From 661e4c9935aeb8760dafc7ced4bbec6cc356a033 Mon Sep 17 00:00:00 2001 From: IRONM00N <64110067+IRONM00N@users.noreply.github.com> Date: Tue, 14 Jun 2022 12:47:57 -0400 Subject: 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 --- src/commands/fun/minesweeper.ts | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) (limited to 'src/commands/fun/minesweeper.ts') 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 }); -- cgit