Telegram bot api limit of incoming updates

感情迁移 提交于 2019-12-21 12:38:29

问题


I was testing the Telegram bot api in order to get updates using

https://api.telegram.org/bot<tokenOfBot>/getUpdates

However, I realized I can get only 100 updates, and other ones don't appear. Is there any way to get the rest of my updates?


回答1:


You may use the limit parameter to control how many updates you received. However, according to the documentation:

limit: ... Values between 1—100 are accepted. Defaults to 100

That means you cannot receive more than 100 updates at a time.

If you want to receive newer updates, you would have to acknowledge the older updates, so the server won't give you the same old messages over and over. Pay attention to update_id. For example, if you have received an update_id of 999, next time you call getUpdates, you should use:

https://api.telegram.org/bot<token>/getUpdates?offset=1000

This way, the server knows you have received update_ids below 1000, and will not give the same old messages over and over.



来源:https://stackoverflow.com/questions/34296374/telegram-bot-api-limit-of-incoming-updates

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!