import { Command, CommandoMessage } from 'discord.js-commando'; import { shuffle } from '../../utils/Util.js' const suits = ['♣', '♥', '♦', '♠'] const faces = ['Jack', 'Queen', 'King'] module.exports = class DrawCardsFun extends Command { constructor(client) { super(client, { name: 'drawcards', aliases: [ 'draw-cards', 'drawhand', 'draw-hand' ], group: 'fun', memberName: 'drawcards', description: 'Draw a hand of playing cards.', examples: ['uwu!drawcards 5'], throttling: { usages: 5, duration: 30 }, userPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], clientPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], args: [ { key: 'aAmount', label: 'hand size', prompt: 'How many cards would you like to draw?', type: 'integer', max: 10, min: 1 }, { key: 'aJokers', prompt: 'Do you want to include jokers in the draw?', type: 'boolean', default: false } ], }); this.deck = null } run(msg: CommandoMessage, { aAmount, aJokers }) { if (!this.deck) this.deck = this.generateDeck() let cards = this.deck if (!aJokers) cards = cards.filter(card => !card.includes('Joker')) return msg.reply(`${aAmount === 1 ? '' : '\n'}${shuffle(cards).slice(0, aAmount).join('\n')}`) } generateDeck() { const deck = [] for (const suit of suits) { deck.push(`${suit} Ace`) for (let i = 2; i <= 10; i++) deck.push(`${suit} ${i}`) for (const face of faces) deck.push(`${suit} ${face}`) } deck.push('⭐ Joker') deck.push('⭐ Joker') return deck } };