Skip to content

Commit a8f1df8

Browse files
committed
v4.0.0-dev1
1 parent 9a472fc commit a8f1df8

File tree

6 files changed

+63
-6
lines changed

6 files changed

+63
-6
lines changed

.changelog/v4.0.0-dev1.md

Whitespace-only changes.

CHANGELOG.md

+21
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,24 @@
1+
# v4.0.0-dev1
2+
> [!warning]
3+
> 这是一个尚在开发中的**预览版**,它可能不稳定,可能会频繁变更,且没有可用性保证。
4+
5+
6+
> Release & Pull Notes: [v4.0.0-dev1](https://github.com/simple-robot/simpler-robot/releases/tag/v4.0.0-dev1)
7+
8+
- feat: Collectable ([`5d145237`](https://github.com/simple-robot/simpler-robot/commit/5d145237))
9+
- feat: ID、Timestamp and Job link ([`60f8634f`](https://github.com/simple-robot/simpler-robot/commit/60f8634f))
10+
- feat: Timestamp ([`3db7aa8f`](https://github.com/simple-robot/simpler-robot/commit/3db7aa8f))
11+
- feat: (WIP) multiplatform ID ([`5eafba6e..1727015e`](https://github.com/simple-robot/simpler-robot/compare/5eafba6e..v3.3.0))
12+
13+
<details><summary><code>5eafba6e..1727015e</code></summary>
14+
15+
- [`5eafba6e`](https://github.com/simple-robot/simpler-robot/commit/5eafba6e)
16+
- [`3e0919a2`](https://github.com/simple-robot/simpler-robot/commit/3e0919a2)
17+
- [`1727015e`](https://github.com/simple-robot/simpler-robot/commit/1727015e)
18+
19+
</details>
20+
21+
122
# v3.3.0
223

324
> Release & Pull Notes: [v3.3.0](https://github.com/simple-robot/simpler-robot/releases/tag/v3.3.0)

build.gradle.kts

+1
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ plugins {
2929
id("com.github.gmazzo.buildconfig") version "4.1.2" apply false
3030
id("io.gitlab.arturbosch.detekt")
3131
id("simbot.nexus-publish")
32+
id("simbot.changelog-generator")
3233
}
3334

3435
setup(P.Simbot)

buildSrc/src/main/kotlin/changelog/GenerateChangelog.kt

+9
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,15 @@ fun Project.generateChangelog(tag: String) {
160160

161161
FileWriter(rootChangelogFile).buffered().use { writer ->
162162
writer.appendLine("# $tag")
163+
if ("-dev" in tag) {
164+
writer.appendLine(
165+
"""
166+
> [!warning]
167+
> 这是一个尚在开发中的**预览版**,它可能不稳定,可能会频繁变更,且没有可用性保证。
168+
169+
""".trimIndent()
170+
)
171+
}
163172
writer.appendLine(
164173
"""
165174

simbot-api/src/commonMain/kotlin/love/forte/simbot/event/EventProcessor.kt

+27
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ package love.forte.simbot.event
2828
import kotlinx.coroutines.CoroutineScope
2929
import kotlinx.coroutines.Job
3030
import kotlinx.coroutines.flow.*
31+
import kotlinx.coroutines.launch
3132
import kotlin.jvm.JvmMultifileClass
3233
import kotlin.jvm.JvmName
3334
import kotlin.jvm.JvmSynthetic
@@ -179,6 +180,32 @@ public interface EventProcessor {
179180
}
180181

181182

183+
/**
184+
* 将事件推送并异步处理。
185+
*/
186+
@JvmSynthetic
187+
public fun EventProcessor.pushAndLaunch(
188+
scope: CoroutineScope,
189+
event: Event,
190+
collector: FlowCollector<EventResult>? = null,
191+
): Job = scope.launch {
192+
with(push(event)) {
193+
if (collector != null) collect(collector) else collect()
194+
}
195+
}
196+
197+
/**
198+
* 将事件推送并异步处理。
199+
*/
200+
@JvmSynthetic
201+
public inline fun EventProcessor.pushAndLaunchThen(
202+
scope: CoroutineScope,
203+
event: Event,
204+
crossinline useFlow: (Flow<EventResult>) -> Unit
205+
): Job = scope.launch {
206+
useFlow(push(event))
207+
}
208+
182209
/**
183210
* 将事件推送并收集处理。
184211
*/

simbot-commons/simbot-common-suspend-runner/src/jvmTest/kotlin/love/forte/simbot/suspendrunner/JvmReserveTests.kt

+5-6
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,13 @@
2323

2424
package love.forte.simbot.suspendrunner
2525

26-
import kotlinx.coroutines.DelicateCoroutinesApi
27-
import kotlinx.coroutines.GlobalScope
26+
import kotlinx.coroutines.Dispatchers
2827
import kotlinx.coroutines.delay
28+
import kotlinx.coroutines.test.runTest
2929
import love.forte.simbot.annotations.InternalSimbotAPI
3030
import love.forte.simbot.suspendrunner.reserve.mono
3131
import love.forte.simbot.suspendrunner.reserve.suspendReserve
3232
import reactor.test.StepVerifier
33-
import kotlin.coroutines.EmptyCoroutineContext
3433
import kotlin.test.Test
3534

3635

@@ -40,10 +39,10 @@ import kotlin.test.Test
4039
*/
4140
class JvmReserveTests {
4241

43-
@OptIn(InternalSimbotAPI::class, DelicateCoroutinesApi::class)
42+
@OptIn(InternalSimbotAPI::class)
4443
@Test
45-
fun jvmReserveMonoTest() {
46-
val reserve = suspendReserve(GlobalScope, EmptyCoroutineContext) { run() }
44+
fun jvmReserveMonoTest() = runTest {
45+
val reserve = suspendReserve(this, Dispatchers.Default) { run() }
4746
val mono = reserve.transform(mono())
4847

4948
StepVerifier.create(mono)

0 commit comments

Comments
 (0)