App helps make telegram channel mirror. We will use Telegram client API because Bot API have limited functionality.
- Catching NewMessage and MessageEdited event and sending them forward
- Flexible source and target channels mapping
- Create Telegram App
- Obtain API App ID and hash
- Setup Postgres database
- Fill .env-example with your data and rename it to .env
- SESSION_STRING can be obtained by running login.py with putted API_ID and API_HASH before.
API_ID=test # Telegram app ID
API_HASH=test # Telegram app hash
SESSION_STRING=test # Telegram session string
# Mapping between source and target channels
# Channel id can be fetched by using @messageinformationsbot telegram bot
# and it always starts with -100 prefix
# [id1, id2, id3:id4] means send messages from id1, id2, id3 to id4
# id5:id6 means send messages from id5 to id6
# [id1, id2, id3:id4];[id5:id6] semicolon means AND
CHAT_MAPPING=[-100999999,-100999999,-100999999:-1009999999];
TIMEOUT_MIRRORING=0.1 # Delay in sec between sending or editing messages
REMOVE_URLS=false # Apply removing URLs on messages
# Remove URLs whitelist
REMOVE_URLS_WL=youtube.com,youtu.be,vk.com,twitch.tv,instagram.com
# Postgres credentials
DATABASE_URL=postgres://user:pass@host/dbname
# or
DB_NAME=test
DB_USER=test
DB_HOST=test
DB_PASS=test
- Create and activate python virtual environment
python -m venv myvenv
source myvenv/Scripts/activate # linux
myvenv/Scripts/activate # windows
- Install depencies
pip install -r requirements.txt
- Run
python app/telemirror.py
or
- Clone project
git clone https://github.com/khoben/telemirror.git
- Create new heroku app within Heroku CLI
heroku create {your app name}
- Add heroku remote
heroku git:remote -a {your app name}
- Set environment variables to your heroku app from .env by running .bash script
./.bash
- Upload on heroku host
git push heroku master
- Start heroku app
heroku ps:scale run=1