|
3 | 3 | import logging |
4 | 4 | import enum |
5 | 5 | from .default import DEFAULT_CONFIG, DEFAULT_VALUE_MAP |
6 | | -from typing import Dict |
7 | 6 | from astrbot.core.utils.astrbot_path import get_astrbot_data_path |
8 | 7 |
|
9 | 8 | ASTRBOT_CONFIG_PATH = os.path.join(get_astrbot_data_path(), "cmd_config.json") |
@@ -45,7 +44,7 @@ def __init__( |
45 | 44 | json.dump(default_config, f, indent=4, ensure_ascii=False) |
46 | 45 | object.__setattr__(self, "first_deploy", True) # 标记第一次部署 |
47 | 46 |
|
48 | | - with open(config_path, "r", encoding="utf-8-sig") as f: |
| 47 | + with open(config_path, encoding="utf-8-sig") as f: |
49 | 48 | conf_str = f.read() |
50 | 49 | conf = json.loads(conf_str) |
51 | 50 |
|
@@ -82,7 +81,7 @@ def _parse_schema(schema: dict, conf: dict): |
82 | 81 |
|
83 | 82 | return conf |
84 | 83 |
|
85 | | - def check_config_integrity(self, refer_conf: Dict, conf: Dict, path=""): |
| 84 | + def check_config_integrity(self, refer_conf: dict, conf: dict, path=""): |
86 | 85 | """检查配置完整性,如果有新的配置项或顺序不一致则返回 True""" |
87 | 86 | has_new = False |
88 | 87 |
|
@@ -140,7 +139,7 @@ def check_config_integrity(self, refer_conf: Dict, conf: Dict, path=""): |
140 | 139 |
|
141 | 140 | return has_new |
142 | 141 |
|
143 | | - def save_config(self, replace_config: Dict = None): |
| 142 | + def save_config(self, replace_config: dict = None): |
144 | 143 | """将配置写入文件 |
145 | 144 |
|
146 | 145 | 如果传入 replace_config,则将配置替换为 replace_config |
|
0 commit comments