feat: Introduce a dedicated autocomplete handler for commands and refactor the inventory use command to utilize it.

This commit is contained in:
syntaxbullet
2025-12-18 14:34:47 +01:00
parent 3a96b67e89
commit 8c1f80981b
3 changed files with 37 additions and 37 deletions

View File

@@ -19,6 +19,17 @@ const event: Event<Events.InteractionCreate> = {
}
}
if (interaction.isAutocomplete()) {
const command = KyokoClient.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);
}
return;
}
if (!interaction.isChatInputCommand()) return;
const command = KyokoClient.commands.get(interaction.commandName);