Skip to content

Commit 28b8f2e

Browse files
committed
Escape special characters in message body
1 parent a008af5 commit 28b8f2e

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

main.go

+3-1
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,10 @@ func main() {
7070
}
7171

7272
// Send message via Telegram bot
73-
msg := tgbotapi.NewMessage(chatID, body.Message)
73+
escapedText := tgbotapi.EscapeText(tgbotapi.ModeMarkdown, body.Message)
74+
msg := tgbotapi.NewMessage(chatID, escapedText)
7475
msg.ParseMode = tgbotapi.ModeMarkdown
76+
7577
_, err := bot.Send(msg)
7678
if err != nil {
7779
log.Printf("Error sending message: %v", err)

0 commit comments

Comments
 (0)