Split to multiple reply if text length is more than 4000 bytes

This commit is contained in:
Y1.Zhao
2024-03-19 04:20:22 -04:00
parent 0c90e27d45
commit 13090b6a42
5 changed files with 54 additions and 48 deletions

View File

@ -6,6 +6,8 @@ from anthropic import Anthropic, APITimeoutError
from telebot import TeleBot
from telebot.types import Message
from . import bot_reply_markdown
from telegramify_markdown import convert
from telegramify_markdown.customize import markdown_symbol
@ -79,18 +81,7 @@ def claude_handler(message: Message, bot: TeleBot) -> None:
player_message.clear()
return
try:
bot.reply_to(
message,
"Claude answer:\n" + convert(claude_reply_text),
parse_mode="MarkdownV2",
)
except:
print("wrong markdown format")
bot.reply_to(
message,
"claude answer:\n\n" + claude_reply_text,
)
bot_reply_markdown(message, "Claude answer", claude_reply_text, bot)
def claude_pro_handler(message: Message, bot: TeleBot) -> None: