Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

179
Visualizações
My server info command is showing 1 human and 1 bot, I have 10 bots and 3 users

I have 10 humans and 3 user in my discord server but my bot shows only 2 total members, 1 human and 1 bot. Can someone help me fix it so that it shows the whole number of members in the server? This is the code -

Total -

.addField('Total Members', `${interaction.guild.members.cache.size}`, true)

Humans -

.addField('Human Users', `${interaction.guild.members.cache.filter(members => !members.user.bot).size}`, true)

Bots -

.addField('Bots', `${interaction.guild.members.cache.filter(members => members.user.bot).size}`, true)

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

There are multiple ways to solve this issue

#1: Do you have intents?

const client = new Discord.Client({ intents: ['GUILDS', 'GUILD_MEMBERS'] })

#2: Have you tried fetching all the members in the guild before showing? Discord.js uses something called "cache", where the package stores something in it's database, and you can do whatever you want with it later on without making a new API request to Discord everytime you want to do something (for example, getting a channel's name). Discord.js tries to cache everything it can while it can. If they are not in your cache, then you can fetch it, and add it to the cache manually.

See GuildMemberManager#fetch

about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda