Variable parameter type based on the previous variable
I want to add a 'parametric'
set
subcommand to one of my commands
For that command the values can be user, role or a string. Can I somehow change the option type (for example use addRoleOption
instead of addStringOption
) based on the value of the type
option?
Solution:Jump to solution
I think this is possible if you use Auto complete
If I'm correct, Autocomplete interaction should be able to give you values of previously filled parameters, which you can use to dynamically present values...
4 Replies
Solution
I think this is possible if you use Auto complete
If I'm correct, Autocomplete interaction should be able to give you values of previously filled parameters, which you can use to dynamically present values
Technically that should work if autocomlete allows that, I forget, but then you'd have to be using just IDs and manually mapping over the servers users and roles
Yeh you can do this with autocomplete but the code won't be pretty. It's still the best way to do it though, at least, much better than message commands or such.
You can use focusedOption to get the arg being parsed.
Thank you all for the replies