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

Looping inside of pagination #51

Closed szymonwilczek closed 5 months ago

szymonwilczek commented 5 months ago

Is your feature request related to a problem? Please describe. No.

Describe the solution you'd like When the user is on the last page, it is still possible to click right arrow to naviagate him back to page number 1.

Describe alternatives you've considered Don't see any.

Or is it already possible?

ygimenez commented 5 months ago

It is if you use either Pages.lazyPaginate (easier) or Pages.buttonize (finer control) instead of regular method, as both allow supplying your own page generator function.

There're examples on how to use them on README.md, but feel free to ask if you need further help.

szymonwilczek commented 5 months ago

Thanks a lot, I'll look into them, btw, do I have to implement the function to loop for pages on my own or this is already pre-defined in Pagination plugin?

ygimenez commented 5 months ago

lazyPaginate gives you the current index inside the Consumer, you can simply index % pages.size() to loop back to the start.