Skip to content

Commit

Permalink
Merge pull request #125 from simple-robot/dev/main
Browse files Browse the repository at this point in the history
Release: v4.0.0-beta2
  • Loading branch information
ForteScarlet authored Mar 3, 2024
2 parents fda0c0f + bcba7fc commit 6a4fdb9
Show file tree
Hide file tree
Showing 8 changed files with 54 additions and 25 deletions.
7 changes: 7 additions & 0 deletions .changelog/v4.0.0-beta2.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
> 对应核心版本: [**v4.0.0-beta1**](https://github.com/simple-robot/simpler-robot/releases/tag/v4.0.0-beta1)

我们欢迎并期望着您的的[反馈](https://github.com/simple-robot/simbot-component-qq-guild/issues)[协助](https://github.com/simple-robot/simbot-component-qq-guild/pulls)
感谢您的贡献与支持!

也欢迎您为我们献上一颗 `star`,这是对我们最大的鼓励与认可!
1 change: 1 addition & 0 deletions .github/workflows/test-branch.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ on:
- '*/src/*/kotlin/**'
- '*/src/*/java/**'
- '*/src/*/resource/**'
- 'gradle/**'

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
Expand Down
4 changes: 2 additions & 2 deletions Writerside/v.list
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@
<vars>
<var name="jb" value="阻塞"/>
<var name="ja" value="异步"/>
<var name="version" value="4.0.0-dev8"/>
<var name="minimum-core-version" value="4.0.0-dev18"/>
<var name="version" value="4.0.0-beta2"/>
<var name="minimum-core-version" value="4.0.0-beta1"/>
</vars>
14 changes: 7 additions & 7 deletions buildSrc/src/main/kotlin/K2Config.kt
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,14 @@
*/

import org.gradle.api.Project
import org.gradle.kotlin.dsl.withType


fun Project.useK2(languageVersion: String = "2.0") {
tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile> {
kotlinOptions {
// useK2
this.languageVersion = languageVersion
}
}
logger.warn("暂时关闭 K2, 直到 Kotlin 2.0 稳定版发布。languageVersion = $languageVersion")
// tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile> {
// kotlinOptions {
// // useK2
// this.languageVersion = languageVersion
// }
// }
}
2 changes: 1 addition & 1 deletion buildSrc/src/main/kotlin/P.kt
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ object P {
override val homepage: String get() = HOMEPAGE


private val baseVersion = v(4, 0, 0) - v("beta1")
private val baseVersion = v(4, 0, 0) - v("beta2")

val snapshotVersion = baseVersion - Version.SNAPSHOT
override val version = if (isSnapshot()) snapshotVersion else baseVersion
Expand Down
6 changes: 3 additions & 3 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
[versions]
kotlin = "1.9.22"
kotlinx-coroutines = "1.8.0"
kotlinx-serialization = "1.6.2"
kotlinx-serialization = "1.6.3"
kotlinx-datetime = "0.5.0"
dokka = "1.9.10"
okio = "3.3.0"
ktor = "2.3.7"
ktor = "2.3.8"
openjdk-jmh = "1.37"
log4j = "2.20.0"
log4j = "2.23.0"
reactor = "3.6.2"
# simbot
simbot = "4.0.0-beta1"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,11 @@

package love.forte.simbot.component.qguild.message

import love.forte.simbot.annotations.ExperimentalSimbotAPI
import love.forte.simbot.component.qguild.ExperimentalQGApi
import love.forte.simbot.message.Messages
import love.forte.simbot.message.emptyMessages
import love.forte.simbot.qguild.api.message.MessageSendApi
import love.forte.simbot.qguild.model.Message
import kotlin.contracts.ExperimentalContracts
import kotlin.contracts.InvocationKind
import kotlin.contracts.contract
import kotlin.jvm.JvmName
import kotlin.jvm.JvmOverloads
import love.forte.simbot.message.Message as SimbotMessage
Expand Down Expand Up @@ -184,21 +180,14 @@ public object MessageParsers {
*
* @return 解析结果的 [MessageSendApi.Body.Builder] 序列。
*/
@OptIn(ExperimentalSimbotAPI::class, ExperimentalContracts::class, ExperimentalQGApi::class)
@OptIn(ExperimentalQGApi::class)
@JvmOverloads
@JvmName("parse")
public suspend inline fun parse(
message: SimbotMessage,
crossinline onEachPre: MessageSendApi.Body.Builder.() -> Unit = {},
onEachPost: MessageSendApi.Body.Builder.() -> Unit = {},
): List<MessageSendApi.Body.Builder> {
contract {
callsInPlace(onEachPre, InvocationKind.AT_LEAST_ONCE)
callsInPlace(onEachPost, InvocationKind.AT_LEAST_ONCE)
}

// val builder = MessageSendApi.Body.Builder().also(onEachPre)

val context = SendingMessageParser.BuilderContext { MessageSendApi.Body.Builder().also(onEachPre) }

when (message) {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import love.forte.simbot.common.id.ID
import love.forte.simbot.component.qguild.bot.QGBot
import love.forte.simbot.component.qguild.message.QGMessageReceipt
import love.forte.simbot.suspendrunner.reserve.SuspendReserve
import java.util.concurrent.CompletableFuture
import kotlin.test.Test
import kotlin.test.assertEquals

/**
*
* @author ForteScarlet
*/
class QGBotSuspendTransFunctionTests {

@Test
fun checkQGBotSTFunctions() {
/*
@ST
public suspend fun sendTo(channelId: ID, text: String): QGMessageReceipt
*/
with(QGBot::class.java.getMethod("sendToBlocking", ID::class.java, String::class.java)) {
assertEquals(QGMessageReceipt::class.java, returnType)
}
with(QGBot::class.java.getMethod("sendToAsync", ID::class.java, String::class.java)) {
assertEquals(CompletableFuture::class.java, returnType)
}
with(QGBot::class.java.getMethod("sendToReserve", ID::class.java, String::class.java)) {
assertEquals(SuspendReserve::class.java, returnType)
}
}

}

0 comments on commit 6a4fdb9

Please sign in to comment.