Skip to content

Commit

Permalink
reformat code
Browse files Browse the repository at this point in the history
  • Loading branch information
liuwangsheng01 committed Aug 17, 2016
1 parent 134ae98 commit a95b4d0
Showing 1 changed file with 10 additions and 11 deletions.
21 changes: 10 additions & 11 deletions wxbot.py
Original file line number Diff line number Diff line change
Expand Up @@ -542,17 +542,16 @@ def handle_msg(self, r):
if msg['MsgType'] == 51: # init message
msg_type_id = 0
user['name'] = 'system'
elif msg['MsgType'] == 37:# 有人加好友 ,37为加好友信息?
weixinhao=msg['Content']
weixinhao=weixinhao[weixinhao.index('fromusername='):weixinhao.index('encryptusername')]
weixinhao=weixinhao[weixinhao.index('"')+1:weixinhao.rindex('"')]
print u'[INFO] 请求加好友!'
print u' 昵称:' + msg['RecommendInfo']['NickName']
#print u'ID:' + msg['RecommendInfo']['UserName']
print u' 附加消息:'+msg['RecommendInfo']['Content']
#print u'Ticket:'+msg['RecommendInfo']['Ticket'] # Ticket添加好友时要用
print u' 微信号:'+weixinhao #未设置微信号的 腾讯会自动生成一段微信ID 但是无法通过搜索 搜索到此人
return
elif msg['MsgType'] == 37: # friend request
pass
# content = msg['Content']
# username = content[content.index('fromusername='): content.index('encryptusername')]
# username = username[username.index('"') + 1: username.rindex('"')]
# print u'[Friend Request]'
# print u' Nickname:' + msg['RecommendInfo']['NickName']
# print u' 附加消息:'+msg['RecommendInfo']['Content']
# # print u'Ticket:'+msg['RecommendInfo']['Ticket'] # Ticket添加好友时要用
# print u' 微信号:'+username #未设置微信号的 腾讯会自动生成一段微信ID 但是无法通过搜索 搜索到此人
elif msg['FromUserName'] == self.my_account['UserName']: # Self
msg_type_id = 1
user['name'] = 'self'
Expand Down

0 comments on commit a95b4d0

Please sign in to comment.