如果需要 保存到 config 可以少调用一次

This commit is contained in:
po-lan 2022-06-16 14:38:41 +08:00 committed by GitHub
parent 15ce9c91fb
commit 3a43ed6919
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -94,12 +94,13 @@ class ConfigsManager:
del self._data[module]
self.save()
def set_config(self, module: str, key: str, value: Any):
def set_config(self, module: str, key: str, value: Any , save_simple_data: bool = False):
"""
设置配置值
:param module: 模块名
:param key: 配置名称
:param value:
:param save_simple_data: 同时保存至config.yaml
"""
if module in self._data.keys():
if (
@ -108,7 +109,7 @@ class ConfigsManager:
):
self._data[module][key]["value"] = value
self._simple_data[module][key] = value
self.save()
self.save(save_simple_data = save_simple_data)
def set_help(self, module: str, key: str, help_: str):
"""