Compare commits

..

No commits in common. "883940c8fda354cd63c7a47e2c1df345a2df268b" and "500ad1a9123f4ae55ced2a9f532ef2a16e328235" have entirely different histories.

8 changed files with 15 additions and 21 deletions

View file

@ -32,7 +32,7 @@ val ownerID = 372703841151614976L
group = "net.moonleay.liljudd"
version = System.getenv("CI_COMMIT_TAG")?.let { "$it-${System.getenv("CI_COMMIT_SHORT_SHA")}-prod" }
?: System.getenv("CI_COMMIT_SHORT_SHA")?.let { "$it-dev" }
?: "2.4.3"
?: "2.4.2"
val kordver = "1.5.6"
val coroutinesver = "1.1.0"

View file

@ -35,7 +35,10 @@ import net.moonleay.botendo.build.BuildConstants
import net.moonleay.lilJudd.buttons.component.EditButtonManager
import net.moonleay.lilJudd.data.CredentialManager
import net.moonleay.lilJudd.data.DB
import net.moonleay.lilJudd.extensions.*
import net.moonleay.lilJudd.extensions.FeatureManageExtension
import net.moonleay.lilJudd.extensions.MatchExtension
import net.moonleay.lilJudd.extensions.SendPlannerExtension
import net.moonleay.lilJudd.extensions.VersionExtension
import net.moonleay.lilJudd.features.AvailabilityManager
import net.moonleay.lilJudd.features.MatchManager
import net.moonleay.lilJudd.features.TimeManager
@ -100,7 +103,7 @@ object Bot {
add(::FeatureManageExtension)
add(::SendPlannerExtension)
add(::MatchExtension)
add(::UpdateRolesExtension) // This command is only for debugging purposes
//add(::UpdateRolesExtension) // This command is only for debugging purposes
//add(::TestExtension) // See comment in TestExtension.kt
}

View file

@ -27,7 +27,6 @@ import dev.kord.core.entity.interaction.ButtonInteraction
import dev.kord.rest.builder.message.modify.embed
import net.moonleay.lilJudd.Bot
import net.moonleay.lilJudd.buttons.component.IEditButton
import net.moonleay.lilJudd.features.AvailabilityManager
import net.moonleay.lilJudd.util.EmbedUtil
class IsAvailableEditButton : IEditButton {
@ -63,6 +62,5 @@ class IsAvailableEditButton : IEditButton {
}
}
}
AvailabilityManager.runThread()
}
}

View file

@ -27,7 +27,6 @@ import dev.kord.core.entity.interaction.ButtonInteraction
import dev.kord.rest.builder.message.modify.embed
import net.moonleay.lilJudd.Bot
import net.moonleay.lilJudd.buttons.component.IEditButton
import net.moonleay.lilJudd.features.AvailabilityManager
import net.moonleay.lilJudd.util.EmbedUtil
class MaybeAvailableEditButton : IEditButton {
@ -63,6 +62,5 @@ class MaybeAvailableEditButton : IEditButton {
}
}
}
AvailabilityManager.runThread()
}
}

View file

@ -27,7 +27,6 @@ import dev.kord.core.entity.interaction.ButtonInteraction
import dev.kord.rest.builder.message.modify.embed
import net.moonleay.lilJudd.Bot
import net.moonleay.lilJudd.buttons.component.IEditButton
import net.moonleay.lilJudd.features.AvailabilityManager
import net.moonleay.lilJudd.util.EmbedUtil
class NotAvailableEditButton : IEditButton {
@ -63,6 +62,5 @@ class NotAvailableEditButton : IEditButton {
}
}
}
AvailabilityManager.runThread()
}
}

View file

@ -107,10 +107,10 @@ 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.messageids] = msgStr
it[serverid] = c.data.guildId.value.toString()
it[channelid] = c.id.value.toString()
it[weekstamp] = (TimeUtil.getWeekStamp().toEpochSecond() * 1000).toString()
it[messageids] = msgStr
} get TimePlanningMessages.id
}
Logger.out("Finished with ${c.data.guildId.value}")

View file

@ -96,8 +96,8 @@ object AvailabilityManager : IFeature {
}
val roleData = roleMap[data.channelid] // Get the role data
if (roleData == null) {
Logger.out("Role for channel ${data.channelid} does not exist")
continue // this took way to long to find out that this was the issue
Logger.out("Role for this channel does not exist")
return
}
val g = Bot.bot.kordRef.getGuildOrThrow(Snowflake(data.serverid))
// Get all members with the role
@ -106,11 +106,9 @@ object AvailabilityManager : IFeature {
}
mce.collect { memberchunkevent ->
memberchunkevent.members.forEach {
Logger.out("Checking member ${it.id.value} (${it.username})")
if (it.roleIds.contains(Snowflake(roleData.hastimeroleid))) {
Logger.out("Checking member ${it.id.value}")
if (it.roleIds.contains(Snowflake(roleData.hastimeroleid)))
it.removeRole(Snowflake(roleData.hastimeroleid))
Logger.out("Removed role from ${it.username}") // Removed the role
}
}
}

View file

@ -94,7 +94,6 @@ object TimeManager : IFeature {
if (Bot.bot.kordRef.getChannel(ch) == null)
continue // TODO: Check if the channel is valid in another shard
val c = Bot.bot.kordRef.getChannelOf<MessageChannel>(ch)!!
msgStr = ""
if (roleMap != null && roleMap.keys.contains(ch) && roleMap[ch] != null) {
c.createMessage {
this.content =
@ -153,7 +152,7 @@ object TimeManager : IFeature {
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.weekstamp] = TimeUtil.getWeekStamp().toOffsetDateTime().toString()
it[TimePlanningMessages.messageids] = msgStr
} get TimePlanningMessages.id
}