From e79afb0e23a6ef3f2648a67bcf6a1a8894bb9ad2 Mon Sep 17 00:00:00 2001 From: Fabian Schlenz Date: Wed, 29 May 2019 12:44:49 +0200 Subject: [PATCH] Added option --notice to send a message as notice. (Greyed out; will not be processed by bots.) --- matrix.sh | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/matrix.sh b/matrix.sh index 5a6e1b2..2512f82 100755 --- a/matrix.sh +++ b/matrix.sh @@ -34,6 +34,7 @@ help() { echo " --token= Access token to use. Only useful if you don't want to use --login." echo " --homeserver= Homeserver address to use. Only useful if you don't want to use --login. Must start with \"https\". Must not have a trailing slash." echo " --room= Which room to send the message to." + echo " --notice Send a notice instead of a message." echo " --html Enable HTML tags in message." echo " --pre Wraps the given message into
 and escapes all other HTML special chars."
 	echo "  --file=              Send  to the room."
@@ -221,7 +222,7 @@ send_message() {
 	if $HTML; then
 		clean_body="${text//<+([a-zA-Z0-9\"\'= \/])>/}"
 		clean_body=`escape "$clean_body"`
-		data="{\"body\": $clean_body, \"msgtype\":\"m.text\",\"formatted_body\":$text,\"format\":\"org.matrix.custom.html\"}"
+		data="{\"body\": $clean_body, \"msgtype\":\"$MESSAGE_TYPE\",\"formatted_body\":$text,\"format\":\"org.matrix.custom.html\"}"
 	else
 		data="{\"body\": $text, \"msgtype\":\"m.text\"}"
 	fi
@@ -283,6 +284,10 @@ for i in "$@"; do
 			PRE="true"
 			shift
 			;;
+		--notice)
+			MESSAGE_TYPE="m.notice"
+			shift
+			;;
 		--file=*)
 			FILE="${i#*=}"
 			ACTION="send"