Cannot catch the correct offline members

So I tried to add this command as the same on Discord.js Guide:
// First use guild.members.fetch to make sure all members are cached
guild.members.fetch({ withPresences: true }).then(fetchedMembers => {
const totalOffline = fetchedMembers.filter(member => member.presence?.status === 'offline');
// Now you have a collection with all online member objects in the totalOnline variable
console.log(`There are currently ${totalOffline.size} members online in this guild!`);
});
// First use guild.members.fetch to make sure all members are cached
guild.members.fetch({ withPresences: true }).then(fetchedMembers => {
const totalOffline = fetchedMembers.filter(member => member.presence?.status === 'offline');
// Now you have a collection with all online member objects in the totalOnline variable
console.log(`There are currently ${totalOffline.size} members online in this guild!`);
});
https://discord.js.org/#/docs/discord.js/main/typedef/PresenceStatus https://discordjs.guide/popular-topics/faq.html#how-do-i-find-all-online-members-of-a-guild However, both online, idle and dnd are correct, except offline status. - I add my bot in the test server where I stored a lot of offline bots and my alt account, but the console still log 0 offline members. All intents are carefully checked. May I ask why I cannot have a correct offline stats?
2 Replies
d.js docs
d.js docs3y ago
• 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.
harshfeudal
harshfeudalOP3y ago
so i am unable to get offline members number? okayyy
Want results from more Discord servers?
Add your server