SHARE
TWEET

Untitled

a guest Aug 17th, 2019 93 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. if (msg.content.startsWith(".del")) {
  2.   let args = msg.content.split(" ").slice(1);
  3.   let messagecount = parseInt(args[0]) || 1;
  4.   var deletedMessages = -1;
  5.   msg.channel.fetchMessages({
  6.       limit: Math.min(messagecount + 1, 100, 200)
  7.     })
  8.     .then(messages => {
  9.       messages.forEach(m => {
  10.         m.delete().catch(console.error);
  11.         deletedMessages++;
  12.       });
  13.     }).then(() => {
  14.       if (deletedMessages === -1) deletedMessages = 0;
  15.       msg.channel.send(`${deletedMessages} messages **deleted.**`)
  16.         .then(m => m.delete(5000));
  17.     }).catch(console.error);
  18. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top