Advertisement
Luk4O123

Untitled

Nov 29th, 2020
29
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.18 KB | None | 0 0
  1. const BaseCommand = require('../../utils/structures/BaseCommand');
  2.  
  3. module.exports = class NukeCommand extends BaseCommand {
  4. constructor() {
  5. super('nuke', 'moderation', []);
  6. }
  7.  
  8. async run(client, message, args) {
  9. //!nuke reason
  10. //Permission Checking:
  11. if (!message.member.hasPermission("MANAGE_CHANNELS")) return message.channel.send("You can not use this commnd.");
  12. if (!message.guild.me.hasPermission("MANAGE_CHANNELS")) return message.channel.send("My role does not have the manage channels permission.");
  13.  
  14. //Variables:
  15. let reason = args.join(" ");
  16. const nukeChannel = message.channel;
  17.  
  18. //Input Checking:
  19. if (!reason) reason = "No reason given.";
  20. if (!nukeChannel.deletable) return message.channel.send("This channel is not deletable.");
  21.  
  22. //Executing:
  23. await nukeChannel.clone().catch(err => console.log(err));
  24. await nukeChannel.delete(reason).catch(err => console.log(err));
  25. try {
  26. await message.channel.bulkDelete(fetched)
  27. .then(messages => message.channel.send(`Channel nuked.`));
  28. } catch (err) {
  29. console.log(err);
  30. message.channel.send(`I was unable to nuke the channel.`);
  31. }
  32. }
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement