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:
@@ -5,6 +5,8 @@ import re
|
|||||||
from textwrap import wrap
|
from textwrap import wrap
|
||||||
from typing import TYPE_CHECKING, Any
|
from typing import TYPE_CHECKING, Any
|
||||||
|
|
||||||
|
from pyrogram import enums
|
||||||
|
|
||||||
from app.ai import AIInvocation, parse_ai_invocation
|
from app.ai import AIInvocation, parse_ai_invocation
|
||||||
from app.commands.core import CommandRegistry, normalize_command_name
|
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("")
|
await ctx.reply("")
|
||||||
return
|
return
|
||||||
html_chunks = [f"<blockquote>{_md_to_tg(c)}</blockquote>" for c in chunks]
|
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:]:
|
for chunk in html_chunks[1:]:
|
||||||
await ctx.client.send_message(
|
await ctx.client.send_message(
|
||||||
ctx.message.chat.id,
|
ctx.message.chat.id,
|
||||||
chunk,
|
chunk,
|
||||||
parse_mode="html",
|
parse_mode=enums.ParseMode.HTML,
|
||||||
reply_to_message_id=getattr(first, "id", None),
|
reply_to_message_id=getattr(first, "id", None),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user