//Dont handle users, that are already subscribed to the event. We only want to handle unsubscribed users here
letuserFound=false;
scheduledEventUsers.forEach(collection=>{
collection.each(key=>{
logger.info(JSON.stringify(key,null,2))
if(key.member.user.id===newState.member?.user.id)
userFound=true;
})
})
if(userFound){
logger.info(`Not handling VoiceState event because user was already subscribed and got an account from there. User: ${JSON.stringify(newState.member,null,2)}`)
newState.member.createDM().then(channel=>channel.send(`Hey! Du bist unserer Watchparty beigetreten, ich hab dir gerade die Zugangsdaten für den Mediaserver geschickt!`))
}else{
newState.member.createDM().then(channel=>channel.send(`Hey! Du bist unserer Watchparty beigetreten aber du hast bereits einen Account. Falls du ein neues Passwort brauchst nutze /reset_passwort!`))
}
}else{
logger.error("WTF? Expected Member?? When doing things")
}
}else{
logger.info("VoiceState channelId was not the id of any channel with events")