fix: fixed removed functions
All checks were successful
Build Gradle project / build-gradle-project (push) Successful in 4m16s

Signed-off-by: moonleay <contact@moonleay.net>
This commit is contained in:
moonleay 2023-09-17 12:59:54 +02:00
parent d2af0fce94
commit e9fac0d687

View file

@ -95,7 +95,7 @@ object AvailabilityManager : IFeature {
val weekday = ZonedDateTime.now().dayOfWeek // The current week day val weekday = ZonedDateTime.now().dayOfWeek // The current week day
val weekStamp = TimeUtil.getWeekStamp().toEpochSecond() * 1000 // The current week time stamp val weekStamp = TimeUtil.getWeekStamp().toEpochSecond() * 1000 // The current week time stamp
Logger.out("It is week ${weekStamp} and day ${weekday}/${TimeUtil.getDayOfMonthInt(weekday)} of the week.") Logger.out("It is week ${weekStamp} and day ${weekday}/${TimeUtil.getDayOfMonthInt(weekday)} of the week.")
val g = Bot.bot.kordRef.getGuildOrThrow(Snowflake(tpmd.serverID)) val g = Bot.bot.kordRef.getGuild(Snowflake(tpmd.serverID))
// Get all members with the role // Get all members with the role
val mce = g.requestMembers { val mce = g.requestMembers {
this.requestAllMembers() this.requestAllMembers()
@ -139,7 +139,7 @@ object AvailabilityManager : IFeature {
.getMemberOrNull(Snowflake(tid)) == null .getMemberOrNull(Snowflake(tid)) == null
) )
continue// This member does not exist anymore. continue// This member does not exist anymore.
val member = Bot.bot.kordRef.getGuildOrThrow(Snowflake(tpmd.serverID)) val member = Bot.bot.kordRef.getGuild(Snowflake(tpmd.serverID))
.getMember(Snowflake(tid)) // Get the member .getMember(Snowflake(tid)) // Get the member
if (member.roleIds.contains(Snowflake(pnrd.hasTimeRoleID))) if (member.roleIds.contains(Snowflake(pnrd.hasTimeRoleID)))
continue // This member already has the role continue // This member already has the role
@ -175,13 +175,13 @@ object AvailabilityManager : IFeature {
// Check if the channel and guild already exist in the db // Check if the channel and guild already exist in the db
if (!alreadyExists) { if (!alreadyExists) {
// Create the roles in Discord // Create the roles in Discord
val hasTimeRole = Bot.bot.kordRef.getGuildOrThrow(Snowflake(gID)).createRole { val hasTimeRole = Bot.bot.kordRef.getGuild(Snowflake(gID)).createRole {
this.name = "available [${ch.data.name.value}]" this.name = "available [${ch.data.name.value}]"
this.mentionable = true this.mentionable = true
} }
val htr = hasTimeRole.id.value.toLong() val htr = hasTimeRole.id.value.toLong()
val wantsNotifsRole = Bot.bot.kordRef.getGuildOrThrow(Snowflake(gID)).createRole { val wantsNotifsRole = Bot.bot.kordRef.getGuild(Snowflake(gID)).createRole {
this.name = "notifications [${ch.data.name.value}]" this.name = "notifications [${ch.data.name.value}]"
this.mentionable = true this.mentionable = true
} }
@ -226,9 +226,9 @@ object AvailabilityManager : IFeature {
if (PlanningNotifierRolesRepository.existsInChannelFromSever(cID, gID)) { if (PlanningNotifierRolesRepository.existsInChannelFromSever(cID, gID)) {
val entry = PlanningNotifierRolesRepository.getForChannelInServer(cID, gID)!! val entry = PlanningNotifierRolesRepository.getForChannelInServer(cID, gID)!!
// delete all entries for this guild and channel combo // delete all entries for this guild and channel combo
Bot.bot.kordRef.getGuildOrThrow(Snowflake(gID)) Bot.bot.kordRef.getGuild(Snowflake(gID))
.getRoleOrNull(Snowflake(entry.hasTimeRoleID))?.delete() .getRoleOrNull(Snowflake(entry.hasTimeRoleID))?.delete()
Bot.bot.kordRef.getGuildOrThrow(Snowflake(gID)) Bot.bot.kordRef.getGuild(Snowflake(gID))
.getRoleOrNull(Snowflake(entry.wantsToBeNotifiedID))?.delete() .getRoleOrNull(Snowflake(entry.wantsToBeNotifiedID))?.delete()
// delete all found entries // delete all found entries