local ContentProvider = game:GetService("ContentProvider") local MarketplaceService = game:GetService("MarketplaceService") local Ws = require(script.Parent.WebhookService) local module = {} local req = Ws:new() local nameSuccess, gameName = pcall(function() return MarketplaceService:GetProductInfo(game.PlaceId).Name end) type Field = { name: string, value: () -> () | string, inline: boolean } local StackField = { { ["name"] = "Game", ["value"] = nameSuccess and gameName or game.Name, ["inline"] = false }, { ["name"] = "Server Id", ["value"] = game.JobId ~= "" and game.JobId or "Roblox Studio", ["inline"] = false }, } local ErrorStackField = { { ["name"] = "Stack Trace", ["value"] = "Stack Trace Template", ["inline"] = false }, { ["name"] = "Error Line", ["value"] = "Error Line Template", ["inline"] = false }, { ["name"] = "Error", ["value"] = "Error Template", ["inline"] = false } } type FieldAdd = { add: (field: Field) -> (FieldAdd) } function module.CreateFields(): FieldAdd StackField = {} local constructor; constructor = function(field: Field) table.insert(StackField, field) return { add = constructor } end return { add = constructor } end function module.AttachErrorFieldsToStackField() for _, field in ErrorStackField do table.insert(StackField, field) end end function module.RequestBotMessage(Message) req.Content = Message req:sendMessage() end function module.RequestBotHook(List,BlackListed) local Stack_Trace = tostring(List[1]) local Error_Line = tostring(List[2]) local Error = tostring(List[3]) req.Author = "ErrorPopper" req.Description = "Error Log" req.AuthorUrl = "https://cdn.discordapp.com/attachments/1088271521916653580/1364384653087215707/gpag0Nb.png?ex=680979ba&is=6808283a&hm=e2ffa9ee417891e638bea837ff400c98c172a1e8134177f7b3bc91a1776acf5d&" req.Thumbnail = `https://assetgame.roblox.com/Game/Tools/ThumbnailAsset.ashx?aid={game.PlaceId}&fmt=png&wd=420&ht=420` req.TimeStamp = DateTime.now():ToIsoDate() local fields = table.clone(StackField) for _, field in fields do if typeof(field.value) == "function" then field.value = field.value() end end fields[#fields - 2].value = Stack_Trace fields[#fields - 1].value = Error_Line fields[#fields].value = Error if not BlackListed then req.Color = Ws.colors.blue else req.Description = "Blacklisted Error" req.Color = Ws.colors.black fields[#fields + 1] = { ["name"] = "BlackListed Error", ["value"] = "Error Has occured over 5 times and is persistent", ["inline"] = false } end req.Fields = fields req:sendAuthorEmbed() end return module