Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- if(command === "purge") {
- let embed = new Discord.RichEmbed()
- .setColor("#ff0000")
- .setTitle(`❌${message.author.username}, error!❌`)
- .setDescription(`Invaild permissions.\n permissions needed: "MANAGE_ROLES", "ADMINISTRATOR"`)
- .setTimestamp()
- if (!message.member.hasPermission(["MANAGE_ROLES", "ADMINISTRATOR"])) return message.channel.send(embed)
- // This command removes all messages from all users in the channel, up to 100.
- // get the delete count, as an actual number.
- const deleteCount = parseInt(args[0], 10);
- // Ooooh nice, combined conditions. <3
- if(!deleteCount || deleteCount < 2 || deleteCount > 100)
- return message.reply("Please provide a number between 2 and 100 for the number of messages to delete");
- // So we get our messages, and delete them. Simple enough, right?
- const fetched = await message.channel.fetchMessages({limit: deleteCount});
- message.channel.bulkDelete(fetched)
- .catch(error => message.reply(`Couldn't delete messages because of: ${error}`));
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement