Best way to check for mutual servers with a user?
I want to know if a user has any mutual servers with the bot, I don't care about how many just whether there are any or not.
I have two ideas but really don't like them:
- Maintain a cache of all guild members and check the cache.
- Fetch the user from every guild and check for a 10007 (unknown member) error.
The only use for a guild member cache would be checking for mutual servers so it's hard to justify all of that memory usage, and doing so also requires a new privileged intent that I don't otherwise need. And fetching will either spam the API until I get IP banned or take unreasonably long to go through every guild one-by-one, I see no way to check every guild individually in a reasonable way.
Is there really no better way to do this?
2 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 OPnevermind issue is moot