fix some message update fields being sent when null

This commit is contained in:
Puyodead1 2023-12-05 12:34:46 -05:00
parent 7cf8c68459
commit b7c4889c63
No known key found for this signature in database
GPG Key ID: A4FA4FEC0DD353FC

View File

@ -109,7 +109,7 @@ router.patch(
await emitEvent({ await emitEvent({
event: "MESSAGE_UPDATE", event: "MESSAGE_UPDATE",
channel_id, channel_id,
data: { ...new_message, nonce: undefined }, data: { ...new_message.toJSON(), nonce: undefined },
} as MessageUpdateEvent), } as MessageUpdateEvent),
]); ]);
@ -117,9 +117,9 @@ router.patch(
// TODO: a DTO? // TODO: a DTO?
return res.json({ return res.json({
...new_message.toJSON(),
id: new_message.id, id: new_message.id,
type: new_message.type, type: new_message.type,
content: new_message.content,
channel_id: new_message.channel_id, channel_id: new_message.channel_id,
author: new_message.author?.toPublicUser(), author: new_message.author?.toPublicUser(),
attachments: new_message.attachments, attachments: new_message.attachments,
@ -128,11 +128,8 @@ router.patch(
mention_roles: new_message.mention_roles, mention_roles: new_message.mention_roles,
mention_everyone: new_message.mention_everyone, mention_everyone: new_message.mention_everyone,
pinned: new_message.pinned, pinned: new_message.pinned,
tts: new_message.tts,
timestamp: new_message.timestamp, timestamp: new_message.timestamp,
edited_timestamp: new_message.edited_timestamp, edited_timestamp: new_message.edited_timestamp,
flags: new_message.flags,
components: new_message.components,
// these are not in the Discord.com response // these are not in the Discord.com response
mention_channels: new_message.mention_channels, mention_channels: new_message.mention_channels,