Merge pull request 'chore: moved to proper data types in columns' (#3) from chore/cleanup-db into master
All checks were successful
Build Gradle project / build-gradle-project (push) Successful in 2m57s
All checks were successful
Build Gradle project / build-gradle-project (push) Successful in 2m57s
Reviewed-on: #3
This commit is contained in:
commit
4f8924fb1a
20 changed files with 117 additions and 89 deletions
|
@ -76,6 +76,9 @@ object Bot {
|
||||||
CredentialManager.dbPassword
|
CredentialManager.dbPassword
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// Make sure the database is up-to-date
|
||||||
|
DB.register()
|
||||||
|
|
||||||
// Register all the jobs
|
// Register all the jobs
|
||||||
jobs.addAll(
|
jobs.addAll(
|
||||||
listOf(
|
listOf(
|
||||||
|
|
|
@ -53,12 +53,12 @@ class AcceptEditButton() : IEditButton {
|
||||||
var found = false
|
var found = false
|
||||||
transaction {
|
transaction {
|
||||||
for (pnr in MatchPlanningData.select {
|
for (pnr in MatchPlanningData.select {
|
||||||
MatchPlanningData.messageid eq (interaction.message.id.value.toString()) and (
|
MatchPlanningData.messageid eq (interaction.message.id.value.toLong()) and (
|
||||||
MatchPlanningData.serverid eq (guild.id.value.toString())) and (
|
MatchPlanningData.serverid eq (guild.id.value.toLong())) and (
|
||||||
MatchPlanningData.channelid eq (interaction.channelId.value.toString()))
|
MatchPlanningData.channelid eq (interaction.channelId.value.toLong()))
|
||||||
}) {
|
}) {
|
||||||
mpdd = MatchPlanningDataData(
|
mpdd = MatchPlanningDataData(
|
||||||
pnr[MatchPlanningData.id].value,
|
pnr[MatchPlanningData.id],
|
||||||
pnr[MatchPlanningData.serverid],
|
pnr[MatchPlanningData.serverid],
|
||||||
pnr[MatchPlanningData.channelid],
|
pnr[MatchPlanningData.channelid],
|
||||||
pnr[MatchPlanningData.matchtype],
|
pnr[MatchPlanningData.matchtype],
|
||||||
|
|
|
@ -50,12 +50,12 @@ class CancelEditButton : IEditButton {
|
||||||
var found = false
|
var found = false
|
||||||
transaction {
|
transaction {
|
||||||
for (pnr in MatchPlanningData.select {
|
for (pnr in MatchPlanningData.select {
|
||||||
MatchPlanningData.messageid eq (interaction.message.id.value.toString()) and (
|
MatchPlanningData.messageid eq (interaction.message.id.value.toLong()) and (
|
||||||
MatchPlanningData.serverid eq (guild.id.value.toString())) and (
|
MatchPlanningData.serverid eq (guild.id.value.toLong())) and (
|
||||||
MatchPlanningData.channelid eq (interaction.channelId.value.toString()))
|
MatchPlanningData.channelid eq (interaction.channelId.value.toLong()))
|
||||||
}) {
|
}) {
|
||||||
mpdd = MatchPlanningDataData(
|
mpdd = MatchPlanningDataData(
|
||||||
pnr[MatchPlanningData.id].value,
|
pnr[MatchPlanningData.id],
|
||||||
pnr[MatchPlanningData.serverid],
|
pnr[MatchPlanningData.serverid],
|
||||||
pnr[MatchPlanningData.channelid],
|
pnr[MatchPlanningData.channelid],
|
||||||
pnr[MatchPlanningData.matchtype],
|
pnr[MatchPlanningData.matchtype],
|
||||||
|
|
|
@ -53,12 +53,12 @@ class DeclineEditButton : IEditButton {
|
||||||
var found = false
|
var found = false
|
||||||
transaction {
|
transaction {
|
||||||
for (pnr in MatchPlanningData.select {
|
for (pnr in MatchPlanningData.select {
|
||||||
MatchPlanningData.messageid eq (interaction.message.id.value.toString()) and (
|
MatchPlanningData.messageid eq (interaction.message.id.value.toLong()) and (
|
||||||
MatchPlanningData.serverid eq (guild.id.value.toString())) and (
|
MatchPlanningData.serverid eq (guild.id.value.toLong())) and (
|
||||||
MatchPlanningData.channelid eq (interaction.channelId.value.toString()))
|
MatchPlanningData.channelid eq (interaction.channelId.value.toLong()))
|
||||||
}) {
|
}) {
|
||||||
mpdd = MatchPlanningDataData(
|
mpdd = MatchPlanningDataData(
|
||||||
pnr[MatchPlanningData.id].value,
|
pnr[MatchPlanningData.id],
|
||||||
pnr[MatchPlanningData.serverid],
|
pnr[MatchPlanningData.serverid],
|
||||||
pnr[MatchPlanningData.channelid],
|
pnr[MatchPlanningData.channelid],
|
||||||
pnr[MatchPlanningData.matchtype],
|
pnr[MatchPlanningData.matchtype],
|
||||||
|
|
|
@ -19,9 +19,16 @@
|
||||||
package net.moonleay.lilJudd.data
|
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.Database
|
||||||
|
import org.jetbrains.exposed.sql.SchemaUtils
|
||||||
|
import org.jetbrains.exposed.sql.transactions.transaction
|
||||||
|
|
||||||
object DB {
|
object DB {
|
||||||
|
private var connected = false
|
||||||
//Connect to the provided DB; trows errors, if the DB is not avalible.
|
//Connect to the provided DB; trows errors, if the DB is not avalible.
|
||||||
fun connect(dbDomain: String, dbName: String, dbUser: String, dbPasswd: String) {
|
fun connect(dbDomain: String, dbName: String, dbUser: String, dbPasswd: String) {
|
||||||
Database.connect(
|
Database.connect(
|
||||||
|
@ -30,5 +37,18 @@ object DB {
|
||||||
user = dbUser,
|
user = dbUser,
|
||||||
password = dbPasswd
|
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)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,13 +20,13 @@ package net.moonleay.lilJudd.data.entry
|
||||||
|
|
||||||
data class MatchPlanningDataData(
|
data class MatchPlanningDataData(
|
||||||
val id: Int,
|
val id: Int,
|
||||||
val serverid: String,
|
val serverid: Long,
|
||||||
val channelid: String,
|
val channelid: Long,
|
||||||
val matchtype: String,
|
val matchtype: String,
|
||||||
val registererid: String,
|
val registererid: Long,
|
||||||
val roleid: String,
|
val roleid: Long,
|
||||||
val opponentname: String,
|
val opponentname: String,
|
||||||
val messageid: String,
|
val messageid: Long,
|
||||||
val timestamp: String,
|
val timestamp: Long,
|
||||||
val jobstr: String
|
val jobstr: String
|
||||||
)
|
)
|
||||||
|
|
|
@ -19,8 +19,8 @@
|
||||||
package net.moonleay.lilJudd.data.entry
|
package net.moonleay.lilJudd.data.entry
|
||||||
|
|
||||||
data class PlanningNotifierRolesData(
|
data class PlanningNotifierRolesData(
|
||||||
val serverID: String, // The id of the server
|
val serverID: Long, // The id of the server
|
||||||
val channelId: String, // The id of the channel
|
val channelId: Long, // The id of the channel
|
||||||
val hastimeroleid: String, // The id of the role that has time today
|
val hastimeroleid: Long, // The id of the role that has time today
|
||||||
val wantstobenotifid: String // The id of the role that wants to be notified
|
val wantstobenotifid: Long // The id of the role that wants to be notified
|
||||||
)
|
)
|
||||||
|
|
|
@ -19,8 +19,8 @@
|
||||||
package net.moonleay.lilJudd.data.entry
|
package net.moonleay.lilJudd.data.entry
|
||||||
|
|
||||||
data class TimePlanningMessagesData(
|
data class TimePlanningMessagesData(
|
||||||
val serverid: String, // The discord server id
|
val serverid: Long, // The discord server id
|
||||||
val channelid: String, // The discord channel id
|
val channelid: Long, // The discord channel id
|
||||||
val weekstamp: String, // The timestamp of the monday of the week at 4am UTC
|
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.]"
|
val messageids: String // IDs are in the following format: "{weekdayNr}:{id};{weekdayNr}:{id};[etc.]"
|
||||||
)
|
)
|
||||||
|
|
|
@ -18,16 +18,17 @@
|
||||||
|
|
||||||
package net.moonleay.lilJudd.data.tables
|
package net.moonleay.lilJudd.data.tables
|
||||||
|
|
||||||
import org.jetbrains.exposed.dao.id.IntIdTable
|
import org.jetbrains.exposed.sql.Table
|
||||||
|
|
||||||
object MatchPlanningData : IntIdTable() {
|
object MatchPlanningData : Table(name = "new_matchplanning_data") {
|
||||||
var serverid = varchar("serverid", 50)
|
var id = integer("id").autoIncrement()
|
||||||
var channelid = varchar("channelid", 50)
|
var serverid = long("serverid")
|
||||||
|
var channelid = long("channelid")
|
||||||
var matchtype = varchar("matchtype", 50)
|
var matchtype = varchar("matchtype", 50)
|
||||||
var registererid = varchar("registererid", 50)
|
var registererid = long("registererid")
|
||||||
var roleid = varchar("roleid", 50)
|
var roleid = long("roleid")
|
||||||
var opponentName = varchar("opponentname", 100)
|
var opponentName = varchar("opponentname", 100)
|
||||||
var messageid = varchar("messageid", 50)
|
var messageid = long("messageid")
|
||||||
var timestamp = varchar("timestamp", 50)
|
var timestamp = long("timestamp")
|
||||||
var jobstr = varchar("jobstr", 50)
|
var jobstr = varchar("jobstr", 50)
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,11 +18,12 @@
|
||||||
|
|
||||||
package net.moonleay.lilJudd.data.tables
|
package net.moonleay.lilJudd.data.tables
|
||||||
|
|
||||||
import org.jetbrains.exposed.dao.id.IntIdTable
|
import org.jetbrains.exposed.sql.Table
|
||||||
|
|
||||||
object PlanningNotifierRoles : IntIdTable() {
|
object PlanningNotifierRoles : Table(name = "new_planningnotifier_roles") {
|
||||||
var serverid = varchar("serverid", 50)
|
var id = integer("id").autoIncrement()
|
||||||
var channelid = varchar("channelid", 50)
|
var serverid = long("serverid")
|
||||||
var hastimeroleid = varchar("hastimeroleid", 50)
|
var channelid = long("channelid")
|
||||||
var wantstobenotifiedid = varchar("wantstobenotifiedid", 50)
|
var hastimeroleid = long("hastimeroleid")
|
||||||
|
var wantstobenotifiedid = long("wantstobenotifiedid")
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,9 +18,11 @@
|
||||||
|
|
||||||
package net.moonleay.lilJudd.data.tables
|
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)
|
object TimePlanningChannels : Table(name = "new_timeplanning_channels") {
|
||||||
val channelid = varchar("channelid", 50)
|
var id = integer("id").autoIncrement()
|
||||||
|
var serverid = long("serverid")
|
||||||
|
val channelid = long("channelid")
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,11 +18,12 @@
|
||||||
|
|
||||||
package net.moonleay.lilJudd.data.tables
|
package net.moonleay.lilJudd.data.tables
|
||||||
|
|
||||||
import org.jetbrains.exposed.dao.id.IntIdTable
|
import org.jetbrains.exposed.sql.Table
|
||||||
|
|
||||||
object TimePlanningMessages : IntIdTable() {
|
object TimePlanningMessages : Table(name = "new_timeplanning_messages") {
|
||||||
var serverid = varchar("serverid", 50)
|
var id = integer("id").autoIncrement()
|
||||||
var channelid = varchar("channelid", 50)
|
var serverid = long("serverid")
|
||||||
var weekstamp = varchar("weekstamp", 50)
|
var channelid = long("channelid")
|
||||||
|
var weekstamp = long("weekstamp")
|
||||||
var messageids = varchar("messageids", 200)
|
var messageids = varchar("messageids", 200)
|
||||||
}
|
}
|
||||||
|
|
|
@ -60,8 +60,8 @@ class FeatureManageExtension : Extension() {
|
||||||
}
|
}
|
||||||
return@action
|
return@action
|
||||||
}
|
}
|
||||||
val gID = this.guild!!.id.toString()
|
val gID = this.guild!!.id.value.toLong()
|
||||||
val cID = this.arguments.channel.id.toString()
|
val cID = this.arguments.channel.id.value.toLong()
|
||||||
val channel = this.arguments.channel
|
val channel = this.arguments.channel
|
||||||
val args = this.arguments
|
val args = this.arguments
|
||||||
Logger.out("${args.feature.readableName} ${args.setStatus.readableName} ${channel.data.name.value}")
|
Logger.out("${args.feature.readableName} ${args.setStatus.readableName} ${channel.data.name.value}")
|
||||||
|
|
|
@ -36,9 +36,9 @@ import net.moonleay.lilJudd.jobs.component.JobManager
|
||||||
import net.moonleay.lilJudd.util.EmbedUtil
|
import net.moonleay.lilJudd.util.EmbedUtil
|
||||||
import net.moonleay.lilJudd.util.MessageUtil
|
import net.moonleay.lilJudd.util.MessageUtil
|
||||||
import net.moonleay.lilJudd.util.TimeUtil
|
import net.moonleay.lilJudd.util.TimeUtil
|
||||||
import org.jetbrains.exposed.dao.id.EntityID
|
|
||||||
import org.jetbrains.exposed.sql.insert
|
import org.jetbrains.exposed.sql.insert
|
||||||
import org.jetbrains.exposed.sql.transactions.transaction
|
import org.jetbrains.exposed.sql.transactions.transaction
|
||||||
|
import kotlin.properties.Delegates
|
||||||
|
|
||||||
class MatchExtension : Extension() {
|
class MatchExtension : Extension() {
|
||||||
|
|
||||||
|
@ -54,8 +54,8 @@ class MatchExtension : Extension() {
|
||||||
this.action {
|
this.action {
|
||||||
val args = this.arguments
|
val args = this.arguments
|
||||||
val m = this.member!!
|
val m = this.member!!
|
||||||
val gID = this.guild!!.id.value.toString()
|
val gID = this.guild!!.id.value
|
||||||
val cID = this.channel.id.value.toString()
|
val cID = this.channel.id.value
|
||||||
val opponent = args.opponent ?: "?"
|
val opponent = args.opponent ?: "?"
|
||||||
val msg = this.respond {
|
val msg = this.respond {
|
||||||
this.embeds.add(
|
this.embeds.add(
|
||||||
|
@ -100,17 +100,17 @@ class MatchExtension : Extension() {
|
||||||
}
|
}
|
||||||
return@action
|
return@action
|
||||||
}
|
}
|
||||||
lateinit var tableID: EntityID<Int>
|
var tableID by Delegates.notNull<Int>()
|
||||||
transaction {
|
transaction {
|
||||||
tableID = MatchPlanningData.insert {
|
tableID = MatchPlanningData.insert {
|
||||||
it[MatchPlanningData.serverid] = gID
|
it[MatchPlanningData.serverid] = gID.toLong()
|
||||||
it[MatchPlanningData.channelid] = cID
|
it[MatchPlanningData.channelid] = cID.toLong()
|
||||||
it[MatchPlanningData.messageid] = msg.id.value.toString()
|
it[MatchPlanningData.messageid] = msg.id.value.toLong()
|
||||||
it[MatchPlanningData.matchtype] = args.matchType.readableName
|
it[MatchPlanningData.matchtype] = args.matchType.readableName
|
||||||
it[MatchPlanningData.roleid] = role.id.value.toString()
|
it[MatchPlanningData.roleid] = role.id.value.toLong()
|
||||||
it[MatchPlanningData.registererid] = m.id.value.toString()
|
it[MatchPlanningData.registererid] = m.id.value.toLong()
|
||||||
it[MatchPlanningData.opponentName] = opponent
|
it[MatchPlanningData.opponentName] = opponent
|
||||||
it[MatchPlanningData.timestamp] = (zdt.toEpochSecond() * 1000).toString()
|
it[MatchPlanningData.timestamp] = (zdt.toEpochSecond() * 1000)
|
||||||
it[MatchPlanningData.jobstr] = jobString
|
it[MatchPlanningData.jobstr] = jobString
|
||||||
} get MatchPlanningData.id
|
} get MatchPlanningData.id
|
||||||
}
|
}
|
||||||
|
@ -120,8 +120,8 @@ class MatchExtension : Extension() {
|
||||||
JobManager.addJob(
|
JobManager.addJob(
|
||||||
MatchJob(
|
MatchJob(
|
||||||
jobString,
|
jobString,
|
||||||
tableID.value,
|
tableID,
|
||||||
"${args.matchType.readableName}_Vs_${opponent}_[${tableID.value}]-${gID}_${cID}",
|
"${args.matchType.readableName}_Vs_${opponent}_[${tableID}]-${gID}_${cID}",
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
@ -107,9 +107,9 @@ class SendPlannerExtension : Extension() {
|
||||||
// Save the message ids
|
// Save the message ids
|
||||||
transaction {
|
transaction {
|
||||||
TimePlanningMessages.insert {
|
TimePlanningMessages.insert {
|
||||||
it[TimePlanningMessages.serverid] = c.data.guildId.value.toString()
|
it[TimePlanningMessages.serverid] = c.data.guildId.value?.value!!.toLong()
|
||||||
it[TimePlanningMessages.channelid] = c.id.value.toString()
|
it[TimePlanningMessages.channelid] = c.id.value.toLong()
|
||||||
it[TimePlanningMessages.weekstamp] = (TimeUtil.getWeekStamp().toEpochSecond() * 1000).toString()
|
it[TimePlanningMessages.weekstamp] = (TimeUtil.getWeekStamp().toEpochSecond() * 1000)
|
||||||
it[TimePlanningMessages.messageids] = msgStr
|
it[TimePlanningMessages.messageids] = msgStr
|
||||||
} get TimePlanningMessages.id
|
} get TimePlanningMessages.id
|
||||||
}
|
}
|
||||||
|
|
|
@ -56,11 +56,11 @@ object AvailabilityManager : IFeature {
|
||||||
// ChannelID, Data
|
// ChannelID, Data
|
||||||
val messageMap = mutableMapOf<Snowflake, TimePlanningMessagesData>()
|
val messageMap = mutableMapOf<Snowflake, TimePlanningMessagesData>()
|
||||||
// ChannelID, Data
|
// ChannelID, Data
|
||||||
val roleMap = mutableMapOf<String, PlanningNotifierRolesData>()
|
val roleMap = mutableMapOf<Long, PlanningNotifierRolesData>()
|
||||||
|
|
||||||
transaction {
|
transaction {
|
||||||
for (pnr in TimePlanningMessages.select {
|
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])] =
|
messageMap[Snowflake(pnr[TimePlanningMessages.channelid])] =
|
||||||
TimePlanningMessagesData(
|
TimePlanningMessagesData(
|
||||||
|
@ -169,8 +169,8 @@ object AvailabilityManager : IFeature {
|
||||||
|
|
||||||
override suspend fun enable(
|
override suspend fun enable(
|
||||||
u: UserBehavior,
|
u: UserBehavior,
|
||||||
gID: String,
|
gID: Long,
|
||||||
cID: String,
|
cID: Long,
|
||||||
ch: Channel,
|
ch: Channel,
|
||||||
args: FeatureManageExtension.FeatureManagerArgs
|
args: FeatureManageExtension.FeatureManagerArgs
|
||||||
): EmbedBuilder {
|
): EmbedBuilder {
|
||||||
|
@ -187,13 +187,13 @@ object AvailabilityManager : IFeature {
|
||||||
this.name = "available [${ch.data.name.value}]"
|
this.name = "available [${ch.data.name.value}]"
|
||||||
this.mentionable = true
|
this.mentionable = true
|
||||||
}
|
}
|
||||||
val htr = hasTimeRole.id.toString()
|
val htr = hasTimeRole.id.value.toLong()
|
||||||
|
|
||||||
val wantsNotifsRole = Bot.bot.kordRef.getGuildOrThrow(Snowflake(gID)).createRole {
|
val wantsNotifsRole = Bot.bot.kordRef.getGuildOrThrow(Snowflake(gID)).createRole {
|
||||||
this.name = "notifications [${ch.data.name.value}]"
|
this.name = "notifications [${ch.data.name.value}]"
|
||||||
this.mentionable = true
|
this.mentionable = true
|
||||||
}
|
}
|
||||||
val wnr = wantsNotifsRole.id.toString()
|
val wnr = wantsNotifsRole.id.value.toLong()
|
||||||
|
|
||||||
// Save the role ids to db
|
// Save the role ids to db
|
||||||
transaction {
|
transaction {
|
||||||
|
@ -224,8 +224,8 @@ object AvailabilityManager : IFeature {
|
||||||
|
|
||||||
override suspend fun disable(
|
override suspend fun disable(
|
||||||
u: UserBehavior,
|
u: UserBehavior,
|
||||||
gID: String,
|
gID: Long,
|
||||||
cID: String,
|
cID: Long,
|
||||||
ch: Channel,
|
ch: Channel,
|
||||||
args: FeatureManageExtension.FeatureManagerArgs
|
args: FeatureManageExtension.FeatureManagerArgs
|
||||||
): EmbedBuilder {
|
): EmbedBuilder {
|
||||||
|
|
|
@ -38,7 +38,7 @@ object MatchManager {
|
||||||
MatchPlanningData.selectAll().forEach {
|
MatchPlanningData.selectAll().forEach {
|
||||||
dataList.add(
|
dataList.add(
|
||||||
MatchPlanningDataData(
|
MatchPlanningDataData(
|
||||||
it[MatchPlanningData.id].value,
|
it[MatchPlanningData.id],
|
||||||
it[MatchPlanningData.serverid],
|
it[MatchPlanningData.serverid],
|
||||||
it[MatchPlanningData.channelid],
|
it[MatchPlanningData.channelid],
|
||||||
it[MatchPlanningData.matchtype],
|
it[MatchPlanningData.matchtype],
|
||||||
|
@ -79,9 +79,9 @@ object MatchManager {
|
||||||
Logger.out("Registered job for match ${data.id}...")
|
Logger.out("Registered job for match ${data.id}...")
|
||||||
}
|
}
|
||||||
|
|
||||||
private suspend fun removeRoleFromGuild(gid: String, rid: String): Boolean {
|
private suspend fun removeRoleFromGuild(gid: Long, rid: Long): Boolean {
|
||||||
val guild = Bot.bot.kordRef.getGuildOrNull(Snowflake(gid.toLong())) ?: return false
|
val guild = Bot.bot.kordRef.getGuildOrNull(Snowflake(gid)) ?: return false
|
||||||
val role = guild.getRoleOrNull(Snowflake(rid.toLong())) ?: return false
|
val role = guild.getRoleOrNull(Snowflake(rid)) ?: return false
|
||||||
role.delete()
|
role.delete()
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
|
@ -151,9 +151,9 @@ object TimeManager : IFeature {
|
||||||
// Save the message ids
|
// Save the message ids
|
||||||
transaction {
|
transaction {
|
||||||
TimePlanningMessages.insert {
|
TimePlanningMessages.insert {
|
||||||
it[TimePlanningMessages.serverid] = c.data.guildId.value.toString()
|
it[TimePlanningMessages.serverid] = c.data.guildId.value?.value!!.toLong()
|
||||||
it[TimePlanningMessages.channelid] = c.id.value.toString()
|
it[TimePlanningMessages.channelid] = c.id.value.toLong()
|
||||||
it[TimePlanningMessages.weekstamp] = (TimeUtil.getWeekStamp().toEpochSecond() * 1000).toString()
|
it[TimePlanningMessages.weekstamp] = (TimeUtil.getWeekStamp().toEpochSecond() * 1000)
|
||||||
it[TimePlanningMessages.messageids] = msgStr
|
it[TimePlanningMessages.messageids] = msgStr
|
||||||
} get TimePlanningMessages.id
|
} get TimePlanningMessages.id
|
||||||
}
|
}
|
||||||
|
@ -164,8 +164,8 @@ object TimeManager : IFeature {
|
||||||
|
|
||||||
override suspend fun enable(
|
override suspend fun enable(
|
||||||
u: UserBehavior,
|
u: UserBehavior,
|
||||||
gID: String,
|
gID: Long,
|
||||||
cID: String,
|
cID: Long,
|
||||||
ch: Channel,
|
ch: Channel,
|
||||||
args: FeatureManageExtension.FeatureManagerArgs
|
args: FeatureManageExtension.FeatureManagerArgs
|
||||||
): EmbedBuilder {
|
): EmbedBuilder {
|
||||||
|
@ -200,8 +200,8 @@ object TimeManager : IFeature {
|
||||||
|
|
||||||
override suspend fun disable(
|
override suspend fun disable(
|
||||||
u: UserBehavior,
|
u: UserBehavior,
|
||||||
gID: String,
|
gID: Long,
|
||||||
cID: String,
|
cID: Long,
|
||||||
ch: Channel,
|
ch: Channel,
|
||||||
args: FeatureManageExtension.FeatureManagerArgs
|
args: FeatureManageExtension.FeatureManagerArgs
|
||||||
): EmbedBuilder {
|
): EmbedBuilder {
|
||||||
|
|
|
@ -29,16 +29,16 @@ interface IFeature {
|
||||||
|
|
||||||
suspend fun enable(
|
suspend fun enable(
|
||||||
u: UserBehavior,
|
u: UserBehavior,
|
||||||
gID: String,
|
gID: Long,
|
||||||
cID: String,
|
cID: Long,
|
||||||
ch: Channel,
|
ch: Channel,
|
||||||
args: FeatureManageExtension.FeatureManagerArgs
|
args: FeatureManageExtension.FeatureManagerArgs
|
||||||
): EmbedBuilder
|
): EmbedBuilder
|
||||||
|
|
||||||
suspend fun disable(
|
suspend fun disable(
|
||||||
u: UserBehavior,
|
u: UserBehavior,
|
||||||
gID: String,
|
gID: Long,
|
||||||
cID: String,
|
cID: Long,
|
||||||
ch: Channel,
|
ch: Channel,
|
||||||
args: FeatureManageExtension.FeatureManagerArgs
|
args: FeatureManageExtension.FeatureManagerArgs
|
||||||
): EmbedBuilder
|
): EmbedBuilder
|
||||||
|
|
|
@ -54,7 +54,7 @@ class MatchJob(
|
||||||
MatchPlanningData.id eq (tableId)
|
MatchPlanningData.id eq (tableId)
|
||||||
}) {
|
}) {
|
||||||
mpdd = MatchPlanningDataData(
|
mpdd = MatchPlanningDataData(
|
||||||
pnr[MatchPlanningData.id].value,
|
pnr[MatchPlanningData.id],
|
||||||
pnr[MatchPlanningData.serverid],
|
pnr[MatchPlanningData.serverid],
|
||||||
pnr[MatchPlanningData.channelid],
|
pnr[MatchPlanningData.channelid],
|
||||||
pnr[MatchPlanningData.matchtype],
|
pnr[MatchPlanningData.matchtype],
|
||||||
|
|
Loading…
Reference in a new issue