release-0.0.5
This commit is contained in:
parent
08256dadc3
commit
89b2688e52
@ -6,7 +6,7 @@
|
||||
<parent>
|
||||
<groupId>dev.struchkov.godfather</groupId>
|
||||
<artifactId>godfather-bot</artifactId>
|
||||
<version>0.0.4</version>
|
||||
<version>0.0.5</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>bot-context</artifactId>
|
||||
|
@ -24,7 +24,7 @@ public class BoxAnswer {
|
||||
private boolean replace;
|
||||
|
||||
private BoxAnswer(Builder builder) {
|
||||
setMessage(builder.message);
|
||||
message = builder.message;
|
||||
keyBoard = builder.keyBoard;
|
||||
replace = builder.replace;
|
||||
}
|
||||
@ -33,7 +33,7 @@ public class BoxAnswer {
|
||||
return BoxAnswer.builder().message(message).build();
|
||||
}
|
||||
|
||||
public static <T extends Message> ProcessingData<T> processing(String messageText) {
|
||||
public static <T extends Message> ProcessingData<T> boxAnswer(String messageText) {
|
||||
return message -> of(messageText);
|
||||
}
|
||||
|
||||
|
@ -6,7 +6,7 @@
|
||||
<parent>
|
||||
<groupId>dev.struchkov.godfather</groupId>
|
||||
<artifactId>godfather-bot</artifactId>
|
||||
<version>0.0.4</version>
|
||||
<version>0.0.5</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>bot-core</artifactId>
|
||||
|
@ -58,6 +58,16 @@ public class AnswerProcessing<M extends Message> extends MainUnit {
|
||||
private Builder() {
|
||||
}
|
||||
|
||||
public Builder<M> processingData(ProcessingData<M> val) {
|
||||
processingData = val;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder<M> sending(Sending val) {
|
||||
sending = val;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder<M> keyWords(Set<String> val) {
|
||||
keyWords = val;
|
||||
return this;
|
||||
|
@ -8,9 +8,12 @@ import dev.struchkov.godfather.core.service.save.push.Pusher;
|
||||
import dev.struchkov.godfather.core.utils.TypeUnit;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import static dev.struchkov.haiti.utils.Inspector.isNotNull;
|
||||
|
||||
/**
|
||||
* Обработчик для сохранения ответов пользователя. Так же допускается скрытое сохранение.
|
||||
*
|
||||
@ -91,12 +94,12 @@ public class AnswerSave<D> extends MainUnit {
|
||||
}
|
||||
|
||||
public static final class Builder<D> {
|
||||
private Set<String> keyWords;
|
||||
private Set<String> keyWords = new HashSet<>();
|
||||
private String phrase;
|
||||
private Pattern pattern;
|
||||
private Integer matchThreshold;
|
||||
private Integer priority;
|
||||
private Set<MainUnit> nextUnits;
|
||||
private Set<MainUnit> nextUnits = new HashSet<>();
|
||||
private Preservable<D> preservable;
|
||||
private String key;
|
||||
private Pusher<D> pusher;
|
||||
@ -178,6 +181,9 @@ public class AnswerSave<D> extends MainUnit {
|
||||
}
|
||||
|
||||
public AnswerSave<D> build() {
|
||||
isNotNull(preservable, "Не указан репозиторий для сохранения формы пользователя");
|
||||
isNotNull(preservableData, "Не указаны данные для сохранения");
|
||||
isNotNull(key, "Не указан ключ для сохранения");
|
||||
return new AnswerSave<>(this);
|
||||
}
|
||||
|
||||
|
@ -38,20 +38,13 @@ public class AnswerText<M extends Message> extends MainUnit {
|
||||
|
||||
private AnswerText(Builder<M> builder) {
|
||||
super(builder.keyWords, builder.phrase, builder.pattern, builder.matchThreshold, builder.priority, builder.nextUnits, builder.activeType, TypeUnit.TEXT);
|
||||
keyWords = builder.keyWords;
|
||||
phrase = builder.phrase;
|
||||
pattern = builder.pattern;
|
||||
matchThreshold = builder.matchThreshold;
|
||||
priority = builder.priority;
|
||||
nextUnits = builder.nextUnits;
|
||||
boxAnswer = builder.boxAnswer;
|
||||
insert = builder.insert;
|
||||
sending = builder.sending;
|
||||
activeType = builder.activeType;
|
||||
}
|
||||
|
||||
public static <M extends Message> AnswerText<M> of(String message) {
|
||||
return AnswerText.<M>builder().boxAnswer(BoxAnswer.processing(message)).build();
|
||||
return AnswerText.<M>builder().boxAnswer(BoxAnswer.boxAnswer(message)).build();
|
||||
}
|
||||
|
||||
public static <M extends Message> Builder<M> builder() {
|
||||
@ -74,7 +67,7 @@ public class AnswerText<M extends Message> extends MainUnit {
|
||||
private ProcessingData<M> boxAnswer;
|
||||
private Insert insert;
|
||||
private Sending sending;
|
||||
private Set<String> keyWords;
|
||||
private Set<String> keyWords = new HashSet<>();
|
||||
private String phrase;
|
||||
private Pattern pattern;
|
||||
private Integer matchThreshold;
|
||||
|
@ -5,6 +5,7 @@ import dev.struchkov.godfather.core.service.save.LocalPreservable;
|
||||
import dev.struchkov.godfather.core.service.save.Preservable;
|
||||
import dev.struchkov.godfather.core.utils.TypeUnit;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
@ -76,7 +77,7 @@ public class AnswerValidity extends MainUnit {
|
||||
private Pattern pattern;
|
||||
private Integer matchThreshold;
|
||||
private Integer priority;
|
||||
private Set<MainUnit> nextUnits;
|
||||
private Set<MainUnit> nextUnits = new HashSet<>();
|
||||
|
||||
private Builder() {
|
||||
}
|
||||
|
@ -6,10 +6,7 @@ import dev.struchkov.godfather.core.domain.unit.AnswerText;
|
||||
import dev.struchkov.godfather.core.domain.unit.AnswerValidity;
|
||||
import dev.struchkov.godfather.core.domain.unit.MainUnit;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
/**
|
||||
* Обработчик Unit-а {@link AnswerValidity}.
|
||||
|
8
pom.xml
8
pom.xml
@ -6,7 +6,7 @@
|
||||
|
||||
<groupId>dev.struchkov.godfather</groupId>
|
||||
<artifactId>godfather-bot</artifactId>
|
||||
<version>0.0.4</version>
|
||||
<version>0.0.5</version>
|
||||
<packaging>pom</packaging>
|
||||
|
||||
<modules>
|
||||
@ -15,7 +15,7 @@
|
||||
</modules>
|
||||
|
||||
<name>GodFather Bot</name>
|
||||
<description>Абстрактная бииблиотека для помощи в реализации библиотек ботов для конкретных социальных сетей
|
||||
<description>Абстрактная библиотека для помощи в реализации библиотек ботов для конкретных социальных сетей
|
||||
</description>
|
||||
<url>https://github.com/Godfather-Bots/godfather</url>
|
||||
<licenses>
|
||||
@ -32,12 +32,12 @@
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
|
||||
|
||||
<godfather.ver>0.0.4</godfather.ver>
|
||||
<godfather.ver>0.0.5</godfather.ver>
|
||||
|
||||
<godfather.context.ver>${godfather.ver}</godfather.context.ver>
|
||||
<godfather.core.ver>${godfather.ver}</godfather.core.ver>
|
||||
|
||||
<autoresponder.ver>2.0.0</autoresponder.ver>
|
||||
<autoresponder.ver>2.0.1</autoresponder.ver>
|
||||
<haiti.utils>1.0.2</haiti.utils>
|
||||
|
||||
<javax.persistence.api.ver>2.2</javax.persistence.api.ver>
|
||||
|
Loading…
Reference in New Issue
Block a user