提交 9e4a701a 编写于 作者: L LittleCoder

Fix actualusername fetch bugs

上级 06daef0d
......@@ -190,28 +190,36 @@ def produce_msg(core, msgList):
def produce_group_chat(core, msg):
r = re.match('(@[0-9a-z]*?):<br/>(.*)$', msg['Content'])
if not r:
utils.msg_formatter(msg, 'Content')
if r:
actualUserName, content = r.groups()
chatroomUserName = msg['FromUserName']
elif msg['FromUserName'] == core.storageClass.userName:
actualUserName = core.storageClass.userName
content = msg['Content']
chatroomUserName = msg['ToUserName']
else:
logger.warning('New structure of groupchat detected, please report a bug.')
return
actualUserName, content = r.groups()
chatroom = core.storageClass.search_chatrooms(userName=msg['FromUserName'])
chatroom = core.storageClass.search_chatrooms(userName=chatroomUserName)
member = utils.search_dict_list((chatroom or {}).get(
'MemberList') or [], 'UserName', actualUserName)
if member is None:
chatroom = core.update_chatroom(msg['FromUserName'])
member = utils.search_dict_list((chatroom or {}).get(
'MemberList') or [], 'UserName', actualUserName)
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))
if member is None:
print(chatroom['MemberList'])
logger.debug('chatroom member fetch failed with %s' % actualUserName)
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))
def send_raw_msg(self, msgType, content, toUserName):
url = '%s/webwxsendmsg' % self.loginInfo['url']
......
import os, platform
VERSION = '1.2.20'
VERSION = '1.2.21'
BASE_URL = 'https://login.weixin.qq.com'
OS = platform.system() #Windows, Linux, Darwin
DIR = os.getcwd()
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册