From 64f251b5759fd0cd235ef69cf653bb41e02d167f Mon Sep 17 00:00:00 2001 From: chase535 <107602367+chase535@users.noreply.github.com> Date: Fri, 19 Aug 2022 01:19:06 +0800 Subject: [PATCH] Update messages.py --- WeChatPush/itchat/async_components/messages.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/WeChatPush/itchat/async_components/messages.py b/WeChatPush/itchat/async_components/messages.py index f0f7d7a..7eea3c7 100644 --- a/WeChatPush/itchat/async_components/messages.py +++ b/WeChatPush/itchat/async_components/messages.py @@ -74,10 +74,8 @@ def produce_msg(core, msgList): # by default we think there may be a user missing not a mp m['User'].core = core msg = {'ChatRoom': '0', 'NotifyCloseContact': '0'} - if m.get('FromUserName') == 'weixin': + if str(m.get('FromUserName')) == 'weixin': msg['Name'] = msg['NickName'] = '微信团队' - elif m.get('MsgType') == 37: - msg['Name'] = msg['NickName'] = m.get('RecommendInfo').get('NickName') elif '@@' in str(m.get('FromUserName')) or '@@' in str(m.get('ToUserName')): msg['ChatRoom'] = '1' msg['NickName'] = msg['ChatRoomName'] = m.get('User').get('NickName') @@ -100,6 +98,7 @@ def produce_msg(core, msgList): elif m.get('MsgType') == 34: # voice msg['Type'] = 'Recording' elif m.get('MsgType') == 37: # friends + msg['Name'] = msg['NickName'] = m.get('RecommendInfo').get('NickName') msg['Type'] = 'Friends' elif m.get('MsgType') == 42: # name card msg['Type'] = 'Card'