Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- client.on('message', message => {
- if(message.author.bot) return;
- let msg = message.content
- let sender = message.author;
- let cont = message.content.slice(prefix.length).split(" ");
- let args = cont.slice(1);
- if (msg.startsWith(prefix + 'purge')) {
- async function purge() {
- message.delete();
- if (!message.member.roles.find("name", "Mods")) {
- message.channel.send('You need the \`Mods\` role to use this command.');
- return;
- }
- if (isNaN(args[0])) {
- message.channel.send('Please use a number as your arguments. \n Usage: ' + prefix + 'clear <amount>');
- return;
- }
- const fetched = await message.channel.fetchMessages({limit: args[0]});
- console.log(fetched.size + ' messages found, deleting...');
- message.channel.bulkDelete(fetched)
- .catch(error => message.channel.send(`Error: ${error}`));
- }
- purge();
- }});
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement