#any reasons interaction.guild.members.cache.get(client.user.id) is returning undefined and interacti
1 messages · Page 1 of 1 (latest)
You should use get only when you're sure the object is in the cache
fetch should be better
No
Usually fetch is better, but the client member should always be in cache.
*Unless you're using some special caching options
someone told this in discord developers
the guilds intent affects if djs gets the guild member in the cache
you'd be hardpressed to check the permissions of a member that isn't in the cache
either way like half of djs relies on the guilds intent, i'd highly recommend using it
unless you have a really specific reason not too, in which case you can just fetch and hope for the best /shrug
so I need guild member permissions
If you give me an example where get is better, I'll be very happy...
guild.members.cache.get(client.user.id)
assuming you have the guilds intent ^
It WILL NOT find the member all the time
Also, just because you interacted with that member, doesn't mean it still resides in the cache
It actually should, unless you're sharding and something went really wrong, or you have some special caching conditions that sweeps your guild member out
Most do not
Just use guild.me in that case
Does this not do the same thing?
I'm using an economy bot for which I assume that I won't get any intents whitelisted for such usecase
These special caching conditions happens all the time, even without specifying them. Imagine holding in the cache 100.000+ members..
thats why I did not enable guild intents
no
so you recommend me to remove the permission check?
I don't believe you know how intents work?
tbh I dont