mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-03 23:36:43 +02:00
40 lines
935 B
JavaScript
40 lines
935 B
JavaScript
const Command = require('../../framework/Command');
|
|
const Deck = require('../../structures/cards/Deck');
|
|
|
|
module.exports = class DrawCardsCommand extends Command {
|
|
constructor(client) {
|
|
super(client, {
|
|
name: 'draw-cards',
|
|
aliases: ['draw-hand'],
|
|
group: 'random-res',
|
|
description: 'Draws a random hand of playing cards.',
|
|
flags: [
|
|
{
|
|
key: 'jokers',
|
|
description: 'Includes jokers in the deck.'
|
|
},
|
|
{
|
|
key: 'j',
|
|
description: 'Alias for bot.'
|
|
}
|
|
],
|
|
args: [
|
|
{
|
|
key: 'amount',
|
|
label: 'hand size',
|
|
type: 'integer',
|
|
max: 10,
|
|
min: 1
|
|
}
|
|
]
|
|
});
|
|
}
|
|
|
|
run(msg, { amount, flags }) {
|
|
const deck = new Deck({ includeJokers: Boolean(flags.jokers || flags.j) });
|
|
const cards = deck.draw(amount);
|
|
const display = Array.isArray(cards) ? cards.map(c => c.display).join('\n') : cards.display;
|
|
return msg.reply(`${amount === 1 ? '' : '\n'}${display}`);
|
|
}
|
|
};
|