A Telegram bot that downloads files/torrents and uploads them to Google Drive
- Python 99.4%
- Dockerfile 0.6%
| Filename | Latest commit message | Latest commit date |
|---|---|---|
| docs | ||
| downloaders | ||
| handlers | ||
| .dockerignore | ||
| .env.example | ||
| .gitignore | ||
| bencode.py | ||
| bot.py | ||
| config.py | ||
| docker-compose.yml | ||
| Dockerfile | ||
| LICENSE | ||
| pixi.lock | ||
| pixi.toml | ||
| pyproject.toml | ||
| README.md | ||
| utils.py | ||
HerdBot
HerdBot is a modular Telegram downloader and uploader bot. It automates downloading files, direct URLs, magnet links, and torrent files to a local server, uploading them recursively to Google Drive, and cleaning up the local filesystem storage after successful transfers.
Key Features
- Protocols Supported: Direct links (HTTP/HTTPS), Torrent files, Magnet links, and Telegram native media.
- Large File Handling: Utilizes Telethon (MTProto API) and
cryptgto support downloading native Telegram files up to 2GB. - Robust Uploads: Integrates with
rcloneto support chunked, multi-threaded uploads while preserving directory structures for multi-file torrents. - Auto-Cleanup: Guarantees deletion of temporary files from local storage upon successful upload.
- Queue & Metrics: Includes
/statusto track active transfer statistics (speed, ETA, progress bars) and/statsfor host server performance tracking. - Access Control: Restricts usage to whitelisted Telegram User IDs.
Project Structure
herdbot/
├── bot.py # Session entry point
├── config.py # Config parsing & validation
├── utils.py # Shared helpers & active jobs registry
├── downloaders/
│ ├── aria2.py # aria2c downloader interface
│ └── rclone.py # rclone uploader interface
└── handlers/
├── __init__.py # Event router configuration
├── start.py # /start and /help commands
├── stats.py # /stats and /status commands
└── mirror.py # Link & media processing pipeline
Documentation
For setup, Google Drive remote authentication, and running instructions, refer to docs/setup.md.