From d23062588a3f64815d6fdb2f34588edeaf83b2aa Mon Sep 17 00:00:00 2001 From: Juraj Bednar Date: Sun, 17 Nov 2024 14:43:11 +0100 Subject: [PATCH] Add support for groups --- README.md | 21 ++++++++++++++++----- signal-monitoring.sh | 13 ++++++++++--- 2 files changed, 26 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 037b65a..9119968 100644 --- a/README.md +++ b/README.md @@ -115,20 +115,31 @@ dependant on single infrastructure provider, anyone can run a node, but it is highly secure. We can use [command-line version](https://github.com/simplex-chat/simplex-chat/blob/stable/docs/CLI.md). -After installation, you need to choose a display name and connect to profile -that should receive notifications (using /c command). After you are connected, -write nickname into +After installation, you need to choose a display name and connect to a user or group +that should receive notifications. Use the /c command to connect to a user, or the /g +command to connect to a group. After you are connected, write the nickname or group name +into the configuration file, prefixing it with @ for users or # for groups: ``` -SIMPLEX_DESTINATION="nickname" +SIMPLEX_DESTINATION="@nickname" # for users +``` +or +``` +SIMPLEX_DESTINATION="#groupname" # for groups ``` -If something does not work, the command that should work is: +If something does not work, the command that should work for sending to a user is: ``` simplex-chat -e '@nickname This is a test' -t 10 ``` +For sending to a group, use: + +``` +simplex-chat -e '#groupname This is a test' -t 10 +``` + ## Why this project I wanted to be able to perform a simple monitoring for my hosted server from diff --git a/signal-monitoring.sh b/signal-monitoring.sh index 6c783bd..3da7cde 100755 --- a/signal-monitoring.sh +++ b/signal-monitoring.sh @@ -21,8 +21,15 @@ LXMF_NAME="LXMF bot signal-monitoring" LXMF_PROPAGATION="32112312312312312312312312312312" ### For simplex-chat command-line utility -# Nickname of already connected user (use /c) -SIMPLEX_DESTINATION="nickname" +# Nickname of already connected user (use /c) or group (use /g) +# Prefix user with @ and group with # + +SIMPLEX_DESTINATION="@nickname" + +# Time to wait for Simplex - this needs to be long enough to send the message to +# the relay. See: https://github.com/simplex-chat/simplex-chat/issues/5196 +# The command is sent to background, so it won't block processing +SIMPLEX_WAIT=10 # now go to the notify function below, choose which notification mechanism # to use. @@ -50,7 +57,7 @@ function notify { # LXMF / Reticulum / Sideband #echo "$1" | LXMF-NotifyBot.py "${LXMF_DESTINATION}" "${LXMF_NAME}" "${LXMF_PROPAGATION}" > /dev/null # SimpleX - #(simplex-chat -e "@${SIMPLEX_DESTINATION} ${1}" -t 10 > /dev/null) & + #(simplex-chat -e "${SIMPLEX_DESTINATION} ${1}" -t ${SIMPLEX_WAIT} > /dev/null) & log "Sending notification ${1}" }