Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Question] 使用 CQ:image 发送图片时出现错误 #97

Open
Ice-Hazymoon opened this issue Sep 14, 2020 · 2 comments
Open

[Question] 使用 CQ:image 发送图片时出现错误 #97

Ice-Hazymoon opened this issue Sep 14, 2020 · 2 comments
Labels
help wanted Extra attention is needed

Comments

@Ice-Hazymoon
Copy link

[0m 19:57:20 [INFO] [BOT 2748164308] [~(117474650)] Ice-Hazymoon?(1733708055) -> [mirai:source:17921,536993175]/搜图[mirai:image:{00F47A9C-3DE3-450D-7CFF-B98118305F8E}.mirai]�[39;49m
�[0m 19:57:26 �[38;5;207m[DEBUG]�[39;49m [CQHTTPMirai] HTTP API response: {"status":"async","retcode":1,"data":null,"echo":null}�[39;49m
�[0m 19:57:26 �[38;5;207m[DEBUG]�[39;49m [CQHTTPMirai] HTTP API Received: {"group_id":117474650,"message":"[CQ:at,qq=1733708055]
-------------------->
[CQ:image,file=file:///C:\Users\Administrator\Desktop\cqqbot\tmp\u8e7l3slr6s.png]
相似度:67.03%
https://www.pixiv.net/artworks/78171158","auto_escape":"false"}�[39;49m
Exception in thread "DefaultDispatcher-worker-1" kotlinx.serialization.json.internal.JsonDecodingException: Unexpected JSON token at offset 104: Invalid escaped char 'U'
JSON input: .....->
[CQ:image,file=file:///C:\Users\Administrator\Desktop\cqq.....
        at kotlinx.serialization.json.internal.JsonExceptionsKt.JsonDecodingException(JsonExceptions.kt:30)
        at kotlinx.serialization.json.internal.JsonReader.fail(JsonReader.kt:329)
        at kotlinx.serialization.json.internal.JsonReader.appendEsc(JsonReader.kt:278)
        at kotlinx.serialization.json.internal.JsonReader.nextString(JsonReader.kt:249)
        at kotlinx.serialization.json.internal.JsonReader.nextToken(JsonReader.kt:213)
        at kotlinx.serialization.json.internal.JsonParser.readObject(JsonParser.kt:26)
        at kotlinx.serialization.json.internal.JsonParser.read(JsonParser.kt:82)
        at kotlinx.serialization.json.internal.StreamingJsonDecoder.decodeJsonElement(StreamingJsonDecoder.kt:37)
        at kotlinx.serialization.json.JsonElementSerializer.deserialize(JsonElementSerializers.kt:52)
        at kotlinx.serialization.json.JsonElementSerializer.deserialize(JsonElementSerializers.kt:30)
        at kotlinx.serialization.json.internal.PolymorphicKt.decodeSerializableValuePolymorphic(Polymorphic.kt:62)
        at kotlinx.serialization.json.internal.StreamingJsonDecoder.decodeSerializableValue(StreamingJsonDecoder.kt:40)
        at kotlinx.serialization.json.Json.decodeFromString(Json.kt:85)
        at kotlinx.serialization.json.Json.parseToJsonElement(Json.kt:113)
        at tech.mihoyo.mirai.web.http.HttpApiModuleKt.paramsToJson(HttpApiModule.kt:261)
        at tech.mihoyo.mirai.web.http.HttpApiModuleKt$cqHttpApiServer$1$$special$$inlined$cqHttpApi$6$1$1.invokeSuspend(HttpApiModule.kt:299)
        at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
        at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:56)
        at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:571)
        at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:738)
        at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:678)
        at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:665)
�[0m 19:57:33 [INFO] [NETWORK] Send: Heartbeat.Alive�[39;49m
�[0m 19:57:33 [INFO] [NETWORK] Recv: Heartbeat.Alive.Response�[39;49m

图片地址检查过是存在的,不知道是不是不支持 [CQ:image,file=file:///C:\Users\Administrator\Desktop\cqqbot\tmp\u8e7l3slr6s.png] 这种格式的CQ码

@Ice-Hazymoon Ice-Hazymoon changed the title 使用 CQ:image 发送图片时出现错误 [Question] [Question] 使用 CQ:image 发送图片时出现错误 Sep 18, 2020
@Ice-Hazymoon
Copy link
Author

使用 [CQ:image,file=base64://xxxxx] 时会出现 timeout 的情况,bot程序这边显示400,mirai控制台过了一段时间显示 :

�[0m 22:31:48 �[38;5;196m[ERROR]�[39;49m [CQHTTPMirai] io.ktor.network.sockets.SocketTimeoutException: Socket timeout has been expired [url=http://127.0.0.1:8989/, socket_timeout=unknown] ms
        at io.ktor.client.features.HttpTimeoutKt.SocketTimeoutException(HttpTimeout.kt:177)
        at io.ktor.client.engine.okhttp.OkUtilsKt$execute$$inlined$suspendCancellableCoroutine$lambda$1.onFailure(OkUtils.kt:31)
        at okhttp3.internal.connection.RealCall$AsyncCall.run(RealCall.kt:510)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
        at java.lang.Thread.run(Unknown Source)
Caused by: java.net.SocketTimeoutException: Read timed out
        at java.net.SocketInputStream.socketRead0(Native Method)
        at java.net.SocketInputStream.socketRead(Unknown Source)
        at java.net.SocketInputStream.read(Unknown Source)
        at java.net.SocketInputStream.read(Unknown Source)
        at okio.InputStreamSource.read(JvmOkio.kt:90)
        at okio.AsyncTimeout$source$1.read(AsyncTimeout.kt:129)
        at okio.RealBufferedSource.indexOf(RealBufferedSource.kt:449)
        at okio.RealBufferedSource.readUtf8LineStrict(RealBufferedSource.kt:333)
        at okhttp3.internal.http1.HeadersReader.readLine(HeadersReader.kt:29)
        at okhttp3.internal.http1.Http1ExchangeCodec.readResponseHeaders(Http1ExchangeCodec.kt:178)
        at okhttp3.internal.connection.Exchange.readResponseHeaders(Exchange.kt:106)
        at okhttp3.internal.http.CallServerInterceptor.intercept(CallServerInterceptor.kt:79)
        at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:100)
        at okhttp3.internal.connection.ConnectInterceptor.intercept(ConnectInterceptor.kt:34)
        at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:100)
        at okhttp3.internal.cache.CacheInterceptor.intercept(CacheInterceptor.kt:82)
        at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:100)
        at okhttp3.internal.http.BridgeInterceptor.intercept(BridgeInterceptor.kt:83)
        at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:100)
        at okhttp3.internal.http.RetryAndFollowUpInterceptor.intercept(RetryAndFollowUpInterceptor.kt:76)
        at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:100)
        at okhttp3.internal.connection.RealCall.getResponseWithInterceptorChain$okhttp(RealCall.kt:197)
        at okhttp3.internal.connection.RealCall$AsyncCall.run(RealCall.kt:502)
        ... 3 more

图片大小估计在 30kb 左右,应该不算很大,不知道是什么原因

@yyuueexxiinngg
Copy link
Owner

上面使用文件时报的错是json格式不合法

下面这个不是很清楚, 可否附件给出发送的字符串进行测试

@yyuueexxiinngg yyuueexxiinngg added the help wanted Extra attention is needed label Nov 13, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants