Trying to get member/roles without being rate limited
I have a bot that is in ~20k servers and it does some work to role-gate certain features in our application based on server membership & roles. Recently we've had a bit of an explosion of users and we are having some major issues with being cloudflare/IP rate limited when trying to do this behavior.
So a couple of q's
1) Is there any way to know if we've been IP rate limited with discord.js? Currently the server just hangs and does nothing when this happens. I could only tell that's what's happening when I restart and get a 429 error when the shards are initializing.
2) Is there any way to cache ALL of the membership data for ALL of the servers we're in, so we don't have to frequently request user membership data from the server? I am using
We do store & cache results in our DB, and use the bot events to try and keep that cache fresh but we still frequently need to check the server.
I feel like there's something I'm missing here, and I'm not dying to refactor things to do rest calls and rotate proxies (I had assumed the normal websocket client would be better than rest calls because of the data caching)... Also wtf I can't even log into discord.com when I get my local IP limited
Any help is greatly appreciated.
So a couple of q's
1) Is there any way to know if we've been IP rate limited with discord.js? Currently the server just hangs and does nothing when this happens. I could only tell that's what's happening when I restart and get a 429 error when the shards are initializing.
2) Is there any way to cache ALL of the membership data for ALL of the servers we're in, so we don't have to frequently request user membership data from the server? I am using
makeCache: Options.cacheEverything() but that doesn't seem to do the trick. It would be awesome to just cache all that data in memory and let the websocket update the cache instead of having to fetch it constantly...We do store & cache results in our DB, and use the bot events to try and keep that cache fresh but we still frequently need to check the server.
I feel like there's something I'm missing here, and I'm not dying to refactor things to do rest calls and rotate proxies (I had assumed the normal websocket client would be better than rest calls because of the data caching)... Also wtf I can't even log into discord.com when I get my local IP limited
Any help is greatly appreciated.
discord.js@14.15.3node@20.9.0