Is there a way to get rate-limit data about an action (like update thread name) ?
I would like to check if my bot is rate-limited before trying to update the name of a thread. Is there a way to do that ?
7 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!Unknown User•8mo ago
Message Not Public
Sign In & Join Server To View
Oh thx, the answer was fast 😂
I will check the listener you gave me. But there is no function like
<Client>.rest.isRateLimited(...)
?Unknown User•8mo ago
Message Not Public
Sign In & Join Server To View
Indeed, I've seen this solution too. However, it doesn't suit me because it's only in a certain specific case that I wanted to check before making the API call 😭
But thanks you for your answers guys :WumpsHeartyLove:
"discord.js handles rate limiting for you internally" I'm wondering how it actually does that since how I understand the docs (https://discord.com/developers/docs/topics/rate-limits) is that we should read the response headers and wait before making a new request. Does anyone here know if the REST client waits before returning a result or how does Discord JS prevent us from hitting the limit?
Sorry about that! My first two messages here. 😅
Completely forgot to answer you, sorry 🙏
I hadn't seen the solution in its entirety and had stopped at the fact that an array of urls could be passed... Finally, I was able to use the function to do what I wanted 💪