Changes to the SlashCommandInteractionOptionsProvider #1116
Labels
🔨 breaking-change
An issue or pull requests that would be a breaking change
improvement
An issue which suggests an improvement of an existing feature
The SlashCommandInteractionOptionsProvider is an interface that contains methods to get options from a slash command interaction. Both the
SlashCommandInteraction
andSlashCommandInteractionOption
interface implements it to be able to navigate through the options more conveniently.Currently methods like
getOptionLongValueByName
only make sense if you are on the last "level" of the command. That means if the current option is aSUB_COMMAND
or if the command has no sub command.Therefore invoking these methods on the following command:
/base group subcommand <arg1>
they will always return an empty optional if you are currently on the
base
orgroup
level.To address this issue we should decide what should be done.
On the one side changing the behavior to get the options from
SlashCommandInteraction#getArguments
and renaming the methods would solve it but the API is not as fluent anymore if you are navigating though the options by yourself. Then if you are on the last level thegetOptionLongValueByName
methods would be missing. Then it might be a bit weird to callgetArgumentLongValueByName
although the options of the current option contains the arguments.On the other side this change is not that bad because there shouldn't be any reason to get the arguments that way if you can call the convenience method
getArguments
or the new added methods.Imo the advantages we get by doing this change is bigger than a bit less fluent API
The text was updated successfully, but these errors were encountered: