Enable concurrent updates for Telegram bot
All checks were successful
release / docker (push) Successful in 39s
All checks were successful
release / docker (push) Successful in 39s
This commit is contained in:
parent
375522864a
commit
3a46e78349
2
.gitignore
vendored
2
.gitignore
vendored
@ -12,3 +12,5 @@ wheels/
|
||||
*.db
|
||||
*.sqlite3
|
||||
embeddings
|
||||
|
||||
/static
|
||||
|
||||
@ -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)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user