Telegram Restricted Media Saver Bot
Snag media from any Telegram channel — public, private, or restricted — and deliver it straight to your chat or a destination channel. No forwarding restrictions, no limits, just the file.
Paste a
t.mepost link → Bot fetches the message via user session → Downloads media → Re-uploads to your chat
The bot uses a dual-client architecture — a bot account for sending/uploading and a user account session for accessing restricted or private channels that the bot itself cannot join.
- Restricted & private channels — bypasses forwarding restrictions using a user session
- All media types — videos, documents, photos, audio, voice, animations, stickers
- Topic / thread links — supports
t.me/c/chat/topic/msgformat - Batch transfers — range syntax
t.me/channel/100-110to grab multiple posts at once - Custom destination — forward files to any channel instead of the current chat
- Custom thumbnail — set your own default thumbnail for all transfers
- Filename templates — rename files using
{filename},{date},{chat},{id},{ext} - Caption control — custom caption templates and word filter/strip rules
- Concurrent workers — async worker pool handles multiple tasks simultaneously
- Persistent tasks — MongoDB-backed task tracking with status history
- Crash recovery — interrupted tasks are marked on restart, visible in
/tasks
1. Get Telegram credentials
- Go to my.telegram.org → API Development Tools
- Create an app and copy your API ID and API Hash
- Create a bot via @BotFather and copy the Bot Token
2. Generate a session string
The user session is required to access restricted channels.
uv run python generate_session.pyFollow the prompts — it will ask for your phone number and OTP, then print the session string. Copy it to USER_SESSION_STRING in your .env.
The session string grants full access to your Telegram account. Never share it or commit it.
3. Configure environment
cp .env.example .envFill in your values:
TELEGRAM_API_ID=12345678
TELEGRAM_API_HASH=your_api_hash
BOT_TOKEN=your_bot_token
USER_SESSION_STRING=your_session_string
MONGODB_URI=mongodb+srv://user:pass@cluster.mongodb.net/
SUDO_USERS=your_telegram_user_id4. Install & run
# Install dependencies
uv sync
# Start the bot
uv run python main.pySingle post
t.me/channel/123
t.me/c/1234567890/45
t.me/b/botname/78
Range of posts
t.me/channel/100-110
Topic / thread link
t.me/c/1234567890/55/93
Join a private chat first
t.me/+AbCdEfGhIj
Send the invite link, then send the post link.
| Command | Description |
|---|---|
/start |
Welcome screen |
/help |
Usage guide |
/settings |
Per-user settings (destination, thumbnail, filename, caption) |
/tasks |
Recent task history |
/status |
Active tasks |
/system |
System info and worker status |
/cancel <id> |
Cancel a running task |
/adduser <id> |
Grant access to a user |
/removeuser <id> |
Revoke access |
/users |
List authorised users |
This project is licensed under the MIT License.
Built with ❤️ by Avishkar Patil