diff --git a/build.gradle.kts b/build.gradle.kts index c41fe6e..6ee695a 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -27,11 +27,11 @@ repositories { dependencies { // Kord - Local SNAPSHOT JARs (voice encryption branch) - // TODO: Switch back to version catalog when Kord merges voice encryption to main + // TODO: Switch back to version catalog when Kord merges voice encryption to main (kord#1063) implementation(fileTree("libs") { include("kord-*.jar") }) // Transitive dependencies required by local Kord JARs (flatDir doesn't resolve these) - // TODO: Remove when Kord merges voice encryption to main + // TODO: Remove when Kord merges voice encryption to main (kord#1063) implementation(libs.kotlinx.datetime) implementation(libs.kord.cache) implementation(libs.kord.cache.map) @@ -65,6 +65,14 @@ dependencies { // Serialization implementation(libs.kotlinx.serialization) + // libdave-jvm for DAVE protocol + implementation(libs.libdave.api) + implementation(libs.libdave.impl.jni) + runtimeOnly(libs.libdave.natives.darwin) + runtimeOnly(libs.libdave.natives.linuxX64) + runtimeOnly(libs.libdave.natives.linuxAarch64) + runtimeOnly(libs.libdave.natives.winX64) + // Lavaplayer implementation(libs.lavaplayer) implementation(libs.lavaplayer.youtube) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 9cdaa51..a5f6628 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -1,8 +1,7 @@ [versions] jacoco = "0.8.12" -# Kord is now loaded from local libs/ folder as SNAPSHOT JARs -# See libs/ directory for the JAR files -kotlin = "2.1.21" +kord = "feature-dave-support-SNAPSHOT" +kotlin = "2.3.10" ktor = "3.1.3" mockk = "1.14.2" slf4j = "2.0.17" @@ -18,6 +17,8 @@ lavaplayer-youtube = "1.17.0" lavaplayer-lavasrc = "4.8.1" idea-ext = "1.1.10" junit-parametized = "5.13.0" +libdave = "0.1.2" +libdave-natives = "0.1.3" [libraries] ktor-client-core = { module = "io.ktor:ktor-client-core", version.ref = "ktor" } @@ -29,7 +30,7 @@ ktor-client-serialization-kotlin-json = { module = "io.ktor:ktor-serialization-k ktor-client-client-resources = { module = "io.ktor:ktor-client-resources", version.ref = "ktor" } ktor-client-client-auth = { module = "io.ktor:ktor-client-auth", version.ref = "ktor" } ktor-client-mock = { module = "io.ktor:ktor-client-mock", version.ref = "ktor" } -# TODO: Re-enable when Kord merges voice encryption branch to main +# Kord - from local JARs in libs/ until DAVE support is merged to main (kord#1063) # kord-core = { module = "dev.kord:kord-core", version.ref = "kord" } # kord-core-voice = { module = "dev.kord:kord-core-voice", version.ref = "kord"} # kord-voice = { module = "dev.kord:kord-voice", version.ref = "kord" } @@ -51,6 +52,12 @@ koin-bom = { module = "io.insert-koin:koin-bom", version.ref = "koin" } koin-core = { module = "io.insert-koin:koin-core" } kotlinx-serialization = { module = "org.jetbrains.kotlinx:kotlinx-serialization-json", version.ref = "serialization" } junit-parametrized = { module = "org.junit.jupiter:junit-jupiter-params", version.ref = "junit-parametized" } +libdave-api = { module = "moe.kyokobot.libdave:api", version.ref = "libdave" } +libdave-impl-jni = { module = "moe.kyokobot.libdave:impl-jni", version.ref = "libdave" } +libdave-natives-darwin = { module = "moe.kyokobot.libdave:natives-darwin", version.ref = "libdave-natives" } +libdave-natives-linuxX64 = { module = "moe.kyokobot.libdave:natives-linux-x86-64", version.ref = "libdave-natives" } +libdave-natives-linuxAarch64 = { module = "moe.kyokobot.libdave:natives-linux-aarch64", version.ref = "libdave-natives" } +libdave-natives-winX64 = { module = "moe.kyokobot.libdave:natives-win-x86-64", version.ref = "libdave-natives" } [plugins] kotlin-jvm = { id = "org.jetbrains.kotlin.jvm", version.ref = "kotlin" } diff --git a/libs/kord-common-feature-dave-support-SNAPSHOT.jar b/libs/kord-common-feature-dave-support-SNAPSHOT.jar new file mode 100644 index 0000000..e4d4149 Binary files /dev/null and b/libs/kord-common-feature-dave-support-SNAPSHOT.jar differ diff --git a/libs/kord-common-jvm-feature-dave-support-SNAPSHOT.jar b/libs/kord-common-jvm-feature-dave-support-SNAPSHOT.jar new file mode 100644 index 0000000..08b6af3 Binary files /dev/null and b/libs/kord-common-jvm-feature-dave-support-SNAPSHOT.jar differ diff --git a/libs/kord-common-jvm-new-voice-encryption-modes-SNAPSHOT.jar b/libs/kord-common-jvm-new-voice-encryption-modes-SNAPSHOT.jar deleted file mode 100644 index be3cdb4..0000000 Binary files a/libs/kord-common-jvm-new-voice-encryption-modes-SNAPSHOT.jar and /dev/null differ diff --git a/libs/kord-common-new-voice-encryption-modes-SNAPSHOT.jar b/libs/kord-common-new-voice-encryption-modes-SNAPSHOT.jar deleted file mode 100644 index 86e480f..0000000 Binary files a/libs/kord-common-new-voice-encryption-modes-SNAPSHOT.jar and /dev/null differ diff --git a/libs/kord-core-feature-dave-support-SNAPSHOT.jar b/libs/kord-core-feature-dave-support-SNAPSHOT.jar new file mode 100644 index 0000000..de78fce Binary files /dev/null and b/libs/kord-core-feature-dave-support-SNAPSHOT.jar differ diff --git a/libs/kord-core-jvm-feature-dave-support-SNAPSHOT.jar b/libs/kord-core-jvm-feature-dave-support-SNAPSHOT.jar new file mode 100644 index 0000000..94c32ac Binary files /dev/null and b/libs/kord-core-jvm-feature-dave-support-SNAPSHOT.jar differ diff --git a/libs/kord-core-jvm-new-voice-encryption-modes-SNAPSHOT.jar b/libs/kord-core-jvm-new-voice-encryption-modes-SNAPSHOT.jar deleted file mode 100644 index a85a06e..0000000 Binary files a/libs/kord-core-jvm-new-voice-encryption-modes-SNAPSHOT.jar and /dev/null differ diff --git a/libs/kord-core-new-voice-encryption-modes-SNAPSHOT.jar b/libs/kord-core-new-voice-encryption-modes-SNAPSHOT.jar deleted file mode 100644 index 9788e93..0000000 Binary files a/libs/kord-core-new-voice-encryption-modes-SNAPSHOT.jar and /dev/null differ diff --git a/libs/kord-core-voice-feature-dave-support-SNAPSHOT.jar b/libs/kord-core-voice-feature-dave-support-SNAPSHOT.jar new file mode 100644 index 0000000..ec6acb0 Binary files /dev/null and b/libs/kord-core-voice-feature-dave-support-SNAPSHOT.jar differ diff --git a/libs/kord-core-voice-new-voice-encryption-modes-SNAPSHOT.jar b/libs/kord-core-voice-new-voice-encryption-modes-SNAPSHOT.jar deleted file mode 100644 index 482f42b..0000000 Binary files a/libs/kord-core-voice-new-voice-encryption-modes-SNAPSHOT.jar and /dev/null differ diff --git a/libs/kord-gateway-feature-dave-support-SNAPSHOT.jar b/libs/kord-gateway-feature-dave-support-SNAPSHOT.jar new file mode 100644 index 0000000..0a6059b Binary files /dev/null and b/libs/kord-gateway-feature-dave-support-SNAPSHOT.jar differ diff --git a/libs/kord-gateway-jvm-feature-dave-support-SNAPSHOT.jar b/libs/kord-gateway-jvm-feature-dave-support-SNAPSHOT.jar new file mode 100644 index 0000000..c1f46e9 Binary files /dev/null and b/libs/kord-gateway-jvm-feature-dave-support-SNAPSHOT.jar differ diff --git a/libs/kord-gateway-jvm-new-voice-encryption-modes-SNAPSHOT.jar b/libs/kord-gateway-jvm-new-voice-encryption-modes-SNAPSHOT.jar deleted file mode 100644 index 3232ffe..0000000 Binary files a/libs/kord-gateway-jvm-new-voice-encryption-modes-SNAPSHOT.jar and /dev/null differ diff --git a/libs/kord-gateway-new-voice-encryption-modes-SNAPSHOT.jar b/libs/kord-gateway-new-voice-encryption-modes-SNAPSHOT.jar deleted file mode 100644 index 00c40a7..0000000 Binary files a/libs/kord-gateway-new-voice-encryption-modes-SNAPSHOT.jar and /dev/null differ diff --git a/libs/kord-ksp-annotations-feature-dave-support-SNAPSHOT.jar b/libs/kord-ksp-annotations-feature-dave-support-SNAPSHOT.jar new file mode 100644 index 0000000..66bf24c Binary files /dev/null and b/libs/kord-ksp-annotations-feature-dave-support-SNAPSHOT.jar differ diff --git a/libs/kord-ksp-annotations-jvm-feature-dave-support-SNAPSHOT.jar b/libs/kord-ksp-annotations-jvm-feature-dave-support-SNAPSHOT.jar new file mode 100644 index 0000000..d572f0b Binary files /dev/null and b/libs/kord-ksp-annotations-jvm-feature-dave-support-SNAPSHOT.jar differ diff --git a/libs/kord-ksp-annotations-jvm-new-voice-encryption-modes-SNAPSHOT.jar b/libs/kord-ksp-annotations-jvm-new-voice-encryption-modes-SNAPSHOT.jar deleted file mode 100644 index 5ee943e..0000000 Binary files a/libs/kord-ksp-annotations-jvm-new-voice-encryption-modes-SNAPSHOT.jar and /dev/null differ diff --git a/libs/kord-ksp-annotations-new-voice-encryption-modes-SNAPSHOT.jar b/libs/kord-ksp-annotations-new-voice-encryption-modes-SNAPSHOT.jar deleted file mode 100644 index fa8f13a..0000000 Binary files a/libs/kord-ksp-annotations-new-voice-encryption-modes-SNAPSHOT.jar and /dev/null differ diff --git a/libs/kord-rest-feature-dave-support-SNAPSHOT.jar b/libs/kord-rest-feature-dave-support-SNAPSHOT.jar new file mode 100644 index 0000000..e5377a0 Binary files /dev/null and b/libs/kord-rest-feature-dave-support-SNAPSHOT.jar differ diff --git a/libs/kord-rest-jvm-feature-dave-support-SNAPSHOT.jar b/libs/kord-rest-jvm-feature-dave-support-SNAPSHOT.jar new file mode 100644 index 0000000..37bb1a9 Binary files /dev/null and b/libs/kord-rest-jvm-feature-dave-support-SNAPSHOT.jar differ diff --git a/libs/kord-rest-jvm-new-voice-encryption-modes-SNAPSHOT.jar b/libs/kord-rest-jvm-new-voice-encryption-modes-SNAPSHOT.jar deleted file mode 100644 index cec5df4..0000000 Binary files a/libs/kord-rest-jvm-new-voice-encryption-modes-SNAPSHOT.jar and /dev/null differ diff --git a/libs/kord-rest-new-voice-encryption-modes-SNAPSHOT.jar b/libs/kord-rest-new-voice-encryption-modes-SNAPSHOT.jar deleted file mode 100644 index f1b5b64..0000000 Binary files a/libs/kord-rest-new-voice-encryption-modes-SNAPSHOT.jar and /dev/null differ diff --git a/libs/kord-voice-feature-dave-support-SNAPSHOT.jar b/libs/kord-voice-feature-dave-support-SNAPSHOT.jar new file mode 100644 index 0000000..ba36301 Binary files /dev/null and b/libs/kord-voice-feature-dave-support-SNAPSHOT.jar differ diff --git a/libs/kord-voice-jvm-feature-dave-support-SNAPSHOT.jar b/libs/kord-voice-jvm-feature-dave-support-SNAPSHOT.jar new file mode 100644 index 0000000..b19d423 Binary files /dev/null and b/libs/kord-voice-jvm-feature-dave-support-SNAPSHOT.jar differ diff --git a/libs/kord-voice-new-voice-encryption-modes-SNAPSHOT.jar b/libs/kord-voice-new-voice-encryption-modes-SNAPSHOT.jar deleted file mode 100644 index 5078c65..0000000 Binary files a/libs/kord-voice-new-voice-encryption-modes-SNAPSHOT.jar and /dev/null differ diff --git a/src/main/kotlin/commands/queue/QueueCommand.kt b/src/main/kotlin/commands/queue/QueueCommand.kt index e68f56a..af5c2a3 100644 --- a/src/main/kotlin/commands/queue/QueueCommand.kt +++ b/src/main/kotlin/commands/queue/QueueCommand.kt @@ -54,7 +54,7 @@ class QueueCommand( key = LocalizationKeys.QUEUE_EMBED_DESCRIPTION, guildId = guildId, discordLocale = discordLocale, - arguments = arrayOf(queue.size, guildName) + arguments = arrayOf(queue.size, guildName) ) val currentPageContent = displayQueue.takeIf { it.isNotEmpty() }?.get(0)?.let { listOf(it) } response.respond { @@ -137,7 +137,7 @@ class QueueCommand( key = LocalizationKeys.QUEUE_EMBED_DESCRIPTION, guildId = guildId, discordLocale = discordLocale, - arguments = arrayOf(queueLength, guildName) + arguments = arrayOf(queueLength, guildName) ) val currentPageContent = displayQueuePage?.let { listOf(it) } interaction.message.edit { diff --git a/src/main/kotlin/services/lavaplayer/GuildLavaPlayerService.kt b/src/main/kotlin/services/lavaplayer/GuildLavaPlayerService.kt index 485ac97..60b660e 100644 --- a/src/main/kotlin/services/lavaplayer/GuildLavaPlayerService.kt +++ b/src/main/kotlin/services/lavaplayer/GuildLavaPlayerService.kt @@ -436,7 +436,7 @@ class GuildLavaPlayerService( key = LocalizationKeys.FOUND_TRACK_LIST, guildId = guildId, discordLocale = discordLocale, - arguments = arrayOf(playlist.name, playlist.tracks.size) + arguments = arrayOf(playlist.name, playlist.tracks.size) ) ) connectToVoiceChannel() @@ -451,14 +451,14 @@ class GuildLavaPlayerService( key = if (addToFront) LocalizationKeys.NEXT_ADDED_SONGS_TO_QUEUE_WITH_LINK else LocalizationKeys.ADDED_SONGS_TO_QUEUE_WITH_LINK, guildId = guildId, discordLocale = discordLocale, - arguments = arrayOf(playlist.name.toSanitizedMarkdownLink(playlistUrl), playlist.tracks.size) + arguments = arrayOf(playlist.name.toSanitizedMarkdownLink(playlistUrl), playlist.tracks.size) ) } else { localizationService.getStringFormat( key = if (addToFront) LocalizationKeys.NEXT_ADDED_SONGS_TO_QUEUE else LocalizationKeys.ADDED_SONGS_TO_QUEUE, guildId = guildId, discordLocale = discordLocale, - arguments = arrayOf(playlist.name, playlist.tracks.size) + arguments = arrayOf(playlist.name, playlist.tracks.size) ) } } diff --git a/src/main/resources/simplelogger.properties b/src/main/resources/simplelogger.properties index 8997b9c..8f159dd 100644 --- a/src/main/resources/simplelogger.properties +++ b/src/main/resources/simplelogger.properties @@ -4,7 +4,8 @@ # Default logging detail level for all instances of SimpleLogger. # Must be one of ("trace", "debug", "info", "warn", or "error"). # If not specified, defaults to "info". -org.slf4j.simpleLogger.defaultLogLevel=info +org.slf4j.simpleLogger.defaultLogLevel=trace +org.slf4j.simpleLogger.logFile=logs/bot.log # Logging detail level for a SimpleLogger instance named "xxxxx". # Must be one of ("trace", "debug", "info", "warn", or "error"). diff --git a/src/test/kotlin/mock/DiscordMocks.kt b/src/test/kotlin/mock/DiscordMocks.kt index 73ac78a..b685c83 100644 --- a/src/test/kotlin/mock/DiscordMocks.kt +++ b/src/test/kotlin/mock/DiscordMocks.kt @@ -3,6 +3,8 @@ package mock import dev.kord.common.entity.DiscordMessage import dev.kord.common.entity.DiscordUser import dev.kord.common.entity.Snowflake +import dev.kord.common.entity.optional.Optional +import dev.kord.common.entity.optional.OptionalInt import dev.kord.core.Kord import dev.kord.core.behavior.channel.BaseVoiceChannelBehavior import dev.kord.core.behavior.interaction.response.DeferredPublicMessageInteractionResponseBehavior @@ -30,7 +32,7 @@ val mockUser = mockk { every { publicFlags } returns mockk() every { banner } returns null every { accentColor } returns null - every { avatarDecoration } returns mockk() + every { avatarDecorationData } returns Optional.Missing() } val mockedMessage = mockk { @@ -62,10 +64,14 @@ val mockedDiscordMessage = mockk { every { application } returns mockk() every { applicationId } returns mockk() every { messageReference } returns mockk() + every { messageSnapshots } returns Optional.Missing() every { flags } returns mockk() every { stickers } returns mockk() every { referencedMessage } returns mockk() + every { interactionMetadata } returns Optional.Missing() every { interaction } returns mockk() + every { thread } returns Optional.Missing() + every { position } returns OptionalInt.Missing every { components } returns mockk() every { roleSubscriptionData } returns mockk() every { id } returns mockk()