|
@@ -128,6 +128,18 @@ class WeworkMessage(ChatMessage): |
|
|
self.ctype = ContextType.IMAGE |
|
|
self.ctype = ContextType.IMAGE |
|
|
self.content = os.path.join(current_dir, "tmp", file_name) |
|
|
self.content = os.path.join(current_dir, "tmp", file_name) |
|
|
self._prepare_fn = lambda: cdn_download(wework, wework_msg, 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: # 新成员入群通知 |
|
|
elif wework_msg["type"] == 11072: # 新成员入群通知 |
|
|
self.ctype = ContextType.JOIN_GROUP |
|
|
self.ctype = ContextType.JOIN_GROUP |
|
|
member_list = wework_msg['data']['member_list'] |
|
|
member_list = wework_msg['data']['member_list'] |
|
@@ -179,6 +191,7 @@ class WeworkMessage(ChatMessage): |
|
|
if conversation_id: |
|
|
if conversation_id: |
|
|
room_info = get_room_info(wework=wework, conversation_id=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.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', []) |
|
|
at_list = data.get('at_list', []) |
|
|
tmp_list = [] |
|
|
tmp_list = [] |
|
|
for at in at_list: |
|
|
for at in at_list: |
|
|