Ephemeral PaginatedMessages are unusable
https://ss.clanware.org/CdquvjYO.png
It always says that it's someone else's message.
@sapphire/framework@npm:4.7.2
@sapphire/discord.js-utilities@npm:7.0.2
48 Replies
Please show your code ๐
The code for generating the embeds etc is 500 lines long but heres a relevant snippet
page.run(interaction)
refers to a button interaction (when they hit 'View case')
Note that when I use a slash command to select the case, this works perfectly
still need help@Favna
๐
Tag fav a
@Favna
I see the pings btw. I
I've just been very busy
I'll go through the posts not yet marked as solved in due time
so to recap @cosigyn
- You send something that has a button
- When user clicks a button you create a new PaginatedMessage. So this is in a class that extends
InteractionHandler
.
- You pass the interaction from the button to the run function
is that correct?Yes
I dumbed it down to this:
command.ts
button-handler.ts
and it works just fine for me @cosigyn. The only way I can actually break it is by doing this in the button handler:
but that is also not how PM works. To make a PM ephemeral the interaction it is being ran on has to be ephemeral. Ergo, starting a PM from a button cannot be ephemeral.I used deferReply to make it ephemeral
Incase it wasn't clear, the paginated message works fine normally, when it's created from a command rather than a button, but when its created from a button, I'm unable to click the PM buttons, as it always says 'its for someone else' after someone else clicks on the button and creates a new PM
I am having a similiar issue so I am going to ask here. My paginated message is not being generated from a button but the original slash command. I use them to call a "shop's" inventory. Certain channels/threads represent shops with varying inventories. I defer the interaction w/
await interaction.deferReply({ ephemeral: true })
. Then I get the data from our API and reply with the paginated message. I use the default actions (less the selection menu) only. I'm using the latest dependencies.
The BeholderPaginatedMessage
class I copied the example of Dragonite just to lower the default idle.
If someone checks the inventory in the same shop they get a message to stop interacting with Y user's buttonsChanging the command to
but keeping the rest the same I still cannot replicate the issue.
Please provide a small reproduction GitHub repository which I can run after providing only a Discord token so I can analyse the issue further.
FYI you dont need to do
actions: []
. setActions
by default already overrides the default actions.
So you can just do:
As for your particular issue, that should definitely work. For example @Dragonite uses the exact same process (https://github.com/favware/dragonite). The same will go for you to provide a small reproduction repository.Ok thanks Iโll get on it
I will provide a reproduction repo, but did you get someone else to click the button after you did, and then try to use the paginated message again?
I did not. I'll try that later.
Thatโs what I had to do. I canโt reproduce on my own locally but my users had mentioned it. Iโll get to the reproduction repo asap
This is what I tried now:
1. Use command with me. This gives an ephemeral reply because of the defer
2. Click the button that calls the interaction handler and sends the PM with me
3. Click the button on the PM with me (works)
4. Click the button on the PM with @AlsoFavna (gives wrong user)
5. Click the button on the PM with me (works)
---
1. Use command with me. This gives an ephemeral reply because of the defer
2. Click the button that calls the interaction handler and sends the PM with me
3. Click the button on the PM with @AlsoFavna (gives wrong user)
4. Click the button on the PM with me (works)
so both work as expected still
I would give reproduction steps but I am getting a weird error:
https://ss.clanware.org/uZvpLC9f.png
make sure all dependencies are up-to-date and such
maze wasnt meant for you means an unexpected error occurred
thats the only differences
The rest are the same version
try using djs 14.13.0 for djs. There were a few changes that arent released yet.
pending on some other work to be done
GitHub
GitHub - cosigyn/Sapphire-Bug-Repro
Contribute to cosigyn/Sapphire-Bug-Repro development by creating an account on GitHub.
Still doing it to me on the minimal sample but was able to get the error this time.
going to publish the repo now
GitHub
GitHub - whackdev/paginated-ephemeral
Contribute to whackdev/paginated-ephemeral development by creating an account on GitHub.
Used cli to create project
It seems like discord has changed something with their API, I keep getting this error even though my code hasn't been updated at all, I wasn't previously getting it
(maze error)
I donโt get that error
I only get it sometimes in certain servers
Do you have the Guilds intent? Itโs the minimum required. That said this error is for using it in Dms with the bot.
this was indeed the lack of
GatewayIntentBits.Guilds
in the intents.here is your repo adjusted and this works just fine @cosigyn
- updated dependencies because otherwise there are TS build errors
- fixed where .env is loaded from
- added the intent mentioned above
- enabled bulk overwrite mode for commands so idHints do not need to be bothered with
I just tried this repo and here too I cannot reproduce any error. I did upgrade @sapphire/discord.js-utilities to 7.1.1 from 7.0.1 but that shouldn't matter as far as I know. I use
/test
and then click the buttons and they work just fine. Of course in this case no one but the user can interact with the buttons, because the message is ephemeral. But that should be the expected result I would assume. If that is wrong then let me know.If you test with Favna in a channel. Then try to use test as AlsoFavna in the same channel you will get the error
It only happens when two users are in the same channel.
If someone shops at the smith and another at the jeweler no issues. But if they both go to the smith it happens
huh you're right. What the hell.
Idk I thought I mustโve done something
#149 - Dragonite
Height
2.2m
Weight
210kg
Levelling rate
Slow
Egg group(s)
Water 1, Dragon
Egg can be obtained
Yes
Minimum hatching time
10,280
Maximum hatching time
10,536
External Resources
2 / 4
can you try to also use /pokemon
#494 - Victini
Pokรฉdex entry
(
Alpha Sapphire
) When it shares the infinite energy it creates, that being's entire body will be overflowing with power.Pokรฉdex entry
(
Omega Ruby
) This Pokรฉmon brings victory. It is said that Trainers with Victini always win, regardless of the type of encounter.External Resources
4 / 4
(Iโve always wanted to see this bot!)
I cant press next page on yours anyway
I canโt press yours and mine works this way
so is this just an issue with ephemeral then hmm
yeah, when I first encountered it I thought it was a me problem so I didn't ask and changed them to visible and no issues
but that causes me issues because our prices change
and people complain
aha I seem to have found the issue. Now the question is why does it happen
yeah if it can find it when not ephemeral not sure why that would change anything
when it's not ephemeral
handleCollect
is called just once and for the proper user, but when it is ephemeral then it's called N times, once for each user that used the command. That causes the check interaction.user.id === targetUser.id
to be false
and send the "wrong user" message. Problem is that handleCollect
is called in order and once for every user so there will always be a false
in the chain.
I added a console.log
above that if check if for not ephemeral it gets logged once but for ephemeral it gets logged twiceooo
hm I do have an idea for how to fix it
Solution
Unfollowing this because it's fixed in
@sapphire/[email protected]