diff --git a/src/bot/commands/games/coin-flip.ts b/src/bot/commands/games/coin-flip.ts new file mode 100644 index 0000000..e46582e --- /dev/null +++ b/src/bot/commands/games/coin-flip.ts @@ -0,0 +1,23 @@ +import { CommandoMessage } from 'discord.js-commando' +import { Command } from '../../base' +import { Client } from '../../models' + +export default class DiceRollCommand extends Command { + constructor(client: Client) { + super(client, { + name: 'flip', + group: 'games', + memberName: 'flip', + description: 'Flip a coin.', + guildOnly: false, + throttling: { + usages: 2, + duration: 3 + }, + }) + } + + public async run(msg: CommandoMessage) { + return msg.reply(Math.floor(Math.random() * 10) % 2 == 0 ? 'Heads!' : 'Tails!') + } +} diff --git a/src/bot/commands/games/rng.ts b/src/bot/commands/games/rng.ts new file mode 100644 index 0000000..3a24c66 --- /dev/null +++ b/src/bot/commands/games/rng.ts @@ -0,0 +1,36 @@ +import { CommandoMessage } from 'discord.js-commando' +import { Command } from '../../base' +import { Client } from '../../models' + +export default class RngCommand extends Command { + constructor(client: Client) { + super(client, { + name: 'rng', + group: 'games', + memberName: 'rng', + description: 'Generate a random positive integer.', + guildOnly: false, + throttling: { + usages: 2, + duration: 3 + }, + args: [ + { + key: 'max', + prompt: 'What is the highest number to generate?\n', + type: 'integer' + } + ] + }) + } + + public async run(msg: CommandoMessage, args: {max: number}) { + if (args.max < 1) { + return msg.reply( + 'The max must be greater than 0.' + ) + } + + return msg.reply(Math.floor(Math.random() * args.max)) + } +}