After the release of 2.1.1 I was still encountering some issues using the library in a DM.
As described in #9, I was experiencing the following error when a page is initialised for a message in a DM while using the timeout feature. 2.1.1 did not seem to fix this (as seen by the version in the jar name):
java.lang.IllegalStateException: Cannot clear reactions from a message in a Group or PrivateChannel.
at net.dv8tion.jda.internal.entities.ReceivedMessage.clearReactions(ReceivedMessage.java:175) ~[JDA-4.2.0_225.jar:4.2.0_225]
at com.github.ygimenez.method.Pages$4.<init>(Pages.java:490) ~[Pagination-Utils-2.1.1.jar:na]
at com.github.ygimenez.method.Pages.paginate(Pages.java:477) ~[Pagination-Utils-2.1.1.jar:na]
Using the non-timeout paginate methods, I was able to get around this issue but if I had set .shouldRemoveOnReact(true) for the paginator builder then switching pages would only work when a user removed their reaction and then re-added their reaction.
In this PR I believe that I have fixed both of these issues. One thing I want to point out is that, in the Pages.java class, I noticed there were not many methods to cut down on duplicated code in the consumers. In order to maintain the style of the code I decided to create setTimeout() methods inside each consumer instead of making one method in the class and referring to that for all the consumers. If you would like me to change to using the latter style (one method that all the consumers use) I'm happy to change over to that.
After the release of 2.1.1 I was still encountering some issues using the library in a DM.
paginate
methods, I was able to get around this issue but if I had set.shouldRemoveOnReact(true)
for the paginator builder then switching pages would only work when a user removed their reaction and then re-added their reaction.In this PR I believe that I have fixed both of these issues. One thing I want to point out is that, in the
Pages.java
class, I noticed there were not many methods to cut down on duplicated code in the consumers. In order to maintain the style of the code I decided to createsetTimeout()
methods inside each consumer instead of making one method in the class and referring to that for all the consumers. If you would like me to change to using the latter style (one method that all the consumers use) I'm happy to change over to that.