#how to stop discord.js from enqueuing requests when a rate limit is hit (for emoji creation)

18 messages · Page 1 of 1 (latest)

gloomy roverBOT
#

• What's your exact discord.js npm list discord.js and node node -v version?
• Post the full error stack trace, not just the top part!
• Show your code!
• Explain what exactly your issue is.
• Not a discord.js issue? Check out #useful-servers.

clever zenith
#

you can listen to the ratelimited event <Client>.rest.on('rateLimited', rate => { ...

#

iirc an error isn't shown until you quite literally spam the api

#

by listening to the rateLimited event to see when your bot receives a rate limit

#

you can avoid a rate limit by not making requests so often such as implementing a cooldown

#

there aren't any methods to avoid a rate limit because you can't forcibly ignore them when you're going over the limit

#

implementing a cooldown is an idea you could consider

#

how large is your bot? server wise

#

you're obviously adding a ton of emojis over a short time to receive a rate limit like that.
listen to that event to see if you're actually being rate limited

#

have you tried listening to the rateLimited event?

quartz torrent
#

The promise doesnt fail on ratelimit, since djs queues the request til after the ratelimit runs out, so you will never catch a ratelimit by using .catch

#

The event is your only hope, but even then the request is still queued

clever zenith
#

clear your cache, that's the old webpage

#

the docs for djs only still use the old website

#

new website is for the other packages, but it's not that hard to read if im being honest

#

thanks for the feedback