Rate Limit Question
Hey, I have a question about the rate limit. I was told that discord.js itself already handles rate limits and that you don't have to do that as a bot creator. Is that true? And also for larger bots?
In addition, there are rest events, once the Response and once the RateLimited? If I get a 429 for one of them, is it always a 429 from Discord or can it also be a 429 that Discord.js has intercepted?
5 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!djs does handle ratelimits for you yes, this should also work for larger bots. And djs is just an api wrapper, it just returns what the api returns
This means that if RESTEvents.Response returns a 429, do I also have this in Discord?
Ah okay, is there a way to intercept something like that?
I get a rate limit for a route like PATCH /channels/324/messages/1234 and when I request the route the next time, the same thing comes back with a rate limit. I thought that if a rate limit comes back on one route, discord.js will not send it to discord the next time, but since a rate limit keeps coming back, discord.js will probably send it to discord again and again. I want to prevent that I get a rate limit for a route several times in a short time.
I always log in when a rate limit appears for Rest Event in Response. I then looked at the route and it was the same. Since it was after a few seconds I knew that it must be the same rate limit.
this is for example logs which come from the rest event response.

yes, can also be seen in the screenshot
Here is the complete log, which we save
ah okay, unfortunately there is nothing we can do about it, so we wouldn't needlessly request the discord api in such situations
yes if you press this button
that's what i thought discord.js was doing. but if that's not the case, i would make it
ah i'll do the update when you get the role. maybe it's because too many people have gotten the role.