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 toolkit11mo 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
FraOroOP11mo ago
const onlineStaff = interaction.guild.members.cache.filter(member => member.presence.status !== 'offline')
treble/luna
treble/luna11mo ago
Not all members have a presence Use nullish coalescing
FraOro
FraOroOP11mo ago
but in the server we are me and some bots, all in "online"
treble/luna
treble/luna11mo ago
and do you have tje GuildPresences intent
FraOro
FraOroOP11mo ago
what? 😅
treble/luna
treble/luna11mo ago
you need the intent
FraOro
FraOroOP11mo ago
thanks you
Want results from more Discord servers?
Add your server