20 lines
516 B
JavaScript
20 lines
516 B
JavaScript
|
module.exports = {
|
||
|
name: 'purge',
|
||
|
aliases: ['purge'],
|
||
|
utilisation: '{prefix}purge',
|
||
|
voiceChannel: false,
|
||
|
|
||
|
async execute(client, message, args) {
|
||
|
|
||
|
if (isNaN(args[0]) || (args[0] < 1 || args[0] > 100)) return message.reply('Il faut spécifier un **nombre** entre 1 et 100 !');
|
||
|
|
||
|
const messages = await message.channel.messages.fetch({
|
||
|
limit: Math.min(args[0], 100),
|
||
|
before: message.id,
|
||
|
});
|
||
|
|
||
|
message.delete();
|
||
|
await message.channel.bulkDelete(messages);
|
||
|
|
||
|
},
|
||
|
};
|