getUpdates: Receive incoming updates

View source: R/bot.R

getUpdatesR Documentation

Receive incoming updates

Description

Use this method to receive incoming updates. It returns a list of Update objects.

Usage

getUpdates(offset = NULL, limit = 100L, timeout = 0L, allowed_updates = NULL)

Arguments

offset

(Optional). Identifier of the first update to be returned.

limit

(Optional). Limits the number of updates to be retrieved. Values between 1-100 are accepted. Defaults to 100.

timeout

(Optional). Timeout in seconds for long polling. Defaults to 0, i.e. usual short polling. Should be positive, short polling should be used for testing purposes only.

allowed_updates

(Optional). String or vector of strings with the types of updates you want your bot to receive. For example, specify c("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 string to receive all updates regardless of type (default). If not specified, the previous setting will be used.

Please note that this parameter doesn't affect updates created before the call to the getUpdates, so unwanted updates may be received for a short period of time.

Details

1. This method will not work if an outgoing webhook is set up.

2. In order to avoid getting duplicate updates, recalculate offset after each server response or use Bot method clean_updates.

3. To take full advantage of this library take a look at Updater.

You can also use it's snake_case equivalent get_updates.

Examples

## Not run: 
bot <- Bot(token = bot_token("RTelegramBot"))

updates <- bot$getUpdates()

## End(Not run)

telegram.bot documentation built on Sept. 7, 2022, 5:07 p.m.