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.
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.
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!)