diff --git a/_conf_schema.json b/_conf_schema.json index 1aa564c..ae5d059 100644 --- a/_conf_schema.json +++ b/_conf_schema.json @@ -88,6 +88,12 @@ "description": "图片传输使用 Base64 编码", "default": true, "hint": "启用后图片会被转为 Base64 编码传输。关闭后将直接传递文件路径或 URL 给 OneBot 实现端,适用于 go-cqhttp、Lagrange 等支持本地路径的实现,可降低内存占用。" + }, + "enable_analysis_reply": { + "type": "bool", + "description": "发送文本/表情回复", + "default": false, + "hint": "开启后,/群分析 将通过发送文本消息提示进度;关闭(默认)则使用表情回应。" } } }, diff --git a/main.py b/main.py index 9573656..74a14df 100644 --- a/main.py +++ b/main.py @@ -504,10 +504,14 @@ class GroupDailyAnalysis(Star): ) TraceContext.set(trace_id) - # 使用表情回应代替文本回复 + # 表情回应 或 文本提示(二选一,由配置开关控制) adapter = self.bot_manager.get_adapter(platform_id) orig_msg_id = getattr(event.message_obj, "message_id", None) - if adapter and orig_msg_id: + use_text_reply = self.config_manager.get_enable_analysis_reply() + + if use_text_reply: + yield event.plain_result("🔍 正在启动分析引擎,正在拉取最近消息...") + elif adapter and orig_msg_id: await adapter.set_reaction(event.get_group_id(), orig_msg_id, "🔍") # 🔍 try: @@ -524,7 +528,7 @@ class GroupDailyAnalysis(Star): yield event.plain_result("❌ 分析失败,原因未知") return - if adapter and orig_msg_id: + if not use_text_reply and adapter and orig_msg_id: await adapter.set_reaction( event.get_group_id(), orig_msg_id, "📊" ) # 📊 diff --git a/src/infrastructure/config/config_manager.py b/src/infrastructure/config/config_manager.py index 1c5c959..b671192 100644 --- a/src/infrastructure/config/config_manager.py +++ b/src/infrastructure/config/config_manager.py @@ -466,6 +466,15 @@ class ConfigManager: """获取是否使用用户群名片""" return self._get_group("basic").get("enable_user_card", False) + def get_enable_analysis_reply(self) -> bool: + """获取是否在群分析完成后发送文本回复""" + return self._get_group("basic").get("enable_analysis_reply", False) + + def set_enable_analysis_reply(self, enabled: bool): + """设置是否在群分析完成后发送文本回复""" + self._ensure_group("basic")["enable_analysis_reply"] = enabled + self.config.save_config() + # ========== 群文件/群相册上传配置 ========== def get_enable_group_file_upload(self) -> bool: