Permalink
Browse files

Added Purge command

  • Loading branch information...
Alcha committed Oct 6, 2018
1 parent ef2724d commit 7a67b9681a4b26d23b35e69a846d724c368ffa31
Showing with 31 additions and 0 deletions.
  1. +31 −0 cmds/admin/Purge.js
@@ -0,0 +1,31 @@
const BaseCmd = require('../BaseCmd')
const perms = require('discord.js').Permissions.FLAGS
class Purge extends BaseCmd {
constructor (client) {
super(client, {
name: 'purge',
memberName: 'purge',
group: 'admin',
description: 'Purges the last given amount of messages in the channel.',
aliases: ['purges'],
examples: ['+purge'],
guildOnly: true,
args: [{
key: 'count',
prompt: 'How many messages would you like to delete?',
type: 'integer'
}]
})
}

async run (msg, { count }) {
if (msg.member.permissions.has(perms.MANAGE_MESSAGES)) {
// Continue with deletion
msg.channel.bulkDelete(count)
.then(msgs => msg.reply(`You've deleted ${msgs.size} messages.`))
.catch(console.error)
} else return msg.reply('You do not have the required permissions (**MANAGE_MESSAGES**) on this server to use this command.')
}
}

module.exports = Purge

0 comments on commit 7a67b96

Please sign in to comment.