aboutsummaryrefslogtreecommitdiff
path: root/src/commands/fun
diff options
context:
space:
mode:
authorIRONM00N <64110067+IRONM00N@users.noreply.github.com>2021-07-14 21:22:09 -0400
committerIRONM00N <64110067+IRONM00N@users.noreply.github.com>2021-07-14 21:22:09 -0400
commit53d2b18f7f73d5696fb7cd86d1c164a790dfdcc3 (patch)
treef95f23aad382879b35860d4d3be3642068fac8a2 /src/commands/fun
parenteaaae08aeee1fa16a4e1ad0b26fceb42885bfcde (diff)
downloadtanzanite-53d2b18f7f73d5696fb7cd86d1c164a790dfdcc3.tar.gz
tanzanite-53d2b18f7f73d5696fb7cd86d1c164a790dfdcc3.tar.bz2
tanzanite-53d2b18f7f73d5696fb7cd86d1c164a790dfdcc3.zip
started moving over some other commands
Diffstat (limited to 'src/commands/fun')
-rw-r--r--src/commands/fun/coinflip.ts26
-rw-r--r--src/commands/fun/dice.ts23
-rw-r--r--src/commands/fun/eightBall.ts64
-rw-r--r--src/commands/fun/minesweeper.ts123
4 files changed, 236 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);
+ }
+}
diff --git a/src/commands/fun/dice.ts b/src/commands/fun/dice.ts
new file mode 100644
index 0000000..46b159b
--- /dev/null
+++ b/src/commands/fun/dice.ts
@@ -0,0 +1,23 @@
+import { BushCommand, BushMessage, BushSlashMessage } from '@lib';
+
+export default class EightBallCommand extends BushCommand {
+ public constructor() {
+ super('dice', {
+ aliases: ['dice', 'die'],
+ category: 'fun',
+ description: {
+ content: 'Roll virtual dice.',
+ usage: 'dice',
+ examples: ['dice']
+ },
+ clientPermissions: ['SEND_MESSAGES'],
+ slash: true
+ });
+ }
+
+ public async exec(message: BushMessage | BushSlashMessage): Promise<unknown> {
+ const responses = ['1', '2', '3', '4', '5', '6'];
+ const answer = responses[Math.floor(Math.random() * responses.length)];
+ return await message.util.reply(`You rolled a **${answer}**.`);
+ }
+}
diff --git a/src/commands/fun/eightBall.ts b/src/commands/fun/eightBall.ts
new file mode 100644
index 0000000..7b7d39c
--- /dev/null
+++ b/src/commands/fun/eightBall.ts
@@ -0,0 +1,64 @@
+import { BushCommand, BushMessage, BushSlashMessage } from '../../lib';
+
+export default class EightBallCommand extends BushCommand {
+ public constructor() {
+ super('eightBall', {
+ aliases: ['8ball', 'eightball'],
+ category: 'fun',
+ description: {
+ content: 'Ask questions for a randomly generated response.',
+ usage: '8Ball <question>',
+ examples: ['8Ball does anyone love me?']
+ },
+ args: [
+ {
+ id: 'question',
+ type: 'string',
+ match: 'rest',
+ prompt: {
+ start: 'What question would you like answered?',
+ retry: '{error} Invalid question.'
+ }
+ }
+ ],
+ slash: true,
+ slashOptions: [
+ {
+ name: 'question',
+ description: 'What question would you like answered?',
+ type: 'STRING',
+ required: true
+ }
+ ],
+ clientPermissions: ['SEND_MESSAGES'],
+ userPermissions: ['SEND_MESSAGES']
+ });
+ }
+
+ public async exec(message: BushMessage | BushSlashMessage): Promise<void> {
+ const responses = [
+ 'It is certain',
+ 'Without a doubt',
+ 'You may rely on it',
+ 'Yes definitely',
+ 'It is decidedly so',
+ 'As I see it, yes',
+ 'Most likely',
+ 'Yes',
+ 'Outlook good',
+ 'Signs point to yes',
+ 'Reply hazy try again',
+ 'Better not tell you now',
+ 'Ask again later',
+ 'Cannot predict now',
+ 'Concentrate and ask again',
+ "Don't count on it",
+ 'Outlook not so good',
+ 'My sources say no',
+ 'Very doubtful',
+ 'My reply is no'
+ ];
+ const answer = responses[Math.floor(Math.random() * responses.length)];
+ await message.util.reply(answer);
+ }
+}
diff --git a/src/commands/fun/minesweeper.ts b/src/commands/fun/minesweeper.ts
new file mode 100644
index 0000000..2b46e34
--- /dev/null
+++ b/src/commands/fun/minesweeper.ts
@@ -0,0 +1,123 @@
+import { BushCommand, BushMessage, BushSlashMessage } from '@lib';
+import Minesweeper from 'discord.js-minesweeper';
+
+export default class MinesweeperCommand extends BushCommand {
+ public constructor() {
+ super('minesweeper', {
+ aliases: ['minesweeper'],
+ category: 'fun',
+ description: {
+ content: 'minesweeper command.',
+ usage: 'minesweeper <rows> <columns> <mines> [--spaces] [--revealFirstCell]',
+ examples: ['minesweeper 10 10 2']
+ },
+ args: [
+ {
+ id: 'rows',
+ type: 'integer',
+ prompt: {
+ start: 'How many rows would you like?',
+ retry: '{error} Choose a valid number of rows',
+ optional: true
+ },
+ default: 9
+ },
+ {
+ id: 'columns',
+ type: 'integer',
+ prompt: {
+ start: 'How many columns would you like?',
+ retry: '{error} Choose a valid number of columns',
+ optional: true
+ },
+ default: 9
+ },
+ {
+ id: 'mines',
+ type: 'integer',
+ prompt: {
+ start: 'How many mines would you like?',
+ retry: '{error} Choose a valid number of mines',
+ optional: true
+ },
+ default: 10
+ },
+ {
+ id: 'spaces',
+ match: 'flag',
+ flag: '--spaces'
+ },
+ {
+ id: 'reveal_first_cell',
+ match: 'flag',
+ flag: '--revealFirstCell'
+ }
+ ],
+ slash: true,
+ slashOptions: [
+ {
+ name: 'rows',
+ description: 'How many rows would you like?',
+ type: 'INTEGER',
+ required: false
+ },
+ {
+ name: 'columns',
+ description: 'How many rows would you like?',
+ type: 'INTEGER',
+ required: false
+ },
+ {
+ name: 'mines',
+ description: 'How many rows would you like?',
+ type: 'INTEGER',
+ required: false
+ },
+ {
+ name: 'spaces',
+ description: 'Would you like there to be spaces?',
+ type: 'BOOLEAN',
+ required: false
+ },
+ {
+ name: 'reveal_first_cell',
+ description: 'Would you like to automatically reveal the first cell?',
+ type: 'BOOLEAN',
+ required: false
+ }
+ ],
+ clientPermissions: ['SEND_MESSAGES'],
+ userPermissions: ['SEND_MESSAGES']
+ });
+ }
+
+ public async exec(
+ message: BushMessage | BushSlashMessage,
+ {
+ rows,
+ columns,
+ mines,
+ spaces,
+ reveal_first_cell
+ }: {
+ rows: number;
+ columns: number;
+ mines: number;
+ spaces: boolean;
+ reveal_first_cell: boolean;
+ }
+ ): Promise<unknown> {
+ const minesweeper = new Minesweeper({
+ rows: rows ?? 9,
+ columns: columns ?? 9,
+ mines: mines ?? 10,
+ emote: 'boom',
+ revealFirstCell: reveal_first_cell ?? false,
+ zeroFirstCell: true,
+ spaces: spaces ?? false,
+ returnType: 'emoji'
+ });
+ const matrix = minesweeper.start();
+ return await message.util.reply(matrix.toString());
+ }
+}