Я знаю, что должен использовать EditMessageReplyMarkup , но я не знаю, как это сделать. Может быть, здесь кто-то может мне помочь.
else if(update.hasCallbackQuery()){
try {
execute(new SendMessage().setText(
update.getCallbackQuery().getData())
.setChatId(update.getCallbackQuery().getMessage().getChatId()));
//HERE I NEED TO DELETE INLINEKEYBOARD
} catch (TelegramApiException e) {
e.printStackTrace();
}
}
Создание Inlinekeyboard
public static List<List<InlineKeyboardButton>> sendThirdOpcions() {
InlineKeyboardButton inlineKeyboardButton1 = new InlineKeyboardButton();
InlineKeyboardButton inlineKeyboardButton2 = new InlineKeyboardButton();
InlineKeyboardButton inlineKeyboardButton3 = new InlineKeyboardButton();
inlineKeyboardButton1.setText("A");
inlineKeyboardButton1.setCallbackData("Button A has been pressed");
inlineKeyboardButton2.setText("B");
inlineKeyboardButton2.setCallbackData("Button B has been pressed");
inlineKeyboardButton3.setText("C");
inlineKeyboardButton3.setCallbackData("Button C has been pressed");
List<InlineKeyboardButton> keyboardButtonsRow1 = new ArrayList<>();
keyboardButtonsRow1.add(inlineKeyboardButton1);
keyboardButtonsRow1.add(inlineKeyboardButton2);
keyboardButtonsRow1.add(inlineKeyboardButton3);
List<List<InlineKeyboardButton>> rowList = new ArrayList<>();
rowList.add(keyboardButtonsRow1);
return rowList;
}
Отправка
if(update.hasMessage()){
if(update.getMessage().hasText()){
SendMessage sendMessage = new SendMessage().setChatId(message.getChatId());
sendMessage.enableHtml(true);
switch (message.getText()) {
case "Grama":
try {
sendMessage.setText("A");
SendPhoto photo = new SendPhoto().setChatId(message.getChatId()).setPhoto("SomeText", new FileInputStream(new File("C:\\Users\\chevp\\Desktop\\YepZnoBot\\src\\main\\resources\\Зауваження 2020-03-27 143310.png")));
photo.setReplyMarkup(inlineKeyboardMarkup.setKeyboard(inlineButtons.sendThirdOpcions()));
execute(photoS);
} catch (TelegramApiException | FileNotFoundException e) {
e.printStackTrace();
}
break;
default:
break;
}
Я также пытался использовать EditMessage, но я не могу найти информацию с примеры как их использовать