Skip to content

Commit

Permalink
Update wechat_message.py
Browse files Browse the repository at this point in the history
加入更多英文适配(通过QR code加入群聊)
  • Loading branch information
Abyss-Seeker authored Aug 6, 2024
1 parent c8ce47d commit b33daff
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion channel/wechat/wechat_message.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ def __init__(self, itchat_msg, is_group=False):
self.create_time = itchat_msg["CreateTime"]
self.is_group = is_group

notes_join_group = ["加入群聊","加入了群聊","invited"] # 可通过添加对应语言的加入群聊通知中的关键词适配更多
notes_join_group = ["加入群聊","加入了群聊","invited","joined"] # 可通过添加对应语言的加入群聊通知中的关键词适配更多
notes_exit_group = ["移出了群聊","removed"] # 可通过添加对应语言的踢出群聊通知中的关键词适配更多
notes_patpat = ["拍了拍我","tickled my","tickled me"] # 可通过添加对应语言的拍一拍通知中的关键词适配更多

Expand All @@ -37,6 +37,8 @@ def __init__(self, itchat_msg, is_group=False):
self.content = itchat_msg["Content"]
if "invited" in itchat_msg["Content"]: # 匹配英文信息
self.actual_user_nickname = re.findall(r'invited\s+(.+?)\s+to\s+the\s+group\s+chat', itchat_msg["Content"])[0]
elif "joined" in itchat_msg["Content"]: # 匹配通过二维码加入的英文信息
self.actual_user_nickname = re.findall(r'"(.*?)" joined the group chat via the QR Code shared by', itchat_msg["Content"])[0]
elif "加入了群聊" in itchat_msg["Content"]:
self.actual_user_nickname = re.findall(r"\"(.*?)\"", itchat_msg["Content"])[-1]
elif "加入群聊" in itchat_msg["Content"]:
Expand Down

0 comments on commit b33daff

Please sign in to comment.