#client.users.cache.size

41 messages · Page 1 of 1 (latest)

dense coral
#

• 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.

shrewd sluiceBOT
#

Getting your bot's member count
client.users.cache.size is unreliable because it will only return cached users
• The preferred method is using collection.reduce() on client.guilds.cache

client.guilds.cache.reduce((acc, guild) => acc + guild.memberCount, 0)
dense coral
timber scarab
#

to get the online presence of members, you need the GUILD_PRESENCES / GuildPresences intent and checking <GuildMember>.presence.status

#

otherwise, that picture isn't really showing me what the problem is

#

if you want to get the total member count in a server, that would be <Guild>.memberCount

dense coral
#

before documentation

timber scarab
#

documentation of what

dense coral
#

message content and server members intent

timber scarab
#

what does that have to do with the member count

dense coral
#

But now nothing comes about the number of people

timber scarab
#

you're not giving a lot of context here

#

number of people for the server? bot's member count?

dense coral
#

yes

timber scarab
#

which one

dense coral
#

2

dense coral
#

look

#

i have two problems

timber scarab
#

you dont need the guild members intent to get your bot's total member count

dense coral
#

The number of online members and the number of bot users of guilds

#

before documentation As if they are working normally, after documenting, the problem appeared. I just want to do it or not

timber scarab
#

and i sent the tag for the bot's member count as well

#

i dont know what else the problem is

#

you also won't be granted the presence intent if you are just going to be displaying online members

dense coral
#

How do I authenticate this Intente What is required

timber scarab
#

i already told you what intents you need

#

you dont need the presence intent to only display online users

#

as that is not considered valid when applying

#

is your bot verified?

dense coral
#

yes

timber scarab
#

okay so then you can choose to apply for the presence intent, but like i said before, you won't be given the intent just to show the total users that are online. that is for your personal liking, which is not what the intent is meant to use used for. you use intents with valid reasons of needing them

dense coral
#

How do I show it?

timber scarab
#

show what

timber scarab
#

by putting that in your code and displaying it on discord such as sending it in a message, embed, etc.

#

seems like you already show a number of members, so i dont really know what the issue is with updating code

dense coral
#

ok

#

thank u

timber scarab
#

hope that clears things up for you. if you have more intent related questions, ask in the discord-developers server