From bfd1361f7122754dfd2d30004d4effc73f375796 Mon Sep 17 00:00:00 2001 From: Christian Hesse Date: Sun, 26 Feb 2023 22:00:52 +0100 Subject: telegram-chat: get the uptime just once --- telegram-chat | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/telegram-chat b/telegram-chat index e4bd783..ba2a3ff 100644 --- a/telegram-chat +++ b/telegram-chat @@ -72,10 +72,10 @@ $WaitFullyConnected; } :local UpdateID 0; +:local Uptime [ /system/resource/get uptime ]; :foreach Update in=[ :toarray $Data ] do={ :set UpdateID [ $JsonGetKey $Update "update_id" ]; - :if (($TelegramChatOffset->0 > 0 || [ /system/resource/get uptime ] > 5m) && \ - $UpdateID >= $TelegramChatOffset->2) do={ + :if (($TelegramChatOffset->0 > 0 || $Uptime > 5m) && $UpdateID >= $TelegramChatOffset->2) do={ :local Trusted false; :local Message [ $JsonGetKey $Update "message" ]; :local MessageId [ $JsonGetKey $Message "message_id" ]; -- cgit v1.2.3-70-g09d2