From a0ae2d13dc3e77c449ca732a18ff57c2f16779a3 Mon Sep 17 00:00:00 2001 From: befantasy <31535803+befantasy@users.noreply.github.com> Date: Thu, 28 Sep 2023 16:11:09 +0800 Subject: [PATCH 1/3] =?UTF-8?q?Update=20context.py=20=E6=96=B0=E5=A2=9ECon?= =?UTF-8?q?textType=20"ACCEPT=5FFRIEND"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- bridge/context.py | 1 + 1 file changed, 1 insertion(+) diff --git a/bridge/context.py b/bridge/context.py index 4f2df1f..1e5958c 100644 --- a/bridge/context.py +++ b/bridge/context.py @@ -12,6 +12,7 @@ class ContextType(Enum): SHARING = 6 # 分享信息 IMAGE_CREATE = 10 # 创建图片命令 + ACCEPT_FRIEND = 19 # 同意好友请求 JOIN_GROUP = 20 # 加入群聊 PATPAT = 21 # 拍了拍 FUNCTION = 22 # 函数调用 From 5b552dffbf16e4f566255414f6a45d94d9a87315 Mon Sep 17 00:00:00 2001 From: befantasy <31535803+befantasy@users.noreply.github.com> Date: Thu, 28 Sep 2023 16:16:30 +0800 Subject: [PATCH 2/3] =?UTF-8?q?Update=20wechat=5Fchannel.py=20=E6=96=B0?= =?UTF-8?q?=E5=A2=9E=20ContextType.ACCEPT=5FFRIEND?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- channel/wechat/wechat_channel.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/channel/wechat/wechat_channel.py b/channel/wechat/wechat_channel.py index be7fbe2..504c368 100644 --- a/channel/wechat/wechat_channel.py +++ b/channel/wechat/wechat_channel.py @@ -167,7 +167,7 @@ class WechatChannel(ChatChannel): logger.debug("[WX]receive voice for group msg: {}".format(cmsg.content)) elif cmsg.ctype == ContextType.IMAGE: logger.debug("[WX]receive image for group msg: {}".format(cmsg.content)) - elif cmsg.ctype in [ContextType.JOIN_GROUP, ContextType.PATPAT]: + elif cmsg.ctype in [ContextType.JOIN_GROUP, ContextType.PATPAT, ContextType.ACCEPT_FRIEND]: logger.debug("[WX]receive note msg: {}".format(cmsg.content)) elif cmsg.ctype == ContextType.TEXT: # logger.debug("[WX]receive group msg: {}, cmsg={}".format(json.dumps(cmsg._rawmsg, ensure_ascii=False), cmsg)) From f72cd13fbadac31f0da581acf3e743a835ed41a2 Mon Sep 17 00:00:00 2001 From: befantasy <31535803+befantasy@users.noreply.github.com> Date: Thu, 28 Sep 2023 16:18:04 +0800 Subject: [PATCH 3/3] Update wechat_message.py --- channel/wechat/wechat_message.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/channel/wechat/wechat_message.py b/channel/wechat/wechat_message.py index 406162a..cf8b3e6 100644 --- a/channel/wechat/wechat_message.py +++ b/channel/wechat/wechat_message.py @@ -34,6 +34,9 @@ class WechatMessage(ChatMessage): self.actual_user_nickname = re.findall(r"\"(.*?)\"", itchat_msg["Content"])[-1] elif "加入群聊" in itchat_msg["Content"]: self.actual_user_nickname = re.findall(r"\"(.*?)\"", itchat_msg["Content"])[0] + elif "你已添加了" in itchat_msg["Content"]: #通过好友请求 + self.ctype = ContextType.ACCEPT_FRIEND + self.content = itchat_msg["Content"] elif "拍了拍我" in itchat_msg["Content"]: self.ctype = ContextType.PATPAT self.content = itchat_msg["Content"]