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

热词提示ERROR: 历史消息为空或者无法获得历史消息 #1

Open
tmdakm opened this issue May 15, 2024 · 2 comments
Open
Assignees
Labels
bug Something isn't working delay Bug fixes delay

Comments

@tmdakm
Copy link

tmdakm commented May 15, 2024

d9d9ec8afc7e18e13ab0e44bec21a2f8
6a6d87815cafc6b3593c01334c9ade9e

@KomeiDiSanXian KomeiDiSanXian self-assigned this May 16, 2024
@KomeiDiSanXian KomeiDiSanXian added the bug Something isn't working label May 16, 2024
@KomeiDiSanXian
Copy link
Owner

定位到问题在zerobot/api.go中, L549

// GettLatestGroupMessageHistory 获取最新群消息历史记录
func (ctx *Ctx) GetLatestGroupMessageHistory(groupID int64) gjson.Result {
	return ctx.CallAction("get_group_msg_history", Params{
		"group_id": groupID,
	}).Data
}

拉格兰文档中写明该api需要以下参数

字段 类型 说明
group_id uint 群组 ID
message_id int 要获取的消息的最后一条的 ID
count int 获取的消息数量

测试时发送示例如下

正向ws

{
    "action": "get_group_msg_history",
    "params": {
        "group_id": 820309545,
        "count": 100,
        "message_id": 562894955
    }
}

拉格兰返回如下

trce: Lagrange.Core.BotContext[0]
      [2024-05-16 22:44:56] [ServiceContext] [DEBUG]: Outgoing SSOFrame: OidbSvcTrpcTcp.0xfe7_3
trce: Lagrange.Core.BotContext[0]
      [2024-05-16 22:44:56] [ServiceContext] [DEBUG]: Incoming SSOFrame: OidbSvcTrpcTcp.0xfe7_3
warn: Lagrange.OneBot.Core.Operation.OperationService[0]
      Unexpected error encountered while handling message.
      System.Exception: Group member not found
         at Lagrange.OneBot.Message.MessageService.ConvertToGroupMsg(UInt32 uin, MessageChain chain)
         at Lagrange.OneBot.Core.Operation.Message.GetGroupMessageHistoryOperation.<>c__DisplayClass3_0.<HandleOperation>b__2(MessageChain x)
         at System.Linq.Enumerable.SelectListIterator`2.Fill(ReadOnlySpan`1 source, Span`1 destination, Func`2 func)
         at System.Linq.Enumerable.SelectListIterator`2.ToList()
         at Lagrange.OneBot.Core.Operation.Message.GetGroupMessageHistoryOperation.HandleOperation(BotContext context, JsonNode payload)
         at Lagrange.OneBot.Core.Operation.OperationService.HandleOperation(MsgRecvEventArgs e)
trce: Lagrange.OneBot.Core.Network.Service.ForwardWSService[13]
      Send(5d880f9f-d52a-44ce-8bd7-32a1c28887a6) {"status":"failed","retcode":200,"data":null,"echo":null}

似乎此api仍有bug? 等待进一步测试

@KomeiDiSanXian
Copy link
Owner

定位到问题在zerobot/api.go中, L549

// GettLatestGroupMessageHistory 获取最新群消息历史记录
func (ctx *Ctx) GetLatestGroupMessageHistory(groupID int64) gjson.Result {
	return ctx.CallAction("get_group_msg_history", Params{
		"group_id": groupID,
	}).Data
}

拉格兰文档中写明该api需要以下参数
字段 类型 说明
group_id uint 群组 ID
message_id int 要获取的消息的最后一条的 ID
count int 获取的消息数量

测试时发送示例如下

正向ws

{
    "action": "get_group_msg_history",
    "params": {
        "group_id": 820309545,
        "count": 100,
        "message_id": 562894955
    }
}

拉格兰返回如下

trce: Lagrange.Core.BotContext[0]
      [2024-05-16 22:44:56] [ServiceContext] [DEBUG]: Outgoing SSOFrame: OidbSvcTrpcTcp.0xfe7_3
trce: Lagrange.Core.BotContext[0]
      [2024-05-16 22:44:56] [ServiceContext] [DEBUG]: Incoming SSOFrame: OidbSvcTrpcTcp.0xfe7_3
warn: Lagrange.OneBot.Core.Operation.OperationService[0]
      Unexpected error encountered while handling message.
      System.Exception: Group member not found
         at Lagrange.OneBot.Message.MessageService.ConvertToGroupMsg(UInt32 uin, MessageChain chain)
         at Lagrange.OneBot.Core.Operation.Message.GetGroupMessageHistoryOperation.<>c__DisplayClass3_0.<HandleOperation>b__2(MessageChain x)
         at System.Linq.Enumerable.SelectListIterator`2.Fill(ReadOnlySpan`1 source, Span`1 destination, Func`2 func)
         at System.Linq.Enumerable.SelectListIterator`2.ToList()
         at Lagrange.OneBot.Core.Operation.Message.GetGroupMessageHistoryOperation.HandleOperation(BotContext context, JsonNode payload)
         at Lagrange.OneBot.Core.Operation.OperationService.HandleOperation(MsgRecvEventArgs e)
trce: Lagrange.OneBot.Core.Network.Service.ForwardWSService[13]
      Send(5d880f9f-d52a-44ce-8bd7-32a1c28887a6) {"status":"failed","retcode":200,"data":null,"echo":null}

似乎此api仍有bug? 等待进一步测试

更改参数 count 为 10 以后能正常获取,15 也能正常获取. 出现这一问题可能是读取到的消息没100导致的?
进一步的测试表明,获取消息最大数量为 30.

需要等待拉格兰那边回复

@KomeiDiSanXian KomeiDiSanXian added the delay Bug fixes delay label May 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working delay Bug fixes delay
Projects
None yet
Development

No branches or pull requests

2 participants