🐛 当没有 .env 文件时意外加载错误的环境变量

This commit is contained in:
Expliyh 2024-05-17 18:00:07 +08:00
parent 246e43317f
commit 4c65a308d6
No known key found for this signature in database
GPG Key ID: F30DE0CFF6157916

View File

@ -7,8 +7,9 @@ from .defines import *
def auto_set_env(config: dict): def auto_set_env(config: dict):
dotenv.load_dotenv() dotenv.load_dotenv(".env")
if os.getenv("DRIVER", None) is not None: if os.getenv("DRIVER", None) is not None:
print(os.getenv("DRIVER"))
nonebot.logger.info("Driver already set in environment variable, skip auto configure.") nonebot.logger.info("Driver already set in environment variable, skip auto configure.")
return return
if config.get("satori", {'enable': False}).get("enable", False): if config.get("satori", {'enable': False}).get("enable", False):