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

fix1

parent aea9d38f
No related branches found
No related tags found
No related merge requests found
...@@ -455,13 +455,13 @@ async function checkAnniv() { ...@@ -455,13 +455,13 @@ async function checkAnniv() {
} }
} }
function verifyMcChatWebhook(){ async function verifyMcChatWebhook(){
let mcChatWebhookId = botSettings.findOne({ where: { name: "mcChatWebhookId" } }); let mcChatWebhookId = await botSettings.findOne({ where: { name: "mcChatWebhookId" } });
if(mcChatWebhookId != null){ if(mcChatWebhookId != null){
console.log("[" + 'INFO'.yellow + "] Le Webhook du serveur MC est déjà configuré."); console.log("[" + 'INFO'.yellow + "] Le Webhook du serveur MC est déjà configuré.");
let mcChatWebhookToken = botSettings.findOne({ where: { name: "mcChatWebhookToken" } }); let mcChatWebhookToken = await botSettings.findOne({ where: { name: "mcChatWebhookToken" } });
if(mcChatWebhookToken){ if(mcChatWebhookToken){
mcChatWebhook = new client.WebhookClient({ id: mcChatWebhookId.value, token: mcChatWebhookToken.value }); mcChatWebhook = new WebhookClient({ id: mcChatWebhookId.value, token: mcChatWebhookToken.value });
}else{ }else{
console.log("[" + 'ERREUR'.brightRed + "] Impossible de trouver le token du webhook dans la base de donnée."); console.log("[" + 'ERREUR'.brightRed + "] Impossible de trouver le token du webhook dans la base de donnée.");
createMcChatWebhook(); createMcChatWebhook();
...@@ -471,7 +471,7 @@ function verifyMcChatWebhook(){ ...@@ -471,7 +471,7 @@ function verifyMcChatWebhook(){
} }
} }
function createMcChatWebhook(){ async function createMcChatWebhook(){
console.log("[" + 'INFO'.yellow + "] Création du Webhook du serveur MC."); console.log("[" + 'INFO'.yellow + "] Création du Webhook du serveur MC.");
client.channels.cache.get(config.get("CANAL_CHAT_MC")).createWebhook('Chat Serveur Minecraft', { client.channels.cache.get(config.get("CANAL_CHAT_MC")).createWebhook('Chat Serveur Minecraft', {
avatar: 'https://sl-craft.fr/data/images/logo/short-color.png', avatar: 'https://sl-craft.fr/data/images/logo/short-color.png',
...@@ -485,7 +485,7 @@ function createMcChatWebhook(){ ...@@ -485,7 +485,7 @@ function createMcChatWebhook(){
name: "mcChatWebhookToken", name: "mcChatWebhookToken",
value: webhook.token value: webhook.token
}); });
mcChatWebhook = new client.WebhookClient({ id: mcChatWebhookId.value, token: mcChatWebhookToken.value }); mcChatWebhook = new WebhookClient({ id: mcChatWebhookId.value, token: mcChatWebhookToken.value });
console.log("[" + 'INFO'.yellow + "] Le Webhook du serveur MC a été configuré avec succès."); console.log("[" + 'INFO'.yellow + "] Le Webhook du serveur MC a été configuré avec succès.");
}) })
.catch(console.error); .catch(console.error);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment