A Telegram Bot that uploads file to the drive.
Before working with Telegram’s API, you need to get your own API ID and hash:
- Login to your Telegram account with the phone number of the developer account to use.
- Click under API Development tools.
- A Create new application window will appear. Fill in your application details. There is no need to enter any URL, and only the first two fields (App title and Short name) can currently be changed later.
- Click on Create application at the end. Remember that your API hash is secret and Telegram won’t let you revoke it. Don’t post it anywhere!
- Sign in to the Google API Console.
- Open the Credentials page. If prompted, select the project that has the Android Management API enabled.
- Click Create credentials > Service account key.
- From the dropdown menu, select New service account. Enter a name for your service account.
- Select your preferred key type and click Create. Your new public/private key pair is generated and downloaded to your machine and is the only copy of this key. You are responsible for storing it securely.
- git clone
https://github.com/nilay1221/drive-bot.git
- cd
drive-bot
- Add your API ID , API HASH , BOT TOKEN in bot.py file.
- Add Service Account Credentials file in current project directory and add its PATH in drive_upload.py
- Add Shared Drive's id in drive_upload.py if using Shared Drive
- Run
pip3 install -r requirements.txt
- Run
python3 bot.py
- Add your API ID , API HASH , BOT TOKEN in bot.py file.
- Add Service Account Credentials file in current project directory and add its PATH in drive_upload.py
- Add Shared Drive's id in drive_upload.py if using Shared Drive
- RUN bot.py in your local machine to generate .session file
- RUN these heroku commands
heroku create
heroku container:login
heroku container:push worker
heroku container:release worker
- Your bot has been sucessfully deployed on heroku.
If you are using Shared Drive Id along with service account then you need to give permission to service account user by adding as a user in shared drive. After that only service account will be allowed to access shared drive Id.