From 83005e9ba991ecb406b8c6a07d7d275dda94443f Mon Sep 17 00:00:00 2001 From: LINSTCL Date: Mon, 6 Mar 2023 09:40:33 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E9=85=8D=E7=BD=AE=E6=96=87?= =?UTF-8?q?=E4=BB=B6=E5=AE=8C=E6=95=B4=E6=80=A7=E6=A0=A1=E9=AA=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- main.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/main.py b/main.py index 0d130c9..6f39f33 100644 --- a/main.py +++ b/main.py @@ -129,6 +129,14 @@ def main(first_time_init=False): config = importlib.import_module('config') + #配置完整性校验 + config_template = importlib.import_module('config-template') + for key in dir(config_template): + if not hasattr(config, key): + setattr(config, key, getattr(config_template, key)) + logging.warning("[{}]未配置,请更新或检查config.py".format(key)) + input('按回车继续...') + import pkg.utils.context pkg.utils.context.set_config(config) @@ -182,8 +190,7 @@ def main(first_time_init=False): # 初始化qq机器人 qqbot = pkg.qqbot.manager.QQBotManager(mirai_http_api_config=config.mirai_http_api_config, timeout=config.process_message_timeout, retry=config.retry_times, - first_time_init=first_time_init, - pool_num=config.pool_num if hasattr(config, 'pool_num') else 10) + first_time_init=first_time_init, pool_num=config.pool_num) # 加载插件 import pkg.plugin.host