Learn R Programming

telegram.bot (version 1.0.0)

stop_polling: stop_polling

Description

Stops the polling. Requires no parameters.

Usage

stop_polling()

Arguments

Examples

Run this code
# NOT RUN {
# Supperassign the updater
updater <<- Updater(token = 'TOKEN')

# Example of a 'kill' command
kill <- function(bot, update){
  bot$sendMessage(chat_id = update$message$chat_id,
                  text = "Bye!")
  # Clean 'kill' update
  bot$get_updates(offset = update$update_id + 1)
  # Stop the updater polling
  updater$stop_polling()
}

updater$dispatcher$add_handler(CommandHandler('kill', kill))

updater$start_polling(verbose = T) # Send '/kill' to the bot
# }

Run the code above in your browser using DataLab