From 27b721ae1fdfa070da7e669e9a22b4f6dc47de11 Mon Sep 17 00:00:00 2001 From: limited_dev Date: Thu, 15 Jun 2023 08:51:32 +0200 Subject: [PATCH] fix: removed nonexistent feature in feature command, fixed timing on timeplanner. Signed-off-by: limited_dev --- src/main/kotlin/net/moonleay/lilJudd/Bot.kt | 3 ++- .../lilJudd/extensions/FeatureManageExtension.kt | 15 +++++++++------ .../lilJudd/extensions/component/FeatureEnum.kt | 2 +- .../moonleay/lilJudd/features/PlanningNotifier.kt | 2 +- .../net/moonleay/lilJudd/features/TimeManager.kt | 2 +- 5 files changed, 14 insertions(+), 10 deletions(-) diff --git a/src/main/kotlin/net/moonleay/lilJudd/Bot.kt b/src/main/kotlin/net/moonleay/lilJudd/Bot.kt index 66208c7..e0c4a41 100644 --- a/src/main/kotlin/net/moonleay/lilJudd/Bot.kt +++ b/src/main/kotlin/net/moonleay/lilJudd/Bot.kt @@ -53,7 +53,7 @@ object Bot { exitProcess(3) } - // Check if the credentials for the Database are existent + // Check if the credentials for the Database are existent, don't run if they are missing if (CredentialManager.dbDomain == "empty" || CredentialManager.dbName == "empty" || CredentialManager.dbUser == "empty" || CredentialManager.dbPassword == "empty") { Logger.out("The config does not contain the whole Database credentials.") exitProcess(3) @@ -70,6 +70,7 @@ object Bot { // Register the TimePlanner thread val coroutineJob = GlobalScope.launch { TimeManager.registerThread() + //PlanningNotifier.registerThread() } // Add a shutdown hook to cancel the coroutine when the application is terminated diff --git a/src/main/kotlin/net/moonleay/lilJudd/extensions/FeatureManageExtension.kt b/src/main/kotlin/net/moonleay/lilJudd/extensions/FeatureManageExtension.kt index 7384c56..712eb8b 100644 --- a/src/main/kotlin/net/moonleay/lilJudd/extensions/FeatureManageExtension.kt +++ b/src/main/kotlin/net/moonleay/lilJudd/extensions/FeatureManageExtension.kt @@ -27,16 +27,16 @@ import com.kotlindiscord.kord.extensions.types.respond import com.kotlindiscord.kord.extensions.utils.hasPermission import dev.kord.common.Color import dev.kord.common.entity.Permission -import dev.kord.common.entity.Snowflake -import dev.kord.core.behavior.createRole -import net.moonleay.lilJudd.data.tables.PlanningNotifierRoles import net.moonleay.lilJudd.data.tables.TimePlanningChannels import net.moonleay.lilJudd.extensions.component.EnableOrDisable import net.moonleay.lilJudd.extensions.component.FeatureEnum import net.moonleay.lilJudd.util.Logger import net.moonleay.lilJudd.util.MessageUtil -import org.jetbrains.exposed.sql.* import org.jetbrains.exposed.sql.SqlExpressionBuilder.eq +import org.jetbrains.exposed.sql.and +import org.jetbrains.exposed.sql.deleteWhere +import org.jetbrains.exposed.sql.insert +import org.jetbrains.exposed.sql.select import org.jetbrains.exposed.sql.transactions.transaction class FeatureManageExtension : Extension() { @@ -115,6 +115,8 @@ class FeatureManageExtension : Extension() { } } + + /* FeatureEnum.PLANNINGNOTIFIER -> { var alreadyExists = false transaction { @@ -167,7 +169,7 @@ class FeatureManageExtension : Extension() { ) ) } - } + } */ } return@action } @@ -216,6 +218,7 @@ class FeatureManageExtension : Extension() { } } + /* FeatureEnum.PLANNINGNOTIFIER -> { var alreadyExists = false transaction { @@ -264,7 +267,7 @@ class FeatureManageExtension : Extension() { ) ) } - } + } */ } } } diff --git a/src/main/kotlin/net/moonleay/lilJudd/extensions/component/FeatureEnum.kt b/src/main/kotlin/net/moonleay/lilJudd/extensions/component/FeatureEnum.kt index 7766f39..3c590fc 100644 --- a/src/main/kotlin/net/moonleay/lilJudd/extensions/component/FeatureEnum.kt +++ b/src/main/kotlin/net/moonleay/lilJudd/extensions/component/FeatureEnum.kt @@ -22,5 +22,5 @@ import com.kotlindiscord.kord.extensions.commands.application.slash.converters.C enum class FeatureEnum(override val readableName: String) : ChoiceEnum { TIMEPLANNINGFEATURE("Time Planning Feature"), - PLANNINGNOTIFIER("Planning Notifier") + //PLANNINGNOTIFIER("Planning Notifier") } diff --git a/src/main/kotlin/net/moonleay/lilJudd/features/PlanningNotifier.kt b/src/main/kotlin/net/moonleay/lilJudd/features/PlanningNotifier.kt index 3aab7e5..fd9329c 100644 --- a/src/main/kotlin/net/moonleay/lilJudd/features/PlanningNotifier.kt +++ b/src/main/kotlin/net/moonleay/lilJudd/features/PlanningNotifier.kt @@ -25,7 +25,7 @@ import net.moonleay.lilJudd.util.Logger object PlanningNotifier { suspend fun registerThread() { Logger.out("Adding ping scheduler...") - val scheduler = buildSchedule("0 00 23 * * * 0o *") // 0 0 4 * * * 0o 1w // 0o is UTC + val scheduler = buildSchedule("0 0 4 * * * 0o 1w") // 0 0 4 * * * 0o 1w // 0o is UTC scheduler.doInfinity { Logger.out("Starting to update roles...") diff --git a/src/main/kotlin/net/moonleay/lilJudd/features/TimeManager.kt b/src/main/kotlin/net/moonleay/lilJudd/features/TimeManager.kt index 0da325b..91fcd80 100644 --- a/src/main/kotlin/net/moonleay/lilJudd/features/TimeManager.kt +++ b/src/main/kotlin/net/moonleay/lilJudd/features/TimeManager.kt @@ -52,7 +52,7 @@ object TimeManager { suspend fun registerThread() { Logger.out("Adding message scheduler...") - val scheduler = buildSchedule("0 00 23 * * * 0o *") // 0 0 4 * * * 0o 1w // 0o is UTC + val scheduler = buildSchedule("0 0 4 * * * 0o 1w") // 0 0 4 * * * 0o 1w // 0o is UTC scheduler.doInfinity { Logger.out("Starting to notify...")