aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Christian Hesse <mail@eworm.de>2023-10-13 21:54:50 +0200
committerGravatar Christian Hesse <mail@eworm.de>2023-10-16 15:27:14 +0200
commit1b62545d8c5b186e9059c9640761a12ad336ec7b (patch)
treeca34a856dd1ba4950bf0e2ae4d6b725a42e57e8e
parent15873e2fdb20ad74e8ba9f0cf3dd7331ad143809 (diff)
telegram-chat: answer question mark with short noticechange-106-2
-rw-r--r--doc/telegram-chat.md5
-rw-r--r--news-and-changes.rsc2
-rw-r--r--telegram-chat.rsc8
3 files changed, 13 insertions, 2 deletions
diff --git a/doc/telegram-chat.md b/doc/telegram-chat.md
index 3cbc710..79a9eb1 100644
--- a/doc/telegram-chat.md
+++ b/doc/telegram-chat.md
@@ -78,6 +78,11 @@ Associated messages are cleared on device reboot.
> ⚠️ **Warning**: If another device is activated both will act, the one from
> reply and the active one!
+### Ask for devices
+
+Send a message with a single question mark (`?`) to query for devices
+currenty online. The answer can be used for command via reply then.
+
Known limitations
-----------------
diff --git a/news-and-changes.rsc b/news-and-changes.rsc
index bbbaad6..49b1671 100644
--- a/news-and-changes.rsc
+++ b/news-and-changes.rsc
@@ -19,7 +19,7 @@
103="Dropped hard-coded name and timeout from 'hotspot-to-wpa-cleanup', instead a comment is required for dhcp server now.";
104="All relevant scripts were ported to new wifiwave2 and are available for AX devices now!";
105="Extended 'check-routeros-update' to support automatic update from specific neighbor(s).";
- 106="Modified 'telegram-chat' to make it act on message replies, without activation.";
+ 106="Modified 'telegram-chat' to make it act on message replies, without activation. Also made it answer a single question mark with a short notice.";
};
# Migration steps to be applied on script updates
diff --git a/telegram-chat.rsc b/telegram-chat.rsc
index e063e80..16edbca 100644
--- a/telegram-chat.rsc
+++ b/telegram-chat.rsc
@@ -77,7 +77,13 @@ $WaitFullyConnected;
:if ($Trusted = true) do={
:local Done false;
- :if ([ :pick ($Message->"text") 0 1 ] = "!") do={
+ :if ($Message->"text" = "?") do={
+ $SendTelegram2 ({ origin=$0; chatid=($Chat->"id"); silent=false; replyto=($Message->"message_id"); \
+ subject=([ $SymbolForNotification "speech-balloon" ] . "Telegram Chat"); \
+ message=("Online, awaiting your commands!") });
+ :set Done true;
+ }
+ :if ($Done = false && [ :pick ($Message->"text") 0 1 ] = "!") do={
:if ($Message->"text" ~ ("^! *(" . [ $EscapeForRegEx $Identity ] . "|@" . $TelegramChatGroups . ")\$")) do={
:set TelegramChatActive true;
} else={