Bots & AutomationOpen source
Rust Telegram Watchlist Orchestrator
An asynchronous Telegram bot engineered in Rust for managing localized media watchlists, featuring randomized suggestion engines and flat-file state persistence.
Tech stack
- Languages
Performance & metrics
- Eliminated network latency overhead typical of remote database connections by reducing state reads/writes to synchronous disk I/O
- Memory footprint and CPU cycles minimized by utilizing
HashSetfor O(1) lookups during duplicate prevention logic
Why I built it
Designed to solve a specific UX friction point: logging media consumption while watching on a Smart TV. Standard web interfaces and TV remotes are highly inefficient for text entry. By exposing the state management interface via a Telegram bot, the user can instantly query, log, and receive randomized media suggestions directly from their mobile device with zero context switching. The architecture was kept intentionally lightweight (statically compiled Rust, flat-file storage) to eliminate the operational overhead of maintaining a relational database.
Architecture & decisions
Built on the tokio asynchronous runtime utilizing the teloxide framework for Telegram API bindings. State persistence is handled via a localized flat-file system. To optimize I/O and deduplication, file contents are loaded into memory as std::collections::HashSet structures, providing O(1) insertion checks. Following state mutation, data is lexicographically sorted and flushed to disk. The bot also implements a custom string buffering algorithm (send_long_message) to dynamically chunk payloads exceeding Telegram's strict 4096-byte message limits.
Key features
- 01Asynchronous command routing and dispatch via the
teloxideREPL architecture - 02Flat-file state persistence with
HashSet-driven deduplication and automatic lexicographical sorting - 03Dynamic message chunking algorithm to strictly adhere to Telegram API payload constraints
- 04Sub-string resolution matching to provide graceful fallback suggestions for inexact user input