From 734c112ee4ccc0e5b22af9ca2443f3e79ab3d18d Mon Sep 17 00:00:00 2001 From: K2cr2O1 <2221577113@qq.com> Date: Sun, 1 Mar 2026 11:14:10 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=B7=BB=E5=8A=A0=E6=9B=B4=E6=96=B0?= =?UTF-8?q?=E6=97=A5=E5=BF=97=E7=94=9F=E6=88=90=E5=99=A8=E5=B9=B6=E4=BF=AE?= =?UTF-8?q?=E6=94=B9=E5=91=BD=E4=BB=A4=E5=89=8D=E7=BC=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 添加完整的更新日志生成器工具,包括Python脚本和HTML模板 将bot命令前缀从"/"改为"。"以符合中文用户习惯 --- config.toml | 2 +- web_static/changelog_generator/generate.py | 71 +++++++ web_static/changelog_generator/template.html | 187 +++++++++++++++++++ 3 files changed, 259 insertions(+), 1 deletion(-) create mode 100644 web_static/changelog_generator/generate.py create mode 100644 web_static/changelog_generator/template.html diff --git a/config.toml b/config.toml index cb60f44..25c55be 100644 --- a/config.toml +++ b/config.toml @@ -19,7 +19,7 @@ token = "" # Bot 基础配置 [bot] # 命令前缀列表 -command = ["/"] +command = ["。"] # 是否忽略自己的消息 ignore_self_message = true # 权限不足时的消息 diff --git a/web_static/changelog_generator/generate.py b/web_static/changelog_generator/generate.py new file mode 100644 index 0000000..3403880 --- /dev/null +++ b/web_static/changelog_generator/generate.py @@ -0,0 +1,71 @@ +import os +import sys +from datetime import datetime +from jinja2 import Environment, FileSystemLoader + +# ========================================== +# 配置区域 +# ========================================== + +# 输出文件路径 (相对于当前脚本或绝对路径) +OUTPUT_FILE = "../changelog.html" + +# 更新日志数据 +# 格式说明: +# version: 版本号 +# date: 日期 (YYYY-MM-DD) +# description: 版本描述 (可选) +# changes: 变更列表 +# - type: 类型 (add, update, fix) +# - content: 变更内容 +changelogs = [ + { + "version": "v1.0.0", + "date": "2026-3-1", + "description": "引入了更多有趣的互动功能,并优化了系统稳定性。", + "changes": [ + {"type": "add", "content": "新增了天气查询功能,支持全国主要城市"}, + {"type": "update", "content": "优化了 Web Parser 的解析速度,不过b站的视频解析等待重做中"}, + {"type": "fix", "content": "修复了在某些特定网络环境下图片加载失败的问题"}, + {"type": "update", "content": "支持多实现端连接(反向WS),此功能并不完善,等待重做"} + + + ] + } +] + +# ========================================== +# 生成逻辑 (通常不需要修改) +# ========================================== + +def generate_changelog(): + # 获取当前脚本所在目录 + base_dir = os.path.dirname(os.path.abspath(__file__)) + + # 设置 Jinja2 环境 + env = Environment(loader=FileSystemLoader(base_dir)) + template = env.get_template("template.html") + + # 获取最新版本号 + latest_version = changelogs[0]["version"] if changelogs else "v0.0.0" + + # 渲染模板 + html_content = template.render( + log=changelogs[0] if changelogs else None, + latest_version=latest_version, + generated_at=datetime.now().strftime("%Y-%m-%d %H:%M:%S") + ) + + # 确定输出路径 + output_path = os.path.join(base_dir, OUTPUT_FILE) + + # 写入文件 + try: + with open(output_path, "w", encoding="utf-8") as f: + f.write(html_content) + print(f"✅ 成功生成更新日志: {os.path.abspath(output_path)}") + except Exception as e: + print(f"❌ 生成失败: {e}") + +if __name__ == "__main__": + generate_changelog() diff --git a/web_static/changelog_generator/template.html b/web_static/changelog_generator/template.html new file mode 100644 index 0000000..e0d3eac --- /dev/null +++ b/web_static/changelog_generator/template.html @@ -0,0 +1,187 @@ + + + + + + NEOBOT | Changelog + + + + + + + + + + + + + +
+
+ + +
+
PROJECT HISTORY
+

+ System
+ Evolution +

+

+ 记录每一次微小的改变,见证成长的轨迹。 +

+
+ + +
+
+ +
+ + +
+
+
+

{{ log.version }}

+ LATEST +
+
{{ log.date }}
+
+ {% if log.description %} +
+

+ "{{ log.description }}" +

+
+ {% endif %} +
+ + +
+
    + {% for change in log.changes %} +
  • + {% if change.type == 'add' %} + ADD + {% elif change.type == 'update' %} + UPD + {% elif change.type == 'fix' %} + FIX + {% else %} + MSC + {% endif %} + + {{ change.content }} +
  • + {% endfor %} +
+
+
+
+ +
+
+ + + + +