Paginated message help

Hey, is there a way to change the items of the pagination message? Ideally with the PaginationFieldMessageEmbed. The use case is I want to build up an inventory for a RPG and want separate categories (to be selected using SelectMenu) At a given time, only one type of category would be shown.. Is there a way to swap out the old items and replace with brand new ones?
8 Replies
Favna
Favna13mo ago
Sapphire Framework
Class: PaginatedMessage | Sapphire
@sapphire/discord.js-utilities.PaginatedMessage
nyan
nyan13mo ago
I meant more as there would be multiple paginatedMessage objects and if the user selects a new category, the whole message would be edited and replaced
Favna
Favna13mo ago
Uh no we do not support that, I'm sorry.
nyan
nyan13mo ago
Another question: is there a way to add a cooldown for button interactions?
Favna
Favna13mo ago
there isnt. There is an open PR after which you can use sapphire interaction handlers instead of the action's run though so then you can reply to an interaction saying they need to wait and just don't process it further. You'll have to implement the rate limit yourself still. Not too dissimilar from https://www.sapphirejs.dev/docs/Guide/plugins/API/rate-limiting
Sapphire Framework
Applying rate limits to routes | Sapphire
When writing an API that is publicly available for consumption, it is often desirable to set a rate limit on your routes
KB
KB13mo ago
As Favna said, it'll be possible if/when the PR is merged. For normal buttons, I've implemented it myself using RateLimitManager and decorators in an interaction handler. Example: https://github.com/KBot-discord/KBot/blob/4862ca8dff95b95363d24e33a70d294c1eb41599/apps/bot/src/lib/utilities/decorators.ts#L26 Actually, I guess you could throw that logic into the action's run but that could be repetitive.
nyan
nyan13mo ago
kk one more.. question: how can i make a button disabled if its on the first page or last page? I assume this can be done via setting page specific actions but wondering if theres an easier solution
Favna
Favna13mo ago
your assumption is correct @sam the update that KB mentioned has been released, see #Announcements