Advertisement
Guest User

Untitled

a guest
Sep 21st, 2019
194
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.51 KB | None | 0 0
  1. const discord = require("discord.js");
  2.  
  3. module.exports.run = async (bot, message, args) => {
  4.  
  5. const ticketid = "624182873775144961" // ID of ticket category
  6. let userName = message.author.username;
  7. let userDiscriminator = message.author.discriminator;
  8.  
  9. if (message.guild.channels.exists('name', `ticket-${message.author.id}`)) return message.channel.send(new discord.RichEmbed().setColor("RED").setTitle("Error!").setDescription("You already have a ticket open!"));
  10. message.guild.createChannel(`ticket-${message.author.id}`, 'text').then(c => {
  11. let everyone = message.guild.defaultRole;
  12. let staff = message.guild.roles.find(c => c.name == "Support");
  13.  
  14. c.overwritePermissions(everyone, {
  15. SEND_MESSAGES: false,
  16. READ_MESSAGES: false
  17. });
  18. c.overwritePermissions(staff, {
  19. SEND_MESSAGES: true,
  20. READ_MESSAGES: true
  21. });
  22. c.overwritePermissions(message.author, {
  23. SEND_MESSAGES: true,
  24. READ_MESSAGES: true
  25. });
  26. message.channel.send(new discord.RichEmbed().setColor("GREEN").setTitle("Success!").setDescription(`Your ticket has been created, <#${c.id}>!`));
  27. let em = new discord.RichEmbed()
  28. .setColor("BLUE")
  29. .setTitle("Vatrix Ticket System")
  30. .addField(`${message.author.username} requested`, args[0] ? args[0] : "None set.")
  31. .addField(`Happy with your response?`, `Get a support member to close this ticket.`);
  32. c.send({ embed: em });
  33.  
  34. }).catch(console.error);
  35.  
  36. }
  37.  
  38. module.exports.help = {
  39. name:"new"
  40. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement