fix: removed nonexistent feature in feature command, fixed timing on timeplanner.

Signed-off-by: limited_dev <loginakkisativ@gmail.com>
This commit is contained in:
limited_dev 2023-06-15 08:51:32 +02:00
parent 7295b39e92
commit 27b721ae1f
5 changed files with 14 additions and 10 deletions

View file

@ -53,7 +53,7 @@ object Bot {
exitProcess(3) 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") { if (CredentialManager.dbDomain == "empty" || CredentialManager.dbName == "empty" || CredentialManager.dbUser == "empty" || CredentialManager.dbPassword == "empty") {
Logger.out("The config does not contain the whole Database credentials.") Logger.out("The config does not contain the whole Database credentials.")
exitProcess(3) exitProcess(3)
@ -70,6 +70,7 @@ object Bot {
// Register the TimePlanner thread // Register the TimePlanner thread
val coroutineJob = GlobalScope.launch { val coroutineJob = GlobalScope.launch {
TimeManager.registerThread() TimeManager.registerThread()
//PlanningNotifier.registerThread()
} }
// Add a shutdown hook to cancel the coroutine when the application is terminated // Add a shutdown hook to cancel the coroutine when the application is terminated

View file

@ -27,16 +27,16 @@ import com.kotlindiscord.kord.extensions.types.respond
import com.kotlindiscord.kord.extensions.utils.hasPermission import com.kotlindiscord.kord.extensions.utils.hasPermission
import dev.kord.common.Color import dev.kord.common.Color
import dev.kord.common.entity.Permission 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.data.tables.TimePlanningChannels
import net.moonleay.lilJudd.extensions.component.EnableOrDisable import net.moonleay.lilJudd.extensions.component.EnableOrDisable
import net.moonleay.lilJudd.extensions.component.FeatureEnum import net.moonleay.lilJudd.extensions.component.FeatureEnum
import net.moonleay.lilJudd.util.Logger import net.moonleay.lilJudd.util.Logger
import net.moonleay.lilJudd.util.MessageUtil import net.moonleay.lilJudd.util.MessageUtil
import org.jetbrains.exposed.sql.*
import org.jetbrains.exposed.sql.SqlExpressionBuilder.eq 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 import org.jetbrains.exposed.sql.transactions.transaction
class FeatureManageExtension : Extension() { class FeatureManageExtension : Extension() {
@ -115,6 +115,8 @@ class FeatureManageExtension : Extension() {
} }
} }
/*
FeatureEnum.PLANNINGNOTIFIER -> { FeatureEnum.PLANNINGNOTIFIER -> {
var alreadyExists = false var alreadyExists = false
transaction { transaction {
@ -167,7 +169,7 @@ class FeatureManageExtension : Extension() {
) )
) )
} }
} } */
} }
return@action return@action
} }
@ -216,6 +218,7 @@ class FeatureManageExtension : Extension() {
} }
} }
/*
FeatureEnum.PLANNINGNOTIFIER -> { FeatureEnum.PLANNINGNOTIFIER -> {
var alreadyExists = false var alreadyExists = false
transaction { transaction {
@ -264,7 +267,7 @@ class FeatureManageExtension : Extension() {
) )
) )
} }
} } */
} }
} }
} }

View file

@ -22,5 +22,5 @@ import com.kotlindiscord.kord.extensions.commands.application.slash.converters.C
enum class FeatureEnum(override val readableName: String) : ChoiceEnum { enum class FeatureEnum(override val readableName: String) : ChoiceEnum {
TIMEPLANNINGFEATURE("Time Planning Feature"), TIMEPLANNINGFEATURE("Time Planning Feature"),
PLANNINGNOTIFIER("Planning Notifier") //PLANNINGNOTIFIER("Planning Notifier")
} }

View file

@ -25,7 +25,7 @@ import net.moonleay.lilJudd.util.Logger
object PlanningNotifier { object PlanningNotifier {
suspend fun registerThread() { suspend fun registerThread() {
Logger.out("Adding ping scheduler...") 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 { scheduler.doInfinity {
Logger.out("Starting to update roles...") Logger.out("Starting to update roles...")

View file

@ -52,7 +52,7 @@ object TimeManager {
suspend fun registerThread() { suspend fun registerThread() {
Logger.out("Adding message scheduler...") 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 { scheduler.doInfinity {
Logger.out("Starting to notify...") Logger.out("Starting to notify...")