diff --git a/install.sh b/install.sh index 8f0a191..d5f1aa0 100644 --- a/install.sh +++ b/install.sh @@ -532,12 +532,11 @@ monitor_alert() { if [ -n "${BOT_TOKEN:-}" ] && [ -n "${BOT_CHAT_ID:-}" ]; then local text if [ "$ping_ms" = "TIMEOUT" ]; then - text="⚠️ ALERT: ${ip}%0APing: TIMEOUT (порог: ${threshold}ms)" + text="⚠️ ALERT: ${ip}\nPing: TIMEOUT (порог: ${threshold}ms)" else - text="⚠️ ALERT: ${ip}%0APing: ${ping_ms}ms (порог: ${threshold}ms)" + text="⚠️ ALERT: ${ip}\nPing: ${ping_ms}ms (порог: ${threshold}ms)" fi - curl -s -X POST "https://api.telegram.org/bot${BOT_TOKEN}/sendMessage" \ - -d "chat_id=${BOT_CHAT_ID}&text=${text}&parse_mode=HTML" > /dev/null 2>&1 + tg_send "$BOT_CHAT_ID" "$text" "" > /dev/null 2>&1 fi } @@ -703,7 +702,8 @@ tg_api() { } tg_send() { - local chat_id="$1" text="$2" keyboard="${3:-}" + local chat_id="$1" text keyboard="${3:-}" + text=$(printf '%b' "$2") local payload if [ -n "$keyboard" ]; then payload=$(jq -n --arg c "$chat_id" --arg t "$text" --argjson k "$keyboard" \ @@ -716,7 +716,8 @@ tg_send() { } tg_edit() { - local chat_id="$1" msg_id="$2" text="$3" keyboard="${4:-}" + local chat_id="$1" msg_id="$2" text keyboard="${4:-}" + text=$(printf '%b' "$3") local payload if [ -n "$keyboard" ]; then payload=$(jq -n --arg c "$chat_id" --argjson m "$msg_id" --arg t "$text" --argjson k "$keyboard" \