de-OOPify stuff a little

This commit is contained in:
spiral 2021-10-20 12:56:51 -04:00
parent c3fa0554c4
commit 2aadc1a1ef
No known key found for this signature in database
GPG key ID: A6059F0CA0E1BD31
6 changed files with 30 additions and 89 deletions

View file

@ -1,22 +1,13 @@
const Logger = require('@lilywonhalf/pretty-logger');
const Config = require('../config.json');
const CommandCategory = require('../model/command-category');
const CommandPermission = require('../model/command-permission');
class Clean
{
constructor() {
this.aliases = ['clear', 'purge'];
this.category = CommandCategory.MODERATION;
this.isAllowedForContext = CommandPermission.isMemberMod;
this.description = 'Deletes messages in a bulk.';
}
/**
* @param {Message} message
* @param {Array} args
*/
async process(message, args) {
module.exports = {
aliases: ['clear', 'purge'],
category: CommandCategory.MODERATION,
isAllowedForContext: CommandPermission.isMemberMod,
description: 'Deletes messages in bulk.',
process: async (message, args) => {
if (args.length > 0 && parseInt(args[0]) > 0) {
await message.channel.bulkDelete(Math.min(parseInt(args[0]) + 1, 100));
} else {
@ -24,5 +15,3 @@ class Clean
}
}
}
module.exports = new Clean();