I am making a “form” system where users answer certain questions for an application of a position.
I’ve ran into an error within the function where I combine gotten answers into one ready-to-send package for the webhook. It seems to print HTTP 400 bad request.
Surprisingly it seems to work if I remove one of the fields as it combines perfectly and sends it correctly to the webhook, therefore it’s likely a problem in the way this is formatted. I would like to have 3, not 2 fields for this purpose. How can I fix this for that to be possible?
local function combineContent(plrName, answer1 , answer2, answer3)
local embed = {
embeds = {
title = "An application has been submitted!",
description = ("Application submitted by " ..plrName),
color = tonumber(0x00A3FF),
fields = {
{
name = "Why should we choose you?",
value = answer1,
inline = true
},
{
name = "Do you have any past experience?",
value = answer2,
inline = true
},
{
name = "How active are you?",
value = answer3,
inline = true
},
}
}
}
return embed
end
That’s not a valid color. You dont use hex on embeds. You use decimal. For example, a bluish color would be 34749. You can google hex/rgb to decimal and convert your color.
After some decoding I found your issue. You forgot an array in your webhook. This is how it should look like.
local function combineContent(plrName, answer1 , answer2, answer3)
local embed = {
embeds = {
{
title = "An application has been submitted!",
description = "Application submitted by "..plrName,
color = tonumber(0x00A3FF),
fields = {
{
name = "Why should we choose you?",
value = answer1,
inline = true
},
{
name = "Do you have any past experience?",
value = answer2,
inline = true
},
{
name = "How active are you?",
value = answer3,
inline = true
},
}
}
}
}
return embed
end