You use Telegram to store stuff, e.g. notes to yourself, files, etc. Possibly you even use it together with another person to share notes, e.g. your grocery store list.
But: you created a group in the past, which now blocks you from editing the messages of yourself or the other person. You want to get rid of the group and use a much-cooler channel, but you refrain from copying all the content of the group by yourself.
This script is for you.
This script copies messages from a source chat to a destination chat.
It will display the list of available chats/groups/channels first, and you can select source and destination.
It keeps a list of already-copied messages on file, so you can run it multiple times without copying everything again.
git clone git@github.com:rgiessmann/telegram-copy-messages.git
cd telegram-copy-messages
.env.example
to .env
.
cp .env.example .env
.env
file. Obtain api_id
and api_hash
from this link and fill it inside Telegram Configuration
section of the .env
file. Run the script via python:
pip install -r requirements.txt
python main.py
or with Docker:
docker build --no-cache -t telegramcopymessages .
docker run --rm --env-file=.env -v td-data:/tmp/.tdlib_files -v telegramcopymessages-data:/app/data telegramcopymessages
App Configuration
section of the .env
file.Kudos to https://github.com/radinshayanfar/TGCopyBot/ and https://github.com/alexander-akhmetov/python-telegram/blob/master/examples/ !