summary refs log tree commit diff
path: root/src/api
diff options
context:
space:
mode:
authorRory& <root@rory.gay>2025-09-28 23:57:29 +0200
committerRory& <root@rory.gay>2025-09-29 18:38:06 +0200
commit61c3b537ad1a51d6d73fb045bcd7f82419dbaea2 (patch)
treef654d806c5df9d57fe91500259e86c947e07b4f2 /src/api
parentOops, forgot to register extension (diff)
downloadserver-ts-61c3b537ad1a51d6d73fb045bcd7f82419dbaea2.tar.xz
Include attachments
Diffstat (limited to 'src/api')
-rw-r--r--src/api/util/handlers/Message.ts7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/api/util/handlers/Message.ts b/src/api/util/handlers/Message.ts

index 167305575..fd40d279a 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<Message> { 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 **/