mirror of
https://github.com/ReVanced/revanced-bots.git
synced 2026-01-30 14:41:03 +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:
24
bots/discord/src/commands/admin/stop.ts
Normal file
24
bots/discord/src/commands/admin/stop.ts
Normal file
@@ -0,0 +1,24 @@
|
||||
import { AdminCommand } from '$/classes/Command'
|
||||
|
||||
export default new AdminCommand({
|
||||
name: 'stop',
|
||||
description: "You don't want to run this unless the bot starts to go insane, and like, you really need to stop it.",
|
||||
async execute({ api, logger, executor }, trigger) {
|
||||
api.intentionallyDisconnecting = true
|
||||
|
||||
logger.fatal('Stopping bot...')
|
||||
trigger.reply({
|
||||
content: 'Stopping... (I will go offline once done)',
|
||||
ephemeral: true,
|
||||
})
|
||||
|
||||
if (!api.client.disconnected) api.client.disconnect()
|
||||
logger.warn('Disconnected from API')
|
||||
|
||||
trigger.client.destroy()
|
||||
logger.warn('Disconnected from Discord API')
|
||||
|
||||
logger.info(`Bot stopped, requested by ${executor.id}`)
|
||||
process.exit(0)
|
||||
},
|
||||
})
|
||||
Reference in New Issue
Block a user