hello, i am trying to make a level difficulty rating system while when submitted sent to a discord server, the gui works perfectly it’s just that the HTTP Request is always a Bad Request and i get the error: HTTP 400 (Bad Request), heres the scripts i am using for the HTTP Requests:
The Submit Button HTTP Client Script:
script.Parent.MouseButton1Click:Connect(function()
local player = game.Players.LocalPlayer
local LevelName = script.Parent.Parent.LevelName
local Difficulty = script.Parent.Parent.DifficultyDisplay
game.ReplicatedStorage.RateLevelMessage:FireServer(player, LevelName, Difficulty)
end)
and the Server HTTP Request Script (which should send a message to a discord server):
local HTTP = game:GetService("HttpService")
game.ReplicatedStorage.RateLevelMessage.OnServerEvent:Connect(function(player, LevelName, Difficulty)
local data = {
["player"] = player,
["LevelName"] = LevelName,
["Difficulty"] = Difficulty
--["content"] = LevelName, Difficulty
}
data = HTTP:JSONEncode(data)
HTTP:PostAsync("The Discord Webhook URL", data)
end)
Hey here, Discord has blocked Roblox servers from their API due to problems I’ve since forgotten. The best way around it would be to set up your own proxy to make a request to your server. However, keep in mind that Discord might delete your Webhook and warn you if they realize what you are doing or if there is a large amount of requests on the Webhook.
Using public proxy like those can have security issues so I would recommend to create your own Proxy if you really need to make request to the Discord API
Another thing, after using the proxy can you tell me what is the “LevelName”, “Difficulty” and “player” data? Discord does not have any of those listed in their api. I believe what you want to make is an embed, but that is not how you make it.
This is an online tool that will give you a visual output on what you are making. This tool is good to design webhooks. After you are done you just copy what is on the left and send it on the request. https://leovoel.github.io/embed-visualizer/
First, all the replies saying that you are getting error 400 because discord blocked requests from roblox (which discord did) are wrong, in that case you would not get a 400 http error but rather a 401 one.
You are getting http 400 because the data you are sending is definitely not in the correct format. That data you pass must be used to generate a discord message so none of the parameters in that dictionary are correct.
To learn how to send a valid embed read this post:
and to learn how to discord embeds’ data is structured read discord’s docs here:
Discord banned roblox servers from using ther API because of abuses with Webhook and peoples sending too many requests / others reasons.
Adding information on why discord blocked roblox since I didn’t say it when I said that I had forgotten the reason in my first post and you were talking about the fact that discord had indeed blocked roblox