Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local ReplicatedStorage = game:GetService("ReplicatedStorage")
- local ServerStorage = game:GetService("ServerStorage")
- local Players = game:GetService("Players")
- local GroupService = game:GetService("GroupService")
- local Marketplace = game:GetService("MarketplaceService")
- local HttpService = game:GetService("HttpService")
- local Dir = ReplicatedStorage:WaitForChild("Event Shouter.Contents")
- local Network = require(ReplicatedStorage:WaitForChild("ForsakenScripts (Packages)"):WaitForChild("Modules"):WaitForChild("Network"))
- local Settings = require(Dir:WaitForChild("Event Shouter.Settings"))
- local Discord = require(ReplicatedStorage:WaitForChild("ForsakenScripts (Packages)"):WaitForChild("Modules"):WaitForChild("DiscordWebhook"))
- local WebhookSettings = require(ServerStorage:WaitForChild("Event Shouter.Webhooks"))
- local function GetPostData(Id)
- for i, v in pairs(WebhookSettings) do
- if v.Id == Id then
- return v
- end
- end
- end
- local Events = {}
- Events.Post = function(Client, SettingsData, Data)
- if not SettingsData or not Data then return end
- local PostData = GetPostData(SettingsData.Channel_Id)
- local Parsed = string.split(PostData.Webhook, "/")
- local Webhook = Discord.new(Parsed[#Parsed-1], Parsed[#Parsed])
- local Message = Webhook:NewMessage()
- local Embed = Message:NewEmbed()
- local AllowedMentions = Message:GetAllowedMention()
- Message:SetAvatarUrl(Players:GetUserThumbnailAsync(Client.UserId, Enum.ThumbnailType.HeadShot, Enum.ThumbnailSize.Size420x420))
- Message:SetUsername(Client.Name)
- if SettingsData.Mention_Everyone then
- Message:Append("@everyone ")
- end
- for _, RoleId in pairs(SettingsData.Mentions) do
- Message:Append("<@&"..RoleId.."> ")
- end
- Embed:SetTimestamp(tick())
- Embed:SetColor3(Settings.Embed.Color)
- Embed:SetTitle("**"..SettingsData.Event_Title.."**")
- local Info
- pcall(function()
- Info = Marketplace:GetProductInfo(game.PlaceId, Enum.InfoType.Asset)
- end)
- Embed:AppendFooter(Info.Name or "...")
- if Settings.Group.Enabled then
- local GroupInfo = GroupService:GetGroupInfoAsync(Settings.Group.Id)
- Embed:SetAuthorName(GroupInfo.Name)
- Embed:SetAuthorURL("https://www.roblox.com/groups/"..Settings.Group.Id)
- Embed:SetThumbnailIconURL(GroupInfo.EmblemUrl)
- end
- for Property, Value in pairs(Data) do
- local Field = Embed:NewField()
- Field:SetName(Property)
- Field:Append(Value)
- --Embed:Append("\n\n**"..Property.."** "..Value)
- end
- Message:Send()
- end
- Network:BindEvents(Events)
- local function IsAllowed(Client)
- if Settings.Group.Enabled then
- local Rank = Client:GetRankInGroup(Settings.Group.Id)
- for _, v in pairs(Settings.Group.AllowedRanks) do
- if v == Rank then
- return true
- end
- end
- end
- for Name, Id in pairs(Settings.AllowedPlayers) do
- if Id == Client.UserId then
- return true
- end
- end
- return false
- end
- local function ClientAdded(Client)
- if IsAllowed(Client) then
- Network:FireClient(Client, "Initialize")
- end
- end
- Players.PlayerAdded:Connect(ClientAdded)
- local Response
- pcall(function()
- Response = HttpService:JSONDecode(HttpService:GetAsync("https://forsakenscripts.pythonanywhere.com/api/verify/"..game.GameId))
- end)
- if not Response or not Response["status"] then
- script:Destroy()
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement