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
d.js toolkit
d.js toolkit8mo 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!
Unknown User
Unknown User8mo ago
Message Not Public
Sign In & Join Server To View
Apokalypt
ApokalyptOP8mo ago
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
Unknown User8mo ago
Message Not Public
Sign In & Join Server To View
Apokalypt
ApokalyptOP8mo ago
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:
kimbletee
kimbletee7mo ago
"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. 😅
Apokalypt
ApokalyptOP7mo ago
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 💪
Want results from more Discord servers?
Add your server