Simple Telegram to Discord one-way relay service. Uses the Discord-Webhooks and Telethon libraries.
Monitors a specified Telegram channel and relays any messages received in that channel to a Discord webhook. Designed to run as a human user for channels where bots are not permitted.
pip install telethon
Then copy config.example.json and set the fields accordingly.
- discord.url - Should be set to a Discord webhook URL. Your Discord admin will need to create this.
- telegram.api_id & api_hash - These can be obtained from Telegram
- telegram.phone - Should be the phone number of the user you wish to connect as (remember to include country code)
- telegram.channel_id - This is the ID of the channel you are monitoring. If you don't have this, you will be presented with a list of available channels on first run of the script.
Once config is set up, simply run:
python3 telelooper.py
For autorestarts, use pm2:
pm2 start telelooper.py --interpreter=python3
Telelooper retrieves unread messages manually every few seconds, while Telebagger relies on Telethon's events. Telethon's events can be unreliable for supergroups, many missed messages can be expected. I would recommend using the telelooper.py script over the telebagger.py script unless you have a pressing need to use events.