Add handling of autocompletion interactions
This commit is contained in:
parent
ec7df40edb
commit
3cf2af7aed
2 changed files with 10 additions and 1 deletions
|
@ -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) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue