Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

242
Views
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 answers
Answer question

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!