MrXiaoM / Overflow

替换 mirai 实现为 Onebot 以进行无缝迁移
https://mirai.mrxiaom.top
GNU Affero General Public License v3.0
337 stars 25 forks source link

私聊向机器人发送文件时报错 #99

Closed RedBeanN closed 2 months ago

RedBeanN commented 2 months ago

问题描述

配合 NapCatQQ 时发生,向机器人账号私聊发送txt文件,NapCat侧有接受文件的日志,Overflow侧报错,没有收到消息

复现

简单测试了一下,除了txt以外发送其他文件也会触发 Overflow 网络日志显示有接收到文件,应该是解析的时候报错了 NapCat侧日志前后都没有报错 image

Overflow 版本

2.16.0-795845b-SNAPSHOT

其他组件版本

NapCat.Core Version: 2.6.3

系统日志

2024-09-17 20:38:00 W/stderr: Exception in thread "DefaultDispatcher-worker-5" java.lang.IllegalStateException
2024-09-17 20:38:00 W/stderr:   at top.mrxiaom.overflow.internal.message.OnebotMessages.getLong$overflow_core(OnebotMessages.kt:377)
2024-09-17 20:38:00 W/stderr:   at top.mrxiaom.overflow.internal.message.OnebotMessages.deserializeFromOneBotJson$overflow_core(OnebotMessages.kt:288)
2024-09-17 20:38:00 W/stderr:   at top.mrxiaom.overflow.internal.message.OnebotMessages.deserializeFromOneBot$overflow_core(OnebotMessages.kt:188)
2024-09-17 20:38:00 W/stderr:   at top.mrxiaom.overflow.internal.message.OnebotMessages.deserializeFromOneBot$overflow_core$default(OnebotMessages.kt:186)
2024-09-17 20:38:00 W/stderr:   at top.mrxiaom.overflow.internal.listener.FriendMessageListener.onMessage(friend.kt:43)
2024-09-17 20:38:00 W/stderr:   at top.mrxiaom.overflow.internal.listener.FriendMessageListener.onMessage(friend.kt:31)
2024-09-17 20:38:00 W/stderr:   at cn.evolvefield.onebot.client.listener.EventListenerKt.message(EventListener.kt:21)
2024-09-17 20:38:00 W/stderr:   at cn.evolvefield.onebot.client.handler.EventBus.onReceive(EventBus.kt:45)
2024-09-17 20:38:00 W/stderr:   at cn.evolvefield.onebot.client.connection.WSClient$onMessage$1.invokeSuspend(WSClient.kt:65)
2024-09-17 20:38:00 W/stderr:   at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
2024-09-17 20:38:00 W/stderr:   at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106)
2024-09-17 20:38:00 W/stderr:   at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:570)
2024-09-17 20:38:00 W/stderr:   at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:750)
2024-09-17 20:38:00 W/stderr:   at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:677)
2024-09-17 20:38:00 W/stderr:   at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:664)
2024-09-17 20:38:00 W/stderr:   Suppressed: kotlinx.coroutines.DiagnosticCoroutineContextException: [CoroutineName(overflow), StandaloneCoroutine{Cancelling}@628ec5a8, Dispatchers.Default]

网络日志

**部分敏感信息已消去**
2024-09-17 20:38:00 D/Onebot: Client received <-- {"self_id":12345,"user_id":12345,"time":1726576679,"message_id":714285457,"message_seq":714285457,"real_id":714285457,"message_type":"private","sender":{"user_id":12345,"nickname":"","card":""},"raw_message":"[CQ:file,file=stream-response.txt,path=,url=file:///app/napcat,file_id=xxx.stream-response.txt,file_size=7842588,file_unique=stream-response.txt]","font":14,"sub_type":"friend","message":[{"type":"file","data":{"file":"stream-response.txt","path":"","url":"file:///app/napcat","file_id":"xxxxx.stream-response.txt","file_size":"7842588","file_unique":"stream-response.txt"}}],"message_format":"array","post_type":"message"}

补充信息

补充:NapCat是跑在docker的mlikiowa/napcat-docker:latest,不确定有没有影响 具体版本是这个

MrXiaoM commented 2 months ago

795845b is too old

RedBeanN commented 2 months ago

@MrXiaoM 我直接按照 https://github.com/MrXiaoM/Overflow/blob/main/docs/install/MCLOverflow.md 更新完就是这个版本,请问需要怎么更新呢?

MrXiaoM commented 2 months ago

@MrXiaoM 我直接按照 https://github.com/MrXiaoM/Overflow/blob/main/docs/install/MCLOverflow.md 更新完就是这个版本,请问需要怎么更新呢?

看置顶 issue

RedBeanN commented 2 months ago

更新后收到的文件是空的 Bot.xxx: xx(xx) -> WrappedFileMessage(id=, internalId=0, name=, size=0, url=file:///app/napcat) 版本:0.9.9.510-d6669df-SNAPSHOT 网络日志:

2024-09-17 21:25:25 D/Onebot: [Recv] <-- {"self_id":12345,"user_id":12345,"time":1726579525,"message_id":815351619,"message_seq":815351619,"real_id":815351619,"message_type":"private","sender":{"user_id":12345,"nickname":"","card":""},"raw_message":"[CQ:file,file=stream-response.txt,path=,url=file:///app/napcat,file_id=xxx.stream-response.txt,file_size=7842588,file_unique=stream-response.txt]","font":14,"sub_type":"friend","message":[{"type":"file","data":{"file":"stream-response.txt","path":"","url":"file:///app/napcat","file_id":"xxx.stream-response.txt","file_size":"7842588","file_unique":"stream-response.txt"}}],"message_format":"array","post_type":"message"}

NapCat有/get_file的接口可以用file_id获得文件,看起来应该是Overflow没有解析?

MrXiaoM commented 2 months ago

mirai 的 api 并不支持私聊文件,解析了也没用

RedBeanN commented 2 months ago

@MrXiaoM 我可以自己适配,既然有file接口了,只要把id和name字段传出来就行