Package com.jagrosh.jdautilities.menu
Class ButtonEmbedPaginator.Builder
java.lang.Object
com.jagrosh.jdautilities.menu.Menu.Builder<ButtonEmbedPaginator.Builder,ButtonEmbedPaginator>
com.jagrosh.jdautilities.menu.ButtonEmbedPaginator.Builder
- Enclosing class:
ButtonEmbedPaginator
public static class ButtonEmbedPaginator.Builder
extends Menu.Builder<ButtonEmbedPaginator.Builder,ButtonEmbedPaginator>
The
Menu.Builder
for a ButtonEmbedPaginator
.-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionAddsMessageEmbeds
to the list of items to paginate.addItems
(Collection<net.dv8tion.jda.api.entities.MessageEmbed> embeds) Adds the collection of providedMessageEmbed
to the list of items to paginate.addItems
(net.dv8tion.jda.api.entities.MessageEmbed... embeds) AddsMessageEmbed
to the list of items to paginate.build()
Builds theButtonEmbedPaginator
with this Builder.Clears all previously set items.setBulkSkipNumber
(int bulkSkipNumber) Sets theButtonEmbedPaginator
's bulk-skip function to skip multiple pages using alternate forward and backwards reactions.setButtonStyle
(net.dv8tion.jda.api.interactions.components.buttons.ButtonStyle style) Sets theButtonStyle
to use for the buttons.setFinalAction
(Consumer<net.dv8tion.jda.api.entities.Message> finalAction) Sets theConsumer
to perform if theButtonEmbedPaginator
times out.Sets theMessageEmbeds
to paginate.setItems
(Collection<net.dv8tion.jda.api.entities.MessageEmbed> embeds) Sets theMessageEmbeds
to paginate.setItems
(net.dv8tion.jda.api.entities.MessageEmbed... embeds) Sets theMessageEmbed
to paginate.Sets the text of theMessage
to be displayed when theButtonEmbedPaginator
is built.setText
(BiFunction<Integer, Integer, String> textBiFunction) Sets the text of theMessage
to be displayed relative to the total page number and the current page as determined by the providedBiFunction
.waitOnSinglePage
(boolean waitOnSinglePage) Sets whether theButtonEmbedPaginator
will instantly timeout, and possibly run a providedRunnable
, if only a single slide is available to display.wrapPageEnds
(boolean wrapPageEnds) Sets theEmbedPaginator
to wrap from the last page to the first when traversing right and vice versa from the left.Methods inherited from class com.jagrosh.jdautilities.menu.Menu.Builder
addRoles, addUsers, setEventWaiter, setRoles, setTimeout, setUsers
-
Constructor Details
-
Builder
public Builder()
-
-
Method Details
-
build
Builds theButtonEmbedPaginator
with this Builder.- Specified by:
build
in classMenu.Builder<ButtonEmbedPaginator.Builder,
ButtonEmbedPaginator> - Returns:
- The Paginator built from this Builder.
- Throws:
IllegalArgumentException
- If one of the following is violated:- No
EventWaiter
was set. - No items were set to paginate.
- No
-
setText
Sets the text of theMessage
to be displayed when theButtonEmbedPaginator
is built.- Parameters:
text
- The Message content to be displayed above the embed when the EmbedPaginator is built.- Returns:
- This builder
-
setText
Sets the text of theMessage
to be displayed relative to the total page number and the current page as determined by the providedBiFunction
.
As the page changes, the BiFunction will re-process the current page number and the total page number, allowing for the displayed text of the Message to change depending on the page number.- Parameters:
textBiFunction
- The BiFunction that uses both current and total page numbers, to get text for the Message- Returns:
- This builder
-
setFinalAction
public ButtonEmbedPaginator.Builder setFinalAction(Consumer<net.dv8tion.jda.api.entities.Message> finalAction) Sets theConsumer
to perform if theButtonEmbedPaginator
times out.- Parameters:
finalAction
- The Consumer action to perform if the EmbedPaginator times out- Returns:
- This builder
-
waitOnSinglePage
Sets whether theButtonEmbedPaginator
will instantly timeout, and possibly run a providedRunnable
, if only a single slide is available to display.- Parameters:
waitOnSinglePage
-true
if the EmbedPaginator will still generate- Returns:
- This builder
-
clearItems
Clears all previously set items.- Returns:
- This builder
-
addItems
AddsMessageEmbed
to the list of items to paginate.- Parameters:
embeds
- The list of MessageEmbeds to add- Returns:
- This builder
-
addItems
public ButtonEmbedPaginator.Builder addItems(Collection<net.dv8tion.jda.api.entities.MessageEmbed> embeds) Adds the collection of providedMessageEmbed
to the list of items to paginate.- Parameters:
embeds
- The collection of MessageEmbeds to add- Returns:
- This builder
-
addItems
AddsMessageEmbeds
to the list of items to paginate.
This method creates a new, basic MessageEmbed containing only the provided String as description.
Use thePaginator
for more Embed customization, without providing your own MessageEmbed instances.- Parameters:
items
- The String list of items to add as MessageEmbeds- Returns:
- This builder
- Throws:
IllegalArgumentException
- When one of the provided Strings is longer than 2048 characters.
-
setItems
Sets theMessageEmbed
to paginate.
This method clears all previously set items before setting.- Parameters:
embeds
- The MessageEmbed list of items to add- Returns:
- This builder
-
setItems
public ButtonEmbedPaginator.Builder setItems(Collection<net.dv8tion.jda.api.entities.MessageEmbed> embeds) Sets theMessageEmbeds
to paginate.
This method clears all previously set items before adding the provided collection of MessageEmbeds.- Parameters:
embeds
- The collection of MessageEmbeds to set.- Returns:
- This builder
-
setItems
Sets theMessageEmbeds
to paginate.
This method clears all previously set items before setting each String as a new MessageEmbed.
Use thePaginator
for more Embed customization, without providing your own MessageEmbed instances.- Parameters:
items
- The String list of items to add- Returns:
- This builder
- Throws:
IllegalArgumentException
- When one of the provided Strings is longer than 2048 characters.
-
setBulkSkipNumber
Sets theButtonEmbedPaginator
's bulk-skip function to skip multiple pages using alternate forward and backwards reactions.- Parameters:
bulkSkipNumber
- The number of pages to skip when the bulk-skip reactions are used.- Returns:
- This builder
-
wrapPageEnds
Sets theEmbedPaginator
to wrap from the last page to the first when traversing right and vice versa from the left.- Parameters:
wrapPageEnds
-true
to enable wrapping.- Returns:
- This builder
-
setButtonStyle
public ButtonEmbedPaginator.Builder setButtonStyle(net.dv8tion.jda.api.interactions.components.buttons.ButtonStyle style) Sets theButtonStyle
to use for the buttons. By default, this isSECONARY
.- Parameters:
style
- The new style- Returns:
- This builder
-