refact(webhook): corrige integracao do webhook e trata erros de cookies
- Migra arquivos de webhook de TS para JS - Corrige imports quebrados e destructuring de SendMessageWebhook e ErrorType - Trata arquivo cookies.json vazio/invalido com try/catch - Corrige digitação de porcentagemPromo no ProductEntity - Envia eventos de sucesso para busca_produto e erros para error_busca
This commit is contained in:
18
webhook/webhook.js
Normal file
18
webhook/webhook.js
Normal file
@@ -0,0 +1,18 @@
|
||||
const { Webhook } = require('discord-webhook-node');
|
||||
|
||||
|
||||
function SendMessageWebhook(title, description, webhookUrl) {
|
||||
let url = webhookUrl;
|
||||
let content = `**${title}**\n${description}`;
|
||||
|
||||
if (!url) {
|
||||
// Fallback for 2 arguments: SendMessageWebhook(content, url)
|
||||
url = description;
|
||||
content = title;
|
||||
}
|
||||
|
||||
const hook = new Webhook(url);
|
||||
hook.send(content);
|
||||
}
|
||||
|
||||
module.exports = SendMessageWebhook;
|
||||
Reference in New Issue
Block a user