I just simply wanted to do stats of non bot users, non bot online users, and bot users
Non bot users and bot users work perfectly fine, but non bot online users return to me random numbers
await guild.members.fetch({ withPresences: true }).then(async fetchedMembers => {
const onlineS = await fetchedMembers.filter(member => !member.presence || member.presence?.status !== 'offline' && !member.user.bot);
console.log(onlineS.size)
})
currently im using this to get non bot online users count, but it just returns random numbers and always member.presence is null, that’s how i initialize my client
const client = new Client({
intents: [GatewayIntentBits.Guilds, GatewayIntentBits.GuildMembers, GatewayIntentBits.MessageContent, GatewayIntentBits.GuildMessages, GatewayIntentBits.GuildMessageReactions, GatewayIntentBits.GuildVoiceStates, GatewayIntentBits.GuildPresences ],
partials: [Partials.Message, Partials.Channel, Partials.Reaction, Partials.GuildMember],
allowedMentions: { parse: [ 'roles', 'users' ] }
});
so everything should work just fine, is there some sort of mistake i made?
ps. i have presence intent enabled in discord developer portal