mirror of
https://github.com/HKUDS/nanobot.git
synced 2026-08-06 17:38:35 +00:00
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:
parent
67648774e2
commit
87478b6e92
@ -1077,13 +1077,14 @@ class TelegramChannel(BaseChannel):
|
|||||||
self._app.bot.send_message,
|
self._app.bot.send_message,
|
||||||
chat_id=chat_id, text=chunk, parse_mode="HTML", **thread_kwargs,
|
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(
|
sent = await self._call_with_retry(
|
||||||
self._app.bot.send_message,
|
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.message_id = sent.message_id
|
||||||
buf.text = tail
|
buf.text = markdown_tail
|
||||||
|
|
||||||
async def _on_start(self, update: Update, context: ContextTypes.DEFAULT_TYPE) -> None:
|
async def _on_start(self, update: Update, context: ContextTypes.DEFAULT_TYPE) -> None:
|
||||||
"""Handle /start command."""
|
"""Handle /start command."""
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user