Autocomplete handling in subcommands
I was wondering how would i handle autocomplete interactions inside subcommands? i have a subcommand group the command has autocompletion on some of it's options is it possible to handle autocompletion within the subcommand class or do i have to handle it in the listener?
Solution:Jump to solution
It's the same as a normal command, but instead of just checking the focused option you can check the subcommand and subcommand group too.
```ts
public override async autocompleteRun(interaction: Subcommand.AutocompleteInteraction) {
const subcommand = interaction.options.getSubcommand();...
4 Replies
use
interaction.options.getSubcommand
in the autocomplete to determine which subcommand is being ranthe subcommand class doesn't implement a autocomplete method so i would have to do it manually inside the interaction listener?
It should be interested from command...
But otherwise yes
Solution
It's the same as a normal command, but instead of just checking the focused option you can check the subcommand and subcommand group too.