#Get status of user

17 messages · Page 1 of 1 (latest)

fallen bramble
#

I have a variable called 'person' which gets a user as an option. I want to get the status of the user in 'online', 'idle',etc.

jaunty spruce
#

• 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.

fallen bramble
#

This is what I'm trying: person.presence.status
Error: TypeError: Cannot read properties of undefined (reading 'status')

fringe saffron
#

how is person defined?

fallen bramble
#

.addUserOption(option => option.setName('user').setDescription('Provides information about the user.'))
const person = interaction.options.getUser('user');

fringe saffron
#

users don't have presences, members do
consider using ...getMember('user')

fringe saffron
#

does it produce the same error, or is it now reading properties of null?

fallen bramble
#

Yeah

#

Reading properties of null

fringe saffron
#

then the member is simply offline (or you don't have the proper intents)

fallen bramble
#

which intents do i need

fringe saffron
#

you will need the GuildPresences intent

fallen bramble
#

it worked

#

tysm!

fringe saffron
#

👍