diff --git a/pxy_bots/views.py b/pxy_bots/views.py index f4baeff..9e93023 100644 --- a/pxy_bots/views.py +++ b/pxy_bots/views.py @@ -96,9 +96,10 @@ async def dispatch_private_commands(update, text): async def transcribe_with_whisper(update, bot): # 1. Descarga el archivo de voz desde Telegram - tg_file = await sync_to_async(bot.get_file)(update.message.voice.file_id) + tg_file = await bot.get_file(update.message.voice.file_id) download_path = f"/tmp/{update.message.voice.file_id}.ogg" - await sync_to_async(tg_file.download)(download_path) + # En python-telegram-bot v21: download_to_drive es coroutine + await tg_file.download_to_drive(download_path) # 2. Envía el audio a la API Whisper de OpenAI with open(download_path, "rb") as audio: @@ -120,7 +121,7 @@ async def telegram_webhook(request, bot_name): try: logger.info(f"Webhook called for bot: {bot_name}") - # Carga la configuración del bot + # Carga la configuración del bot (sync ORM) try: bot_instance = await sync_to_async(TelegramBot.objects.get)( name=bot_name, is_active=True