From f6f8bd05b6b08e86f5cb0fa0a37e8a5194b21090 Mon Sep 17 00:00:00 2001 From: ljc545w Date: Sat, 26 Mar 2022 17:58:10 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0py=E7=A4=BA=E4=BE=8B=E6=96=87?= =?UTF-8?q?=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- wxRobot.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/wxRobot.py b/wxRobot.py index 46afcb2..16dbb9c 100644 --- a/wxRobot.py +++ b/wxRobot.py @@ -132,13 +132,18 @@ class WeChatRobot(): _EnumFriendStatus = { 0xB0:'被删除', 0xB1:'是好友', + 0xB2:'已拉黑', 0xB5:'被拉黑', } status = self.robot.CCheckFriendStatus(wxid) if status == 0x0: print('请先初始化再进行检测!') assert False - return _EnumFriendStatus[status] + try: + return _EnumFriendStatus[status] + except KeyError: + return "未知状态:{}".format( + hex(status).upper().replace('0X','0x')) def test_SendText(): import os @@ -185,4 +190,4 @@ def test_FriendStatus(): if __name__ == '__main__': test_SendText() - \ No newline at end of file + -- GitLab