From 2deeb4f2b3fb82148cbbc9662450275c4e46fc80 Mon Sep 17 00:00:00 2001 From: GramingFoxTeam Date: Thu, 10 Aug 2023 17:22:59 +0300 Subject: [PATCH] fix(bot-discord): fix "Thinking..." you have thinked for too long my child --- apps/bot-discord/src/commands/ban.js | 2 +- apps/bot-discord/src/commands/exile.js | 2 +- apps/bot-discord/src/commands/mute.js | 2 +- apps/bot-discord/src/commands/unban.js | 2 +- apps/bot-discord/src/commands/unexile.js | 2 +- apps/bot-discord/src/commands/unmute.js | 2 +- apps/bot-discord/src/utils/muteMember.js | 4 ++-- apps/bot-discord/src/utils/reportToLogs.js | 6 +++--- 8 files changed, 11 insertions(+), 11 deletions(-) diff --git a/apps/bot-discord/src/commands/ban.js b/apps/bot-discord/src/commands/ban.js index 7832bac..208c0d3 100644 --- a/apps/bot-discord/src/commands/ban.js +++ b/apps/bot-discord/src/commands/ban.js @@ -40,6 +40,6 @@ export default { actionTo: await client.users.fetch(interaction.options.getString('user')), actionBy: interaction.member, channel: interaction.channel - }); + }, interaction); } }; diff --git a/apps/bot-discord/src/commands/exile.js b/apps/bot-discord/src/commands/exile.js index e25d395..45484fc 100644 --- a/apps/bot-discord/src/commands/exile.js +++ b/apps/bot-discord/src/commands/exile.js @@ -52,6 +52,6 @@ export default { actionBy: interaction.member, channel: interaction.channel, expire: parsedDuration - }); + }, interaction); } }; diff --git a/apps/bot-discord/src/commands/mute.js b/apps/bot-discord/src/commands/mute.js index 6a41f44..3a09af1 100644 --- a/apps/bot-discord/src/commands/mute.js +++ b/apps/bot-discord/src/commands/mute.js @@ -58,6 +58,6 @@ export default { actionBy: interaction.member, channel: interaction.channel, expire: parsedDuration - }); + }, interaction); } }; diff --git a/apps/bot-discord/src/commands/unban.js b/apps/bot-discord/src/commands/unban.js index c372b2d..0d25f27 100644 --- a/apps/bot-discord/src/commands/unban.js +++ b/apps/bot-discord/src/commands/unban.js @@ -27,6 +27,6 @@ export default { actionTo: await client.users.fetch(interaction.options.getString('user')), actionBy: interaction.member, channel: interaction.channel - }); + }, interaction); } }; diff --git a/apps/bot-discord/src/commands/unexile.js b/apps/bot-discord/src/commands/unexile.js index ccd9759..c94abfe 100644 --- a/apps/bot-discord/src/commands/unexile.js +++ b/apps/bot-discord/src/commands/unexile.js @@ -49,6 +49,6 @@ export default { actionTo: await client.users.fetch(interaction.options.getString('user')), actionBy: interaction.member, channel: interaction.channel, - }); + }, interaction); } }; diff --git a/apps/bot-discord/src/commands/unmute.js b/apps/bot-discord/src/commands/unmute.js index e9d0d5d..6e96a6b 100644 --- a/apps/bot-discord/src/commands/unmute.js +++ b/apps/bot-discord/src/commands/unmute.js @@ -49,6 +49,6 @@ export default { actionTo: await client.users.fetch(interaction.options.getString('user')), actionBy: interaction.member, channel: interaction.channel, - }); + }, interaction); } }; diff --git a/apps/bot-discord/src/utils/muteMember.js b/apps/bot-discord/src/utils/muteMember.js index 8beb52a..f7bb699 100644 --- a/apps/bot-discord/src/utils/muteMember.js +++ b/apps/bot-discord/src/utils/muteMember.js @@ -59,7 +59,7 @@ export default async function muteMember(config, member, { duration, reason, sup // Remove the roles, give defined roles. if (!existingMute) { - const currentRoles = member.roles.map((role) => role.id); + const currentRoles = member.roles.cache.map((role) => role.id); let setRoles = []; for (const role of currentRoles) { if (takenRoles.includes(role)) continue; @@ -69,7 +69,7 @@ export default async function muteMember(config, member, { duration, reason, sup setRoles = setRoles.concat(supportMute ? config.discord.mute.supportGiveRoles : config.discord.mute.giveRoles) - await member.roles.set(takenRoles); + await member.roles.set(setRoles); } diff --git a/apps/bot-discord/src/utils/reportToLogs.js b/apps/bot-discord/src/utils/reportToLogs.js index 50e05a4..3c76d8c 100644 --- a/apps/bot-discord/src/utils/reportToLogs.js +++ b/apps/bot-discord/src/utils/reportToLogs.js @@ -1,6 +1,6 @@ import { EmbedBuilder, messageLink } from 'discord.js'; -export default async function reportToLogs(config, client, action, message, { reason, expire, actionTo, actionBy }, msgChannel) { +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); @@ -31,8 +31,8 @@ export default async function reportToLogs(config, client, action, message, { re actionEmbed.setFields(fields); - if (msgChannel) { - const msg = await msgChannel.send({ embeds: [actionEmbed] }); + if (interaction) { + const msg = await interaction.editReply({ embeds: [actionEmbed] }); reportToLogs(config, client, action, msg, { reason, expire, actionTo, actionBy }); } else thread.send({ embeds: [actionEmbed] }); } \ No newline at end of file