🐛 修复Config add配置时显示问题 (#1835)

This commit is contained in:
HibiKier 2025-01-16 09:13:28 +08:00 committed by GitHub
parent 63145ffee0
commit d0b1024566
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 3 additions and 0 deletions

View File

@ -62,6 +62,7 @@ def _generate_simple_config(exists_module: list[str]):
# 读取用户配置
_data = {}
_tmp_data = {}
exists_module += Config.add_module
if SIMPLE_CONFIG_FILE.exists():
_data = _yaml.load(SIMPLE_CONFIG_FILE.open(encoding="utf8"))
# 将简易配置文件的数据填充到配置文件

View File

@ -266,6 +266,7 @@ class ConfigsManager:
self._data: dict[str, ConfigGroup] = {}
self._simple_data: dict = {}
self._simple_file = DATA_PATH / "config.yaml"
self.add_module = []
_yaml = YAML()
if file:
file.parent.mkdir(exist_ok=True, parents=True)
@ -328,6 +329,7 @@ class ConfigsManager:
if not module or not key:
raise ValueError("add_plugin_config: module和key不能为为空")
self.add_module.append(f"{module}:{key}".lower())
if module in self._data and (config := self._data[module].configs.get(key)):
config.help = help
config.arg_parser = arg_parser