#any reasons interaction.guild.members.cache.get(client.user.id) is returning undefined and interacti

1 messages · Page 1 of 1 (latest)

azure citrus
#

You should use get only when you're sure the object is in the cache

#

fetch should be better

pastel wasp
#

Usually fetch is better, but the client member should always be in cache.

#

*Unless you're using some special caching options

tardy scroll
#

someone told this in discord developers

pastel wasp
#

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

tardy scroll
#

so I need guild member permissions

azure citrus
pastel wasp
#

assuming you have the guilds intent ^

azure citrus
#

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

pastel wasp
#

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

coral dagger
pastel wasp
tardy scroll
#

I'm using an economy bot for which I assume that I won't get any intents whitelisted for such usecase

azure citrus
#

These special caching conditions happens all the time, even without specifying them. Imagine holding in the cache 100.000+ members..

tardy scroll
pastel wasp
tardy scroll
#

so you recommend me to remove the permission check?

pastel wasp
tardy scroll
#

tbh I dont

pastel wasp
#

There are 2, soon to be 3, privileged intents. GUILD_MEMBERS the presence one, and soon the message content one.

#

every other intent, for now, you can just use at your discretion

#

I highly doubt we'll see GUILDS become one of those