Is it best to stay away from batch functionality?
I have a use case where I have a website interface for my bot. I can track users, edit them, accept applicants through the site (from which the form is submitted to a discord channel in embeded form), and so on and so forth. I also have the ability to remove applicants (which should also effectively remove the users application as well, but I haven't implemented this yet).
My question is when I have a scenario where I might want to approve multiple applicants from the web interface and have that reflected on discord (thus I'd have to update multiple discord messages linked to said applicants), or reject/remove, what's the best way to handle this or should I avoid it altogether and simply handle it on an individual by individual bases (which isn't the best user experience having to doing it one at a time on the web site),
I know discord js handles rate limiting, but I'm curious how that would apply in this scenario. Keep in mind I might have multiple people handling applicants on the web site end, so that's multiple requests to discord from different vectors.
4 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!as long as it all goes through the same rest instance/rate limit handler and it respects the limits with appropriate back offs the only thing that can happen is that it takes some time to complete
message edits and sends have a shared rate limit of roughly (reminder: rate limits are dynamic and should not be hardcoded) of 5 per 5 seconds (channel scoped)
one of the things you should not be doing, even within rate limits is DMing members (especially if they did not initiate an action to receive such DMs) en mass
so that's multiple requests to discord from different vectors.you should still have all of that interface with the same bot api/rest instance so it all goes through the same rate limit handling if you start making multiple clients/rest instances that can simultaneously call endpoints that might be more of an issue
What's a good example of an appropriate back off?
and thanks
as you said yourself, discord.js handles rate limits for you
backoffs are determined by the ratelimit headers the api sends back in responses