HACKING.md: use `socat -u` in examples
このコミットが含まれているのは:
コミット
4034b6a79e
18
HACKING.md
18
HACKING.md
|
@ -32,31 +32,21 @@ on chat, e.g. text-to-speech or Twitch Plays Pokémon.
|
||||||
|
|
||||||
View events like this:
|
View events like this:
|
||||||
```sh
|
```sh
|
||||||
socat UNIX-CONNECT:event.sock STDOUT
|
socat -u UNIX-CONNECT:event.sock STDOUT
|
||||||
```
|
```
|
||||||
|
|
||||||
Sidenote, this will still read from stdin, and if you send anything on
|
|
||||||
stdin the event socket will close itself. If you want to ignore stdin,
|
|
||||||
I couldn't figure out how to get `socat` to do it so you can do it like
|
|
||||||
this:
|
|
||||||
```sh
|
|
||||||
cat > /dev/null | socat UNIX-CONNECT:event.sock STDOUT
|
|
||||||
```
|
|
||||||
If you do this `cat` will not exit when the connection is closed so you
|
|
||||||
will probably have to interrupt it with `^C`.
|
|
||||||
|
|
||||||
#### Examples
|
#### Examples
|
||||||
|
|
||||||
If you have `jq` you can view prettified events like this:
|
If you have `jq` you can view prettified events like this:
|
||||||
```sh
|
```sh
|
||||||
socat UNIX-CONNECT:event.sock STDOUT | jq
|
socat -u UNIX-CONNECT:event.sock STDOUT | jq
|
||||||
```
|
```
|
||||||
(On older versions of `jq` you have to say `jq .` when reading from
|
(On older versions of `jq` you have to say `jq .` when reading from
|
||||||
stdin.)
|
stdin.)
|
||||||
|
|
||||||
Use this to get each new chat message on a new line:
|
Use this to get each new chat message on a new line:
|
||||||
```sh
|
```sh
|
||||||
socat UNIX-CONNECT:event.sock STDOUT | jq 'select(.type == "message") | .event.nomarkup'
|
socat -u UNIX-CONNECT:event.sock STDOUT | jq 'select(.type == "message") | .event.nomarkup'
|
||||||
```
|
```
|
||||||
|
|
||||||
##### Text-to-speech
|
##### Text-to-speech
|
||||||
|
@ -65,7 +55,7 @@ This command will take each new chat message with the prefix "!say ",
|
||||||
strip the prefix, and synthesize the rest of the message as speech using
|
strip the prefix, and synthesize the rest of the message as speech using
|
||||||
`espeak`:
|
`espeak`:
|
||||||
```sh
|
```sh
|
||||||
socat UNIX-CONNECT:event.sock STDOUT \
|
socat -u UNIX-CONNECT:event.sock STDOUT \
|
||||||
| jq --unbuffered 'select(.type == "message") | .event.nomarkup' \
|
| jq --unbuffered 'select(.type == "message") | .event.nomarkup' \
|
||||||
| grep -E --line-buffered '^"!say ' \
|
| grep -E --line-buffered '^"!say ' \
|
||||||
| sed -Eu 's/^"!say /"/' \
|
| sed -Eu 's/^"!say /"/' \
|
||||||
|
|
読み込み中…
新しいイシューから参照