The bot will upload the file to its server. Processing time varies from 30 seconds to 5 minutes.
Telegram has a 50 MB file limit for bots. You may need to: bot de telegram para cambiar caras en videos
from telegram import Update
from telegram.ext import ApplicationBuilder, CommandHandler, MessageHandler, filters, ContextTypes
TOKEN = "TU_TOKEN"
async def start(update: Update, context: ContextTypes.DEFAULT_TYPE):
await update.message.reply_text("Envía un video para cambiar la cara.")
async def handle_video(update: Update, context: ContextTypes.DEFAULT_TYPE):
video = update.message.video or update.message.document
file = await context.bot.get_file(video.file_id)
path = f"/tmp/video.file_id.mp4"
await file.download_to_drive(path)
# enviar trabajo al worker (ej. Redis)
await update.message.reply_text("Video recibido. Procesando...")
app = ApplicationBuilder().token(TOKEN).build()
app.add_handler(CommandHandler("start", start))
app.add_handler(MessageHandler(filters.VIDEO | filters.Document.ALL, handle_video))
app.run_polling()