From 4ab1eb3a2df677ac5a96a7da7882d3ebba9b05a2 Mon Sep 17 00:00:00 2001 From: loicbersier Date: Mon, 12 Aug 2019 14:05:39 +0200 Subject: [PATCH] don't actually crash --- commands/fun/fakebot.js | 28 ++++++++++++++++++---------- 1 file changed, 18 insertions(+), 10 deletions(-) diff --git a/commands/fun/fakebot.js b/commands/fun/fakebot.js index 87744050..932bc52a 100644 --- a/commands/fun/fakebot.js +++ b/commands/fun/fakebot.js @@ -40,19 +40,27 @@ class fakebotCommand extends Command { if (err) { console.log(err); } + return message.channel.send('Please run me again to send the 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() + } else { + 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() + }); + + webhook.edit({ + name: args.member.username, + avatar: args.member.displayAvatarURL() + }); + + message.delete(); + return webhook.send(args.message); }); - message.delete(); - return webhook.send(args.message); - }); + } } } module.exports = fakebotCommand; \ No newline at end of file