mirror of
https://github.com/zhenxun-org/zhenxun_bot.git
synced 2025-12-15 14:22:55 +08:00
🐛 修复Config add配置时显示问题 (#1835)
This commit is contained in:
parent
63145ffee0
commit
d0b1024566
@ -62,6 +62,7 @@ def _generate_simple_config(exists_module: list[str]):
|
|||||||
# 读取用户配置
|
# 读取用户配置
|
||||||
_data = {}
|
_data = {}
|
||||||
_tmp_data = {}
|
_tmp_data = {}
|
||||||
|
exists_module += Config.add_module
|
||||||
if SIMPLE_CONFIG_FILE.exists():
|
if SIMPLE_CONFIG_FILE.exists():
|
||||||
_data = _yaml.load(SIMPLE_CONFIG_FILE.open(encoding="utf8"))
|
_data = _yaml.load(SIMPLE_CONFIG_FILE.open(encoding="utf8"))
|
||||||
# 将简易配置文件的数据填充到配置文件
|
# 将简易配置文件的数据填充到配置文件
|
||||||
|
|||||||
@ -266,6 +266,7 @@ class ConfigsManager:
|
|||||||
self._data: dict[str, ConfigGroup] = {}
|
self._data: dict[str, ConfigGroup] = {}
|
||||||
self._simple_data: dict = {}
|
self._simple_data: dict = {}
|
||||||
self._simple_file = DATA_PATH / "config.yaml"
|
self._simple_file = DATA_PATH / "config.yaml"
|
||||||
|
self.add_module = []
|
||||||
_yaml = YAML()
|
_yaml = YAML()
|
||||||
if file:
|
if file:
|
||||||
file.parent.mkdir(exist_ok=True, parents=True)
|
file.parent.mkdir(exist_ok=True, parents=True)
|
||||||
@ -328,6 +329,7 @@ class ConfigsManager:
|
|||||||
|
|
||||||
if not module or not key:
|
if not module or not key:
|
||||||
raise ValueError("add_plugin_config: module和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)):
|
if module in self._data and (config := self._data[module].configs.get(key)):
|
||||||
config.help = help
|
config.help = help
|
||||||
config.arg_parser = arg_parser
|
config.arg_parser = arg_parser
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user