Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Only update CommandData limiting booleans for non-empty additions #1963

Merged
merged 1 commit into from
Dec 27, 2021
Merged

Conversation

Sanduhr32
Copy link
Contributor

Pull Request Etiquette

Changes

  • Internal code
  • Library interface (affecting end-user code)
  • Documentation
  • Other: _____

Closes Issue: NaN

Description

Fixes that you can't "mix" options & subcommand (groups) after adding an empty set of these complementary types.
Only updates booleans for non-empty sets.

@Sanduhr32 Sanduhr32 changed the title [Bugfix] needs good title Only update CommandData limiting booleans for non-empty additions Dec 21, 2021
@@ -142,7 +142,8 @@ public CommandData addOptions(@Nonnull OptionData... options)
Checks.noneNull(options, "Option");
Checks.check(options.length + this.options.length() <= 25, "Cannot have more than 25 options for a command!");
Checks.check(allowOption, "You cannot mix options with subcommands/groups.");
allowSubcommands = allowGroups = false;
if (options.length > 0)
allowSubcommands = allowGroups = false;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should just return if length = 0, also this check should be before the mixing of options check is done.

change check oder & return this
@MinnDevelopment MinnDevelopment merged commit 4a642db into discord-jda:master Dec 27, 2021
@Sanduhr32 Sanduhr32 deleted the patch-1 branch January 4, 2022 10:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants