From b4797d7487549e5bf142df08dae33c527e63e2ca Mon Sep 17 00:00:00 2001 From: Ninjdai <65647523+Ninjdai1@users.noreply.github.com> Date: Tue, 29 Aug 2023 22:44:36 +0200 Subject: [PATCH] Update clear.js --- commands/moderation/clear.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/commands/moderation/clear.js b/commands/moderation/clear.js index 464d5b4..0e95cfa 100644 --- a/commands/moderation/clear.js +++ b/commands/moderation/clear.js @@ -15,13 +15,14 @@ module.exports = { ) .setDescription('Supprimer un grand nombre de messages d\'un salon'), async execute(interaction, client) { + await interaction.deferReply({ ephemeral: true }) const number = interaction.options.getInteger('nombre'); try { - const fetched = await interaction.channel.fetchMessages({ limit: number }); + const fetched = await interaction.channel.messages.fetch({ limit: number }); const notPinned = fetched.filter(fetchedMsg => !fetchedMsg.pinned); await interaction.channel.bulkDelete(notPinned, true); - await interaction.reply({ content: `J'ai bien supprimé ${number} message${number>1 ? "s" : ""} dans ce salon`, ephemeral: true}); + await interaction.editReply({ content: `J'ai bien supprimé ${number} message${number>1 ? "s" : ""} dans ce salon`, ephemeral: true}); } catch(err) { console.error(err); }