Commit graph

25 commits

Author SHA1 Message Date
Christian Hesse
bfd1361f71 telegram-chat: get the uptime just once 2023-02-26 22:19:36 +01:00
Christian Hesse
02b447212d telegram-chat: ignore new messages after reboot
This script supports multiple devices, and sending offset to discard
messages is delayed to third fetch to make sure all devices get the
message.

This can cause trouble, though: Sending a device a reboot command can
make that device reboot multiple times 🥴 or - even worse - make it
enter an infinite boot loop 😳 if it is the only device.

So let's ignore first messages after reboot.
2023-02-26 22:19:36 +01:00
Christian Hesse
5ea892662f telegram-chat: send messages in reply 2023-02-26 22:19:30 +01:00
Christian Hesse
95b8a47b81 telegram-chat: log command with failed syntax validation 2023-02-14 23:01:24 +01:00
Christian Hesse
f1ad240e59 telegram-chat: never decrease the local offset 2023-02-14 23:01:24 +01:00
Christian Hesse
77d26e02d4 telegram-chat: add debug message for handled updates 2023-02-14 23:01:16 +01:00
Christian Hesse
2a7576f4e4 telegram-chat: add updateid in log messages 2023-02-14 21:28:15 +01:00
Christian Hesse
58a6fac3d9 telegram-chat: use complete property name 2023-02-07 21:19:57 +01:00
Christian Hesse
9c066599e8 telegram-chat: handle exceeded file read size 2023-02-04 23:24:44 +01:00
Christian Hesse
600203797b telegram-chat: no need to :put ...
... a simple change to root dir is sufficient.
2023-02-03 22:30:08 +01:00
Christian Hesse
04c26d3d2e telegram-chat: log with severity debug only...
... as failed request are quite common.
2023-02-03 22:01:35 +01:00
Christian Hesse
8a900dce00 telegram-chat: delay confirmation of updates
Several devices can communicate with the same bot, and we want all of
them to receive their updates. However this can be tricky, as...

* ... sometimes internet connection can be unreliable or saturated.
* ... device can be busy with long running command.
* ... the Telegram bot api servers seem to implement what ever kind of
  rate limiting. Anybody can give details?

So let's confirm the update id after third request only. 😁 This gives
delayed devices some extra chances to catch up.
2023-02-03 21:59:26 +01:00
Christian Hesse
4bc5b9cf5f telegram-chat: log warning only when trying to activate 2023-02-03 09:56:30 +01:00
Christian Hesse
9d1cf87489 telegram-chat: handle missing username 2023-02-03 09:53:49 +01:00
Christian Hesse
c47c9a2906 telegram-chat: discard messages without text 2023-02-02 11:30:49 +01:00
Christian Hesse
82003bc7d1 telegram-chat: allow to modify the time to wait for command
For now this is a hidden settings... Do we want this to be documented?
2023-02-02 11:24:45 +01:00
Christian Hesse
978c03131a global-functions: $WaitForFile: use delay instead of iterations 2023-02-02 11:20:14 +01:00
Christian Hesse
b794d98cbb telegram-chat: reply with a hint when untrusted...
... but only when activating via identity.
2023-02-02 10:06:42 +01:00
Christian Hesse
08383daa5c telegram-chat: always reply to origin chat 2023-02-02 10:06:42 +01:00
Christian Hesse
8dd53c80f5 telegram-chat: modify text if no output available 2023-02-01 14:26:28 +01:00
Christian Hesse
b5399099c6 telegram-chat: also give a hint on failed syntax validation
... and drop the warning in log instead.
2023-02-01 11:29:56 +01:00
Christian Hesse
a073835667 telegram-chat: ... and give a hint on failure 2023-02-01 11:29:56 +01:00
Christian Hesse
c2cf05e9e5 telegram-chat: handle error in command... 2023-02-01 11:29:56 +01:00
Christian Hesse
44c30efbcd telegram-chat: give a hint if command is still running 2023-02-01 11:29:56 +01:00
Christian Hesse
819c7294c6 introduce telegram-chat
Druvis from Mikrotik produced a video "MikroTik Telegram bot - Chat with
your Router?". He shows his script to chat with a Router via Telegram
bot to send it commands: https://youtu.be/KLX6j3sLRIE

This script is kind of limited and has several issues... 🥴

Let's make it robust, usable, multi-device capable and just fun! 😁

(Sadly Mikrotik has a policy to not allow links in Youtube comments.
Thus my comment with several hints was removed immediately. If anybody
is in contact with Druvis... Please tell him about this script!)
2023-01-31 17:26:51 +01:00