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'