Build a Telegram Bot : Torrent download to Google Drive

Recently saw an interesting Telegram Bot project, you can use aria2 to download files and upload them to Google Drive. Usually they also have to use to aria2-rclone automatically uploaded to Google Drive, this way through Bot.

Project Address : https://github.com/out386/aria-telegram-mirror-bot

Installation:

I. Pre-installation preparation:

  1. Create a Telegram Bot (Reference)

Open BotFather to create a new Bot and save the generated API

  1. Add this bot to the group @get_id_bot to get your own id and group id (Note: When the group’s public or chat history is made visible, the group id changes) and optionally, give it the permission to delete messages. This permission is used to clean up status request messages from users. Not granting it will quickly fill the chat with useless messages from users.

  2. Install aria2.
    For Ubuntu :

apt install aria2

  1. Get Google Drive folder ID

If you create a folder that is https://drive.google.com/drive/folders/1uAKQ7E5YZPKDODR47z1wIF0ZUDQcrIZh
1uAKQ7E5YZPKDODR47z1wIF0ZUDQCRIZh is the folder ID

  1. Install nodejs
    In Ubuntu can be installed directly apt, other platforms see here

curl -sL https://deb.nodesource.com/setup_10.x | bash - &&
apt-get install -y nodejs

II. Installation

  1. Install TypeScript with

sudo npm install -g typescript

  1. Clone the repo:

git clone https://github.com/out386/aria-telegram-mirror-bot
cd aria-telegram-mirror-bot

  1. Run

npm install

  1. Copy the example files:

cp src/.constants.js.example src/.constants.js
cp aria.sh.example aria.sh

  1. Configure the aria2 startup script:
  • nano aria.sh
  • ARIA_RPC_SECRET is the secret (password) used to connect to aria2. Set this to whatever you want, and save the file with ctrl + x .
  • MAX_CONCURRENT_DOWNLOADS is the number of download jobs that can be active at the same time. Note that this does not affect the number of concurrent uploads. There is currently no limit for the number of concurrent uploads.
  1. Configure the bot:
  • nano src/.constants.js
  • Now replace the placeholder values in this file with your values. Use the Constants description section below for reference.
  1. Compile the project by running tsc

  2. Set up OAuth:

  • Visit the Google Cloud Console
  • Go to the OAuth Consent tab, fill it, and save.
  • Go to the Credentials tab and click Create Credentials → OAuth Client ID
  • Choose Other and Create.
  • Use the download button to download your credentials.
  • Move that file to the root of aria-telegram-mirror-bot, and rename it to client_secret.json
  1. Enable the Drive API:
  • Visit the Google API Library page.
  • Search for Drive.
  • Make sure that it’s enabled. Enable it if not.
  1. Start aria2 with
    ./aria.sh

  2. Start the bot with
    npm start

  3. Open Telegram, and send
    /mirror https://raw.githubusercontent.com/out386/aria-telegram-mirror-bot/master/README.md to the bot.
    image

  4. In the terminal, it’ll ask you to visit an authentication URL. Visit it, grant access, copy the code on that page, and paste it in the terminal.
    image

That’s it…

READ FULL DESCIPRION & DETAILS HERE

Credits to Original Devoloper

10 Likes

Do i need a vps for this? or its completely free?

I tried it but after sending /mirror url
there is no authentication link in the terminal…Don’t know where is the problem.
As I am a windows user, first time dealing with ubuntu
I wish, you can help by providing a video tutorial, IF possible.
Thanks in advance…

We must have also a google drive with big space …
If u can provide a simple video tutorial also
thanks

1 Like

Detailed : How To Create Own Torrent To G-drive Telegram Bot - #2 by SaM

From here “Install TypeScript with” which software we have to use because im noob in programming please reply :pray: