A script to copy all content from a Telegram channel.
It retrieves and saves all messages, including text, images, and links, from a specified Telegram channel for easy backup and access.
- 📋 Clone any Telegram channel or group (supports both public & private).
- 🔄 You must be a member of the source channel or group to copy its content.
- 🛠 Automatically handles text, images, PDFs, and videos for efficient backup.
git clone https://github.com/Warnigo/telegram-chanal-copy.git
cd telegram-chanal-copy1. Edit config.py file before use
API_IDandAPI_HASH- Get those from my.telegram.orgPHONE_NUMBER- Give phone number with country code (ex. +998901234567)NAME- Give any name what you wantSOURCE_CHAT_IDandDESTINATION_CHAT_ID- Get those from @username_idbot
class Config:
API_ID = "12345678" # Your API ID
API_HASH = "your_api_hash" # Your API Hash
PHONE_NUMBER = "+998901234567" # Your phone number (with country code)
NAME = "telegram-channel" # Any name you choose
SOURCE_CHAT_ID = -1001234567890 # Source channel/group ID
DESTINATION_CHAT_ID = -1009876543210 # Destination channel/group IDNote
Make sure to replace the placeholders with your actual credentials.
If it doesn't exist, create the configuration file:
touch config.pyIt's highly recommended to use a virtual environment to avoid dependency conflicts.
python -m venv myenvpython3 -m venv myenv.\myenv\Scripts\activatesource myenv/bin/activateNote
To deactivate the virtual environment at any time, simply run:
deactivateThe script relies on the Telethon library to interact with Telegram.
Install telethon
pip install telethonpip3 install telethonpython bot.pypython3 bot.pyUpon running the script, you'll be prompted to choose whether to load new messages or resend all messages from the source channel.
- Enter
yto only copy new messages from the source channel to the destination. - Enter
nto copy all messages again from the source to the destination.
Note
If you interrupt the script and restart it, you can choose to continue from where you left off or start over.
- Make sure you have joined both the source and destination channels/groups before running the script.
- Double-check your API credentials if you encounter authentication errors. If the script stops unexpectedly, you can rerun it. Use the y/n prompt to control what content is copied.
If you find this project useful, please ⭐️ star the repository to show your support!
Made with ❤️ by Warnigo