# Build a Telegram Bot : Torrent download to Google Drive

**URL:** <https://onehack.st/t/build-a-telegram-bot-torrent-download-to-google-drive/86039>\
**Category:** Tools & Scripts\
**Tags:** programming, piracy, cloud-storage\
**Created:** [May 12, 2020, 10:28am UTC](https://onehack.st/t/build-a-telegram-bot-torrent-download-to-google-drive/86039 "2020-05-12T10:28:51Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![GROWNUPS](https://onehack.st/user_avatar/onehack.st/grownups/32/25400_2.png) [@GROWNUPS](https://onehack.st/u/GROWNUPS)\
**Post date:** [May 12, 2020, 10:28am UTC](https://onehack.st/t/build-a-telegram-bot-torrent-download-to-google-drive/86039/1 "2020-05-12T10:28:51Z")

</div>

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](https://github.com/out386/aria-telegram-mirror-bot)

**Installation:**

**I. Pre-installation preparation:**

1. **Create a Telegram Bot** [(Reference)](https://core.telegram.org/bots#3-how-do-i-create-a-bot)

Open [BotFather](https://t.me/BotFather) to create a new Bot and save the generated API

 ![image](https://onehack.st/uploads/default/original/3X/d/c/dcbdaa92bbba86cfa634767ebb886037e6eec35b.png)

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](https://github.com/aria2/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](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](https://nodejs.org/zh-cn/download/package-manager/)

> curl -sL [https://deb.nodesource.com/setup\_10.x](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](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](https://github.com/out386/aria-telegram-mirror-bot#Constants-description) section below for reference.

1. Compile the project by running `tsc`

2. Set up OAuth:

- Visit the [Google Cloud Console](https://console.developers.google.com/apis/credentials)
- 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](https://console.developers.google.com/apis/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.  

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](https://onehack.st/uploads/default/original/3X/b/a/ba2a9425c3056f72be09562dbbfc2e17bd9f342c.png)

That’s it…

READ FULL DESCIPRION & DETAILS [HERE](https://github.com/out386/aria-telegram-mirror-bot/blob/master/README.md)

_Credits to Original Devoloper_

---

<div class="post-metadata">

**Author:** ![littlesudip](https://onehack.st/user_avatar/onehack.st/littlesudip/32/39586_2.png) [@littlesudip](https://onehack.st/u/littlesudip)\
**Post date:** [May 12, 2020, 1:23pm UTC](https://onehack.st/t/build-a-telegram-bot-torrent-download-to-google-drive/86039/2 "2020-05-12T13:23:46Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Mr\_Sam](https://onehack.st/user_avatar/onehack.st/mr_sam/32/31912_2.png) [@Mr\_Sam](https://onehack.st/u/Mr_Sam)\
**Post date:** [May 12, 2020, 2:00pm UTC](https://onehack.st/t/build-a-telegram-bot-torrent-download-to-google-drive/86039/3 "2020-05-12T14:00:55Z")

</div>

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..

---

<div class="post-metadata">

**Author:** ![Stephanie07](https://onehack.st/user_avatar/onehack.st/stephanie07/32/18122_2.png) [@Stephanie07](https://onehack.st/u/Stephanie07)\
**Post date:** [May 12, 2020, 2:05pm UTC](https://onehack.st/t/build-a-telegram-bot-torrent-download-to-google-drive/86039/4 "2020-05-12T14:05:00Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![GROWNUPS](https://onehack.st/user_avatar/onehack.st/grownups/32/25400_2.png) [@GROWNUPS](https://onehack.st/u/GROWNUPS)\
**Post date:** [May 13, 2020, 7:06pm UTC](https://onehack.st/t/build-a-telegram-bot-torrent-download-to-google-drive/86039/5 "2020-05-13T19:06:53Z")

</div>

Detailed : [How To Create Own Torrent To G-drive Telegram Bot-1 - #2 by Aina](https://onehack.st/t/how-to-create-own-torrent-to-g-drive-telegram-bot/86330/2)

---

<div class="post-metadata">

**Author:** ![Atik](https://onehack.st/user_avatar/onehack.st/atik/32/19380_2.png) [@Atik](https://onehack.st/u/Atik)\
**Post date:** [May 14, 2020, 4:22pm UTC](https://onehack.st/t/build-a-telegram-bot-torrent-download-to-google-drive/86039/6 "2020-05-14T16:22:36Z")

</div>

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