From 1316d8d8a7589105e98564e625d3e2c0f897cd0b Mon Sep 17 00:00:00 2001 From: SofianeLasri <alasri250@gmail.com> Date: Sat, 9 Jul 2022 15:41:42 +0200 Subject: [PATCH] =?UTF-8?q?ajout=20d'une=20v=C3=A9rification=20suppl=C3=A9?= =?UTF-8?q?mentaire=20pour=20le=20webhook=20de=20dev?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- index.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/index.js b/index.js index 2e9961a..03c0bfc 100644 --- a/index.js +++ b/index.js @@ -593,11 +593,16 @@ async function checkAnniv() { async function verifyMcChatWebhook() { let mcChatWebhookId = await botSettings.findOne({ where: { name: "mcChatWebhookId" } }); - if (mcChatWebhookId != null) { + let devMcChatWebhookId = await botSettings.findOne({ where: { name: "devMcChatWebhookId" } }); + + if (mcChatWebhookId != null && devMcChatWebhookId != null) { console.log("[" + 'INFO'.yellow + "] Le Webhook du serveur MC est déjà configuré."); let mcChatWebhookToken = await botSettings.findOne({ where: { name: "mcChatWebhookToken" } }); - if (mcChatWebhookToken) { + let devMcChatWebhookToken = await botSettings.findOne({ where: { name: "devMcChatWebhookToken" } }); + + if (mcChatWebhookToken != null && devMcChatWebhookToken != null) { mcChatWebhook = new WebhookClient({ id: mcChatWebhookId.value, token: mcChatWebhookToken.value }); + devMcChatWebhook = new WebhookClient({ id: devMcChatWebhookId.value, token: devMcChatWebhookToken.value }); } else { console.log("[" + 'ERREUR'.brightRed + "] Impossible de trouver le token du webhook dans la base de donnée."); createMcChatWebhook(); -- GitLab