Queue to prevent rate limit, but sometimes unreliable. Are there any alternatives or improvements?
Hello, I have written a bot that should make it possible to react to a message with embed for a certain time event and the first 10 are entered in the list and later assigned to a role. This kind of bot also works and I never had problems with it, except now because it can be that too many people react at the same time or one after the other and it comes to a rate limit, this problem has already been solved as well as possible with the queue but it doesn't seem very reliable to me but I get told by people that there are often more than 10 people in this list and I have no idea how to fix it, I'm not very familiar with queues and I'm not the best developer, do any of you have any ideas on how to fix this maybe a different way than the queue or some suggestions on how to improve my code would be greatly appreciated.
I have added comments to make it easier to explain.
Here is the code for adding people and if anyone wants to remove themselves:
- https://hastebin.com/share/ajutuconuy.javascript
* https://hastebin.com/share/uradumimef.javascript
Thanks in advance.
3 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!
- ✅
Marked as resolved by OPnormally you shouldn't need to handle any ratelimits, as djs itself queues requests until the ratelimit is over
So the Queue is useless? But without them when many people react i got a rate limit for "Too many requests" or can this happen because of a other step in my code