You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
2024-04-01 10:27:55 D/Onebot: Client received <-- {"message_type":"group","sub_type":"normal","message_id":-964635551,"group_id":GID,"user_id":UID,"anonymous":null,"message":[{"type":"text","data":{"text":"XXX"}}],"raw_message":"XXX","font":0,"sender":{"user_id":UID,"nickname":"NICK","card":"CARD","sex":"unknown","age":0,"area":"","level":"100","role":"admin","title":""},"time":1711938475,"self_id":BOTID,"post_type":"message"}
2024-04-01 10:27:55 D/Onebot: Send to server --> {"action":"send_group_msg","params":{"group_id":GID,"message":[{"type":"reply","data":{"id":"3330331745"}},{"type":"text","data":{"text":"XXX"}},"auto_escape":false},"echo":264}
2024-04-01 10:27:55 D/Onebot: Client received <-- {"status":"failed","retcode":200,"data":null,"echo":264}
在这段日志实例中,message id -964635551在回复的时候被解析为了3330331745,目测应该是int32被解析为了uint32
Lagrange的日志也证明了这一点,超出int32范围:
warn: Lagrange.OneBot.Core.Operation.OperationService[0]
Unexpected error encountered while handling message.
System.OverflowException: Value was either too large or too small for an Int32.
at System.Number.ThrowOverflowOrFormatException(ParsingStatus status, ReadOnlySpan`1 value, TypeCode type)
at System.Int32.Parse(String s)
at Lagrange.OneBot.Message.Entity.ReplySegment.Build(MessageBuilder builder, SegmentBase segment) in {PATH}\Lagrange.OneBot\Message\Entity\ReplySegment.cs:line 27
at Lagrange.OneBot.Core.Operation.Message.MessageCommon.BuildMessages(MessageBuilder builder, List`1 segments) in {PATH}\Lagrange.OneBot\Core\Operation\Message\MessageCommon.cs:line 215
at Lagrange.OneBot.Core.Operation.Message.MessageCommon.ParseChain(OneBotGroupMessage message) in {PATH}\Lagrange.OneBot\Core\Operation\Message\MessageCommon.cs:line 143
at Lagrange.OneBot.Core.Operation.Message.SendGroupMessageOperation.HandleOperation(BotContext context, JsonNode payload) in {PATH}\Lagrange.OneBot\Core\Operation\Message\SendGroupMessageOperation.cs:line 19
at Lagrange.OneBot.Core.Operation.OperationService.HandleOperation(MsgRecvEventArgs e) in {PATH}\Lagrange.OneBot\Core\Operation\OperationService.cs:line 58
问题描述
在Onebot V11标准中,message_id的数据类型为number (int32),但是似乎Overflow在回复信息中会将其解析为uint32
复现
我的业务逻辑代码大致如下:
就是一种通过GroupMessageEvent来回复信息的效果,回复使用者的信息并发送XXXX
大多数情况是正常的,有时候会报错
Onebot的log如下:
在这段日志实例中,message id -964635551在回复的时候被解析为了3330331745,目测应该是int32被解析为了uint32
Lagrange的日志也证明了这一点,超出int32范围:
Overflow 版本
213cf4d
其他组件版本
Mirai目录Libs:
mirai-console-2.16.0
mirai-console-terminal-2.16.0-all
overflow-core-all-2.16.0-213cf4d-SNAPSHOT-all
bcprov-jdk15on-1.64
Onebot实现:
Lagrange.OneBot (Commit:62f48c224a683f4721f1c94f58df5468663ac9d1)
系统日志
No response
网络日志
No response
补充信息
目前来说message_id在0到2147483647的时候是正常的,而且大多数message_id都小于2147483647,我这儿也就一个群里出现,因此表现形式是就那个群无法发送,且不清楚这个在OpenShamrock上是不是一样的表现(好像之前在OpenShamrock上没遇到过),因此提issue了
同样的该群的所有带回复的信息也无法获取,目测也是把回复的Reply的message id解析到了uint32(?),Overflow报错如下:
刚刚看到代码了:
Overflow/overflow-core/src/main/kotlin/top/mrxiaom/overflow/internal/message/OnebotMessages.kt
Lines 115 to 119 in 213cf4d
Overflow/overflow-core/src/main/kotlin/top/mrxiaom/overflow/internal/message/OnebotMessages.kt
Lines 332 to 335 in 213cf4d
😨要不直接干成long得了,反正两边交互用的json(
The text was updated successfully, but these errors were encountered: