ccashbot/commands/moderation/prune.js
Expand-sys 9422e6e2b3 good
2021-06-09 20:40:12 +10:00

19 lines
574 B
JavaScript

module.exports = {
name: 'prune',
description: 'Prune up to 99 messages.',
permissions: 'MANAGE_MESSAGES',
execute(message, args) {
const amount = parseInt(args[0]) + 1;
if (isNaN(amount)) {
return message.reply('that doesn\'t seem to be a valid number.');
} else if (amount <= 1 || amount > 100) {
return message.reply('you need to input a number between 1 and 99.');
}
message.channel.bulkDelete(amount, true).catch(err => {
console.error(err);
message.channel.send('there was an error trying to prune messages in this channel!');
});
},
};