From 413e09fb9ec26ec9aec82964ba2214d544b32692 Mon Sep 17 00:00:00 2001 From: 6vision Date: Thu, 14 Dec 2023 00:50:34 +0800 Subject: [PATCH] =?UTF-8?q?1=E3=80=81=E4=BC=81=E5=BE=AE=E4=B8=AA=E4=BA=BA?= =?UTF-8?q?=E5=8F=B7=E6=94=AF=E6=8C=81=E6=96=87=E4=BB=B6=E5=92=8C=E9=93=BE?= =?UTF-8?q?=E6=8E=A5=E6=B6=88=E6=81=AF=202=E3=80=81=E4=BF=AE=E5=A4=8D?= =?UTF-8?q?=E4=BC=81=E5=BE=AE=E4=B8=AA=E4=BA=BA=E5=8F=B7=E7=BE=A4=E5=90=8D?= =?UTF-8?q?=E8=8E=B7=E5=8F=96bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- channel/wework/wework_channel.py | 2 +- channel/wework/wework_message.py | 13 +++++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/channel/wework/wework_channel.py b/channel/wework/wework_channel.py index fb77843..1020261 100644 --- a/channel/wework/wework_channel.py +++ b/channel/wework/wework_channel.py @@ -120,7 +120,7 @@ def _check(func): @wework.msg_register( - [ntwork.MT_RECV_TEXT_MSG, ntwork.MT_RECV_IMAGE_MSG, 11072, ntwork.MT_RECV_VOICE_MSG]) + [ntwork.MT_RECV_TEXT_MSG, ntwork.MT_RECV_IMAGE_MSG, 11072, ntwork.MT_RECV_LINK_CARD_MSG,ntwork.MT_RECV_FILE_MSG, ntwork.MT_RECV_VOICE_MSG]) def all_msg_handler(wework_instance: ntwork.WeWork, message): logger.debug(f"收到消息: {message}") if 'data' in message: diff --git a/channel/wework/wework_message.py b/channel/wework/wework_message.py index e95dfb1..17e27f4 100644 --- a/channel/wework/wework_message.py +++ b/channel/wework/wework_message.py @@ -128,6 +128,18 @@ class WeworkMessage(ChatMessage): self.ctype = ContextType.IMAGE self.content = os.path.join(current_dir, "tmp", file_name) self._prepare_fn = lambda: cdn_download(wework, wework_msg, file_name) + elif wework_msg["type"] == 11045: # 文件消息 + print("文件消息") + print(wework_msg) + file_name = datetime.datetime.now().strftime('%Y%m%d%H%M%S') + file_name = file_name + wework_msg['data']['cdn']['file_name'] + current_dir = os.getcwd() + self.ctype = ContextType.FILE + self.content = os.path.join(current_dir, "tmp", file_name) + self._prepare_fn = lambda: cdn_download(wework, wework_msg, file_name) + elif wework_msg["type"] == 11047: # 链接消息 + self.ctype = ContextType.SHARING + self.content = wework_msg['data']['url'] elif wework_msg["type"] == 11072: # 新成员入群通知 self.ctype = ContextType.JOIN_GROUP member_list = wework_msg['data']['member_list'] @@ -179,6 +191,7 @@ class WeworkMessage(ChatMessage): if conversation_id: room_info = get_room_info(wework=wework, conversation_id=conversation_id) self.other_user_nickname = room_info.get('nickname', None) if room_info else None + self.from_user_nickname = room_info.get('nickname', None) if room_info else None at_list = data.get('at_list', []) tmp_list = [] for at in at_list: