Enable concurrent updates for Telegram bot
All checks were successful
release / docker (push) Successful in 39s

This commit is contained in:
estromenko 2025-11-01 22:14:31 +03:00
parent 375522864a
commit 3a46e78349
2 changed files with 7 additions and 4 deletions

2
.gitignore vendored
View File

@ -12,3 +12,5 @@ wheels/
*.db *.db
*.sqlite3 *.sqlite3
embeddings embeddings
/static

View File

@ -1,5 +1,6 @@
import os import os
import io import io
import asyncio
import traceback import traceback
from telegram import Update from telegram import Update
from telegram.ext import filters, ApplicationBuilder, MessageHandler, CommandHandler, ContextTypes 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) await context.bot.editMessageText("Отлично! Запомнил Ваше резюме.", update.effective_chat.id, message.id)
application = ApplicationBuilder().token(os.environ["BOT_TOKEN"]).build() application = ApplicationBuilder().token(os.environ["BOT_TOKEN"]).concurrent_updates(True).build()
application.add_handler(CommandHandler('start', start)) application.add_handler(CommandHandler('start', start, block=False))
application.add_handler(MessageHandler(filters.TEXT & (~filters.COMMAND), prompt)) application.add_handler(MessageHandler(filters.TEXT & (~filters.COMMAND), prompt, block=False))
application.add_handler(MessageHandler((filters.Document.ALL | filters.PHOTO) & (~filters.COMMAND), handle_document)) application.add_handler(MessageHandler((filters.Document.ALL | filters.PHOTO) & (~filters.COMMAND), handle_document, block=False))
application.add_error_handler(error_handler) application.add_error_handler(error_handler)