Commit graph

56 commits

Author SHA1 Message Date
Christian Hesse
30b80e903d telegram-chat: use $FileExists ...
... to work around restrictions in new file handling.
2025-06-04 22:30:45 +02:00
Christian Hesse
6a49c483b6 telegram-chat: rename variable...
... to better describe the use.
2025-05-23 17:38:22 +02:00
Christian Hesse
c50acd697a telegram-chat: fix detection of replies 2025-05-23 17:36:56 +02:00
Christian Hesse
f1396b83aa telegram-chat: support debug output for updates in JSON 2025-05-22 10:13:52 +02:00
Christian Hesse
1b5dd1e1d3 telegram-chat: support trusted group chat ids
But be warned: Adding a person to a trusted group will give
her/him administrative control over the device(s) - without
changes on the device itself!

On the other hand... Removing permissions is easily done by removing
a person from a group.

Closes: https://github.com/eworm-de/routeros-scripts/issues/101
2025-05-22 10:13:52 +02:00
Christian Hesse
f22d46da96 telegram-chat: :do ... on-error=... -> :onerror ... do=... 2025-05-22 10:13:52 +02:00
Christian Hesse
9b5419b939 telegram-chat: check for global config to be ready 2025-05-08 09:51:08 +02:00
Christian Hesse
35bce7c5eb telegram-chat: fail if global functions do not become ready 2025-05-08 09:51:07 +02:00
Christian Hesse
3ad8cafc7a telegram-chat: use :onerror for outer block 2025-05-08 09:51:07 +02:00
Christian Hesse
4eafcaa3ac telegram-chat: say hello when awaiting commands 2025-02-25 22:16:48 +01:00
Christian Hesse
7928c5f054 telegram-chat: support reply in group's topic 2025-02-25 17:55:26 +01:00
Christian Hesse
757fa60e6f telegram-chat: make $IsReply a boolean...
... and check for correct data type.

We need this for a group with topic feature enabled, as that variable is
set there, but is is an array.
2025-02-25 17:55:26 +01:00
Christian Hesse
b156fc43cf telegram-chat: use $RmDir 2025-02-10 15:23:50 +01:00
Christian Hesse
ef48b8d39e telegram-chat: add dependencies on device-mode 2025-01-30 09:00:02 +01:00
Christian Hesse
e3ca37ad9a telegram-chat: use short url rsc.eworm.de 2025-01-29 14:14:27 +01:00
Christian Hesse
9e3729c279 update copyright for 2025 2025-01-02 00:04:06 +01:00
Christian Hesse
adbefca0e4 telegram-chat: use $ExitError to indicate unintentional error 2024-12-09 11:49:50 +01:00
Christian Hesse
32474c751f telegram-chat: drop extra conversion
The JSON parser was actually fixed in RouterOS 7.15beta4, but let's bump
the required version to next stable release instead.
2024-07-25 09:15:41 +02:00
Christian Hesse
6fbafe76ba bump RouterOS requirement for all scripts and modules...
... now that global-functions requires RouterOS 7.14 anyway.
2024-07-16 13:50:22 +02:00
Christian Hesse
588dacb5af certs: Go Daddy Secure Certificate Authority - G2 -> Go Daddy Root Certificate Authority - G2 2024-06-21 15:57:04 +02:00
Christian Hesse
a97820d12a telegram-chat: drop extra parenthesis 2024-05-25 19:55:13 +02:00
Christian Hesse
d664856326 telegram-chat: convert the message (command) to string
RouterOS 7.15beta4 fixed a bug in JSON parser:

*) console - do not convert string to array in ":deserialize" command;

Before that change commands with a comma caused very crazy issues. Let's
convert the message to a string. This does not give exactly the expected
result, but mitigates telegram-chat to explode.

A command like...

    /ip/address/print proplist=address,network;

... is converted to...

    /ip/address/print proplist=address;network;

... and results in:

    Columns: ADDRESS
    # ADDRESS
    0 10.0.0.1/24
    1 127.0.0.1/8
    bad command name network (line 1 column 36)
2024-05-24 20:30:55 +02:00
Christian Hesse
6ba1faca4c telegram-chat: shorten the message 2024-04-29 23:02:48 +02:00
Christian Hesse
7e5010a608 telegram-chat: use :deserialize ...
... instead of $ParseJson. This requires RouterOS 7.13.
2024-04-01 22:45:35 +02:00
Christian Hesse
c01a424f4f telegram-chat: read file content...
... instead of getting it. This lifts the size limit, though we are
still limited by Telegram message size.

This requires RouterOS 7.13.
2024-04-01 22:45:35 +02:00
Christian Hesse
f72aadfc59 telegram-chat: note active state when answering broadcast 2024-03-21 21:11:38 +01:00
Christian Hesse
cc81e55649 telegram-chat: improve readability with symbols 2024-03-21 14:28:23 +01:00
Christian Hesse
19fb5c5801 telegram-chat: switch to $LogPrint 2024-03-12 20:37:57 +01:00
Christian Hesse
738dd11929 telegram-chat: drop main function, use :do with on-error 2024-03-12 15:27:15 +01:00
Christian Hesse
010bea56dc telegram-chat: error when making directory fails 2024-03-12 15:27:15 +01:00
Christian Hesse
1e8918fdaa global-functions: $ScriptLock: do not exit from global function 2024-03-12 15:27:15 +01:00
Christian Hesse
6fd745fc0f telegram-chat: move code into function 2024-03-04 21:40:34 +01:00
Christian Hesse
24b681761b telegram-chat: use :jobname to get script name 2024-01-30 00:52:21 +01:00
Christian Hesse
abfc8e9191 telegram-chat: add (and increase) random delay on error
Chances are that two devices schedule the script (nearly) simultaneously.
Causing a lot of failures from fetch. Instead of forcing a retry on
*every* invocating we add (and increase) a random delay, that is
slowly decreasd on success. This should minimize failures...
2024-01-30 00:02:08 +01:00
Christian Hesse
b6367b5df3 telegram-chat: fix concatenation (and retry with delay)
Ups... 😳
2024-01-30 00:02:08 +01:00
Christian Hesse
9a73fc526f update copyright for 2024 2024-01-01 15:25:25 +01:00
Christian Hesse
cae5f425a6 telegram-chat: get rid of '.txt' file extension 2023-11-22 21:20:44 +01:00
Christian Hesse
1f6040178f telegram-chat: rework the retry logic
... with increasing delay.
2023-10-19 21:13:04 +02:00
Christian Hesse
b81f3850ae telegram-chat: log when sending notice 2023-10-19 09:19:34 +02:00
Christian Hesse
4c365c131d telegram-chat: drop extra conversion 2023-10-19 08:42:29 +02:00
Christian Hesse
fffe0a3b50 telegram-chat: retry on fetch failure...
... and exit with a warning.
2023-10-17 21:37:13 +02:00
Christian Hesse
bcc10c8285 telegram-chat: make messages silent...
... at least those not indicating an error.
2023-10-17 14:05:03 +02:00
Christian Hesse
73194b92cf telegram-chat: use $ParseJson for all JSON 2023-10-16 23:43:58 +02:00
Christian Hesse
c9233773b3 telegram-chat: do not act on foreign reply...
... even if active!
2023-10-16 15:27:14 +02:00
Christian Hesse
bc4839f611 telegram-chat: rename variable 2023-10-16 15:27:14 +02:00
Christian Hesse
1b62545d8c telegram-chat: answer question mark with short notice 2023-10-16 15:27:14 +02:00
Christian Hesse
15873e2fdb telegram-chat: restore indention 2023-10-16 15:27:14 +02:00
Christian Hesse
555461c612 telegram-chat: do not nest conditions 2023-10-16 15:27:14 +02:00
Christian Hesse
adca33cc5b telegram-chat: act on reply without delay 2023-10-16 13:11:20 +02:00
Christian Hesse
399d952ac2 telegram-chat: act on reply from self 2023-10-16 13:11:20 +02:00