Change to escapeMarkdown

This commit is contained in:
Astra 2026-02-28 17:49:36 +00:00
parent 0a357be1b6
commit 3085c36718

8
bot.go
View file

@ -418,13 +418,13 @@ func handleNewMessage(ctx context.Context, api *tg.Client, alertPeer *tg.InputPe
chatName := channel.Title chatName := channel.Title
// Build alert message with HTML formatting for markdown v2 // Build alert message with HTML formatting for markdown v2
matchMessageHTML := fmt.Sprintf("🚨 Matched\n<b>Score</b>: %.2f\n<b>Chat</b>: %s (ID: %d)\n<b>User</b>: %s (%s) (ID: %d)\n", matchMessageHTML := fmt.Sprintf("🚨 Matched\n<b>Score</b>: %.2f\n<b>Chat</b>: %s (ID: %d)\n<b>User</b>: %s (ID: %d)\n",
result.score, escapeHTML(chatName), chatID, escapeHTML(displayName+" ("+username+")"), username, senderID) result.score, escapeMarkdown(chatName), chatID, escapeMarkdown(displayName+" ("+username+")"), senderID)
// Send ntfy notification if config set (use plain text for ntfy) // Send ntfy notification if config set (use plain text for ntfy)
if cfg.NtfyToken != "" || cfg.NtfyTopic != "" { if cfg.NtfyToken != "" || cfg.NtfyTopic != "" {
plainMessage := fmt.Sprintf("🚨 Matched\nScore: %.2f\nChat: %s (ID: %d)\nUser: %s (%s) (ID: %d)\n", plainMessage := fmt.Sprintf("🚨 Matched\nScore: %.2f\nChat: %s (ID: %d)\nUser: %s (ID: %d)\n\n%s",
result.score, chatName, chatID, displayName+" ("+username+")", username, senderID) result.score, escapeMarkdown(chatName), chatID, escapeMarkdown(displayName+" ("+username+")"), senderID, escapeMarkdown(msg.Message))
notify(plainMessage, cfg.NtfyHost, cfg.NtfyTopic, fmt.Sprintf("Scam Alert: %s", chatName), 5, cfg.NtfyToken) notify(plainMessage, cfg.NtfyHost, cfg.NtfyTopic, fmt.Sprintf("Scam Alert: %s", chatName), 5, cfg.NtfyToken)
} }