Advertisement
V3N0M_Z

Untitled

Jan 4th, 2021
1,121
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 3.24 KB | None | 0 0
  1. local ReplicatedStorage = game:GetService("ReplicatedStorage")
  2. local ServerStorage = game:GetService("ServerStorage")
  3. local Players = game:GetService("Players")
  4. local GroupService = game:GetService("GroupService")
  5. local Marketplace = game:GetService("MarketplaceService")
  6. local HttpService = game:GetService("HttpService")
  7.  
  8. local Dir = ReplicatedStorage:WaitForChild("Event Shouter.Contents")
  9. local Network = require(ReplicatedStorage:WaitForChild("ForsakenScripts (Packages)"):WaitForChild("Modules"):WaitForChild("Network"))
  10. local Settings = require(Dir:WaitForChild("Event Shouter.Settings"))
  11. local Discord = require(ReplicatedStorage:WaitForChild("ForsakenScripts (Packages)"):WaitForChild("Modules"):WaitForChild("DiscordWebhook"))
  12. local WebhookSettings = require(ServerStorage:WaitForChild("Event Shouter.Webhooks"))
  13.  
  14. local function GetPostData(Id)
  15.     for i, v in pairs(WebhookSettings) do
  16.         if v.Id == Id then
  17.             return v
  18.         end
  19.     end
  20. end
  21.  
  22. local Events = {}
  23. Events.Post = function(Client, SettingsData, Data)
  24.     if not SettingsData or not Data then return end
  25.     local PostData = GetPostData(SettingsData.Channel_Id)
  26.     local Parsed = string.split(PostData.Webhook, "/")
  27.     local Webhook = Discord.new(Parsed[#Parsed-1], Parsed[#Parsed])
  28.     local Message = Webhook:NewMessage()
  29.     local Embed = Message:NewEmbed()
  30.     local AllowedMentions = Message:GetAllowedMention()
  31.    
  32.     Message:SetAvatarUrl(Players:GetUserThumbnailAsync(Client.UserId, Enum.ThumbnailType.HeadShot, Enum.ThumbnailSize.Size420x420))
  33.     Message:SetUsername(Client.Name)
  34.    
  35.     if SettingsData.Mention_Everyone then
  36.         Message:Append("@everyone ")
  37.     end
  38.     for _, RoleId in pairs(SettingsData.Mentions) do
  39.         Message:Append("<@&"..RoleId.."> ")
  40.     end
  41.    
  42.     Embed:SetTimestamp(tick())
  43.     Embed:SetColor3(Settings.Embed.Color)
  44.     Embed:SetTitle("**"..SettingsData.Event_Title.."**")
  45.     local Info
  46.     pcall(function()
  47.         Info = Marketplace:GetProductInfo(game.PlaceId, Enum.InfoType.Asset)
  48.     end)
  49.     Embed:AppendFooter(Info.Name or "...")
  50.     if Settings.Group.Enabled then
  51.         local GroupInfo = GroupService:GetGroupInfoAsync(Settings.Group.Id)
  52.         Embed:SetAuthorName(GroupInfo.Name)
  53.         Embed:SetAuthorURL("https://www.roblox.com/groups/"..Settings.Group.Id)
  54.         Embed:SetThumbnailIconURL(GroupInfo.EmblemUrl)
  55.     end
  56.    
  57.     for Property, Value in pairs(Data) do
  58.         local Field = Embed:NewField()
  59.         Field:SetName(Property)
  60.         Field:Append(Value)
  61.         --Embed:Append("\n\n**"..Property.."** "..Value)
  62.     end
  63.    
  64.     Message:Send()
  65. end
  66. Network:BindEvents(Events)
  67.  
  68.  
  69.  
  70. local function IsAllowed(Client)
  71.    
  72.     if Settings.Group.Enabled then
  73.         local Rank = Client:GetRankInGroup(Settings.Group.Id)
  74.         for _, v in pairs(Settings.Group.AllowedRanks) do
  75.             if v == Rank then
  76.                 return true
  77.             end
  78.         end
  79.     end
  80.    
  81.     for Name, Id in pairs(Settings.AllowedPlayers) do
  82.         if Id == Client.UserId then
  83.             return true
  84.         end
  85.     end
  86.    
  87.     return false
  88.    
  89. end
  90.  
  91. local function ClientAdded(Client)
  92.     if IsAllowed(Client) then
  93.         Network:FireClient(Client, "Initialize")
  94.     end
  95. end
  96. Players.PlayerAdded:Connect(ClientAdded)
  97.  
  98. local Response
  99. pcall(function()
  100.     Response = HttpService:JSONDecode(HttpService:GetAsync("https://forsakenscripts.pythonanywhere.com/api/verify/"..game.GameId))
  101. end)
  102. if not Response or not Response["status"] then
  103.     script:Destroy()
  104. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement