From 89d81432d34ece41c7d2bb6372ab1b7a2012d202 Mon Sep 17 00:00:00 2001 From: Rory& Date: Tue, 16 Jun 2026 01:03:20 +0200 Subject: [PATCH] Dont fetch roles for non-guild mesages --- src/api/util/handlers/Message.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/api/util/handlers/Message.ts b/src/api/util/handlers/Message.ts index d0176693a..bf14290cc 100644 --- a/src/api/util/handlers/Message.ts +++ b/src/api/util/handlers/Message.ts @@ -700,7 +700,7 @@ async function handleMessageMentionsAsync(message: Message) { } contentTrace.calls.push("parseMentions", { micros: sw.getElapsedAndReset().totalMicroseconds }); - let mentionedRoles = await Role.find({ where: { id: In(mention_role_id_set.values().toArray()), guild_id: channel.guild_id } }); + let mentionedRoles = !channel.guild_id ? [] : await Role.find({ where: { id: In(mention_role_id_set.values().toArray()), guild_id: channel.guild_id } }); contentTrace.calls.push("queryMentionRoles", { micros: sw.getElapsedAndReset().totalMicroseconds }); //TODO: should this throw at all?