Advertisement
Guest User

Untitled

a guest
May 20th, 2018
118
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.16 KB | None | 0 0
  1. local discordia = require "discordia"
  2. local client = discordia.Client()
  3.  
  4. available_languages={
  5. AR="\xF0\x9F\x87\xB8\xF0\x9F\x87\xA6",
  6. BR="\xF0\x9F\x87\xA7\xF0\x9F\x87\xB7",
  7. CN="\xF0\x9F\x87\xA8\xF0\x9F\x87\xB3",
  8. DE="\xF0\x9F\x87\xA9\xF0\x9F\x87\xAA",
  9. EN="\xF0\x9F\x87\xAC\xF0\x9F\x87\xA7",
  10. ES="\xF0\x9F\x87\xAA\xF0\x9F\x87\xB8",
  11. FR="\xF0\x9F\x87\xAB\xF0\x9F\x87\xB7",
  12. HR="\xF0\x9F\x87\xAD\xF0\x9F\x87\xB7",
  13. HU="\xF0\x9F\x87\xAD\xF0\x9F\x87\xBA",
  14. IT="\xF0\x9F\x87\xAE\xF0\x9F\x87\xB9",
  15. PL="\xF0\x9F\x87\xB5\xF0\x9F\x87\xB1",
  16. RO="\xF0\x9F\x87\xB7\xF0\x9F\x87\xB4",
  17. TR="\xF0\x9F\x87\xB9\xF0\x9F\x87\xB7",
  18. CZ="\xF0\x9F\x87\xA8\xF0\x9F\x87\xBF",
  19. NL="\xF0\x9F\x87\xB3\xF0\x9F\x87\xB1"
  20. }
  21.  
  22. roles={
  23. ["AR"]='447386612255686659',
  24. ["BR"]='447386563974922263',
  25. ["CN"]='447386613954248705',
  26. ["DE"]='447386613639806976',
  27. ["EN"]='447386382600503307',
  28. ["ES"]='447386563983179776',
  29. ["FR"]='447386410958323722',
  30. ["HR"]='447386616353521665',
  31. ["HU"]='447386564155146240',
  32. ["IT"]='447386614671343616',
  33. ["PL"]='447386564130111529',
  34. ["RO"]='447386564234838026',
  35. ["TR"]='447386563983441920',
  36. ["CZ"]='447386615514529813',
  37. ["NL"]='447386612746420224'
  38. }
  39.  
  40. do
  41. local concat = table.concat
  42. table.concat = function(list, sep, f, i, j, it)
  43. it = it or function() return next, list end
  44.  
  45. if type(f) == "boolean" and f then
  46. return concat(list, sep)
  47. end
  48.  
  49. local txt = ""
  50. sep = sep or ""
  51. i,j = i or 1,j or #list
  52. for k,v in it(list) do
  53. if type(k) ~= "number" and true or (k >= i and k <= j) then
  54. txt = txt .. tostring((not f and v or f(k,v))) .. sep
  55. end
  56. end
  57. return string.sub(txt,1,-1-#sep)
  58. end
  59. end
  60.  
  61. client:on("ready", function()
  62. --local message = client:getChannel('447384060659105793'):send("React the community flag that you want to discuss with to get access to their public channel. :speech_balloon:\n\n" .. table.concat(available_languages, "\t", function(index, value)
  63. -- return value .. " `" .. index .. "`"
  64. --end))
  65.  
  66. --for k, v in next, available_languages do
  67. -- message:addReaction(v)
  68. --end
  69. end)
  70.  
  71. client:on("reactionAddUncached", function(channel, messageID, hash, userID)
  72. if userID == client.user.id then return end
  73.  
  74. if channel.id == "447384060659105793" then
  75. for k, v in next, available_languages do
  76. if v == hash then
  77. channel.guild:getMember(userID):addRole(roles[k])
  78. return
  79. end
  80. end
  81. end
  82. end)
  83. client:on("reactionRemoveUncached", function(channel, messageID, hash, userID)
  84. if userID == client.user.id then return end
  85.  
  86. if channel.id == "447384060659105793" then
  87. for k, v in next, available_languages do
  88. if v == hash then
  89. channel.guild:getMember(userID):removeRole(roles[k])
  90. return
  91. end
  92. end
  93. end
  94. end)
  95.  
  96. client:on("memberJoin", function(member)
  97. member:addRole('447387513577930752')
  98. end)
  99.  
  100. client:run('Bot NDMxMTkyMjczNzAzNzk2NzM3.DeLn5A.-Kc4W-BylupYeSWmNbX5lfeh6CQ')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement