mirror of
https://github.com/ReVanced/revanced-bots.git
synced 2026-01-20 17:53:57 +00:00
- 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
22 lines
850 B
TypeScript
22 lines
850 B
TypeScript
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') // ;)
|
|
},
|
|
})
|