feat(telegram): 全部通知改为中文详细说明

统一告警/恢复/系统/Layer3/测试消息格式,含来源、影响与建议操作。

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
Nexus Agent
2026-06-07 21:01:47 +08:00
parent f60a5ea5bc
commit ea2507dbc0
9 changed files with 327 additions and 103 deletions
+12 -3
View File
@@ -9,6 +9,7 @@ Sensitive values are masked in GET responses.
from typing import Optional
from pathlib import Path
import asyncio
import html
import logging
import ipaddress
import re
@@ -1004,10 +1005,18 @@ async def telegram_test_send(
from datetime import datetime, timezone
now = datetime.now(timezone.utc).strftime("%Y-%m-%d %H:%M:%S UTC")
sys_name = html.escape((_settings.SYSTEM_NAME or "Nexus").strip())
message = (
f"✅ <b>Nexus 测试消息</b>\n"
f"Bot 配置正确,告警通知已就绪\n"
f"时间: {now}"
f"✅ <b>【Telegram 配置测试消息发送成功</b>\n"
f"平台:{sys_name}\n"
f"具体情况:Bot Token 与 Chat ID 配置正确,Telegram 通道可用\n"
f"将接收的通知类型:\n"
f"• 子机 CPU/内存/磁盘超阈值告警与恢复\n"
f"• Redis / MySQL 连接异常与恢复\n"
f"• 子机时钟偏差、文件推送结果\n"
f"• Layer 3 宿主机巡检 /health 失败与自动重启\n"
f"说明:可在设置页关闭单项 NOTIFY_* 开关以停止对应类型推送\n"
f"时间:{now}"
)
try: