|
| 1 | +const Discord = require("discord.js"); |
| 2 | +const config = require("../../config/config.json"); |
| 3 | + |
| 4 | +module.exports.run = async (client, message, args) => { |
| 5 | + |
| 6 | + //User no permission |
| 7 | + const embed6 = new Discord.MessageEmbed() |
| 8 | + .setDescription( |
| 9 | + `${emojis.cross} ${message.author.username}, Missing Permission` |
| 10 | + ) |
| 11 | + .setColor("RED"); |
| 12 | + if (!message.member.hasPermission("KICK_MEMBERS") || message.author.id === 221838936866029568) { |
| 13 | + return message.channel.send(embed6).then(m => m.delete({ timeout: 5000 })); |
| 14 | + } |
| 15 | + |
| 16 | + //Bot no permission |
| 17 | + const notice3 = new Discord.MessageEmbed() |
| 18 | + .setDescription(`${emojis.cross} I don't have permission to list people!`) |
| 19 | + .setColor("RED"); |
| 20 | + if (!message.guild.member(client.user).hasPermission("KICK_MEMBERS")) { |
| 21 | + return message.channel.send(notice3).then(m => m.delete({ timeout: 5000 })); |
| 22 | + } |
| 23 | + |
| 24 | + //List and Pruning |
| 25 | + let mentionedrole = message.mentions.roles.firstKey() |
| 26 | + const withoutPrefix = message.content.slice(config.prefix.length); |
| 27 | + const split = withoutPrefix.split(/ +/); |
| 28 | + const command = split[0]; |
| 29 | + const argss = split.slice(1); |
| 30 | + let id = argss[0]; |
| 31 | + |
| 32 | + //Didn't mention a role |
| 33 | + const notice2 = new Discord.MessageEmbed() |
| 34 | + .setDescription(`${message.author}, You didn't mention a role!`) |
| 35 | + .setColor("RED"); |
| 36 | + if (!args.length) return message.channel.send(notice2); |
| 37 | + |
| 38 | + //Didn't mention the exact role |
| 39 | + const embed7 = new Discord.MessageEmbed() |
| 40 | + .setTitle("Wrong Usage!") |
| 41 | + .setDescription("Correct Example: p!prune <role> <days>") |
| 42 | + .setColor("RED"); |
| 43 | + if (!id.startsWith('<@&') && id.endsWith('>')) { |
| 44 | + message.delete(); |
| 45 | + return message.channel.send(embed7).then(m => m.delete({ timeout: 5000 })); |
| 46 | + } |
| 47 | + |
| 48 | + |
| 49 | + |
| 50 | + |
| 51 | +}; |
| 52 | +module.exports.help = { |
| 53 | + name: "prune", |
| 54 | + description: "Pruning users in specific roles and days.", |
| 55 | + usage: "p!prune <role> <days>", |
| 56 | + accessableby: "ADMINISTRATOR", |
| 57 | + aliases: [], |
| 58 | + cooldown: 300 |
| 59 | +}; |
0 commit comments