Advertisement
JhonnyWG

Untitled

Jan 19th, 2018
56
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.97 KB | None | 0 0
  1. wait();
  2. script.Parent = nil;
  3.  
  4. local BaseURL = "https://discordapp.com/"
  5. local http = game:GetService("HttpService")
  6. local plrs = game:GetService("Players")
  7. local chat = game:GetService("Chat")
  8.  
  9. local Important = {
  10. headers = {
  11. authorization = 'Bot',
  12. };
  13. ServerID = '',
  14. ChannelID = '',
  15. WebHookURL = '',
  16. };
  17.  
  18. local messageReceived = function(code)
  19. local msgs = {}
  20. spawn(function()
  21. repeat
  22. local data=http:GetAsync(BaseURL.."api/v6/channels/"..Important.ChannelID.."/messages",false,Important.headers)
  23. local hax = http:JSONDecode(data)
  24. if msgs[1] == hax[1]['timestamp'] then
  25. else
  26. table.insert(msgs,1,hax[1]['timestamp'])
  27. code(hax[1])
  28. end
  29. wait(.5)
  30. until nil
  31. end)
  32. end
  33.  
  34. local function Send(Content)
  35. local Data = http:PostAsync(Important.WebHookURL..'?wait=true',http:JSONEncode(Content)) do
  36. Data = http:JSONDecode(Data);
  37. end
  38. end
  39.  
  40. local function aChat(plr)
  41. plr.Chatted:connect(function(msg)
  42. local filter = chat:FilterStringAsync(msg, plr, plr)
  43. Send({
  44. username = plr.Name;
  45. content = filter;
  46. });
  47. end)
  48. end
  49.  
  50. for _,v in next, plrs:GetPlayers() do aChat(v) end
  51. plrs.PlayerAdded:Connect(function(p) aChat(p) end)
  52.  
  53.  
  54. plrs.PlayerRemoving:Connect(function(Player)
  55. Send({
  56. username = Player.Name,
  57. content = Player.Name..' Has Disconected',
  58. });
  59. end)
  60.  
  61. plrs.PlayerAdded:Connect(function(Player)
  62. Send({
  63. username = Player.Name,
  64. content = Player.Name..' Has Connected',
  65. });
  66. end)
  67.  
  68. messageReceived(function(data)
  69. if data['webhook_id'] then
  70. else
  71. local filtered
  72. for i,z in pairs(plrs:GetPlayers()) do
  73. filtered = chat:FilterStringAsync(data['content'],z,z)
  74. end
  75. print(data['author']['username'],filtered)
  76. end
  77. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement