Answer the question
In order to leave comments, you need to log in
How can I receive a message from a user Telegram bot java?
For example, the bot sent "enter your address", the user replied with his address, I have to accept it in a string format. Also, the bot said "enter your name", I entered it and so that the bot would also accept it and fill it in a string format.
Code where Onupdate:
else if (update.getCallbackQuery().getData().equals("dostavka")){
sendDostavka(update.getCallbackQuery());
}
public void sendDostavka(CallbackQuery callbackQuery) {
Update update = new Update();
String getType = "Доставка";
try {
execute(new SendMessage().setText(
"Теперь введите куда вести заказ")
.setChatId(callbackQuery.getMessage().getChatId()));
Message message = update.getMessage();
message.getMessageId();
SendMsg(message,"6667");
if (message != null && message.hasText()) {
String adress = update.getMessage().getText();
}
}
} catch(TelegramApiException e){
e.printStackTrace();
}
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question