From 865fd6af4c1e5bdcf3d08804fa676d63dee9bcdf Mon Sep 17 00:00:00 2001 From: yanyongyu Date: Sat, 15 Aug 2020 17:47:50 +0800 Subject: [PATCH] fix nonebot-test --- nonebot/__init__.py | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/nonebot/__init__.py b/nonebot/__init__.py index 1611e714..0049bf76 100644 --- a/nonebot/__init__.py +++ b/nonebot/__init__.py @@ -10,11 +10,6 @@ from nonebot.config import Env, Config from nonebot.adapters.cqhttp import Bot as CQBot from nonebot.typing import Type, Union, Driver, Optional, NoReturn -try: - import nonebot_test -except ImportError: - nonebot_test = None - _driver: Optional[Driver] = None @@ -34,6 +29,17 @@ def get_asgi(): return driver.asgi +def get_bots(): + driver = get_driver() + return driver.bots + + +try: + import nonebot_test +except ImportError: + nonebot_test = None + + def init(*, _env_file: Optional[str] = None, **kwargs): global _driver env = Env()