gizziboy
(Quiz)
April 9, 2021, 5:05pm
#1
function filteringFunction.OnServerInvoke(player, msg)
local payload = HTTP:JSONEncode({
--content = CHAT:FilterStringForBroadcast(msg,player),
--username = player.Name.." - (#"..player.UserId..")"
data =
{
["content"] = '',
["embeds"] = {{
["title"] = "Feedback:",
["description"] = msg,
["type"] = "rich",
["color"] = tonumber(0xffffff),
["fields"] = {
{
["name"] = "Username: "..player.Name,
["value"] = "Player ID: "..player.UserId,
["inline"] = true
}
}
}}
}
})
HTTP:PostAsync(webhook, payload)
return "Feedback recieved!"
end
I get a HTTP 400 bad request when I do this, I don’t know what I’m doing wrong, I don’t work with HTTP much.
4 Likes
gizziboy
(Quiz)
April 9, 2021, 5:30pm
#3
I tried it and it still gave the same error
1 Like
why are nesting tables like that?
try to make it simpler to read, i cant understand it that well
get a youtube video and remake the webhook
the reason its http 400 bad request is possibly because the data isnt formatted correctly
function filteringFunction.OnServerInvoke(player, msg)
local payload = HTTP:JSONEncode({
["content"] = 'some',
["embeds"] = {{
["title"] = "Feedback:",
["description"] = msg,
["type"] = "rich",
["color"] = tonumber(0xffffff),
["fields"] = {
{
["name"] = "Username: "..player.Name,
["value"] = "Player ID: "..player.UserId,
["inline"] = true
}
}
}}
})
HTTP:PostAsync(webhook, payload)
return "Feedback recieved!"
end
try that
gizziboy
(Quiz)
April 9, 2021, 5:32pm
#7
This is the exact same code from multiple different tutorials Like this
im working on a piece of code that will fix the problem, standby
gizziboy
(Quiz)
April 9, 2021, 5:34pm
#9
That doesn’t work either.
Extra characters
it isn’t because you have to close ["embeds"]
table with the nested table
well, all I did was simplify it. i did it my way which always succeeds