Closed lucasfreitas1988 closed 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)
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)