summary refs log tree commit diff
diff options
context:
space:
mode:
authorErkin Alp Güney <erkinalp9035@gmail.com>2022-01-12 16:04:34 +0300
committerGitHub <noreply@github.com>2022-01-12 16:04:34 +0300
commit277b28c00015120d698f86672e51cc618aed3686 (patch)
treee078fec0229323dbd23dfa67e4b7f4b76aac32b2
parentUpdate Guild.ts (diff)
downloadserver-277b28c00015120d698f86672e51cc618aed3686.tar.xz
Fix the feature check
-rw-r--r--api/src/util/handlers/Message.ts2
1 files changed, 2 insertions, 0 deletions
diff --git a/api/src/util/handlers/Message.ts b/api/src/util/handlers/Message.ts
index dae6f7e8..92bb2335 100644
--- a/api/src/util/handlers/Message.ts
+++ b/api/src/util/handlers/Message.ts
@@ -2,6 +2,7 @@ import {
 	Channel,
 	Embed,
 	emitEvent,
+	Guild,
 	Message,
 	MessageCreateEvent,
 	MessageUpdateEvent,
@@ -81,6 +82,7 @@ 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: 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");