SHARE
TWEET

ssss

a guest Jan 28th, 2020 61 in 7 days
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. const count = JSON["parse"](require("fs")["readFileSync"]('./count.json' , 'utf8'));
  2. client["on"]('message', message => {
  3. if(message["author"]["bot"]) return undefined;
  4. if(!count[message["guild"]["id"]]) count[message["guild"]["id"]] = {
  5. count: 1
  6. }
  7. require("fs")["writeFile"]("./count.json", JSON["stringify"](count), (err) => {if(err) console["error"](err)})
  8. let args = message["content"]["split"](" ");
  9. if(args[0]["toLowerCase"]() == prefix + `setticket`) {
  10. if(!args[1]) return message["channel"]["send"](`**| Using: \`\`${prefix}setticket [Ticket Message]\`\`**`)
  11. let e = new Discord.RichEmbed()
  12. .setAuthor(message.guild.name,message.guild.iconURL)
  13. .setColor("BLUE")
  14. .setDescription(`**${args[1]}
  15. React With 📩 To Open A Ticket**`)
  16. .setFooter(message.author.username,message.author.avatarURL)
  17. message["channel"]["send"](e)["then"](o => {
  18. o["react"]("📩")
  19. let c = (react,user) => react["emoji"]["name"] === "📩" && user["id"] === message["author"]["id"];
  20. let cc = o["createReactionCollector"](c, { time: 0})
  21. cc["on"]("collect", r => {
  22. if(!message["guild"]["member"](client["user"])["hasPermission"]("ADMINISTRATOR")) return message["channel"]["send"](`**| I do not have permission.**`);
  23. if(message["guild"]["channels"]["exists"]("name", "ticket-" + count[message["guild"]["id"]].count)) return message["channel"]["send"](`**| You already opened a ticket.**`);
  24. message["guild"]["createChannel"](`ticket-` + count[message["guild"]["id"]].count, "text")["then"](c => {
  25. let role = message["guild"]["roles"]["find"]("name", "Ticket");
  26. let role2 = message["guild"]["roles"]["find"]("name", "@everyone");
  27. c["overwritePermissions"](role, {
  28. SEND_MESSAGES: true,
  29. READ_MESSAGES: true
  30. });
  31. c["overwritePermissions"](role2, {
  32. SEND_MESSAGES: false,
  33. READ_MESSAGES: false
  34. });
  35. c["overwritePermissions"](message["author"], {
  36. SEND_MESSAGES: true,
  37. READ_MESSAGES: true
  38. });
  39. const new1 = new Discord.RichEmbed()
  40. .setColor("BLUE")
  41. .setAuthor(message["author"]["username"],message["author"]["avatarURL"])
  42. .setDescription(`**| Done Open your Ticket: <#${c.id}>**`)
  43. .setFooter(client["user"]["username"],client["user"]["avatarURL"])
  44. .setTimestamp();
  45. message["author"]["send"](new1);
  46. count[message["guild"]["id"]].count += 1
  47. c.send(`${message["author"]}
  48. > ** نرجو منك الانتظار وسوف يرد الدعم الفني عليك في اقرب وقت ممكن ..**
  49. @here
  50. `)
  51. })
  52. })
  53. })
  54. }
  55. });
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