forked from syntaxbullet/AuroraBot-discord
feat: implement administrative control panel with real-time bot actions
This commit is contained in:
@@ -9,6 +9,7 @@ export class Client extends DiscordClient {
|
||||
|
||||
commands: Collection<string, Command>;
|
||||
lastCommandTimestamp: number | null = null;
|
||||
maintenanceMode: boolean = false;
|
||||
private commandLoader: CommandLoader;
|
||||
private eventLoader: EventLoader;
|
||||
|
||||
@@ -17,6 +18,41 @@ export class Client extends DiscordClient {
|
||||
this.commands = new Collection<string, Command>();
|
||||
this.commandLoader = new CommandLoader(this);
|
||||
this.eventLoader = new EventLoader(this);
|
||||
this.setupSystemEvents();
|
||||
}
|
||||
|
||||
private setupSystemEvents() {
|
||||
import("@shared/lib/events").then(({ systemEvents, EVENTS }) => {
|
||||
systemEvents.on(EVENTS.ACTIONS.RELOAD_COMMANDS, async () => {
|
||||
console.log("🔄 System Action: Reloading commands...");
|
||||
await this.loadCommands(true);
|
||||
await this.deployCommands();
|
||||
|
||||
const { dashboardService } = await import("@shared/modules/dashboard/dashboard.service");
|
||||
await dashboardService.recordEvent({
|
||||
type: "success",
|
||||
message: "Bot: Commands reloaded and redeployed",
|
||||
icon: "✅"
|
||||
});
|
||||
});
|
||||
|
||||
systemEvents.on(EVENTS.ACTIONS.CLEAR_CACHE, async () => {
|
||||
console.log("🧹 System Action: Clearing caches...");
|
||||
// In a real app, we'd loop through services and clear their internal maps
|
||||
const { dashboardService } = await import("@shared/modules/dashboard/dashboard.service");
|
||||
await dashboardService.recordEvent({
|
||||
type: "success",
|
||||
message: "Bot: Internal caches cleared",
|
||||
icon: "🧼"
|
||||
});
|
||||
});
|
||||
|
||||
systemEvents.on(EVENTS.ACTIONS.MAINTENANCE_MODE, async (data: { enabled: boolean, reason?: string }) => {
|
||||
const { enabled, reason } = data;
|
||||
console.log(`🛠️ System Action: Maintenance mode ${enabled ? "ON" : "OFF"}${reason ? ` (${reason})` : ""}`);
|
||||
this.maintenanceMode = enabled;
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
async loadCommands(reload: boolean = false) {
|
||||
|
||||
Reference in New Issue
Block a user