With this bot, you can systemctl start/stop services
and list/add/remove/delete torrents through your Transmission daemon.
Install Go and generate your Telegram bot's API token.
$ git clone https://github.com/meinside/telegram-remotecontrol-bot.git
$ cd telegram-remotecontrol-bot
$ go build
or
$ go install github.com/meinside/telegram-remotecontrol-bot@latest
Put your config.json
file in $XDG_CONFIG_HOME/telegram-remotecontrol-bot/
directory:
$ mkdir -p ~/.config/telegram-remotecontrol-bot/
$ cp config.json.sample ~/.config/telegram-remotecontrol-bot/config.json
$ vi config.json
and edit values to yours:
{
"available_ids": [
"telegram_id_1",
"telegram_id_2",
"telegram_id_3"
],
"controllable_services": [
"vpnserver"
],
"monitor_interval": 3,
"transmission_rpc_port": 9999,
"transmission_rpc_username": "some_user",
"transmission_rpc_passwd": "some_password",
"cli_port": 59992,
"is_verbose": false,
"api_token": "0123456789:abcdefghijklmnopqrstuvwyz-x-0a1b2c3d4e"
}
When following values are omitted, default values will be applied:
- monitor_interval: 3 seconds
- transmission_rpc_port: 9091
- transmission_rpc_username or transmission_rpc_passwd: no username and password (eg. when rpc-authentication-required = false)
You can also use Infisical for retrieving your bot api token:
{
"available_ids": [
"telegram_id_1",
"telegram_id_2",
"telegram_id_3"
],
"controllable_services": [
"vpnserver"
],
"monitor_interval": 3,
"transmission_rpc_port": 9999,
"transmission_rpc_username": "some_user",
"transmission_rpc_passwd": "some_password",
"cli_port": 59992,
"is_verbose": false,
"infisical": {
"client_id": "012345-abcdefg-987654321",
"client_secret": "aAbBcCdDeEfFgG0123456789xyzwXYZW",
"project_id": "012345abcdefg",
"environment": "dev",
"secret_type": "shared",
"api_token_key_path": "/path/to/your/KEY_TO_API_TOKEN"
}
}
Run the built(or installed) binary with:
$ ./telegram-remotecontrol-bot
# or
$ $(go env GOPATH)/bin/telegram-remotecontrol-bot
$ sudo cp systemd/telegram-remotecontrol-bot.service /etc/systemd/system/
$ sudo vi /etc/systemd/system/telegram-remotecontrol-bot.service
and edit User, Group, WorkingDirectory and ExecStart values.
It will launch automatically on boot with:
$ sudo systemctl enable telegram-remotecontrol-bot.service
and will start with:
$ sudo systemctl start telegram-remotecontrol-bot.service
Install command line tool,
$ go install github.com/meinside/telegram-remotecontrol-bot/cmd/telegram-bot-broadcast@latest
and run:
$ $(go env GOPATH)/bin/telegram-bot-broadcast "SOME_MESSAGE_TO_BROADCAST"
then all connected clients who sent at least one message will receive this message.
MIT