From 223f89b19eb3ffbe0eec660dff15f1b1a3bb982b Mon Sep 17 00:00:00 2001 From: chaos-zhu Date: Sun, 14 Dec 2025 15:45:31 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20tg=E6=B6=88=E6=81=AF=E6=A0=BC=E5=BC=8F?= =?UTF-8?q?=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- server/utils/notification.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/server/utils/notification.js b/server/utils/notification.js index 59904e2..5fd54ab 100644 --- a/server/utils/notification.js +++ b/server/utils/notification.js @@ -366,11 +366,14 @@ async function sendTelegramNotification(config, payload) { } /** - * 转义 Markdown 特殊字符 + * 转义 Telegram Markdown 特殊字符 + * 注意:Telegram 的 Markdown 模式只需要转义少量字符 + * 参考:https://core.telegram.org/bots/api#markdown-style */ function escapeMarkdown(text) { if (!text) return '' - return String(text).replace(/([_*\[\]()~`>#+\-=|{}.!])/g, '\\$1') + // 在 Telegram Markdown 模式下,只需要转义 _ * ` [ 这几个字符 + return String(text).replace(/([_*`\[])/g, '\\$1') } /**