问题
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_id
s 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