From a521192881537428e40ea5de6bb6ca62fcdfd72f Mon Sep 17 00:00:00 2001 From: SrIzan10 <66965250+SrIzan10@users.noreply.github.com> Date: Fri, 12 Aug 2022 14:57:30 +0200 Subject: [PATCH] fix: send to modlogs AFTER it has been done at the beginning, the message was sent BEFORE doing the moderation action, which caused errors to happen after the message was sent to modlogs --- commands/moderation/ban.ts | 2 +- commands/moderation/kick.ts | 2 +- commands/moderation/timeoutUser.ts | 5 ++--- 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/commands/moderation/ban.ts b/commands/moderation/ban.ts index 82b23f8..7abc431 100644 --- a/commands/moderation/ban.ts +++ b/commands/moderation/ban.ts @@ -24,9 +24,9 @@ export default commandModule({ execute: async (ctx, options, message) => { const userToBan = options[1].getMember('usuario', true); const reason = options[1].get('razon', true).value; + userToBan.ban(reason) const sendToMods = ctx.client.guilds.cache.get('928018226330337280')!.channels.cache.get('1004118323258208257') await sendToMods.send({content: `Se ha baneado a ${userToBan}.\nBan efectuado por ${ctx.user} con razón "${reason}."`}) - userToBan.ban(reason) await ctx.reply({content: 'Baneado correctamente!', ephemeral: true}) }, }); \ No newline at end of file diff --git a/commands/moderation/kick.ts b/commands/moderation/kick.ts index bb93491..400c928 100644 --- a/commands/moderation/kick.ts +++ b/commands/moderation/kick.ts @@ -29,9 +29,9 @@ export default commandModule({ const kickEmbed = new EmbedBuilder() .setTitle('Nuevo kick.') .setDescription(`Kick efectuado por <@${ctx.author}>.\nRazón: ${reason}.`); + userToBan.kick(reason) const sendToMods = ctx.client.guilds.cache.get('928018226330337280')!.channels.cache.get('1004118323258208257') await sendToMods.send({content: `Se ha expulsado a ${userToBan}.\nKick efectuado por ${ctx.user} con razón "${reason}."`}) - userToBan.kick(reason) await ctx.reply({content: 'Expulsado correctamente!'}) }, }); \ No newline at end of file diff --git a/commands/moderation/timeoutUser.ts b/commands/moderation/timeoutUser.ts index e55a411..07e4b2f 100644 --- a/commands/moderation/timeoutUser.ts +++ b/commands/moderation/timeoutUser.ts @@ -40,10 +40,9 @@ export default commandModule({ const razon = options[1].getString('razon', true); const minutosToMilisegundos = minutos * 60 * 1000 + usuario.timeout(minutosToMilisegundos, razon).then(() => {ctx.reply({content: `Se ha silenciado a ${usuario} correctamente.`, ephemeral: true})}) const sendToMods = ctx.client.guilds.cache.get('928018226330337280')!.channels.cache.get('1004118323258208257') await sendToMods.send({content: `Se ha silenciado a ${usuario}.\nSlencio efectuado por ${ctx.user} con ${minutos} minutos de duración.\nRazón: ${razon}`}) - - usuario.timeout(minutosToMilisegundos, razon).then(() => {ctx.reply({content: `Se ha silenciado a ${usuario} correctamente.`, ephemeral: true})}) - } + } }, ); \ No newline at end of file