Files
xiao/commands/games/slots.js
T
Daniel Odendahl Jr bcaa91c367 Destructuring is Nice
2017-04-11 03:51:10 +00:00

31 lines
1.3 KiB
JavaScript

const { Command } = require('discord.js-commando');
module.exports = class SlotsCommand extends Command {
constructor(client) {
super(client, {
name: 'slots',
group: 'games',
memberName: 'slots',
description: 'Play slots. (;slots)',
examples: [';slots']
});
}
run(message) {
if (message.channel.type !== 'dm') {
if (!message.channel.permissionsFor(this.client.user).hasPermission(['SEND_MESSAGES', 'READ_MESSAGES'])) return;
}
const slotThing = [':grapes:', ':tangerine:', ':pear:', ':cherries:'];
const slotOne = slotThing[Math.floor(Math.random() * slotThing.length)];
const slotTwo = slotThing[Math.floor(Math.random() * slotThing.length)];
const slotThree = slotThing[Math.floor(Math.random() * slotThing.length)];
const slotFour = slotThing[Math.floor(Math.random() * slotThing.length)];
if (slotOne === slotTwo && slotOne === slotThree && slotOne === slotFour) {
return message.say(`${slotOne}|${slotTwo}|${slotThree}|${slotFour}\nWow! You won! Great job... er... luck!`);
}
else {
return message.say(`${slotOne}|${slotTwo}|${slotThree}|${slotFour}\nAww... You lost... Guess it's just bad luck, huh?`);
}
}
};