diff options
author | IRONM00N <64110067+IRONM00N@users.noreply.github.com> | 2021-07-14 21:22:09 -0400 |
---|---|---|
committer | IRONM00N <64110067+IRONM00N@users.noreply.github.com> | 2021-07-14 21:22:09 -0400 |
commit | 53d2b18f7f73d5696fb7cd86d1c164a790dfdcc3 (patch) | |
tree | f95f23aad382879b35860d4d3be3642068fac8a2 /src/commands/fun/coinflip.ts | |
parent | eaaae08aeee1fa16a4e1ad0b26fceb42885bfcde (diff) | |
download | tanzanite-53d2b18f7f73d5696fb7cd86d1c164a790dfdcc3.tar.gz tanzanite-53d2b18f7f73d5696fb7cd86d1c164a790dfdcc3.tar.bz2 tanzanite-53d2b18f7f73d5696fb7cd86d1c164a790dfdcc3.zip |
started moving over some other commands
Diffstat (limited to 'src/commands/fun/coinflip.ts')
-rw-r--r-- | src/commands/fun/coinflip.ts | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/src/commands/fun/coinflip.ts b/src/commands/fun/coinflip.ts new file mode 100644 index 0000000..68484bb --- /dev/null +++ b/src/commands/fun/coinflip.ts @@ -0,0 +1,26 @@ +import { BushCommand, BushMessage, BushSlashMessage } from '@lib'; + +export default class CoinFlipCommand extends BushCommand { + public constructor() { + super('coinflip', { + aliases: ['coinflip', 'cf'], + category: 'fun', + description: { + content: 'Flip a virtual coin.', + usage: 'coinflip', + examples: ['coinflip'] + }, + clientPermissions: ['SEND_MESSAGES'] + }); + } + + public async exec(message: BushMessage | BushSlashMessage): Promise<void> { + const random = Math.random(); + let result: string; + const fall = message.author.id === '322862723090219008' ? 0.1 : 0.001; + if (random < fall) result = 'The coin fell off the table :('; + else if (random <= 0.5 + fall / 2) result = 'Heads'; + else result = 'Tails'; + await message.util.reply(result); + } +} |