use of net.dv8tion.jda.api.interactions.components.selections.SelectOption in project Ree6 by Ree6-Applications.
the class Setup method onPerform.
@Override
public void onPerform(CommandEvent commandEvent) {
if (commandEvent.getMember().hasPermission(Permission.ADMINISTRATOR)) {
EmbedBuilder embedBuilder = new EmbedBuilder().setTitle("Setup Menu").setFooter(commandEvent.getGuild().getName() + " - " + Data.ADVERTISEMENT, commandEvent.getGuild().getIconUrl()).setColor(Color.cyan).setDescription("Which configuration do you want to check out?");
List<SelectOption> optionList = new ArrayList<>();
optionList.add(SelectOption.of("Audit-Logging", "log"));
optionList.add(SelectOption.of("Welcome-channel", "welcome"));
optionList.add(SelectOption.of("News-channel", "news"));
optionList.add(SelectOption.of("Mute role", "mute"));
optionList.add(SelectOption.of("Autorole", "autrorole"));
SelectMenu selectMenu = new SelectMenuImpl("setupActionMenu", "Select a configuration Step!", 1, 1, false, optionList);
if (commandEvent.isSlashCommand()) {
commandEvent.getInteractionHook().sendMessageEmbeds(embedBuilder.build()).addActionRow(selectMenu).queue();
} else {
commandEvent.getTextChannel().sendMessageEmbeds(embedBuilder.build()).setActionRows(ActionRow.of(selectMenu)).queue();
}
} else {
sendMessage("You dont have the Permission for this Command!", 5, commandEvent.getTextChannel(), commandEvent.getInteractionHook());
}
deleteMessage(commandEvent.getMessage(), commandEvent.getInteractionHook());
}
use of net.dv8tion.jda.api.interactions.components.selections.SelectOption in project BotCommands by freya022.
the class BasicInteractiveMenu method buildSelectMenu.
@NotNull
private SelectMenu buildSelectMenu() {
final LambdaSelectionMenuBuilder builder = Components.selectionMenu(this::handleSelection).oneUse().setConstraints(constraints);
final List<SelectOption> options = builder.getOptions();
for (int i = 0, itemsSize = items.size(); i < itemsSize; i++) {
InteractiveMenuItem<T> item = items.get(i);
SelectOption option = item.content().toSelectOption(String.valueOf(i));
if (i == selectedItem)
option = option.withDefault(true);
options.add(option);
}
return builder.build();
}
Aggregations