multiple autocomplete

hi, i have a subcommand like this and an autocomplete function that gets the interaction, how can i "see" what option it should autocomplete? i tried
interaction.options.getString('name')
interaction.options.getString('name')
because that was somewhere in the internet, but that just gives null
..addSubcommand(subcommand =>
subcommand
.setName('cwl-log')
.setDescription('view the clans specific CWL log')
.addStringOption(option =>
option.setName('season')
.setDescription('CWL season by month and year')
.setAutocomplete(true)
.setRequired(true))
.addStringOption(option =>
option.setName('day')
.setDescription('warday of the cwl')
.setAutocomplete(true)))
..addSubcommand(subcommand =>
subcommand
.setName('cwl-log')
.setDescription('view the clans specific CWL log')
.addStringOption(option =>
option.setName('season')
.setDescription('CWL season by month and year')
.setAutocomplete(true)
.setRequired(true))
.addStringOption(option =>
option.setName('day')
.setDescription('warday of the cwl')
.setAutocomplete(true)))
4 Replies
d.js toolkit
d.js toolkit6mo ago
- What's your exact discord.js npm list discord.js and node node -v version? - Not a discord.js issue? Check out #other-js-ts. - Consider reading #how-to-get-help to improve your question! - Explain what exactly your issue is. - Post the full error stack trace, not just the top part! - Show your code! - Issue solved? Press the button! - Marked as resolved by OP
duck
duck6mo ago
you can pass true to <AutocompleteInteraction>.options.getFocused() so that it returns the whole option object then you can access <AutocompleteFocusedOption>.name
d.js docs
d.js docs6mo ago
:method: CommandInteractionOptionResolver#getFocused() Gets the focused option.
Jannek
Jannek6mo ago
works perfectly thanks a lot <3, i couldnt find it online with my searches
Want results from more Discord servers?
Add your server