| Handler | R Documentation |
The base class for all update handlers. Create custom handlers by inheriting from it.
Handler( callback, check_update = NULL, handle_update = NULL, handlername = NULL ) is.Handler(x)
callback |
The callback function for this handler. Its inputs will be
|
check_update |
Function that will override the default
|
handle_update |
Function that will override the default
|
handlername |
Name of the customized class, which will inherit from
|
x |
Object to be tested. |
An R6Class object.
check_updateCalled to determine if an update should be handled by this handler instance.
handle_updateCalled if it was determined that an update should indeed be handled by this instance.
MessageHandlerTo handle Telegram messages.
CommandHandlerTo handle Telegram commands.
CallbackQueryHandlerTo handle Telegram callback queries.
ErrorHandlerTo handle errors while polling for updates.
## Not run:
# Example of a Handler
callback_method <- function(bot, update) {
chat_id <- update$effective_chat()$id
bot$sendMessage(chat_id = chat_id, text = "Hello")
}
hello_handler <- Handler(callback_method)
# Customizing Handler
check_update <- function(update) {
TRUE
}
handle_update <- function(update, dispatcher) {
self$callback(dispatcher$bot, update)
}
foo_handler <- Handler(callback_method,
check_update = check_update,
handle_update = handle_update,
handlername = "FooHandler"
)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.