mirror of
https://github.com/langbot-app/LangBot.git
synced 2025-11-26 03:44:58 +08:00
23 lines
501 B
Python
23 lines
501 B
Python
|
|
from . import model as file_model
|
||
|
|
from ..utils import context
|
||
|
|
|
||
|
|
|
||
|
|
class ConfigManager:
|
||
|
|
"""配置文件管理器"""
|
||
|
|
|
||
|
|
file: file_model.ConfigFile = None
|
||
|
|
"""配置文件实例"""
|
||
|
|
|
||
|
|
data: dict = None
|
||
|
|
"""配置数据"""
|
||
|
|
|
||
|
|
def __init__(self, cfg_file: file_model.ConfigFile) -> None:
|
||
|
|
self.file = cfg_file
|
||
|
|
self.data = {}
|
||
|
|
|
||
|
|
async def load_config(self):
|
||
|
|
self.data = await self.file.load()
|
||
|
|
|
||
|
|
async def dump_config(self):
|
||
|
|
await self.file.save(self.data)
|