From ce640e61f4e6ede2f6fdbdb186f25e3f7cf6dd35 Mon Sep 17 00:00:00 2001 From: SXP-Simon Date: Sun, 8 Feb 2026 18:27:25 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20resolve=20AttributeError=20by=20using=20?= =?UTF-8?q?context.get=5Fconfig()=20to=20access=20plugin=5Fset=20=EF=BC=88?= =?UTF-8?q?=E4=BB=85=E6=B5=8B=E8=AF=95=EF=BC=8C=E5=90=8E=E6=9C=9F=E9=9C=80?= =?UTF-8?q?=E8=A6=81=E7=BA=A0=E6=AD=A3=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- main.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/main.py b/main.py index c278841..d283599 100644 --- a/main.py +++ b/main.py @@ -67,6 +67,20 @@ class QQGroupDailyAnalysis(Star): async def on_platform_loaded(self): """平台加载完成后初始化""" try: + # 检查插件是否被启用 (Fix for empty plugin_set issue) + # 如果 plugin_set 为空列表,会导致所有插件不响应消息 + if self.context: + # 获取配置对象 + config = self.context.get_config() + plugin_set = config.get("plugin_set") + + if isinstance(plugin_set, list) and not plugin_set: + logger.warning("检测到 plugin_set 为空,自动修正以启用插件") + config["plugin_set"].append("astrbot_plugin_qq_group_daily_analysis") + elif isinstance(plugin_set, list) and "*" not in plugin_set and "astrbot_plugin_qq_group_daily_analysis" not in plugin_set: + logger.warning("检测到当前插件未在 plugin_set 中,自动添加") + config["plugin_set"].append("astrbot_plugin_qq_group_daily_analysis") + # 初始化所有bot实例 discovered = await self.bot_manager.initialize_from_config() if discovered: