momocow / node-cq-websocket

A Node SDK for developing QQ chatbots based on WebSocket, which is depending on CoolQ and CQHTTP API plugin.

Home Page:https://cq-websocket.js.org/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

在特定情况下消息含有at但没有被 message.x.@.me 捕获

Tsuk1ko opened this issue · comments

我实际使用时发现,当在消息中at机器人之前含有图片,则该消息将会被message.x捕获,跳过了message.x.@.me

例如:

# 以下消息可以被 message.x.@.me 捕获(先at再图片,或是at前只有文字没有图片)
[CQ:at,qq=123] [CQ:image,file=123,url=123]
123123[CQ:at,qq=123]

# 以下消息会跳过 message.x.@.me (先图片再at,并且与之间或者之前是否有文字无关)
[CQ:image,file=123,url=123][CQ:at,qq=123]
[CQ:image,file=123,url=123] [CQ:at,qq=123]
[CQ:image,file=123,url=123] aaa [CQ:at,qq=123]
aaa[CQ:image,file=123,url=123][CQ:at,qq=123]

確實有這問題呢 🤔
試了一下發現, 原因是RegExp的greedy問題, 造成只有第一個CQ碼會被抽出。

稍後發個patch。

好的,感谢 😃