mirror of
https://github.com/zhayujie/chatgpt-on-wechat.git
synced 2026-06-02 00:57:41 +08:00
feat: add support for PATPAT context
This commit is contained in:
@@ -31,7 +31,6 @@ class WeChatMessage(ChatMessage):
|
||||
"加入群聊" in itchat_msg["Content"] or "加入了群聊" in itchat_msg["Content"]
|
||||
):
|
||||
self.ctype = ContextType.JOIN_GROUP
|
||||
logger.debug("[WX]join group message: " + itchat_msg["Content"])
|
||||
self.content = itchat_msg["Content"]
|
||||
# 这里只能得到nickname, actual_user_id还是机器人的id
|
||||
if "加入了群聊" in itchat_msg["Content"]:
|
||||
@@ -42,6 +41,13 @@ class WeChatMessage(ChatMessage):
|
||||
self.actual_user_nickname = re.findall(
|
||||
r"\"(.*?)\"", itchat_msg["Content"]
|
||||
)[0]
|
||||
elif "拍了拍我" in itchat_msg["Content"]:
|
||||
self.ctype = ContextType.PATPAT
|
||||
self.content = itchat_msg["Content"]
|
||||
if is_group:
|
||||
self.actual_user_nickname = re.findall(
|
||||
r"\"(.*?)\"", itchat_msg["Content"]
|
||||
)[0]
|
||||
else:
|
||||
raise NotImplementedError(
|
||||
"Unsupported note message: " + itchat_msg["Content"]
|
||||
@@ -82,5 +88,5 @@ class WeChatMessage(ChatMessage):
|
||||
if self.is_group:
|
||||
self.is_at = itchat_msg["IsAt"]
|
||||
self.actual_user_id = itchat_msg["ActualUserName"]
|
||||
if self.ctype != ContextType.JOIN_GROUP:
|
||||
if self.ctype not in [ContextType.JOIN_GROUP, ContextType.PATPAT]:
|
||||
self.actual_user_nickname = itchat_msg["ActualNickName"]
|
||||
|
||||
Reference in New Issue
Block a user