Maybe you want to record some messages filtered by regex.
Maybe you want to analyze messages in some chat in near-real time.
Maybe you want to filter alerts from air raid alert channels in Telegram because your neighbor is a bastard and they shower your home city with suicide drones and rockets.
Who knows
- Create a venv, enter it (optional):
python -m venv venv
source venv/bin/activate # for POSIX shells. If you have some other shell you know what to do better than I do
venv\Scripts\activate # for Windows
venv/Scripts/Activate.ps1 # Windows Powershell
venv/bin/Activate.ps1 # Linux Powershell- Install dependencies
pip -r requirements.txt-
Get your API credentials from my.telegram.org and put them into
api.py -
Prepare sessions for each script that needs to run at the same time:
python prepare_session.py --api api.py session_name.sessionKeep in mind that scripts can't use the same session or a copy of a session file. Telegram probably sends only one event per session, and clients will steal each others events.
- Run the scripts (example)
Scripts have built-in help available, try running them with --help.
| Name | Description |
|---|---|
prepare_session.py |
Prepare session for other scripts |
listen.py |
Listen to Telegram sources (channels, users, chats) and print them |
forward.py |
Forward messages to a Telegram channel, chat or user |
tail.py |
Print text of last messages in Telegram channel, char or user |