Making an Autocomplete 2nd Option Display Differently Based on 1st Option?

Is it possible to make a slash command which has a first option which can be some things, and then the second option changes depending on what the thing in the first option is? Any help is greatly appreciated.
10 Replies
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
Squid
Squid2y ago
You can use <AutocompleteInteraction>.options.getString('firstoption') to get the first string option (with the actual option name), for instance The autocomplete interaction options is missing a couple methods for more advanced types, such as getUser()
monbrey
monbrey2y ago
You can still .get('name').value on any type of option, which will be the id of a user/role/channel etc I'm pretty sure the autocomplete guide covers this
d.js docs
d.js docs2y ago
guide Slash Commands: Responding to autocomplete interactions - Handling multiple autocomplete options read more
dzlandis
dzlandis2y ago
I'm essentially trying to have a command like this: /settings setting:ping value:<this part can change based on what the first setting is selected as> So I assume if the "setting" option is not also an autocomplete option, I can't get it before the user sends, correct?
monbrey
monbrey2y ago
yes you can Provided they have filled it in first
dzlandis
dzlandis2y ago
So if a user has typed: /settings setting:ping I can access what the setting option is before they even press send and then change the value option in relation to that with an autocomplete option? 🤔
monbrey
monbrey2y ago
yes You can access the value of other already-filled options in an AutocompleteInteraction The only part you dont get is full objects for users/roles/channels, but you can still get their ids
dzlandis
dzlandis2y ago
Oh neat I'll try it out, thank you 🙏 I've thought about doing this but then on the other hand of things, that would result in my just having a lot of subcommands It would mean having 8 different subcommands and I'm planning to add more 🤷‍♂️ It would also mean having a subcommand of a subcommand which I'm not sure is possible 🤔 Cause then the command would look like for what I'm doing (as an example): /settings moderation isEnabled value:true Or something like that 🤔