From f636aa907fd163d5c99ec700b089d773b0f4af6a Mon Sep 17 00:00:00 2001 From: loicbersier Date: Mon, 12 Aug 2019 13:49:43 +0200 Subject: [PATCH] fix crash --- commands/fun/fakebot.js | 22 ++++++++-------------- 1 file changed, 8 insertions(+), 14 deletions(-) diff --git a/commands/fun/fakebot.js b/commands/fun/fakebot.js index bca2df9..a64c094 100644 --- a/commands/fun/fakebot.js +++ b/commands/fun/fakebot.js @@ -40,24 +40,18 @@ class fakebotCommand extends Command { if (err) { console.log(err); } - sendWebhook(this.client); }); }); - } else { - sendWebhook(this.client); } - - function sendWebhook(client) { - let webhook = require(`../../webhook/${message.guild.id}.json`); - client.fetchWebhook(webhook.id, webhook.token) - .then(webhook => { - webhook.edit({ - name: args.member.username, - avatar: args.member.displayAvatarURL() - }); - return webhook.send(args.message); + let webhook = require(`../../webhook/${message.guild.id}.json`); + this.client.fetchWebhook(webhook.id, webhook.token) + .then(webhook => { + webhook.edit({ + name: args.member.username, + avatar: args.member.displayAvatarURL() }); - } + return webhook.send(args.message); + }); } } module.exports = fakebotCommand; \ No newline at end of file