Confusion about guild memberCount
Hello, I use guild.memberCount on a regular basis and it worked just fine for a long time now. However, it stopped working for some use cases, for example when fetching a guild manually using
client.guilds.fetch()
. I took a look at the code behind guild.memberCount and discovered that it seems to be using guild.member_count
from the Discord API but I could not find member_count
as valid parameter of a guild in the Discord API docs. Is this a mistake or am I just missing something?5 Replies
- 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!
- ✅
Marked as resolved by OPIt is provided in the guild create event, which (with the guilds intent) runs upon bot login and when the bot is added to a guild
Discord Developer Portal
Discord Developer Portal — API Docs for Bots and Developers
Integrate your service with Discord — whether it's a bot or a game or whatever your wildest imagination can come up with.
D.js also updates it with the guildMemberAdd/Remove event
My moderators can ban certain Discord servers violating ToS from using my bot. They just need the ID of the server and for that, I manually fetch it
Thanks!