From 3a46e7834954f570ac55826123ac2187295a9569 Mon Sep 17 00:00:00 2001 From: estromenko Date: Sat, 1 Nov 2025 22:14:31 +0300 Subject: [PATCH] Enable concurrent updates for Telegram bot --- .gitignore | 2 ++ vacancies/main/bot.py | 9 +++++---- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/.gitignore b/.gitignore index 033e24e..1f0fe11 100644 --- a/.gitignore +++ b/.gitignore @@ -12,3 +12,5 @@ wheels/ *.db *.sqlite3 embeddings + +/static diff --git a/vacancies/main/bot.py b/vacancies/main/bot.py index 7175059..ce74c68 100644 --- a/vacancies/main/bot.py +++ b/vacancies/main/bot.py @@ -1,5 +1,6 @@ import os import io +import asyncio import traceback from telegram import Update from telegram.ext import filters, ApplicationBuilder, MessageHandler, CommandHandler, ContextTypes @@ -90,8 +91,8 @@ async def handle_document(update: Update, context: ContextTypes.DEFAULT_TYPE): await context.bot.editMessageText("Отлично! Запомнил Ваше резюме.", update.effective_chat.id, message.id) -application = ApplicationBuilder().token(os.environ["BOT_TOKEN"]).build() -application.add_handler(CommandHandler('start', start)) -application.add_handler(MessageHandler(filters.TEXT & (~filters.COMMAND), prompt)) -application.add_handler(MessageHandler((filters.Document.ALL | filters.PHOTO) & (~filters.COMMAND), handle_document)) +application = ApplicationBuilder().token(os.environ["BOT_TOKEN"]).concurrent_updates(True).build() +application.add_handler(CommandHandler('start', start, block=False)) +application.add_handler(MessageHandler(filters.TEXT & (~filters.COMMAND), prompt, block=False)) +application.add_handler(MessageHandler((filters.Document.ALL | filters.PHOTO) & (~filters.COMMAND), handle_document, block=False)) application.add_error_handler(error_handler)