I’m trying to send a way to test a webhook, however I keep getting this error and I have no idea how to fix it, I’ve already tried resetting the webhook. Still nothing.
(link table was here but it just got spammed, i deserve that)
function:
function sendPost(typeOfPing,content,player)
if type(typeOfPing)~="string" then
error("line must be a string")
end
local anti_cheat=nil
local output=nil
local playerInfo=nil
local noPlayer=false
local data={
["content"]=content
}
if not player then
print("no player passed... resuming without player")
noPlayer=true
end
if noPlayer==false then
playerInfo=game.Players:GetPlayerByUserId(player)
if typeOfPing=="anti-cheat" then
anti_cheat={
["embeds"]={{
["author"]={
["name"]=playerInfo.Name.."has been banned",
["icon_url"]="https://www.roblox.com/Thumbs/Avatar.ashx?x=100&username"..playerInfo.Name
},
["description"]=content,
["color"]=Color3.fromHex("#f19f32"),
["fields"]={
{
["name"]="Account Age:",
["value"]=playerInfo.AccountAge,
["inline"]=true
}
}
}}
}
typeOfPing=pings["anti-cheat"]
data=anti_cheat
elseif typeOfPing=="output" then
output={
}
typeOfPing=pings.output
data=output
elseif typeOfPing=="test" then
typeOfPing=pings.test
else
warn("type of ping doesnt exist")
return
end
end
local dataToBeSent=nil
dataToBeSent=HttpService:JSONEncode(data)
local success,failure=pcall(function()
HttpService:PostAsync(typeOfPing,dataToBeSent,Enum.HttpContentType.ApplicationJson)
end)
if success then
print("webhook ping to discord",typeOfPing,data)
else
warn("error with webhook, details below")
warn(failure)
warn("typeOfPing:",typeOfPing)
warn("data:",data)
end
end
error: