JDA-Utilities
JDA-Utilities copied to clipboard
Add EmbedPaginator to menu module
Pull Request
Pull Request Checklist
Please follow the following steps before opening this PR.
PRs that do not complete the checklist will be subject to denial for
missing information.
- [x] I have checked the pull request page for upcoming or merged features/bug fixes.
- [x] I have read JDA's contributing guidelines.
Pull Request Information
Check and fill in the blanks for all that apply:
- [ ] My PR fixes a bug, error, or other issue with the library's codebase.
- [x] My PR is for the
menu
module of the JDA-Utilities library. - [ ] My PR creates a new module for the JDA-Utilities library:
______
.
Description
Closes #103
This implements a EmbedPaginator
class to the menu module, which allows to pass own instances of a MessageEmbed
to make paginated Embeds.
This is mostly based on the Slideshow
class.
There are methods that where not implemented for multiple reasons:
-
setColor
andshowPageNumber
: Seems weird and would probably be a quite "hacky" aproach to alter an Embed's colour if you provide it through the MessageEmbed instance itself. -
setItemsPerPage
: You can only have one embed per page, for obvious reasons.
I also added a addItems(String... items)
and setItems(String... items)
method to just create a basic Embed with nothing more than the description. That is just a convenience method in case someone wants this.
I pushed some minor corrections to the overall format.
In addition did I also add a Checks.check(String#length() <= MessageEmbed.TEXT_MAX_LENGTH, "Message");
check for the addItems(String...)
and setItems(String...)
methods to make sure that none of the provided Strings exceeds the embed limit.
Added a addItems(Collection<MessageEmbed>)
and setItems(Collection<MessageEmbed>)
option.