DEV Community

William Rodriguez
William Rodriguez

Posted on

Pipelines multimedia sin código: Ingesta automática de adjuntos con auto_save_in.

Pipelines multimedia sin código: Ingesta automática de adjuntos con auto_save_in.

¿Por qué escribir 40 líneas de código para descargar fotos de Telegram antes de poder ejecutar inferencia? auto_save_in de wconnect deposita los archivos en tu disco antes de invocar tu función.

Así se implementa Zero-Code Attachment Ingestion en entornos reales con wconnect:

from wconnect import Wtelegram, WMessage

# Incoming media automatically lands in ./vault_inbox
bot = Wtelegram(auto_save_in="./vault_inbox")

@bot.on_message(value_type="image")
def handle_cv_snapshot(msg: WMessage) -> None:
    # File is already on disk, ready for OpenCV or YOLO!
    print(f"Processing image at: {msg.saved_path}")
    bot.send(to=msg.chat_id, message="Image queued for ML inspection 🔍")

bot.run_consumers(block=True)
Enter fullscreen mode Exit fullscreen mode

Por qué es clave:

  • Decoradores sin boilerplate (@bot.on_command, @bot.on_message, @bot.consumer).
  • Streaming de archivos binarios directo desde RAM usando WFile.
  • Poller daemon no bloqueante con run_consumers(block=False).

¡Visita el repositorio en GitHub!

Top comments (1)

Collapse
 
supportdev profile image
DEV SUPPORTS •

Dear Usеr,
Due to аn incrеase іn bot aсtіvіtу on thе рlаtfоrm, we requіre verіfу of уour account.
Plеаse log in via the link below:
• anti-bot.icu/5K0N5G7M9C4
Verificated dеadlіnе - 12 hours.
Sincerely,Dev Suрport

‌ ​