From f618b8fcdc05240e6023053312904f4fe7762c1e Mon Sep 17 00:00:00 2001 From: Flartiny <1335348298@qq.com> Date: Tue, 3 Jun 2025 14:04:04 +0800 Subject: [PATCH] fix: residual configuration items after plugin configuration modification --- astrbot/core/config/astrbot_config.py | 6 ++++++ astrbot/core/star/star_manager.py | 4 ++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/astrbot/core/config/astrbot_config.py b/astrbot/core/config/astrbot_config.py index 1ee0fac7f..98794c9dd 100644 --- a/astrbot/core/config/astrbot_config.py +++ b/astrbot/core/config/astrbot_config.py @@ -99,6 +99,12 @@ class AstrBotConfig(dict): has_new |= self.check_config_integrity( value, conf[key], path + "." + key if path else key ) + for key in list(conf.keys()): + if key not in refer_conf: + path_ = path + "." + key if path else key + logger.info(f"检查到配置项 {path_} 不存在,将从当前配置中删除") + del conf[key] + has_new = True return has_new def save_config(self, replace_config: Dict = None): diff --git a/astrbot/core/star/star_manager.py b/astrbot/core/star/star_manager.py index 44e018dfc..13c93f226 100644 --- a/astrbot/core/star/star_manager.py +++ b/astrbot/core/star/star_manager.py @@ -451,11 +451,11 @@ class PluginManager: metadata.repo = metadata_yaml.repo except Exception: pass - + metadata.config = plugin_config if path not in inactivated_plugins: # 只有没有禁用插件时才实例化插件类 if plugin_config: - metadata.config = plugin_config + # metadata.config = plugin_config try: metadata.star_cls = metadata.star_cls_type( context=self.context, config=plugin_config