feat: Introduce a dedicated autocomplete handler for commands and refactor the inventory use command to utilize it.
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user