Webhook
This commit is contained in:
@@ -1,7 +1,7 @@
|
|||||||
const ErrorType = {
|
const ErrorType = {
|
||||||
busca_produto: "https://discord.com/api/webhooks/1511503190489825280/JmeEKSpkUtBzhBrUKLE8aOp0W_8aUVpYUktpWonHuynYFOJgKiJp31MRreJpjmwLv868",
|
busca_produto: "https://discord.com/api/webhooks/1511503190489825280/JmeEKSpkUtBzhBrUKLE8aOp0W_8aUVpYUktpWonHuynYFOJgKiJp31MRreJpjmwLv868",
|
||||||
error_busca: "https://discord.com/api/webhooks/1510999432039239832/Vq82_mb0ThlM6Py6KbAF-QPV4r_SPEE5Tvk5vLJadSYdIlKAVUMUdqT_7jcBJV6u2ddl"
|
error_busca: "https://discord.com/api/webhooks/1510999432039239832/Vq82_mb0ThlM6Py6KbAF-QPV4r_SPEE5Tvk5vLJadSYdIlKAVUMUdqT_7jcBJV6u2ddl"
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = ErrorType;
|
module.exports = ErrorType;
|
||||||
@@ -1,18 +1,18 @@
|
|||||||
const { Webhook } = require('discord-webhook-node');
|
const { Webhook } = require('discord-webhook-node');
|
||||||
|
|
||||||
|
|
||||||
function SendMessageWebhook(title, description, webhookUrl) {
|
function SendMessageWebhook(title, description, webhookUrl) {
|
||||||
let url = webhookUrl;
|
let url = webhookUrl;
|
||||||
let content = `**${title}**\n${description}`;
|
let content = `**${title}**\n${description}`;
|
||||||
|
|
||||||
if (!url) {
|
if (!url) {
|
||||||
// Fallback for 2 arguments: SendMessageWebhook(content, url)
|
// Fallback for 2 arguments: SendMessageWebhook(content, url)
|
||||||
url = description;
|
url = description;
|
||||||
content = title;
|
content = title;
|
||||||
}
|
}
|
||||||
|
|
||||||
const hook = new Webhook(url);
|
const hook = new Webhook(url);
|
||||||
hook.send(content);
|
hook.send(content);
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = SendMessageWebhook;
|
module.exports = SendMessageWebhook;
|
||||||
Reference in New Issue
Block a user