diff --git a/bots/discord/.gitignore b/bots/discord/.gitignore index f742463..130f357 100644 --- a/bots/discord/.gitignore +++ b/bots/discord/.gitignore @@ -174,9 +174,6 @@ dist # Finder (MacOS) folder config .DS_Store -# Config -config.ts - # DB *.db *.sqlite diff --git a/bots/discord/src/commands/admin/reload.ts b/bots/discord/src/commands/admin/reload.ts new file mode 100644 index 0000000..1a5c920 --- /dev/null +++ b/bots/discord/src/commands/admin/reload.ts @@ -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, + }) + }, +})