Closed drunckoder closed 8 years ago
BTW, setInlineMessageId(String.valueOf(update.getCallbackQuery().getMessage().getMessageId())) isn't working with an exception:
org.telegram.telegrambots.TelegramApiException: Error at editmessagetext: Bad Request: Wrong inline message identifier specified at org.telegram.telegrambots.bots.AbsSender.sendApiMethod(AbsSender.java:1016) at org.telegram.telegrambots.bots.AbsSender.editMessageText(AbsSender.java:227) at Launcher.onUpdateReceived(Launcher.java:74) at org.telegram.telegrambots.updatesreceivers.BotSession$HandlerThread.run(BotSession.java:197)
Piece of code:
EditMessageText editMessage = new EditMessageText(); editMessage.setInlineMessageId(String.valueOf(update.getCallbackQuery().getMessage().getMessageId())); editMessage.setText(update.getCallbackQuery().getMessage().getText()); editMessage.setReplyMarkup(inlineKeyboardMarkup); editMessageText(editMessage);
After spending some time, I've got it working:
EditMessageText editMessage = new EditMessageText(); editMessage.setChatId(String.valueOf(update.getCallbackQuery().getMessage().getChatId())); editMessage.setMessageId(update.getCallbackQuery().getMessage().getMessageId()); editMessage.setText("text"); editMessageText(editMessage);
As the Telegram Bot API docs say, if don't specify the inline_message_id, then I should set chat_id and message_id, and I did so. But the question remains about inline_message_id. Where can I get it?
The inline_message_id is present in the callbackquery itself it the inline button was added to an inline query.
Thank you very much!
Hey everyone! I'm trying to make a bot with InlineKeyboardMarkup feature and faced an issue while updating the existing chat message.
How do I use the editMessage method? I couldn't find how to get a message ID to pass to setInlineMessageId(String) method.
Is there a working example of such a bot or some kind of explanation?
Thanks in advance!