Advertisement
Ryyan

Untitled

Aug 5th, 2019
131
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.27 KB | None | 0 0
  1.  
  2. if (command === "delticket") {
  3.  
  4. if(!message.guild.me.hasPermission("MANAGE_CHANNELS")) return message.channel.send('Sorry Mate, I dont have permissions to manage channels, contact a server admin.'), message.react('❌')
  5. let category = message.guild.channels.find(c => c.name == "tickets" && c.type == "category")
  6. let general = message.guild.channels.find(c => c.name == "〖💬〗「general」")
  7. if (!category) return message.channel.send("There are currently no tickets."), message.react('❌')
  8.  
  9. let support_ticket = message.guild.roles.find(r => r.name == "support team")
  10. if(!support_ticket) return message.channel.send("Whoops! it seems there is not an role named **support team** thats pretty weird dude"), message.react('❌')
  11. if (!message.member.roles.has(support_ticket.id)) return message.channel.send('Sorry mate but only the support team (or people with the role) can close tickets.'), message.react('❌')
  12. if(!message.channel.parent || message.channel.parent.id != category.id) return message.channel.send("This channel does not belong to any ticket"), message.react('❌')
  13. return message.channel.delete().catch(error => message.channel.send(`An error occurred: ${error.message}`)), general.send(`Successfully deleted the ticket.`)
  14. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement