Learn R Programming

telegram.bot (version 2.2.0)

MessageHandler: Handling messages

Description

Handler class to handle Telegram messages. They might contain text, media or status updates.

Usage

MessageHandler(callback, filters = NULL)

Arguments

callback

The callback function for this handler. See Handler for information about this function.

filters

(Optional). Only allow updates with these filters. Use NULL (default) or MessageFilters$all for no filtering. See MessageFilters for a full list of all available filters.

Format

An R6Class object.

Examples

Run this code
# NOT RUN {
callback_method <- function(bot, update){
  chat_id <- update$message$chat_id
  bot$sendMessage(chat_id = chat_id, text = 'Hello')
}

# No filtering
message_handler <- MessageHandler(callback_method, MessageFilters$all)
# }

Run the code above in your browser using DataLab