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

248
Vistas
Why is this not executed in the forEach method?
client.on('guildMemberAdd', async (member) => {
    const joinRoles = db.getRoles(member.guildId);

    joinRoles.data.forEach(element => {
        console.log(element.role + "meee1")
    });

    console.log("meee2")
})

So, to the question, why is this not executed in the forEach method?

Once a user joins the guild nothing is done except meee2 is shown, meee1 is not shown for whatever reason. Why? What am I doing wrong?

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

It seems like you're dealing with an empty array (assuming you don't get any errors in the console) and considering that almost all DB's have some sort of latency and even your function is marked as async I'd assume that you might have to use await in front of db.getRoles() call. I also assume that getRoles is returning a promise and you could try and debug to see what is happening while you're adding a new guild member.

PS. I'd comment but not enough respect points yet.

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