X-Git-Url: http://git.giacomolli.uk/onechat/blobdiff_plain/1379d7d0d0173416237ddf8ebe820743d2cecfa6..de170709599e849c6b409d247b800dc68b0c7ab7:/telegram.go?ds=inline diff --git a/telegram.go b/telegram.go index 13196d4..13c200c 100644 --- a/telegram.go +++ b/telegram.go @@ -311,8 +311,9 @@ func (b *TelegramBot) typing(ctx context.Context) { } // post sends event to the chat. A reply goes as rich messages of its Markdown, -// split with telegramSplitRich. Every other event goes as plain text, split -// with telegramSplitMessage. +// with each < outside code escaped by telegramEscapeTags and then split with +// telegramSplitRich, so that the length limit counts the escaped text. Every +// other event goes as plain text, split with telegramSplitMessage. func (b *TelegramBot) post(ctx context.Context, event Event) { if event.Kind != "reply" { for _, text := range telegramSplitMessage(telegramText(event), telegramMessageUnits) { @@ -324,7 +325,7 @@ func (b *TelegramBot) post(ctx context.Context, event Event) { return } - for _, markdown := range telegramSplitRich(event.Text, telegramRichBytes) { + for _, markdown := range telegramSplitRich(telegramEscapeTags(event.Text), telegramRichBytes) { b.deliverRich(ctx, markdown) } }