rate limit information
Is there some way to hook into the rate limit information that DJS evalueates so that the application can also handle some rate limit topics itself?
9 Replies
- What's your exact discord.js
npm list discord.js
and node node -v
version?
- Not a discord.js issue? Check out #other-js-ts.
- Consider reading #how-to-get-help to improve your question!
- Explain what exactly your issue is.
- Post the full error stack trace, not just the top part!
- Show your code!
- Issue solved? Press the button!ratelimits are dynamic
djs just queus requests if you hit that limit
I know they are
I want to avoid queuing requests and handle that in my code
they are dynamic
Meaning they change at any time
There's no constant
If I understand this correctly it would throw an exception instead of queuing, correct?
the promise would reject
Great! This would be exactly what I need, I think 👍 thank you
Isn't that too late though? Shouldn't we be reading the headers of each response https://discord.com/developers/docs/topics/rate-limits and wait before making a new request so that we never hit the limit? Is there a way to read the response headers with Discord JS REST client?
But haven’t we then hit the limit already?
I guess in the big picture it's enough for me to know that from a developer's point of view I can safely just make requests with the client and not worry about hitting the rate limits.
Do you know if in theory it could also work with Promise.all() ?
Thanks for patiently clarifying and helping me with this! I appreciate it.
I guess what I’m asking with the promise.all question is that will the client in theory also support making many parallel requests, but looking at my current case, which is querying messages, I don’t think I’ll actually need to do that for the time being.
Excellent! Thank you!
I still managed to hit the limit often enough so I now do my own rate limiting on top of DJS 🙈
I am using it exclusively
but I needed an own queuing system anyway so I integrated rate limit checks and avoidance into it