Giter VIP home page Giter VIP logo

transmission-telegram-bot's Introduction


WebTorrent
Transmission Bot for Telegram

Do you like the project? Buy me a coffee or a beer ๐Ÿป

So, you want to controll your torrent status from anywhere in the world, but you don't know how to do this, right? Here is the solution, this is a simple telegram bot that allows you to check the status of your torrents, add, stop, remove, briefly these are all the basic actions that you do with the program or web interface.

Summary:

Available commands

  • List of all torrents;
  • Torrent status - Get all details about a torrent;
  • Torrent start - Restart a torrent that is paused;
  • Torrent stop - Stop a torrent;
  • Torrent remove - Remove a torrent;
  • Add torrent - Add a torrent from a .torrent file or from an url;

How to install it

Clone the repository with git clone https://github.com/raffaelecalza/transmission-telegram-bot.git or download it as a zip file from here.

1) Register your bot name

First of all you have to register your bot's name. To do this, begin a new chat to @BotFather. Send /newbot command. Then send to him the name of your bot (e.g. My Wonderful Bot). Then send a username for the bot (NOTE: this must end with the word 'bot'), e.g. MyWonderfulBot. After that the Bot Father will send you a message that contains the TOKEN for the bot. Save it because in the fourth step we'll use it.

2) Set bot commands (Optional)

This step is optional because the bot has a custom keyboard, but I suggest you to set the commands. After you have register your bot and take the token you have to send to BotFather the full list of commands. Use the /setcommands and send this string to BotFather:

torrentlist - Get the list of all torrents
torrentstatus - Get all details about a torrent
torrentadd - Add a torrent from url
torrentstart - Start a paused torrent
torrentstop - Stop a torrent
torrentremove - Remove a torrent
settings - Set your preferences
help - Get the list of available commands

3) Install NodeJS, NPM and PM2

Go to the next step if you have already installed NodeJS, NPM and PM2.

Install NodeJS and NPM

For Windows and OSX go to NodeJS site and download the installer (https://nodejs.org/en/download/). This also will install NPM.

For linux users, follow this guide (https://nodejs.org/en/download/package-manager/).

Install all project dependencies

Open up a terminal, go to your bot's folder and then run npm install.

Install PM2

For running your bot forever and as a daemon, you have to install a simple library called PM2 - Process Manager 2. So, Open a console and type sudo npm install -g pm2. If everything goes right try to type this command in the terminal pm2 status, and you should see an empty list of applications.

4) Configure your bot

Now, open the config.json file with a text editor. Replace the token string with your bot's token. If you already know your chats id insert it in the array. In the transmission section, insert the ip address of the computer where transmission is installed (localhost if the bot runs in the same machine). Insert your username and password if you've set it, otherwise leave this fileds empty (don't delete them). The last step is to specify the number of the port (if you have changed it).

{
  "bot": {
      "token": "your bot's token",
      "users": [000000, 000000, 2222222]
  },
  "transmission": {
      "address": "your ip address",
      "credentials": {
          "username": "leave this empty if you doesn't have a username",
          "password": "leave this empty if you doesn't have a password"
      },
      "port": 9091
  }
}

If you don't know your chat id, open a terminal and go to your bot repo's folder, open the bot/ folder then start your bot (after have installed all packages in the 3 step) with the command node bot.js. Try to send a message to your bot, you'll see in the console your chat id, hit Ctrl + C to stop the bot and insert your chat id in the config file.
NOTE: you must have inserted at least the bot token in the config file but i recommend you to configure also Transmission before running your bot.

5) Run your bot

Now you haven't to wait anymore, go to your bot folder and type pm2 start bot.js. Then your bot will start in background.

NOTE

If you shutdown or reboot your PC, PM2 will stop your application so you have to re-run your bot every time with the command pm2 start bot.js.

Report bugs or suggestions

If you have discovered a bug or if you have a suggestion, please open an issue or send me an email ([email protected])

transmission-telegram-bot's People

Contributors

raffaelecalza avatar matteocontrini avatar tasi788 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.