fix(telegram): escape send_slash_confirm preview with format_message

send_slash_confirm() sent the raw command preview with ParseMode.MARKDOWN,
skipping the format_message() conversion applied to every other dynamic
send in the adapter. Commands with underscores, dots, brackets, or other
MarkdownV2-sensitive characters raised BadRequest: Can't parse entities;
the exception was swallowed by the outer try/except, so the confirmation
prompt silently never appeared.

Fix: wrap preview through format_message() and switch to MARKDOWN_V2,
symmetric with send_update_prompt and the callback sends fixed in
a69404052.
This commit is contained in:
nftpoetrist
2026-05-14 20:18:44 +03:00
committed by Teknium
parent 35781bab90
commit 4b6d35bed2
2 changed files with 111 additions and 4 deletions

View File

@@ -2297,9 +2297,7 @@ class TelegramAdapter(BasePlatformAdapter):
return SendResult(success=False, error="Not connected")
try:
# Message body: render as plain text (message already contains
# markdown formatting from the gateway primitive).
preview = message if len(message) <= 3800 else message[:3800] + "..."
preview = self.format_message(message if len(message) <= 3800 else message[:3800] + "...")
keyboard = InlineKeyboardMarkup([
[
@@ -2315,7 +2313,7 @@ class TelegramAdapter(BasePlatformAdapter):
kwargs: Dict[str, Any] = {
"chat_id": int(chat_id),
"text": preview,
"parse_mode": ParseMode.MARKDOWN,
"parse_mode": ParseMode.MARKDOWN_V2,
"reply_markup": keyboard,
**self._link_preview_kwargs(),
}