diff --git a/astrbot/core/config/default.py b/astrbot/core/config/default.py index 13be0b498..4a6364979 100644 --- a/astrbot/core/config/default.py +++ b/astrbot/core/config/default.py @@ -248,6 +248,9 @@ CONFIG_METADATA_2 = { "description": "平台设置", "type": "object", "items": { + "plugin_enable": { + "invisible": True, # 隐藏插件启用配置 + }, "unique_session": { "description": "会话隔离", "type": "bool", diff --git a/astrbot/core/pipeline/platform_compatibility/stage.py b/astrbot/core/pipeline/platform_compatibility/stage.py index 0b0b04fda..644912c26 100644 --- a/astrbot/core/pipeline/platform_compatibility/stage.py +++ b/astrbot/core/pipeline/platform_compatibility/stage.py @@ -3,6 +3,7 @@ from ..context import PipelineContext from typing import Union, AsyncGenerator from astrbot.core.platform.astr_message_event import AstrMessageEvent from astrbot.core.star.star import star_map +from astrbot.core.star.star_handler import StarHandlerMetadata from astrbot.core import logger @@ -34,6 +35,8 @@ class PlatformCompatibilityStage(Stage): # 标记不兼容的处理器 for handler in activated_handlers: + if not isinstance(handler, StarHandlerMetadata): + continue # 检查处理器是否在当前平台启用 enabled = handler.is_enabled_for_platform(platform_id) if not enabled: @@ -43,6 +46,7 @@ class PlatformCompatibilityStage(Stage): f"[PlatformCompatibilityStage] 插件 {plugin_name} 在平台 {platform_id} 未启用,标记处理器 {handler.handler_name} 为平台不兼容" ) # 设置处理器为平台不兼容状态 + # TODO: 更好的标记方式 handler.platform_compatible = False else: # 确保处理器为平台兼容状态 diff --git a/astrbot/core/utils/shared_preferences.py b/astrbot/core/utils/shared_preferences.py index bf88ba8db..b11987322 100644 --- a/astrbot/core/utils/shared_preferences.py +++ b/astrbot/core/utils/shared_preferences.py @@ -15,7 +15,7 @@ class SharedPreferences: def _save_preferences(self): with open(self.path, "w") as f: - json.dump(self._data, f, indent=4) + json.dump(self._data, f, indent=4, ensure_ascii=False) f.flush() def get(self, key, default=None):