Advertisement
Guest User

LOL

a guest
Nov 19th, 2019
169
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.29 KB | None | 0 0
  1. bot.on('message', async message => {
  2.  
  3. if (message.author.bot) return;
  4. if (message.channel.type !== 'text') {
  5. let active = await db.fetch(`support_${message.author.id}`);
  6. let guild = bot.guilds.get(serverStats.guildID);
  7. let channel, found = true;
  8. try {
  9. if (active) bot.channels.get(active.channelID)
  10. .guild;
  11. } catch (e) {
  12. found = false;
  13. }
  14. if (!active || !found) {
  15. active = {};
  16. channel = await guild.createChannel(`${message.author.username}-${message.author.discriminator}`, {type: 'text'})
  17. channel.setParent(serverStats.ticketCategoryID)
  18. channel.setTopic(`!zakoncz aby zamknąć ticket | Wsparcie dla ${message.author.tag} | ID: ${message.author.id}`)
  19.  
  20. channel.overwritePermissions('582227307352162335', { //Role id (kiedy ktos dolacza na serwer <<, niewiem jak to zmienic na @everyone. Tylko administarcja bedzie widziec kanal!
  21. VIEW_CHANNEL: false,
  22. SEND_MESSAGES: false,
  23. ADD_REACTIONS: false
  24. });
  25.  
  26.  
  27. channel.overwritePermissions('609808389454954507', { //Role id (kiedy ktos dolacza na serwer <<, niewiem jak to zmienic na @everyone. Tylko administarcja bedzie widziec kanal!
  28. VIEW_CHANNEL: true,
  29. SEND_MESSAGES: true,
  30. ADD_REACTIONS: true
  31. });
  32.  
  33.  
  34. channel.overwritePermissions('602249945696698419', { //Role id (kiedy ktos dolacza na serwer <<, niewiem jak to zmienic na @everyone. Tylko administarcja bedzie widziec kanal!
  35. VIEW_CHANNEL: true,
  36. SEND_MESSAGES: true,
  37. ADD_REACTIONS: true
  38. });
  39.  
  40.  
  41. channel.overwritePermissions('582584900742414489', { //Role id (kiedy ktos dolacza na serwer <<, niewiem jak to zmienic na @everyone. Tylko administarcja bedzie widziec kanal!
  42. VIEW_CHANNEL: true,
  43. SEND_MESSAGES: true,
  44. ADD_REACTIONS: true
  45. });
  46.  
  47.  
  48. let author = message.author;
  49. const newChannel = new Discord.RichEmbed()
  50. .setColor('RANDOM')
  51. .setAuthor(author.tag, author.avatarURL)
  52. .setFooter('Utworzono bilet pomocniczy!')
  53. .addField('Użytkownik', author)
  54. .addField('ID', author.id)
  55. await channel.send(newChannel);
  56. const newTicket = new Discord.RichEmbed()
  57. .setColor('RANDOM')
  58. .setAuthor(`Cześć, ${author.username}`, author.avatarURL)
  59. .setFooter('Utworzono bilet pomocniczy!')
  60. await author.send(newTicket);
  61. active.channelID = channel.id;
  62. active.targetID = author.id;
  63. }
  64. channel = bot.channels.get(active.channelID);
  65. const dm = new Discord.RichEmbed()
  66. .setColor('RANDOM')
  67. .setAuthor(`Dziękuje, ${message.author.username}`, message.author.avatarURL)
  68. .setFooter(`Twoja wiadomość została wysłana, support wkrótce się z tobą skontaktuje.`)
  69. await message.author.send(dm);
  70. if (message.content.startsWith('!complete')) return;
  71. const embed5 = new Discord.RichEmbed()
  72. .setColor('RANDOM')
  73. .setAuthor(message.author.tag, message.author.avatarURL)
  74. .setDescription(message.content)
  75. .setFooter(`Wiadomość otrzymana - ${message.author.tag}`)
  76. await channel.send(embed5);
  77. db.set(`support_${message.author.id}`, active);
  78. db.set(`supportChannel_${channel.id}`, message.author.id);
  79. return;
  80. }
  81. let support = await db.fetch(`supportChannel_${message.channel.id}`);
  82. if (support) {
  83. support = await db.fetch(`support_${support}`);
  84. let supportUser = bot.users.get(support.targetID);
  85. if (!supportUser) return message.channel.delete();
  86. if (message.content.toLowerCase() === '!zakoncz') {
  87. const complete = new Discord.RichEmbed()
  88. .setColor('RANDOM')
  89. .setAuthor(`Hej, ${supportUser.tag}`, supportUser.avatarURL)
  90. .setFooter('Zamknięty bilet')
  91. .setDescription('* Twój bilet został oznaczony jako kompletny. Jeśli chcesz go ponownie otworzyć lub utworzyć nowy, wyślij wiadomość do bota. *')
  92. supportUser.send(complete);
  93. message.channel.delete();
  94. db.delete(`support_${support.targetID}`);
  95. let inEmbed = new Discord.RichEmbed()
  96. .setTitle('Bilet Zamknięty!')
  97. .addField('Wsparcie użytkownika', `${supportUser.tag}`)
  98. .addField('Przez', message.author.tag)
  99. .setColor('RANDOM')
  100. const staffChannel = bot.channels.get('636304867761193010'); //stworzenie kanalu z logami wklej tu jego id
  101. staffChannel.send(inEmbed);
  102. }
  103. const embed4 = new Discord.RichEmbed()
  104. .setColor('RANDOM')
  105. .setAuthor(message.author.tag, message.author.avatarURL)
  106. .setFooter(`Wiadomość Otrzymana -- Support`)
  107. .setDescription(message.content)
  108. bot.users.get(support.targetID)
  109. .send(embed4);
  110. message.delete({
  111. timeout: 10000
  112. });
  113. embed4.setFooter(`Wiadomość Wysłana -- ${supportUser.tag}`)
  114. .setDescription(message.content);
  115. return message.channel.send(embed4);
  116. }
  117. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement