From d7d1c1544a29cb4e2dc4ccc8ea08206b6c70cb77 Mon Sep 17 00:00:00 2001 From: Soulter <905617992@qq.com> Date: Sat, 12 Apr 2025 15:01:38 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20fix:=20=E4=BF=AE=E5=A4=8D?= =?UTF-8?q?=E9=87=8D=E5=90=AFbot=E6=97=B6=E5=8F=AF=E8=83=BD=E5=8F=91?= =?UTF-8?q?=E7=94=9F=E6=8A=A5=E9=94=99=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 在 gewechat, wecom 等消息平台没启动成功的情况下重启bot会报错 --- .../platform/sources/gewechat/gewechat_platform_adapter.py | 5 ++++- astrbot/core/platform/sources/wecom/wecom_adapter.py | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/astrbot/core/platform/sources/gewechat/gewechat_platform_adapter.py b/astrbot/core/platform/sources/gewechat/gewechat_platform_adapter.py index 930359837..7d8dddfca 100644 --- a/astrbot/core/platform/sources/gewechat/gewechat_platform_adapter.py +++ b/astrbot/core/platform/sources/gewechat/gewechat_platform_adapter.py @@ -67,7 +67,10 @@ class GewechatPlatformAdapter(Platform): async def terminate(self): self.client.shutdown_event.set() - await self.client.server.shutdown() + try: + await self.client.server.shutdown() + except Exception as _: + pass logger.info("Gewechat 适配器已被优雅地关闭。") async def logout(self): diff --git a/astrbot/core/platform/sources/wecom/wecom_adapter.py b/astrbot/core/platform/sources/wecom/wecom_adapter.py index 4386a80ab..c6b7c096d 100644 --- a/astrbot/core/platform/sources/wecom/wecom_adapter.py +++ b/astrbot/core/platform/sources/wecom/wecom_adapter.py @@ -237,5 +237,8 @@ class WecomPlatformAdapter(Platform): async def terminate(self): self.server.shutdown_event.set() - await self.server.server.shutdown() + try: + await self.server.server.shutdown() + except Exception as _: + pass logger.info("企业微信 适配器已被优雅地关闭")