Telegram Bot¶
You can add new torrents via Telegram bot.
Register bot¶
- Register your bot with BotFather as described at https://core.telegram.org/bots#6-botfather
!!! note If you have already configured notifications with Telegram you don't need to create a new bot. Use an existing one.
-
Install
python-telegram-botlibrary to your python environment withYou may install torrt with required dependencies with:
-
Configure torrt to use the bot:
Restrict users (comma-separated) talking to the bot with option
allowed_users: -
Create a new Telegram group and add the bot.
Listen to commands¶
Start listening to user commands:
Now your bot is ready to accept messages and fully functional.
Note
It is recommended to start run_bots process using a process management system (see supervisord or systemd configuration example below).
Talking to the bot¶
Bot supports a number of commands.
-
To start new conversation with bot use command:
and follow further instructions. You can add new, list or remove already registered torrents.
Note
If you want to cancel current operation use
/cancelcommand. -
Add a torrent using
/addcommand (torrent is downloaded to a default directory.): -
All registered torrents can be viewed with:
-
To remove torrent use command:
-
To show all available commands use:
Supervisor configuration¶
Here described how to configure and start torrt's Telegram bot with supervisord.
- Install
supervisordon your host as described at http://supervisord.org/installing.html -
Create configuration file
torrt.confat/etc/supervisor/conf.d/:Replace
PATH_TO_TORRT_SCRIPTwith a location of torrt executable file andUSER_ON_HOSTwith a user starting a process. -
Start process with following commands:
Systemd user service¶
If you are running basically any modern Linux distribution you can run Telegram bot under your user with systemd,
without having to deal with global system configuration.
-
Mark your user as the one allowed to 'linger'
-
Create service definition in your home directory:
Create
~/.config/systemd/user/torrt.service(for example with a text editor) with:Replace
PATH_TO_TORRT_SCRIPTwith a location of torrt executable file -
Start Service
-
(Optional) Enable service autostart