hirnoty is a simple telegram bot that allows executing scripts and getting notifications.
-
Create virtualenv:
$ virtualenv venv $ source venv/bin/activate
-
Install:
pip install git+https://github.com/hir12111/hirnoty
-
Get a token from the botfather and add it to
~/.config/hirnoty/config.py
following the formatTOKEN = '...'
-
Add the scripts you want to allow to the folder
~/.config/hirnoty/scripts
, make sure that the scripts are set as executable -
Start hirnoty:
hirnoty-ctl start
You can now talk to the bot
\exec {script_name}
Execute script with name {script_name}
\subs {topic_name}
Subscribe to topic {topic_name}
- Create a zmq socket of type PUSH
- Connect to the machine running hirnoty (tcp port 1234)
- Send a multipart message in which the first part is the topic name and the second part is the actual information you want to send
The user configuration is ~/.config/hirnoty/config.py
TOKEN (str): Bot token (required).
SCRIPT_DIR (str): Path to scripts directory.
Defaults to ~/.config/hirnoty/scripts
.
ACL (list): list of ids of allowed users. Defaults to None
(disabled)
LOGLEVEL (str): loglevel, choice between: 'error'
, warning
, 'info'
or 'debug'
. Defaults to 'info'
.
BIND_ADDRESS (str): address to receive the external messages from, defauls to '*:1234'
OTP (str): path to a file with one time passwords (one per line) that will be consume from end to beginning of the file, the password must be provided at the end of the command. Defaults to None (disabled).