Enforcing Order of Options in Slash Commands #5967
Unanswered
NuroC
asked this question in
API Feature Requests & Ideas
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Which package is this feature request for?
discord.js
Feature
The current implementation of a slash command allows users to choose options in any order, even if my code requires each options value depending on the previously selected option. A new feature is requested to enforce the order of options, even if they are not required.
Ideal solution or implementation
The ideal solution would be to provide an option to set the order of the options explicitly. This could be done by adding an "order" property to each option object, which would specify the position of the option in the command. This way, when the user enters the command, the options would be presented in the specified order.
Alternative solutions or implementations
An alternative solution would be to use a custom validation function to enforce the order of the options. This function would check that each option's name is in the correct position and return an error message if it is not. However, this solution may not be ideal as it requires additional development effort and may be more prone to errors.
Examples
I have figured out that if I set the option to
required
, it enforces the order by which its set in the configuration.The code above would set the order of the options from 1 to 2 and so on.
Now, the order can be choosen freely however the user wants to.
Beta Was this translation helpful? Give feedback.
All reactions