TelegramBots
TelegramBots copied to clipboard
[BUG] #editMediaMessage does not work properly with "file_id" specified
Describe the bug Every time when I try to send an editMessageMedia I get "Error editing message text: [400] Bad Request: MEDIA_EMPTY)"
To Reproduce Steps to reproduce the behavior:
This error occures when I try to change photo in a photoMessage already sent by a bot previously:
InputMediaPhoto inputMediaPhoto = new InputMediaPhoto();
inputMediaPhoto.setMedia("AgACAgIAAxkBAAIlaWOZGQvBn2uHvqfTwVYHGD-ezlU5AAJgxzEbSojJSMNUFLrahKyaAQADAgADeAADLAQ");
EditMessageMedia editMessageMedia = new EditMessageMedia();
editMessageMedia.setMedia(inputMediaPhoto);
editMessageMedia.setReplyMarkup(null);
editMessageMedia.setMessageId(messageId);
editMessageMedia.setChatId(chatId);
try {
telegramLongPollingBot.execute(editMessageMedia);
} catch (TelegramApiException e) {
log.warn("Error while editing media of a message! (bot-username: " +
telegramLongPollingBot.getBotUsername() + ", reason: " + e.getMessage() + ")") ;
}
Expected behavior Changes message's media (in my case - photo) to the one specified in inputMediaPhoto. Note: file_id is 100% correct.
Ok, the bug is that serMedia for some reason does not work properly with file_id of photos, uploaded to Telegram. #setMedia(String media) works properly only with a photo given by URL-string, however method description and API documentation says that specifying file_id is also permitted.
Hi, I had problem like this. Did you try get instance with constructor? I mean EditMessageMedia obj = new EditMessageMedia(arg1, agr2, . . .);
or with builder EditMessageMedia obj = EditMessageMedia.builder().build();