Files
xiao/commands/games/slots.js
T
Daniel Odendahl Jr 76907549df The Power of const
2017-04-03 22:31:19 +00:00

32 lines
1.4 KiB
JavaScript

const commando = require('discord.js-commando');
module.exports = class SlotsCommand extends commando.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;
}
console.log(`[Command] ${message.content}`);
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?`);
}
}
};