I needed to store some files from Telegram to my google drive. I tried looking for a bot to do this, but all of them didn't work. So I decided to create my own.
This is useful if you have a server where by the bot can download large telegram files and send them to google drive without you using any bandwidth. Pretty neat.
- Get a Telegram API KEY and a bot token from Bot Father. You can get more information here.
- Follow this Guide to get a detailed explanation on how to get authentication for Google Service API.
- On the 5th page of the guide above, you will download a json file. Rename it to
client_secrets.json
- Fill in your
client id
andclient secret
from theclient_secrets.json
file to thesettings.yaml
file. - Fil in your Telegram user-id on the
main.py
file. This is so the bot saves files only from you.
Clone the repository:
git clone https://github.com/AvicennaJr/Telegram2Drive
Install the requirements:
cd Telegram2Drive
pip install -r requirements.txt
Then run the bot with:
python main.py
Send any file to your bot and you will find it on your google drive.
Note: If you are using a server you can make a simple Systemd
script to let the bot run in the background.