diff --git a/telegram-sender/telegram-sender-quarkus/src/main/java/dev/struchkov/godfather/telegram/quarkus/sender/TelegramSender.java b/telegram-sender/telegram-sender-quarkus/src/main/java/dev/struchkov/godfather/telegram/quarkus/sender/TelegramSender.java index 315134a..eeda8b6 100644 --- a/telegram-sender/telegram-sender-quarkus/src/main/java/dev/struchkov/godfather/telegram/quarkus/sender/TelegramSender.java +++ b/telegram-sender/telegram-sender-quarkus/src/main/java/dev/struchkov/godfather/telegram/quarkus/sender/TelegramSender.java @@ -87,11 +87,6 @@ public class TelegramSender implements TelegramSending { return Uni.createFrom().voidItem(); } - @Override - public Uni replaceMessage(@NotNull String personId, @NotNull String messageId, @NotNull BoxAnswer newAnswer) { - return replace(personId, messageId, newAnswer, true); - } - @Override public Uni sendNotSave(@NotNull BoxAnswer boxAnswer) { return sendBoxAnswer(boxAnswer, false); @@ -222,6 +217,7 @@ public class TelegramSender implements TelegramSending { final Message lastMessage = answerMessages.get(answerMessages.size() - 1); final SentBox sentBox = new SentBox(); + sentBox.setPersonId(telegramId); sentBox.setMessageId(lastMessage.getMessageId().toString()); sentBox.setOriginalAnswer(boxAnswer); sentBox.setSentAnswer(boxAnswer); diff --git a/telegram-sender/telegram-sender-simple/src/main/java/dev/struchkov/godfather/telegram/simple/sender/TelegramSender.java b/telegram-sender/telegram-sender-simple/src/main/java/dev/struchkov/godfather/telegram/simple/sender/TelegramSender.java index 6714a85..2a10828 100644 --- a/telegram-sender/telegram-sender-simple/src/main/java/dev/struchkov/godfather/telegram/simple/sender/TelegramSender.java +++ b/telegram-sender/telegram-sender-simple/src/main/java/dev/struchkov/godfather/telegram/simple/sender/TelegramSender.java @@ -85,11 +85,6 @@ public class TelegramSender implements TelegramSending { } } - @Override - public Optional replaceMessage(@NotNull String personId, @NotNull String messageId, @NotNull BoxAnswer newAnswer) { - return replace(personId, messageId, newAnswer, newAnswer, true); - } - @Override public Optional send(@NotNull BoxAnswer boxAnswer) { isNotNull(boxAnswer.getRecipientPersonId()); diff --git a/telegram-webhook/telegram-webhook-quarkus/src/main/java/dev/struchkov/godfather/telegram/webhook/WebhookController.java b/telegram-webhook/telegram-webhook-quarkus/src/main/java/dev/struchkov/godfather/telegram/webhook/WebhookController.java index f1d48fc..a62869f 100644 --- a/telegram-webhook/telegram-webhook-quarkus/src/main/java/dev/struchkov/godfather/telegram/webhook/WebhookController.java +++ b/telegram-webhook/telegram-webhook-quarkus/src/main/java/dev/struchkov/godfather/telegram/webhook/WebhookController.java @@ -39,12 +39,15 @@ public class WebhookController { @Produces(MediaType.APPLICATION_JSON) public Uni updateReceived(@PathParam("webhookPath") String botPath, @HeaderParam("X-Telegram-Bot-Api-Secret-Token") String secretTokenFromTelegram, Update update) { return Uni.createFrom().voidItem() - .invoke(() -> log.trace("Получено webhook событие")) .invoke(() -> { + log.trace("Получено webhook событие"); isTrue(pathKey.equals(botPath), accessException(ERROR_ACCESS)); isTrue(secretToken.equals(secretTokenFromTelegram), accessException(ERROR_ACCESS)); }) - .onItem().ignore().andSwitchTo(() -> eventDistributor.processing(update)) + .onItem().ignore().andSwitchTo( + () -> eventDistributor.processing(update) + .onFailure().recoverWithNull() + ) .invoke(() -> log.trace("Webhook событие успешно обработано")) .replaceWith(Response.ok().build()); }