fix: escape Telegram Markdown special characters

This commit is contained in:
xboard
2026-03-30 01:46:56 +08:00
parent 3744ebcd5a
commit daf3055b42
2 changed files with 15 additions and 5 deletions

View File

@@ -229,4 +229,14 @@ class Helper
{
return $transfer_enable / 1073741824;
}
/**
* 转义 Telegram Markdown 特殊字符
* @param string $text
* @return string
*/
public static function escapeMarkdown(string $text): string
{
return str_replace(['_', '*', '`', '['], ['\_', '\*', '\`', '\['], $text);
}
}