Skip to content
Snippets Groups Projects
Commit 3ba04fe6 authored by Sofiane Lasri's avatar Sofiane Lasri
Browse files

test

parent 0c82a9a2
No related branches found
No related tags found
No related merge requests found
......@@ -461,7 +461,9 @@ async function verifyMcChatWebhook(){
console.log("[" + 'INFO'.yellow + "] Le Webhook du serveur MC est déjà configuré.");
let mcChatWebhookToken = await botSettings.findOne({ where: { name: "mcChatWebhookToken" } });
if(mcChatWebhookToken){
mcChatWebhook = new WebhookClient({ id: mcChatWebhookId.value, token: mcChatWebhookToken.value });
mcChatWebhook = client.fetchWebhook(mcChatWebhookId.value, mcChatWebhookToken.value)
.then(webhook => console.log("[" + 'INFO'.yellow + "] Webhook " + webhook.name + " trouvé."))
.catch(console.error);
}else{
console.log("[" + 'ERREUR'.brightRed + "] Impossible de trouver le token du webhook dans la base de donnée.");
createMcChatWebhook();
......@@ -485,7 +487,9 @@ async function createMcChatWebhook(){
name: "mcChatWebhookToken",
value: webhook.token
});
mcChatWebhook = new WebhookClient({ id: mcChatWebhookId.value, token: mcChatWebhookToken.value });
mcChatWebhook = client.fetchWebhook(mcChatWebhookId.value, mcChatWebhookToken.value)
.then(webhook => console.log("[" + 'INFO'.yellow + "] Webhook " + webhook.name + " trouvé."))
.catch(console.error);
console.log("[" + 'INFO'.yellow + "] Le Webhook du serveur MC a été configuré avec succès.");
})
.catch(console.error);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment