Update README.md
This commit is contained in:
parent
0e7b467439
commit
cdfbffc932
1 changed files with 28 additions and 35 deletions
63
README.md
63
README.md
|
@ -3,17 +3,17 @@ A script to send a message to a Matrix room.
|
|||
|
||||
---
|
||||
|
||||
**Syntax:** `matrix-send <message> <room id>`
|
||||
**Syntax:** `matrix-send message room`
|
||||
|
||||
**For example:** `matrix-send "Hello world\!" aBcDeFgHiJkLmNoP:matrix.org`
|
||||
**For example:** `matrix-send "Hello world\!" \!aBcDeFgHiJkLmNoP:example.org`
|
||||
|
||||
---
|
||||
|
||||
`matrix-send` is a simple script to interact with a Matrix homeserver in order to send a message to a room.
|
||||
`matrix-send` is a simple script to send a message to a Matrix room.
|
||||
|
||||
If you don't understand, `matrix-send` is an oversimplified Matrix client.
|
||||
It does this by sending a JSON message to your Matrix server. The message type supported is currently only m.text, but other types will be supported.
|
||||
|
||||
It is mainly designed for automation. I use it on my Matrix room.
|
||||
It is mainly designed for automation. I use it on a private Matrix room of mine.
|
||||
|
||||
`matrix-send` doesn't have support for end-to-end encryption, and never will.
|
||||
|
||||
|
@ -21,48 +21,41 @@ It is mainly designed for automation. I use it on my Matrix room.
|
|||
|
||||
In order to start using `matrix-send` you need a config file. To copy the configuration to .config, clone this repository and type:
|
||||
|
||||
make config
|
||||
```shell
|
||||
$ make config
|
||||
```
|
||||
|
||||
The configuration has now been copied to ~/.config, so open the file ~/.config/matrix-send.conf with your favourite text editor.
|
||||
Now edit the file ~/.config/matrix-send.conf. You will see three (uncommented) lines.
|
||||
|
||||
You will see three "directives"; configuration options that take an argument. Directives' syntax look like so:
|
||||
```shell
|
||||
Server ...
|
||||
Username ...
|
||||
Password ...
|
||||
```
|
||||
|
||||
Directive Argument
|
||||
Delete the example values and enter in your credentials.
|
||||
|
||||
Modify the `Server` directive to match your server's Matrix URL. If you're using matrix.org you can leave it as default.
|
||||
If you don't want to put your password in plain text, since matrix-send.conf is a shell script, you could do something like this:
|
||||
|
||||
If you're not using matrix.org, one way you can find your server's Matrix URL is by typing your server's address into Element. Click Continue, and hover over your server's address that popped up. The Matrix URL should be showing.
|
||||
```shell
|
||||
Password $(gpg -d /path/to/passwd.gpg)
|
||||
```
|
||||
|
||||
Set the `Username` directive to your username, and the `Password` directive to your password.
|
||||
|
||||
You might not want to put your password in plain text, so you could do something like this instead:
|
||||
|
||||
Password $(gpg -d ~/.matrix_pass.gpg)
|
||||
|
||||
This will open `gpg` to decrypt a file with your password inside. You will need to set this up first.
|
||||
|
||||
After you've finished changing these, your configuration should look like this (without the comments):
|
||||
|
||||
Server matrix-client.matrix.org # or your server
|
||||
Username jeremy # your name
|
||||
Password mysupersecurepassword # your password
|
||||
|
||||
After you have these three directives set, you're ready to start.
|
||||
|
||||
Additional directives can be found in [config.md](https://github.com/jtbx/matrix-send/blob/main/config.md).
|
||||
/path/to/passwd.gpg is a GPG-encrypted file containing only your password, once decrypted.
|
||||
|
||||
---
|
||||
|
||||
To install, run `make install` as root, in the cloned repository's directory.
|
||||
To install matrix-send, run `make install` as root, in the cloned repository's directory.
|
||||
```shell
|
||||
# make install
|
||||
```
|
||||
|
||||
make install
|
||||
In order to send messages, you need your Room ID. Find the room you want to send to, and find its Room ID in the settings or somewhere else. It will likely be under Advanced or something similar.
|
||||
|
||||
Now, using your Matrix client, make a room, and find the Room ID. On Element, right click your room, and click Advanced. Your Room ID is under "Internal Room ID".
|
||||
To send a message, type `matrix-send` followed by your message and then your Room ID. You may need to escape the exclamation mark(s). For example:
|
||||
|
||||
To send a message to your chosen room, type `matrix-send` followed by your message (in speech marks) and then your Room ID. You may need to escape the exclamation mark(s). For example:
|
||||
|
||||
matrix-send "Hi\!" \!asdfasdfasdfasdf:matrix.org
|
||||
matrix-send 'Hi!' \!asdfasdfasdfasdf:matrix.org
|
||||
|
||||
That will send the message "Hi!" to the Matrix room !asdfasdfasdfasdf:matrix.org.
|
||||
|
||||
For a more detailed guide, see the manual page `man matrix-send`.
|
||||
For more information, see [matrix-send(1)](https://codeberg.org/jtbx/matrix-send/src/branch/master/doc/matrix-send.1.md).
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue