PB_PhenixH

clear.js

Feb 14th, 2021
58
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.62 KB | None | 0 0
  1. module.exports = {
  2. name: 'clear',
  3. description: "Clear messages!",
  4. async execute(message, args) {
  5. if (!args[0]) return message.reply("Please enter the amount of messages to clear!");
  6.  
  7. if(isNaN(args[0])) return message.reply("Please type a real number!");
  8.  
  9. if(args[0] > 100) return message.reply("You can't remove more than 100 messages!");
  10.  
  11. if(args[0] < 1) return message.reply("You have to delete at least one message!");
  12.  
  13. await message.channel.messages.fetch({ limit: args[0]}).then(messages =>{
  14. message.channel.bulkDelete(messages)
  15. });
  16.  
  17. }
Advertisement
Add Comment
Please, Sign In to add comment