Add handling of autocompletion interactions

This commit is contained in:
Wroclaw 2023-05-10 04:19:49 +02:00
parent ec7df40edb
commit 3cf2af7aed
2 changed files with 10 additions and 1 deletions

View file

@ -32,6 +32,13 @@ export default class CommandManager {
foundCommand.execute(interaction);
return;
}
if (interaction.isAutocomplete()) {
const foundCommand = this.commands.find((command) => command.name == interaction.commandName );
if (!foundCommand) throw new Error(`Unknown command received (${interaction.commandName}). Did you forgot to push updated commands?`);
if (!foundCommand.autocomplete) return;
foundCommand.autocomplete(interaction);
return;
}
}
bindClient(client: DiscordClient) {