diff options
| author | IRONM00N <64110067+IRONM00N@users.noreply.github.com> | 2021-10-21 00:05:53 -0400 |
|---|---|---|
| committer | IRONM00N <64110067+IRONM00N@users.noreply.github.com> | 2021-10-21 00:05:53 -0400 |
| commit | 166d7fdf24440db71311c2cda95697c06e7b8b36 (patch) | |
| tree | 23b0400362b5f3035b156200eb634d202aa54741 /src/commands/fun | |
| parent | 08f33f7d450c8920afc3b9fb8886729547065313 (diff) | |
| download | tanzanite-166d7fdf24440db71311c2cda95697c06e7b8b36.tar.gz tanzanite-166d7fdf24440db71311c2cda95697c06e7b8b36.tar.bz2 tanzanite-166d7fdf24440db71311c2cda95697c06e7b8b36.zip | |
Refactoring, rewrote ButtonPaginator, better permission handling + support for send messages in threads, optimizations, another scam link
Diffstat (limited to 'src/commands/fun')
| -rw-r--r-- | src/commands/fun/coinflip.ts | 5 | ||||
| -rw-r--r-- | src/commands/fun/dice.ts | 3 | ||||
| -rw-r--r-- | src/commands/fun/eightBall.ts | 4 | ||||
| -rw-r--r-- | src/commands/fun/minesweeper.ts | 68 |
4 files changed, 21 insertions, 59 deletions
diff --git a/src/commands/fun/coinflip.ts b/src/commands/fun/coinflip.ts index e0892b7..42e7167 100644 --- a/src/commands/fun/coinflip.ts +++ b/src/commands/fun/coinflip.ts @@ -10,14 +10,15 @@ export default class CoinFlipCommand extends BushCommand { usage: 'coinflip', examples: ['coinflip'] }, - clientPermissions: ['SEND_MESSAGES'] + clientPermissions: (m) => util.clientSendAndPermCheck(m), + userPermissions: [] }); } public override async exec(message: BushMessage | BushSlashMessage): Promise<void> { const random = Math.random(); let result: string; - const fall = message.author.id === '322862723090219008' ? 0.1 : 0.001; + 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'; diff --git a/src/commands/fun/dice.ts b/src/commands/fun/dice.ts index 241f1d2..9f18657 100644 --- a/src/commands/fun/dice.ts +++ b/src/commands/fun/dice.ts @@ -10,7 +10,8 @@ export default class EightBallCommand extends BushCommand { usage: 'dice', examples: ['dice'] }, - clientPermissions: ['SEND_MESSAGES'], + clientPermissions: (m) => util.clientSendAndPermCheck(m), + userPermissions: [], slash: true }); } diff --git a/src/commands/fun/eightBall.ts b/src/commands/fun/eightBall.ts index efaaff5..b3c56da 100644 --- a/src/commands/fun/eightBall.ts +++ b/src/commands/fun/eightBall.ts @@ -30,8 +30,8 @@ export default class EightBallCommand extends BushCommand { required: true } ], - clientPermissions: ['SEND_MESSAGES'], - userPermissions: ['SEND_MESSAGES'] + clientPermissions: (m) => util.clientSendAndPermCheck(m), + userPermissions: [] }); } diff --git a/src/commands/fun/minesweeper.ts b/src/commands/fun/minesweeper.ts index 57909a2..b45dcda 100644 --- a/src/commands/fun/minesweeper.ts +++ b/src/commands/fun/minesweeper.ts @@ -42,43 +42,15 @@ export default class MinesweeperCommand extends BushCommand { }, default: 10 }, - { - id: 'spaces', - match: 'flag', - flag: '--spaces' - }, - { - id: 'reveal_first_cell', - match: 'flag', - flag: '--revealFirstCell' - } + { 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: '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?', @@ -86,35 +58,23 @@ export default class MinesweeperCommand extends BushCommand { required: false } ], - clientPermissions: ['SEND_MESSAGES'], - userPermissions: ['SEND_MESSAGES'] + clientPermissions: (m) => util.clientSendAndPermCheck(m), + userPermissions: [] }); } public override async exec( message: BushMessage | BushSlashMessage, - { - rows, - columns, - mines, - spaces, - reveal_first_cell - }: { - rows: number; - columns: number; - mines: number; - spaces: boolean; - reveal_first_cell: boolean; - } + args: { 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, + rows: args.rows ?? 9, + columns: args.columns ?? 9, + mines: args.mines ?? 10, emote: 'boom', - revealFirstCell: reveal_first_cell ?? false, + revealFirstCell: args.reveal_first_cell ?? false, zeroFirstCell: true, - spaces: spaces ?? false, + spaces: args.spaces ?? false, returnType: 'emoji' }); const matrix = minesweeper.start(); |
