Creating telegram bot in r programming facing some issues

Good Day! I am preparing a telegram bot in R Programming , where user will get some information which are link to command1,command2,command3,command4. For the same I have written some text here :

While input the command1,command2 etc on telegram, it is not responding... as per the message link to this bot.. can you please help me on this.. thanks..

library(telegram.bot)
library(stringr)

bot_token <- "XXXX"
target_chat_id <- YYYY

bot <- Bot(token = bot_token)

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, username = "chatbotusername")
bot <- bot + start_handler


# start bot
bot$start_polling()


while (TRUE) {
  Sys.sleep(2)
  #sent message every hour
  if (format(Sys.time(), "%M") == "00") {
    if (format(Sys.time(), "%H") == "08") {
      bot_sendmessage("Sentiments during the last 24 hours is ")
    }
    
    if (as.numeric(format(Sys.time(), "%H")) == round(runif(1, 8, 23))) {
      bot_sendmessage("Today Tweet :  ")
      
    }
    
    if (format(Sys.time(), "%H") == "23") {
      bot_sendmessage(" Latest Updates :  ")
      #Sys.sleep(round(runif(1, 1, 10)))
      #bot_sendmessage("For ")
    }
    
  }
  
  #sent message based on last reply in chat
  
  if (TRUE) {
    ##obtain last message
    
    history <- bot$getUpdates()
    if (length(history) != 0) {
      lastmessage <- history[[length(history)]]
      
      lasttext <- lastmessage$message$text
      lastuser <- lastmessage$message$from$first_name
      
      print(lastuser)
      print(lasttext)
      
      if (str_detect(lasttext, "/command1")) {
        bot_sendmessage("Some message related to command1 ")
        Sys.sleep(1)
        bot$clean_updates()
      }
      
      if (str_detect(lasttext, "/command2")) {
        bot_sendmessage(" Some message related to command2")
        Sys.sleep(1)
        bot$clean_updates()
      }
      
      if (str_detect(lasttext, "/command3")) {
        bot_sendmessage("Some message related to command3")
        Sys.sleep(1)
        bot$clean_updates()
      }
      
      if (str_detect(lasttext, "/command4")) {
        bot_sendmessage("Some message related to command4")
        Sys.sleep(1)
        bot$clean_updates()
      }
      
    }
  }
}

Thanks a lot in advance..