fixed despacito normal behaviour
This commit is contained in:
parent
5618e2470f
commit
8d271be6a3
1 changed files with 11 additions and 12 deletions
|
@ -22,6 +22,15 @@ module.exports = class DespacitoCommand extends Command {
|
||||||
}
|
}
|
||||||
|
|
||||||
async run(message, { user }) {
|
async run(message, { user }) {
|
||||||
|
if (!user) {
|
||||||
|
const number = Object.keys(responseObject).length;
|
||||||
|
const despacitoNumber = Math.floor (Math.random() * (number - 1 + 1)) + 1;
|
||||||
|
return message.channel.send({files: [responseObject[despacitoNumber]]});
|
||||||
|
} else if (user.id === message.author.id) {
|
||||||
|
return message.say(`Did you just try to despacitoad yourself?`);
|
||||||
|
} else if (user.id === this.client.user.id) {
|
||||||
|
return message.say('Nice try but you wont get me :^)');
|
||||||
|
} else {
|
||||||
const canvas = createCanvas(660, 660);
|
const canvas = createCanvas(660, 660);
|
||||||
const ctx = canvas.getContext('2d');
|
const ctx = canvas.getContext('2d');
|
||||||
const background = await loadImage(user.avatarURL);
|
const background = await loadImage(user.avatarURL);
|
||||||
|
@ -31,16 +40,6 @@ module.exports = class DespacitoCommand extends Command {
|
||||||
ctx.drawImage(bg, 0, 0, canvas.width, canvas.height);
|
ctx.drawImage(bg, 0, 0, canvas.width, canvas.height);
|
||||||
const attachment = new Discord.Attachment(canvas.toBuffer(), 'despacito.png');
|
const attachment = new Discord.Attachment(canvas.toBuffer(), 'despacito.png');
|
||||||
|
|
||||||
if (!user) {
|
|
||||||
const number = Object.keys(responseObject).length;
|
|
||||||
const despacitoNumber = Math.floor (Math.random() * (number - 1 + 1)) + 1;
|
|
||||||
if (!user)
|
|
||||||
return message.channel.send({files: [responseObject[despacitoNumber]]});
|
|
||||||
} else if (user.id === message.author.id) {
|
|
||||||
return message.say(`Did you just try to despacitoad yourself?`);
|
|
||||||
} else if (user.id === this.client.user.id) {
|
|
||||||
return message.say('Nice try but you wont get me :^)');
|
|
||||||
} else {
|
|
||||||
message.delete();
|
message.delete();
|
||||||
message.say(`${user}, you have been despacitoad`, attachment);
|
message.say(`${user}, you have been despacitoad`, attachment);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue