feat(settings): support toggling disabled commands and auto-reload bot on save

This commit is contained in:
syntaxbullet
2026-01-08 22:44:48 +01:00
parent c6fd23b5fa
commit 9caa95a0d8
4 changed files with 15 additions and 3 deletions

View File

@@ -61,7 +61,8 @@ mock.module("../../bot/lib/BotClient", () => ({
},
commands: [
{ data: { name: "ping" } }
]
],
knownCommands: new Set(["ping", "help", "disabled-cmd"])
}
}));

View File

@@ -186,8 +186,13 @@ export async function createWebServer(config: WebServerConfig = {}): Promise<Web
// Merge partial update into current config
const mergedConfig = deepMerge(currentConfig, partialConfig);
// saveConfig throws if validation fails
saveConfig(mergedConfig);
const { systemEvents, EVENTS } = await import("@shared/lib/events");
systemEvents.emit(EVENTS.ACTIONS.RELOAD_COMMANDS);
return Response.json({ success: true });
}
} catch (error) {
@@ -221,7 +226,7 @@ export async function createWebServer(config: WebServerConfig = {}): Promise<Web
const channels = guild.channels.cache
.map(c => ({ id: c.id, name: c.name, type: c.type }));
const commands = AuroraClient.commands.map(c => c.data.name);
const commands = Array.from(AuroraClient.knownCommands).sort();
return Response.json({ roles, channels, commands });
} catch (error) {