From 6e94d97234fb1ba8a447e2d223e454b6a97bb9f3 Mon Sep 17 00:00:00 2001 From: GramingFoxTeam Date: Thu, 10 Aug 2023 17:34:03 +0300 Subject: [PATCH] fix(bot-discord): actually fix thinking i think my sanity is lost after this --- apps/bot-discord/src/utils/reportToLogs.js | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/apps/bot-discord/src/utils/reportToLogs.js b/apps/bot-discord/src/utils/reportToLogs.js index 3c76d8c..9c59875 100644 --- a/apps/bot-discord/src/utils/reportToLogs.js +++ b/apps/bot-discord/src/utils/reportToLogs.js @@ -1,9 +1,6 @@ import { EmbedBuilder, messageLink } from 'discord.js'; export default async function reportToLogs(config, client, action, message, { reason, expire, actionTo, actionBy }, interaction) { - const channel = await client.channels.fetch(config.logs.channelId); - const thread = await channel.threads.fetch(config.logs.threadId); - const actionUpper = action.charAt(0).toUpperCase() + action.slice(1); const actionTitle = `${actionUpper} ${actionTo.tag}`; const actionEmbed = new EmbedBuilder() @@ -32,7 +29,12 @@ export default async function reportToLogs(config, client, action, message, { re actionEmbed.setFields(fields); if (interaction) { - const msg = await interaction.editReply({ embeds: [actionEmbed] }); + await interaction.editReply({ embeds: [actionEmbed] }); + const msg = await interaction.fetchReply(); reportToLogs(config, client, action, msg, { reason, expire, actionTo, actionBy }); - } else thread.send({ embeds: [actionEmbed] }); + } else { + const channel = await client.channels.fetch(config.logs.channelId); + const thread = await channel.threads.fetch(config.logs.threadId); + thread.send({ embeds: [actionEmbed] }); + } } \ No newline at end of file