fix: fixed AvailabilityManager

Signed-off-by: moonleay <contact@moonleay.net>
This commit is contained in:
moonleay 2023-09-06 22:05:29 +02:00
parent 925398db65
commit d10f8901c9

View file

@ -96,8 +96,8 @@ object AvailabilityManager : IFeature {
}
val roleData = roleMap[data.channelid] // Get the role data
if (roleData == null) {
Logger.out("Role for this channel does not exist")
return
Logger.out("Role for channel ${data.channelid} does not exist")
continue // this took way to long to find out that this was the issue
}
val g = Bot.bot.kordRef.getGuildOrThrow(Snowflake(data.serverid))
// Get all members with the role
@ -106,9 +106,11 @@ object AvailabilityManager : IFeature {
}
mce.collect { memberchunkevent ->
memberchunkevent.members.forEach {
Logger.out("Checking member ${it.id.value}")
if (it.roleIds.contains(Snowflake(roleData.hastimeroleid)))
Logger.out("Checking member ${it.id.value} (${it.username})")
if (it.roleIds.contains(Snowflake(roleData.hastimeroleid))) {
it.removeRole(Snowflake(roleData.hastimeroleid))
Logger.out("Removed role from ${it.username}") // Removed the role
}
}
}