Automatically upload videos sent to your Telegram "Saved Messages" to Google Drive. Designed for hourly VPS sessions.
- 📥 Downloads videos of any size (500MB - 2GB+)
- ☁️ Resumable uploads to Google Drive
- 🔄 Queue persistence across VPS restarts
- 📲 Real-time Telegram notifications
- 🐳 Docker-based for quick deployment
# 1. Clone repo
git clone https://github.com/YOUR_USERNAME/telegram-drive-bot.git
cd telegram-drive-bot
# 2. Copy your credential files
# (see One-Time Setup below if you don't have these yet)
# 3. Configure environment
cp .env.example .env
nano .env # Add your API credentials
# 4. Start the bot
docker compose up -d- Go to my.telegram.org
- Log in with your phone number
- Click "API development tools"
- Create a new application
- Copy your
api_idandapi_hash
Run this on your local machine (requires phone for verification):
# Install dependencies
pip install pyrogram tgcrypto
# Run session generator
python generate_session.pyThis creates telegram_drive_bot.session - you'll need this file.
- Open Google Drive
- Create a folder named
tele bot(or any name) - Open the folder
- Copy the folder ID from the URL:
https://drive.google.com/drive/folders/1ABC123xyz └── This is your folder ID
You should have these files ready:
token.pickle- Your Google OAuth pickle filetelegram_drive_bot.session- Generated in step 2- Your Telegram
api_idandapi_hash
# SSH into your VPS
ssh user@your-vps-ip
# Clone and setup
git clone https://github.com/YOUR_USERNAME/telegram-drive-bot.git
cd telegram-drive-bot
# Upload credential files (run from your local machine)
scp token.pickle telegram_drive_bot.session user@your-vps-ip:~/telegram-drive-bot/
# On VPS: move session file to correct location
mkdir -p session
mv telegram_drive_bot.session session/
# Configure
cp .env.example .env
nano .env
# Add:
# TELEGRAM_API_ID=your_id
# TELEGRAM_API_HASH=your_hash
# DRIVE_FOLDER_ID=your_folder_id
# Start
docker compose up -dAfter the first setup, you can restart with:
cd ~/telegram-drive-bot && docker compose up -d- Send a video to your Telegram "Saved Messages"
- Bot downloads the video and shows progress
- Bot uploads to Google Drive with progress
- Bot sends you the Drive link when complete
/status- Check bot status and queue
telegram-drive-bot/
├── bot/
│ ├── main.py # Entry point
│ ├── telegram_handler.py # Video download handling
│ ├── drive_uploader.py # Drive upload with resume
│ └── queue_manager.py # Persistent queue
├── session/ # Pyrogram session file
├── queue/ # Upload queue (persists)
├── downloads/ # Temporary downloads
├── token.pickle # Google OAuth credentials
├── .env # Configuration
├── Dockerfile
└── docker-compose.yml
Generate the session file locally using generate_session.py
Ensure token.pickle is in the project root directory
The file is saved locally and will be retried on next restart
docker compose logs -fMIT