Добавил новые модули domain
This commit is contained in:
parent
89d7796402
commit
3b9ebf28c6
@ -18,7 +18,11 @@
|
|||||||
<dependencies>
|
<dependencies>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>dev.struchkov.godfather</groupId>
|
<groupId>dev.struchkov.godfather</groupId>
|
||||||
<artifactId>bot-domain-main</artifactId>
|
<artifactId>bot-domain-quarkus</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>dev.struchkov.godfather</groupId>
|
||||||
|
<artifactId>bot-context-main</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
package dev.struchkov.godfather.quarkus.context.service;
|
package dev.struchkov.godfather.quarkus.context.service;
|
||||||
|
|
||||||
import dev.struchkov.godfather.main.domain.BoxAnswer;
|
|
||||||
import dev.struchkov.godfather.main.domain.SendType;
|
import dev.struchkov.godfather.main.domain.SendType;
|
||||||
import dev.struchkov.godfather.main.domain.SentBox;
|
import dev.struchkov.godfather.quarkus.domain.BoxAnswer;
|
||||||
|
import dev.struchkov.godfather.quarkus.domain.SentBox;
|
||||||
import io.smallrye.mutiny.Uni;
|
import io.smallrye.mutiny.Uni;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
|
@ -1,7 +1,8 @@
|
|||||||
package dev.struchkov.godfather.quarkus.context.service;
|
package dev.struchkov.godfather.quarkus.context.service;
|
||||||
|
|
||||||
import dev.struchkov.godfather.main.domain.BoxAnswer;
|
import dev.struchkov.godfather.quarkus.domain.BoxAnswer;
|
||||||
import dev.struchkov.godfather.main.domain.SentBox;
|
import dev.struchkov.godfather.quarkus.domain.SentBox;
|
||||||
|
import dev.struchkov.godfather.quarkus.domain.action.PreSendProcessing;
|
||||||
import io.smallrye.mutiny.Uni;
|
import io.smallrye.mutiny.Uni;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
|
@ -18,7 +18,7 @@
|
|||||||
<dependencies>
|
<dependencies>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>dev.struchkov.godfather</groupId>
|
<groupId>dev.struchkov.godfather</groupId>
|
||||||
<artifactId>bot-domain-main</artifactId>
|
<artifactId>bot-domain-simple</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
package dev.struchkov.godfather.simple.context.service;
|
package dev.struchkov.godfather.simple.context.service;
|
||||||
|
|
||||||
import dev.struchkov.godfather.main.domain.BoxAnswer;
|
|
||||||
import dev.struchkov.godfather.main.domain.SendType;
|
import dev.struchkov.godfather.main.domain.SendType;
|
||||||
import dev.struchkov.godfather.main.domain.SentBox;
|
import dev.struchkov.godfather.simple.domain.BoxAnswer;
|
||||||
|
import dev.struchkov.godfather.simple.domain.SentBox;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
|
@ -1,7 +1,8 @@
|
|||||||
package dev.struchkov.godfather.simple.context.service;
|
package dev.struchkov.godfather.simple.context.service;
|
||||||
|
|
||||||
import dev.struchkov.godfather.main.domain.BoxAnswer;
|
import dev.struchkov.godfather.simple.domain.BoxAnswer;
|
||||||
import dev.struchkov.godfather.main.domain.SentBox;
|
import dev.struchkov.godfather.simple.domain.SentBox;
|
||||||
|
import dev.struchkov.godfather.simple.domain.action.PreSendProcessing;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
package dev.struchkov.godfather.quarkus.core.action;
|
package dev.struchkov.godfather.quarkus.core.action;
|
||||||
|
|
||||||
import dev.struchkov.godfather.main.domain.BoxAnswer;
|
|
||||||
import dev.struchkov.godfather.main.domain.content.Message;
|
import dev.struchkov.godfather.main.domain.content.Message;
|
||||||
import dev.struchkov.godfather.quarkus.context.service.Sending;
|
import dev.struchkov.godfather.quarkus.context.service.Sending;
|
||||||
import dev.struchkov.godfather.quarkus.core.unit.AnswerCheck;
|
import dev.struchkov.godfather.quarkus.core.unit.AnswerCheck;
|
||||||
import dev.struchkov.godfather.quarkus.core.unit.MainUnit;
|
import dev.struchkov.godfather.quarkus.core.unit.MainUnit;
|
||||||
import dev.struchkov.godfather.quarkus.core.unit.UnitRequest;
|
import dev.struchkov.godfather.quarkus.core.unit.UnitRequest;
|
||||||
|
import dev.struchkov.godfather.quarkus.domain.BoxAnswer;
|
||||||
import io.smallrye.mutiny.Uni;
|
import io.smallrye.mutiny.Uni;
|
||||||
|
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
@ -58,4 +58,5 @@ public class AnswerCheckAction<M extends Message> implements ActionUnit<AnswerCh
|
|||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -3,10 +3,10 @@ package dev.struchkov.godfather.quarkus.core.unit;
|
|||||||
import dev.struchkov.autoresponder.entity.KeyWord;
|
import dev.struchkov.autoresponder.entity.KeyWord;
|
||||||
import dev.struchkov.godfather.main.core.unit.TypeUnit;
|
import dev.struchkov.godfather.main.core.unit.TypeUnit;
|
||||||
import dev.struchkov.godfather.main.core.unit.UnitActiveType;
|
import dev.struchkov.godfather.main.core.unit.UnitActiveType;
|
||||||
import dev.struchkov.godfather.main.domain.BoxAnswer;
|
|
||||||
import dev.struchkov.godfather.main.domain.content.Message;
|
import dev.struchkov.godfather.main.domain.content.Message;
|
||||||
import dev.struchkov.godfather.quarkus.context.service.Accessibility;
|
import dev.struchkov.godfather.quarkus.context.service.Accessibility;
|
||||||
import dev.struchkov.godfather.quarkus.core.unit.func.CheckData;
|
import dev.struchkov.godfather.quarkus.core.unit.func.CheckData;
|
||||||
|
import dev.struchkov.godfather.quarkus.domain.BoxAnswer;
|
||||||
|
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
@ -95,6 +95,7 @@ public class AnswerCheck<M extends Message> extends MainUnit<M> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static final class Builder<M extends Message> {
|
public static final class Builder<M extends Message> {
|
||||||
|
|
||||||
private String name = UUID.randomUUID().toString();
|
private String name = UUID.randomUUID().toString();
|
||||||
private String description;
|
private String description;
|
||||||
|
|
||||||
|
@ -3,11 +3,11 @@ package dev.struchkov.godfather.quarkus.core.unit;
|
|||||||
import dev.struchkov.autoresponder.entity.KeyWord;
|
import dev.struchkov.autoresponder.entity.KeyWord;
|
||||||
import dev.struchkov.godfather.main.core.unit.TypeUnit;
|
import dev.struchkov.godfather.main.core.unit.TypeUnit;
|
||||||
import dev.struchkov.godfather.main.core.unit.UnitActiveType;
|
import dev.struchkov.godfather.main.core.unit.UnitActiveType;
|
||||||
import dev.struchkov.godfather.main.domain.BoxAnswer;
|
|
||||||
import dev.struchkov.godfather.main.domain.content.Message;
|
import dev.struchkov.godfather.main.domain.content.Message;
|
||||||
import dev.struchkov.godfather.quarkus.context.service.Accessibility;
|
import dev.struchkov.godfather.quarkus.context.service.Accessibility;
|
||||||
import dev.struchkov.godfather.quarkus.core.unit.func.CallBackConsumer;
|
import dev.struchkov.godfather.quarkus.core.unit.func.CallBackConsumer;
|
||||||
import dev.struchkov.godfather.quarkus.core.unit.func.ProcessingData;
|
import dev.struchkov.godfather.quarkus.core.unit.func.ProcessingData;
|
||||||
|
import dev.struchkov.godfather.quarkus.domain.BoxAnswer;
|
||||||
import io.smallrye.mutiny.Uni;
|
import io.smallrye.mutiny.Uni;
|
||||||
|
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
@ -242,4 +242,5 @@ public class AnswerText<M extends Message> extends MainUnit<M> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
package dev.struchkov.godfather.quarkus.core.unit.func;
|
package dev.struchkov.godfather.quarkus.core.unit.func;
|
||||||
|
|
||||||
import dev.struchkov.godfather.main.domain.SentBox;
|
import dev.struchkov.godfather.quarkus.domain.SentBox;
|
||||||
import io.smallrye.mutiny.Uni;
|
import io.smallrye.mutiny.Uni;
|
||||||
|
|
||||||
@FunctionalInterface
|
@FunctionalInterface
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
package dev.struchkov.godfather.quarkus.core.unit.func;
|
package dev.struchkov.godfather.quarkus.core.unit.func;
|
||||||
|
|
||||||
import dev.struchkov.godfather.main.domain.BoxAnswer;
|
import dev.struchkov.godfather.quarkus.domain.BoxAnswer;
|
||||||
import io.smallrye.mutiny.Uni;
|
import io.smallrye.mutiny.Uni;
|
||||||
|
|
||||||
@FunctionalInterface
|
@FunctionalInterface
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
package dev.struchkov.godfather.simple.core.action;
|
package dev.struchkov.godfather.simple.core.action;
|
||||||
|
|
||||||
import dev.struchkov.godfather.main.domain.BoxAnswer;
|
|
||||||
import dev.struchkov.godfather.main.domain.content.Message;
|
import dev.struchkov.godfather.main.domain.content.Message;
|
||||||
import dev.struchkov.godfather.simple.context.service.Sending;
|
import dev.struchkov.godfather.simple.context.service.Sending;
|
||||||
import dev.struchkov.godfather.simple.core.unit.AnswerCheck;
|
import dev.struchkov.godfather.simple.core.unit.AnswerCheck;
|
||||||
import dev.struchkov.godfather.simple.core.unit.MainUnit;
|
import dev.struchkov.godfather.simple.core.unit.MainUnit;
|
||||||
import dev.struchkov.godfather.simple.core.unit.UnitRequest;
|
import dev.struchkov.godfather.simple.core.unit.UnitRequest;
|
||||||
|
import dev.struchkov.godfather.simple.domain.BoxAnswer;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
|
@ -1,7 +1,5 @@
|
|||||||
package dev.struchkov.godfather.simple.core.action;
|
package dev.struchkov.godfather.simple.core.action;
|
||||||
|
|
||||||
import dev.struchkov.godfather.main.domain.BoxAnswer;
|
|
||||||
import dev.struchkov.godfather.main.domain.SentBox;
|
|
||||||
import dev.struchkov.godfather.main.domain.content.Message;
|
import dev.struchkov.godfather.main.domain.content.Message;
|
||||||
import dev.struchkov.godfather.simple.context.service.Sending;
|
import dev.struchkov.godfather.simple.context.service.Sending;
|
||||||
import dev.struchkov.godfather.simple.core.unit.AnswerText;
|
import dev.struchkov.godfather.simple.core.unit.AnswerText;
|
||||||
@ -9,6 +7,8 @@ import dev.struchkov.godfather.simple.core.unit.MainUnit;
|
|||||||
import dev.struchkov.godfather.simple.core.unit.UnitRequest;
|
import dev.struchkov.godfather.simple.core.unit.UnitRequest;
|
||||||
import dev.struchkov.godfather.simple.core.unit.func.CallBackConsumer;
|
import dev.struchkov.godfather.simple.core.unit.func.CallBackConsumer;
|
||||||
import dev.struchkov.godfather.simple.core.unit.func.ProcessingData;
|
import dev.struchkov.godfather.simple.core.unit.func.ProcessingData;
|
||||||
|
import dev.struchkov.godfather.simple.domain.BoxAnswer;
|
||||||
|
import dev.struchkov.godfather.simple.domain.SentBox;
|
||||||
|
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
|
|
||||||
|
@ -1,12 +1,13 @@
|
|||||||
package dev.struchkov.godfather.simple.core.pusher;
|
package dev.struchkov.godfather.simple.core.pusher;
|
||||||
|
|
||||||
import dev.struchkov.godfather.main.domain.BoxAnswer;
|
|
||||||
import dev.struchkov.godfather.simple.context.service.Pusher;
|
import dev.struchkov.godfather.simple.context.service.Pusher;
|
||||||
import dev.struchkov.godfather.simple.context.service.Sending;
|
import dev.struchkov.godfather.simple.context.service.Sending;
|
||||||
|
import dev.struchkov.godfather.simple.domain.BoxAnswer;
|
||||||
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import static dev.struchkov.godfather.main.domain.BoxAnswer.boxAnswer;
|
import static dev.struchkov.godfather.simple.domain.BoxAnswer.boxAnswer;
|
||||||
|
|
||||||
|
|
||||||
public class UserSanderPusher implements Pusher<String> {
|
public class UserSanderPusher implements Pusher<String> {
|
||||||
|
|
||||||
|
@ -3,10 +3,10 @@ package dev.struchkov.godfather.simple.core.unit;
|
|||||||
import dev.struchkov.autoresponder.entity.KeyWord;
|
import dev.struchkov.autoresponder.entity.KeyWord;
|
||||||
import dev.struchkov.godfather.main.core.unit.TypeUnit;
|
import dev.struchkov.godfather.main.core.unit.TypeUnit;
|
||||||
import dev.struchkov.godfather.main.core.unit.UnitActiveType;
|
import dev.struchkov.godfather.main.core.unit.UnitActiveType;
|
||||||
import dev.struchkov.godfather.main.domain.BoxAnswer;
|
|
||||||
import dev.struchkov.godfather.main.domain.content.Message;
|
import dev.struchkov.godfather.main.domain.content.Message;
|
||||||
import dev.struchkov.godfather.simple.context.service.Accessibility;
|
import dev.struchkov.godfather.simple.context.service.Accessibility;
|
||||||
import dev.struchkov.godfather.simple.core.unit.func.CheckData;
|
import dev.struchkov.godfather.simple.core.unit.func.CheckData;
|
||||||
|
import dev.struchkov.godfather.simple.domain.BoxAnswer;
|
||||||
|
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
@ -95,6 +95,7 @@ public class AnswerCheck<M extends Message> extends MainUnit<M> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static final class Builder<M extends Message> {
|
public static final class Builder<M extends Message> {
|
||||||
|
|
||||||
private String name = UUID.randomUUID().toString();
|
private String name = UUID.randomUUID().toString();
|
||||||
private String description;
|
private String description;
|
||||||
|
|
||||||
|
@ -3,11 +3,11 @@ package dev.struchkov.godfather.simple.core.unit;
|
|||||||
import dev.struchkov.autoresponder.entity.KeyWord;
|
import dev.struchkov.autoresponder.entity.KeyWord;
|
||||||
import dev.struchkov.godfather.main.core.unit.TypeUnit;
|
import dev.struchkov.godfather.main.core.unit.TypeUnit;
|
||||||
import dev.struchkov.godfather.main.core.unit.UnitActiveType;
|
import dev.struchkov.godfather.main.core.unit.UnitActiveType;
|
||||||
import dev.struchkov.godfather.main.domain.BoxAnswer;
|
|
||||||
import dev.struchkov.godfather.main.domain.content.Message;
|
import dev.struchkov.godfather.main.domain.content.Message;
|
||||||
import dev.struchkov.godfather.simple.context.service.Accessibility;
|
import dev.struchkov.godfather.simple.context.service.Accessibility;
|
||||||
import dev.struchkov.godfather.simple.core.unit.func.CallBackConsumer;
|
import dev.struchkov.godfather.simple.core.unit.func.CallBackConsumer;
|
||||||
import dev.struchkov.godfather.simple.core.unit.func.ProcessingData;
|
import dev.struchkov.godfather.simple.core.unit.func.ProcessingData;
|
||||||
|
import dev.struchkov.godfather.simple.domain.BoxAnswer;
|
||||||
|
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package dev.struchkov.godfather.simple.core.unit.func;
|
package dev.struchkov.godfather.simple.core.unit.func;
|
||||||
|
|
||||||
import dev.struchkov.godfather.main.domain.SentBox;
|
|
||||||
|
import dev.struchkov.godfather.simple.domain.SentBox;
|
||||||
|
|
||||||
@FunctionalInterface
|
@FunctionalInterface
|
||||||
public interface CallBackConsumer {
|
public interface CallBackConsumer {
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package dev.struchkov.godfather.simple.core.unit.func;
|
package dev.struchkov.godfather.simple.core.unit.func;
|
||||||
|
|
||||||
import dev.struchkov.godfather.main.domain.BoxAnswer;
|
|
||||||
|
import dev.struchkov.godfather.simple.domain.BoxAnswer;
|
||||||
|
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
|
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
<parent>
|
<parent>
|
||||||
<artifactId>bot-domain</artifactId>
|
<artifactId>bot-domain</artifactId>
|
||||||
<groupId>dev.struchkov.godfather</groupId>
|
<groupId>dev.struchkov.godfather</groupId>
|
||||||
<version>0.0.51-SNAPSHOT</version>
|
<version>0.0.51-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
|
||||||
|
|
||||||
<artifactId>bot-domain-main</artifactId>
|
<artifactId>bot-domain-main</artifactId>
|
||||||
|
|
||||||
|
32
bot-domain/bot-domain-quarkus/pom.xml
Normal file
32
bot-domain/bot-domain-quarkus/pom.xml
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||||
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
<parent>
|
||||||
|
<groupId>dev.struchkov.godfather</groupId>
|
||||||
|
<artifactId>bot-domain</artifactId>
|
||||||
|
<version>0.0.51-SNAPSHOT</version>
|
||||||
|
</parent>
|
||||||
|
|
||||||
|
<artifactId>bot-domain-quarkus</artifactId>
|
||||||
|
|
||||||
|
<properties>
|
||||||
|
<maven.compiler.source>17</maven.compiler.source>
|
||||||
|
<maven.compiler.target>17</maven.compiler.target>
|
||||||
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
|
</properties>
|
||||||
|
|
||||||
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>dev.struchkov.godfather</groupId>
|
||||||
|
<artifactId>bot-domain-main</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>io.smallrye.reactive</groupId>
|
||||||
|
<artifactId>smallrye-mutiny-vertx-core</artifactId>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
|
||||||
|
</project>
|
@ -0,0 +1,209 @@
|
|||||||
|
package dev.struchkov.godfather.quarkus.domain;
|
||||||
|
|
||||||
|
|
||||||
|
import dev.struchkov.godfather.main.domain.ContextKey;
|
||||||
|
import dev.struchkov.godfather.main.domain.keyboard.KeyBoard;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Optional;
|
||||||
|
|
||||||
|
import static dev.struchkov.haiti.utils.Checker.checkNotNull;
|
||||||
|
import static dev.struchkov.haiti.utils.Checker.checkNull;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Контейнер, которые содержит данные, которые будут отправлены пользователю как ответ на его запрос.
|
||||||
|
*
|
||||||
|
* @author upagge [08/07/2019]
|
||||||
|
*/
|
||||||
|
public class BoxAnswer {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>Получатель сообщения</p>
|
||||||
|
*/
|
||||||
|
private String recipientPersonId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Идентификатор сообщения, которое нужно заменить.
|
||||||
|
*/
|
||||||
|
private final String replaceMessageId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Клавиатура - меню.
|
||||||
|
*/
|
||||||
|
private final KeyBoard keyBoard;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Флаг означающий, что надо перезаписать наше последнее отправленное сообщение, вместо отправки нового.
|
||||||
|
*/
|
||||||
|
private final boolean replace;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Обычное текстовое сообщение.
|
||||||
|
*/
|
||||||
|
private String message;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Полезная нагрузка для реализаций.
|
||||||
|
*/
|
||||||
|
protected Map<ContextKey, Object> payload;
|
||||||
|
|
||||||
|
private BoxAnswer(Builder builder) {
|
||||||
|
message = builder.message;
|
||||||
|
keyBoard = builder.keyBoard;
|
||||||
|
replace = builder.replace;
|
||||||
|
replaceMessageId = builder.replaceMessageId;
|
||||||
|
recipientPersonId = builder.recipientPersonId;
|
||||||
|
payload = builder.payload;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static BoxAnswer boxAnswer(boolean replace, String message) {
|
||||||
|
return BoxAnswer.builder().replace(replace).message(message).build();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static BoxAnswer boxAnswer(boolean replace, String messageText, KeyBoard keyBoard) {
|
||||||
|
return BoxAnswer.builder().replace(replace).message(messageText).keyBoard(keyBoard).build();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static BoxAnswer boxAnswer(String message) {
|
||||||
|
return boxAnswer(false, message);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static BoxAnswer boxAnswer(String message, KeyBoard keyBoard) {
|
||||||
|
return boxAnswer(false, message, keyBoard);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static BoxAnswer replaceBoxAnswer(String message) {
|
||||||
|
return boxAnswer(true, message);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static BoxAnswer replaceBoxAnswer(String message, KeyBoard keyBoard) {
|
||||||
|
return boxAnswer(true, message, keyBoard);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static BoxAnswer replaceBoxAnswer(String messageId, String message) {
|
||||||
|
return BoxAnswer.builder().replace(true).replaceMessageId(messageId).message(message).build();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static BoxAnswer replaceBoxAnswer(String messageId, String message, KeyBoard keyBoard) {
|
||||||
|
return BoxAnswer.builder().replace(true).replaceMessageId(messageId).message(message).keyBoard(keyBoard).build();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Builder builder() {
|
||||||
|
return new Builder();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Builder replaceBuilder() {
|
||||||
|
return new Builder().replace(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getMessage() {
|
||||||
|
return message;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMessage(String message) {
|
||||||
|
this.message = message;
|
||||||
|
}
|
||||||
|
|
||||||
|
public KeyBoard getKeyBoard() {
|
||||||
|
return keyBoard;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isReplace() {
|
||||||
|
return replace;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getReplaceMessageId() {
|
||||||
|
return replaceMessageId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getRecipientPersonId() {
|
||||||
|
return recipientPersonId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRecipientPersonId(String recipientPersonId) {
|
||||||
|
this.recipientPersonId = recipientPersonId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRecipientIfNull(String recipientPersonId) {
|
||||||
|
if (checkNull(this.recipientPersonId)) {
|
||||||
|
this.recipientPersonId = recipientPersonId;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public Map<ContextKey, Object> getPayload() {
|
||||||
|
return payload;
|
||||||
|
}
|
||||||
|
|
||||||
|
public <T> void setPayload(ContextKey<T> key, T value) {
|
||||||
|
if (checkNotNull(value)) {
|
||||||
|
payload.put(key, value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public <T> Optional<T> getPayLoad(ContextKey<T> contextKey) {
|
||||||
|
return Optional.ofNullable(payload.get(contextKey))
|
||||||
|
.map(value -> (T) value);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return "BoxAnswer{" +
|
||||||
|
"message='" + message + '\'' +
|
||||||
|
", keyBoard=" + keyBoard +
|
||||||
|
", replace=" + replace +
|
||||||
|
'}';
|
||||||
|
}
|
||||||
|
|
||||||
|
public static final class Builder {
|
||||||
|
|
||||||
|
private String message;
|
||||||
|
private KeyBoard keyBoard;
|
||||||
|
private boolean replace;
|
||||||
|
private String replaceMessageId;
|
||||||
|
private String recipientPersonId;
|
||||||
|
private Map<ContextKey, Object> payload = new HashMap<>();
|
||||||
|
|
||||||
|
private Builder() {
|
||||||
|
}
|
||||||
|
|
||||||
|
public Builder message(String val) {
|
||||||
|
message = val;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Builder keyBoard(KeyBoard val) {
|
||||||
|
keyBoard = val;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Builder replace(boolean val) {
|
||||||
|
replace = val;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Builder recipientPersonId(String val) {
|
||||||
|
recipientPersonId = val;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Builder replaceMessageId(String val) {
|
||||||
|
replaceMessageId = val;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public <T> Builder payload(ContextKey<T> key, T value) {
|
||||||
|
if (checkNotNull(value)) {
|
||||||
|
payload.put(key, value);
|
||||||
|
}
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public BoxAnswer build() {
|
||||||
|
return new BoxAnswer(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,39 @@
|
|||||||
|
package dev.struchkov.godfather.quarkus.domain;
|
||||||
|
|
||||||
|
import java.util.Optional;
|
||||||
|
|
||||||
|
public class SentBox {
|
||||||
|
|
||||||
|
private String personId;
|
||||||
|
private String messageId;
|
||||||
|
private BoxAnswer sentAnswer;
|
||||||
|
private BoxAnswer originalAnswer;
|
||||||
|
|
||||||
|
public SentBox(String personId, String messageId, BoxAnswer sentAnswer, BoxAnswer originalAnswer) {
|
||||||
|
this.personId = personId;
|
||||||
|
this.messageId = messageId;
|
||||||
|
this.sentAnswer = sentAnswer;
|
||||||
|
this.originalAnswer = originalAnswer;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Optional<SentBox> optional(String personId, String messageId, BoxAnswer sentAnswer, BoxAnswer originalAnswer) {
|
||||||
|
return Optional.of(new SentBox(personId, messageId, sentAnswer, originalAnswer));
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getPersonId() {
|
||||||
|
return personId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getMessageId() {
|
||||||
|
return messageId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public BoxAnswer getSentAnswer() {
|
||||||
|
return sentAnswer;
|
||||||
|
}
|
||||||
|
|
||||||
|
public BoxAnswer getOriginalAnswer() {
|
||||||
|
return originalAnswer;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -1,6 +1,6 @@
|
|||||||
package dev.struchkov.godfather.quarkus.context.service;
|
package dev.struchkov.godfather.quarkus.domain.action;
|
||||||
|
|
||||||
import dev.struchkov.godfather.main.domain.BoxAnswer;
|
import dev.struchkov.godfather.quarkus.domain.BoxAnswer;
|
||||||
import io.smallrye.mutiny.Uni;
|
import io.smallrye.mutiny.Uni;
|
||||||
|
|
||||||
@FunctionalInterface
|
@FunctionalInterface
|
27
bot-domain/bot-domain-simple/pom.xml
Normal file
27
bot-domain/bot-domain-simple/pom.xml
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||||
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
<parent>
|
||||||
|
<groupId>dev.struchkov.godfather</groupId>
|
||||||
|
<artifactId>bot-domain</artifactId>
|
||||||
|
<version>0.0.51-SNAPSHOT</version>
|
||||||
|
</parent>
|
||||||
|
|
||||||
|
<artifactId>bot-domain-simple</artifactId>
|
||||||
|
|
||||||
|
<properties>
|
||||||
|
<maven.compiler.source>17</maven.compiler.source>
|
||||||
|
<maven.compiler.target>17</maven.compiler.target>
|
||||||
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
|
</properties>
|
||||||
|
|
||||||
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>dev.struchkov.godfather</groupId>
|
||||||
|
<artifactId>bot-domain-main</artifactId>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
|
||||||
|
</project>
|
@ -1,5 +1,6 @@
|
|||||||
package dev.struchkov.godfather.main.domain;
|
package dev.struchkov.godfather.simple.domain;
|
||||||
|
|
||||||
|
import dev.struchkov.godfather.main.domain.ContextKey;
|
||||||
import dev.struchkov.godfather.main.domain.keyboard.KeyBoard;
|
import dev.struchkov.godfather.main.domain.keyboard.KeyBoard;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
@ -16,6 +17,16 @@ import static dev.struchkov.haiti.utils.Checker.checkNull;
|
|||||||
*/
|
*/
|
||||||
public class BoxAnswer {
|
public class BoxAnswer {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>Получатель сообщения</p>
|
||||||
|
*/
|
||||||
|
private String recipientPersonId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Идентификатор сообщения, которое нужно заменить.
|
||||||
|
*/
|
||||||
|
private final String replaceMessageId;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Клавиатура - меню.
|
* Клавиатура - меню.
|
||||||
*/
|
*/
|
||||||
@ -26,18 +37,14 @@ public class BoxAnswer {
|
|||||||
*/
|
*/
|
||||||
private final boolean replace;
|
private final boolean replace;
|
||||||
|
|
||||||
private final String replaceMessageId;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Обычное текстовое сообщение.
|
* Обычное текстовое сообщение.
|
||||||
*/
|
*/
|
||||||
private String message;
|
private String message;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>Получатель сообщения</p>
|
* Полезная нагрузка для реализаций.
|
||||||
*/
|
*/
|
||||||
private String recipientPersonId;
|
|
||||||
|
|
||||||
protected Map<ContextKey, Object> payload;
|
protected Map<ContextKey, Object> payload;
|
||||||
|
|
||||||
private BoxAnswer(Builder builder) {
|
private BoxAnswer(Builder builder) {
|
@ -1,4 +1,4 @@
|
|||||||
package dev.struchkov.godfather.main.domain;
|
package dev.struchkov.godfather.simple.domain;
|
||||||
|
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
|
|
@ -1,6 +1,6 @@
|
|||||||
package dev.struchkov.godfather.simple.context.service;
|
package dev.struchkov.godfather.simple.domain.action;
|
||||||
|
|
||||||
import dev.struchkov.godfather.main.domain.BoxAnswer;
|
import dev.struchkov.godfather.simple.domain.BoxAnswer;
|
||||||
|
|
||||||
@FunctionalInterface
|
@FunctionalInterface
|
||||||
public interface PreSendProcessing {
|
public interface PreSendProcessing {
|
@ -11,6 +11,8 @@
|
|||||||
<packaging>pom</packaging>
|
<packaging>pom</packaging>
|
||||||
<modules>
|
<modules>
|
||||||
<module>bot-domain-main</module>
|
<module>bot-domain-main</module>
|
||||||
|
<module>bot-domain-quarkus</module>
|
||||||
|
<module>bot-domain-simple</module>
|
||||||
</modules>
|
</modules>
|
||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
|
13
pom.xml
13
pom.xml
@ -1,5 +1,6 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
<groupId>dev.struchkov.godfather</groupId>
|
<groupId>dev.struchkov.godfather</groupId>
|
||||||
@ -64,6 +65,16 @@
|
|||||||
<artifactId>bot-domain-main</artifactId>
|
<artifactId>bot-domain-main</artifactId>
|
||||||
<version>${project.version}</version>
|
<version>${project.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>dev.struchkov.godfather</groupId>
|
||||||
|
<artifactId>bot-domain-quarkus</artifactId>
|
||||||
|
<version>${project.version}</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>dev.struchkov.godfather</groupId>
|
||||||
|
<artifactId>bot-domain-simple</artifactId>
|
||||||
|
<version>${project.version}</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>dev.struchkov.godfather</groupId>
|
<groupId>dev.struchkov.godfather</groupId>
|
||||||
|
Loading…
Reference in New Issue
Block a user