Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Custom REST rate limit offsets for specific routes #9762

Open
TheNoob27 opened this issue Aug 11, 2023 · 0 comments
Open

Custom REST rate limit offsets for specific routes #9762

TheNoob27 opened this issue Aug 11, 2023 · 0 comments

Comments

@TheNoob27
Copy link

Which application or package is this feature request for?

rest

Feature

To help prevent ratelimits and be more safe, discord.js gives you the option to set a ratelimit offset for all routes. But, some routes are heavily used by some bots, perhaps more than other routes, so providing a one size fits all may not be ideal all the time.

For example what if you have a reactions heavy bot, that adds reactions very often, and you want to be more cautious of the frequent reactions your bot is adding and want to avoid 429s, but you don't want it to make other actions slower than preferred, like editing messages.

Ideal solution or implementation

Perhaps the rateLimitOffset option in the client options could optionally be a function, similar to rejectOnRatelimit. This could take in the route, or extra data, whichever works best, and return the number the offset should be in this context.

Alternative solutions or implementations

The alternative is to implement your own external rate limiting, but that can become messy or repetitive depending on the bot.

Other context

No response

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant