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)
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)