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

不支持array形式的上报消息 #2

Open
RockChinQ opened this issue Apr 25, 2023 · 0 comments
Open

不支持array形式的上报消息 #2

RockChinQ opened this issue Apr 25, 2023 · 0 comments
Labels
bug Something isn't working

Comments

@RockChinQ
Copy link
Member

上报消息,示例如下:

{"post_type":"message","message_type":"private","time":1682421865,"self_id":2200000051,"sub_type":"friend","font":0,"sender":{"age":0,"nickname":"PokeBox","sex":"unknown","user_id":930000005},"message_id":1750478322,"user_id":930000005,"target_id":2200000051,"message":[{"type":"text","data":{"text":"hi"}}],"raw_message":"hi"}

和string格式的上报消息不同,需要对消息格式做处理。
下面是能正常使用的string的消息格式:

{"post_type":"message","message_type":"private","time":1682421386,"self_id":2200000051,"sub_type":"friend","message_id":1642095065,"user_id":930000005,"target_id":2200000051,"message":"!help","raw_message":"!help","font":0,"sender":{"age":0,"nickname":"PokeBox","sex":"unknown","user_id":930000005}}

报错导致的原因与go-cqhttp版本并无太大关系,当我使用的go-cqhttp版本是v1.0.0-rc5,目前几乎所有版本均支持string或array两种消息格式,设置方法为编辑config.yml文件,找到message下的post-format选项,并把值设置为array:

message:
  # 上报数据类型
  # 可选: string,array
  post-format: array

重启go-cqhttp和QChatGPT后,给机器人发送任意消息,即可复现上述bug。

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

No branches or pull requests

1 participant