feat(bots/discord/commands): add reload command

This commit is contained in:
PalmDevs
2024-08-02 18:53:43 +07:00
parent c36684091d
commit 6875b32fd0
2 changed files with 17 additions and 3 deletions

View File

@@ -174,9 +174,6 @@ dist
# Finder (MacOS) folder config
.DS_Store
# Config
config.ts
# DB
*.db
*.sqlite

View File

@@ -0,0 +1,17 @@
import { AdminCommand } from '$/classes/Command'
import { join, dirname } from 'path'
import type { Config } from 'config.schema'
export default new AdminCommand({
name: 'reload',
description: 'Reload configuration',
async execute(context, trigger) {
context.config = ((await import(join(dirname(Bun.main), '..', 'config.js'))) as { default: Config }).default
await trigger.reply({
content: 'Reloaded configuration',
ephemeral: true,
})
},
})