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

244
Visualizações
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 Respostas
Responde à pergunta

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