From 6b91d446532023b832ce8b111b3ac39e7c3ea5ff Mon Sep 17 00:00:00 2001 From: uy_sun Date: Sat, 11 Nov 2023 11:49:40 +0800 Subject: [PATCH] :bug: ensure bot connected before disconnect it --- nonebot/adapters/qq/adapter.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/nonebot/adapters/qq/adapter.py b/nonebot/adapters/qq/adapter.py index 0dd3489..1b24216 100644 --- a/nonebot/adapters/qq/adapter.py +++ b/nonebot/adapters/qq/adapter.py @@ -199,7 +199,8 @@ async def _forward_ws(self, bot: Bot, ws_url: URL, shard: Tuple[int, int]) -> No if heartbeat_task: heartbeat_task.cancel() heartbeat_task = None - self.bot_disconnect(bot) + if bot.self_id in self.bots: + self.bot_disconnect(bot) except Exception as e: log(