This is a simple bot to download telegram files directly to your own server without needing to keep telegram open or using telegram-cli, this uses Telegram's MTProto protocol to download files up to 4GB using the Pyrogram Framework.
To setup this bot on your own server you'll need a Telegram API ID/Hash, it can be created at My Telegram website, do this before continue
If you want to run this bot on a docker server follow Environment variables guide and then Docker install guide.
To install all needed dependencies use pip:
python3 -m pip install -r requirements.txtIf you have any issue, try to install build-essentials in your system, the psutil
lib sometimes needs to be builded locally.
Observation: This bot support dot files(.env)
Now that you've your own ID/Hash it has to be passed to TELEGRAM_API_ID and
TELEGRAM_API_HASH environment variables, you also need to set the bot token(create
one here) as BOT_TOKEN, and if you want to download files from channels
that doesn't allow forwarding/copying content you need to set PHONE_NUMBER with your
number that is used on a telegram account that is allowed to access the content you want
to download.
The default download folder is /data, if you want to set another location define that
as DOWNLOAD_FOLDER, default session storage path is /config but it can be set by
CONFIG_FOLDER, this can be usefull for saving session across updates.
You also need to set the bot administrator list using ADMINS, use spaces to separate
everyone.
To run this bot it has to be started as a module, to this use -m flag:
python3 -m botWhen you wanna stop the bot, press CTRL+\
This bot is so simple that you only need to set some environment variables and mount a folder inside the container to keep your downloads, for this, use this command replacing values with your owns:
# Build a docker image to your own server
docker build -t telegram-downloader .
# Now run this
docker run \
-it `# optional, use -d if you won't use your account to download content` \
-v /home/$USER/TDownloader/data:/data \
-v /home/$USER/TDownloader/config:/config \
-e TELEGRAM_API_ID=123456 \
-e TELEGRAM_API_HASH="yourTelegramAPIHash" \
-e BOT_TOKEN="yourBotToken" \
-e PHONE_NUMBER="yourPhoneNumber" `# optional` \
-e ADMINS="@yourTelegramUsername" \
telegram-downloader