aboutsummaryrefslogtreecommitdiff
path: root/src/commands/fun
diff options
context:
space:
mode:
authorIRONM00N <64110067+IRONM00N@users.noreply.github.com>2022-06-14 12:47:57 -0400
committerIRONM00N <64110067+IRONM00N@users.noreply.github.com>2022-06-14 12:47:57 -0400
commit661e4c9935aeb8760dafc7ced4bbec6cc356a033 (patch)
treebb4c12bdef067d203f100e13e05ccb705b299834 /src/commands/fun
parenteaf592b72eb5b1d66aa2bde5151a8947570a506c (diff)
downloadtanzanite-661e4c9935aeb8760dafc7ced4bbec6cc356a033.tar.gz
tanzanite-661e4c9935aeb8760dafc7ced4bbec6cc356a033.tar.bz2
tanzanite-661e4c9935aeb8760dafc7ced4bbec6cc356a033.zip
remove the war crimes that I previously committed
- Remove custom typings and replace with declaration merging - Fix the typings for args - Replace all discord-api-types imports with discord.js imports - Fix discord.js breaking changes
Diffstat (limited to 'src/commands/fun')
-rw-r--r--src/commands/fun/coinFlip.ts4
-rw-r--r--src/commands/fun/dice.ts4
-rw-r--r--src/commands/fun/eightBall.ts4
-rw-r--r--src/commands/fun/minesweeper.ts24
4 files changed, 20 insertions, 16 deletions
diff --git a/src/commands/fun/coinFlip.ts b/src/commands/fun/coinFlip.ts
index b0805cd..fea5cb5 100644
--- a/src/commands/fun/coinFlip.ts
+++ b/src/commands/fun/coinFlip.ts
@@ -1,4 +1,4 @@
-import { BushCommand, type BushMessage, type BushSlashMessage } from '#lib';
+import { BushCommand, type CommandMessage, type SlashMessage } from '#lib';
export default class CoinFlipCommand extends BushCommand {
public constructor() {
@@ -14,7 +14,7 @@ export default class CoinFlipCommand extends BushCommand {
});
}
- public override async exec(message: BushMessage | BushSlashMessage) {
+ public override async exec(message: CommandMessage | SlashMessage) {
const random = Math.random();
let result: string;
const fall = message.author.id === '322862723090219008' ? 0.1 : 0.001; //dw about it
diff --git a/src/commands/fun/dice.ts b/src/commands/fun/dice.ts
index 53fc9e2..b2bc7e4 100644
--- a/src/commands/fun/dice.ts
+++ b/src/commands/fun/dice.ts
@@ -1,4 +1,4 @@
-import { BushCommand, type BushMessage, type BushSlashMessage } from '#lib';
+import { BushCommand, type CommandMessage, type SlashMessage } from '#lib';
export default class DiceCommand extends BushCommand {
public constructor() {
@@ -14,7 +14,7 @@ export default class DiceCommand extends BushCommand {
});
}
- public override async exec(message: BushMessage | BushSlashMessage) {
+ public override async exec(message: CommandMessage | SlashMessage) {
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
index ff06fe5..66fcc45 100644
--- a/src/commands/fun/eightBall.ts
+++ b/src/commands/fun/eightBall.ts
@@ -1,4 +1,4 @@
-import { BushCommand, type BushMessage, type BushSlashMessage } from '#lib';
+import { BushCommand, type CommandMessage, type SlashMessage } from '#lib';
import { ApplicationCommandOptionType } from 'discord.js';
export default class EightBallCommand extends BushCommand {
@@ -26,7 +26,7 @@ export default class EightBallCommand extends BushCommand {
});
}
- public override async exec(message: BushMessage | BushSlashMessage) {
+ public override async exec(message: CommandMessage | SlashMessage) {
const responses = [
'It is certain',
'Without a doubt',
diff --git a/src/commands/fun/minesweeper.ts b/src/commands/fun/minesweeper.ts
index 72551e9..d25cb5d 100644
--- a/src/commands/fun/minesweeper.ts
+++ b/src/commands/fun/minesweeper.ts
@@ -1,4 +1,4 @@
-import { BushCommand, type ArgType, type BushMessage, type BushSlashMessage } from '#lib';
+import { BushCommand, OptArgType, type ArgType, type CommandMessage, type SlashMessage } from '#lib';
import { Minesweeper } from '@notenoughupdates/discord.js-minesweeper';
import assert from 'assert';
import { ApplicationCommandOptionType } from 'discord.js';
@@ -53,10 +53,10 @@ export default class MinesweeperCommand extends BushCommand {
optional: true
},
{
- id: 'do_not_reveal_first_cell',
+ id: 'no_reveal',
description: 'Whether to not reveal the first cell automatically.',
match: 'flag',
- flag: ['--doNotRevealFirstCell', 'do_not_reveal_first_cell'],
+ flag: ['--noReveal', '--no_reveal', '--doNotRevealFirstCell', 'do_not_reveal_first_cell'],
prompt: 'Would you like to not automatically reveal the first cell?',
slashType: ApplicationCommandOptionType.Boolean,
optional: true
@@ -69,20 +69,24 @@ export default class MinesweeperCommand extends BushCommand {
}
public override async exec(
- message: BushMessage | BushSlashMessage,
+ message: CommandMessage | SlashMessage,
args: {
- rows: ArgType<'integer'>;
- columns: ArgType<'integer'>;
- mines: ArgType<'integer'>;
- spaces: boolean;
- do_not_reveal_first_cell: boolean;
+ rows: OptArgType<'integer'>;
+ columns: OptArgType<'integer'>;
+ mines: OptArgType<'integer'>;
+ spaces: ArgType<'flag'>;
+ no_reveal: ArgType<'flag'>;
}
) {
+ args.rows ??= 9;
+ args.columns ??= 9;
+ args.mines ??= 10;
+
const minesweeper = new Minesweeper({
rows: args.rows,
columns: args.columns,
mines: args.mines,
- revealFirstCell: args.do_not_reveal_first_cell ? false : true,
+ revealFirstCell: args.no_reveal ? false : true,
spaces: args.spaces ?? false,
zeroFirstCell: false
});