Поправил проблему с BoxAnswer
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Struchkov Mark 2023-03-22 10:41:55 +03:00
parent f485af1d22
commit 9a105cfc92
Signed by: upagge
GPG Key ID: D3018BE7BA428CA6

View File

@ -19,6 +19,8 @@ import java.util.function.Supplier;
import java.util.regex.Pattern;
import java.util.stream.Collectors;
import static dev.struchkov.godfather.quarkus.domain.BoxAnswer.boxAnswer;
/**
* Используется для отправки ответа пользователю.
*
@ -58,11 +60,7 @@ public class AnswerText<M extends Message> extends MainUnit<M> {
}
public static <M extends Message> AnswerText<M> of(String message) {
return AnswerText.<M>builder().answer(BoxAnswer.boxAnswer(message)).build();
}
public static <M extends Message> AnswerText<M> of(BoxAnswer boxAnswer) {
return AnswerText.<M>builder().answer(boxAnswer).build();
return AnswerText.<M>builder().answer(() -> boxAnswer(message)).build();
}
public static <M extends Message> Builder<M> builder() {
@ -123,11 +121,6 @@ public class AnswerText<M extends Message> extends MainUnit<M> {
return this;
}
public Builder<M> answer(BoxAnswer answer) {
this.boxAnswer = message -> Uni.createFrom().item(answer);
return this;
}
public Builder<M> answer(Supplier<BoxAnswer> answer) {
this.boxAnswer = message -> Uni.createFrom().item(answer.get());
return this;