Search in sources :

Example 1 with ButtonContent

use of com.freya02.botcommands.api.utils.ButtonContent in project BotCommands by freya022.

the class ChoiceMenu method putComponents.

@Override
protected void putComponents() {
    super.putComponents();
    final MenuPage<E> page = pages.get(this.page);
    final List<E> entries = page.entries();
    for (int i = 0; i < entries.size(); i++) {
        final E item = entries.get(i);
        final ButtonContent content = buttonContentSupplier.apply(item, i);
        final Button choiceButton = Components.primaryButton(event -> {
            this.cleanup(event.getContext());
            callback.accept(event, item);
        }).setConstraints(constraints).build(content);
        components.addComponents(1 + (i / 5), choiceButton);
    }
}
Also used : Button(net.dv8tion.jda.api.interactions.components.buttons.Button) ButtonContent(com.freya02.botcommands.api.utils.ButtonContent)

Aggregations

ButtonContent (com.freya02.botcommands.api.utils.ButtonContent)1 Button (net.dv8tion.jda.api.interactions.components.buttons.Button)1