添加gewechat被at人wxid获取,AstrBotMessage添加be_at_wxid字段
This commit is contained in:
@@ -62,6 +62,8 @@ class AstrBotMessage:
|
||||
raw_message: object
|
||||
timestamp: int # 消息时间戳
|
||||
|
||||
be_at_wxid: List[str] # gewechat用的群组内at信息,用于机器人获取被at的wxid
|
||||
|
||||
def __init__(self) -> None:
|
||||
self.timestamp = int(time.time())
|
||||
|
||||
|
||||
@@ -152,9 +152,13 @@ class SimpleGewechatClient:
|
||||
# at
|
||||
# content = content.split('\u2005')[1]
|
||||
content = re.sub(r"@[^\u2005]*\u2005", "", content)
|
||||
abm.be_at_wxid = re.findall(r'<atuserlist><!\[CDATA\[.*?(?:,|\b)([^,]+?)(?=,|\]\]></atuserlist>)',d["MsgSource"])
|
||||
|
||||
abm.group_id = from_user_name
|
||||
# at
|
||||
msg_source = d["MsgSource"]
|
||||
|
||||
|
||||
if (
|
||||
f"<atuserlist><![CDATA[,{abm.self_id}]]>" in msg_source
|
||||
or f"<atuserlist><![CDATA[{abm.self_id}]]>" in msg_source
|
||||
|
||||
Reference in New Issue
Block a user