Chrissy
Chrissy
Explore posts from servers
DIAdiscord.js - Imagine a boo! 👻
Created by Chrissy on 6/29/2024 in #djs-questions
discord.js polls seem to not work
No description
7 replies
DIAdiscord.js - Imagine a boo! 👻
Created by Chrissy on 6/25/2024 in #djs-questions
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
{
t: 'MESSAGE_CREATE',
s: 117,
op: 0,
d: {
pinned: false,
message_reference: {
type: 0,
message_id: '1255115609881182270',
guild_id: '1070626568260562954',
channel_id: '1218523493893935175'
},
id: '1255115611336609812',
// ... other fields
}
}
{
t: 'MESSAGE_UPDATE',
s: 121,
op: 0,
d: {
pinned: true,
id: '1255115609881182270',
// ... other fields
}
}
{
t: 'CHANNEL_PINS_UPDATE',
s: 122,
op: 0,
d: {
last_pin_timestamp: '2024-06-25T11:01:24+00:00',
channel_id: '1218523493893935175',
guild_id: '1070626568260562954'
}
}
{
t: 'MESSAGE_CREATE',
s: 123,
op: 0,
d: {
type: 6, // system message saying message got pinnned
// ... other fields
}
}
{
t: 'GUILD_AUDIT_LOG_ENTRY_CREATE', // audit log for the message
s: 124,
op: 0,
d: {
user_id: '498094279793704991',
target_id: '498094279793704991',
options: {
message_id: '1255115609881182270',
channel_id: '1218523493893935175'
},
id: '1255115626599678044',
action_type: 74,
guild_id: '1070626568260562954'
}
}
{
t: 'MESSAGE_CREATE',
s: 117,
op: 0,
d: {
pinned: false,
message_reference: {
type: 0,
message_id: '1255115609881182270',
guild_id: '1070626568260562954',
channel_id: '1218523493893935175'
},
id: '1255115611336609812',
// ... other fields
}
}
{
t: 'MESSAGE_UPDATE',
s: 121,
op: 0,
d: {
pinned: true,
id: '1255115609881182270',
// ... other fields
}
}
{
t: 'CHANNEL_PINS_UPDATE',
s: 122,
op: 0,
d: {
last_pin_timestamp: '2024-06-25T11:01:24+00:00',
channel_id: '1218523493893935175',
guild_id: '1070626568260562954'
}
}
{
t: 'MESSAGE_CREATE',
s: 123,
op: 0,
d: {
type: 6, // system message saying message got pinnned
// ... other fields
}
}
{
t: 'GUILD_AUDIT_LOG_ENTRY_CREATE', // audit log for the message
s: 124,
op: 0,
d: {
user_id: '498094279793704991',
target_id: '498094279793704991',
options: {
message_id: '1255115609881182270',
channel_id: '1218523493893935175'
},
id: '1255115626599678044',
action_type: 74,
guild_id: '1070626568260562954'
}
}
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)
13 replies