reo7sp / tgbot-cpp

C++ library for Telegram bot API
http://reo7sp.github.io/tgbot-cpp
MIT License
995 stars 238 forks source link

Clean Tg Update queu #301

Closed jiren85 closed 4 months ago

jiren85 commented 4 months ago

Hello,

I've a question; Is there in your lib a method to clean the telegram updates queue after I've received the update?

Thank you in advance.

Regards

llnulldisk commented 4 months ago

Hi,

The update is automatically cleaned from the queue, if you handle it.

Do you want to discard all pending updates in the queue? Then no, there is currently no such function. However, you can do something like this:

Update::Ptr update = api.getUpdates(-1).front(); api.getUpdates(update->updateId + 1);

jiren85 commented 4 months ago

Great It's perfect.

Thank you so much.