mirror of
https://github.com/RockChinQ/QChatGPT.git
synced 2024-11-16 03:32:33 +08:00
添加配置文件完整性校验
This commit is contained in:
parent
f0c78f0529
commit
83005e9ba9
11
main.py
11
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
|
||||
|
|
Loading…
Reference in New Issue
Block a user