From d3e8d023fe8c3ab76fa0d6b471a251dcac00347c Mon Sep 17 00:00:00 2001 From: Changhua Date: Sun, 25 Sep 2022 20:18:18 +0800 Subject: [PATCH] Avoid exception when target nickname not found --- robot/base_robot.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/robot/base_robot.py b/robot/base_robot.py index 1f0cd5d..950b2ab 100644 --- a/robot/base_robot.py +++ b/robot/base_robot.py @@ -37,7 +37,7 @@ class BaseRobot(object): wxids = at_list.split(",") for wxid in wxids: # 这里偷个懒,直接 @昵称。有必要的话可以通过 MicroMsg.db 里的 ChatRoom 表,解析群昵称 - ats = f" @{self.allContacts[wxid]}" + ats = f" @{self.allContacts.get(wxid, '')}" self.sdk.WxSendTextMsg(receiver, f"{msg}{ats}", at_list)