mirror of
https://github.com/aljazceru/chatgpt-telegram-bot.git
synced 2025-12-20 06:05:12 +01:00
fix #151 for messages containing broken markdown
This commit is contained in:
@@ -445,12 +445,22 @@ class ChatGPTTelegramBot:
|
||||
chunks = self.split_into_chunks(response)
|
||||
|
||||
for index, chunk in enumerate(chunks):
|
||||
try:
|
||||
await context.bot.send_message(
|
||||
chat_id=chat_id,
|
||||
reply_to_message_id=update.message.message_id if index == 0 else None,
|
||||
text=chunk,
|
||||
parse_mode=constants.ParseMode.MARKDOWN
|
||||
)
|
||||
except Exception:
|
||||
try:
|
||||
await context.bot.send_message(
|
||||
chat_id=chat_id,
|
||||
reply_to_message_id=update.message.message_id if index == 0 else None,
|
||||
text=chunk
|
||||
)
|
||||
except Exception as e:
|
||||
raise e
|
||||
|
||||
await self.wrap_with_indicator(update, context, constants.ChatAction.TYPING, _reply)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user