2021-05-02 20:00:36 -04:00
|
|
|
const Logger = require('@lilywonhalf/pretty-logger');
|
2021-07-16 21:10:49 -04:00
|
|
|
const Config = require('../config.json');
|
|
|
|
|
const CommandCategory = require('../model/command-category');
|
|
|
|
|
const CommandPermission = require('../model/command-permission');
|
2021-05-02 20:00:36 -04:00
|
|
|
|
|
|
|
|
class Clean
|
|
|
|
|
{
|
|
|
|
|
constructor() {
|
|
|
|
|
this.aliases = ['clear', 'purge'];
|
|
|
|
|
this.category = CommandCategory.MODERATION;
|
|
|
|
|
this.isAllowedForContext = CommandPermission.isMemberMod;
|
2021-05-04 21:47:26 -04:00
|
|
|
this.description = 'Deletes messages in a bulk.';
|
2021-05-02 20:00:36 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @param {Message} message
|
|
|
|
|
* @param {Array} args
|
|
|
|
|
*/
|
|
|
|
|
async process(message, args) {
|
|
|
|
|
if (args.length > 0 && parseInt(args[0]) > 0) {
|
|
|
|
|
await message.channel.bulkDelete(Math.min(parseInt(args[0]) + 1, 100));
|
|
|
|
|
} else {
|
|
|
|
|
message.reply(`You have to tell me how many messages I should clean. \`${Config.prefix}clean 10\` for example.`);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
module.exports = new Clean();
|