Skip to content

Commit f824fff

Browse files
committed
Add function get_user_id.
1 parent cf42400 commit f824fff

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

wxbot.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -484,6 +484,16 @@ def send_msg_by_uid(self, word, dst='filehelper'):
484484
dic = r.json()
485485
return dic['BaseResponse']['Ret'] == 0
486486

487+
def get_user_id(self, name):
488+
for contact in self.contact_list:
489+
if 'RemarkName' in contact and contact['RemarkName'] == name:
490+
return contact['UserName']
491+
elif 'NickName' in contact and contact['NickName'] == name:
492+
return contact['UserName']
493+
elif 'DisplayName' in contact and contact['DisplayName'] == name:
494+
return contact['UserName']
495+
return ''
496+
487497
def send_msg(self, name, word, isfile=False):
488498
uid = self.get_user_id(name)
489499
if uid:

0 commit comments

Comments
 (0)