How to send a Discord webhook through Roblox

Content Type isn’t relevant just remove that argument

1 Like

You should of removed that in your code.

My bad, I do apologise for any inconvenience caused.

A RATE LIMIT OF 10 REQUESTS A SECOND HAD BEEN ADDED

Exceeding this ratelimit will result in a 1 hour timeout from the API

Due to a high amount of requests, the ratelimit has been increased to 60 a minute, I recommend adding a debounce to any of your scripts that utilise this function and to secure remote events to prevent exploiters hijacking this vulnerability.

Good job! It worked out fine for me after some small corrections.

Thank you! If you enjoyed it please make sure to leave a like.

HOW TO ADD DEBOUNCE TO WEBHOOK CHATLOGS EXAMPLE

local debounce = 0 
game.Players.PlayerAdded:Connect(function(Player)
    Player.Chatted:Connect(function(Message)
        local data = {
            ['WebhookURL'] = 'https://discord.com/webhook/blahblahblah'
            ['WebhookData'] = {['username']='xG_andalf', ['content']=Message}
        }
        if debounce > 59 then repeat wait(1) until debounce == 0 end end
        local https = game:GetService('HttpService')
        local data = https:JSONEncode(data)
        local success,errorm = pcall(function()
            https:PostAsync('https://bloxrank.com/api/webhook/', data)
        end)
    end)
end)

local RuntimeService = game:GetService('RuntimeService')

function resetcalldowns() 
    while true do 
        wait(60)
        debounce = 0
    end
end

local coro = coroutine.create(resetcalldowns())
coroutine.resume(coro)

If you require anymore help, feel free to send me a message or reply to this post

2 Likes

That is not a proper debounce as that only delays the HTTP request by 1.5 seconds.

That’s the point :man_facepalming: If the HTTP requests are delayed then the ratelimit won’t be exceeded.

That is more like you’re just delaying the event instead, so if the .Chatted event is triggered alot of times within the same time then its just going to be bypassed very easily.

1 Like

Exactly this! If you send a bunch of events at once without the wait, it will spam the webhook like you’re concerned about, but adding the wait will do absolutely nothing to resolve that problem. It will spam the webhook the same amount and at the same time, the only change is that it would be 1.5 seconds before that happens.

But ths 1.5 seconds will stop it spamming all at once therefore avoiding the ratelimit

No it would not. it just delays the event by 1.5 seconds, which is pretty useless. That is not a proper rate limiter. It does not make sure that under 50 API gets sent every minute and no matter how long the wait is, it would still spam the same amount of times. It only affects how long it takes for the API to get sent.

That’s the point, if the requests are delayed, they’re still all being sent just not all at the same time.

You are not understanding or processing what our replies are stating. You are just delaying the Player.Chatted event by an arbitrary 1.5 seconds, which is the same as no delay as the function connected to the event runs without regard to the previous call. Consequently, the script can still send requests all at the same time when players spam the chat.

1 Like

That isn’t even a debounce at all bro. It just delays the time by 1.5 seconds (you should use task.wait instead of just wait btw, wait is becoming deprecated as we all know). It’s totally useless.

Imagine all you do is getting delayed by 1.5 seconds, the interval between all your action are still the same but the time it happens is the one getting delayed by 1.5 seconds. Go look up what is a proper debounce before adding unworking solutions to your own posts.

Oh and btw you didnt link the “Roblox post documentation” in your original post.
And for bloxrank, i dont see any developer api in their website.

I did “;webhooks enable” in my server which worked but then to get a proxy url from Bloxrank there is no documentation.

You don’t need a proxy URL. You can just use that example provided. “;webhooks enable” is a command that allows you to customise the way your bot looks in the server.

What are you talking about ?
Do you atleast know that what you have been showing us is the proxy service provider of Bloxrank to bypass the Discord denial of Roblox’s http post requests ?

I don’t think you know anything about the code you’ve showed in your OP. It literally has a bloxrank url and then a redirect url to the discord hook it’s targeting.