From 746687cf6ee5223abb7ef92e038e9ea616c3c4ed Mon Sep 17 00:00:00 2001 From: pluja Date: Wed, 22 Mar 2023 18:29:14 +0100 Subject: [PATCH] avoid timeout error --- main.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/main.py b/main.py index cd9bb9a..3975682 100644 --- a/main.py +++ b/main.py @@ -188,12 +188,12 @@ async def chat(update: Update, context: ContextTypes.DEFAULT_TYPE): # Edit the message in real time if not message_sent: - sent_message = await context.bot.send_message(chat_id=update.effective_chat.id, text=assistant_message) + sent_message = await context.bot.send_message(chat_id=update.effective_chat.id, text=assistant_message, timeout=10) message_sent = True else: try: if new_content.strip() != "": - await context.bot.edit_message_text(chat_id=update.effective_chat.id, message_id=sent_message.message_id, text=assistant_message) + await context.bot.edit_message_text(chat_id=update.effective_chat.id, message_id=sent_message.message_id, text=assistant_message, timeout=10) except BadRequest as e: if "Message is not modified" not in str(e): raise e