feat(settings): support toggling disabled commands and auto-reload bot on save
This commit is contained in:
@@ -61,7 +61,8 @@ mock.module("../../bot/lib/BotClient", () => ({
|
||||
},
|
||||
commands: [
|
||||
{ data: { name: "ping" } }
|
||||
]
|
||||
],
|
||||
knownCommands: new Set(["ping", "help", "disabled-cmd"])
|
||||
}
|
||||
}));
|
||||
|
||||
|
||||
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user