mirror of
https://github.com/hrfee/jfa-go.git
synced 2024-11-10 12:20:10 +00:00
Telegram: Escape exclamation marks, remove for images
![alt](link) becomes [alt](link), telegram seems to pick up that they're images anyway.
This commit is contained in:
parent
8b816dc725
commit
478b40d0ff
@ -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…
Reference in New Issue
Block a user