fix: fixed removed functions

Signed-off-by: moonleay <contact@moonleay.net>
This commit is contained in:
moonleay 2023-09-17 12:59:54 +02:00
parent 9072109b34
commit 344751b9de
Signed by: moonleay
GPG key ID: 82667543CCD715FB

View file

@ -95,7 +95,7 @@ object AvailabilityManager : IFeature {
val weekday = ZonedDateTime.now().dayOfWeek // The current week day
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.")
val g = Bot.bot.kordRef.getGuildOrThrow(Snowflake(tpmd.serverID))
val g = Bot.bot.kordRef.getGuild(Snowflake(tpmd.serverID))
// Get all members with the role
val mce = g.requestMembers {
this.requestAllMembers()
@ -139,7 +139,7 @@ object AvailabilityManager : IFeature {
.getMemberOrNull(Snowflake(tid)) == null
)
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
if (member.roleIds.contains(Snowflake(pnrd.hasTimeRoleID)))
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
if (!alreadyExists) {
// 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.mentionable = true
}
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.mentionable = true
}
@ -226,9 +226,9 @@ object AvailabilityManager : IFeature {
if (PlanningNotifierRolesRepository.existsInChannelFromSever(cID, gID)) {
val entry = PlanningNotifierRolesRepository.getForChannelInServer(cID, gID)!!
// 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()
Bot.bot.kordRef.getGuildOrThrow(Snowflake(gID))
Bot.bot.kordRef.getGuild(Snowflake(gID))
.getRoleOrNull(Snowflake(entry.wantsToBeNotifiedID))?.delete()
// delete all found entries