Fetch membercount?

const theGuild = await botclient.guilds.fetch(channels[i].server, { force: false, allowUnknownGuild: true }).catch(() => null)
console.log(theGuild.memberCount)
const theGuild = await botclient.guilds.fetch(channels[i].server, { force: false, allowUnknownGuild: true }).catch(() => null)
console.log(theGuild.memberCount)
This returns undefined most of the time, the rest of the time it gives the membercount, any ideas why? Guessing when it's not loaded in the shard... But then how do I load it? .approximateMemberCount is the same.
Solution:
Oh. Its needed to be forced for whatever reason
Jump to solution
4 Replies
Solution
bomi
bomi2y ago
Oh. Its needed to be forced for whatever reason
Alexandre
Alexandre2y ago
Forced? Did you have a code?
bomi
bomi2y ago
Sorry for the late reply but yeah. In my code above where I have it set to force: false, it needs to be set to true to recieve membercount information
Alexandre
Alexandre2y ago
Oh okey Thxxx