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

feat: ✨ 支持提前解析含content字段的type为forward类型的消息 #108

Merged
merged 1 commit into from
Nov 12, 2024

Conversation

kagg886
Copy link
Contributor

@kagg886 kagg886 commented Nov 12, 2024

在提出此拉取请求时,我确认了以下几点(请复选框):

  • 我已阅读并理解贡献文档
  • 我已检查没有与此请求重复的 Pull Requests。
  • 我已经考虑过,并确认这份呈件对其他人很有价值。
  • 我接受此提交可能不会被使用,并根据维护人员的意愿关闭 Pull Requests。

填写PR内容:
我的Napcat上总会爆合并转发错误:

2024-11-12 21:42:22.594 [DefaultDispatcher-worker-3] WARN  top.mrxiaom.overflow.OverflowAPI - 解析消息 forward -> {"id":"7436387625315107617","content":[{"self_id":3405637452,"user_id":485184047,"time":1731415740,"message_id":315011686,"message_seq":315011686,"real_id":315011686,"message_type":"group","sender":{"user_id":485184047,"nickname":"上亦下心","card":""},"raw_message":"1","font":14,"sub_type":"normal","message":[{"type":"text","data":{"text":"1"}}],"message_format":"array","post_type":"message","group_id":284840486},{"self_id":3405637452,"user_id":485184047,"time":1731415746,"message_id":1377545730,"message_seq":1377545730,"real_id":1377545730,"message_type":"group","sender":{"user_id":485184047,"nickname":"上亦下心","card":""},"raw_message":"1","font":14,"sub_type":"normal","message":[{"type":"text","data":{"text":"1"}}],"message_format":"array","post_type":"message","group_id":284840486}]} 时出现错误 (NapCat.Onebot v2.6.27)
java.lang.IllegalStateException: 无法下载转发消息,详见网络日志 (logs/onebot/*.log
	at top.mrxiaom.overflow.internal.Overflow.downloadForwardMessage(Overflow.kt:439)
	at top.mrxiaom.overflow.internal.Overflow$downloadForwardMessage$1.invokeSuspend(Overflow.kt)
	at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
	at kotlinx.coroutines.internal.ScopeCoroutine.afterResume(Scopes.kt:28)
	at kotlinx.coroutines.AbstractCoroutine.resumeWith(AbstractCoroutine.kt:99)
	at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:46)
	at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:102)
	at kotlinx.coroutines.internal.LimitedDispatcher$Worker.run(LimitedDispatcher.kt:111)
	at kotlinx.coroutines.scheduling.TaskImpl.run(Tasks.kt:99)
	at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:584)
	at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:811)
	at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:715)
	at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:702)

经调试很可能是napcat对get_forward_msg的请求不返回的缘故(至少我查遍napcat的文件日志也未发现napcat向overflow推送get_forward_msg的返回)

而napcat是在type为forward的消息内提前塞了content的。这意味着可以通过提前解析来抑制本该解析失败的消息。

需要注意的是,若含有reply等消息,此时的Overflow仍会发送get_msg请求,目前也未发现get_msg的返回
对于这种方式,我无能为力

@MrXiaoM MrXiaoM merged commit fc56fce into MrXiaoM:main Nov 12, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants