Skip to content

Commit

Permalink
fix some message update fields being sent when null
Browse files Browse the repository at this point in the history
  • Loading branch information
Puyodead1 committed Dec 5, 2023
1 parent 7cf8c68 commit b7c4889
Showing 1 changed file with 2 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -109,17 +109,17 @@ router.patch(
await emitEvent({
event: "MESSAGE_UPDATE",
channel_id,
data: { ...new_message, nonce: undefined },
data: { ...new_message.toJSON(), nonce: undefined },
} as MessageUpdateEvent),
]);

postHandleMessage(new_message);

// TODO: a DTO?
return res.json({
...new_message.toJSON(),
id: new_message.id,
type: new_message.type,
content: new_message.content,
channel_id: new_message.channel_id,
author: new_message.author?.toPublicUser(),
attachments: new_message.attachments,
Expand All @@ -128,11 +128,8 @@ router.patch(
mention_roles: new_message.mention_roles,
mention_everyone: new_message.mention_everyone,
pinned: new_message.pinned,
tts: new_message.tts,
timestamp: new_message.timestamp,
edited_timestamp: new_message.edited_timestamp,
flags: new_message.flags,
components: new_message.components,

// these are not in the Discord.com response
mention_channels: new_message.mention_channels,
Expand Down

0 comments on commit b7c4889

Please sign in to comment.