Reputation: 13
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?
Upvotes: 0
Views: 79
Reputation: 681
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.
Upvotes: 3