diff options
Diffstat (limited to 'server/src/commands/minigames')
| -rw-r--r-- | server/src/commands/minigames/8Ball.ts | 31 | ||||
| -rw-r--r-- | server/src/commands/minigames/Coinflip.ts | 50 | ||||
| -rw-r--r-- | server/src/commands/minigames/RollDie.ts | 29 | ||||
| -rw-r--r-- | server/src/commands/minigames/RussianRoulette.ts | 27 |
4 files changed, 137 insertions, 0 deletions
diff --git a/server/src/commands/minigames/8Ball.ts b/server/src/commands/minigames/8Ball.ts new file mode 100644 index 0000000..2ff3904 --- /dev/null +++ b/server/src/commands/minigames/8Ball.ts @@ -0,0 +1,31 @@ +import { Command } from 'discord-akairo'; +import { Message } from 'discord.js'; +import * as EightBallResponses from '../../json/8ball.json' +import { colour } from '../../Config'; + +export default class EightBallMinigames extends Command { + public constructor() { + super('8ball', { + aliases: ['8ball', '8b', '8-ball', '8-b'], + category: 'minigames', + description: { + content: 'Shake the magic 8 Ball for a fortune!', + usage: '[question]', + examples: [ + 'will I ever get married?' + ] + }, + ratelimit: 3 + }); + } + + public exec(msg: Message): Promise<Message> { + let randomResponse = EightBallResponses.standard[Math.floor(Math.random() * EightBallResponses.standard.length)]; + const embed = this.client.util.embed() + .setColor(colour) + .setAuthor('The 8-ball says', + 'https://upload.wikimedia.org/wikipedia/commons/thumb/f/fd/8-Ball_Pool.svg/500px-8-Ball_Pool.svg.png') + .setDescription(`\`${randomResponse}\``); + return msg.channel.send(embed); + } +}
\ No newline at end of file diff --git a/server/src/commands/minigames/Coinflip.ts b/server/src/commands/minigames/Coinflip.ts new file mode 100644 index 0000000..1962b00 --- /dev/null +++ b/server/src/commands/minigames/Coinflip.ts @@ -0,0 +1,50 @@ +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<Message> { + 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); + } +}
\ No newline at end of file diff --git a/server/src/commands/minigames/RollDie.ts b/server/src/commands/minigames/RollDie.ts new file mode 100644 index 0000000..8631874 --- /dev/null +++ b/server/src/commands/minigames/RollDie.ts @@ -0,0 +1,29 @@ +import { Command } from 'discord-akairo'; +import { Message } from 'discord.js'; +import { colour } from '../../Config'; + +export default class RollDieMinigames extends Command { + public constructor() { + super('rolldie', { + aliases: ['rolldie', 'rolldice', 'roll-die', 'roll-dice'], + category: 'minigames', + description: { + content: 'Roll a die.', + usage: '', + examples: [ + '' + ] + }, + ratelimit: 3 + }); + } + + public exec(msg: Message): Promise<Message> { + const sides = [1, 2, 3, 4, 5, 6]; + const embed = this.client.util.embed() + .setColor(colour) + .setAuthor('The die landed on', 'https://i.imgur.com/dK18NpV.png') + .setDescription(`\`${sides[Math.floor(Math.random() * sides.length)]}\``); + return msg.channel.send(embed); + } +}
\ No newline at end of file diff --git a/server/src/commands/minigames/RussianRoulette.ts b/server/src/commands/minigames/RussianRoulette.ts new file mode 100644 index 0000000..c52a4c8 --- /dev/null +++ b/server/src/commands/minigames/RussianRoulette.ts @@ -0,0 +1,27 @@ +import { Command } from 'discord-akairo'; +import { Message } from 'discord.js'; + +export default class RussianRouletteMinigames extends Command { + public constructor() { + super('russianroulette', { + aliases: ['russianroulette', 'rr'], + category: 'minigames', + description: { + content: 'Play a round of Russian Roulette.', + usage: '', + examples: [ + '' + ] + }, + ratelimit: 3 + }); + } + + public exec(msg: Message): Promise<Message> { + const chamber = Math.floor(Math.random() * 6); + if (chamber === 0) + return msg.reply('💥 *Bang.* You lose.'); + else + return msg.reply("🔫 *Click.* You survived."); + } +}
\ No newline at end of file |