unable to access cache for member.roles
for some reason the if(!member.roles.cache.find('')) is coming back as undefined. What did I do wrong?
6 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!given that
<Collection>.find()
accepts a test function, not a boolean, it's likely that code isn't even executing
furthermore <ReactionUserManager>.fetch()
would resolve with a collection of User
s, not GuildMember
s, so you'll have trouble accessing their roles from thereoooh okay. I'll take a look into it for myself and come back if I still can't figure it out. Thank you for the hint!
get or has would be the better methods to use
Unknown User•13mo ago
Message Not Public
Sign In & Join Server To View
thank you for all the suggestions 🙂
I'm still struggling a little bit with this one.
so, I tried .get() and .has() but it looks like neither of them are a function of the collection that gets created when I fetch() the server members.
I thought I might be able to match them by id to the user, but that's also failing
I was reading up on it and it looks like fetching over 100 guild members will leave the fetch command hanging.
I'm still not super familiar with data structures since I'm home taught. Is there a way I could fetch half the members in the collection and then fetch the other half so that I don't hit a timeout during the fetch()?
NVM I figured it out. I just made something really scuffed but it works x'D