Исправления в TelegramSender
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Struchkov Mark 2023-03-27 20:43:24 +03:00
parent efe3e042e2
commit 317fd066c9
Signed by: upagge
GPG Key ID: D3018BE7BA428CA6
2 changed files with 11 additions and 2 deletions

View File

@ -170,10 +170,14 @@ public class TelegramSender implements TelegramSending {
final EditMessageText editMessageText = new EditMessageText();
editMessageText.setChatId(telegramId);
editMessageText.setMessageId(Integer.parseInt(lastMessageId));
editMessageText.enableMarkdown(true);
editMessageText.setText(boxAnswer.getMessage());
editMessageText.setReplyMarkup(convertInlineKeyBoard((InlineKeyBoard) boxAnswer.getKeyBoard()));
boxAnswer.getPayLoad(ENABLE_MARKDOWN).ifPresent(editMessageText::enableMarkdown);
boxAnswer.getPayLoad(DISABLE_WEB_PAGE_PREVIEW).ifPresent(isDisable -> {
if (TRUE.equals(isDisable)) editMessageText.disableWebPagePreview();
});
return Uni.createFrom().completionStage(executeAsync(editMessageText))
.onItem().ifNotNull().transformToUni(t -> Uni.createFrom().optional(SentBox.optional(telegramId, lastMessageId, boxAnswer, boxAnswer)))
.onFailure(TelegramApiRequestException.class).recoverWithUni(

View File

@ -96,9 +96,14 @@ public class TelegramSender implements TelegramSending {
public void replaceInlineMessage(String inlineMessageId, BoxAnswer boxAnswer) {
final EditMessageText editMessageText = new EditMessageText();
editMessageText.setInlineMessageId(inlineMessageId);
editMessageText.enableMarkdown(true);
editMessageText.setText(boxAnswer.getMessage());
editMessageText.setReplyMarkup(convertInlineKeyBoard((InlineKeyBoard) boxAnswer.getKeyBoard()));
boxAnswer.getPayLoad(ENABLE_MARKDOWN).ifPresent(editMessageText::enableMarkdown);
boxAnswer.getPayLoad(DISABLE_WEB_PAGE_PREVIEW).ifPresent(isDisable -> {
if (TRUE.equals(isDisable)) editMessageText.disableWebPagePreview();
});
try {
absSender.execute(editMessageText);
} catch (TelegramApiRequestException e) {