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

部分用户发送ForwardMessage失败 #146

Closed
GardenHamster opened this issue Feb 21, 2023 · 14 comments · May be fixed by #147
Closed

部分用户发送ForwardMessage失败 #146

GardenHamster opened this issue Feb 21, 2023 · 14 comments · May be fixed by #147
Labels
bug Something isn't working Done

Comments

@GardenHamster
Copy link

GardenHamster commented Feb 21, 2023

Mirai-CSharp:2.1.9
Mirai-CSharp.HttpApi:2.1.9
MCL:2.14.0
mirai-api-http:2.8.0
mirai-console:2.14.0
JDK:17
Theresa3rd-Bot:v0.8.0

2023-02-21 17:01:20,118 [15] ERROR RollingLog [(null)] - replyRankingInfo异常
System.ArgumentException: 调用http-api失败, 参数错误, 请到 https://github.com/Executor-Cheng/Mirai-CSharp/issues 下提交issue。
   at Mirai.CSharp.HttpApi.Extensions.ApiResponseExtensions.EnsureApiRespCode(JsonElement root)
   at Mirai.CSharp.HttpApi.Session.MiraiHttpSession.CommonSendMessageAsync(String action, Nullable`1 qqNumber, Nullable`1 groupNumber, IChatMessage[] chain, Nullable`1 quoteMsgId, CancellationToken token)
   at TheresaBot.MiraiHttpApi.Session.MiraiSession.SendGroupMergeMessageAsync(Int64 groupId, List`1 setuContents)
   at TheresaBot.MiraiHttpApi.Session.MiraiSession.SendGroupSetuAsync(List`1 setuContents, Int64 groupId, Boolean sendMerge)
   at TheresaBot.Main.Handler.PixivRankingHandler.replyRankingInfo(GroupCommand command, PixivRankingMode rankingMode, PixivRankingItem rankingItem)
@GardenHamster
Copy link
Author

只有一部分账号会出现类似的问题,而且非合并消息发送功能正常

@Executor-Cheng
Copy link
Owner

这个问题到现在还存续不?我感觉是mirai那边没有正确缓存群号搞出来的问题

@ShennaiShenwei
Copy link

应该不是的,给定QQ号与群号不存在是因为程序里bug反馈的群号给的是空号,主要是上面的调用http-api失败(纯小白,这是我的bot的问题,大佬代发的issue)

@GardenHamster
Copy link
Author

应该不是的,给定QQ号与群号不存在是因为程序里bug反馈的群号给的是空号,主要是上面的调用http-api失败(纯小白,这是我的bot的问题,大佬代发的issue)

群号不存在的问题,是插件本身的另外一个问题导致的,和这个issuse反馈的问题无关,我修改一下issuse

@GardenHamster
Copy link
Author

主要是我这边看不到mirai那边返回了什么消息,我先再检查一下是不是插件本身的问题吧

@Executor-Cheng Executor-Cheng added the need-repro Need reproduction label Feb 23, 2023
@GardenHamster
Copy link
Author

  • 好像找到问题了

  • 在使用mirai-api-http-2.6.2.mirai2.jar的情况下,没有出现问题

  • 升级到最新mirai-api-http-2.8.0.mirai2.jar的情况,会返回错误400

j.RootElement = ValueKind = Object : "{"code":400,"msg":"无效参数"}"

@GardenHamster
Copy link
Author

只要发ForwardMessage就会出现问题

List<IForwardMessageNode> nodeList = new();
nodeList.Add(new ForwardMessageNode("test", qqNumber, DateTime.Now, new IChatMessage[] {new PlainMessage("testmsg") }));
await session.SendGroupMessageAsync(qqGroup, new ForwardMessage(nodeList.ToArray()));

@Executor-Cheng Executor-Cheng added investigating The developer is investigating the issue bug Something isn't working working The developer is working on this issue/pr. and removed need-repro Need reproduction investigating The developer is investigating the issue labels Feb 27, 2023
@Executor-Cheng
Copy link
Owner

猜测可能由于序列化 ForwardMessageNode 时传递了 "sourceId": 0 导致 mirai-api-http 优先从缓存中获取一个不存在的消息导致的问题
将考虑当 ForwardMessageNode.Id == 0 时禁用此属性序列化

@Executor-Cheng
Copy link
Owner

Executor-Cheng commented Feb 27, 2023

更新: 修改了 (I)ForwardMessageNode 中所有属性的类型为可空
已在 13f439f 中处理

@Executor-Cheng Executor-Cheng added Done and removed working The developer is working on this issue/pr. labels Feb 27, 2023
@GardenHamster
Copy link
Author

谢谢,辛苦佬了

@GardenHamster
Copy link
Author

mirai-http-api v2.9.1貌似修复了这个错误了

@GardenHamster
Copy link
Author

确实是mirai的问题,更新到mirai-http-api v2.9.1就没有出现错误了

@Executor-Cheng
Copy link
Owner

确实是mirai的问题,更新到mirai-http-api v2.9.1就没有出现错误了

我猜测是这里
project-mirai/mirai-api-http@1e32f14#diff-8ad1a9aadcc292d9f9c5c9f3ac0ddebd458384eab6c2b858463430cd0e875cebR196
这行导致的问题, 它搞不好是要求必须传入display参数了
既然如此, 这次的breaking changes我就推迟了, 至少到下一个minor再合入吧

@GardenHamster
Copy link
Author

好的

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working Done
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants