summary refs log tree commit diff
path: root/api
diff options
context:
space:
mode:
authorErkin Alp Güney <erkinalp9035@gmail.com>2022-01-12 09:58:22 +0300
committerGitHub <noreply@github.com>2022-01-12 09:58:22 +0300
commit4082ed2784a08ff1dc07bb2e6a5258448cf579c5 (patch)
treeac881339464a07762f7ffdc57017ad38a97fbe8b /api
parentSchema change for group specific emojis (diff)
downloadserver-4082ed2784a08ff1dc07bb2e6a5258448cf579c5.tar.xz
Add cross channel replies
Resolves #533
Diffstat (limited to 'api')
-rw-r--r--api/src/util/handlers/Message.ts6
1 files changed, 4 insertions, 2 deletions
diff --git a/api/src/util/handlers/Message.ts b/api/src/util/handlers/Message.ts
index a3055aed..dae6f7e8 100644
--- a/api/src/util/handlers/Message.ts
+++ b/api/src/util/handlers/Message.ts
@@ -81,8 +81,10 @@ 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
-		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 (!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
 		message.type = MessageType.REPLY;