Duplicate messageUpdate events in sharded bot
I'm receiving duplicate messageUpdate events and I'm not sure why. I have tried storing messageId in redis and checking it before sending message, but still it somehow bypasses it. Is it some sort of retry event? It's kind of similar to a let's say a bump reminder bot
Relevant code:
messageUpdate.ts
MessageHandler
XHandler
4 Replies
- What's your exact discord.js
npm list discord.js
and node node -v
version?
- Not a discord.js issue? Check out #other-js-ts.
- Consider reading #how-to-get-help to improve your question!
- Explain what exactly your issue is.
- Post the full error stack trace, not just the top part!
- Show your code!
- Issue solved? Press the button!Discord.js:
14.13.0
Node.js: v20.10.0
on adding some console.logs I found that it's the same shard running the same code twice
messageUpdate? When the other bot's embed title edits to "confirm", my bot maps the userId to that action
yea I'm sure I didn't add any duplicate listeners. Here's my event registeration code:
How can the code be better? I thought the standard factory design pattern was good enough
I see
oh. I fixed it and just forgot to update in the other parts of the code. I've updated the message that should be more readableand also console.log(client.listenerCount("messageUpdate"))
I get 1
the addReminder function is called for the exact same messageId
hmm that could be possible, let me check if that's the case
That indeed was the case, there's apparently a new field in embeds called content_scan_version
, oldMessage and newMessage are same with content_scan_version
being 0 for oldMessage and content_scan_version
being 1 in newMessage
Thank you very much for narrowing down the issue, appreciate it