discordjs / builders

A collection of builders that you can use when creating your bot.
Apache License 2.0
97 stars 37 forks source link

Provide range option for `.addIntegerOption` #30

Closed mahyarmirrashed closed 3 years ago

mahyarmirrashed commented 3 years ago

Is your feature request related to a problem? Please describe. There is currently no option to select the acceptable range of integers for the .addIntegerOption() on the SlashCommandBuilder(). This has to partially do with Discord's API for creating slash commands. When they do implement the feature, I would like to support added here. (I am also not sure where to provide such feedback to Discord.)

Describe the ideal solution The ideal option would be to have an extra method on the integer to select ranges of integers that are acceptable for the option. The method should default to the full range when no ranges are provided. The builder should provide warnings when integer ranges overlap in some method to the developer. In addition, the builder should allow a step feature for cases that the developer wants to only select ranges in steps of 2, 3, 4, 5, etc.

Describe alternatives you've considered The alternative option would be to manually check the integer option(s) passed with their acceptable range and send an ephemeral message to the user who invocated the slash command to let them the number is out of range. This, however, is very clunky because it includes about five extra lines per option to validate.

Additional context Discord Slash commands are useful for bot builders because they simplified interactions with users through a select range of options making it unnecessary to lint all responses with a regular expression for correctness. This problem seems like something that would be best fixed on Discord's side rather than on the consumer side of the library.

mahyarmirrashed commented 3 years ago

Created a feedback ticket on Discord's feedback portal: https://support.discord.com/hc/en-us/community/posts/4407140966679-Slash-Command-Integer-Range-Option-Support

almostSouji commented 3 years ago

Until Discord implements this possibility it makes little to no sense to have it as a feature request on this repository, feel free to re-open the issue once they put it into the API.