]> git.giacomolli.uk - onechat/commitdiff
Send the Telegram replies as rich messages
authorAnderson A. Giacomolli <redacted>
Sat, 7 Nov 2026 15:30:51 +0000 (12:30 -0300)
committerAnderson A. Giacomolli <redacted>
Sat, 7 Nov 2026 15:30:51 +0000 (12:30 -0300)
The bot sends each model reply with sendRichMessage and the Markdown of
the reply unchanged, so Telegram renders the tables and the other blocks
itself. Message entities have no tables, so a table showed as lines of
pipes. A reply over the limit of a rich message goes as more than one
rich message, split between blocks with splitRich.

When the Bot API answers ok false with HTTP 400 or 404, the reply was
not sent, so the bot sends the same Markdown once with the entity path:
markdownEntities, splitEntities, and sendMessage. The fallback logs one
line with no text of the reply. Every other failure gives no fallback: a
network error, HTTP 429, and HTTP 5xx wait and try the rich message
again, and any other failure drops the reply with one log line. The send
timeout applies to each sendRichMessage call.

The notices of the bot, the errors, and the messages from the terminal
stay plain text with sendMessage. The log and the terminal client do not
change.

Issue: fec23f9


No differences found