feat(html): 增加了html_only_url选项,使在选择输出格式为html时可以单独发送BaseURL (#166 @shiitin)

* 更改了AstrBot中面板的的设置项,增加了html_only_url选项

* 增加了html_only_url

* 增加了单独发送URL

在html_only_url设置被打开且配置了Base URL后,将会单独发送URL

* 加入测试日志,尝试解决存在问题

* 加入测试日志,尝试解决存在问题

* 删除了定时触发部分的测试日志

* 修改了手动触发部分的发送HTML的判断

* 修改了main.py的单行长度过长问题

* 修复了dispatcher.py的缩进问题
This commit is contained in:
Shiitin
2026-04-12 22:03:45 +08:00
committed by GitHub
parent 937f4e1782
commit 911b8b2fb2
4 changed files with 53 additions and 0 deletions
+16
View File
@@ -628,6 +628,22 @@ class GroupDailyAnalysis(Star):
nickname_getter=nickname_getter,
)
if html_path:
is_only_url = self.config_manager.get_html_only_url()
base_url = self.config_manager.get_html_base_url()
if is_only_url:
if base_url and base_url.strip():
filename = os.path.basename(html_path)
report_url = f"{base_url.rstrip('/')}/{filename}"
yield event.plain_result(
f"📊 今日群聊分析报告已生成:\n{report_url}"
)
return # 拦截成功,直接退出,不再发文件
else:
logger.warning(
f"手动触发群 {group_id} 开启了仅发送外链,但未配置 html_base_url,回退至发送文件。"
)
caption = self.report_generator.build_html_caption(html_path)
# 发送 HTML 文件