Find what role was added/removed with guildMemberUpdate
Hi, I am trying to detect when a role is removed from a user. I currently have the following code:
I thought it would work, and in theory it does, however it doesn't work when the member's roles aren't in the cache (which is quite possible in my use case) so I was wondering if there's any way to detect what role has been removed given that the
old's roles may not be cached. Thanks!4 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!
Popular Topics: Miscellaneous - How do I check which role was added/removed and for which member?
read more
Collection#difference()
The difference method returns a new structure containing items where the key is present in one of the original structures but not the other.ah
Checking the audit logs for modified roles is the only way I would think would work.