Forward all videos from a Telegram forum topic to another group — automatically.
فارسی | English
TopicRelay is a Python script that connects to Telegram using your user account and forwards all videos from a specific forum topic (thread) in one group to another group — one by one, in chronological order.
Built for situations where you have hundreds of videos archived in a topic and need to migrate them to a different group, channel, or community.
- 🔍 Auto-discovery — Scans an entire forum topic and collects all videos
- 📋 Chronological order — Forwards from oldest to newest
- 💾 Progress saving — Saves state every 20 messages; resumes from where it stopped if interrupted
- 🚦 Rate limit handling — Detects Telegram's FloodWait and pauses automatically
- 🔁 Auto retry — Retries each message up to 3 times on failure
- 🎬 All video types — Handles both native Telegram videos and video files sent as documents
- 📝 Detailed logging — Logs everything to console and
forwarder.log - 🔒 No bot token needed — Uses a standard Telegram user account
- Python 3.8 or higher
- A Telegram user account (phone number login — not a bot token)
- The account must be a member of both the source and destination groups
- Go to my.telegram.org
- Log in with your phone number
- Click "API development tools"
- Create a new application (any name is fine)
- Copy your
api_idandapi_hash
git clone https://github.com/roseshayan/TopicRelay.git
cd TopicRelay
pip install -r requirements.txtOpen find_info.py, fill in your credentials, set TARGET_GROUP_ID to your source group, then run:
python find_info.pyThis will print all your supergroups with their IDs, and all topics inside the target group.
Tip — Manual method: In Telegram Desktop, open the topic → right-click any message → Copy Message Link. The link looks like:
https://t.me/c/GROUPID/TOPICID/MSGIDThe middle number is your Topic ID.
Edit the config block at the top of forwarder.py:
API_ID = 12345678 # From my.telegram.org
API_HASH = 'your_hash_here' # From my.telegram.org
SOURCE_GROUP = -1001234567890 # Source group (with Topics enabled)
TOPIC_ID = 999 # Topic ID inside the source group
DEST_GROUP = -1009876543210 # Destination group
DELAY_SECONDS = 3 # Seconds between each forward (minimum 2)python forwarder.pyLog in with your phone number when prompted (e.g. +989123456789), then press Enter to start.
TopicRelay/
├── forwarder.py # Main script — collects and forwards videos
├── find_info.py # Helper — lists group IDs and topic IDs
├── requirements.txt # Dependencies
├── README.md # This file (English)
└── README.fa.md # Persian documentation
| Note | Details |
|---|---|
| User account only | Telegram bots cannot read message history. This script requires a real user account. |
| Session file | After first login, a .session file is saved locally. Guard it like a password. |
| Forwarding restriction | If the source group has "Restrict Saving Content" enabled, forwarding will fail. |
| Rate limits | ~800 videos at 3s delay ≈ 40 minutes. The script handles FloodWait automatically. |
| Progress file | progress.json tracks forwarded messages. Delete it to restart from scratch. |
- Never share your
api_id,api_hash, or.sessionfiles - Add
*.session,progress.json, andforwarder.logto.gitignore(already included) - Revoke your API credentials at my.telegram.org if compromised
This project is licensed under the MIT License.
SudoShayanNA
- GitHub: @SudoShayanNA
- Email: namayandeshayan@gmail.com