ebeneditos / telegram.bot

Develop a Telegram Bot with R
https://ebeneditos.github.io/telegram.bot/
GNU General Public License v3.0
108 stars 24 forks source link

Telegram Bot Help - Second answer and more #12

Closed lucasfreitas1988 closed 4 years ago

lucasfreitas1988 commented 4 years ago

I need help with a chatbot code for Telegram, please ...

When I follow the scripts available on github or internet, my bot only responds to the original messages ... I can't get him to answer other questions ... Follow my code:

updater <- Updater (token = bot_token ("RTelegramBot"))

start <- function (bot, update) {    bot $ sendMessage (chat_id = update $ message $ chat_id,                    text = sprintf ("Hello% s!",                                   update $ message $ from $ first_name)) }

start_handler <- CommandHandler ("start", start)

updater <- updater + start_handler

caps <- function (bot, update, args) {    if (length (args> 0L)) {      text_caps <- toupper (paste (args, collapse = "Are you ok?"))      bot $ sendMessage (chat_id = update $ message $ chat_id,                      text = "Yes, and you?")    } }

updater <- updater + CommandHandler ("caps", caps, pass_args = TRUE)