From 28f02b58e05a3c02095f59d2485e63083783f6d4 Mon Sep 17 00:00:00 2001 From: liuwei Date: Mon, 19 May 2025 17:23:01 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B0=83=E6=95=B4=E5=BF=83=E8=B7=B3=E7=AD=96?= =?UTF-8?q?=E7=95=A5=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- robot.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/robot.py b/robot.py index 73ea8a6..b31da03 100644 --- a/robot.py +++ b/robot.py @@ -218,9 +218,9 @@ class Robot(Job): data = await self.ipad_bot.sync_message() except Exception as e: self.LOG.error(f"获取新消息失败 {e}") - if e == "用户可能退出": - self.LOG.error(f"获取新消息失败 {e},请重启应用重新登录!") - self.ipad_running = False + if "用户可能退出" in str(e): + self.LOG.error(f"用户可能退出: {e}") + self.login_twice_auto_auth() await asyncio.sleep(5) continue @@ -319,6 +319,9 @@ class Robot(Job): self.LOG.warning("心跳失败") except Exception as e: self.LOG.error(f"wechat_ipad heartbeat: {e}") + if "用户可能退出" in str(e): + self.LOG.error(f"用户可能退出: {e}") + self.login_twice_auto_auth() await asyncio.sleep(60) async def _heartbeat_task_long(self): @@ -333,6 +336,9 @@ class Robot(Job): self.LOG.warning("长连接心跳失败") except Exception as e: self.LOG.error(f"wechat_ipad heartbeat long: {e}") + if "用户可能退出" in str(e): + self.LOG.error(f"用户可能退出: {e}") + self.login_twice_auto_auth() await asyncio.sleep(120) async def _process_ipad_message(self, message: WxMessage):