ygimenez / Pagination-Utils

A collection of methods to make message pagination with JDA easier.
GNU Lesser General Public License v2.1
27 stars 7 forks source link

Buttonization does not work with Pagination #13

Open xWink opened 3 years ago

xWink commented 3 years ago

Checklist

Make sure that you've checked all the items below.

Library info

What libraries versions are you using.

Describe the bug

Using the library to paginate AND buttonize a MessageEmbed will result in all the reactions being added, but only the functionality of one (pagination OR buttonization). The functioning feature is determined by the order in which they are declared, so if one were to paginate and then buttonize a message, the functionality of buttonization would work, but not pagination, despite all the reactions being added to the message. Inverting the order of pagination/buttonization makes pagination work and buttonization fail (but all reactions are still added).

To Reproduce

Steps to reproduce the behavior:

  1. Create HashMap of buttons, as per buttonization guide
  2. Create ArrayList of Pages
  3. Populate ArrayList of Pages with Page objects with type EMBED and desired MessageEmbed instances, as per Pagination guide
  4. Send message where the content is the content of the first page in the ArrayList (casted as MessageEmbed) and pass a callback to the queue method to buttonize and paginate the successfully sent message, as per Buttonization and Pagination guides
  5. Start bot and make it display the paginated/buttonized message
  6. Try to navigate resulting menu and use the additional buttons, only one feature will work

Expected behavior

Functionality of both pagination and buttonization should work such that a MessageEmbed can be sent with a list of options with pages. This will allow for numbered lists with more than 10 options to exist (via pagination) while also being easy to use.

Screenshots

image

Additional context

This is particularly useful for the case of ordered lists of options. In my case, it would be to show a list of 12 numbered/lettered options in groups of 5. So the first page would show 5 options, with reactions for numbers 1-5 (or letters A-E) as well as the pagination reactions. The second page shows the next 5 options with the same buttons as the first page. The third page shows the last 2 options, so only reactions for numbers 1-2, but also with pagination reactions.

ygimenez commented 3 years ago

I'll see what I can do, it'll probably be implemented as a different method in a future version.

avurro commented 3 years ago

What you think about to give the possibility to add emoji with custom function in paginate method ? @ygimenez

ygimenez commented 3 years ago

This is what OP's talking about @avurro