summary refs log tree commit diff
path: root/api/src/util/handlers/Message.ts
diff options
context:
space:
mode:
authorMadeline <46743919+MaddyUnderStars@users.noreply.github.com>2022-03-31 21:48:14 +1100
committerMadeline <46743919+MaddyUnderStars@users.noreply.github.com>2022-03-31 21:48:14 +1100
commit18467b6c0d1f5ffa529ab4c3e49eb3a72e0f6322 (patch)
treea7fd86af541c5edc3814e6eb5f8524948b38acc3 /api/src/util/handlers/Message.ts
parentchanges from yonks ago that I forgot to commit (diff)
parentMake member.premium_since ISO8601 timestamp (diff)
downloadserver-18467b6c0d1f5ffa529ab4c3e49eb3a72e0f6322.tar.xz
Merge branch 'master' into maddyrtc
Diffstat (limited to '')
-rw-r--r--api/src/util/handlers/Message.ts10
1 files changed, 6 insertions, 4 deletions
diff --git a/api/src/util/handlers/Message.ts b/api/src/util/handlers/Message.ts

index 21664368..2d9f7032 100644 --- a/api/src/util/handlers/Message.ts +++ b/api/src/util/handlers/Message.ts
@@ -82,10 +82,12 @@ export async function handleMessage(opts: MessageOptions): Promise<Message> { if (opts.message_reference) { permission.hasThrow("READ_MESSAGE_HISTORY"); // code below has to be redone when we add custom message routing and cross-channel replies - const guild = await Guild.findOneOrFail({ id: channel.guild_id }); - if (!guild.features.includes("CROSS_CHANNEL_REPLIES")) { - if (opts.message_reference.guild_id !== channel.guild_id) throw new HTTPError("You can only reference messages from this guild"); - if (opts.message_reference.channel_id !== opts.channel_id) throw new HTTPError("You can only reference messages from this channel"); + if (message.guild_id !== null) { + const guild = await Guild.findOneOrFail({ id: channel.guild_id }); + if (!guild.features.includes("CROSS_CHANNEL_REPLIES")) { + if (opts.message_reference.guild_id !== channel.guild_id) throw new HTTPError("You can only reference messages from this guild"); + if (opts.message_reference.channel_id !== opts.channel_id) throw new HTTPError("You can only reference messages from this channel"); + } } // TODO: should be checked if the referenced message exists? // @ts-ignore