All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.github.freya022.botcommands.api.pagination.ButtonContentSupplier Maven / Gradle / Ivy

Go to download

A Kotlin-first (and Java) framework that makes creating Discord bots a piece of cake, using the JDA library.

There is a newer version: 3.0.0-alpha.22
Show newest version
package io.github.freya022.botcommands.api.pagination;

import io.github.freya022.botcommands.api.utils.ButtonContent;
import net.dv8tion.jda.api.entities.emoji.Emoji;
import net.dv8tion.jda.api.interactions.components.buttons.Button;

/**
 * A {@link ButtonContent} supplier for use in different paginators, allowing you to use custom buttons (text / emoji).
 * 
You get handed the object the button is bound to, as well as the object's index in the current page. *
So for a menu, if you have a maximum of 5 items per page, your index is between 0 (included) and 5 (excluded). * *
*
See limitations of buttons content at {@link Button#primary(String, String)} and {@link Button#primary(String, Emoji)}. * * @param Item type * @see java.util.function.BiFunction * @see ButtonContent#withString(String) * @see ButtonContent#withEmoji(Emoji) */ public interface ButtonContentSupplier { /** * Returns a {@link ButtonContent} based on the given item and the current page number of the paginator * * @param item The item bound to this button * @param index The index of this item on the current page number of the paginator * @return The {@link ButtonContent} of this item */ ButtonContent apply(T item, int index); }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy