Setting autocomplete options based on other option's value
I'm trying to make it so one autocomplete option (
type
)'s choices are based on the value of another option (category
) within the same command.
When I first set the value of category
- which is a non-autocomplete string choice option - and I move to the autocomplete option type
it successfully populates its choices according to the value of category
. However, when I go back and change the value of category
to something else, then move to the type
option, the proper corresponding choices only populate correctly if I type at least one letter. If I do not, it populates it with the previously set of choices, corresponding to the first value set for category
.
I've attached a GIF that will hopefully help understand my issue. Thank you!
[email protected] node v18.16.0
2 Replies
This wont be sapphire related because the autocomplete stuff is just passing events through from Discord's API. We don't modify the data or anything. It's just geting passed 1:1 from Discord API to DiscordJS to Sapphire.
So add some logging and try to figure it out I suppose. Can't tell from the code or from the gif.
You could also consider restructuring so the categories can be subcommands so instead of
my_shop_item add
it would be /add_shop_item <category_subcommand>