Hello guys. Today I will be showing How to Create a Telegram Google Drive Upload Bot. We have seen how to create several types of Telegram bots. We shall be deploying the bot to Heroku. Now let’s learn How to Create a Telegram Google Drive Upload Bot.
- Heroku Account
- Termux apk on Android
- How to Check if Your Microsoft Windows OS is Permanently Activated
- How to Check if Your Windows 10 is Activated With an OEM, Retail or Volume License
- EduTechTainMent All-In-One Guide to Entertainment | IPTV, PayTV, OTT | 2021
- Enroll in Coursera Courses for Free and Earn Certificates
- How to Get Access to ALL WintellectNow Premium Courses For FREE| Nov. 2020
How to Create a Telegram Google Drive Upload Bot
Install Heroku CLI in Termux on your Android device. It is best to use the npm package to install Heroku because it offers the complete CLI just like you find on the official website. In addition, we need to install git. If you already have these packages installed on your Termux, you can skip this step.
pkg install nodejs
npm i -g heroku
pkg install git
Now run the update and upgrade cmd
apt update && apt upgrade
Then login to Heroku CLI and your Github account using the below codes.
heroku login # This will open a prompt which will ask you to login via browser to authenticate your session in the CLI
Login to your GitHub account
git config --global user.email "email" # Replace email in the quotes with your Github email address
git config --global user.name "username" # Replace username in quotes with your Github Username
The next step is to clone the repo onto your local storage on your Android phone. Navigate to a location where you wish to clone your repo into and run the following cmd:
git clone https://github.com/aryanvikash/Google-Drive-Uploader
Next Create Your Google Drive api Credential. Select the Other Type option when asked.
If you already have a credentials.json file on your phone, just copy it from where you saved it on your phone to the root directory of the Google Drive Upload Bot.
Now copy your credentials.json file into the root directory of the bot repo and rename it as client_secrets.json by running this code:
mv credentials.json client_secrets.json
Next run this codes to edit the creds.py file
Input your Bot token obtained from Botfather and also input your Team Drive or Google Drive ID and the folder ID where you want your uploaded files to be saved. This step is essential if you want to use a Team Drive as your upload destination.
Then install the requirements.
pip3 install requirements.txt
Next, run the following codes to deploy your bot to Heroku. Check your list of Heroku apps. If you are using the Heroku free account without a credit card linked to it, you can create a maximum of five apps. If you have reached this limit, you can delete an app on Heroku before you deploy this one.
heroku apps # Lists all your current Heroku apps
If you wish to delete an app on Heroku, you can run this code using the heroku CLI
heroku apps:destroy app_name # This will destroy/delete the app_name specified by you
Create a new heroku app to deploy your Gdrive Upload bot into:
heroku create app_name # Replace app_name with your desired app name. Only lower case letters allowed.
If you already have a Heroku app you wish to use for this bot, you can specify and select the app using the below cmd:
heroku git:remote -a app_name # Replace app-name with your own
Next add your locally cloned repo to your git remote repo:
git add .
Then, commit the changes made:
git commit -m "Commit message" # Specify a commit message of your choice
Next, push the changes to your remote:
git push heroku master
You can add the following commands to your Botfather setCommand option for your Bot:
start - Start Message auth - Authorise You revoke - Delete Your Saved credential help - help Text
Now your bot should respond. If it doesn’t you can restart dynos for the bot using this codes below:
heroku ps:scale worker=0 # Stops dynos running on the app
heroku ps:scale worker=1 # Restarts dyno on the app
If you want to see the logs for troubleshooting of your bot in action, run this code in another Termux tab:
heroku logs --tail -a app_name # Replace app_name with yours.
Thereafter go to your bot, click on the /help to seee the introduction to the bot. Click on /auth and follow the link to authorise your bot to upload to your Team Drive. To upload files to your Team Drive, just send a link of the file to your Google Drive Upload Bot
ETTM Video Guide
That’s it guys. Now you can deploy your own Google drive Upload bot using Heroku for FREE. Don’t forget to subscribe to EduTechTainMent to get notified whenever we publish such informative posts and also join us on Telegram. Subcribe to the EduTechTainMent YouTube guide.