Skip to content

A telegram bot that deploys to heroku and downloads links and torrents and uploads to google drive and returns public share link.

License

Notifications You must be signed in to change notification settings

RKRohk/kuebikobot

 
 

Repository files navigation

Bot logo

kuebiko bot

Status Platform GitHub Issues GitHub Pull Requests License

x`

🤖 A telegram bot that deploys to heroku and downloads links and torrents and uploads to google drive and returns public share link.

📝 Table of Contents

🧐 About

This bot is written in python and imports aria2 for downloading files and magnet links and uploads to google drive via drive-cli then returns direct download/share link with visibility set to public for easy sharing.

This bot is asynchronous and also has pause and cancel buttons of easy management of downloads.

🎥 Demo / Working

Working

Will be updated shortly!

💭 How it works

The bot first extracts the link from the the command it's called from and then adds it to aria2 cli via webhooks, after that it will show progress every 2 seconds in form of message updates.

Once the download completes it will then proceed to upload the file/folder using predefined scripts that will then return the shared link in form of a reply to the original message.

The entire bot is written in Python 3.7

🎈 Usage

To use the bot, type:

/help

or

/start (personal message only)

All commands, i.e. "/help" are not case sensitive.

The bot will then give you the help context menu.

Start:

/help Response:

/mirror :for http(s),ftp and file downloads

/magnet :for torrent magnet links

/cancel :cancel all in progress downloads

/list :get a list of downloads

use these commands along with your link or magnets.

Example:

/mirror https://releases.ubuntu.com/20.04/ubuntu-20.04.1-desktop-amd64.iso

Response:

Mirror, [14.08.20 19:57]
[In reply to Sahil]
Downloading
'ubuntu-20.04.1-desktop-amd64.iso'
Progress : 17.62/2656.00 MBs
at 33.53 MBps
[--------------------] 0.7 %

Mirror, [14.08.20 19:59]
[In reply to Sahil]
https://drive.google.com/open?id=<- id of the file ->

Mirror, [14.08.20 19:59]
Upload complete


Beep boop. I am a bot. If there are any issues, contact at my GitHub

Want to make a similar bot? Check out: GitHub

🏁 Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on heroku.

Prerequisites

All the prerequisites are mentioned in the requirements.txt. Additionally, you'll need to install aria2c on your linux machine if you want to run a local version. You'll also need to get google credentials for the google drive via API dashboard from google developers console.

aria2c
credentials.json
bot id from bot father (telegram)

Installing

First, copy the credentials.json in the root directory and update the bot id in bot.py at line 14.

Switch to venv and install all the requirements from requirements.txt

run python3 bot.py

When you run for the first time, it will ask you to authorise or refresh token for drive using local web server, follow the link from terminal and open in any web browser. After authenticating copy back the access code to cli. This will create token.json which is importantand should be kept securely.

That's it. The bot should send a bot started message on the channels it addded to verifying it's active.

You're bot is now ready to use. Yay!

🚀 Deploying your own bot

To deploy your bot on heroku, please follow the above steps and then procced below: Procfile and and other settings have already been added as per needs.

Push the repo to your local github and set up a deployment in heroku. Add the following buildpacks under Settings > Buildpacks heroku/python
https://github.com/amivin/aria2-heroku.git the second buildpack will ensure that aria is installed on the dyno on which the bot will run.

After that deploy your branch and if everything is correctly configured, the bot will reply with bot started message in the channels.

⛏️ Built Using

  • python-telegram-bot - This library provides a pure Python interface for the Telegram Bot API.
  • Heroku - SaaS hosting platform
  • aria2p - Command-line tool and library to interact with an aria2c daemon process with JSON-RPC.
  • aria2c - aria2 is a lightweight multi-protocol & multi-source, cross platform download utility operated in command-line.
  • pydrive - Google Drive API made easy.

✍️ Authors

See also the list of contributors who participated in this project.

About

A telegram bot that deploys to heroku and downloads links and torrents and uploads to google drive and returns public share link.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 97.4%
  • Dockerfile 1.5%
  • Shell 1.1%