diff options
author | Christian Hesse <mail@eworm.de> | 2023-10-13 22:43:19 +0200 |
---|---|---|
committer | Christian Hesse <mail@eworm.de> | 2023-10-16 23:43:58 +0200 |
commit | 73194b92cf2c4c10b7d45945b15f26c965d03dca (patch) | |
tree | a6eb6dfb6baea5977693f33c2acb2cccb957c5b4 /telegram-chat.rsc | |
parent | c0aab0feadd1ede2cc2d900811f0678f8901de6a (diff) |
telegram-chat: use $ParseJson for all JSON
Diffstat (limited to 'telegram-chat.rsc')
-rw-r--r-- | telegram-chat.rsc | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/telegram-chat.rsc b/telegram-chat.rsc index 2bd8ccd..59e56b7 100644 --- a/telegram-chat.rsc +++ b/telegram-chat.rsc @@ -52,14 +52,13 @@ $WaitFullyConnected; :set Data ([ /tool/fetch check-certificate=yes-without-crl output=user \ ("https://api.telegram.org/bot" . $TelegramTokenId . "/getUpdates?offset=" . \ $TelegramChatOffset->0 . "&allowed_updates=%5B%22message%22%5D") as-value ]->"data"); - :set Data [ :pick $Data ([ :find $Data "[" ] + 1) ([ :len $Data ] - 2) ]; } on-error={ $LogPrintExit2 debug $0 ("Failed getting updates from Telegram.") true; } :local UpdateID 0; :local Uptime [ /system/resource/get uptime ]; -:foreach UpdateArray in=[ :toarray $Data ] do={ +:foreach UpdateArray in=[ :toarray ([ $ParseJson $Data ]->"result") ] do={ :local Update [ $ParseJson $UpdateArray ]; :set UpdateID ($Update->"update_id"); :local Message [ $ParseJson ($Update->"message") ]; |