User object roles
If a user uses a slash command, is there a guarantee the member object I receive in the handler would be the latest update of that member? I had assumed that would be the case but I'm having behaviour that would suggest the member object I receive does not have the latest up to date information on what roles the user has.
6 Replies
member.fetch(true) will re-fetch the member from the discord api and bypass the cache
Yes, Discord sends up-to-date data, and Discord.js handles it using
users._add
and members._add
, which cache by default.And would this happen before a precondition is processed by sapphire? Specifically the problem I'm having is that I have a precondition that checks if a role id is in the roles.cache of the member object passed in the precondition handler. People are reporting that it's been randomly working and randomly not working which leads me to believe that something is not up to date
Before the event is even emitted on Discord.js's side, way before Sapphire can even handle it.
I see
I will have to do some deeper investigating
Thanks for answering btw
Solution
Turned out to be user error lol