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

[Bug]: dev 版本无法获取群荣誉信息,get_group_honor_info 接口返回空结果 #2390

Closed
4 tasks done
1umine opened this issue Aug 19, 2023 · 3 comments
Closed
4 tasks done
Labels
bug? The issue author think this is a bug

Comments

@1umine
Copy link
Contributor

1umine commented Aug 19, 2023

请确保您已阅读以上注意事项,并勾选下方的确认框。

  • 我已经仔细阅读上述教程和 "提问前需知"
  • 我已经使用 dev分支版本 测试过,问题依旧存在。
  • 我已经在 Issue Tracker 中找过我要提出的问题,没有找到相同问题的ISSUE。
  • 我已知晓并同意,此处仅用于汇报程序中存在的问题。若这个 Issue 是关于其他非程序本身问题,则我的 Issue 可能会被无条件自动关闭或/并锁定。(这些问题应当在 Discussion 板块提出。)

go-cqhttp 版本

5db03c7

运行环境

Windows (64)

运行架构

ARM [64] (别名:AArch64 / ARMv8)

连接方式

WebSocket (反向)

使用协议

6 | aPad

重现步骤

使用 5db03c7 或以上版本
请求API: /get_group_honor_info?group_id=666666&type=all

期望的结果是什么?

正常获取群荣誉信息列表

实际的结果是什么?

所有结果均为空,data 仅包含群号字段,请求前群内已经产生了荣誉信息,如龙王等

{
  "data": {
    "group_id": 6666666
  },
  "message": "",
  "retcode": 0,
  "status": "ok"
}

简单的复现代码/链接(可选)

见重现步骤

日志记录(可选)

No response

补充说明(可选)

这个获取不到荣誉信息的 bug 好像是在 7月28日 出现的 ,7.27 以及之前是可以正常获取的。
除此之外,似乎自 8.1 更新后日志经常出现 一条消息最多包含一条reply元素 这样的警告,在收到带有回复的消息时就有不小的概率发生。

@1umine 1umine added the bug? The issue author think this is a bug label Aug 19, 2023
@xiangxiangxiong9
Copy link
Contributor

xiangxiangxiong9 commented Aug 21, 2023

那个 [WARNING]: 警告: 一条信息只能包含一个 Reply 元素. 是我的锅 😢 #2397 0.0


可能是获取群荣誉的JSON解析出问题了 [tx对结果进行了一些改变...?]
[go-cqhttp]

go-cqhttp/coolq/api.go

Lines 1362 to 1419 in 5db03c7

// CQGetGroupHonorInfo 获取群荣誉信息
//
// https://git.io/Jtz1H
// @route(get_group_honor_info)
// @rename(t->type)
func (bot *CQBot) CQGetGroupHonorInfo(groupID int64, t string) global.MSG {
msg := global.MSG{"group_id": groupID}
convertMem := func(memList []client.HonorMemberInfo) (ret []global.MSG) {
for _, mem := range memList {
ret = append(ret, global.MSG{
"user_id": mem.Uin,
"nickname": mem.Name,
"avatar": mem.Avatar,
"description": mem.Desc,
})
}
return
}
if t == "talkative" || t == "all" {
if honor, err := bot.Client.GetGroupHonorInfo(groupID, client.Talkative); err == nil {
if honor.CurrentTalkative.Uin != 0 {
msg["current_talkative"] = global.MSG{
"user_id": honor.CurrentTalkative.Uin,
"nickname": honor.CurrentTalkative.Name,
"avatar": honor.CurrentTalkative.Avatar,
"day_count": honor.CurrentTalkative.DayCount,
}
}
msg["talkative_list"] = convertMem(honor.TalkativeList)
}
}
if t == "performer" || t == "all" {
if honor, err := bot.Client.GetGroupHonorInfo(groupID, client.Performer); err == nil {
msg["performer_list"] = convertMem(honor.ActorList)
}
}
if t == "legend" || t == "all" {
if honor, err := bot.Client.GetGroupHonorInfo(groupID, client.Legend); err == nil {
msg["legend_list"] = convertMem(honor.LegendList)
}
}
if t == "strong_newbie" || t == "all" {
if honor, err := bot.Client.GetGroupHonorInfo(groupID, client.StrongNewbie); err == nil {
msg["strong_newbie_list"] = convertMem(honor.StrongNewbieList)
}
}
if t == "emotion" || t == "all" {
if honor, err := bot.Client.GetGroupHonorInfo(groupID, client.Emotion); err == nil {
msg["emotion_list"] = convertMem(honor.EmotionList)
}
}
return OK(msg)
}

honor: <nil>
err: invalid character ';' after top-level value

[MiraiGo]
https://github.com/Mrs4s/MiraiGo/blob/e4b6dc62fd76d8220d6681acff43fefb2c755547/client/http_api.go#L62-L75

拉取后好像多了个
;(function(){var s;(s=document.currentScript||document.scripts[document.scripts.length-1]).parentNode.removeChild(s);}());

@1umine
Copy link
Contributor Author

1umine commented Aug 22, 2023

了解了

@1umine
Copy link
Contributor Author

1umine commented Aug 22, 2023

已解决

@1umine 1umine closed this as completed Aug 22, 2023
1umine added a commit to 1umine/go-cqhttp that referenced this issue Aug 22, 2023
fumiama pushed a commit that referenced this issue Aug 27, 2023
* fix: skip callback error

* update: update comment

* change the logic of callback and auto-register

* add token update prompt.

* fix log buffer string

* fix #2368

增加对 client 的利用,避免创建过多 clients

* refactor: wrap sign request

* feat: impl additional sign servers configuration

* fix error in using configurations.

* fix lint error

* 支持切换回主签名服务器

* feat: support different key and auth

* optimize: find avaliable sign-server

* fix: register instance after server is changed

* fix lint error

* update: add config 'sync-check-servers'

* update: first check master sign-server, or wait 3s

* add checking log & optimize wait for checking done

* fix wrong judge

* add config: rule for changing sign server

* optimize registration logic after changing server

* add some log

* fix #2390

* resolve requested changes in #2389

* update dependency

* fix lint error 'idx is unused'

* refactor: extract sync check and async check logic

* delete async check sign-server
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug? The issue author think this is a bug
Projects
None yet
Development

No branches or pull requests

2 participants