-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Update Kotlin to 1.9.0 - Update Kmongo to 4.10.0 - Update coroutines to 1.7.3 - Update serialization to 1.6.0-RC - Update KSP to 1.9.0-1.0.11 - Bump JDK requirement to 20 - Fix a bug in /fix command causing an exception when trying to re-establish voice connection - Fix support for /redeploy in MusicPlugin - Add support for Loom - Use Loom to call YouTube client - Use IO Dispatcher for Kord and related coroutines
- Loading branch information
1 parent
8bc7c3d
commit aa8d2e5
Showing
15 changed files
with
80 additions
and
28 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
18 changes: 18 additions & 0 deletions
18
api/src/main/kotlin/dev/schlaubi/mikbot/plugin/api/util/LoomDispatcher.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
package dev.schlaubi.mikbot.plugin.api.util | ||
|
||
import kotlinx.coroutines.CoroutineDispatcher | ||
import kotlinx.coroutines.CoroutineScope | ||
import kotlinx.coroutines.asCoroutineDispatcher | ||
import kotlinx.coroutines.withContext | ||
import java.util.concurrent.Executors | ||
|
||
/** | ||
* Coroutine dispatcher using [Executors.newVirtualThreadPerTaskExecutor] for dispatching. | ||
*/ | ||
public val loomDispatcher: CoroutineDispatcher = Executors.newVirtualThreadPerTaskExecutor() | ||
.asCoroutineDispatcher() | ||
|
||
/** | ||
* Executes the oncoming block using [loomDispatcher]. | ||
*/ | ||
public suspend fun <T> blocking(block: suspend CoroutineScope.() -> T): T = withContext(loomDispatcher, block) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
subprojects { | ||
version = "3.0.6-SNAPSHOT" | ||
version = "3.1.0-SNAPSHOT" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 4 additions & 0 deletions
4
music/player/src/main/kotlin/dev/schlaubi/mikmusic/player/TrackLogic.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 24 additions & 0 deletions
24
music/player/src/main/kotlin/dev/schlaubi/mikmusic/util/JsonElementSerializer.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package dev.schlaubi.mikmusic.util | ||
|
||
import kotlinx.serialization.KSerializer | ||
import kotlinx.serialization.descriptors.PrimitiveKind | ||
import kotlinx.serialization.descriptors.PrimitiveSerialDescriptor | ||
import kotlinx.serialization.descriptors.SerialDescriptor | ||
import kotlinx.serialization.encoding.Decoder | ||
import kotlinx.serialization.encoding.Encoder | ||
import kotlinx.serialization.json.Json | ||
import kotlinx.serialization.json.JsonElement | ||
import kotlinx.serialization.json.JsonObject | ||
|
||
object JsonObjectSerializer : JsonElementSerializer<JsonObject>() { | ||
override val serializer: KSerializer<JsonObject> = JsonObject.serializer() | ||
} | ||
|
||
abstract class JsonElementSerializer<T : JsonElement> : KSerializer<T> { | ||
protected abstract val serializer: KSerializer<T> | ||
override val descriptor: SerialDescriptor = PrimitiveSerialDescriptor("JsonStringSerializer", PrimitiveKind.STRING) | ||
|
||
override fun deserialize(decoder: Decoder): T = Json.decodeFromString(serializer, decoder.decodeString()) | ||
override fun serialize(encoder: Encoder, value: T) = | ||
encoder.encodeString(Json.encodeToString(serializer, value)) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters