From 10834bfa167b15376bfafb736109e7d019f32490 Mon Sep 17 00:00:00 2001 From: Luca Kellermann Date: Thu, 12 Sep 2024 22:17:45 +0200 Subject: [PATCH] Imports, formatting --- README.md | 2 +- gradle/libs.versions.toml | 1 + rest/src/commonTest/kotlin/request/MessageRequests.kt | 2 -- .../src/commonMain/kotlin/dev/kord/gateway/GatewayExample.kt | 4 ++-- samples/src/jvmMain/kotlin/runMain.jvm.kt | 4 +--- voice/src/commonMain/kotlin/udp/DefaultAudioFrameSender.kt | 1 - voice/src/commonMain/kotlin/udp/ipDiscovery.kt | 3 +-- voice/src/jsMain/kotlin/udp/VoiceUdpSocket.js.kt | 1 - .../dev/kord/voice/encryption/XSalsa20Poly1305Encryption.kt | 1 - .../jvmMain/kotlin/dev/kord/voice/streams/DefaultStreams.kt | 1 + 10 files changed, 7 insertions(+), 13 deletions(-) diff --git a/README.md b/README.md index 659633939224..f20a05979d1e 100644 --- a/README.md +++ b/README.md @@ -47,7 +47,7 @@ mapping of the Voice API on Kotlin/JVM | [core-voice](core-voice) | [core-voice](https://kordlib.github.io/kord/core-voice) | `kord-core-voice`¹ | ✅ | ✅ | ✅² | ¹ These artifacts only supports Gradle Version 5.3 or higher, for older Gradle versions and Maven please append `-jvm` -² Currently not on Windows(MinGW) targets, see #69 +² Currently not on Windows(MinGW) targets, see #69 ## Installation diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index d7b57b401708..79ff5902d775 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -37,6 +37,7 @@ buildconfig = "5.4.0" # https://github.com/gmazzo/gradle-buildconfig-plugin kord-gradle-tools = "1.6.2" # https://github.com/kordlib/gradle-tools/blob/main/build.gradle.kts#L10 maven-publish-plugin = "0.29.0" # https://github.com/vanniktech/gradle-maven-publish-plugin + [libraries] # cache diff --git a/rest/src/commonTest/kotlin/request/MessageRequests.kt b/rest/src/commonTest/kotlin/request/MessageRequests.kt index a49498723ed8..bb3827f74708 100644 --- a/rest/src/commonTest/kotlin/request/MessageRequests.kt +++ b/rest/src/commonTest/kotlin/request/MessageRequests.kt @@ -9,11 +9,9 @@ import dev.kord.common.entity.optional.Optional import dev.kord.rest.json.readFile import dev.kord.rest.service.ChannelService import dev.kord.test.IgnoreOnSimulatorPlatforms -import dev.kord.test.Platform import io.ktor.client.* import io.ktor.client.engine.mock.* import io.ktor.client.request.forms.* -import io.ktor.utils.io.* import kotlinx.coroutines.test.runTest import kotlinx.datetime.Clock import kotlinx.serialization.encodeToString diff --git a/samples/src/commonMain/kotlin/dev/kord/gateway/GatewayExample.kt b/samples/src/commonMain/kotlin/dev/kord/gateway/GatewayExample.kt index 02e1fb0a4c35..60d729f90111 100644 --- a/samples/src/commonMain/kotlin/dev/kord/gateway/GatewayExample.kt +++ b/samples/src/commonMain/kotlin/dev/kord/gateway/GatewayExample.kt @@ -19,7 +19,7 @@ suspend fun main(args: Array) { gateway.events.filterIsInstance().onEach { val words = it.message.content.split(' ') when (words.firstOrNull()) { - "!close" -> gateway.stop() + "!close" -> gateway.stop() "!detach" -> gateway.detach() "!status" -> when (words.getOrNull(1)) { "playing" -> gateway.editPresence { @@ -29,7 +29,7 @@ suspend fun main(args: Array) { } } - "!ping" -> gateway.editPresence { + "!ping" -> gateway.editPresence { status = PresenceStatus.Online afk = false listening("a ${gateway.ping.value?.inWholeMilliseconds} ms ping") diff --git a/samples/src/jvmMain/kotlin/runMain.jvm.kt b/samples/src/jvmMain/kotlin/runMain.jvm.kt index 1166532b1e4b..48392f5b7001 100644 --- a/samples/src/jvmMain/kotlin/runMain.jvm.kt +++ b/samples/src/jvmMain/kotlin/runMain.jvm.kt @@ -1,8 +1,6 @@ import kotlinx.coroutines.CoroutineScope -import kotlinx.coroutines.GlobalScope -import kotlinx.coroutines.launch import kotlinx.coroutines.runBlocking actual fun runMain(block: suspend CoroutineScope.() -> Unit) { runBlocking { block() } -} \ No newline at end of file +} diff --git a/voice/src/commonMain/kotlin/udp/DefaultAudioFrameSender.kt b/voice/src/commonMain/kotlin/udp/DefaultAudioFrameSender.kt index c1d835eac5ab..f0316424563e 100644 --- a/voice/src/commonMain/kotlin/udp/DefaultAudioFrameSender.kt +++ b/voice/src/commonMain/kotlin/udp/DefaultAudioFrameSender.kt @@ -6,7 +6,6 @@ import dev.kord.voice.AudioProvider import dev.kord.voice.FrameInterceptor import dev.kord.voice.encryption.strategies.NonceStrategy import io.github.oshai.kotlinlogging.KotlinLogging -import io.ktor.utils.io.core.* import kotlinx.coroutines.channels.Channel import kotlinx.coroutines.coroutineScope import kotlinx.coroutines.flow.* diff --git a/voice/src/commonMain/kotlin/udp/ipDiscovery.kt b/voice/src/commonMain/kotlin/udp/ipDiscovery.kt index 21628f77d180..abfdf16536ad 100644 --- a/voice/src/commonMain/kotlin/udp/ipDiscovery.kt +++ b/voice/src/commonMain/kotlin/udp/ipDiscovery.kt @@ -3,7 +3,6 @@ package dev.kord.voice.udp import dev.kord.voice.io.mutableCursor import dev.kord.voice.io.view import io.github.oshai.kotlinlogging.KotlinLogging -import io.ktor.utils.io.core.* import kotlinx.io.readByteArray import kotlinx.io.readUShort @@ -39,4 +38,4 @@ public suspend fun VoiceUdpSocket.discoverIP(address: SocketAddress, ssrc: Int): SocketAddress(ip, port) } -} \ No newline at end of file +} diff --git a/voice/src/jsMain/kotlin/udp/VoiceUdpSocket.js.kt b/voice/src/jsMain/kotlin/udp/VoiceUdpSocket.js.kt index 89361b574cf5..08d4e7b382be 100644 --- a/voice/src/jsMain/kotlin/udp/VoiceUdpSocket.js.kt +++ b/voice/src/jsMain/kotlin/udp/VoiceUdpSocket.js.kt @@ -1,6 +1,5 @@ package dev.kord.voice.udp -import dev.kord.common.annotation.KordVoice import dev.kord.voice.io.ByteArrayView import io.ktor.utils.io.core.* import js.typedarrays.toUint8Array diff --git a/voice/src/jvmMain/kotlin/dev/kord/voice/encryption/XSalsa20Poly1305Encryption.kt b/voice/src/jvmMain/kotlin/dev/kord/voice/encryption/XSalsa20Poly1305Encryption.kt index 47363cfbfc61..808e9d502ae9 100644 --- a/voice/src/jvmMain/kotlin/dev/kord/voice/encryption/XSalsa20Poly1305Encryption.kt +++ b/voice/src/jvmMain/kotlin/dev/kord/voice/encryption/XSalsa20Poly1305Encryption.kt @@ -5,7 +5,6 @@ import com.iwebpp.crypto.TweetNaclFast.SecretBox.boxzerobytesLength import com.iwebpp.crypto.TweetNaclFast.SecretBox.zerobytesLength import dev.kord.voice.io.MutableByteArrayCursor - // https://datatracker.ietf.org/doc/html/rfc6716#section-3.2.1 private const val OPUS_MAX_LENGTH = 1276 diff --git a/voice/src/jvmMain/kotlin/dev/kord/voice/streams/DefaultStreams.kt b/voice/src/jvmMain/kotlin/dev/kord/voice/streams/DefaultStreams.kt index 2e91381139c4..28b0ab5f817b 100644 --- a/voice/src/jvmMain/kotlin/dev/kord/voice/streams/DefaultStreams.kt +++ b/voice/src/jvmMain/kotlin/dev/kord/voice/streams/DefaultStreams.kt @@ -1,4 +1,5 @@ @file:JvmName("DefaultStreamsJvm") + package dev.kord.voice.streams import com.iwebpp.crypto.TweetNaclFast