diff --git a/src/api/routes/webhooks/#webhook_id/#webhook_token/messages/#message_id.ts b/src/api/routes/webhooks/#webhook_id/#webhook_token/messages/#message_id.ts index 798752f08..929719e59 100644 --- a/src/api/routes/webhooks/#webhook_id/#webhook_token/messages/#message_id.ts +++ b/src/api/routes/webhooks/#webhook_id/#webhook_token/messages/#message_id.ts @@ -98,27 +98,7 @@ router.patch( } satisfies MessageUpdateEvent); postHandleMessage(new_message).catch((e) => console.error("[Message] post-message handler failed", e)); - - // TODO: a DTO? - return res.json({ - ...new_message.toJSON(), - id: new_message.id, - type: new_message.type, - channel_id: new_message.channel_id!, - // member: new_message.member?.toPublicMember(), // TODO: why was this here? this isnt in the Message object lol - author: new_message.author!.toPartialUser(), - attachments: new_message.attachments?.map((x) => x.toJSON()) ?? [], - embeds: new_message.embeds, - mentions: new_message.mentions?.map((u) => u.toPartialUser()) ?? [], - mention_roles: new_message.mention_roles?.map((r) => r.id) ?? [], - mention_everyone: new_message.mention_everyone ?? false, - pinned: new_message.pinned, - timestamp: new_message.timestamp.toISOString(), - edited_timestamp: new_message.edited_timestamp?.toISOString() ?? null, - - // these are not in the Discord.com response - mention_channels: new_message.mention_channels.map((x) => x.toJSON()), - } satisfies PublicMessage); + return res.json(new_message.toJSON()); }, ); diff --git a/src/database/entities/Message.ts b/src/database/entities/Message.ts index f84d22b42..c3ab8c190 100644 --- a/src/database/entities/Message.ts +++ b/src/database/entities/Message.ts @@ -349,7 +349,7 @@ export class Message extends BaseClass { message_reference: this.message_reference ?? undefined, mention_everyone: this.mention_everyone ?? false, author: { - ...(this.author?.toPublicUser() ?? undefined), + ...(this.author?.toPartialUser() ?? undefined), // Webhooks username: this.username ?? this.author?.username ?? null, avatar: this.avatar ?? this.author?.avatar ?? null,