simple-robot / simbot-component-onebot

一个Kotlin多平台的 OneBot SDK 实现,一个异步高效、Java 友好的 Simple Robot 组件库 ~ 🐱🐱🐱
https://simbot.forte.love/component-onebot.html
GNU Lesser General Public License v3.0
10 stars 3 forks source link

bot 被禁言时尝试回复消息,raw 消息解析抛出异常 #75

Closed Ant00000ny closed 3 months ago

Ant00000ny commented 3 months ago

使用 NapCat 作为 OneBot 实现,bot 被禁言的状态下尝试回复群消息时报错:

java.lang.IllegalStateException: `data` is null, this result may mean a failure: retcode=200, status=failed, raw={"status":"failed","retcode":200,"data":null,"message":"发送超时","wording":"发送超时","echo":null}
        at love.forte.simbot.component.onebot.v11.core.api.OneBotApiResult.getDataOrThrow(OneBotApi.kt:121) ~[simbot-component-onebot-v11-core-jvm-1.0.0.jar!/:na]
        at love.forte.simbot.component.onebot.v11.core.api.OneBotApiRequests__OneBotApiRequestsKt.requestData(OneBotApiRequests.kt:339) ~[simbot-component-onebot-v11-core-jvm-1.0.0.jar!/:na]
        at love.forte.simbot.component.onebot.v11.core.api.OneBotApiRequests.requestData(Unknown Source) ~[simbot-component-onebot-v11-core-jvm-1.0.0.jar!/:na]
        at love.forte.simbot.component.onebot.v11.core.api.OneBotApiRequests__OneBotApiRequestsKt$requestData$1.invokeSuspend(OneBotApiRequests.kt) ~[simbot-component-onebot-v11-core-jvm-1.0.0.jar!/:na]
        at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33) ~[kotlin-stdlib-2.0.0.jar!/:2.0.0-release-341]
        at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:104) ~[kotlinx-coroutines-core-jvm-1.8.1.jar!/:na]
        at kotlinx.coroutines.internal.LimitedDispatcher$Worker.run(LimitedDispatcher.kt:111) ~[kotlinx-coroutines-core-jvm-1.8.1.jar!/:na]
        at kotlinx.coroutines.scheduling.TaskImpl.run(Tasks.kt:99) ~[kotlinx-coroutines-core-jvm-1.8.1.jar!/:na]
        at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:584) ~[kotlinx-coroutines-core-jvm-1.8.1.jar!/:na]
        at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:811) ~[kotlinx-coroutines-core-jvm-1.8.1.jar!/:na]
        at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:715) ~[kotlinx-coroutines-core-jvm-1.8.1.jar!/:na]
        at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:702) ~[kotlinx-coroutines-core-jvm-1.8.1.jar!/:na]

相关依赖版本:

    implementation("love.forte.simbot:simbot-core-spring-boot-starter:4.3.1")
    implementation("love.forte.simbot.component:simbot-component-onebot-v11-core-jvm:1.0.0")
    implementation("io.ktor:ktor-client-java-jvm:2.3.12")

NapCat:1.5.5

ForteScarlet commented 3 months ago

服务端响应了错误:"message":"发送超时","wording":"发送超时",因此报错是预期情况。 但不知道 "发送超时" 是否是 "bot 被禁言的状态下尝试回复群消息时" 的预期错误,可以看看NapCat的服务端日志是否有什么线索?

Ant00000ny commented 3 months ago

日志报了 ERROR,是 NapCat 的预期错误也是 simbot 的预期错误,那看来是合理的...

ForteScarlet commented 3 months ago

如果 "retcode":200 能变成一个看上去更合理的数字就更好了