Hi, So I’m sending a pet notification thing to discord where when a person gets a rare pet, it will show there. However, it does not seem to work and it errors with HTTP 400 (Bad Request). Please help.
local userId = Player.UserId
local thumbType = Enum.ThumbnailType.HeadShot
local thumbSize = Enum.ThumbnailSize.Size420x420
local content, isReady = game.Players:GetUserThumbnailAsync(userId, thumbType, thumbSize)
local data = HttpService:JSONEncode({
["embeds"] = {{
["author"] = {
["name"] = Player.Name,
["icon_url"] = game:GetService("Players"):GetUserThumbnailAsync(Player.UserId, Enum.ThumbnailType.HeadShot, Enum.ThumbnailSize.Size150x150),
},
["title"] = "Someone Hatched A ".. tostring(Rarity).." ".. tostring(PetName).." Pet (".. tostring(Chance)..")!",
["description"] = "Player: ".. tostring(Player.Name),
["color"] = (color or 16766976),
}}
})
if data ~= nil then
HttpService:PostAsync(webhookUrl, data)
end
I use discord webhooks in a game to log admin commands here is what i use
local url = "" -- paste your webhook here
local http = game:GetService("HttpService")
local data = {
['username'] = User,
['content'] = Message
}
local newdata = http:JSONEncode(data)
http:PostAsync(url, newdata)
Yes, I used this to create the image for the player. I think there is something with the data table though in the author section because before I added that it worked fine.
Firstly, I use embed because it looks better and there are more options. Second of all the main problem is I want it too contain the image of the users avatar, so like a thumbnail. I’ve seen it done before on other Discord Servers so it must be possible.
The HyperText Transfer Protocol (HTTP) 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). Are you sending the data to the correct endpoint? Are data encoded correctly into the json form?