Telegram: Escape exclamation marks, remove for images

![alt](link) becomes [alt](link), telegram seems to pick up that they're
images anyway.
matrix
Harvey Tindall 4 years ago
parent 8b816dc725
commit 478b40d0ff
No known key found for this signature in database
GPG Key ID: BBC65952848FB1A2

@ -148,7 +148,10 @@ func (t *TelegramDaemon) Send(message *Message, ID ...int64) error {
if message.Markdown == "" {
msg = tg.NewMessage(id, message.Text)
} else {
msg = tg.NewMessage(id, strings.ReplaceAll(message.Markdown, ".", "\\."))
text := strings.ReplaceAll(message.Markdown, ".", "\\.")
text = strings.ReplaceAll(text, "![", "[")
text = strings.ReplaceAll(text, "!", "\\!")
msg = tg.NewMessage(id, text)
msg.ParseMode = "MarkdownV2"
}
_, err := t.bot.Send(msg)

Loading…
Cancel
Save