channelPinsUpdate get the pinned/unpinned message

I'm trying to get the most recently pinned or unpinned message from the channelPinsUpdate event. The event returns a channel and a date. You can get all pinned messages by using channel.messages.fetchPinned() It's not possible to know if a message was pinned or unpinned since the date is always provided. The message class has no property for when it was pinned, so you can't go through all pinned messages and then find the one that matches the date that's given to you... Is there any other way to actually get that one message that just got pinned or unpinned?
11 Replies
d.js toolkit
d.js toolkit6d ago
- 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!
Nikki
Nikki6d ago
I guess I will just have to use messageUpdate in the meantime to check whenever a message gets pinned
Amgelo
Amgelo6d ago
you can fetch audit logs and check there though messageUpdate is probably better/easier for your case
Nikki
Nikki6d ago
:bcaYaya3:
Amgelo
Amgelo6d ago
people generally use audit logs when they need to know who performed an action, or if somehow there's no other way
Nikki
Nikki6d ago
What's the channelPinsUpdate event even for if it only gives you a useless date and a channel Why does it not just give you the message so it's actually useful? I see no use case to ever need just the channel when a message gets pinned
Nikki
Nikki6d ago
Welp, just got the answer to the second question
No description
Amgelo
Amgelo6d ago
for you to get messageUpdate, you need the GuildMessages intent, maybe you also need a partial though I'm not sure of that there may be people that do only need the channel for some reason, maybe logging or whatever otherwise ask discord ig lol
Nikki
Nikki6d ago
oh I know how to do all of that I will do that is it okay to leave this post open so I can give updates on it?
Amgelo
Amgelo6d ago
I'm not sure since this is more for djs related questions, maybe staff can answer
Nikki
Nikki5d ago
I sent a mail directly to their Developer Support in the help center So I got a response and they basically just told me to post a feature request on the discord-api-docs github page which are read by the discord API engineers