From 34fa8e02539b300312103a27d965a3b2de557ae9 Mon Sep 17 00:00:00 2001 From: IRONM00N <64110067+IRONM00N@users.noreply.github.com> Date: Sat, 1 Jan 2022 17:04:06 -0500 Subject: idk why this didn't get committed --- src/commands/fun/coinFlip.ts | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 src/commands/fun/coinFlip.ts (limited to 'src/commands') diff --git a/src/commands/fun/coinFlip.ts b/src/commands/fun/coinFlip.ts new file mode 100644 index 0000000..b0805cd --- /dev/null +++ b/src/commands/fun/coinFlip.ts @@ -0,0 +1,26 @@ +import { BushCommand, type BushMessage, type BushSlashMessage } from '#lib'; + +export default class CoinFlipCommand extends BushCommand { + public constructor() { + super('coinFlip', { + aliases: ['coin-flip', 'cf'], + category: 'fun', + description: 'Flip a virtual coin.', + usage: ['coinflip'], + examples: ['coinflip'], + clientPermissions: (m) => util.clientSendAndPermCheck(m), + userPermissions: [], + slash: true + }); + } + + public override async exec(message: BushMessage | BushSlashMessage) { + const random = Math.random(); + let result: string; + const fall = message.author.id === '322862723090219008' ? 0.1 : 0.001; //dw about it + 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); + } +} -- cgit