Telegram is a messaging app developed by Russian developers and is considered one of the safest, fastest, and most reliable messaging platforms today. Beyond instant messaging, Telegram allows the transfer of various file types, including documents, photos, videos, and audio. However, Telegram doesn’t clearly specify how long files are retained on its servers. I personally love using Telegram to store my files, but one day I realized that some files had become unavailable for download. That’s when I decided to create a Telegram bot to solve this issue.
Introducing Savebot
Savebot can save all messages you send to it on Telegram, including text, images, and videos, directly to your local storage. I have open-sourced the project on GitHub and even provided a Docker image for easy deployment. Savebot is incredibly convenient and efficient. You can even integrate it with other Docker images for automatic cloud uploads β though that feature still needs further development.
To run Savebot, you need:
- A Telegram Bot: You can easily create one via @BotFather.
- Python 3 Environment: If you can use Docker, you’re already a Savebot expert!
π Running Savebot in Docker
If you already have your BOT_TOKEN
, you can retrieve your TARGET_CHAT_ID
using the following command:
docker run -d \
--rm \
--name savebot \
-e MY_TOKEN= \
iskoldt/savebot:latest
Send any message to your bot, and it will return your TARGET_CHAT_ID
.
Now, run the following command to fully set up Savebot:
docker run -d \
--name savebot \
--restart unless-stopped \
-e MY_TOKEN= \
-e TARGET_CHAT_ID= \
-v /your/local/path:/savebot/messages \
iskoldt/savebot:latest
π¦ How to Use Savebot
Simply send files to your Telegram bot, and the files will be stored locally!
If you wish to save files elsewhere, just replace the Docker volume /savebot/messages
with your preferred storage location.
π‘ Using the MTProto API for Larger Files
The Telegram Bot API has a file size limit. To overcome this, you can use the MTProto API. You can obtain your API_ID
and API_HASH
here.
Once you have your API_ID
and API_HASH
, you’re all set to save any file with Savebot!
π Special Thanks
A big thanks to Pyrogram and Telethon for providing powerful APIs, which made it possible to build this Telegram bot.