From 266b331699a5221a2412485fc305424b285a4f3c Mon Sep 17 00:00:00 2001 From: moonleay Date: Mon, 11 Sep 2023 13:35:17 +0200 Subject: [PATCH] chore: moved to proper data types in columns Signed-off-by: moonleay --- src/main/kotlin/net/moonleay/lilJudd/Bot.kt | 3 +++ .../buttons/matchplanner/AcceptEditButton.kt | 8 +++---- .../buttons/matchplanner/CancelEditButton.kt | 8 +++---- .../buttons/matchplanner/DeclineEditButton.kt | 8 +++---- .../kotlin/net/moonleay/lilJudd/data/DB.kt | 20 ++++++++++++++++ .../data/entry/MatchPlanningDataData.kt | 12 +++++----- .../data/entry/PlanningNotifierRolesData.kt | 8 +++---- .../data/entry/TimePlanningMessagesData.kt | 6 ++--- .../lilJudd/data/tables/MatchPlanningData.kt | 17 ++++++------- .../data/tables/PlanningNotifierRoles.kt | 13 +++++----- .../data/tables/TimePlanningChannels.kt | 10 ++++---- .../data/tables/TimePlanningMessages.kt | 11 +++++---- .../extensions/FeatureManageExtension.kt | 4 ++-- .../lilJudd/extensions/MatchExtension.kt | 24 +++++++++---------- .../extensions/SendPlannerExtension.kt | 6 ++--- .../lilJudd/features/AvailabilityManager.kt | 16 ++++++------- .../moonleay/lilJudd/features/MatchManager.kt | 8 +++---- .../moonleay/lilJudd/features/TimeManager.kt | 14 +++++------ .../lilJudd/features/component/IFeature.kt | 8 +++---- .../net/moonleay/lilJudd/jobs/MatchJob.kt | 2 +- 20 files changed, 117 insertions(+), 89 deletions(-) diff --git a/src/main/kotlin/net/moonleay/lilJudd/Bot.kt b/src/main/kotlin/net/moonleay/lilJudd/Bot.kt index 1c6e337..6f6d47f 100644 --- a/src/main/kotlin/net/moonleay/lilJudd/Bot.kt +++ b/src/main/kotlin/net/moonleay/lilJudd/Bot.kt @@ -76,6 +76,9 @@ object Bot { CredentialManager.dbPassword ) + // Make sure the database is up-to-date + DB.register() + // Register all the jobs jobs.addAll( listOf( diff --git a/src/main/kotlin/net/moonleay/lilJudd/buttons/matchplanner/AcceptEditButton.kt b/src/main/kotlin/net/moonleay/lilJudd/buttons/matchplanner/AcceptEditButton.kt index c9f33e7..55765ee 100644 --- a/src/main/kotlin/net/moonleay/lilJudd/buttons/matchplanner/AcceptEditButton.kt +++ b/src/main/kotlin/net/moonleay/lilJudd/buttons/matchplanner/AcceptEditButton.kt @@ -53,12 +53,12 @@ class AcceptEditButton() : IEditButton { var found = false transaction { for (pnr in MatchPlanningData.select { - MatchPlanningData.messageid eq (interaction.message.id.value.toString()) and ( - MatchPlanningData.serverid eq (guild.id.value.toString())) and ( - MatchPlanningData.channelid eq (interaction.channelId.value.toString())) + MatchPlanningData.messageid eq (interaction.message.id.value.toLong()) and ( + MatchPlanningData.serverid eq (guild.id.value.toLong())) and ( + MatchPlanningData.channelid eq (interaction.channelId.value.toLong())) }) { mpdd = MatchPlanningDataData( - pnr[MatchPlanningData.id].value, + pnr[MatchPlanningData.id], pnr[MatchPlanningData.serverid], pnr[MatchPlanningData.channelid], pnr[MatchPlanningData.matchtype], diff --git a/src/main/kotlin/net/moonleay/lilJudd/buttons/matchplanner/CancelEditButton.kt b/src/main/kotlin/net/moonleay/lilJudd/buttons/matchplanner/CancelEditButton.kt index 3925cd3..4f70ab7 100644 --- a/src/main/kotlin/net/moonleay/lilJudd/buttons/matchplanner/CancelEditButton.kt +++ b/src/main/kotlin/net/moonleay/lilJudd/buttons/matchplanner/CancelEditButton.kt @@ -50,12 +50,12 @@ class CancelEditButton : IEditButton { var found = false transaction { for (pnr in MatchPlanningData.select { - MatchPlanningData.messageid eq (interaction.message.id.value.toString()) and ( - MatchPlanningData.serverid eq (guild.id.value.toString())) and ( - MatchPlanningData.channelid eq (interaction.channelId.value.toString())) + MatchPlanningData.messageid eq (interaction.message.id.value.toLong()) and ( + MatchPlanningData.serverid eq (guild.id.value.toLong())) and ( + MatchPlanningData.channelid eq (interaction.channelId.value.toLong())) }) { mpdd = MatchPlanningDataData( - pnr[MatchPlanningData.id].value, + pnr[MatchPlanningData.id], pnr[MatchPlanningData.serverid], pnr[MatchPlanningData.channelid], pnr[MatchPlanningData.matchtype], diff --git a/src/main/kotlin/net/moonleay/lilJudd/buttons/matchplanner/DeclineEditButton.kt b/src/main/kotlin/net/moonleay/lilJudd/buttons/matchplanner/DeclineEditButton.kt index 67b193e..3d0e0bd 100644 --- a/src/main/kotlin/net/moonleay/lilJudd/buttons/matchplanner/DeclineEditButton.kt +++ b/src/main/kotlin/net/moonleay/lilJudd/buttons/matchplanner/DeclineEditButton.kt @@ -53,12 +53,12 @@ class DeclineEditButton : IEditButton { var found = false transaction { for (pnr in MatchPlanningData.select { - MatchPlanningData.messageid eq (interaction.message.id.value.toString()) and ( - MatchPlanningData.serverid eq (guild.id.value.toString())) and ( - MatchPlanningData.channelid eq (interaction.channelId.value.toString())) + MatchPlanningData.messageid eq (interaction.message.id.value.toLong()) and ( + MatchPlanningData.serverid eq (guild.id.value.toLong())) and ( + MatchPlanningData.channelid eq (interaction.channelId.value.toLong())) }) { mpdd = MatchPlanningDataData( - pnr[MatchPlanningData.id].value, + pnr[MatchPlanningData.id], pnr[MatchPlanningData.serverid], pnr[MatchPlanningData.channelid], pnr[MatchPlanningData.matchtype], diff --git a/src/main/kotlin/net/moonleay/lilJudd/data/DB.kt b/src/main/kotlin/net/moonleay/lilJudd/data/DB.kt index b1ff4b7..f0711de 100644 --- a/src/main/kotlin/net/moonleay/lilJudd/data/DB.kt +++ b/src/main/kotlin/net/moonleay/lilJudd/data/DB.kt @@ -19,9 +19,16 @@ package net.moonleay.lilJudd.data +import net.moonleay.lilJudd.data.tables.MatchPlanningData +import net.moonleay.lilJudd.data.tables.PlanningNotifierRoles +import net.moonleay.lilJudd.data.tables.TimePlanningChannels +import net.moonleay.lilJudd.data.tables.TimePlanningMessages import org.jetbrains.exposed.sql.Database +import org.jetbrains.exposed.sql.SchemaUtils +import org.jetbrains.exposed.sql.transactions.transaction object DB { + private var connected = false //Connect to the provided DB; trows errors, if the DB is not avalible. fun connect(dbDomain: String, dbName: String, dbUser: String, dbPasswd: String) { Database.connect( @@ -30,5 +37,18 @@ object DB { user = dbUser, password = dbPasswd ) + connected = true + } + + fun register() { + if (!connected) + return + // Register tables here + transaction { + SchemaUtils.create(TimePlanningChannels) + SchemaUtils.create(TimePlanningMessages) + SchemaUtils.create(MatchPlanningData) + SchemaUtils.create(PlanningNotifierRoles) + } } } diff --git a/src/main/kotlin/net/moonleay/lilJudd/data/entry/MatchPlanningDataData.kt b/src/main/kotlin/net/moonleay/lilJudd/data/entry/MatchPlanningDataData.kt index ca0bd32..451278e 100644 --- a/src/main/kotlin/net/moonleay/lilJudd/data/entry/MatchPlanningDataData.kt +++ b/src/main/kotlin/net/moonleay/lilJudd/data/entry/MatchPlanningDataData.kt @@ -20,13 +20,13 @@ package net.moonleay.lilJudd.data.entry data class MatchPlanningDataData( val id: Int, - val serverid: String, - val channelid: String, + val serverid: Long, + val channelid: Long, val matchtype: String, - val registererid: String, - val roleid: String, + val registererid: Long, + val roleid: Long, val opponentname: String, - val messageid: String, - val timestamp: String, + val messageid: Long, + val timestamp: Long, val jobstr: String ) diff --git a/src/main/kotlin/net/moonleay/lilJudd/data/entry/PlanningNotifierRolesData.kt b/src/main/kotlin/net/moonleay/lilJudd/data/entry/PlanningNotifierRolesData.kt index 8cba107..fc15729 100644 --- a/src/main/kotlin/net/moonleay/lilJudd/data/entry/PlanningNotifierRolesData.kt +++ b/src/main/kotlin/net/moonleay/lilJudd/data/entry/PlanningNotifierRolesData.kt @@ -19,8 +19,8 @@ package net.moonleay.lilJudd.data.entry data class PlanningNotifierRolesData( - val serverID: String, // The id of the server - val channelId: String, // The id of the channel - val hastimeroleid: String, // The id of the role that has time today - val wantstobenotifid: String // The id of the role that wants to be notified + val serverID: Long, // The id of the server + val channelId: Long, // The id of the channel + val hastimeroleid: Long, // The id of the role that has time today + val wantstobenotifid: Long // The id of the role that wants to be notified ) diff --git a/src/main/kotlin/net/moonleay/lilJudd/data/entry/TimePlanningMessagesData.kt b/src/main/kotlin/net/moonleay/lilJudd/data/entry/TimePlanningMessagesData.kt index 3da4ba8..c4de368 100644 --- a/src/main/kotlin/net/moonleay/lilJudd/data/entry/TimePlanningMessagesData.kt +++ b/src/main/kotlin/net/moonleay/lilJudd/data/entry/TimePlanningMessagesData.kt @@ -19,8 +19,8 @@ package net.moonleay.lilJudd.data.entry data class TimePlanningMessagesData( - val serverid: String, // The discord server id - val channelid: String, // The discord channel id - val weekstamp: String, // The timestamp of the monday of the week at 4am UTC + val serverid: Long, // The discord server id + val channelid: Long, // The discord channel id + val weekstamp: Long, // The timestamp of the monday of the week at 4am UTC val messageids: String // IDs are in the following format: "{weekdayNr}:{id};{weekdayNr}:{id};[etc.]" ) diff --git a/src/main/kotlin/net/moonleay/lilJudd/data/tables/MatchPlanningData.kt b/src/main/kotlin/net/moonleay/lilJudd/data/tables/MatchPlanningData.kt index 2de3ece..e2e8afa 100644 --- a/src/main/kotlin/net/moonleay/lilJudd/data/tables/MatchPlanningData.kt +++ b/src/main/kotlin/net/moonleay/lilJudd/data/tables/MatchPlanningData.kt @@ -18,16 +18,17 @@ package net.moonleay.lilJudd.data.tables -import org.jetbrains.exposed.dao.id.IntIdTable +import org.jetbrains.exposed.sql.Table -object MatchPlanningData : IntIdTable() { - var serverid = varchar("serverid", 50) - var channelid = varchar("channelid", 50) +object MatchPlanningData : Table(name = "new_matchplanning_data") { + var id = integer("id").autoIncrement() + var serverid = long("serverid") + var channelid = long("channelid") var matchtype = varchar("matchtype", 50) - var registererid = varchar("registererid", 50) - var roleid = varchar("roleid", 50) + var registererid = long("registererid") + var roleid = long("roleid") var opponentName = varchar("opponentname", 100) - var messageid = varchar("messageid", 50) - var timestamp = varchar("timestamp", 50) + var messageid = long("messageid") + var timestamp = long("timestamp") var jobstr = varchar("jobstr", 50) } diff --git a/src/main/kotlin/net/moonleay/lilJudd/data/tables/PlanningNotifierRoles.kt b/src/main/kotlin/net/moonleay/lilJudd/data/tables/PlanningNotifierRoles.kt index d8d3b9d..e2fc9e0 100644 --- a/src/main/kotlin/net/moonleay/lilJudd/data/tables/PlanningNotifierRoles.kt +++ b/src/main/kotlin/net/moonleay/lilJudd/data/tables/PlanningNotifierRoles.kt @@ -18,11 +18,12 @@ package net.moonleay.lilJudd.data.tables -import org.jetbrains.exposed.dao.id.IntIdTable +import org.jetbrains.exposed.sql.Table -object PlanningNotifierRoles : IntIdTable() { - var serverid = varchar("serverid", 50) - var channelid = varchar("channelid", 50) - var hastimeroleid = varchar("hastimeroleid", 50) - var wantstobenotifiedid = varchar("wantstobenotifiedid", 50) +object PlanningNotifierRoles : Table(name = "new_planningnotifier_roles") { + var id = integer("id").autoIncrement() + var serverid = long("serverid") + var channelid = long("channelid") + var hastimeroleid = long("hastimeroleid") + var wantstobenotifiedid = long("wantstobenotifiedid") } diff --git a/src/main/kotlin/net/moonleay/lilJudd/data/tables/TimePlanningChannels.kt b/src/main/kotlin/net/moonleay/lilJudd/data/tables/TimePlanningChannels.kt index a746aa1..a521838 100644 --- a/src/main/kotlin/net/moonleay/lilJudd/data/tables/TimePlanningChannels.kt +++ b/src/main/kotlin/net/moonleay/lilJudd/data/tables/TimePlanningChannels.kt @@ -18,9 +18,11 @@ package net.moonleay.lilJudd.data.tables -import org.jetbrains.exposed.dao.id.IntIdTable +import org.jetbrains.exposed.sql.Table -object TimePlanningChannels : IntIdTable() { - var serverid = varchar("serverid", 50) - val channelid = varchar("channelid", 50) + +object TimePlanningChannels : Table(name = "new_timeplanning_channels") { + var id = integer("id").autoIncrement() + var serverid = long("serverid") + val channelid = long("channelid") } diff --git a/src/main/kotlin/net/moonleay/lilJudd/data/tables/TimePlanningMessages.kt b/src/main/kotlin/net/moonleay/lilJudd/data/tables/TimePlanningMessages.kt index 7498edb..8f8a01b 100644 --- a/src/main/kotlin/net/moonleay/lilJudd/data/tables/TimePlanningMessages.kt +++ b/src/main/kotlin/net/moonleay/lilJudd/data/tables/TimePlanningMessages.kt @@ -18,11 +18,12 @@ package net.moonleay.lilJudd.data.tables -import org.jetbrains.exposed.dao.id.IntIdTable +import org.jetbrains.exposed.sql.Table -object TimePlanningMessages : IntIdTable() { - var serverid = varchar("serverid", 50) - var channelid = varchar("channelid", 50) - var weekstamp = varchar("weekstamp", 50) +object TimePlanningMessages : Table(name = "new_timeplanning_messages") { + var id = integer("id").autoIncrement() + var serverid = long("serverid") + var channelid = long("channelid") + var weekstamp = long("weekstamp") var messageids = varchar("messageids", 200) } diff --git a/src/main/kotlin/net/moonleay/lilJudd/extensions/FeatureManageExtension.kt b/src/main/kotlin/net/moonleay/lilJudd/extensions/FeatureManageExtension.kt index 48f68e9..eac08c6 100644 --- a/src/main/kotlin/net/moonleay/lilJudd/extensions/FeatureManageExtension.kt +++ b/src/main/kotlin/net/moonleay/lilJudd/extensions/FeatureManageExtension.kt @@ -60,8 +60,8 @@ class FeatureManageExtension : Extension() { } return@action } - val gID = this.guild!!.id.toString() - val cID = this.arguments.channel.id.toString() + val gID = this.guild!!.id.value.toLong() + val cID = this.arguments.channel.id.value.toLong() val channel = this.arguments.channel val args = this.arguments Logger.out("${args.feature.readableName} ${args.setStatus.readableName} ${channel.data.name.value}") diff --git a/src/main/kotlin/net/moonleay/lilJudd/extensions/MatchExtension.kt b/src/main/kotlin/net/moonleay/lilJudd/extensions/MatchExtension.kt index 4eb1db0..3be70f7 100644 --- a/src/main/kotlin/net/moonleay/lilJudd/extensions/MatchExtension.kt +++ b/src/main/kotlin/net/moonleay/lilJudd/extensions/MatchExtension.kt @@ -36,9 +36,9 @@ import net.moonleay.lilJudd.jobs.component.JobManager import net.moonleay.lilJudd.util.EmbedUtil import net.moonleay.lilJudd.util.MessageUtil import net.moonleay.lilJudd.util.TimeUtil -import org.jetbrains.exposed.dao.id.EntityID import org.jetbrains.exposed.sql.insert import org.jetbrains.exposed.sql.transactions.transaction +import kotlin.properties.Delegates class MatchExtension : Extension() { @@ -54,8 +54,8 @@ class MatchExtension : Extension() { this.action { val args = this.arguments val m = this.member!! - val gID = this.guild!!.id.value.toString() - val cID = this.channel.id.value.toString() + val gID = this.guild!!.id.value + val cID = this.channel.id.value val opponent = args.opponent ?: "?" val msg = this.respond { this.embeds.add( @@ -100,17 +100,17 @@ class MatchExtension : Extension() { } return@action } - lateinit var tableID: EntityID + var tableID by Delegates.notNull() transaction { tableID = MatchPlanningData.insert { - it[MatchPlanningData.serverid] = gID - it[MatchPlanningData.channelid] = cID - it[MatchPlanningData.messageid] = msg.id.value.toString() + it[MatchPlanningData.serverid] = gID.toLong() + it[MatchPlanningData.channelid] = cID.toLong() + it[MatchPlanningData.messageid] = msg.id.value.toLong() it[MatchPlanningData.matchtype] = args.matchType.readableName - it[MatchPlanningData.roleid] = role.id.value.toString() - it[MatchPlanningData.registererid] = m.id.value.toString() + it[MatchPlanningData.roleid] = role.id.value.toLong() + it[MatchPlanningData.registererid] = m.id.value.toLong() it[MatchPlanningData.opponentName] = opponent - it[MatchPlanningData.timestamp] = (zdt.toEpochSecond() * 1000).toString() + it[MatchPlanningData.timestamp] = (zdt.toEpochSecond() * 1000) it[MatchPlanningData.jobstr] = jobString } get MatchPlanningData.id } @@ -120,8 +120,8 @@ class MatchExtension : Extension() { JobManager.addJob( MatchJob( jobString, - tableID.value, - "${args.matchType.readableName}_Vs_${opponent}_[${tableID.value}]-${gID}_${cID}", + tableID, + "${args.matchType.readableName}_Vs_${opponent}_[${tableID}]-${gID}_${cID}", ) ) } diff --git a/src/main/kotlin/net/moonleay/lilJudd/extensions/SendPlannerExtension.kt b/src/main/kotlin/net/moonleay/lilJudd/extensions/SendPlannerExtension.kt index c02294e..0e53f7b 100644 --- a/src/main/kotlin/net/moonleay/lilJudd/extensions/SendPlannerExtension.kt +++ b/src/main/kotlin/net/moonleay/lilJudd/extensions/SendPlannerExtension.kt @@ -107,9 +107,9 @@ class SendPlannerExtension : Extension() { // Save the message ids transaction { TimePlanningMessages.insert { - it[TimePlanningMessages.serverid] = c.data.guildId.value.toString() - it[TimePlanningMessages.channelid] = c.id.value.toString() - it[TimePlanningMessages.weekstamp] = (TimeUtil.getWeekStamp().toEpochSecond() * 1000).toString() + it[TimePlanningMessages.serverid] = c.data.guildId.value?.value!!.toLong() + it[TimePlanningMessages.channelid] = c.id.value.toLong() + it[TimePlanningMessages.weekstamp] = (TimeUtil.getWeekStamp().toEpochSecond() * 1000) it[TimePlanningMessages.messageids] = msgStr } get TimePlanningMessages.id } diff --git a/src/main/kotlin/net/moonleay/lilJudd/features/AvailabilityManager.kt b/src/main/kotlin/net/moonleay/lilJudd/features/AvailabilityManager.kt index 2a980dc..d9fff00 100644 --- a/src/main/kotlin/net/moonleay/lilJudd/features/AvailabilityManager.kt +++ b/src/main/kotlin/net/moonleay/lilJudd/features/AvailabilityManager.kt @@ -56,11 +56,11 @@ object AvailabilityManager : IFeature { // ChannelID, Data val messageMap = mutableMapOf() // ChannelID, Data - val roleMap = mutableMapOf() + val roleMap = mutableMapOf() transaction { for (pnr in TimePlanningMessages.select { - TimePlanningMessages.weekstamp eq (TimeUtil.getWeekStamp().toEpochSecond() * 1000).toString() + TimePlanningMessages.weekstamp eq (TimeUtil.getWeekStamp().toEpochSecond() * 1000) }) { messageMap[Snowflake(pnr[TimePlanningMessages.channelid])] = TimePlanningMessagesData( @@ -169,8 +169,8 @@ object AvailabilityManager : IFeature { override suspend fun enable( u: UserBehavior, - gID: String, - cID: String, + gID: Long, + cID: Long, ch: Channel, args: FeatureManageExtension.FeatureManagerArgs ): EmbedBuilder { @@ -187,13 +187,13 @@ object AvailabilityManager : IFeature { this.name = "available [${ch.data.name.value}]" this.mentionable = true } - val htr = hasTimeRole.id.toString() + val htr = hasTimeRole.id.value.toLong() val wantsNotifsRole = Bot.bot.kordRef.getGuildOrThrow(Snowflake(gID)).createRole { this.name = "notifications [${ch.data.name.value}]" this.mentionable = true } - val wnr = wantsNotifsRole.id.toString() + val wnr = wantsNotifsRole.id.value.toLong() // Save the role ids to db transaction { @@ -224,8 +224,8 @@ object AvailabilityManager : IFeature { override suspend fun disable( u: UserBehavior, - gID: String, - cID: String, + gID: Long, + cID: Long, ch: Channel, args: FeatureManageExtension.FeatureManagerArgs ): EmbedBuilder { diff --git a/src/main/kotlin/net/moonleay/lilJudd/features/MatchManager.kt b/src/main/kotlin/net/moonleay/lilJudd/features/MatchManager.kt index a92ad6a..1591545 100644 --- a/src/main/kotlin/net/moonleay/lilJudd/features/MatchManager.kt +++ b/src/main/kotlin/net/moonleay/lilJudd/features/MatchManager.kt @@ -38,7 +38,7 @@ object MatchManager { MatchPlanningData.selectAll().forEach { dataList.add( MatchPlanningDataData( - it[MatchPlanningData.id].value, + it[MatchPlanningData.id], it[MatchPlanningData.serverid], it[MatchPlanningData.channelid], it[MatchPlanningData.matchtype], @@ -79,9 +79,9 @@ object MatchManager { Logger.out("Registered job for match ${data.id}...") } - private suspend fun removeRoleFromGuild(gid: String, rid: String): Boolean { - val guild = Bot.bot.kordRef.getGuildOrNull(Snowflake(gid.toLong())) ?: return false - val role = guild.getRoleOrNull(Snowflake(rid.toLong())) ?: return false + private suspend fun removeRoleFromGuild(gid: Long, rid: Long): Boolean { + val guild = Bot.bot.kordRef.getGuildOrNull(Snowflake(gid)) ?: return false + val role = guild.getRoleOrNull(Snowflake(rid)) ?: return false role.delete() return true } diff --git a/src/main/kotlin/net/moonleay/lilJudd/features/TimeManager.kt b/src/main/kotlin/net/moonleay/lilJudd/features/TimeManager.kt index 9acbc33..2058c11 100644 --- a/src/main/kotlin/net/moonleay/lilJudd/features/TimeManager.kt +++ b/src/main/kotlin/net/moonleay/lilJudd/features/TimeManager.kt @@ -151,9 +151,9 @@ object TimeManager : IFeature { // Save the message ids transaction { TimePlanningMessages.insert { - it[TimePlanningMessages.serverid] = c.data.guildId.value.toString() - it[TimePlanningMessages.channelid] = c.id.value.toString() - it[TimePlanningMessages.weekstamp] = (TimeUtil.getWeekStamp().toEpochSecond() * 1000).toString() + it[TimePlanningMessages.serverid] = c.data.guildId.value?.value!!.toLong() + it[TimePlanningMessages.channelid] = c.id.value.toLong() + it[TimePlanningMessages.weekstamp] = (TimeUtil.getWeekStamp().toEpochSecond() * 1000) it[TimePlanningMessages.messageids] = msgStr } get TimePlanningMessages.id } @@ -164,8 +164,8 @@ object TimeManager : IFeature { override suspend fun enable( u: UserBehavior, - gID: String, - cID: String, + gID: Long, + cID: Long, ch: Channel, args: FeatureManageExtension.FeatureManagerArgs ): EmbedBuilder { @@ -200,8 +200,8 @@ object TimeManager : IFeature { override suspend fun disable( u: UserBehavior, - gID: String, - cID: String, + gID: Long, + cID: Long, ch: Channel, args: FeatureManageExtension.FeatureManagerArgs ): EmbedBuilder { diff --git a/src/main/kotlin/net/moonleay/lilJudd/features/component/IFeature.kt b/src/main/kotlin/net/moonleay/lilJudd/features/component/IFeature.kt index aa27536..1145797 100644 --- a/src/main/kotlin/net/moonleay/lilJudd/features/component/IFeature.kt +++ b/src/main/kotlin/net/moonleay/lilJudd/features/component/IFeature.kt @@ -29,16 +29,16 @@ interface IFeature { suspend fun enable( u: UserBehavior, - gID: String, - cID: String, + gID: Long, + cID: Long, ch: Channel, args: FeatureManageExtension.FeatureManagerArgs ): EmbedBuilder suspend fun disable( u: UserBehavior, - gID: String, - cID: String, + gID: Long, + cID: Long, ch: Channel, args: FeatureManageExtension.FeatureManagerArgs ): EmbedBuilder diff --git a/src/main/kotlin/net/moonleay/lilJudd/jobs/MatchJob.kt b/src/main/kotlin/net/moonleay/lilJudd/jobs/MatchJob.kt index 394758a..89b33e4 100644 --- a/src/main/kotlin/net/moonleay/lilJudd/jobs/MatchJob.kt +++ b/src/main/kotlin/net/moonleay/lilJudd/jobs/MatchJob.kt @@ -54,7 +54,7 @@ class MatchJob( MatchPlanningData.id eq (tableId) }) { mpdd = MatchPlanningDataData( - pnr[MatchPlanningData.id].value, + pnr[MatchPlanningData.id], pnr[MatchPlanningData.serverid], pnr[MatchPlanningData.channelid], pnr[MatchPlanningData.matchtype],