DiscordJS Member Counter Weird Appearance

Viewed 26

So I have added member count to the bot but I discovered something a bit strange. If I use guild.memberCount I get the same result as the counter on the server settings page. But if I use guild.members.cache.size I get a different result number.

Example guild.memberCount says 1335 (Same as Server Settings Page) guild.members.cache.size says 1332

Is there a reason why it keeps removing 3? W do not use bot user filters. Just a total count.

1 Answers

Not all members will be in the cache. Generally, they only become cached once they send a message, at which point they're stored temporarily in memory.

guild.memberCount, on the other hand, is the member count directly received from Discord's API.

Related