Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

327
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda