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

322
Visualizações
TypeError: Cannot read property 'members' of undefined in discord.js \\\
const guild = client.guilds.cache.get("771238821550620703");
   setInterval(function () {
      var memberCount = guild.members.filter(member => !member.user.bot).size;  
      var memberCountChannel = client.channels.get("886555053421375501");
      memberCountChannel.setName(`╭・🍸:Online :${memberCount}`);
   }, 10000);

TypeError: Cannot read property 'members' of undefined

I have checked the channel id and server id hundred times but it is still not working..

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

0

  1. client.channels.get(...) is not a function. The correct method would be client.channels.cache.get(...).
  2. You should always fetch the guild instead of searching the cache, especially as more guilds get added.

Example:

(async () => {
    const guild = await client.guilds.fetch("771238821550620703");
    setInterval(function () {
        var memberCount = guild.members.filter(member => !member.user.bot).size;
        var memberCountChannel = guild.channels.get("886555053421375501");
        memberCountChannel.setName(`╭・🍸:Online :${memberCount}`);
    }, 10000);
});
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