GuildMemberUpdate's oldMember doesn't have correct roles.
- [email protected]
- Node v16.20.1
I'm trying to run some code only when a specific role is either added or removed. After just starting the bot; the oldMember will always only have 1 role (@ everyone). After this code has been run at least once (I assumed) the member will be cached and it can correctly determine the oldMember's roles.
20 Replies
- What's your exact discord.js
npm list discord.js
and node node -v
version?
- Post the full error stack trace, not just the top part!
- Show your code!
- Explain what exactly your issue is.
- Not a discord.js issue? Check out #useful-servers.
- Issue solved? Press the button!this is the console output using
._roles
. I know I'm not supposed to use that its just to have a screenshot-sized output hahaUnknown User•17mo ago
Message Not Public
Sign In & Join Server To View
How would you suggest that I cache all the guild members on the server? Should I do that in my on(Events.ClientReady), or is there another smart way to do that?
The server has several thousand people in it so would this be efficient?
Unknown User•17mo ago
Message Not Public
Sign In & Join Server To View
Perfect! How many members do you think the bot would have to oversee for this strategy to not work anymore?
its currently at ~7000
Unknown User•17mo ago
Message Not Public
Sign In & Join Server To View
I understand that but the strategy of caching every user when the bot starts might become too cumbersome
Unknown User•17mo ago
Message Not Public
Sign In & Join Server To View
could you just sanity check this solution and I'll mark it as resolved
Unknown User•17mo ago
Message Not Public
Sign In & Join Server To View
that would cache all guild information (including members) for all guilds the bot is a member of, as opposed to what I did which will cache specifically only members in that specific guild?
Unknown User•17mo ago
Message Not Public
Sign In & Join Server To View
yeah that's what im saying. I'm asking if your example will cache all guilds the bot is in
and not just members in the specific guild like my example
Unknown User•17mo ago
Message Not Public
Sign In & Join Server To View
I'm just trying to work out the specific difference between
which I think was your other example
Unknown User•17mo ago
Message Not Public
Sign In & Join Server To View
ooooooh I think i see what you mean
so there's no like real difference between the two
Unknown User•17mo ago
Message Not Public
Sign In & Join Server To View
alright perfect thanks a lot