diff --git a/build.gradle.kts b/build.gradle.kts index eac9d28..0ad11dc 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -29,7 +29,7 @@ plugins { } //lilJudd version 2 -val ownerID = 372703841151614976L +val creatorID = 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" } @@ -120,7 +120,7 @@ val templateSrc = project.rootDir.resolve("src/main/templates") val templateDest = project.projectDir.resolve("build/generated/templates") val templateProps = mapOf( "version" to project.version as String, - "ownerID" to ownerID, + "creatorID" to creatorID, "kordversion" to kordver, "coroutinesversion" to coroutinesver, "ktorversion" to ktorver, diff --git a/src/main/kotlin/net/moonleay/liljudd/Bot.kt b/src/main/kotlin/net/moonleay/liljudd/Bot.kt index 5ea1197..2e5e5aa 100644 --- a/src/main/kotlin/net/moonleay/liljudd/Bot.kt +++ b/src/main/kotlin/net/moonleay/liljudd/Bot.kt @@ -133,7 +133,7 @@ object Bot { this.embed { this.title = "Oops. Something went wrong." this.description = "The bot encountered an error during execution.\n" + - "Please report this to <@${BuildConstants.ownerID}>.\n" + + "Please report this to <@${BuildConstants.creatorID}>.\n" + "The errorid is \"$stamp.stk\"" this.field { this.name = "Error message:" diff --git a/src/main/kotlin/net/moonleay/liljudd/Main.kt b/src/main/kotlin/net/moonleay/liljudd/Main.kt index e60782b..a1196f8 100644 --- a/src/main/kotlin/net/moonleay/liljudd/Main.kt +++ b/src/main/kotlin/net/moonleay/liljudd/Main.kt @@ -31,7 +31,7 @@ suspend fun main() { "v.${BuildConstants.version}\n" ) - Logger.out("li'l Judd made by moonleay (https://moonleay.net). Web UI made by IchLiebeZuege (https://mal-noh.de).") + Logger.out("li'l Judd made by moonleay (https://moonleay.net). Web UI made by aronmal (https://mal-noh.de).") Logger.out("For more information check out https://liljudd.ink and https://git.moonleay.net/DiscordBots/lilJudd") Bot.start() diff --git a/src/main/kotlin/net/moonleay/liljudd/features/AvailabilityManager.kt b/src/main/kotlin/net/moonleay/liljudd/features/AvailabilityManager.kt index c62fcdb..e4d0441 100644 --- a/src/main/kotlin/net/moonleay/liljudd/features/AvailabilityManager.kt +++ b/src/main/kotlin/net/moonleay/liljudd/features/AvailabilityManager.kt @@ -44,7 +44,7 @@ object AvailabilityManager : IFeature { // This runs during the cronjob. suspend fun runThread() { - Logger.out("Starting to update roles...") + Logger.out("Updating match roles") // ChannelID, Data val messages = TimePlanningMessagesRepository.getWeek(TimeUtil.getWeekStamp().toEpochSecond()) @@ -70,7 +70,7 @@ object AvailabilityManager : IFeature { } this.updateInChannel(snf, data, roleData) } - Logger.out("Done! Until tomorrow! <3 ") + Logger.out("Finished updating roles") } suspend fun updateInChannel(snf: Snowflake) { @@ -162,7 +162,7 @@ object AvailabilityManager : IFeature { // Register the cronjob to run at 1AM UTC every day override suspend fun registerThread() { - Logger.out("Adding availability scheduler...") + Logger.out("Registering daily planning message role update coroutine") val scheduler = buildSchedule("0 0 2 * * *") // 0 0 4 * * * 0o 1w // 0o is UTC scheduler.doInfinity { this.runThread() @@ -176,7 +176,7 @@ object AvailabilityManager : IFeature { ch: Channel, args: FeatureManageExtension.FeatureManagerArgs ): EmbedBuilder { - var alreadyExists = PlanningNotifierRolesRepository.existsInChannel(cID) + val alreadyExists = PlanningNotifierRolesRepository.existsInChannel(cID) // Check if the channel and guild already exist in the db if (!alreadyExists) { // Create the roles in Discord diff --git a/src/main/kotlin/net/moonleay/liljudd/features/MatchManager.kt b/src/main/kotlin/net/moonleay/liljudd/features/MatchManager.kt index abe847a..1bdeafe 100644 --- a/src/main/kotlin/net/moonleay/liljudd/features/MatchManager.kt +++ b/src/main/kotlin/net/moonleay/liljudd/features/MatchManager.kt @@ -28,7 +28,7 @@ import net.moonleay.liljudd.util.Logger object MatchManager { suspend fun update() { - Logger.out("Updating match roles...") + Logger.out("Updating matches") val dataList = MatchPlanningDataRepository.getAll() for (data in dataList) { @@ -41,7 +41,7 @@ object MatchManager { } this.registerJob(data) } - Logger.out("Done. Until next time! <3 ") + Logger.out("Finished updating matches") } private fun registerJob(data: MatchPlanningDataData) { diff --git a/src/main/kotlin/net/moonleay/liljudd/features/TimeManager.kt b/src/main/kotlin/net/moonleay/liljudd/features/TimeManager.kt index 44d261a..0496dff 100644 --- a/src/main/kotlin/net/moonleay/liljudd/features/TimeManager.kt +++ b/src/main/kotlin/net/moonleay/liljudd/features/TimeManager.kt @@ -52,7 +52,7 @@ object TimeManager : IFeature { // Register the cronjob to run at 0:01 AM UTC every Monday override suspend fun registerThread() { - Logger.out("Adding message scheduler...") + Logger.out("Registering weekly planning message posting coroutine") val scheduler = buildSchedule("0 0 1 * * * 0o 1w") // 0 0 4 * * * 0o 1w // 0o is UTC scheduler.doInfinity { this.runThread() @@ -60,7 +60,7 @@ object TimeManager : IFeature { } private suspend fun runThread() { - Logger.out("Starting to notify...") + Logger.out("Starting to send out weekly planning messages") // ChannelID -> Data val targetedChannels = TimePlanningChannelsRepository.getAll().associateBy { it.channelID } @@ -72,7 +72,7 @@ object TimeManager : IFeature { for (ch2 in targetedChannels.keys) { val ch = Snowflake(ch2) if (Bot.bot.kordRef.getChannel(ch) == null) - continue // TODO: Check if the channel is valid in another shard + continue val c = Bot.bot.kordRef.getChannelOf(ch)!! msgStr = "" if (targetedRoles != null && targetedRoles.keys.contains(ch2) && targetedRoles[ch2] != null) { @@ -133,7 +133,7 @@ object TimeManager : IFeature { } msgStr += "${it}:${msg.id.value};" then = then.plusDays(1).withHour(4).withMinute(0).withSecond(0) - Logger.out("Finished sending day $it") + Logger.out("Finished sending day $it in $ch") delay(1000) } @@ -186,7 +186,7 @@ object TimeManager : IFeature { ): EmbedBuilder { // Check if entry exists in db if (TimePlanningChannelsRepository.exists(cID, gID)) { - // delete all entrys for this channel + // delete all entries for this channel TimePlanningChannelsRepository.deleteFromChannelInServer(cID, gID) return MessageUtil.getEmbed( EmbedColor.SUCCESS, diff --git a/src/main/kotlin/net/moonleay/liljudd/util/MessageUtil.kt b/src/main/kotlin/net/moonleay/liljudd/util/MessageUtil.kt index 98503d6..f531dd0 100644 --- a/src/main/kotlin/net/moonleay/liljudd/util/MessageUtil.kt +++ b/src/main/kotlin/net/moonleay/liljudd/util/MessageUtil.kt @@ -37,6 +37,11 @@ object MessageUtil { val ebb = EmbedBuilder() ebb.color = e.color ebb.title = e.title + ebb.author { + this.icon = e.author?.url + this.name = e.author?.name.toString() + this.url = e.author?.url + } e.fields.forEach { val fb = EmbedBuilder.Field() fb.name = it.name @@ -44,6 +49,10 @@ object MessageUtil { fb.inline = it.inline ebb.fields.add(fb) } + ebb.footer { + this.icon = e.footer?.iconUrl + this.text = e.footer?.text.toString() + } ebb.description = e.description return ebb } diff --git a/src/main/templates/net/moonleay/lilJudd/build/BuildConstants.kt b/src/main/templates/net/moonleay/lilJudd/build/BuildConstants.kt index 44c46b3..73a4fdd 100644 --- a/src/main/templates/net/moonleay/lilJudd/build/BuildConstants.kt +++ b/src/main/templates/net/moonleay/lilJudd/build/BuildConstants.kt @@ -20,7 +20,7 @@ package net.moonleay.liljudd.build internal object BuildConstants { const val version = "${version}" - const val ownerID = "${ownerID}" + const val creatorID = "${creatorID}" const val kordVersion = "${kordversion}" const val coroutinesVersion = "${coroutinesversion}" const val ktorVersion = "${ktorversion}"