fix error message

This commit is contained in:
loicbersier 2018-10-14 17:47:25 +02:00
parent 0e9120bf49
commit 425e541c58

View file

@ -25,7 +25,10 @@ module.exports = class DespacitoCommand extends Command {
if (!user) { if (!user) {
const number = Object.keys(responseObject).length; const number = Object.keys(responseObject).length;
const despacitoNumber = Math.floor (Math.random() * (number - 1 + 1)) + 1; const despacitoNumber = Math.floor (Math.random() * (number - 1 + 1)) + 1;
return message.channel.send({files: [responseObject[despacitoNumber]]}); return message.channel.send({files: [responseObject[despacitoNumber]]}).catch(error => {
message.say('an error as occured')
})
} else if (user.id === message.author.id) { } else if (user.id === message.author.id) {
return message.say(`Did you just try to despacitoad yourself?`); return message.say(`Did you just try to despacitoad yourself?`);
} else if (user.id === this.client.user.id) { } else if (user.id === this.client.user.id) {
@ -41,7 +44,9 @@ module.exports = class DespacitoCommand extends Command {
const attachment = new Discord.Attachment(canvas.toBuffer(), 'despacito.png'); const attachment = new Discord.Attachment(canvas.toBuffer(), 'despacito.png');
message.delete(); message.delete();
message.say(`${user}, you have been despacitoad`, attachment); message.say(`${user}, you have been despacitoad`, attachment).catch(error => {
message.say('an error as occured')
})
} }