Skip to content

Commit

Permalink
🐛 Fixed arguments order in slash structures
Browse files Browse the repository at this point in the history
  • Loading branch information
ItsTheSky committed May 18, 2024
1 parent 588d4cd commit b91c73d
Showing 1 changed file with 8 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package info.itsthesky.disky.elements.structures.slash.models;

import ch.njol.skript.lang.Trigger;
import info.itsthesky.disky.DiSky;
import info.itsthesky.disky.core.Bot;
import info.itsthesky.disky.core.JDAUtils;
import net.dv8tion.jda.api.Permission;
Expand Down Expand Up @@ -150,9 +151,13 @@ public boolean shouldUpdate(ParsedCommand command) {
}

public void prepareArguments(List<OptionMapping> options) {
for (int i = 0; i < options.size(); i++) {
final OptionMapping option = options.get(i);
final ParsedArgument argument = arguments.get(i);
DiSky.debug("Found '" + arguments.size() + " args' for '" + options.size() + " options'");
for (ParsedArgument argument : arguments) {
final OptionMapping option = options.stream().filter(opt -> opt.getName().equals(argument.getName())).findFirst().orElse(null);
if (option == null) {
argument.setValue(null);
continue;
}

argument.setValue(JDAUtils.parseOptionValue(option));
}
Expand Down

0 comments on commit b91c73d

Please sign in to comment.