diff --git a/build.gradle.kts b/build.gradle.kts index a1f35c5..21e207e 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -28,16 +28,18 @@ subprojects { } dependencies { - taboo(files("/libs/OneBot-Client-0.4.1.jar")) + taboo("love.forte.simbot:simbot-core:4.6.0") + taboo("love.forte.simbot.component:simbot-component-onebot-v11-core:1.3.0") taboo("com.github.SNWCreations:KookBC:0.27.4") compileOnly("ink.ptms.core:v12004:12004:mapped") compileOnly("ink.ptms.core:v12004:12004:universal") compileOnly(kotlin("stdlib")) + runtimeOnly("io.ktor:ktor-client-java:2.3.12") } java { - sourceCompatibility = JavaVersion.VERSION_1_8 - targetCompatibility = JavaVersion.VERSION_1_8 + sourceCompatibility = JavaVersion.VERSION_11 + targetCompatibility = JavaVersion.VERSION_11 } tasks.withType { @@ -46,7 +48,7 @@ subprojects { tasks.withType { kotlinOptions { - jvmTarget = "1.8" + jvmTarget = "11" freeCompilerArgs = listOf("-Xjvm-default=all") } } diff --git a/common/src/main/kotlin/me/regadpole/plumbot/bot/QQBot.kt b/common/src/main/kotlin/me/regadpole/plumbot/bot/QQBot.kt index 72f2326..9ffd8cb 100644 --- a/common/src/main/kotlin/me/regadpole/plumbot/bot/QQBot.kt +++ b/common/src/main/kotlin/me/regadpole/plumbot/bot/QQBot.kt @@ -3,6 +3,14 @@ package me.regadpole.plumbot.bot import cn.evole.onebot.client.OneBotClient import cn.evole.onebot.client.core.BotConfig import cn.evole.onebot.sdk.util.MsgUtils +import io.ktor.http.* +import love.forte.simbot.application.Application +import love.forte.simbot.application.launchApplication +import love.forte.simbot.component.onebot.v11.core.bot.OneBotBotConfiguration +import love.forte.simbot.component.onebot.v11.core.bot.firstOneBotBotManager +import love.forte.simbot.component.onebot.v11.core.useOneBot11 +import love.forte.simbot.core.application.Simple +import love.forte.simbot.core.application.launchSimpleApplication import me.regadpole.plumbot.PlumBot import me.regadpole.plumbot.listener.qq.QQListener import taboolib.common.platform.function.info @@ -34,6 +42,29 @@ class QQBot(private val plugin: PlumBot): Bot { return this } + private suspend fun startOnebot() { + val app = launchApplication(Simple) { + useOneBot11() + } + + app.configure() + app.join() + } + + private suspend fun Application.configure() { + val botManager = botManagers.firstOneBotBotManager() + val bot = botManager.register( + OneBotBotConfiguration().apply { + botUniqueId = "11112222" + apiServerHost = Url("http://127.0.0.1:3000") + eventServerHost = Url("ws://127.0.0.1:3001") + accessToken = null + /// ... + } + ) + bot.start() + } + /** * Stop a bot */ diff --git a/libs/OneBot-Client-0.4.1.jar b/libs/OneBot-Client-0.4.1.jar deleted file mode 100644 index e3b6796..0000000 Binary files a/libs/OneBot-Client-0.4.1.jar and /dev/null differ