Package com.github.ygimenez.method
Class Pages
java.lang.Object
com.github.ygimenez.method.Pages
The main class containing all pagination-related methods, including but not limited
to
paginate(net.dv8tion.jda.api.entities.Message, java.util.List<com.github.ygimenez.model.Page>, boolean), categorize(net.dv8tion.jda.api.entities.Message, java.util.Map<net.dv8tion.jda.api.entities.emoji.Emoji, com.github.ygimenez.model.Page>, boolean), buttonize(net.dv8tion.jda.api.entities.Message, java.util.Map<net.dv8tion.jda.api.entities.emoji.Emoji, com.github.ygimenez.model.ThrowingConsumer<com.github.ygimenez.model.ButtonWrapper>>, boolean, boolean) and lazyPaginate(net.dv8tion.jda.api.entities.Message, com.github.ygimenez.model.ThrowingFunction<java.lang.Integer, com.github.ygimenez.model.Page>, boolean).-
Method Summary
Modifier and TypeMethodDescriptionstatic voidSet aPaginatorobject to handle incoming events.static voidaddReactions(net.dv8tion.jda.api.entities.Message msg, boolean withSkip, boolean withGoto)Utility method to add navigation buttons.static ActionReferencebuttonize(net.dv8tion.jda.api.entities.Message msg, ButtonizeHelper helper)Adds buttons to the specifiedMessage/MessageEmbed, with each executing a specific task on click.static ActionReferencebuttonize(net.dv8tion.jda.api.entities.Message msg, Map<net.dv8tion.jda.api.entities.emoji.Emoji,ThrowingConsumer<ButtonWrapper>> buttons, boolean useButtons, boolean showCancelButton)Adds buttons to the specifiedMessage/MessageEmbed, with each executing a specific task on click.static ActionReferencebuttonize(net.dv8tion.jda.api.entities.Message msg, Map<net.dv8tion.jda.api.entities.emoji.Emoji,ThrowingConsumer<ButtonWrapper>> buttons, boolean useButtons, boolean showCancelButton, int time, TimeUnit unit)Adds buttons to the specifiedMessage/MessageEmbed, with each executing a specific task on click.static ActionReferencebuttonize(net.dv8tion.jda.api.entities.Message msg, Map<net.dv8tion.jda.api.entities.emoji.Emoji,ThrowingConsumer<ButtonWrapper>> buttons, boolean useButtons, boolean showCancelButton, int time, TimeUnit unit, Predicate<net.dv8tion.jda.api.entities.User> canInteract)Adds buttons to the specifiedMessage/MessageEmbed, with each executing a specific task on click.static ActionReferencebuttonize(net.dv8tion.jda.api.entities.Message msg, Map<net.dv8tion.jda.api.entities.emoji.Emoji,ThrowingConsumer<ButtonWrapper>> buttons, boolean useButtons, boolean cancellable, int time, TimeUnit unit, Predicate<net.dv8tion.jda.api.entities.User> canInteract, Consumer<net.dv8tion.jda.api.entities.Message> onCancel)Adds buttons to the specifiedMessage/MessageEmbed, with each executing a specific task on click.static ActionReferencebuttonize(net.dv8tion.jda.api.entities.Message msg, Map<net.dv8tion.jda.api.entities.emoji.Emoji,ThrowingConsumer<ButtonWrapper>> buttons, boolean useButtons, boolean showCancelButton, Predicate<net.dv8tion.jda.api.entities.User> canInteract)Adds buttons to the specifiedMessage/MessageEmbed, with each executing a specific task on click.static ActionReferencebuttonize(net.dv8tion.jda.api.entities.Message msg, Map<net.dv8tion.jda.api.entities.emoji.Emoji,ThrowingConsumer<ButtonWrapper>> buttons, boolean useButtons, boolean showCancelButton, Predicate<net.dv8tion.jda.api.entities.User> canInteract, Consumer<net.dv8tion.jda.api.entities.Message> onCancel)Adds buttons to the specifiedMessage/MessageEmbed, with each executing a specific task on click.static ActionReferencecategorize(net.dv8tion.jda.api.entities.Message msg, CategorizeHelper helper)Adds menu-like buttons to the specifiedMessage/MessageEmbedwhich will browse through a givenMapof pages.static ActionReferencecategorize(net.dv8tion.jda.api.entities.Message msg, Map<net.dv8tion.jda.api.entities.emoji.Emoji,Page> categories, boolean useButtons)Adds menu-like buttons to the specifiedMessage/MessageEmbedwhich will browse through a givenMapof pages.static ActionReferencecategorize(net.dv8tion.jda.api.entities.Message msg, Map<net.dv8tion.jda.api.entities.emoji.Emoji,Page> categories, boolean useButtons, int time, TimeUnit unit)Adds menu-like buttons to the specifiedMessage/MessageEmbedwhich will browse through a givenMapof pages.static ActionReferencecategorize(net.dv8tion.jda.api.entities.Message msg, Map<net.dv8tion.jda.api.entities.emoji.Emoji,Page> categories, boolean useButtons, int time, TimeUnit unit, Predicate<net.dv8tion.jda.api.entities.User> canInteract)Adds menu-like buttons to the specifiedMessage/MessageEmbedwhich will browse through a givenMapof pages.static ActionReferencecategorize(net.dv8tion.jda.api.entities.Message msg, Map<net.dv8tion.jda.api.entities.emoji.Emoji,Page> categories, boolean useButtons, Predicate<net.dv8tion.jda.api.entities.User> canInteract)Adds menu-like buttons to the specifiedMessage/MessageEmbedwhich will browse through a givenMapof pages.static voidclearButtons(net.dv8tion.jda.api.entities.Message msg)Utility method to clear all buttons of a message.static voidclearReactions(net.dv8tion.jda.api.entities.Message msg)Utility method to clear all reactions of a message.static voidRemoves current button handler, allowing anotheractivate(Paginator)call.
Using this method without activating beforehand will do nothing.static voidfinalizeEvent(net.dv8tion.jda.api.entities.Message msg, Consumer<Void> callback)Utility method to clear all reactions of a message.static MessageHandlerRetrieves the library'sMessageHandlerobject.static PaginatorRetrieves thePaginatorobject used to activate this library.static booleanChecks whether this library has been activated or not.static ActionReferencelazyPaginate(net.dv8tion.jda.api.entities.Message msg, LazyPaginateHelper helper)Adds navigation buttons to the specifiedMessage/MessageEmbedwhich will lazily load content by using suppliedThrowingFunction.static ActionReferencelazyPaginate(net.dv8tion.jda.api.entities.Message msg, ThrowingFunction<Integer,Page> pageLoader, boolean useButtons)Adds navigation buttons to the specifiedMessage/MessageEmbedwhich will lazily load content by using suppliedThrowingFunction.static ActionReferencelazyPaginate(net.dv8tion.jda.api.entities.Message msg, ThrowingFunction<Integer,Page> pageLoader, boolean useButtons, int time, TimeUnit unit)Adds navigation buttons to the specifiedMessage/MessageEmbedwhich will lazily load content by using suppliedThrowingFunction.static ActionReferencelazyPaginate(net.dv8tion.jda.api.entities.Message msg, ThrowingFunction<Integer,Page> pageLoader, boolean useButtons, int time, TimeUnit unit, Predicate<net.dv8tion.jda.api.entities.User> canInteract)Adds navigation buttons to the specifiedMessage/MessageEmbedwhich will lazily load content by using suppliedThrowingFunction.static ActionReferencelazyPaginate(net.dv8tion.jda.api.entities.Message msg, ThrowingFunction<Integer,Page> pageLoader, boolean useButtons, Predicate<net.dv8tion.jda.api.entities.User> canInteract)Adds navigation buttons to the specifiedMessage/MessageEmbedwhich will lazily load content by using suppliedThrowingFunction.static ActionReferencelazyPaginate(net.dv8tion.jda.api.entities.Message msg, List<Page> pageCache, ThrowingFunction<Integer,Page> pageLoader, boolean useButtons)Adds navigation buttons to the specifiedMessage/MessageEmbedwhich will lazily load content by using suppliedThrowingFunction.static ActionReferencelazyPaginate(net.dv8tion.jda.api.entities.Message msg, List<Page> pageCache, ThrowingFunction<Integer,Page> pageLoader, boolean useButtons, int time, TimeUnit unit)Adds navigation buttons to the specifiedMessage/MessageEmbedwhich will lazily load content by using suppliedThrowingFunction.static ActionReferencelazyPaginate(net.dv8tion.jda.api.entities.Message msg, List<Page> pageCache, ThrowingFunction<Integer,Page> pageLoader, boolean useButtons, int time, TimeUnit unit, Predicate<net.dv8tion.jda.api.entities.User> canInteract)Adds navigation buttons to the specifiedMessage/MessageEmbedwhich will lazily load content by using suppliedThrowingFunction.static ActionReferencelazyPaginate(net.dv8tion.jda.api.entities.Message msg, List<Page> pageCache, ThrowingFunction<Integer,Page> pageLoader, boolean useButtons, Predicate<net.dv8tion.jda.api.entities.User> canInteract)Adds navigation buttons to the specifiedMessage/MessageEmbedwhich will lazily load content by using suppliedThrowingFunction.static voidmodifyButtons(net.dv8tion.jda.api.entities.Message msg, Page p, Map<String,Function<net.dv8tion.jda.api.interactions.components.buttons.Button,net.dv8tion.jda.api.interactions.components.buttons.Button>> changes)Utility method for switching pages and/or modifying message buttons.static ActionReferencepaginate(net.dv8tion.jda.api.entities.Message msg, PaginateHelper helper)Adds navigation buttons to the specifiedMessage/MessageEmbedwhich will navigate through a givenListof pages.static ActionReferenceAdds navigation buttons to the specifiedMessage/MessageEmbedwhich will navigate through a givenListof pages.static ActionReferencepaginate(net.dv8tion.jda.api.entities.Message msg, List<Page> pages, boolean useButtons, boolean fastForward)Adds navigation buttons to the specifiedMessage/MessageEmbedwhich will navigate through a givenListof pages.static ActionReferencepaginate(net.dv8tion.jda.api.entities.Message msg, List<Page> pages, boolean useButtons, boolean fastForward, Predicate<net.dv8tion.jda.api.entities.User> canInteract)Adds navigation buttons to the specifiedMessage/MessageEmbedwhich will navigate through a givenListof pages.static ActionReferencepaginate(net.dv8tion.jda.api.entities.Message msg, List<Page> pages, boolean useButtons, int skipAmount)Adds navigation buttons to the specifiedMessage/MessageEmbedwhich will navigate through a givenListof pages.static ActionReferencepaginate(net.dv8tion.jda.api.entities.Message msg, List<Page> pages, boolean useButtons, int skipAmount, boolean fastForward, Predicate<net.dv8tion.jda.api.entities.User> canInteract)Adds navigation buttons to the specifiedMessage/MessageEmbedwhich will navigate through a givenListof pages.static ActionReferencepaginate(net.dv8tion.jda.api.entities.Message msg, List<Page> pages, boolean useButtons, int time, TimeUnit unit)Adds navigation buttons to the specifiedMessage/MessageEmbedwhich will navigate through a givenListof pages.static ActionReferencepaginate(net.dv8tion.jda.api.entities.Message msg, List<Page> pages, boolean useButtons, int time, TimeUnit unit, boolean fastForward)Adds navigation buttons to the specifiedMessage/MessageEmbedwhich will navigate through a givenListof pages.static ActionReferencepaginate(net.dv8tion.jda.api.entities.Message msg, List<Page> pages, boolean useButtons, int time, TimeUnit unit, boolean fastForward, Predicate<net.dv8tion.jda.api.entities.User> canInteract)Adds navigation buttons to the specifiedMessage/MessageEmbedwhich will navigate through a givenListof pages.static ActionReferencepaginate(net.dv8tion.jda.api.entities.Message msg, List<Page> pages, boolean useButtons, int time, TimeUnit unit, int skipAmount)Adds navigation buttons to the specifiedMessage/MessageEmbedwhich will navigate through a givenListof pages.static ActionReferencepaginate(net.dv8tion.jda.api.entities.Message msg, List<Page> pages, boolean useButtons, int time, TimeUnit unit, int skipAmount, boolean fastForward)Adds navigation buttons to the specifiedMessage/MessageEmbedwhich will navigate through a givenListof pages.static ActionReferencepaginate(net.dv8tion.jda.api.entities.Message msg, List<Page> pages, boolean useButtons, int time, TimeUnit unit, int skipAmount, boolean fastForward, Predicate<net.dv8tion.jda.api.entities.User> canInteract)Adds navigation buttons to the specifiedMessage/MessageEmbedwhich will navigate through a givenListof pages.static ActionReferencepaginate(net.dv8tion.jda.api.entities.Message msg, List<Page> pages, boolean useButtons, int time, TimeUnit unit, int skipAmount, Predicate<net.dv8tion.jda.api.entities.User> canInteract)Adds navigation buttons to the specifiedMessage/MessageEmbedwhich will navigate through a givenListof pages.static ActionReferencepaginate(net.dv8tion.jda.api.entities.Message msg, List<Page> pages, boolean useButtons, int time, TimeUnit unit, Predicate<net.dv8tion.jda.api.entities.User> canInteract)Adds navigation buttons to the specifiedMessage/MessageEmbedwhich will navigate through a givenListof pages.static ActionReferencepaginate(net.dv8tion.jda.api.entities.Message msg, List<Page> pages, boolean useButtons, int skipAmount, Predicate<net.dv8tion.jda.api.entities.User> canInteract)Adds navigation buttons to the specifiedMessage/MessageEmbedwhich will navigate through a givenListof pages.static ActionReferencepaginate(net.dv8tion.jda.api.entities.Message msg, List<Page> pages, boolean useButtons, Predicate<net.dv8tion.jda.api.entities.User> canInteract)Adds navigation buttons to the specifiedMessage/MessageEmbedwhich will navigate through a givenListof pages.static net.dv8tion.jda.api.entities.MessagereloadMessage(net.dv8tion.jda.api.entities.Message msg)Utility method for re-fetching a message.static <T> TsubGet(net.dv8tion.jda.api.requests.RestAction<T> future)Utility method for submitting aRestActionand awaiting its result.static <T> TsubGet(net.dv8tion.jda.api.requests.RestAction<T> future, T or)Utility method for submitting aRestActionand awaiting its result.
-
Method Details
-
activate
Set aPaginatorobject to handle incoming events. This is required only once unless you want to change which client is handling events.
Before calling this method again, you must usedeactivate()to remove currentPaginator, else this method will throwAlreadyActivatedException.- Parameters:
paginator- ThePaginatorobject.- Throws:
AlreadyActivatedException- Thrown if there's a handler already set.InvalidHandlerException- Thrown if the handler isn't either aJDAorShardManagerobject.
-
deactivate
public static void deactivate()Removes current button handler, allowing anotheractivate(Paginator)call.
Using this method without activating beforehand will do nothing. -
isActivated
public static boolean isActivated()Checks whether this library has been activated or not.- Returns:
- The activation state of this library.
-
getPaginator
Retrieves thePaginatorobject used to activate this library.- Returns:
- The current
Paginatorobject.
-
getHandler
Retrieves the library'sMessageHandlerobject.- Returns:
- The
MessageHandlerobject.
-
paginate
public static ActionReference paginate(@NotNull net.dv8tion.jda.api.entities.Message msg, @NotNull List<Page> pages, boolean useButtons) throws net.dv8tion.jda.api.exceptions.ErrorResponseException, net.dv8tion.jda.api.exceptions.InsufficientPermissionExceptionAdds navigation buttons to the specifiedMessage/MessageEmbedwhich will navigate through a givenListof pages.- Parameters:
msg- TheMessagesent which will be paginated.pages- The pages to be shown. The order of theListwill define the order of the pages.useButtons- Whether to use interactionButtonor reactions. Will fall back to false if the suppliedMessagewas not sent by the bot.- Returns:
- An
ActionReferencepointing to this action. This is useful if you need to track whether an event is still being processed or was already removed (ie. garbage collected). - Throws:
net.dv8tion.jda.api.exceptions.ErrorResponseException- Thrown if theMessageno longer exists or cannot be accessed when triggering aGenericMessageReactionEvent.net.dv8tion.jda.api.exceptions.InsufficientPermissionException- Thrown if this library cannot remove reactions due to lack of bot permission.InvalidStateException- Thrown if the library wasn't activated or the page list is empty.
-
paginate
public static ActionReference paginate(@NotNull net.dv8tion.jda.api.entities.Message msg, @NotNull List<Page> pages, boolean useButtons, int time, TimeUnit unit) throws net.dv8tion.jda.api.exceptions.ErrorResponseException, net.dv8tion.jda.api.exceptions.InsufficientPermissionExceptionAdds navigation buttons to the specifiedMessage/MessageEmbedwhich will navigate through a givenListof pages. You can specify how long the listener will stay active before shutting down itself after a no-activity interval.- Parameters:
msg- TheMessagesent which will be paginated.pages- The pages to be shown. The order of theListwill define the order of the pages.useButtons- Whether to use interactionButtonor reactions. Will fall back to false if the suppliedMessagewas not sent by the bot.time- The time before the listener automatically stop listening for further events (recommended: 60).unit- The time'sTimeUnit(recommended:TimeUnit.SECONDS).- Returns:
- An
ActionReferencepointing to this action. This is useful if you need to track whether an event is still being processed or was already removed (ie. garbage collected). - Throws:
net.dv8tion.jda.api.exceptions.ErrorResponseException- Thrown if theMessageno longer exists or cannot be accessed when triggering aGenericMessageReactionEvent.net.dv8tion.jda.api.exceptions.InsufficientPermissionException- Thrown if this library cannot remove reactions due to lack of bot permission.InvalidStateException- Thrown if the library wasn't activated or the page list is empty.
-
paginate
public static ActionReference paginate(@NotNull net.dv8tion.jda.api.entities.Message msg, @NotNull List<Page> pages, boolean useButtons, Predicate<net.dv8tion.jda.api.entities.User> canInteract) throws net.dv8tion.jda.api.exceptions.ErrorResponseException, net.dv8tion.jda.api.exceptions.InsufficientPermissionExceptionAdds navigation buttons to the specifiedMessage/MessageEmbedwhich will navigate through a givenListof pages.- Parameters:
msg- TheMessagesent which will be paginated.pages- The pages to be shown. The order of theListwill define the order of the pages.useButtons- Whether to use interactionButtonor reactions. Will fall back to false if the suppliedMessagewas not sent by the bot.canInteract-Predicateto determine whether theUserthat pressed the button can interact with it or not.- Returns:
- An
ActionReferencepointing to this action. This is useful if you need to track whether an event is still being processed or was already removed (ie. garbage collected). - Throws:
net.dv8tion.jda.api.exceptions.ErrorResponseException- Thrown if theMessageno longer exists or cannot be accessed when triggering aGenericMessageReactionEvent.net.dv8tion.jda.api.exceptions.InsufficientPermissionException- Thrown if this library cannot remove reactions due to lack of bot permission.InvalidStateException- Thrown if the library wasn't activated or the page list is empty.
-
paginate
public static ActionReference paginate(@NotNull net.dv8tion.jda.api.entities.Message msg, @NotNull List<Page> pages, boolean useButtons, int time, TimeUnit unit, Predicate<net.dv8tion.jda.api.entities.User> canInteract) throws net.dv8tion.jda.api.exceptions.ErrorResponseException, net.dv8tion.jda.api.exceptions.InsufficientPermissionExceptionAdds navigation buttons to the specifiedMessage/MessageEmbedwhich will navigate through a givenListof pages. You can specify how long the listener will stay active before shutting down itself after a no-activity interval.- Parameters:
msg- TheMessagesent which will be paginated.pages- The pages to be shown. The order of theListwill define the order of the pages.useButtons- Whether to use interactionButtonor reactions. Will fall back to false if the suppliedMessagewas not sent by the bot.time- The time before the listener automatically stop listening for further events (recommended: 60).unit- The time'sTimeUnit(recommended:TimeUnit.SECONDS).canInteract-Predicateto determine whether theUserthat pressed the button can interact with it or not.- Returns:
- An
ActionReferencepointing to this action. This is useful if you need to track whether an event is still being processed or was already removed (ie. garbage collected). - Throws:
net.dv8tion.jda.api.exceptions.ErrorResponseException- Thrown if theMessageno longer exists or cannot be accessed when triggering aGenericMessageReactionEvent.net.dv8tion.jda.api.exceptions.InsufficientPermissionException- Thrown if this library cannot remove reactions due to lack of bot permission.InvalidStateException- Thrown if the library wasn't activated or the page list is empty.
-
paginate
public static ActionReference paginate(@NotNull net.dv8tion.jda.api.entities.Message msg, @NotNull List<Page> pages, boolean useButtons, boolean fastForward) throws net.dv8tion.jda.api.exceptions.ErrorResponseException, net.dv8tion.jda.api.exceptions.InsufficientPermissionExceptionAdds navigation buttons to the specifiedMessage/MessageEmbedwhich will navigate through a givenListof pages.- Parameters:
msg- TheMessagesent which will be paginated.pages- The pages to be shown. The order of theListwill define the order of the pages.useButtons- Whether to use interactionButtonor reactions. Will fall back to false if the suppliedMessagewas not sent by the bot.fastForward- Whether theEmote.GOTO_FIRSTandEmote.GOTO_LASTbuttons should be shown.- Returns:
- An
ActionReferencepointing to this action. This is useful if you need to track whether an event is still being processed or was already removed (ie. garbage collected). - Throws:
net.dv8tion.jda.api.exceptions.ErrorResponseException- Thrown if theMessageno longer exists or cannot be accessed when triggering aGenericMessageReactionEvent.net.dv8tion.jda.api.exceptions.InsufficientPermissionException- Thrown if this library cannot remove reactions due to lack of bot permission.InvalidStateException- Thrown if the library wasn't activated or the page list is empty.
-
paginate
public static ActionReference paginate(@NotNull net.dv8tion.jda.api.entities.Message msg, @NotNull List<Page> pages, boolean useButtons, int time, TimeUnit unit, boolean fastForward) throws net.dv8tion.jda.api.exceptions.ErrorResponseException, net.dv8tion.jda.api.exceptions.InsufficientPermissionExceptionAdds navigation buttons to the specifiedMessage/MessageEmbedwhich will navigate through a givenListof pages. You can specify how long the listener will stay active before shutting down itself after a no-activity interval.- Parameters:
msg- TheMessagesent which will be paginated.pages- The pages to be shown. The order of theListwill define the order of the pages.useButtons- Whether to use interactionButtonor reactions. Will fall back to false if the suppliedMessagewas not sent by the bot.time- The time before the listener automatically stop listening for further events (recommended: 60).unit- The time'sTimeUnit(recommended:TimeUnit.SECONDS).fastForward- Whether theEmote.GOTO_FIRSTandEmote.GOTO_LASTbuttons should be shown.- Returns:
- An
ActionReferencepointing to this action. This is useful if you need to track whether an event is still being processed or was already removed (ie. garbage collected). - Throws:
net.dv8tion.jda.api.exceptions.ErrorResponseException- Thrown if theMessageno longer exists or cannot be accessed when triggering aGenericMessageReactionEvent.net.dv8tion.jda.api.exceptions.InsufficientPermissionException- Thrown if this library cannot remove reactions due to lack of bot permission.InvalidStateException- Thrown if the library wasn't activated or the page list is empty.
-
paginate
public static ActionReference paginate(@NotNull net.dv8tion.jda.api.entities.Message msg, @NotNull List<Page> pages, boolean useButtons, boolean fastForward, Predicate<net.dv8tion.jda.api.entities.User> canInteract) throws net.dv8tion.jda.api.exceptions.ErrorResponseException, net.dv8tion.jda.api.exceptions.InsufficientPermissionExceptionAdds navigation buttons to the specifiedMessage/MessageEmbedwhich will navigate through a givenListof pages.- Parameters:
msg- TheMessagesent which will be paginated.pages- The pages to be shown. The order of theListwill define the order of the pages.useButtons- Whether to use interactionButtonor reactions. Will fall back to false if the suppliedMessagewas not sent by the bot.fastForward- Whether theEmote.GOTO_FIRSTandEmote.GOTO_LASTbuttons should be shown.canInteract-Predicateto determine whether theUserthat pressed the button can interact with it or not.- Returns:
- An
ActionReferencepointing to this action. This is useful if you need to track whether an event is still being processed or was already removed (ie. garbage collected). - Throws:
net.dv8tion.jda.api.exceptions.ErrorResponseException- Thrown if theMessageno longer exists or cannot be accessed when triggering aGenericMessageReactionEvent.net.dv8tion.jda.api.exceptions.InsufficientPermissionException- Thrown if this library cannot remove reactions due to lack of bot permission.InvalidStateException- Thrown if the library wasn't activated or the page list is empty.
-
paginate
public static ActionReference paginate(@NotNull net.dv8tion.jda.api.entities.Message msg, @NotNull List<Page> pages, boolean useButtons, int time, TimeUnit unit, boolean fastForward, Predicate<net.dv8tion.jda.api.entities.User> canInteract) throws net.dv8tion.jda.api.exceptions.ErrorResponseException, net.dv8tion.jda.api.exceptions.InsufficientPermissionExceptionAdds navigation buttons to the specifiedMessage/MessageEmbedwhich will navigate through a givenListof pages. You can specify how long the listener will stay active before shutting down itself after a no-activity interval.- Parameters:
msg- TheMessagesent which will be paginated.pages- The pages to be shown. The order of theListwill define the order of the pages.useButtons- Whether to use interactionButtonor reactions. Will fall back to false if the suppliedMessagewas not sent by the bot.time- The time before the listener automatically stop listening for further events (recommended: 60).unit- The time'sTimeUnit(recommended:TimeUnit.SECONDS).fastForward- Whether theEmote.GOTO_FIRSTandEmote.GOTO_LASTbuttons should be shown.canInteract-Predicateto determine whether theUserthat pressed the button can interact with it or not.- Returns:
- An
ActionReferencepointing to this action. This is useful if you need to track whether an event is still being processed or was already removed (ie. garbage collected). - Throws:
net.dv8tion.jda.api.exceptions.ErrorResponseException- Thrown if theMessageno longer exists or cannot be accessed when triggering aGenericMessageReactionEvent.net.dv8tion.jda.api.exceptions.InsufficientPermissionException- Thrown if this library cannot remove reactions due to lack of bot permission.InvalidStateException- Thrown if the library wasn't activated or the page list is empty.
-
paginate
public static ActionReference paginate(@NotNull net.dv8tion.jda.api.entities.Message msg, @NotNull List<Page> pages, boolean useButtons, int skipAmount) throws net.dv8tion.jda.api.exceptions.ErrorResponseException, net.dv8tion.jda.api.exceptions.InsufficientPermissionExceptionAdds navigation buttons to the specifiedMessage/MessageEmbedwhich will navigate through a givenListof pages.- Parameters:
msg- TheMessagesent which will be paginated.pages- The pages to be shown. The order of theListwill define the order of the pages.useButtons- Whether to use interactionButtonor reactions. Will fall back to false if the suppliedMessagewas not sent by the bot.skipAmount- The amount of pages to be skipped when clickingEmote.SKIP_BACKWARDandEmote.SKIP_FORWARDbuttons.- Returns:
- An
ActionReferencepointing to this action. This is useful if you need to track whether an event is still being processed or was already removed (ie. garbage collected). - Throws:
net.dv8tion.jda.api.exceptions.ErrorResponseException- Thrown if theMessageno longer exists or cannot be accessed when triggering aGenericMessageReactionEvent.net.dv8tion.jda.api.exceptions.InsufficientPermissionException- Thrown if this library cannot remove reactions due to lack of bot permission.InvalidStateException- Thrown if the library wasn't activated or the page list is empty.
-
paginate
public static ActionReference paginate(@NotNull net.dv8tion.jda.api.entities.Message msg, @NotNull List<Page> pages, boolean useButtons, int time, TimeUnit unit, int skipAmount) throws net.dv8tion.jda.api.exceptions.ErrorResponseException, net.dv8tion.jda.api.exceptions.InsufficientPermissionExceptionAdds navigation buttons to the specifiedMessage/MessageEmbedwhich will navigate through a givenListof pages. You can specify how long the listener will stay active before shutting down itself after a no-activity interval.- Parameters:
msg- TheMessagesent which will be paginated.pages- The pages to be shown. The order of theListwill define the order of the pages.useButtons- Whether to use interactionButtonor reactions. Will fall back to false if the suppliedMessagewas not sent by the bot.time- The time before the listener automatically stop listening for further events (recommended: 60).unit- The time'sTimeUnit(recommended:TimeUnit.SECONDS).skipAmount- The amount of pages to be skipped when clickingEmote.SKIP_BACKWARDandEmote.SKIP_FORWARDbuttons.- Returns:
- An
ActionReferencepointing to this action. This is useful if you need to track whether an event is still being processed or was already removed (ie. garbage collected). - Throws:
net.dv8tion.jda.api.exceptions.ErrorResponseException- Thrown if theMessageno longer exists or cannot be accessed when triggering aGenericMessageReactionEvent.net.dv8tion.jda.api.exceptions.InsufficientPermissionException- Thrown if this library cannot remove reactions due to lack of bot permission.InvalidStateException- Thrown if the library wasn't activated or the page list is empty.
-
paginate
public static ActionReference paginate(@NotNull net.dv8tion.jda.api.entities.Message msg, @NotNull List<Page> pages, boolean useButtons, int skipAmount, Predicate<net.dv8tion.jda.api.entities.User> canInteract) throws net.dv8tion.jda.api.exceptions.ErrorResponseException, net.dv8tion.jda.api.exceptions.InsufficientPermissionExceptionAdds navigation buttons to the specifiedMessage/MessageEmbedwhich will navigate through a givenListof pages.- Parameters:
msg- TheMessagesent which will be paginated.pages- The pages to be shown. The order of theListwill define the order of the pages.useButtons- Whether to use interactionButtonor reactions. Will fall back to false if the suppliedMessagewas not sent by the bot.skipAmount- The amount of pages to be skipped when clickingEmote.SKIP_BACKWARDandEmote.SKIP_FORWARDbuttons.canInteract-Predicateto determine whether theUserthat pressed the button can interact with it or not.- Returns:
- An
ActionReferencepointing to this action. This is useful if you need to track whether an event is still being processed or was already removed (ie. garbage collected). - Throws:
net.dv8tion.jda.api.exceptions.ErrorResponseException- Thrown if theMessageno longer exists or cannot be accessed when triggering aGenericMessageReactionEvent.net.dv8tion.jda.api.exceptions.InsufficientPermissionException- Thrown if this library cannot remove reactions due to lack of bot permission.InvalidStateException- Thrown if the library wasn't activated or the page list is empty.
-
paginate
public static ActionReference paginate(@NotNull net.dv8tion.jda.api.entities.Message msg, @NotNull List<Page> pages, boolean useButtons, int time, TimeUnit unit, int skipAmount, Predicate<net.dv8tion.jda.api.entities.User> canInteract) throws net.dv8tion.jda.api.exceptions.ErrorResponseException, net.dv8tion.jda.api.exceptions.InsufficientPermissionExceptionAdds navigation buttons to the specifiedMessage/MessageEmbedwhich will navigate through a givenListof pages. You can specify how long the listener will stay active before shutting down itself after a no-activity interval.- Parameters:
msg- TheMessagesent which will be paginated.pages- The pages to be shown. The order of theListwill define the order of the pages.useButtons- Whether to use interactionButtonor reactions. Will fall back to false if the suppliedMessagewas not sent by the bot.time- The time before the listener automatically stop listening for further events (recommended: 60).unit- The time'sTimeUnit(recommended:TimeUnit.SECONDS).skipAmount- The amount of pages to be skipped when clickingEmote.SKIP_BACKWARDandEmote.SKIP_FORWARDbuttons.canInteract-Predicateto determine whether theUserthat pressed the button can interact with it or not.- Returns:
- An
ActionReferencepointing to this action. This is useful if you need to track whether an event is still being processed or was already removed (ie. garbage collected). - Throws:
net.dv8tion.jda.api.exceptions.ErrorResponseException- Thrown if theMessageno longer exists or cannot be accessed when triggering aGenericMessageReactionEvent.net.dv8tion.jda.api.exceptions.InsufficientPermissionException- Thrown if this library cannot remove reactions due to lack of bot permission.InvalidStateException- Thrown if the library wasn't activated or the page list is empty.
-
paginate
public static ActionReference paginate(@NotNull net.dv8tion.jda.api.entities.Message msg, @NotNull List<Page> pages, boolean useButtons, int skipAmount, boolean fastForward, Predicate<net.dv8tion.jda.api.entities.User> canInteract) throws net.dv8tion.jda.api.exceptions.ErrorResponseException, net.dv8tion.jda.api.exceptions.InsufficientPermissionExceptionAdds navigation buttons to the specifiedMessage/MessageEmbedwhich will navigate through a givenListof pages.- Parameters:
msg- TheMessagesent which will be paginated.pages- The pages to be shown. The order of theListwill define the order of the pages.useButtons- Whether to use interactionButtonor reactions. Will fall back to false if the suppliedMessagewas not sent by the bot.skipAmount- The amount of pages to be skipped when clickingEmote.SKIP_BACKWARDandEmote.SKIP_FORWARDbuttons.fastForward- Whether theEmote.GOTO_FIRSTandEmote.GOTO_LASTbuttons should be shown.canInteract-Predicateto determine whether theUserthat pressed the button can interact with it or not.- Returns:
- An
ActionReferencepointing to this action. This is useful if you need to track whether an event is still being processed or was already removed (ie. garbage collected). - Throws:
net.dv8tion.jda.api.exceptions.ErrorResponseException- Thrown if theMessageno longer exists or cannot be accessed when triggering aGenericMessageReactionEvent.net.dv8tion.jda.api.exceptions.InsufficientPermissionException- Thrown if this library cannot remove reactions due to lack of bot permission.InvalidStateException- Thrown if the library wasn't activated or the page list is empty.
-
paginate
public static ActionReference paginate(@NotNull net.dv8tion.jda.api.entities.Message msg, @NotNull List<Page> pages, boolean useButtons, int time, TimeUnit unit, int skipAmount, boolean fastForward) throws net.dv8tion.jda.api.exceptions.ErrorResponseException, net.dv8tion.jda.api.exceptions.InsufficientPermissionExceptionAdds navigation buttons to the specifiedMessage/MessageEmbedwhich will navigate through a givenListof pages. You can specify how long the listener will stay active before shutting down itself after a no-activity interval.- Parameters:
msg- TheMessagesent which will be paginated.pages- The pages to be shown. The order of theListwill define the order of the pages.useButtons- Whether to use interactionButtonor reactions. Will fall back to false if the suppliedMessagewas not sent by the bot.time- The time before the listener automatically stop listening for further events (recommended: 60).unit- The time'sTimeUnit(recommended:TimeUnit.SECONDS).skipAmount- The amount of pages to be skipped when clickingEmote.SKIP_BACKWARDandEmote.SKIP_FORWARDbuttons.fastForward- Whether theEmote.GOTO_FIRSTandEmote.GOTO_LASTbuttons should be shown.- Returns:
- An
ActionReferencepointing to this action. This is useful if you need to track whether an event is still being processed or was already removed (ie. garbage collected). - Throws:
net.dv8tion.jda.api.exceptions.ErrorResponseException- Thrown if theMessageno longer exists or cannot be accessed when triggering aGenericMessageReactionEvent.net.dv8tion.jda.api.exceptions.InsufficientPermissionException- Thrown if this library cannot remove reactions due to lack of bot permission.InvalidStateException- Thrown if the library wasn't activated or the page list is empty.
-
paginate
public static ActionReference paginate(@NotNull net.dv8tion.jda.api.entities.Message msg, @NotNull List<Page> pages, boolean useButtons, int time, TimeUnit unit, int skipAmount, boolean fastForward, Predicate<net.dv8tion.jda.api.entities.User> canInteract) throws net.dv8tion.jda.api.exceptions.ErrorResponseException, net.dv8tion.jda.api.exceptions.InsufficientPermissionExceptionAdds navigation buttons to the specifiedMessage/MessageEmbedwhich will navigate through a givenListof pages. You can specify how long the listener will stay active before shutting down itself after a no-activity interval.- Parameters:
msg- TheMessagesent which will be paginated.pages- The pages to be shown. The order of theListwill define the order of the pages.useButtons- Whether to use interactionButtonor reactions. Will fall back to false if the suppliedMessagewas not sent by the bot.time- The time before the listener automatically stop listening for further events (recommended: 60).unit- The time'sTimeUnit(recommended:TimeUnit.SECONDS).skipAmount- The amount of pages to be skipped when clickingEmote.SKIP_BACKWARDandEmote.SKIP_FORWARDbuttons.fastForward- Whether theEmote.GOTO_FIRSTandEmote.GOTO_LASTbuttons should be shown.canInteract-Predicateto determine whether theUserthat pressed the button can interact with it or not.- Returns:
- An
ActionReferencepointing to this action. This is useful if you need to track whether an event is still being processed or was already removed (ie. garbage collected). - Throws:
net.dv8tion.jda.api.exceptions.ErrorResponseException- Thrown if theMessageno longer exists or cannot be accessed when triggering aGenericMessageReactionEvent.net.dv8tion.jda.api.exceptions.InsufficientPermissionException- Thrown if this library cannot remove reactions due to lack of bot permission.InvalidStateException- Thrown if the library wasn't activated or the page list is empty.
-
paginate
public static ActionReference paginate(@NotNull net.dv8tion.jda.api.entities.Message msg, @NotNull PaginateHelper helper) throws net.dv8tion.jda.api.exceptions.ErrorResponseException, net.dv8tion.jda.api.exceptions.InsufficientPermissionExceptionAdds navigation buttons to the specifiedMessage/MessageEmbedwhich will navigate through a givenListof pages. This versions uses a helper class to aid customization and allow reusage of configurations.- Parameters:
msg- TheMessagesent which will be paginated.helper- APaginateHelperholding desired pagination settings.- Returns:
- An
ActionReferencepointing to this action. This is useful if you need to track whether an event is still being processed or was already removed (ie. garbage collected). - Throws:
net.dv8tion.jda.api.exceptions.ErrorResponseException- Thrown if theMessageno longer exists or cannot be accessed when triggering aGenericMessageReactionEvent.net.dv8tion.jda.api.exceptions.InsufficientPermissionException- Thrown if this library cannot remove reactions due to lack of bot permission.InvalidStateException- Thrown if the library wasn't activated or the page list is empty.
-
categorize
public static ActionReference categorize(@NotNull net.dv8tion.jda.api.entities.Message msg, @NotNull Map<net.dv8tion.jda.api.entities.emoji.Emoji,Page> categories, boolean useButtons) throws net.dv8tion.jda.api.exceptions.ErrorResponseException, net.dv8tion.jda.api.exceptions.InsufficientPermissionExceptionAdds menu-like buttons to the specifiedMessage/MessageEmbedwhich will browse through a givenMapof pages. You may only specify onePageper button, adding another button with an existing unicode will overwrite the current button'sPage.- Parameters:
msg- TheMessagesent which will be categorized.categories- The categories to be shown. The categories are defined by aMapcontaining emoji unicodes or emote ids as keys andPagesas values.useButtons- Whether to use interactionButtonor reactions. Will fall back to false if the suppliedMessagewas not sent by the bot.- Returns:
- an
ActionReferencepointing to the newly created event, can be used for checking when it gets disposed of. - Throws:
net.dv8tion.jda.api.exceptions.ErrorResponseException- Thrown if theMessageno longer exists or cannot be accessed when triggering aGenericMessageReactionEvent.net.dv8tion.jda.api.exceptions.InsufficientPermissionException- Thrown if this library cannot remove reactions due to lack of bot permission.InvalidStateException- Thrown if the library wasn't activated.
-
categorize
public static ActionReference categorize(@NotNull net.dv8tion.jda.api.entities.Message msg, @NotNull Map<net.dv8tion.jda.api.entities.emoji.Emoji,Page> categories, boolean useButtons, int time, TimeUnit unit) throws net.dv8tion.jda.api.exceptions.ErrorResponseException, net.dv8tion.jda.api.exceptions.InsufficientPermissionExceptionAdds menu-like buttons to the specifiedMessage/MessageEmbedwhich will browse through a givenMapof pages. You may only specify onePageper button, adding another button with an existing unicode will overwrite the current button'sPage. You can specify how long the listener will stay active before shutting down itself after a no-activity interval.- Parameters:
msg- TheMessagesent which will be categorized.categories- The categories to be shown. The categories are defined by aMapcontaining emoji unicodes or emote ids as keys andPagesas values.useButtons- Whether to use interactionButtonor reactions. Will fall back to false if the suppliedMessagewas not sent by the bot.time- The time before the listener automatically stop listening for further events (recommended: 60).unit- The time'sTimeUnit(recommended:TimeUnit.SECONDS).- Returns:
- an
ActionReferencepointing to the newly created event, can be used for checking when it gets disposed of. - Throws:
net.dv8tion.jda.api.exceptions.ErrorResponseException- Thrown if theMessageno longer exists or cannot be accessed when triggering aGenericMessageReactionEvent.net.dv8tion.jda.api.exceptions.InsufficientPermissionException- Thrown if this library cannot remove reactions due to lack of bot permission.InvalidStateException- Thrown if the library wasn't activated.
-
categorize
public static ActionReference categorize(@NotNull net.dv8tion.jda.api.entities.Message msg, @NotNull Map<net.dv8tion.jda.api.entities.emoji.Emoji,Page> categories, boolean useButtons, Predicate<net.dv8tion.jda.api.entities.User> canInteract) throws net.dv8tion.jda.api.exceptions.ErrorResponseException, net.dv8tion.jda.api.exceptions.InsufficientPermissionExceptionAdds menu-like buttons to the specifiedMessage/MessageEmbedwhich will browse through a givenMapof pages. You may only specify onePageper button, adding another button with an existing unicode will overwrite the current button'sPage.- Parameters:
msg- TheMessagesent which will be categorized.categories- The categories to be shown. The categories are defined by aMapcontaining emoji unicodes or emote ids as keys andPagesas values.useButtons- Whether to use interactionButtonor reactions. Will fall back to false if the suppliedMessagewas not sent by the bot.canInteract-Predicateto determine whether theUserthat pressed the button can interact with it or not.- Returns:
- an
ActionReferencepointing to the newly created event, can be used for checking when it gets disposed of. - Throws:
net.dv8tion.jda.api.exceptions.ErrorResponseException- Thrown if theMessageno longer exists or cannot be accessed when triggering aGenericMessageReactionEvent.net.dv8tion.jda.api.exceptions.InsufficientPermissionException- Thrown if this library cannot remove reactions due to lack of bot permission.InvalidStateException- Thrown if the library wasn't activated.
-
categorize
public static ActionReference categorize(@NotNull net.dv8tion.jda.api.entities.Message msg, @NotNull Map<net.dv8tion.jda.api.entities.emoji.Emoji,Page> categories, boolean useButtons, int time, TimeUnit unit, Predicate<net.dv8tion.jda.api.entities.User> canInteract) throws net.dv8tion.jda.api.exceptions.ErrorResponseException, net.dv8tion.jda.api.exceptions.InsufficientPermissionExceptionAdds menu-like buttons to the specifiedMessage/MessageEmbedwhich will browse through a givenMapof pages. You may only specify onePageper button, adding another button with an existing unicode will overwrite the current button'sPage. You can specify how long the listener will stay active before shutting down itself after a no-activity interval.- Parameters:
msg- TheMessagesent which will be categorized.categories- The categories to be shown. The categories are defined by aMapcontaining emoji unicodes or emote ids as keys andPagesas values.useButtons- Whether to use interactionButtonor reactions. Will fall back to false if the suppliedMessagewas not sent by the bot.time- The time before the listener automatically stop listening for further events (recommended: 60).unit- The time'sTimeUnit(recommended:TimeUnit.SECONDS).canInteract-Predicateto determine whether theUserthat pressed the button can interact with it or not.- Returns:
- an
ActionReferencepointing to the newly created event, can be used for checking when it gets disposed of. - Throws:
net.dv8tion.jda.api.exceptions.ErrorResponseException- Thrown if theMessageno longer exists or cannot be accessed when triggering aGenericMessageReactionEvent.net.dv8tion.jda.api.exceptions.InsufficientPermissionException- Thrown if this library cannot remove reactions due to lack of bot permission.InvalidStateException- Thrown if the library wasn't activated.
-
categorize
public static ActionReference categorize(@NotNull net.dv8tion.jda.api.entities.Message msg, @NotNull CategorizeHelper helper) throws net.dv8tion.jda.api.exceptions.ErrorResponseException, net.dv8tion.jda.api.exceptions.InsufficientPermissionExceptionAdds menu-like buttons to the specifiedMessage/MessageEmbedwhich will browse through a givenMapof pages. You may only specify onePageper button, adding another button with an existing unicode will overwrite the current button'sPage. This versions uses a helper class to aid customization and allow reusage of configurations.- Parameters:
msg- TheMessagesent which will be categorized.helper- ACategorizeHelperholding desired categorization settings.- Returns:
- an
ActionReferencepointing to the newly created event, can be used for checking when it gets disposed of. - Throws:
net.dv8tion.jda.api.exceptions.ErrorResponseException- Thrown if theMessageno longer exists or cannot be accessed when triggering aGenericMessageReactionEvent.net.dv8tion.jda.api.exceptions.InsufficientPermissionException- Thrown if this library cannot remove reactions due to lack of bot permission.InvalidStateException- Thrown if the library wasn't activated.
-
buttonize
public static ActionReference buttonize(@NotNull net.dv8tion.jda.api.entities.Message msg, @NotNull Map<net.dv8tion.jda.api.entities.emoji.Emoji,ThrowingConsumer<ButtonWrapper>> buttons, boolean useButtons, boolean showCancelButton) throws net.dv8tion.jda.api.exceptions.ErrorResponseException, net.dv8tion.jda.api.exceptions.InsufficientPermissionExceptionAdds buttons to the specifiedMessage/MessageEmbed, with each executing a specific task on click. You may only specify oneRunnableper button, adding another button with an existing unicode will overwrite the current button'sRunnable.- Parameters:
msg- TheMessagesent which will be buttoned.buttons- The buttons to be shown. The buttons are defined by a Map containing emoji unicodes or emote ids as keys andThrowingTriConsumer<Member,Message,InteractionHook> containing desired behavior as value.useButtons- Whether to use interactionButtonor reactions. Will fall back to false if the suppliedMessagewas not sent by the bot.showCancelButton- Should theEmote.CANCELbutton be created automatically?- Returns:
- an
ActionReferencepointing to the newly created event, can be used for checking when it gets disposed of. - Throws:
net.dv8tion.jda.api.exceptions.ErrorResponseException- Thrown if theMessageno longer exists or cannot be accessed when triggering aGenericMessageReactionEvent.net.dv8tion.jda.api.exceptions.InsufficientPermissionException- Thrown if this library cannot remove reactions due to lack of bot permission.InvalidStateException- Thrown if the library wasn't activated.
-
buttonize
public static ActionReference buttonize(@NotNull net.dv8tion.jda.api.entities.Message msg, @NotNull Map<net.dv8tion.jda.api.entities.emoji.Emoji,ThrowingConsumer<ButtonWrapper>> buttons, boolean useButtons, boolean showCancelButton, int time, TimeUnit unit) throws net.dv8tion.jda.api.exceptions.ErrorResponseException, net.dv8tion.jda.api.exceptions.InsufficientPermissionExceptionAdds buttons to the specifiedMessage/MessageEmbed, with each executing a specific task on click. You may only specify oneRunnableper button, adding another button with an existing unicode will overwrite the current button'sRunnable. You can specify the time in which the listener will automatically stop itself after a no-activity interval.- Parameters:
msg- TheMessagesent which will be buttoned.buttons- The buttons to be shown. The buttons are defined by a Map containing emoji unicodes or emote ids as keys andThrowingTriConsumer<Member,Message,InteractionHook> containing desired behavior as value.useButtons- Whether to use interactionButtonor reactions. Will fall back to false if the suppliedMessagewas not sent by the bot.showCancelButton- Should theEmote.CANCELbutton be created automatically?time- The time before the listener automatically stop listening for further events (recommended: 60).unit- The time'sTimeUnit(recommended:TimeUnit.SECONDS).- Returns:
- an
ActionReferencepointing to the newly created event, can be used for checking when it gets disposed of. - Throws:
net.dv8tion.jda.api.exceptions.ErrorResponseException- Thrown if theMessageno longer exists or cannot be accessed when triggering aGenericMessageReactionEvent.net.dv8tion.jda.api.exceptions.InsufficientPermissionException- Thrown if this library cannot remove reactions due to lack of bot permission.InvalidStateException- Thrown if the library wasn't activated.
-
buttonize
public static ActionReference buttonize(@NotNull net.dv8tion.jda.api.entities.Message msg, @NotNull Map<net.dv8tion.jda.api.entities.emoji.Emoji,ThrowingConsumer<ButtonWrapper>> buttons, boolean useButtons, boolean showCancelButton, Predicate<net.dv8tion.jda.api.entities.User> canInteract) throws net.dv8tion.jda.api.exceptions.ErrorResponseException, net.dv8tion.jda.api.exceptions.InsufficientPermissionExceptionAdds buttons to the specifiedMessage/MessageEmbed, with each executing a specific task on click. You may only specify oneRunnableper button, adding another button with an existing unicode will overwrite the current button'sRunnable.- Parameters:
msg- TheMessagesent which will be buttoned.buttons- The buttons to be shown. The buttons are defined by a Map containing emoji unicodes or emote ids as keys andThrowingTriConsumer<Member,Message,InteractionHook> containing desired behavior as value.useButtons- Whether to use interactionButtonor reactions. Will fall back to false if the suppliedMessagewas not sent by the bot.showCancelButton- Should theEmote.CANCELbutton be created automatically?canInteract-Predicateto determine whether theUserthat pressed the button can interact with it or not.- Returns:
- an
ActionReferencepointing to the newly created event, can be used for checking when it gets disposed of. - Throws:
net.dv8tion.jda.api.exceptions.ErrorResponseException- Thrown if theMessageno longer exists or cannot be accessed when triggering aGenericMessageReactionEvent.net.dv8tion.jda.api.exceptions.InsufficientPermissionException- Thrown if this library cannot remove reactions due to lack of bot permission.InvalidStateException- Thrown if the library wasn't activated.
-
buttonize
public static ActionReference buttonize(@NotNull net.dv8tion.jda.api.entities.Message msg, @NotNull Map<net.dv8tion.jda.api.entities.emoji.Emoji,ThrowingConsumer<ButtonWrapper>> buttons, boolean useButtons, boolean showCancelButton, int time, TimeUnit unit, Predicate<net.dv8tion.jda.api.entities.User> canInteract) throws net.dv8tion.jda.api.exceptions.ErrorResponseException, net.dv8tion.jda.api.exceptions.InsufficientPermissionExceptionAdds buttons to the specifiedMessage/MessageEmbed, with each executing a specific task on click. You may only specify oneRunnableper button, adding another button with an existing unicode will overwrite the current button'sRunnable. You can specify the time in which the listener will automatically stop itself after a no-activity interval.- Parameters:
msg- TheMessagesent which will be buttoned.buttons- The buttons to be shown. The buttons are defined by a Map containing emoji unicodes or emote ids as keys andThrowingTriConsumer<Member,Message,InteractionHook> containing desired behavior as value.useButtons- Whether to use interactionButtonor reactions. Will fall back to false if the suppliedMessagewas not sent by the bot.showCancelButton- Should theEmote.CANCELbutton be created automatically?time- The time before the listener automatically stop listening for further events (recommended: 60).unit- The time'sTimeUnit(recommended:TimeUnit.SECONDS).canInteract-Predicateto determine whether theUserthat pressed the button can interact with it or not.- Returns:
- an
ActionReferencepointing to the newly created event, can be used for checking when it gets disposed of. - Throws:
net.dv8tion.jda.api.exceptions.ErrorResponseException- Thrown if theMessageno longer exists or cannot be accessed when triggering aGenericMessageReactionEvent.net.dv8tion.jda.api.exceptions.InsufficientPermissionException- Thrown if this library cannot remove reactions due to lack of bot permission.InvalidStateException- Thrown if the library wasn't activated.
-
buttonize
public static ActionReference buttonize(@NotNull net.dv8tion.jda.api.entities.Message msg, @NotNull Map<net.dv8tion.jda.api.entities.emoji.Emoji,ThrowingConsumer<ButtonWrapper>> buttons, boolean useButtons, boolean showCancelButton, Predicate<net.dv8tion.jda.api.entities.User> canInteract, Consumer<net.dv8tion.jda.api.entities.Message> onCancel) throws net.dv8tion.jda.api.exceptions.ErrorResponseException, net.dv8tion.jda.api.exceptions.InsufficientPermissionExceptionAdds buttons to the specifiedMessage/MessageEmbed, with each executing a specific task on click. You may only specify oneRunnableper button, adding another button with an existing unicode will overwrite the current button'sRunnable.- Parameters:
msg- TheMessagesent which will be buttoned.buttons- The buttons to be shown. The buttons are defined by a Map containing emoji unicodes or emote ids as keys andThrowingTriConsumer<Member,Message,InteractionHook> containing desired behavior as value.useButtons- Whether to use interactionButtonor reactions. Will fall back to false if the suppliedMessagewas not sent by the bot.showCancelButton- Should theEmote.CANCELbutton be created automatically?canInteract-Predicateto determine whether theUserthat pressed the button can interact with it or not.onCancel- Action to be run after the listener is removed.- Returns:
- an
ActionReferencepointing to the newly created event, can be used for checking when it gets disposed of. - Throws:
net.dv8tion.jda.api.exceptions.ErrorResponseException- Thrown if theMessageno longer exists or cannot be accessed when triggering aGenericMessageReactionEvent.net.dv8tion.jda.api.exceptions.InsufficientPermissionException- Thrown if this library cannot remove reactions due to lack of bot permission.InvalidStateException- Thrown if the library wasn't activated.
-
buttonize
public static ActionReference buttonize(@NotNull net.dv8tion.jda.api.entities.Message msg, @NotNull Map<net.dv8tion.jda.api.entities.emoji.Emoji,ThrowingConsumer<ButtonWrapper>> buttons, boolean useButtons, boolean cancellable, int time, TimeUnit unit, Predicate<net.dv8tion.jda.api.entities.User> canInteract, Consumer<net.dv8tion.jda.api.entities.Message> onCancel) throws net.dv8tion.jda.api.exceptions.ErrorResponseException, net.dv8tion.jda.api.exceptions.InsufficientPermissionExceptionAdds buttons to the specifiedMessage/MessageEmbed, with each executing a specific task on click. You may only specify oneRunnableper button, adding another button with an existing unicode will overwrite the current button'sRunnable. You can specify the time in which the listener will automatically stop itself after a no-activity interval.- Parameters:
msg- TheMessagesent which will be buttoned.buttons- The buttons to be shown. The buttons are defined by a Map containing emoji unicodes or emote ids as keys andThrowingTriConsumer<Member,Message,InteractionHook> containing desired behavior as value.useButtons- Whether to use interactionButtonor reactions. Will fall back to false if the suppliedMessagewas not sent by the bot.cancellable- Should theEmote.CANCELbutton be created automatically?time- The time before the listener automatically stop listening for further events (recommended: 60).unit- The time'sTimeUnit(recommended:TimeUnit.SECONDS).canInteract-Predicateto determine whether theUserthat pressed the button can interact with it or not.onCancel- Action to be run after the listener is removed.- Returns:
- an
ActionReferencepointing to the newly created event, can be used for checking when it gets disposed of. - Throws:
net.dv8tion.jda.api.exceptions.ErrorResponseException- Thrown if theMessageno longer exists or cannot be accessed when triggering aGenericMessageReactionEvent.net.dv8tion.jda.api.exceptions.InsufficientPermissionException- Thrown if this library cannot remove reactions due to lack of bot permission.InvalidStateException- Thrown if the library wasn't activated.
-
buttonize
public static ActionReference buttonize(@NotNull net.dv8tion.jda.api.entities.Message msg, @NotNull ButtonizeHelper helper) throws net.dv8tion.jda.api.exceptions.ErrorResponseException, net.dv8tion.jda.api.exceptions.InsufficientPermissionExceptionAdds buttons to the specifiedMessage/MessageEmbed, with each executing a specific task on click. You may only specify oneRunnableper button, adding another button with an existing unicode will overwrite the current button'sRunnable. This versions uses a helper class to aid customization and allow reusage of configurations.- Parameters:
msg- TheMessagesent which will be buttoned.helper- AButtonizeHelperholding desired buttonization settings.- Returns:
- an
ActionReferencepointing to the newly created event, can be used for checking when it gets disposed of. - Throws:
net.dv8tion.jda.api.exceptions.ErrorResponseException- Thrown if theMessageno longer exists or cannot be accessed when triggering aGenericMessageReactionEvent.net.dv8tion.jda.api.exceptions.InsufficientPermissionException- Thrown if this library cannot remove reactions due to lack of bot permission.InvalidStateException- Thrown if the library wasn't activated.
-
lazyPaginate
public static ActionReference lazyPaginate(@NotNull net.dv8tion.jda.api.entities.Message msg, @NotNull ThrowingFunction<Integer,Page> pageLoader, boolean useButtons) throws net.dv8tion.jda.api.exceptions.ErrorResponseException, net.dv8tion.jda.api.exceptions.InsufficientPermissionExceptionAdds navigation buttons to the specifiedMessage/MessageEmbedwhich will lazily load content by using suppliedThrowingFunction. For this reason, this pagination type cannot have skip nor fast-forward buttons given the unknown page limit.- Parameters:
msg- TheMessagesent which will be paginated.pageLoader-ThrowingFunction<Integer,Page> to generate the next page. If this returns null the method will treat it as last page, preventing unnecessary updates.useButtons- Whether to use interactionButtonor reactions. Will fall back to false if the suppliedMessagewas not sent by the bot.- Returns:
- an
ActionReferencepointing to the newly created event, can be used for checking when it gets disposed of. - Throws:
net.dv8tion.jda.api.exceptions.ErrorResponseException- Thrown if theMessageno longer exists or cannot be accessed when triggering aGenericMessageReactionEvent.net.dv8tion.jda.api.exceptions.InsufficientPermissionException- Thrown if this library cannot remove reactions due to lack of bot permission.InvalidStateException- Thrown if the library wasn't activated or first page cannot be generated.
-
lazyPaginate
public static ActionReference lazyPaginate(@NotNull net.dv8tion.jda.api.entities.Message msg, @NotNull ThrowingFunction<Integer,Page> pageLoader, boolean useButtons, int time, TimeUnit unit) throws net.dv8tion.jda.api.exceptions.ErrorResponseException, net.dv8tion.jda.api.exceptions.InsufficientPermissionExceptionAdds navigation buttons to the specifiedMessage/MessageEmbedwhich will lazily load content by using suppliedThrowingFunction. For this reason, this pagination type cannot have skip nor fast-forward buttons given the unknown page limit You can specify how long the listener will stay active before shutting down itself after a no-activity interval.- Parameters:
msg- TheMessagesent which will be paginated.pageLoader-ThrowingFunction<Integer,Page> to generate the next page. If this returns null the method will treat it as last page, preventing unnecessary updates.useButtons- Whether to use interactionButtonor reactions. Will fall back to false if the suppliedMessagewas not sent by the bot.time- The time before the listener automatically stop listening for further events (recommended: 60).unit- The time'sTimeUnit(recommended:TimeUnit.SECONDS).- Returns:
- an
ActionReferencepointing to the newly created event, can be used for checking when it gets disposed of. - Throws:
net.dv8tion.jda.api.exceptions.ErrorResponseException- Thrown if theMessageno longer exists or cannot be accessed when triggering aGenericMessageReactionEvent.net.dv8tion.jda.api.exceptions.InsufficientPermissionException- Thrown if this library cannot remove reactions due to lack of bot permission.InvalidStateException- Thrown if the library wasn't activated or first page cannot be generated.
-
lazyPaginate
public static ActionReference lazyPaginate(@NotNull net.dv8tion.jda.api.entities.Message msg, @NotNull ThrowingFunction<Integer,Page> pageLoader, boolean useButtons, Predicate<net.dv8tion.jda.api.entities.User> canInteract) throws net.dv8tion.jda.api.exceptions.ErrorResponseException, net.dv8tion.jda.api.exceptions.InsufficientPermissionExceptionAdds navigation buttons to the specifiedMessage/MessageEmbedwhich will lazily load content by using suppliedThrowingFunction. For this reason, this pagination type cannot have skip nor fast-forward buttons given the unknown page limit.- Parameters:
msg- TheMessagesent which will be paginated.pageLoader-ThrowingFunction<Integer,Page> to generate the next page. If this returns null the method will treat it as last page, preventing unnecessary updates.useButtons- Whether to use interactionButtonor reactions. Will fall back to false if the suppliedMessagewas not sent by the bot.canInteract-Predicateto determine whether theUserthat pressed the button can interact with it or not.- Returns:
- an
ActionReferencepointing to the newly created event, can be used for checking when it gets disposed of. - Throws:
net.dv8tion.jda.api.exceptions.ErrorResponseException- Thrown if theMessageno longer exists or cannot be accessed when triggering aGenericMessageReactionEvent.net.dv8tion.jda.api.exceptions.InsufficientPermissionException- Thrown if this library cannot remove reactions due to lack of bot permission.InvalidStateException- Thrown if the library wasn't activated or first page cannot be generated.
-
lazyPaginate
public static ActionReference lazyPaginate(@NotNull net.dv8tion.jda.api.entities.Message msg, @NotNull ThrowingFunction<Integer,Page> pageLoader, boolean useButtons, int time, TimeUnit unit, Predicate<net.dv8tion.jda.api.entities.User> canInteract) throws net.dv8tion.jda.api.exceptions.ErrorResponseException, net.dv8tion.jda.api.exceptions.InsufficientPermissionExceptionAdds navigation buttons to the specifiedMessage/MessageEmbedwhich will lazily load content by using suppliedThrowingFunction. For this reason, this pagination type cannot have skip nor fast-forward buttons given the unknown page limit. You can specify how long the listener will stay active before shutting down itself after a no-activity interval.- Parameters:
msg- TheMessagesent which will be paginated.pageLoader-ThrowingFunction<Integer,Page> to generate the next page. If this returns null the method will treat it as last page, preventing unnecessary updates.useButtons- Whether to use interactionButtonor reactions. Will fall back to false if the suppliedMessagewas not sent by the bot.time- The time before the listener automatically stop listening. for further events (recommended: 60).unit- The time'sTimeUnit(recommended:TimeUnit.SECONDS).canInteract-Predicateto determine whether theUserthat pressed the button can interact with it or not.- Returns:
- an
ActionReferencepointing to the newly created event, can be used for checking when it gets disposed of. - Throws:
net.dv8tion.jda.api.exceptions.ErrorResponseException- Thrown if theMessageno longer exists or cannot be accessed when triggering aGenericMessageReactionEvent.net.dv8tion.jda.api.exceptions.InsufficientPermissionException- Thrown if this library cannot remove reactions due to lack of bot permission.InvalidStateException- Thrown if the library wasn't activated or first page cannot be generated.
-
lazyPaginate
public static ActionReference lazyPaginate(@NotNull net.dv8tion.jda.api.entities.Message msg, List<Page> pageCache, @NotNull ThrowingFunction<Integer,Page> pageLoader, boolean useButtons) throws net.dv8tion.jda.api.exceptions.ErrorResponseException, net.dv8tion.jda.api.exceptions.InsufficientPermissionExceptionAdds navigation buttons to the specifiedMessage/MessageEmbedwhich will lazily load content by using suppliedThrowingFunction. For this reason, this pagination type cannot have skip nor fast-forward buttons given the unknown page limit.- Parameters:
msg- TheMessagesent which will be paginated.pageCache- TheListthat'll hold previously visited pages (can be pre-filled or edited anytime).pageLoader-ThrowingFunction<Integer,Page> to generate the next page. If this returns null the method will treat it as last page, preventing unnecessary updates.useButtons- Whether to use interactionButtonor reactions. Will fall back to false if the suppliedMessagewas not sent by the bot.- Returns:
- an
ActionReferencepointing to the newly created event, can be used for checking when it gets disposed of. - Throws:
net.dv8tion.jda.api.exceptions.ErrorResponseException- Thrown if theMessageno longer exists or cannot be accessed when triggering aGenericMessageReactionEvent.net.dv8tion.jda.api.exceptions.InsufficientPermissionException- Thrown if this library cannot remove reactions due to lack of bot permission.InvalidStateException- Thrown if the library wasn't activated or first page cannot be generated.
-
lazyPaginate
public static ActionReference lazyPaginate(@NotNull net.dv8tion.jda.api.entities.Message msg, List<Page> pageCache, @NotNull ThrowingFunction<Integer,Page> pageLoader, boolean useButtons, int time, TimeUnit unit) throws net.dv8tion.jda.api.exceptions.ErrorResponseException, net.dv8tion.jda.api.exceptions.InsufficientPermissionExceptionAdds navigation buttons to the specifiedMessage/MessageEmbedwhich will lazily load content by using suppliedThrowingFunction. For this reason, this pagination type cannot have skip nor fast-forward buttons given the unknown page limit. You can specify how long the listener will stay active before shutting down itself after a no-activity interval.- Parameters:
msg- TheMessagesent which will be paginated.pageCache- TheListthat'll hold previously visited pages (can be pre-filled or edited anytime).pageLoader-ThrowingFunction<Integer,Page> to generate the next page. If this returns null the method will treat it as last page, preventing unnecessary updates.useButtons- Whether to use interactionButtonor reactions. Will fall back to false if the suppliedMessagewas not sent by the bot.time- The time before the listener automatically stop listening for further events (recommended: 60).unit- The time'sTimeUnit(recommended:TimeUnit.SECONDS).- Returns:
- an
ActionReferencepointing to the newly created event, can be used for checking when it gets disposed of. - Throws:
net.dv8tion.jda.api.exceptions.ErrorResponseException- Thrown if theMessageno longer exists or cannot be accessed when triggering aGenericMessageReactionEvent.net.dv8tion.jda.api.exceptions.InsufficientPermissionException- Thrown if this library cannot remove reactions due to lack of bot permission.InvalidStateException- Thrown if the library wasn't activated or first page cannot be generated.
-
lazyPaginate
public static ActionReference lazyPaginate(@NotNull net.dv8tion.jda.api.entities.Message msg, List<Page> pageCache, @NotNull ThrowingFunction<Integer,Page> pageLoader, boolean useButtons, Predicate<net.dv8tion.jda.api.entities.User> canInteract) throws net.dv8tion.jda.api.exceptions.ErrorResponseException, net.dv8tion.jda.api.exceptions.InsufficientPermissionExceptionAdds navigation buttons to the specifiedMessage/MessageEmbedwhich will lazily load content by using suppliedThrowingFunction. For this reason, this pagination type cannot have skip nor fast-forward buttons given the unknown page limit.- Parameters:
msg- TheMessagesent which will be paginated.pageCache- TheListthat'll hold previously visited pages (can be pre-filled or edited anytime).pageLoader-ThrowingFunction<Integer,Page> to generate the next page. If this returns null the method will treat it as last page, preventing unnecessary updates.useButtons- Whether to use interactionButtonor reactions. Will fall back to false if the suppliedMessagewas not sent by the bot.canInteract-Predicateto determine whether theUserthat pressed the button can interact with it or not.- Returns:
- an
ActionReferencepointing to the newly created event, can be used for checking when it gets disposed of. - Throws:
net.dv8tion.jda.api.exceptions.ErrorResponseException- Thrown if theMessageno longer exists or cannot be accessed when triggering aGenericMessageReactionEvent.net.dv8tion.jda.api.exceptions.InsufficientPermissionException- Thrown if this library cannot remove reactions due to lack of bot permission.InvalidStateException- Thrown if the library wasn't activated or first page cannot be generated.
-
lazyPaginate
public static ActionReference lazyPaginate(@NotNull net.dv8tion.jda.api.entities.Message msg, List<Page> pageCache, @NotNull ThrowingFunction<Integer,Page> pageLoader, boolean useButtons, int time, TimeUnit unit, Predicate<net.dv8tion.jda.api.entities.User> canInteract) throws net.dv8tion.jda.api.exceptions.ErrorResponseException, net.dv8tion.jda.api.exceptions.InsufficientPermissionExceptionAdds navigation buttons to the specifiedMessage/MessageEmbedwhich will lazily load content by using suppliedThrowingFunction. For this reason, this pagination type cannot have skip nor fast-forward buttons given the unknown page limit. You can specify how long the listener will stay active before shutting down itself after a no-activity interval.- Parameters:
msg- TheMessagesent which will be paginated.pageCache- TheListthat'll hold previously visited pages (can be pre-filled or edited anytime).pageLoader-ThrowingFunction<Integer,Page> to generate the next page. If this returns null the method will treat it as last page, preventing unnecessary updates.useButtons- Whether to use interactionButtonor reactions. Will fall back to false if the suppliedMessagewas not sent by the bot.time- The time before the listener automatically stop listening for further events (recommended: 60).unit- The time'sTimeUnit(recommended:TimeUnit.SECONDS).canInteract-Predicateto determine whether theUserthat pressed the button can interact with it or not.- Returns:
- an
ActionReferencepointing to the newly created event, can be used for checking when it gets disposed of. - Throws:
net.dv8tion.jda.api.exceptions.ErrorResponseException- Thrown if theMessageno longer exists or cannot be accessed when triggering aGenericMessageReactionEvent.net.dv8tion.jda.api.exceptions.InsufficientPermissionException- Thrown if this library cannot remove reactions due to lack of bot permission.InvalidStateException- Thrown if the library wasn't activated or first page cannot be generated.
-
lazyPaginate
public static ActionReference lazyPaginate(@NotNull net.dv8tion.jda.api.entities.Message msg, @NotNull LazyPaginateHelper helper) throws net.dv8tion.jda.api.exceptions.ErrorResponseException, net.dv8tion.jda.api.exceptions.InsufficientPermissionExceptionAdds navigation buttons to the specifiedMessage/MessageEmbedwhich will lazily load content by using suppliedThrowingFunction. For this reason, this pagination type cannot have skip nor fast-forward buttons given the unknown page limit. This versions uses a helper class to aid customization and allow reusage of configurations.- Parameters:
msg- TheMessagesent which will be paginated.helper- ALazyPaginateHelperholding desired lazy pagination settings.- Returns:
- an
ActionReferencepointing to the newly created event, can be used for checking when it gets disposed of. - Throws:
net.dv8tion.jda.api.exceptions.ErrorResponseException- Thrown if theMessageno longer exists or cannot be accessed when triggering aGenericMessageReactionEvent.net.dv8tion.jda.api.exceptions.InsufficientPermissionException- Thrown if this library cannot remove reactions due to lack of bot permission.InvalidStateException- Thrown if the library wasn't activated or first page cannot be generated.
-
reloadMessage
public static net.dv8tion.jda.api.entities.Message reloadMessage(@NotNull net.dv8tion.jda.api.entities.Message msg)Utility method for re-fetching a message.- Parameters:
msg- TheMessageto be reloaded.- Returns:
- The updated message instance.
-
subGet
public static <T> T subGet(@NotNull net.dv8tion.jda.api.requests.RestAction<T> future)Utility method for submitting aRestActionand awaiting its result.- Type Parameters:
T- Return type for theRestAction.- Parameters:
future- TheRestActionto be executed.- Returns:
- The
RestActionresult, or null should it fail.
-
subGet
public static <T> T subGet(@NotNull net.dv8tion.jda.api.requests.RestAction<T> future, @NotNull T or)Utility method for submitting aRestActionand awaiting its result.- Type Parameters:
T- Return type for theRestAction.- Parameters:
future- TheRestActionto be executed.or- Fallback value to be returned should it fail.- Returns:
- The
RestActionresult.
-
clearReactions
public static void clearReactions(net.dv8tion.jda.api.entities.Message msg)Utility method to clear all reactions of a message.- Parameters:
msg- TheMessageto have reactions/buttons removed from.
-
clearButtons
public static void clearButtons(net.dv8tion.jda.api.entities.Message msg)Utility method to clear all buttons of a message.- Parameters:
msg- TheMessageto have reactions/buttons removed from.
-
finalizeEvent
public static void finalizeEvent(net.dv8tion.jda.api.entities.Message msg, Consumer<Void> callback)Utility method to clear all reactions of a message.- Parameters:
msg- TheMessageto have reactions removed from.callback- Action to be executed after removing reactions.
-
modifyButtons
public static void modifyButtons(net.dv8tion.jda.api.entities.Message msg, @Nullable Page p, Map<String,Function<net.dv8tion.jda.api.interactions.components.buttons.Button,net.dv8tion.jda.api.interactions.components.buttons.Button>> changes)Utility method for switching pages and/or modifying message buttons. -
addReactions
public static void addReactions(net.dv8tion.jda.api.entities.Message msg, boolean withSkip, boolean withGoto)Utility method to add navigation buttons.- Parameters:
msg- TheMessageto have reactions removed from.withSkip- Whether to includeEmote.SKIP_BACKWARDandEmote.SKIP_FORWARDbuttons.withGoto- Whether to includeEmote.GOTO_FIRSTandEmote.GOTO_LASTbuttons.
-