mirror of
https://github.com/zhenxun-org/zhenxun_bot.git
synced 2025-12-14 21:52:56 +08:00
✨ feat(configs): 优化 ConfigsManager 中的键值获取逻辑,确保未定义键时自动创建 ConfigGroup 实例 (#2058)
This commit is contained in:
parent
c667fc215e
commit
761c8daac4
@ -344,7 +344,9 @@ class ConfigsManager:
|
|||||||
返回:
|
返回:
|
||||||
ConfigGroup: ConfigGroup
|
ConfigGroup: ConfigGroup
|
||||||
"""
|
"""
|
||||||
return self._data.get(key) or ConfigGroup(module="")
|
if key not in self._data:
|
||||||
|
self._data[key] = ConfigGroup(module=key)
|
||||||
|
return self._data[key]
|
||||||
|
|
||||||
def save(self, path: str | Path | None = None, save_simple_data: bool = False):
|
def save(self, path: str | Path | None = None, save_simple_data: bool = False):
|
||||||
"""保存数据
|
"""保存数据
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user