tgfilestream
A Telegram bot that can stream Telegram files to users over HTTP.
Setup
Install dependencies (see requirements.txt), configure environment variables (see below) and run with
python3 -m tgfilestream
.
A reverse proxy is recommended to add TLS. When using a reverse proxy, keep
Source Code: https://github.com/TGExplore/TG-Files-to-LinkHOST
as-is, but add the publicly accessible URL to PUBLIC_URL
. The URL should include the protocol, e.g. https://example.com
.Telegram Api: https://my.telegram.org
Bot Father: @BotFather
Environment variables
TG_API_ID
(required) - Your Telegram API ID.TG_API_HASH
(required) - Your Telegram API hash.TG_SESSION_NAME
(defaults totgfilestream
) - The name of the Telethon session file to use.PORT
(defaults to8080
) - The port to listen at.HOST
(defaults tolocalhost
) - The host to listen at.PUBLIC_URL
(defaults tohttp://localhost:8080
) - The prefix for links that the bot gives.TRUST_FORWARD_HEADERS
(defaults to false) - Whether or not to trust X-Forwarded-For headers when logging requests.DEBUG
(defaults to false) - Whether or not to enable extra prints.LOG_CONFIG
- Path to a Python basic log config. OverridesDEBUG
.REQUEST_LIMIT
(default 5) - The maximum number of requests a single IP can have active at a time.CONNECTION_LIMIT
(default 20) - The maximum number of connections to a single Telegram datacenter.TG_START_MESG
- The message that should be shown in Telegram chat, in case of non-media message.
How to get TG_SESSION_NAME string
Run Console in Heroku
python3 GenerateStringSession.py
and follow.- Note: When it will ask for Phone Number and Bot token Give
Bot token
value
Issue Bot stopped responding
If bot is not responding, open
https://<appname>.herokuapp.com/
and try again.
Disqus for infotelbot