Telegram bot api 传入更新的限制 [英] Telegram bot api limit of incoming updates

查看:36
本文介绍了Telegram bot api 传入更新的限制的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在测试 Telegram bot api 以获取更新使用

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

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

但是,我意识到我只能获得 100 个更新,而其他的则不会出现.有什么办法可以获得我的其余更新吗?

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?

推荐答案

您可以使用 limit 参数来控制您收到的更新数量.但是,根据文档:

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

limit: ... 可以接受 1-100 之间的值.默认为 100

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

这意味着您一次不能收到超过 100 个更新.

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

如果您想接收较新的更新,则必须确认较旧的更新,因此服务器不会一遍又一遍地给您相同的旧消息.注意update_id.例如,如果您收到 999 的 update_id,下次调用 getUpdates 时,您应该使用:

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

这样,服务器就知道你收到了update_id低于1000的s,不会一遍遍地给同样的旧消息.

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

这篇关于Telegram bot api 传入更新的限制的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆