summaryrefslogtreecommitdiff
path: root/server/src/commands/minigames/Coinflip.ts
diff options
context:
space:
mode:
author8cy <[email protected]>2020-07-23 23:24:17 -0700
committer8cy <[email protected]>2020-07-23 23:24:17 -0700
commitbb511abc03bb66848947e37a999502b813c77269 (patch)
tree612c010fc8317e1cdf11471a18aad0270819d33e /server/src/commands/minigames/Coinflip.ts
parentfix: if clear amount equal or over 100, round down to 99 (diff)
downloaddep-core-bb511abc03bb66848947e37a999502b813c77269.tar.xz
dep-core-bb511abc03bb66848947e37a999502b813c77269.zip
goodbye old uwufier :cry:
Diffstat (limited to 'server/src/commands/minigames/Coinflip.ts')
-rw-r--r--server/src/commands/minigames/Coinflip.ts50
1 files changed, 50 insertions, 0 deletions
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