Guild .memberCount vs .approximateMemberCount?

What is the difference between a guild's memberCount and approx MC? I don't see a memberCount in the actual API-provided Guild, and additionally the approximate count is for some reason null? I have the Guilds & GuildMembers intents enabled which I presume are the needed ones.
2 Replies
d.js toolkit
d.js toolkitā€¢10mo 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!
log(n)
log(n)ā€¢10mo ago
ā””ā”€ mw-analytics@workspace:.
ā””ā”€ discord.js@npm:14.14.1 (via npm:^14.14.1)
ā””ā”€ mw-analytics@workspace:.
ā””ā”€ discord.js@npm:14.14.1 (via npm:^14.14.1)
Node 18.17.0
this.container.metricsManager.writePoint(
new Point("member-count").intField("members", client.guilds.cache.get(env.MAIN_GUILD_ID)!.approximateMemberCount)
);
this.container.metricsManager.writePoint(
new Point("member-count").intField("members", client.guilds.cache.get(env.MAIN_GUILD_ID)!.approximateMemberCount)
);
The error is the Influx client showing me that the guild's .approximateMemberCount is null (ping for replies please) Should I be using .membercount or .approximatemembercount? I'm still getting nulls, I enabled GuildPresences as well
const guild = await client.guilds.fetch({ guild: env.MAIN_GUILD_ID, withCounts: true });

this.container.metricsManager.writePoint(
new Point("member-count")
.intField("members", guild.approximateMemberCount)
.intField("onlineMembers", guild.approximatePresenceCount)
);
const guild = await client.guilds.fetch({ guild: env.MAIN_GUILD_ID, withCounts: true });

this.container.metricsManager.writePoint(
new Point("member-count")
.intField("members", guild.approximateMemberCount)
.intField("onlineMembers", guild.approximatePresenceCount)
);
.memberCount exists though Thinkeng I misunderstood what you said. What about for getting members per presence? Do I fetch the full member list?? Technically in some guilds don't you only get members in VCs if they're over the large guild threshold? We don't have 75k and its a single-server bot so no issue
Want results from more Discord servers?
Add your server