Bug: 回复消息里的艾特会被去掉,导致在回复里艾特就触发不了to_me了
Closed this issue · 1 comments
cy1159178778 commented
操作系统
Windows
Python 版本
3.10.2
NoneBot 版本
2.3.1
适配器
OneBot v11 2.1.5
协议端
NapCat 1.6.1
描述问题
nonebot\adapters\onebot\v11\adapter.py 232
while True:
data = await websocket.receive()
json_data = json.loads(data)
if event := self.json_to_event(json_data, self_id):
if "meta_event.heartbeat" not in str(event):
log("WARNING", f"receive_event: {event}")
asyncio.create_task(bot.handle_event(event))
nonebot\adapters\onebot\v11\bot.py 186
async def handle_event(self, event: Event) -> None:
"""处理收到的事件。"""
if isinstance(event, MessageEvent):
await _check_reply(self, event)
_check_at_me(self, event)
_check_nickname(self, event)
if "meta_event.heartbeat" not in str(event):
log("WARNING", f"handle_event: {event}")
await handle_event(self, event)
在以上两个文件加了日志打印,然后发现回复消息里的艾特会被去掉,导致在回复里艾特机器人就触发不了to_me了
复现步骤
1、自己发一条消息
2、回复自己的消息,并艾特某人
期望的结果
回复消息里的艾特不会被去掉,在回复里艾特能触发to_me
截图或日志
07-04 22:52:55 [WARNING] nonebot | OneBot V11 | receive_event: [message.group.normal]: Message -2147483424 from 115xxxx78@[群:974xxxx49] "[CQ:reply,id=-2147483430][CQ:at,qq=216xxxx64]"
07-04 22:52:55 [WARNING] nonebot | OneBot V11 | handle_event: [message.group.normal]: Message -2147483424 from 115xxxx78@[群:974xxxx49] ""
07-04 22:52:55 [SUCCESS] nonebot | OneBot V11 216xxxx64 | [message.group.normal]: Message -2147483424 from 115xxxx78@[群:974xxxx49] ""
07-04 22:53:09 [WARNING] nonebot | OneBot V11 | receive_event: [message.group.normal]: Message -2147483423 from 115xxxx78@[群:974xxxx49] "[CQ:reply,id=-2147483430][CQ:at,qq=216xxxx64] 123"
07-04 22:53:09 [WARNING] nonebot | OneBot V11 | handle_event: [message.group.normal]: Message -2147483423 from 115xxxx78@[群:974xxxx49] "123"
07-04 22:53:09 [SUCCESS] nonebot | OneBot V11 216xxxx64 | [message.group.normal]: Message -2147483423 from 115xxxx78@[群:974xxxx49] "123"
yanyongyu commented
这个是因为以前QQ协议在回复消息后都会自带一个at回复的人,所以做了自动删除,现在可能需要判断一下at的人是不是回复的人。