GraiaProject / Application

一个设计精巧, 协议实现完备的, 基于 mirai-api-http 的即时聊天软件自动化框架.
https://graia-document.vercel.app/
GNU Affero General Public License v3.0
438 stars 63 forks source link

回复消息中多余的at #24

Closed ieew closed 4 years ago

ieew commented 4 years ago

描述你遇到的问题: 回复消息的解析可能存在问题

复现步骤: 该 BUG 会在进行以下操作后出现:

  1. 群内有人回复某一条消息的时候

运行环境:

额外信息: 如果回复消息中包含qq自动添加的at行为则是: image

[
    Source(id=19532, time=datetime.datetime(2020, 8, 8, 1, 29, 58, tzinfo=datetime.timezone.utc)),
    Quote(id=19527, groupId=xxxxxxxx, senderId=xxxxxxxx, targetId=601249169, origin=MessageChain(__root__=[Source(id=19527, time=datetime.datetime(2020, 8, 8, 1, 27, 3, tzinfo=datetime.timezone.utc)), Plain(type='Plain', text='1')])),
    At(type='At', target=xxxxxxxx, display='@雪洛千心山'),
    Plain(type='Plain', text=' '),
    At(type='At', target=xxxxxxxx, display='@雪洛千心山'),
    Plain(type='Plain', text=' 帮楼上百度')
]

如果回复消息中qq自动添加的at被删除之后则是: image

[
    Source(id=19534, time=datetime.datetime(2020, 8, 8, 1, 36, 10, tzinfo=datetime.timezone.utc)),
    Quote(id=19527, groupId=xxxxxxxx, senderId=xxxxxxxx, targetId=xxxxxxxx, origin=MessageChain(__root__=[Source(id=19527, time=datetime.datetime(2020, 8, 8, 1, 27, 3, tzinfo=datetime.timezone.utc)), Plain(type='Plain', text='1')])),
    At(type='At', target=xxxxxxxx, display='@雪洛千心山'),
    Plain(type='Plain', text=' '),
    Plain(type='Plain', text='帮楼上百度')
]
GreyElaina commented 4 years ago

mirai-core 的问题, 非本项目问题, 我没有做这种隐式添加消息元素的.

GreyElaina commented 4 years ago

@ieew 你使用 v3 时, 使用的是和 v4 一样的消息接收方式吗

ieew commented 4 years ago

用的一样的消息接收方式

ieew commented 4 years ago

今天检查了一下http api那边传过来的信息,接口获得的json为

{"type":"GroupMessage","messageChain":[{"type":"Source","id":19550,"time":1596959296},{"type":"Quote","id":19527,"senderId":xxxxxxxx,"targetId":xxxxxxxx,"groupId":xxxxxxxx,"origin":[{"type":"Source","id":19527,"time":1596850023},{"type":"Plain","text":"1"}]},{"type":"At","target":xxxxxxxx,"display":"@雪洛千心山"},{"type":"Plain","text":" "},{"type":"At","target":xxxxxxxx,"display":"@雪洛千心山"},{"type":"Plain","text":" 帮楼上百度"}],"sender":{"id":xxxxxxx,"memberName":"未知","permission":"OWNER","group":{"id":xxxxxxxx,"name":"个人网盘","permission":"MEMBER"}}}

经过确认,http api那边并没有返回多余的at

coranholmes commented 4 years ago

我也遇到这个问题,请问解决了吗?