Any better ways to get ALL guild members that have a specific server role?
Small question for those that know, is there any better way to get all guild members that have a specific guild role that doesn't require me to fetch and cache every single guild member in the server before grabbing them from the djs cache? I ask cause the bot I'm writing is stuck pulling over 10,000+ guild members just trying to figure out what members have specific roles, and it seems very wasteful / abusive if I have to download all this data at once from the API when all I'm trying to get is like, 25 members from the 10,000+ pool.
8 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 OP<Role>.members relies on cache so you will have to fetch
is role.members the only way?
additionally you can fetch and pass cache: false, should just return a collection which you can filter through
Fetch on which manager?
GuildMemberManager
I mean, this still seems like I'll have to download all members then filter, so sounds like theres no other way around it for the moment
There unfortunately is not.