fix NoSuchElement case on command with no options
This commit is contained in:
parent
e9b5610f3c
commit
9d88ca902d
@ -98,11 +98,13 @@ public class JavacordWrapper extends LibraryWrapper {
|
|||||||
List<SlashCommandInteractionOption> options = interaction.getOptions();
|
List<SlashCommandInteractionOption> options = interaction.getOptions();
|
||||||
try {
|
try {
|
||||||
builder.setApplicationCommand(TypeFactory.annotation(SlashCommand.class, Map.of("name", interaction.getCommandName())));
|
builder.setApplicationCommand(TypeFactory.annotation(SlashCommand.class, Map.of("name", interaction.getCommandName())));
|
||||||
if (!options.getFirst().getArguments().isEmpty()) {
|
if (!options.isEmpty()) {
|
||||||
builder.setSubCommandGroup(TypeFactory.annotation(SubCommandGroup.class, Map.of("name", options.getFirst().getName())));
|
if (!options.getFirst().getArguments().isEmpty()) {
|
||||||
builder.setSubCommand(TypeFactory.annotation(SubCommand.class, Map.of("name", options.getFirst().getOptions().getFirst().getName())));
|
builder.setSubCommandGroup(TypeFactory.annotation(SubCommandGroup.class, Map.of("name", options.getFirst().getName())));
|
||||||
}else
|
builder.setSubCommand(TypeFactory.annotation(SubCommand.class, Map.of("name", options.getFirst().getOptions().getFirst().getName())));
|
||||||
builder.setSubCommand(TypeFactory.annotation(SubCommand.class, Map.of("name", options.getFirst().getName())));
|
}else
|
||||||
|
builder.setSubCommand(TypeFactory.annotation(SubCommand.class, Map.of("name", options.getFirst().getName())));
|
||||||
|
}
|
||||||
} catch (AnnotationFormatException e) {
|
} catch (AnnotationFormatException e) {
|
||||||
logger.fatal(e);
|
logger.fatal(e);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user