Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add EmbedPaginator to menu module #104

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open

Add EmbedPaginator to menu module #104

wants to merge 5 commits into from

Conversation

Andre601
Copy link
Contributor

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.

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.
  • 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 and showPageNumber: 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.

@Andre601
Copy link
Contributor Author

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.

@Andre601
Copy link
Contributor Author

Added a addItems(Collection<MessageEmbed>) and setItems(Collection<MessageEmbed>) option.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add support to directly add MessageEmbeds to Paginator
2 participants