Weird behaviour from pins, caused by discord.js
i'm trying to register message pin updates
I got it working functionally now, but i wondered why it's so "weird"
when you pin a message the following happens:
First an "MESSAGE_UPDATE" get's sent.
in the payload it even says that the messge is pinned/not pinned (updated)
Then an "CHANNEL_PINS_UPDATE" fires, which on djs get's emitted as ChannelPinsUpdate event.
However, why doesn't the messageUpdate event trigger?
I could simply do then (oldMessage.pinned !== newMessage.pinned) // got pinned/unpinned
Why do i have to do in the ChannelPinsUpdate find message via audit log from channel
this is what client.on raw sends
clearly a message update happend, with the new value of pinned even tho it "just got pinned"
But discordjs doesn't fire the messageUpdate event (only the channelPinsUpdate and GuildAuditLogEntryCreate event)
7 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!
- ✅
Marked as resolved by staffUnknown User•6mo ago
Message Not Public
Sign In & Join Server To View
i have partials enabled, it's for both partial and not partial messages
the message also get's automatically added to the cache, even when i clear it, but the event doesn't trigger
therefore i managed to create such a tool, to find the message that got pinned via channelPinsUpdate event.
(a fetch is never required)
But it could also be acomplished by triggering messageUpdate
debug it:
on pin the messageUpdate never fires, but it's inside the raw event
Unknown User•6mo ago
Message Not Public
Sign In & Join Server To View
so when you pin a message for you the messageUpdate event triggers?
reinstalling discord.js fixed it lol