From 456aad59dbb7b885f52fd06ff99f39259ff78797 Mon Sep 17 00:00:00 2001 From: Tutur33 Date: Fri, 16 Feb 2024 23:04:49 +0100 Subject: [PATCH] commande clear --- commands/gestion/clear.js | 20 ++++++++++++++++++++ commands/moderation/kick.js | 2 +- 2 files changed, 21 insertions(+), 1 deletion(-) create mode 100644 commands/gestion/clear.js diff --git a/commands/gestion/clear.js b/commands/gestion/clear.js new file mode 100644 index 0000000..4ce686b --- /dev/null +++ b/commands/gestion/clear.js @@ -0,0 +1,20 @@ +const { PermissionsBitField} = require("discord.js") +module.exports = { + name: 'clear', + description: 'Clear des messages', + emote: '🗑️', + utilisation: 'clear ', + category: 'gestion', + async execute(message, args, client) { + const amount = parseInt(args[0]) + 1; + if (isNaN(amount)) { + return message.reply('Veuillez entrer un nombre valide'); + } else if (amount <= 1 || amount > 100) { + return message.reply('Vous devez entrer un nombre entre 1 et 99'); + } + await message.reply('🗑️ Clear en cours...'); + await message.channel.bulkDelete(amount, true).catch((err) => { + message.reply('Une erreur est survenue lors du clear'); + }); + }, +}; \ No newline at end of file diff --git a/commands/moderation/kick.js b/commands/moderation/kick.js index 7bd9b3f..1ee0d58 100644 --- a/commands/moderation/kick.js +++ b/commands/moderation/kick.js @@ -6,7 +6,7 @@ module.exports = { description: 'Kick a member', emote: '🔍', utilisation: 'kick <@member> [reason]', - category: 'utils', + category: 'moderation', async execute(message, args, client) { const member = message.mentions.members.first();