Compare commits
7 commits
500ad1a912
...
883940c8fd
Author | SHA1 | Date | |
---|---|---|---|
883940c8fd | |||
18cd26c456 | |||
a3c1344f1a | |||
f552ea4faa | |||
d10f8901c9 | |||
925398db65 | |||
b258747086 |
8 changed files with 21 additions and 15 deletions
|
@ -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.2"
|
||||
?: "2.4.3"
|
||||
|
||||
val kordver = "1.5.6"
|
||||
val coroutinesver = "1.1.0"
|
||||
|
|
|
@ -35,10 +35,7 @@ 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.FeatureManageExtension
|
||||
import net.moonleay.lilJudd.extensions.MatchExtension
|
||||
import net.moonleay.lilJudd.extensions.SendPlannerExtension
|
||||
import net.moonleay.lilJudd.extensions.VersionExtension
|
||||
import net.moonleay.lilJudd.extensions.*
|
||||
import net.moonleay.lilJudd.features.AvailabilityManager
|
||||
import net.moonleay.lilJudd.features.MatchManager
|
||||
import net.moonleay.lilJudd.features.TimeManager
|
||||
|
@ -103,7 +100,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
|
||||
}
|
||||
|
||||
|
|
|
@ -27,6 +27,7 @@ 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 {
|
||||
|
@ -62,5 +63,6 @@ class IsAvailableEditButton : IEditButton {
|
|||
}
|
||||
}
|
||||
}
|
||||
AvailabilityManager.runThread()
|
||||
}
|
||||
}
|
||||
|
|
|
@ -27,6 +27,7 @@ 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 {
|
||||
|
@ -62,5 +63,6 @@ class MaybeAvailableEditButton : IEditButton {
|
|||
}
|
||||
}
|
||||
}
|
||||
AvailabilityManager.runThread()
|
||||
}
|
||||
}
|
||||
|
|
|
@ -27,6 +27,7 @@ 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 {
|
||||
|
@ -62,5 +63,6 @@ class NotAvailableEditButton : IEditButton {
|
|||
}
|
||||
}
|
||||
}
|
||||
AvailabilityManager.runThread()
|
||||
}
|
||||
}
|
||||
|
|
|
@ -107,10 +107,10 @@ class SendPlannerExtension : Extension() {
|
|||
// Save the message ids
|
||||
transaction {
|
||||
TimePlanningMessages.insert {
|
||||
it[serverid] = c.data.guildId.value.toString()
|
||||
it[channelid] = c.id.value.toString()
|
||||
it[weekstamp] = (TimeUtil.getWeekStamp().toEpochSecond() * 1000).toString()
|
||||
it[messageids] = msgStr
|
||||
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
|
||||
} get TimePlanningMessages.id
|
||||
}
|
||||
Logger.out("Finished with ${c.data.guildId.value}")
|
||||
|
|
|
@ -96,8 +96,8 @@ object AvailabilityManager : IFeature {
|
|||
}
|
||||
val roleData = roleMap[data.channelid] // Get the role data
|
||||
if (roleData == null) {
|
||||
Logger.out("Role for this channel does not exist")
|
||||
return
|
||||
Logger.out("Role for channel ${data.channelid} does not exist")
|
||||
continue // this took way to long to find out that this was the issue
|
||||
}
|
||||
val g = Bot.bot.kordRef.getGuildOrThrow(Snowflake(data.serverid))
|
||||
// Get all members with the role
|
||||
|
@ -106,9 +106,11 @@ object AvailabilityManager : IFeature {
|
|||
}
|
||||
mce.collect { memberchunkevent ->
|
||||
memberchunkevent.members.forEach {
|
||||
Logger.out("Checking member ${it.id.value}")
|
||||
if (it.roleIds.contains(Snowflake(roleData.hastimeroleid)))
|
||||
Logger.out("Checking member ${it.id.value} (${it.username})")
|
||||
if (it.roleIds.contains(Snowflake(roleData.hastimeroleid))) {
|
||||
it.removeRole(Snowflake(roleData.hastimeroleid))
|
||||
Logger.out("Removed role from ${it.username}") // Removed the role
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -94,6 +94,7 @@ 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 =
|
||||
|
@ -152,7 +153,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().toOffsetDateTime().toString()
|
||||
it[TimePlanningMessages.weekstamp] = (TimeUtil.getWeekStamp().toEpochSecond() * 1000).toString()
|
||||
it[TimePlanningMessages.messageids] = msgStr
|
||||
} get TimePlanningMessages.id
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue