feat: Bot now skips Bot Users

Signed-off-by: moonleay <contact@moonleay.net>
This commit is contained in:
moonleay 2023-09-14 09:41:27 +02:00
parent 3d1f2c7d8f
commit 8a77b275dc

View file

@ -18,6 +18,7 @@
package net.moonleay.lilJudd.features
import com.kotlindiscord.kord.extensions.utils.isNullOrBot
import dev.inmo.krontab.buildSchedule
import dev.inmo.krontab.doInfinity
import dev.kord.common.Color
@ -162,11 +163,14 @@ object AvailabilityManager : IFeature {
}
mce.collect { memberchunkevent ->
memberchunkevent.members.forEach {
Logger.out("Checking member ${it.id.value} (${it.username})")
if (it.roleIds.contains(Snowflake(pnrd.hastimeroleid))) {
it.removeRole(Snowflake(pnrd.hastimeroleid))
Logger.out("Removed role from ${it.username}") // Removed the role
if (!it.isNullOrBot()) { // Check if the member is a bot
Logger.out("Checking member ${it.id.value} (${it.username})")
if (it.roleIds.contains(Snowflake(pnrd.hastimeroleid))) {
it.removeRole(Snowflake(pnrd.hastimeroleid))
Logger.out("Removed role from ${it.username}") // Removed the role
}
}
// I cant use continue here, because it does not work with .forEach
}
}