Use this method to receive incoming updates. It returns a
list of Update
objects.
getUpdates(offset = NULL, limit = 100L, timeout = 0L, allowed_updates = NULL)
(Optional). Identifier of the first update to be returned.
(Optional). Limits the number of updates to be retrieved. Values between 1-100 are accepted. Defaults to 100.
(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.
(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.
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
.
if (FALSE) {
bot <- Bot(token = bot_token("RTelegramBot"))
updates <- bot$getUpdates()
}
Run the code above in your browser using DataLab