mirror of
https://github.com/ReVanced/revanced-bots.git
synced 2026-01-22 02:33:57 +00:00
26 lines
846 B
TypeScript
26 lines
846 B
TypeScript
import { AdminCommand } from '$/classes/Command'
|
|
import { MessageFlags } from 'discord.js'
|
|
|
|
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)',
|
|
flags: MessageFlags.Ephemeral,
|
|
})
|
|
|
|
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)
|
|
},
|
|
})
|