Fix parse mode: use enums.ParseMode.HTML instead of string

ParseMode is a plain Enum, not a str subclass — string "html" fails
equality check against the enum member and raises ValueError.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-05-18 14:36:46 +02:00
parent 0cafff8696
commit 777aa90f17

View File

@@ -5,6 +5,8 @@ import re
from textwrap import wrap
from typing import TYPE_CHECKING, Any
from pyrogram import enums
from app.ai import AIInvocation, parse_ai_invocation
from app.commands.core import CommandRegistry, normalize_command_name
@@ -106,12 +108,12 @@ async def _reply_long(ctx: "CommandContext", text: str) -> None:
await ctx.reply("")
return
html_chunks = [f"<blockquote>{_md_to_tg(c)}</blockquote>" for c in chunks]
first = await ctx.reply(html_chunks[0], parse_mode="html")
first = await ctx.reply(html_chunks[0], parse_mode=enums.ParseMode.HTML)
for chunk in html_chunks[1:]:
await ctx.client.send_message(
ctx.message.chat.id,
chunk,
parse_mode="html",
parse_mode=enums.ParseMode.HTML,
reply_to_message_id=getattr(first, "id", None),
)