Dev_Cron
(Dev_Cron)
November 18, 2020, 5:03am
#1
Hello everybody, I hope you all have a marvelous day/evening.
Recently I’m trying to make a webhook system. But I’m getting the following error over and over.
Script:
local Reporter = ReplicatedStorage.Report
local HttpService = game:GetService("HttpService")
local Webhook = 'https://discord.com/api/webhooks/778480754019008532/-AlvEkqt0_Vn7WbAfmcpgsHarLuI3Du3xh11QLbP5AA4yXdmzR6-OIZZY-PV9fNUUPVJ'
Reporter.OnServerEvent:Connect(function(Invoker, V)
local SendData =
{
["content"] = "",
["embeds"] = {{
['title']= "Report tool",
['description']= "New report by" .. Invoker.Name.."!",
['type']= "rich",
['color']= tonumber(0x36393e),
['fields']={
{
['value']="Report: "..V,
['inline']=true }
}
}
}
}
local NewSendData = HttpService:JSONEncode(SendData)
HttpService:PostAsync(Webhook, NewSendData)
end)
--End script--
1 Like
Did you try to send a simple message to see if its an issue with the formatting?
Here’s my webhook function
function Execute(channel, token, data)
local succ, err = pcall(function()
local response = httpService:RequestAsync({
Url = string.format("https://discordapp.com/api/webhooks/%s/%s", tostring(channel), tostring(token));
Method = "POST";
Headers = {
['Content-Type'] = "application/json";
};
Body = httpService:JSONEncode(data);
});
if not response.Success then
warn("The request failed:", response.StatusCode, response.StatusMessage);
end;
end);
if not succ then
warn("Http Request Failed:",err);
end;
end;
This is part of my bigger API that I made. Has every function on the Discord API. Yes. I made the full Discord API on Roblox.
I dont see why you should make the discord API as the only real feature you can do without bots is webhooks.
Well yes but actually no. You can do everything that a bot can, how do you think the bot does it? You can make a bot token through the Discord api and slap that bad boy onto your requests and you can do everything a Discord bot can.
That’s how I made a verification system that doesn’t use an actual Discord bot running on NodeJS, so you can just get a code in game, tab to Discord, say the code there and boom, you’re verified on that account. All running on that Roblox server.
you could I guess but that is a complete waste of time tbh as making a bot that talks with roblox is way easier then using just requests only.
Dev_Cron
(Dev_Cron)
November 18, 2020, 5:38am
#7
Yes, and it’s still doing the error.
I just tested your code and my code and neither worked, so I think it’s back to when Roblox requests and blocked to the API on Discord’s end, so you would want to use a Proxy to bypass that.
posatta
(pasta)
November 18, 2020, 5:39am
#9
You probably shouldn’t post your webhook publicly; now anyone can use it! It seems that someone’s gone ahead and deleted it for you, so that might be why you’re getting that error.
4 Likes
Dev_Cron
(Dev_Cron)
November 18, 2020, 5:40am
#10
I know, but I changed webhook and it’s not working.
hikma_t
(hik)
November 18, 2020, 5:43am
#11
You’re most likely not using the correct format. https://embed.discord.website/
That’s not the problem. He’s using the proper format.
The problem is that Roblox is blocked by the Discord API again because so many calls are sent.
hikma_t
(hik)
November 18, 2020, 5:44am
#13
Blocked for OP or for everyone?
Everyone. I tried his code, and my code that worked a month ago and it didn’t work for either.
hikma_t
(hik)
November 18, 2020, 5:45am
#15
Weird. Just set up a webhook not more than two hours ago and its still working as of now.
Dev_Cron
(Dev_Cron)
November 18, 2020, 5:46am
#16
So it’s a global problem? If so then I guess to contact Roblox support.
Actually, I just tested in Roblox studio, so it could be that the Studio header is blocked, but the actual servers aren’t. Is it working in studio and in game for you?
Roblox support can’t do anything because it’s on Discord’s end.
Dev_Cron
(Dev_Cron)
November 18, 2020, 5:48am
#19
Alright, I’ll wait and see. If it won’t work until November 20 I’ll give up on that.
Have you just tested in studio or in the live game as well?