patrix/README.md

55 lines
2.2 KiB
Markdown
Raw Normal View History

2017-09-07 15:03:46 +02:00
patrix is a simple command line client for [Matrix](https://matrix.org) written in perl. It can send text messages or files to rooms. I use it to send [Zabbix](https://www.zabbix.com) alerts to a Matrix room, a bit like [sendxmpp](https://github.com/lhost/sendxmpp) can do with XMPP.
2017-09-06 15:43:25 +02:00
It requires the following perl modules
* LWP::UserAgent
* HTTP::Request
* Config::Simple
* File::HomeDir
2017-09-07 12:46:40 +02:00
* File::Basename
* File::MimeInfo
* Path::Tiny
2017-09-06 15:43:25 +02:00
* Getopt::Long
2017-09-07 15:03:46 +02:00
* URI::Escape
2017-09-06 15:43:25 +02:00
* JSON
2017-09-07 12:46:40 +02:00
For now it's very limited, and can only send text messages and files to a room. Here're the vailable options:
2017-09-06 15:43:25 +02:00
* --user: specify the user you want to login as
* --password: the password to auth against the HS
* --server: the HS you want to connect to. Default is https://matrix.org
* --access_token: can be used instead of --user and --password
* --room: the room to which the message must be sent. Can be a room ID or a room alias
2017-09-06 15:43:25 +02:00
* --message: the text message you want to send. If you send something on stdin, it's assumed to be the text to send and this option is ignored
* --debug: if present, will be verbose
* --conf: path to a conf file. Default conf file is ~/.patrixrc
2017-09-07 12:46:40 +02:00
* --file: if action is send-file, specify the path of the file to send
2017-09-06 15:43:25 +02:00
* --action: what to do. Valid actions are
* send-msg (default): send the text message
* send-message: an alias for send-msg
* send-notice: send a notice. Very similar to send-msg but the client may display it differently. Eg Riot will not notify you for notices
2017-09-07 12:46:40 +02:00
* send-file: send a binary file. --file must be set
2017-09-06 15:43:25 +02:00
* get-access-token: just login and print the access token
2017-09-06 16:21:16 +02:00
* get-room-list: prints the list of public rooms of this server
2017-09-06 15:43:25 +02:00
All the available options can be set a the configuration file using a simple ini style format, eg
2017-09-06 15:46:45 +02:00
```
2017-09-06 15:43:25 +02:00
user=alert
password=p@ssw0rd
room=!BWdARvAgNQGgSjgtAG:matrix.domain.com
2017-09-06 15:46:45 +02:00
```
Options given on the command line take precedence over the config file
2017-09-07 15:08:31 +02:00
Examples:
```
cat /var/log/boot.log | patrix --room='#bootlogs:matrix.domain.com' --action=send-notice
```
```
patrix --action=send-file --file=/home/dani/archive.tgz --user=dani --password=secret --server=matrix.domain.com
```
```
patrix --debug --message="Hello World"
```