MessageHandler {telegram.bot}R Documentation

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

## 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)

## End(Not run)

[Package telegram.bot version 3.0.0 Index]