diff --git a/src/api/util/handlers/Message.ts b/src/api/util/handlers/Message.ts index 16730557..fd40d279 100644 --- a/src/api/util/handlers/Message.ts +++ b/src/api/util/handlers/Message.ts @@ -227,10 +227,13 @@ export async function handleMessage(opts: MessageOptions): Promise { where: { id: opts.message_reference.message_id, }, - relations: ["author", "mentions", "mention_roles", "mention_channels"], + relations: ["author", "mentions", "mention_roles", "mention_channels", "attachments"], }); - if (message.referenced_message.channel_id !== opts.message_reference.channel_id) throw new HTTPError("Referenced message not found in the specified channel", 404); + if (message.referenced_message.channel_id && message.referenced_message.channel_id !== opts.message_reference.channel_id) + throw new HTTPError("Referenced message not found in the specified channel", 404); + if (message.referenced_message.guild_id && message.referenced_message.guild_id !== opts.message_reference.guild_id) + throw new HTTPError("Referenced message not found in the specified channel", 404); } /** Q: should be checked if the referenced message exists? ANSWER: NO otherwise backfilling won't work **/