diff --git a/README.md b/README.md index dca6435c..1ba9e11c 100644 --- a/README.md +++ b/README.md @@ -240,6 +240,8 @@ A: 有些账号是天生无法给自己的账号发送信息的,建议使用`f [sjdy521/Mojo-Weixin][Mojo-Weixin]: 使用Perl语言编写的微信客户端框架,可通过插件提供基于HTTP协议的api接口供其他语言调用 +[HanSon/vbot][HanSon-vbot]: 基于PHP7的微信个人号机器人,通过实现匿名函数可以方便地实现各种自定义的功能 + ## 问题和建议 如果有什么问题或者建议都可以在这个[Issue][issue#1]和我讨论 @@ -268,4 +270,5 @@ A: 有些账号是天生无法给自己的账号发送信息的,建议使用`f [liuwons-wxBot]: https://github.com/liuwons/wxBot [zixia-wechaty]: https://github.com/zixia/wechaty [Mojo-Weixin]: https://github.com/sjdy521/Mojo-Weixin +[HanSon-vbot]: https://github.com/hanson/vbot [issue#1]: https://github.com/littlecodersh/ItChat/issues/1 diff --git a/itchat/components/contact.py b/itchat/components/contact.py index 35793d64..1fc98bec 100644 --- a/itchat/components/contact.py +++ b/itchat/components/contact.py @@ -118,8 +118,12 @@ def update_local_chatrooms(core, l): # format new chatrooms utils.emoji_formatter(chatroom, 'NickName') for member in chatroom['MemberList']: - utils.emoji_formatter(member, 'NickName') - utils.emoji_formatter(member, 'DisplayName') + if 'NickName' in member: + utils.emoji_formatter(member, 'NickName') + if 'DisplayName' in member: + utils.emoji_formatter(member, 'DisplayName') + if 'RemarkName' in member: + utils.emoji_formatter(member, 'RemarkName') # update it to old chatrooms oldChatroom = utils.search_dict_list( core.chatroomList, 'UserName', chatroom['UserName']) @@ -180,6 +184,8 @@ def update_local_friends(core, l): utils.emoji_formatter(friend, 'NickName') if 'DisplayName' in friend: utils.emoji_formatter(friend, 'DisplayName') + if 'RemarkName' in member: + utils.emoji_formatter(member, 'RemarkName') oldInfoDict = utils.search_dict_list( fullList, 'UserName', friend['UserName']) if oldInfoDict is None: diff --git a/itchat/components/messages.py b/itchat/components/messages.py index 2c3d0081..9f3cd10d 100644 --- a/itchat/components/messages.py +++ b/itchat/components/messages.py @@ -209,6 +209,7 @@ def produce_group_chat(core, msg): msg['ActualUserName'] = core.storageClass.userName msg['ActualNickName'] = core.storageClass.nickName msg['isAt'] = False + utils.msg_formatter(msg, 'Content') return chatroom = core.storageClass.search_chatrooms(userName=chatroomUserName) member = utils.search_dict_list((chatroom or {}).get( @@ -219,16 +220,18 @@ def produce_group_chat(core, msg): 'MemberList') or [], 'UserName', actualUserName) if member is None: logger.debug('chatroom member fetch failed with %s' % actualUserName) + msg['ActualNickName'] = '' + msg['isAt'] = False else: - msg['ActualUserName'] = actualUserName msg['ActualNickName'] = member['DisplayName'] or member['NickName'] - msg['Content'] = content - utils.msg_formatter(msg, 'Content') atFlag = '@' + (chatroom['self']['DisplayName'] or core.storageClass.nickName) msg['isAt'] = ( (atFlag + (u'\u2005' if u'\u2005' in msg['Content'] else ' ')) in msg['Content'] or msg['Content'].endswith(atFlag)) + msg['ActualUserName'] = actualUserName + msg['Content'] = content + utils.msg_formatter(msg, 'Content') def send_raw_msg(self, msgType, content, toUserName): url = '%s/webwxsendmsg' % self.loginInfo['url'] diff --git a/itchat/config.py b/itchat/config.py index 54cb644c..ab17ffbe 100644 --- a/itchat/config.py +++ b/itchat/config.py @@ -1,6 +1,6 @@ import os, platform -VERSION = '1.2.32' +VERSION = '1.2.33' BASE_URL = 'https://login.weixin.qq.com' OS = platform.system() #Windows, Linux, Darwin DIR = os.getcwd() diff --git a/itchat/content.py b/itchat/content.py index 4517c521..429f2f5b 100644 --- a/itchat/content.py +++ b/itchat/content.py @@ -4,8 +4,11 @@ NOTE = 'Note' SHARING = 'Sharing' PICTURE = 'Picture' -RECORDING = 'Recording' +RECORDING = VOICE = 'Recording' ATTACHMENT = 'Attachment' VIDEO = 'Video' FRIENDS = 'Friends' SYSTEM = 'System' + +INCOME_MSG = [TEXT, MAP, CARD, NOTE, SHARING, PICTURE, + RECORDING, VOICE, ATTACHMENT, VIDEO, FRIENDS, SYSTEM]