nospaces-recheck-patch

This commit is contained in:
2024-09-28 10:14:38 +03:00
parent 32ce2e17c4
commit a9e37b7a4e
2 changed files with 14 additions and 6 deletions

View File

@@ -1,6 +1,5 @@
import aiohttp
import aiofiles
import os
import json
from urllib.parse import urlencode
from bot.config import BOT_TOKEN
@@ -36,11 +35,10 @@ async def telegram_api(endpoint: str, json_data=None, **kwargs):
async def download_file(file_id):
"""Asynchronously download a file from Telegram and yield the temporary file path."""
download_url = f"{api_base}/{file_path}"
# Get the file path of the file using the telegram_api method
file = await telegram_api("getFile", file_id=file_id)
file_path = file["result"]["file_path"]
download_url = f"{api_base}/{file_path}"
async with aiohttp.ClientSession() as session:
async with session.get(download_url) as response: