PaginatedMessage actions on a single page

Hi!, I'm currently using the super convenient PaginatedMessage class and calling the .addPageActions() method to add actions with a run() callback to each page. This has been working great, I have however noticed that the run() function is only being called when the total number of pages is more than 1. I checked out the code setting up the collector for the message, and that indeed seems to be the case. I was wondering if there was a way to ensure that custom actions are called in the specific case where the number of pages is exactly 1 while still being able to access the passed context. Thanks :)
Solution:
You'll have to extend the class and overwrite the appropriate method. Our believe is that there is no point to showing a paginated message with page controls when there is only 1 page and in such a case you should write your code so that the embeds / content / component are sent directly. This is to discourage the misuse of the class and potential over engineering....
Jump to solution
2 Replies
Solution
Favna
Favna•3mo ago
You'll have to extend the class and overwrite the appropriate method. Our believe is that there is no point to showing a paginated message with page controls when there is only 1 page and in such a case you should write your code so that the embeds / content / component are sent directly. This is to discourage the misuse of the class and potential over engineering.
Chef
ChefOP•3mo ago
That is a fair point, it just felt a bit hacky overwriting the same internal function with a minor change in the condition for my use case where the number of pages can easily be 1 as the data can be fairly dynamic. Regardless, thanks for the response and for this awesome library 🙌
Want results from more Discord servers?
Add your server