cotestatnt / AsyncTelegram2

Powerful, flexible and secure Arduino Telegram BOT library. Hardware independent, it can be used with any MCU capable of handling an SSL connection.
MIT License
83 stars 25 forks source link

When message ask as read #78

Closed joroMaser closed 2 years ago

joroMaser commented 2 years ago

I thought that when I got new message with getNewMessage that message marked as read so I will not get this message again. But I test that code to implement restart esp with text message

if (msg.text == "RESTART")
        {
          Serial.println("RESTART message");
          ESP.restart();
        }

But that makes a boot loop,each boot I got the same message(even I sent this message once). And I saw that each time I got the same

cotestatnt commented 2 years ago

This is the same like this https://github.com/cotestatnt/AsyncTelegram2/issues/62 and this https://github.com/cotestatnt/AsyncTelegram2/issues/70

joroMaser commented 2 years ago

@cotestatnt Thank you so much about your reply. But using while (!myBot.noNewMessage()) will not drop anew message after reset message (until the esp will reboot?)

cotestatnt commented 2 years ago

myBot.noNewMessage() simply wait until bot is synced with server and no new messages are pending.

joroMaser commented 2 years ago

@cotestatnt Thank you,you can close this issue. I will check hiw do you prevent get duplicate message in normal state while getNewMessage