don't actually crash

This commit is contained in:
loicbersier 2019-08-12 14:05:39 +02:00
parent 8166a16a17
commit 4ab1eb3a2d

View file

@ -40,9 +40,10 @@ class fakebotCommand extends Command {
if (err) { if (err) {
console.log(err); console.log(err);
} }
return message.channel.send('Please run me again to send the message!');
}); });
}); });
} } else {
let webhook = require(`../../webhook/${message.guild.id}.json`); let webhook = require(`../../webhook/${message.guild.id}.json`);
this.client.fetchWebhook(webhook.id, webhook.token) this.client.fetchWebhook(webhook.id, webhook.token)
.then(webhook => { .then(webhook => {
@ -50,9 +51,16 @@ class fakebotCommand extends Command {
name: args.member.username, name: args.member.username,
avatar: args.member.displayAvatarURL() avatar: args.member.displayAvatarURL()
}); });
webhook.edit({
name: args.member.username,
avatar: args.member.displayAvatarURL()
});
message.delete(); message.delete();
return webhook.send(args.message); return webhook.send(args.message);
}); });
} }
}
} }
module.exports = fakebotCommand; module.exports = fakebotCommand;