use of dev.triumphteam.cmd.core.argument.InternalArgument in project triumph-cmds by TriumphTeam.
the class SlashSubCommand method getJdaOptions.
public List<OptionData> getJdaOptions() {
final List<OptionData> options = new ArrayList<>();
final List<InternalArgument<S, ?>> internalArguments = getArguments();
for (int i = 0; i < internalArguments.size(); i++) {
final InternalArgument<S, ?> internalArgument = internalArguments.get(i);
final OptionData option = new OptionData(JdaOptionUtil.fromType(internalArgument.getType()), internalArgument.getName(), internalArgument.getDescription(), !internalArgument.isOptional());
options.add(option);
final Choice suggestion = getChoice(i);
if (suggestion instanceof EmptyChoice)
continue;
option.addChoices(suggestion.getChoices().stream().map(it -> new Command.Choice(it, it)).limit(25).collect(Collectors.toList()));
}
return options;
}
Aggregations