🐛 assert bot when disconnect (#1757)

This commit is contained in:
Ju4tCode 2023-03-01 18:22:07 +08:00 committed by GitHub
parent be81d094b4
commit f3aa8c6aa5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -66,8 +66,9 @@ class Adapter(abc.ABC):
参数: 参数:
bot: {ref}`nonebot.adapters.Bot` 实例 bot: {ref}`nonebot.adapters.Bot` 实例
""" """
if self.bots.pop(bot.self_id, None) is None:
raise RuntimeError(f"{bot} not found in adapter {self.get_name()}")
self.driver._bot_disconnect(bot) self.driver._bot_disconnect(bot)
self.bots.pop(bot.self_id, None)
def setup_http_server(self, setup: HTTPServerSetup): def setup_http_server(self, setup: HTTPServerSetup):
"""设置一个 HTTP 服务器路由配置""" """设置一个 HTTP 服务器路由配置"""