View source: R/commandhandler.R
CommandHandler | R Documentation |
Handler
class to handle Telegram commands.
CommandHandler( command, callback, filters = NULL, pass_args = FALSE, username = NULL )
command |
The command or vector of commands this handler should listen for. |
callback |
The callback function for this handler.
See |
filters |
(Optional). Only allow updates with these filters. See
|
pass_args |
(Optional). Determines whether the handler should be passed
|
username |
(Optional). Bot's username, you can retrieve it from
|
An R6Class
object.
## Not run: # Initialize bot bot <- Bot("TOKEN") username <- bot$getMe()$username updater <- Updater(bot = bot) # Add a command start <- function(bot, update) { bot$sendMessage( chat_id = update$message$chat_id, text = "Hi, I am a bot!" ) } updater <- updater + CommandHandler("start", start, username = username) ## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.