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

Closed
TheNoob27 opened this issue Aug 11, 2023 · 0 comments · Fixed by #10099
Closed

Custom REST rate limit offsets for specific routes #9762

TheNoob27 opened this issue Aug 11, 2023 · 0 comments · Fixed by #10099

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

@didinele didinele self-assigned this Jan 22, 2024
@kodiakhq kodiakhq bot closed this as completed in #10099 Jan 30, 2024
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jan 29, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants