Paginated message not editing reply (always seems to reply)
CaseCommand.createCaseEmbed creates another paginated message, and runs it.
Solution:Jump to solution
I found that it works when I set the customid of the button to
@sapphire/paginated-messages.stop
, but really it should be able to support any customid7 Replies
@Helpers
When I just run
context.collector.stop();
it says Unknown Interaction
Solution
I found that it works when I set the customid of the button to
@sapphire/paginated-messages.stop
, but really it should be able to support any customidYou're overcomplicating because you're forgetting the basic JS principles of class extension and object oriented programming though.
Just extend the PaginatedMessage class and override the
handleEnd
method. Call super.handleEnd(...args)
then add your single line CaseCommand.createCaseEmbed(cases[this.index], interaction, collection);
below it
https://github.com/sapphiredev/utilities/blob/main/packages/discord.js-utilities/src/lib/PaginatedMessages/PaginatedMessage.ts#L1354
cases[this.index]
replaces cases[context.handler.index
as per https://github.com/sapphiredev/utilities/blob/main/packages/discord.js-utilities/src/lib/PaginatedMessages/PaginatedMessage.ts#L1316
adding to that, the extended class really comes down to just 8 lines of code:
More addition, you can also add your own custom ID to
stopPaginatedMessageCustomIds
using PaginatedMessage.setStopPaginatedMessageCustomIds
. Then your initial code would work just fine. That said, with your initial code you would have 2 stop buttons so you probably want to use the solution above instead.
@cosigynAlso if you use
PaginatedMessage.setActions
then you don't need include ...PaginatedMessage.defaultActions
by instead setting the second parameter to true
Thank you, although I had omitted the stop button and page selector from default actions, so it would only be one button
I looked through the docs but it’s quite difficult to find these different methods
How so? I can imagine 2 factors:
1. Finding the class itself
2. The class having a lot of methods
To cover 1, our website has an Algolia powered search. Either press Control (or Command) + K or click the search bar top right. (no different from the DiscordJS site for that matter if you're used to it) (also very similar to many many other technical documentation websites).
As for 2... yeah that's a thing but that's just a matter of scrolling through the methods. Nothing that can be done there.