Telegram 机器人:忽略纯文本消息
Telegram bot: ignore text-only messages
我想减少从 Telegram 到我的服务器的请求数量,并使机器人只接收带有图像、URL 或文档的消息。我使用网络钩子。
如果这是可以实现的,那么怎么做?
可以通过 https://core.telegram.org/bots/api#setwebhook 方法的 allowed_updates
参数进行一些扩展:
List the types of updates you want your bot to receive. For example, specify [“message”, “edited_channel_post”, “callback_query”] to only receive updates of these types. See Update for a complete list of available update types. Specify an empty list to receive all updates regardless of type (default). If not specified, the previous setting will be used.
非常遗憾,因为这是文本,所以不可能只接收带有 url 的更新。
如果您想减少请求的数量,可以尝试使用 getUpdates
方法。抱歉:/
我想减少从 Telegram 到我的服务器的请求数量,并使机器人只接收带有图像、URL 或文档的消息。我使用网络钩子。
如果这是可以实现的,那么怎么做?
可以通过 https://core.telegram.org/bots/api#setwebhook 方法的 allowed_updates
参数进行一些扩展:
List the types of updates you want your bot to receive. For example, specify [“message”, “edited_channel_post”, “callback_query”] to only receive updates of these types. See Update for a complete list of available update types. Specify an empty list to receive all updates regardless of type (default). If not specified, the previous setting will be used.
非常遗憾,因为这是文本,所以不可能只接收带有 url 的更新。
如果您想减少请求的数量,可以尝试使用 getUpdates
方法。抱歉:/