Skip to content
Snippets Groups Projects
Commit 7b1245b7 authored by Reviath's avatar Reviath
Browse files

Update commands/clear.js

parent b1cea355
No related branches found
No related tags found
No related merge requests found
......@@ -2,13 +2,13 @@ const Discord = require('discord.js');
exports.run = function(client, message, args) {
let id = Number(args[0]);
if(!message.member.hasPermission("MANAGE_MESSAGES")) return message.channel.send("<a:x_:801038779955150888> You need manage messages permission to use this command");
if(isNaN(id)) return message.channel.send("<a:x_:801038779955150888> You need to specify how many messages to delete");
if(!args[0]) return message.channel.send("<a:x_:801038779955150888> You need to specify how many messages to delete");
if ((args[0]) > 100) return message.channel.send('<a:x_:801038779955150888> i can\'t delete more than 100 messages')
if(!message.member.hasPermission("MANAGE_MESSAGES")) return message.channel.send("You need manage messages permission to use this command");
if(isNaN(id)) return message.channel.send("You need to specify how many messages do you want to delete.");
if(!args[0]) return message.channel.send("You need to specify how many messages do you want to delete.");
if ((args[0]) > 100) return message.channel.send('I can\'t delete more than 100 messages')
message.delete();
message.channel.bulkDelete(args[0]).then(() => {
message.channel.send(`<a:tik:801039054694514691> I delete ${args[0]} messages`).catch(e => {
message.channel.send(`Deleted ${args[0]} messages.`).catch(e => {
message.channel.send(`An error occurred \n${e}`)
});
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment