Learn R Programming

telegram.bot (version 3.0.0)

MessageHandler: Handling messages

Description

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

Usage

MessageHandler(callback, filters = NULL)

Format

An R6Class object.

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.

Examples

Run this code
if (FALSE) {
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