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
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.
public override async autocompleteRun(interaction: Subcommand.AutocompleteInteraction) { const subcommand = interaction.options.getSubcommand(); if (subcommand === 'first') { // stuff } else if (subcommand === 'second') { // stuff }}
public override async autocompleteRun(interaction: Subcommand.AutocompleteInteraction) { const subcommand = interaction.options.getSubcommand(); if (subcommand === 'first') { // stuff } else if (subcommand === 'second') { // stuff }}