telegram.bot {telegram.bot} | R Documentation |
Develop a Telegram Bot with R
Description
Provides a pure interface for the Telegram Bot API. In addition to the pure API implementation, it features a number of tools to make the development of Telegram bots with R easy and straightforward, providing an easy-to-use interface that takes some work off the programmer.
Details
In this page you can learn how to build a Bot quickly with this package.
Main Classes
Updater
Package main class. This class, which employs the class
Dispatcher
, provides a front-end to classBot
to the programmer, so they can focus on coding the bot. Its purpose is to receive the updates from Telegram and to deliver them to said dispatcher.Bot
This object represents a Telegram Bot.
Dispatcher
This class dispatches all kinds of updates to its registered handlers.
Handler
The base class for all update handlers.
Author(s)
Maintainer: Ernest Benedito ebeneditos@gmail.com
Other contributors:
Chris Stefano virtualstaticvoid@gmail.com [contributor]
See Also
Useful links:
Report bugs at https://github.com/ebeneditos/telegram.bot/issues
Examples
## Not run:
library(telegram.bot)
start <- function(bot, update) {
bot$sendMessage(
chat_id = update$message$chat_id,
text = sprintf("Hello %s!", update$message$from$first_name)
)
}
updater <- Updater("TOKEN") + CommandHandler("start", start)
updater$start_polling() # Send '/start' to the bot
## End(Not run)