diff --git a/.idea/kotlinc.xml b/.idea/kotlinc.xml
index 8d81632..fe63bb6 100644
--- a/.idea/kotlinc.xml
+++ b/.idea/kotlinc.xml
@@ -1,6 +1,6 @@
-
+
\ No newline at end of file
diff --git a/build.gradle.kts b/build.gradle.kts
index c5db4f4..f144ace 100644
--- a/build.gradle.kts
+++ b/build.gradle.kts
@@ -54,7 +54,6 @@ allprojects {
}
dependencies {
- implementation("io.ktor:ktor-client-encoding:2.2.4")
detektPlugins(libs.detekt)
detektPlugins(libs.detekt.libraries)
@@ -64,6 +63,8 @@ dependencies {
implementation(libs.kmongo)
implementation(libs.rgxgen)
+ implementation(libs.ktor.client.encoding)
+
implementation(libs.kordex.annotations)
implementation(libs.kordex.core)
implementation(libs.kordex.mappings)
diff --git a/buildSrc/build.gradle.kts b/buildSrc/build.gradle.kts
index d24f9c2..0d73e40 100644
--- a/buildSrc/build.gradle.kts
+++ b/buildSrc/build.gradle.kts
@@ -17,12 +17,12 @@ dependencies {
implementation(gradleApi())
implementation(localGroovy())
- implementation(kotlin("gradle-plugin", version = "1.9.22"))
- implementation(kotlin("serialization", version = "1.9.22"))
+ implementation(kotlin("gradle-plugin", version = "1.9.23"))
+ implementation(kotlin("serialization", version = "1.9.23"))
implementation("gradle.plugin.org.cadixdev.gradle", "licenser", "0.6.1")
implementation("com.github.jakemarsden", "git-hooks-gradle-plugin", "0.0.2")
- implementation("com.google.devtools.ksp", "com.google.devtools.ksp.gradle.plugin", "1.9.22-1.0.17")
+ implementation("com.google.devtools.ksp", "com.google.devtools.ksp.gradle.plugin", "1.9.23-1.0.19")
implementation("io.gitlab.arturbosch.detekt", "detekt-gradle-plugin", "1.23.5")
// implementation("org.ec4j.editorconfig", "org.ec4j.editorconfig.gradle.plugin", "0.0.3")
diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml
index 460ba6d..b02619d 100644
--- a/gradle/libs.versions.toml
+++ b/gradle/libs.versions.toml
@@ -1,26 +1,26 @@
[versions]
detekt = "1.23.5"
-kotlin = "1.9.22"
+kotlin = "1.9.23"
graphql = "7.0.2"
autolink = "0.11.0"
commons-text = "1.11.0"
excelkt = "1.0.2"
flexver = "1.1.1"
-groovy = "3.0.20"
+groovy = "3.0.21"
homoglyph = "1.2.1"
jansi = "2.4.1"
jsoup = "1.17.2"
-kaml = "0.57.0"
+kaml = "0.58.0"
kmongo = "4.11.0"
kordex = "1.8.0-SNAPSHOT"
kotlintest = "3.4.2"
-ktor = "2.3.8"
+ktor = "2.3.9"
kx-ser = "1.6.3"
-logback = "1.5.1"
+logback = "1.5.3"
logback-groovy = "1.14.5"
logging = "6.0.3"
-moshi = "1.15.0"
+moshi = "1.15.1"
rgxgen = "2.0"
semver = "1.4.2"
@@ -52,6 +52,8 @@ kotlin-reflect = { module = "org.jetbrains.kotlin:kotlin-reflect", version.ref =
kotlin-stdlib = { module = "org.jetbrains.kotlin:kotlin-stdlib-jdk8" }
kotlintest = { module = "io.kotlintest:kotlintest-runner-junit5", version.ref = "kotlintest" }
ktor-core = { module = "io.ktor:ktor-client-core", version.ref = "ktor" }
+ktor-client-cio = { module = "io.ktor:ktor-client-cio", version.ref = "ktor" }
+ktor-client-encoding = { module = "io.ktor:ktor-client-encoding", version.ref = "ktor" }
ktor-content-negotiation = { module = "io.ktor:ktor-client-content-negotiation", version.ref = "ktor" }
kx-ser = { module = "org.jetbrains.kotlinx:kotlinx-serialization-core", version.ref = "kx-ser" }
logback = { module = "ch.qos.logback:logback-classic", version.ref = "logback" }
diff --git a/module-log-parser/build.gradle.kts b/module-log-parser/build.gradle.kts
index d60e6d7..de0e942 100644
--- a/module-log-parser/build.gradle.kts
+++ b/module-log-parser/build.gradle.kts
@@ -16,6 +16,8 @@ dependencies {
ksp(libs.kordex.annotationProcessor)
+ implementation(libs.ktor.client.cio)
+
implementation(libs.kordex.annotations)
implementation(libs.kordex.core)
implementation(libs.kordex.unsafe)
diff --git a/module-log-parser/src/main/kotlin/org/quiltmc/community/cozy/modules/logs/LogParserExtension.kt b/module-log-parser/src/main/kotlin/org/quiltmc/community/cozy/modules/logs/LogParserExtension.kt
index 03bcaf0..7859eed 100644
--- a/module-log-parser/src/main/kotlin/org/quiltmc/community/cozy/modules/logs/LogParserExtension.kt
+++ b/module-log-parser/src/main/kotlin/org/quiltmc/community/cozy/modules/logs/LogParserExtension.kt
@@ -36,6 +36,7 @@ import org.quiltmc.community.cozy.modules.logs.events.DefaultEventHandler
import org.quiltmc.community.cozy.modules.logs.events.EventHandler
import org.quiltmc.community.cozy.modules.logs.events.PKEventHandler
import org.quiltmc.community.cozy.modules.logs.types.BaseLogHandler
+import java.net.URI
import java.net.URL
import kotlin.time.Duration.Companion.minutes
@@ -96,7 +97,7 @@ public class LogParserExtension : Extension() {
}
val logs = (parseLinks(message.content) + message.attachments.map { it.url })
- .map { URL(it) }
+ .map { URI(it).toURL() }
.map { handleLink(it, event) }
.flatten()
.filter {
diff --git a/src/main/kotlin/org/quiltmc/community/App.kt b/src/main/kotlin/org/quiltmc/community/App.kt
index 9ee65c3..9e2b7f9 100644
--- a/src/main/kotlin/org/quiltmc/community/App.kt
+++ b/src/main/kotlin/org/quiltmc/community/App.kt
@@ -166,7 +166,6 @@ suspend fun setupQuilt() = ExtensibleBot(DISCORD_TOKEN) {
}
extPhishing {
- appName = "QuiltMC's Cozy Bot"
detectionAction = DetectionAction.Kick
logChannelName = "cozy-logs"
requiredCommandPermission = null
diff --git a/src/main/kotlin/org/quiltmc/community/modes/quilt/extensions/minecraft/MinecraftExtension.kt b/src/main/kotlin/org/quiltmc/community/modes/quilt/extensions/minecraft/MinecraftExtension.kt
index 9130529..b041870 100644
--- a/src/main/kotlin/org/quiltmc/community/modes/quilt/extensions/minecraft/MinecraftExtension.kt
+++ b/src/main/kotlin/org/quiltmc/community/modes/quilt/extensions/minecraft/MinecraftExtension.kt
@@ -17,14 +17,18 @@ import com.kotlindiscord.kord.extensions.extensions.ephemeralSlashCommand
import com.kotlindiscord.kord.extensions.pagination.pages.Page
import com.kotlindiscord.kord.extensions.utils.scheduling.Scheduler
import com.kotlindiscord.kord.extensions.utils.scheduling.Task
+import com.kotlindiscord.kord.extensions.utils.toReaction
import dev.kord.common.annotation.KordPreview
import dev.kord.common.entity.Permission
import dev.kord.common.entity.Snowflake
import dev.kord.core.behavior.channel.createMessage
+import dev.kord.core.builder.components.emoji
+import dev.kord.core.entity.ReactionEmoji
import dev.kord.core.entity.channel.NewsChannel
import dev.kord.core.entity.channel.TextChannel
import dev.kord.core.entity.channel.TopGuildMessageChannel
-import dev.kord.rest.builder.message.EmbedBuilder
+import dev.kord.rest.builder.message.MessageBuilder
+import dev.kord.rest.builder.message.actionRow
import dev.kord.rest.builder.message.embed
import io.github.oshai.kotlinlogging.KotlinLogging
import io.ktor.client.*
@@ -49,7 +53,7 @@ private val LINK_REGEX = "[^\"]+)\"[^>]*>(?[^<]+)".to
@Suppress("MagicNumber", "UnderscoresInNumericLiterals")
private val CHANNELS: List = listOf(
-// Snowflake(828218532671389736L), // Testing
+// Snowflake(1220660330191917056L), // Testing
Snowflake(838805249271267398L), // Community
// Snowflake(834195264629243904L), // Toolchain
)
@@ -95,7 +99,7 @@ class MinecraftExtension : Extension() {
ephemeralSubCommand(::CheckArguments) {
name = "get"
description = "Retrieve the patch notes for a given Minecraft version, or the latest if not " +
- "supplied."
+ "supplied."
action {
if (!::currentEntries.isInitialized) {
@@ -115,9 +119,7 @@ class MinecraftExtension : Extension() {
}
respond {
- embed {
- patchNotes(patch.get())
- }
+ patchNotes(patch.get())
}
}
}
@@ -262,14 +264,17 @@ class MinecraftExtension : Extension() {
result = result.replace("", "`")
result = result.replace("
", "`")
- result = result.replace("[\n]*[\n]*".toRegex(), "\n\n__**")
- result = result.replace("[\n]*[\n]*".toRegex(), "**__\n")
+ @Suppress("MagicNumber")
+ for (i in 1..6) {
+ result = result.replace("[\n]*[\n]*".toRegex(), "\n\n${"#".repeat(i)} ")
+ result = result.replace("[\n]*[\n]*".toRegex(), "\n")
+ }
result = result.replace("[\n]*<[ou]l>[\n]*".toRegex(), "\n\n")
result = result.replace("[\n]*[ou]l>[\n]*".toRegex(), "\n\n")
- result = result.replace("[\n]*\n+[\n]*".toRegex(), "\n**»** ")
- result = result.replace("([\n]{2,})?[\n]*".toRegex(), "\n**»** ")
+ result = result.replace("[\n]*\n+[\n]*".toRegex(), "\n- ")
+ result = result.replace("([\n]{2,})?[\n]*".toRegex(), "\n- ")
result = result.replace("[\n]*[\n]*".toRegex(), "\n\n")
val links = LINK_REGEX.findAll(result)
@@ -299,25 +304,34 @@ class MinecraftExtension : Extension() {
return result to 0
}
- private fun EmbedBuilder.patchNotes(patchNote: PatchNote, maxLength: Int = 1000) {
+ private fun MessageBuilder.patchNotes(patchNote: PatchNote, maxLength: Int = 4000) {
val (truncated, remaining) = patchNote.body.formatHTML().truncateMarkdown(maxLength)
- title = patchNote.title
- color = DISCORD_GREEN
-
- description = "[Full patch notes](https://quiltmc.org/mc-patchnotes/#${patchNote.version})\n\n"
- description += truncated
+ actionRow {
+ linkButton("https://quiltmc.org/mc-patchnotes/#${patchNote.version}") {
+ label = "Read more..."
- if (remaining > 0) {
- description += "\n\n[... $remaining more lines]"
+ emoji("🔗".toReaction() as ReactionEmoji.Unicode)
+ }
}
- thumbnail {
- url = "$BASE_URL${patchNote.image.url}"
- }
+ embed {
+ title = patchNote.title
+ color = DISCORD_GREEN
+
+ description = truncated
- footer {
- text = "URL: https://quiltmc.org/mc-patchnotes/#${patchNote.version}"
+ if (remaining > 0) {
+ description += "\n\n[... $remaining more lines]"
+ }
+
+ thumbnail {
+ url = "$BASE_URL${patchNote.image.url}"
+ }
+
+ footer {
+ text = "URL: https://quiltmc.org/mc-patchnotes/#${patchNote.version}"
+ }
}
}
@@ -327,7 +341,8 @@ class MinecraftExtension : Extension() {
if (guildId == COMMUNITY_GUILD) {
content = "<@&$MINECRAFT_UPDATE_PING_ROLE>"
}
- embed { patchNotes(patchNote, maxLength) }
+
+ patchNotes(patchNote, maxLength)
}
val title = if (patchNote.title.startsWith("minecraft ", true)) {