Added PrettyPrint config option
This commit is contained in:
parent
f4bca1586d
commit
1fb436c53b
1 changed files with 9 additions and 2 deletions
11
matrix-send
11
matrix-send
|
@ -1,7 +1,7 @@
|
|||
#!/usr/bin/env sh
|
||||
# matrix-send: send a message to a Matrix room
|
||||
|
||||
version="1.0"
|
||||
version="1.0.1"
|
||||
|
||||
###########################
|
||||
#### Generic Functions ####
|
||||
|
@ -106,6 +106,10 @@ NoCache () {
|
|||
nocache="true"
|
||||
}
|
||||
|
||||
PrettyPrint () {
|
||||
prettyprint="true"
|
||||
}
|
||||
|
||||
############################
|
||||
#### Specific Functions ####
|
||||
############################
|
||||
|
@ -134,7 +138,10 @@ ClearCache () {
|
|||
}
|
||||
|
||||
Send () {
|
||||
curl -s -XPOST -d "{"'"'"msgtype"'"'":"'"'"$mtype"'"'", "'"'"body"'"'":"'"'"$message"'"'"}" "https://$server/_matrix/client/r0/rooms/%21$roomid/send/m.room.message?access_token=$token"
|
||||
if [ -z "$prettyprint" ]
|
||||
then curl -s -XPOST -d "{"'"'"msgtype"'"'":"'"'"$mtype"'"'", "'"'"body"'"'":"'"'"$message"'"'"}" "https://$server/_matrix/client/r0/rooms/%21$roomid/send/m.room.message?access_token=$token"
|
||||
else curl -s -XPOST -d "{"'"'"msgtype"'"'":"'"'"$mtype"'"'", "'"'"body"'"'":"'"'"$message"'"'"}" "https://$server/_matrix/client/r0/rooms/%21$roomid/send/m.room.message?access_token=$token" | jq
|
||||
fi
|
||||
}
|
||||
|
||||
########################
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue