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
d.js toolkit
d.js toolkit10mo ago
- 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!
treble/luna
treble/luna10mo ago
ratelimits are dynamic djs just queus requests if you hit that limit
mze9412
mze9412OP10mo ago
I know they are I want to avoid queuing requests and handle that in my code
treble/luna
treble/luna10mo ago
they are dynamic Meaning they change at any time There's no constant
mze9412
mze9412OP10mo ago
If I understand this correctly it would throw an exception instead of queuing, correct?
Almeida
Almeida10mo ago
the promise would reject
mze9412
mze9412OP10mo ago
Great! This would be exactly what I need, I think 👍 thank you
kimbletee
kimbletee7mo ago
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!
mze9412
mze9412OP6mo ago
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
Want results from more Discord servers?
Add your server