Удалил лишний метод в отправке
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Struchkov Mark 2023-04-02 14:39:12 +03:00
parent 6414f92904
commit 476a97001c
Signed by: upagge
GPG Key ID: D3018BE7BA428CA6
3 changed files with 6 additions and 12 deletions

View File

@ -87,11 +87,6 @@ public class TelegramSender implements TelegramSending {
return Uni.createFrom().voidItem(); return Uni.createFrom().voidItem();
} }
@Override
public Uni<SentBox> replaceMessage(@NotNull String personId, @NotNull String messageId, @NotNull BoxAnswer newAnswer) {
return replace(personId, messageId, newAnswer, true);
}
@Override @Override
public Uni<SentBox> sendNotSave(@NotNull BoxAnswer boxAnswer) { public Uni<SentBox> sendNotSave(@NotNull BoxAnswer boxAnswer) {
return sendBoxAnswer(boxAnswer, false); return sendBoxAnswer(boxAnswer, false);
@ -222,6 +217,7 @@ public class TelegramSender implements TelegramSending {
final Message lastMessage = answerMessages.get(answerMessages.size() - 1); final Message lastMessage = answerMessages.get(answerMessages.size() - 1);
final SentBox sentBox = new SentBox(); final SentBox sentBox = new SentBox();
sentBox.setPersonId(telegramId);
sentBox.setMessageId(lastMessage.getMessageId().toString()); sentBox.setMessageId(lastMessage.getMessageId().toString());
sentBox.setOriginalAnswer(boxAnswer); sentBox.setOriginalAnswer(boxAnswer);
sentBox.setSentAnswer(boxAnswer); sentBox.setSentAnswer(boxAnswer);

View File

@ -85,11 +85,6 @@ public class TelegramSender implements TelegramSending {
} }
} }
@Override
public Optional<SentBox> replaceMessage(@NotNull String personId, @NotNull String messageId, @NotNull BoxAnswer newAnswer) {
return replace(personId, messageId, newAnswer, newAnswer, true);
}
@Override @Override
public Optional<SentBox> send(@NotNull BoxAnswer boxAnswer) { public Optional<SentBox> send(@NotNull BoxAnswer boxAnswer) {
isNotNull(boxAnswer.getRecipientPersonId()); isNotNull(boxAnswer.getRecipientPersonId());

View File

@ -39,12 +39,15 @@ public class WebhookController {
@Produces(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON)
public Uni<Response> updateReceived(@PathParam("webhookPath") String botPath, @HeaderParam("X-Telegram-Bot-Api-Secret-Token") String secretTokenFromTelegram, Update update) { public Uni<Response> updateReceived(@PathParam("webhookPath") String botPath, @HeaderParam("X-Telegram-Bot-Api-Secret-Token") String secretTokenFromTelegram, Update update) {
return Uni.createFrom().voidItem() return Uni.createFrom().voidItem()
.invoke(() -> log.trace("Получено webhook событие"))
.invoke(() -> { .invoke(() -> {
log.trace("Получено webhook событие");
isTrue(pathKey.equals(botPath), accessException(ERROR_ACCESS)); isTrue(pathKey.equals(botPath), accessException(ERROR_ACCESS));
isTrue(secretToken.equals(secretTokenFromTelegram), 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 событие успешно обработано")) .invoke(() -> log.trace("Webhook событие успешно обработано"))
.replaceWith(Response.ok().build()); .replaceWith(Response.ok().build());
} }