refactor: Extract interaction handling logic into dedicated ComponentInteractionHandler, AutocompleteHandler, and CommandHandler classes.

This commit is contained in:
syntaxbullet
2025-12-24 21:38:01 +01:00
parent f13ef781b6
commit 5420653b2b
5 changed files with 96 additions and 54 deletions

View File

@@ -0,0 +1,21 @@
import { AutocompleteInteraction } from "discord.js";
import { AuroraClient } from "@/lib/BotClient";
/**
* Handles autocomplete interactions for slash commands
*/
export class AutocompleteHandler {
static async handle(interaction: AutocompleteInteraction): Promise<void> {
const command = AuroraClient.commands.get(interaction.commandName);
if (!command || !command.autocomplete) {
return;
}
try {
await command.autocomplete(interaction);
} catch (error) {
console.error(`Error handling autocomplete for ${interaction.commandName}:`, error);
}
}
}