Limiter - Forget About Rate Limits

Limiter

Forget About Rate Limits

โœจ Documentation | ๐Ÿ’พ Download | ๐Ÿ“ƒ Source



Annoyed with Discord banning you for exceeding webhook rate limits? Sick of rate limits in general? No problem! Limiter is a module that takes care of rate limits for you using a queue.



Documentation

Limiter:SetRateLimit(rt: number)

rt - Maximum amount of functions that will be executed and leave the queue per minute (Defaults to 5)

Limiter:Add(misc, ...)

misc - Can be a string or a function

If misc is a function, you would use it like this:
Limiter:Add(function()
    print('hi')
end)

If misc is a string, you can choose from one of the available ids:

  • d_webhook - For creating a discord webhook

Example Usage:

Limiter:Add("d_webhook", "webhook_url", "messagetosend")

Limiter:Activate()

Begins running the queue and fires the Limiter.Activated event.

Limiter:Deactivate()

Stops running the queue and fires the Limiter.Deactivated event.

Limiter.Activated

Fired when Limiter:Activate() is called. No parameters.

Limiter.Deactivated

Fired when Limiter:Deactivate() is called. No parameters.

Limiter.Added

Fired when Limiter:Add() is called. No parameters.



Source Code


You can view the source code for Limiter here.



Thanks for reading!
13 Likes

Thanks for the resource!
Would have been very useful for me had this been available a few months ago then I wouldnโ€™t have wasted time making my own rate limiter.

3 Likes

If using this for webhooks, you should be using discordโ€™s provided ratelimits instead.

2 Likes

Yes, the normal MESSAGE_CREATE is five messages.

1 Like

I mean using the returned headers for limiting, having multiple servers spamming messages can get you banned since the limit is not changing across servers with your current method.

1 Like

HttpService:PostAsync() does not return headers, only a type string status.

1 Like

RequestAsync returns headers, you might want to switch over to that.