summary refs log tree commit diff
path: root/api/src/util/handlers/Message.ts
diff options
context:
space:
mode:
authorTheArcaneBrony <myrainbowdash949@gmail.com>2022-08-06 18:25:30 +0200
committerTheArcaneBrony <myrainbowdash949@gmail.com>2022-08-09 23:28:27 +0200
commitcba3844c6f7a6b26c93d8061da0ca7fe6b291e92 (patch)
tree515a4000f4d26ab1999644b9dd6a057e03041bcf /api/src/util/handlers/Message.ts
parentmigrate to DataSource (diff)
downloadserver-cba3844c6f7a6b26c93d8061da0ca7fe6b291e92.tar.xz
Resolve changes undone by rebasing from master
Diffstat (limited to 'api/src/util/handlers/Message.ts')
-rw-r--r--api/src/util/handlers/Message.ts8
1 files changed, 4 insertions, 4 deletions
diff --git a/api/src/util/handlers/Message.ts b/api/src/util/handlers/Message.ts
index 0a74312e..80012260 100644
--- a/api/src/util/handlers/Message.ts
+++ b/api/src/util/handlers/Message.ts
@@ -68,10 +68,10 @@ export async function handleMessage(opts: MessageOptions): Promise<Message> {
 		rights.hasThrow("SEND_MESSAGES");
 	}	
 	if (opts.application_id) {
-		message.application = await Application.findOneOrFail({ id: opts.application_id });
+		message.application = await Application.findOneOrFail({ where: { id: opts.application_id } });
 	}
 	if (opts.webhook_id) {
-		message.webhook = await Webhook.findOneOrFail({ id: opts.webhook_id });
+		message.webhook = await Webhook.findOneOrFail({ where: { id: opts.webhook_id } });
 	}
 	
 	const permission = await getPermission(opts.author_id, channel.guild_id, opts.channel_id);
@@ -85,7 +85,7 @@ export async function handleMessage(opts: MessageOptions): Promise<Message> {
 		permission.hasThrow("READ_MESSAGE_HISTORY");
 		// code below has to be redone when we add custom message routing
 		if (message.guild_id !== null) {
-			const guild = await Guild.findOneOrFail({ id: channel.guild_id });
+			const guild = await Guild.findOneOrFail({ where: { 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");
@@ -120,7 +120,7 @@ export async function handleMessage(opts: MessageOptions): Promise<Message> {
 
 		await Promise.all(
 			Array.from(content.matchAll(ROLE_MENTION)).map(async ([_, mention]) => {
-				const role = await Role.findOneOrFail({ id: mention, guild_id: channel.guild_id });
+				const role = await Role.findOneOrFail({ where: { id: mention, guild_id: channel.guild_id } });
 				if (role.mentionable || permission.has("MANAGE_ROLES")) {
 					mention_role_ids.push(mention);
 				}