MaxproGlitcher

chats log .lua

Jul 21st, 2024
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.45 KB | None | 0 0
  1.  
  2. --[[
  3.  
  4.  
  5. Tutorial:
  6. make a discord webhook
  7. copy the webhook url
  8. put the webhooks url in the 'Your Discord Webhook Link Here!'
  9.  
  10. this basically makes your bot start sending the chat messages from the server ur in
  11. --]]
  12.  
  13. local marketplaceService = game:GetService("MarketplaceService")
  14.  
  15. local isSuccessful, info = pcall(marketplaceService.GetProductInfo, marketplaceService, Game.PlaceId)
  16. if isSuccessful then
  17.  
  18. local wh = 'Your Discord Webhook Link Here!'
  19. local embed1 = {
  20. ['title'] = 'Beginning of Message logs on '..info.Name.." at "..tostring(os.date("%m/%d/%y at time %X"))
  21. }
  22. local a = request({
  23. Url = wh,
  24. Headers = {['Content-Type'] = 'application/json'},
  25. Body = game:GetService("HttpService"):JSONEncode({['embeds'] = {embed1}, ['content'] = ''}),
  26. Method = "POST"
  27. })
  28. function logMsg(Webhook, Player, Message)
  29. local embed = {
  30. ['description'] = Player..": "..Message.." " ..tostring(os.date("| time %X"))
  31. }
  32. local a = request({
  33. Url = Webhook,
  34. Headers = {['Content-Type'] = 'application/json'},
  35. Body = game:GetService("HttpService"):JSONEncode({['embeds'] = {embed}, ['content'] = ''}),
  36. Method = "POST"
  37. })
  38. end
  39. for i,v in pairs(game.Players:GetPlayers()) do
  40. v.Chatted:Connect(function(msg)
  41. logMsg(wh, v.Name, msg)
  42. end)
  43. end
  44.  
  45. game.Players.PlayerAdded:Connect(function(plr)
  46. plr.Chatted:Connect(function(msg)
  47. logMsg(wh, plr.Name, msg)
  48. end)
  49. end)
  50. end
Advertisement
Add Comment
Please, Sign In to add comment