mirror of
https://github.com/ReVanced/revanced-bots.git
synced 2026-01-28 21:51:02 +00:00
feat(bots/discord): framework changes and new features
- Migrated to a new command framework which looks better and works better - Fixed commands not being bundled correctly - Added message (prefix) commands with argument validation - Added a new CommandErrorType, for invalid arguments - `/eval` is now a bit safer - Corrected colors for the coinflip embed - `/stop` now works even when the bot is not connected to the API
This commit is contained in:
21
bots/discord/src/commands/admin/exception-test.ts
Normal file
21
bots/discord/src/commands/admin/exception-test.ts
Normal file
@@ -0,0 +1,21 @@
|
||||
import { ApplicationCommandOptionType } from 'discord.js'
|
||||
|
||||
import { AdminCommand } from '$/classes/Command'
|
||||
import CommandError, { CommandErrorType } from '$/classes/CommandError'
|
||||
|
||||
export default new AdminCommand({
|
||||
name: 'exception-test',
|
||||
description: 'Makes the bot intentionally hate you by throwing an exception',
|
||||
options: {
|
||||
type: {
|
||||
description: 'The type of exception to throw',
|
||||
type: ApplicationCommandOptionType.String,
|
||||
required: true,
|
||||
choices: Object.keys(CommandErrorType).map(k => ({ name: k, value: k })),
|
||||
},
|
||||
},
|
||||
async execute(_, __, { type }) {
|
||||
if (type === 'Process') throw new Error('Intentional process exception')
|
||||
throw new CommandError(CommandErrorType[type as keyof typeof CommandErrorType], 'Intentional bot design') // ;)
|
||||
},
|
||||
})
|
||||
Reference in New Issue
Block a user