import { Command } from 'discord-akairo'; import { Message } from 'discord.js'; import { colour } from '../../Config'; export default class CoinflipMinigames extends Command { public constructor() { super('coinflip', { aliases: ['coinflip', 'flipcoin', 'coin-flip', 'flip-coin'], category: 'minigames', description: { content: 'Flip a coin.', usage: '', examples: [ '' ] }, ratelimit: 3, args: [ { id: 'type', type: 'string', prompt: { start: 'What type of coinflip would you like?', retry: 'That is not a valid type', optional: true } } ] }); } public exec(msg: Message, { type }): Promise { let outcomes; let quantum = false; if (type === 'quantum' || type === 'q') { outcomes = ['NaN', '0', 'null', 'undefined', '']; quantum = true; } else { outcomes = ['heads!', 'tails!']; } const side = outcomes[Math.floor(Math.random() * outcomes.length)]; const embed = this.client.util.embed() .setColor(colour) .setAuthor(`The ${quantum ? 'quantum' : ''} coin landed on`, 'https://i.imgur.com/pr7JCce.png') .setDescription(`\`${side}\``); return msg.channel.send(embed); } }