From 85e2152c37b743495bc8731a2db60cac5655d04e Mon Sep 17 00:00:00 2001 From: LunaUrsa <1836049+LunaUrsa@users.noreply.github.com> Date: Mon, 19 Feb 2024 10:34:38 -0600 Subject: [PATCH] Properly get the linked channel on react --- src/discord/commands/global/d.ai.ts | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/src/discord/commands/global/d.ai.ts b/src/discord/commands/global/d.ai.ts index 0abce9b48..fe50e0ef4 100644 --- a/src/discord/commands/global/d.ai.ts +++ b/src/discord/commands/global/d.ai.ts @@ -2269,17 +2269,13 @@ export async function aiReaction( const thumbsDownEmojis = ['👎', '👎🏻', '👎🏼', '👎🏽', '👎🏾', '👎🏿', 'ts_thumbdown']; if (messageReaction.message.reference === null) return; const originalMessage = await messageReaction.message.fetchReference(); - const aiLinkData = await db.ai_channels.findFirst({ - where: { - channel_id: originalMessage.channel.id, - }, - }); + const aiLinkData = await getLinkedChannel(originalMessage.channel); - log.debug(F, `aiLinkData: ${JSON.stringify(aiLinkData, null, 2)}`); - log.debug(F, `messageReaction: ${JSON.stringify(messageReaction, null, 2)}`); - log.debug(F, `messageReaction.message.author: ${JSON.stringify(messageReaction.message.author, null, 2)}`); - log.debug(F, `user: ${JSON.stringify(user, null, 2)}`); - log.debug(F, `Emoji name: ${messageReaction.emoji.name}`); + // log.debug(F, `aiLinkData: ${JSON.stringify(aiLinkData, null, 2)}`); + // log.debug(F, `messageReaction: ${JSON.stringify(messageReaction, null, 2)}`); + // log.debug(F, `messageReaction.message.author: ${JSON.stringify(messageReaction.message.author, null, 2)}`); + // log.debug(F, `user: ${JSON.stringify(user, null, 2)}`); + // log.debug(F, `Emoji name: ${messageReaction.emoji.name}`); if (aiLinkData && messageReaction.message.author?.bot