mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-03 23:36:43 +02:00
41 lines
1.2 KiB
JavaScript
41 lines
1.2 KiB
JavaScript
const Command = require('../../framework/Command');
|
|
const { stripIndents } = require('common-tags');
|
|
const slots = ['🍇', '🍊', '🍐', '🍒', '🍋', '🍌', '🔔'];
|
|
|
|
module.exports = class SlotsCommand extends Command {
|
|
constructor(client) {
|
|
super(client, {
|
|
name: 'slots',
|
|
group: 'games-sp',
|
|
memberName: 'slots',
|
|
description: 'Play a game of slots.'
|
|
});
|
|
}
|
|
|
|
run(msg) {
|
|
const slotOne = Math.floor(Math.random() * slots.length);
|
|
const slotTwo = Math.floor(Math.random() * slots.length);
|
|
const slotThree = Math.floor(Math.random() * slots.length);
|
|
return msg.say(stripIndents`
|
|
**[ 🎰 | SLOTS ]**
|
|
------------------
|
|
${this.wrapSlots(slotOne, false)} : ${this.wrapSlots(slotTwo, false)} : ${this.wrapSlots(slotThree, false)}
|
|
|
|
${slots[slotOne]} : ${slots[slotTwo]} : ${slots[slotThree]} **<**
|
|
|
|
${this.wrapSlots(slotOne, true)} : ${this.wrapSlots(slotTwo, true)} : ${this.wrapSlots(slotThree, true)}
|
|
------------------
|
|
| : : : **${slotOne === slotTwo && slotOne === slotThree ? 'WIN!' : 'LOST'}** : : : |
|
|
`);
|
|
}
|
|
|
|
wrapSlots(slot, add) {
|
|
if (add) {
|
|
if (slot + 1 > slots.length - 1) return slots[0];
|
|
return slots[slot + 1];
|
|
}
|
|
if (slot - 1 < 0) return slots[slots.length - 1];
|
|
return slots[slot - 1];
|
|
}
|
|
};
|