Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

start_polling

Start polling


Description

Starts polling updates from Telegram. You can stop the polling either by using the the interrupt R command in the session menu or with the stop_polling method.

Usage

start_polling(timeout = 10L, clean = FALSE, allowed_updates = NULL,
  verbose = FALSE)

Arguments

timeout

(Optional). Passed to getUpdates. Default is 10.

clean

(Optional). Whether to clean any pending updates on Telegram servers before actually starting to poll. Default is FALSE.

allowed_updates

(Optional). Passed to getUpdates.

verbose

(Optional). If TRUE, prints status of the polling. Default is FALSE.

Examples

## Not run: 
# Start polling example
start <- function(bot, update) {
  bot$sendMessage(
    chat_id = update$message$chat_id,
    text = sprintf(
      "Hello %s!",
      update$message$from$first_name
    )
  )
}

updater <- Updater("TOKEN") + CommandHandler("start", start)

updater$start_polling(verbose = TRUE)

## End(Not run)

telegram.bot

Develop a 'Telegram Bot' with R

v2.4.0
GPL-3
Authors
Ernest Benedito [aut, cre]
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.