Sorry if it was worded badly, but im having an issue of, Im trying to calculate the amount of users in my db (adding them up per value), and after fetching the users with a forEach(), Im doing a wait(10000) [10 seconds], and it seems to be just not waiting.
let totalmembers = 0
function wait(ms) {
var start = new Date().getTime();
var end = start;
while (end < start + ms) {
end = new Date().getTime();
}
}
client.diskey.forEach(async m => {
if(client.group.get(m) === null) return message.channel.send("not linked")
console.log("finished waiting")
await axios.get("https://groups.roblox.com/v1/groups/" + Number(client.group.get(m))).then(async gc => {
await message.channel.send((gc.data.name + " : " + gc.data.memberCount + " : "))
totalmembers = totalmembers + gc.data.memberCount
console.log(totalmembers)
wait(10000)
console.log("waiting")
await message.channel.send(totalmembers)
})
})
}
Any help appreciated.