mirror of
https://github.com/Nezumi-2711/astrbot_plugin_qq_group_daily_analysis.git
synced 2026-09-22 13:38:43 +00:00
feat: 新增 show_report_caption 选项,可关闭报告发送时的文字前缀
This commit is contained in:
@@ -143,6 +143,12 @@
|
|||||||
"description": "发送文本/表情回复",
|
"description": "发送文本/表情回复",
|
||||||
"default": false,
|
"default": false,
|
||||||
"hint": "开启后,/群分析 将通过发送文本消息提示进度;关闭(默认)则使用表情回应。"
|
"hint": "开启后,/群分析 将通过发送文本消息提示进度;关闭(默认)则使用表情回应。"
|
||||||
|
},
|
||||||
|
"show_report_caption": {
|
||||||
|
"type": "bool",
|
||||||
|
"description": "发送报告时附带 \"📊 每日群聊分析报告已生成\" 前缀",
|
||||||
|
"default": true,
|
||||||
|
"hint": "关闭后,发送图片/HTML 报告时将只发送文件本身,不附带 \"📊 每日群聊分析报告已生成\" 等文字前缀。"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -649,7 +649,7 @@ class GroupDailyAnalysis(Star):
|
|||||||
)
|
)
|
||||||
|
|
||||||
if image_url:
|
if image_url:
|
||||||
caption = TraceContext.make_report_caption()
|
caption = TraceContext.make_report_caption() if self.config_manager.get_show_report_caption() else ""
|
||||||
sent = await adapter.send_image(group_id, image_url, caption=caption)
|
sent = await adapter.send_image(group_id, image_url, caption=caption)
|
||||||
if sent:
|
if sent:
|
||||||
await self._try_upload_image(group_id, image_url, platform_id)
|
await self._try_upload_image(group_id, image_url, platform_id)
|
||||||
|
|||||||
@@ -680,6 +680,15 @@ class ConfigManager:
|
|||||||
self._ensure_group("basic")["enable_analysis_reply"] = enabled
|
self._ensure_group("basic")["enable_analysis_reply"] = enabled
|
||||||
self.config.save_config()
|
self.config.save_config()
|
||||||
|
|
||||||
|
def get_show_report_caption(self) -> bool:
|
||||||
|
"""获取是否发送 \"📊 每日群聊分析报告已生成\" 前缀文字。"""
|
||||||
|
return self._get_group("basic").get("show_report_caption", True)
|
||||||
|
|
||||||
|
def set_show_report_caption(self, enabled: bool):
|
||||||
|
"""设置是否发送 \"📊 每日群聊分析报告已生成\" 前缀文字。"""
|
||||||
|
self._ensure_group("basic")["show_report_caption"] = enabled
|
||||||
|
self.config.save_config()
|
||||||
|
|
||||||
def get_profile_display_mode(self) -> str:
|
def get_profile_display_mode(self) -> str:
|
||||||
"""获取人格标签展示模式。"""
|
"""获取人格标签展示模式。"""
|
||||||
mode = str(self._get_group("basic").get("profile_display_mode", "mbti")).lower()
|
mode = str(self._get_group("basic").get("profile_display_mode", "mbti")).lower()
|
||||||
|
|||||||
@@ -100,7 +100,7 @@ class ReportDispatcher:
|
|||||||
# 4. 发送图片
|
# 4. 发送图片
|
||||||
sent = False
|
sent = False
|
||||||
if image_url:
|
if image_url:
|
||||||
caption = TraceContext.make_report_caption()
|
caption = TraceContext.make_report_caption() if self.config_manager.get_show_report_caption() else ""
|
||||||
sent = await self.message_sender.send_image_smart(
|
sent = await self.message_sender.send_image_smart(
|
||||||
group_id, image_url, caption, platform_id
|
group_id, image_url, caption, platform_id
|
||||||
)
|
)
|
||||||
@@ -180,7 +180,7 @@ class ReportDispatcher:
|
|||||||
f"[{trace_id}] 群 {group_id} 开启了仅发送外链,但未配置 html_base_url,已进行降级,回退至发送 HTML 文件。"
|
f"[{trace_id}] 群 {group_id} 开启了仅发送外链,但未配置 html_base_url,已进行降级,回退至发送 HTML 文件。"
|
||||||
)
|
)
|
||||||
|
|
||||||
caption = self.report_generator.build_html_caption(html_path)
|
caption = self.report_generator.build_html_caption(html_path) if self.config_manager.get_show_report_caption() else ""
|
||||||
|
|
||||||
sent = await self.message_sender.send_file(
|
sent = await self.message_sender.send_file(
|
||||||
group_id,
|
group_id,
|
||||||
|
|||||||
@@ -647,7 +647,7 @@ class ReportGenerator(IReportGenerator):
|
|||||||
return None, None
|
return None, None
|
||||||
|
|
||||||
def build_html_caption(self, html_path: str) -> str:
|
def build_html_caption(self, html_path: str) -> str:
|
||||||
"""根据 html_base_url 生成 HTML 报告链接 caption"""
|
"""根据 html_base_url 生成 HTML 报告链接 caption。由调用方决定是否发送。"""
|
||||||
|
|
||||||
caption = "📊 每日群聊分析报告已生成"
|
caption = "📊 每日群聊分析报告已生成"
|
||||||
base_url = self.config_manager.get_html_base_url()
|
base_url = self.config_manager.get_html_base_url()
|
||||||
|
|||||||
Reference in New Issue
Block a user