Cannot read properties of null

Hi, I am experiencing the following problem when I want to get the status of a server member. Why is it always null?
Shard error: TypeError: Cannot read properties of null (reading 'status')
at F:\Projects Source Code\FraOroBot\src\commands\setup\staffonlinestats.js:13:129
[.....]
Shard error: TypeError: Cannot read properties of null (reading 'status')
at F:\Projects Source Code\FraOroBot\src\commands\setup\staffonlinestats.js:13:129
[.....]
8 Replies
d.js toolkit
d.js toolkit5mo ago
- 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! - Marked as resolved by OP
FraOro
FraOro5mo ago
const onlineStaff = interaction.guild.members.cache.filter(member => member.presence.status !== 'offline')
treble/luna
treble/luna5mo ago
Not all members have a presence Use nullish coalescing
FraOro
FraOro5mo ago
but in the server we are me and some bots, all in "online"
treble/luna
treble/luna5mo ago
and do you have tje GuildPresences intent
FraOro
FraOro5mo ago
what? 😅
treble/luna
treble/luna5mo ago
you need the intent
FraOro
FraOro5mo ago
thanks you