Develop a Telegram Bot with R
This package 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. It is built on top of the pure API implementation, being an extension of the
telegram
package, an R wrapper around the
Telegram Bot API.
You can install telegram.bot
from CRAN:
install.packages("telegram.bot")
Or the development version from GitHub:
# install.packages("devtools")
devtools::install_github("ebeneditos/telegram.bot")
Make sure you have the devtools
package updated.
The telegram.bot
package is easy, fun and free to use! You can quickly build a chatbot with a few lines:
library(telegram.bot)
hello <- function(bot, update){
bot$sendMessage(chat_id = update$message$chat_id,
text = sprintf("Hello %s!", update$message$from$first_name))
}
updater <- Updater('YOUR TOKEN HERE')
updater$dispatcher$add_handler(CommandHandler('hello', hello))
updater$start_polling()
To get you started with telegram.bot
, we recommend to take a look at its Wiki:
- Introduction to the API.
- Tutorial: Building an R Bot in 3 steps.
You can also check these other resources:
The package is in a starting phase, so contributions of all sizes are very welcome. Please:
- Review our contribution guidelines to get started.
- You can also help by reporting bugs.
You may copy, distribute and modify the software provided that modifications are described and licensed for free under LGPL-3. Derivatives works (including modifications or anything statically linked to the package) can only be redistributed under LGPL-3, but applications that use the library don't have to be.
This package is inspired by Python's library
python-telegram-bot
, specially by its submodule telegram.ext
.