Добавил retry для скачивания аудиосообщений
This commit is contained in:
22
main.py
22
main.py
@@ -5,8 +5,14 @@ from telegram.ext import (
|
||||
MessageHandler,
|
||||
filters,
|
||||
)
|
||||
from telegram.request import HTTPXRequest
|
||||
|
||||
from src.config import BOT_TOKEN
|
||||
from src.config import (
|
||||
BOT_TOKEN,
|
||||
TELEGRAM_CONNECT_TIMEOUT,
|
||||
TELEGRAM_READ_TIMEOUT,
|
||||
TELEGRAM_WRITE_TIMEOUT,
|
||||
)
|
||||
from src.database import init_db
|
||||
from src.handlers import (
|
||||
admin_command,
|
||||
@@ -41,7 +47,19 @@ def main() -> None:
|
||||
|
||||
init_db()
|
||||
|
||||
app = ApplicationBuilder().token(BOT_TOKEN).build()
|
||||
app = (
|
||||
ApplicationBuilder()
|
||||
.token(BOT_TOKEN)
|
||||
.request(
|
||||
HTTPXRequest(
|
||||
connection_pool_size=8,
|
||||
connect_timeout=TELEGRAM_CONNECT_TIMEOUT,
|
||||
read_timeout=TELEGRAM_READ_TIMEOUT,
|
||||
write_timeout=TELEGRAM_WRITE_TIMEOUT,
|
||||
)
|
||||
)
|
||||
.build()
|
||||
)
|
||||
|
||||
# Команды
|
||||
app.add_handler(CommandHandler("start", start_command))
|
||||
|
||||
Reference in New Issue
Block a user