I am having issues with my code. I wish to make a discord webhook, which worked earlier. My primary issue is trying to ignore " using backslash (\). You can review my script here:
Your structure is invalid for Discord. Remember that embeds should be a list of embeds, where each embed object is a dictionary. You have it set to a dictionary when it should be a list of dictionaries. If you only want a message with a single embed, it would be a list with one dictionary in it that is the embed object.
Another thing: the Name key in the embed dictionary should not be capitalized; it should be lowercase.
local data =
{
["content"] = "",
["embeds"] = { -- Should be a list of dictionaries which are embed objects, not a dictionary itself
{ -- Made this into a list with a single embed
["title"] = playerN.Name,
["author"] = {
["name"] = context.Executor.Name -- Should be lowercase
},
["description"] = "\"".. Chat:FilterStringForBroadcast(reason, context.Executor) .."\""
}
}
}
400 Bad Request response status code indicates that the server cannot or will not process the request due to something that is perceived to be a client error (e.g., malformed request syntax, invalid request message framing, or deceptive request routing).
I was thinking of 404 Not Found, embeds is meant to be a list
You have solved it. That was the problem all along. Thanks a lot, you have helped me and I’ll be able to apply this in the future for when I use JSON encoding again. A lot of people didn’t know how it was done, so thanks again!