fix(telegram): keep raw markdown in overflow stream buffer tail

Send the overflow tail message with HTML parse_mode, but persist the
unrendered markdown chunk in buf.text so later deltas and stream_end
re-render correctly via _split_telegram_markdown_html().
This commit is contained in:
sanasif786ka 2026-07-07 22:34:12 +05:30 committed by Xubin Ren
parent 67648774e2
commit 87478b6e92

View File

@ -1077,13 +1077,14 @@ class TelegramChannel(BaseChannel):
self._app.bot.send_message,
chat_id=chat_id, text=chunk, parse_mode="HTML", **thread_kwargs,
)
tail = html_chunks[-1]
markdown_tail = chunks[-1]
tail_html = html_chunks[-1]
sent = await self._call_with_retry(
self._app.bot.send_message,
chat_id=chat_id, text=tail, parse_mode="HTML", **thread_kwargs,
chat_id=chat_id, text=tail_html, parse_mode="HTML", **thread_kwargs,
)
buf.message_id = sent.message_id
buf.text = tail
buf.text = markdown_tail
async def _on_start(self, update: Update, context: ContextTypes.DEFAULT_TYPE) -> None:
"""Handle /start command."""