release-0.0.2
This commit is contained in:
parent
579ff95b4b
commit
b8681b433a
17
.gitlab-ci.yml
Normal file
17
.gitlab-ci.yml
Normal file
@ -0,0 +1,17 @@
|
||||
image: maven:3.8.4-openjdk-17
|
||||
variables:
|
||||
MAVEN_OPTS: "-Dmaven.repo.local=./.m2/repository"
|
||||
|
||||
stages:
|
||||
- deploy
|
||||
|
||||
deploy:
|
||||
stage: deploy
|
||||
only:
|
||||
- /^release-.*$/
|
||||
except:
|
||||
- branches
|
||||
before_script:
|
||||
- gpg --pinentry-mode loopback --passphrase $GPG_PASSPHRASE --import $GPG_PRIVATE_KEY
|
||||
script:
|
||||
- 'mvn --settings $MAVEN_SETTINGS -U -P ossrh,release clean deploy'
|
@ -6,7 +6,7 @@
|
||||
<parent>
|
||||
<groupId>dev.struchkov.godfather</groupId>
|
||||
<artifactId>godfather-bot</artifactId>
|
||||
<version>0.0.1-RELEASE</version>
|
||||
<version>0.0.2</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>bot-context</artifactId>
|
||||
@ -15,13 +15,10 @@
|
||||
|
||||
<name>Bot Context</name>
|
||||
<description>Доменные сущности, интерфейсы, для библиотеки Godfather</description>
|
||||
<url>https://github.com/Godfather-Bots/godfather</url>
|
||||
<licenses>
|
||||
<license>
|
||||
<name>BSD 3-Clause "New" or "Revised" License</name>
|
||||
<url>https://github.com/Godfather-Bots/godfather/blob/master/LICENSE</url>
|
||||
</license>
|
||||
</licenses>
|
||||
|
||||
<properties>
|
||||
<skip.deploy>false</skip.deploy>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
@ -55,25 +52,15 @@
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.sonatype.plugins</groupId>
|
||||
<artifactId>nexus-staging-maven-plugin</artifactId>
|
||||
<configuration>
|
||||
<source>17</source>
|
||||
<target>17</target>
|
||||
<skipNexusStagingDeployMojo>${skip.deploy}</skipNexusStagingDeployMojo>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
<scm>
|
||||
<connection>scm:git:https://github.com/Godfather-Bots/godfather.git</connection>
|
||||
<url>https://github.com/Godfather-Bots/godfathere</url>
|
||||
<developerConnection>scm:git:https://github.com/Godfather-Bots/godfather.git</developerConnection>
|
||||
</scm>
|
||||
|
||||
<distributionManagement>
|
||||
<snapshotRepository>
|
||||
<id>ossrh</id>
|
||||
<url>https://s01.oss.sonatype.org/content/repositories/snapshots</url>
|
||||
</snapshotRepository>
|
||||
</distributionManagement>
|
||||
|
||||
</project>
|
@ -1,7 +1,9 @@
|
||||
package dev.struchkov.godfather.context.domain;
|
||||
|
||||
import dev.struchkov.godfather.context.domain.content.Message;
|
||||
import dev.struchkov.godfather.context.domain.content.attachment.GeoCoordinate;
|
||||
import dev.struchkov.godfather.context.domain.keyboard.KeyBoard;
|
||||
import dev.struchkov.godfather.context.service.usercode.ProcessingData;
|
||||
import dev.struchkov.godfather.context.utils.Description;
|
||||
import lombok.Builder;
|
||||
import lombok.EqualsAndHashCode;
|
||||
@ -37,4 +39,8 @@ public class BoxAnswer {
|
||||
return BoxAnswer.builder().message(message).build();
|
||||
}
|
||||
|
||||
public static <T extends Message> ProcessingData<T> processing(String messageText) {
|
||||
return (message) -> builder().message(messageText).build();
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -8,6 +8,7 @@ package dev.struchkov.godfather.context.domain.content.attachment;
|
||||
public enum AttachmentType {
|
||||
|
||||
AUDIO_MESSAGE,
|
||||
GEO
|
||||
GEO,
|
||||
LINK
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,19 @@
|
||||
package dev.struchkov.godfather.context.domain.content.attachment;
|
||||
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import lombok.ToString;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString
|
||||
public class Link extends Attachment {
|
||||
private String url;
|
||||
|
||||
public Link() {
|
||||
this.type = AttachmentType.LINK;
|
||||
}
|
||||
|
||||
}
|
@ -1,4 +1,4 @@
|
||||
package dev.struchkov.godfather.core.service.usercode;
|
||||
package dev.struchkov.godfather.context.service.usercode;
|
||||
|
||||
import dev.struchkov.godfather.context.domain.content.Message;
|
||||
|
@ -1,4 +1,4 @@
|
||||
package dev.struchkov.godfather.core.service.usercode;
|
||||
package dev.struchkov.godfather.context.service.usercode;
|
||||
|
||||
import java.util.List;
|
||||
|
@ -1,4 +1,4 @@
|
||||
package dev.struchkov.godfather.core.service.usercode;
|
||||
package dev.struchkov.godfather.context.service.usercode;
|
||||
|
||||
import dev.struchkov.godfather.context.domain.BoxAnswer;
|
||||
import dev.struchkov.godfather.context.domain.content.Message;
|
@ -6,7 +6,7 @@
|
||||
<parent>
|
||||
<groupId>dev.struchkov.godfather</groupId>
|
||||
<artifactId>godfather-bot</artifactId>
|
||||
<version>0.0.1-RELEASE</version>
|
||||
<version>0.0.2</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>bot-core</artifactId>
|
||||
@ -15,13 +15,10 @@
|
||||
|
||||
<name>Bot Core</name>
|
||||
<description>Реализация основной логики для создания ботов без привязки к конкретным социальным сетям.</description>
|
||||
<url>https://github.com/Godfather-Bots/godfather</url>
|
||||
<licenses>
|
||||
<license>
|
||||
<name>BSD 3-Clause "New" or "Revised" License</name>
|
||||
<url>https://github.com/Godfather-Bots/godfather/blob/master/LICENSE</url>
|
||||
</license>
|
||||
</licenses>
|
||||
|
||||
<properties>
|
||||
<skip.deploy>false</skip.deploy>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
@ -45,34 +42,15 @@
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.sonatype.plugins</groupId>
|
||||
<artifactId>nexus-staging-maven-plugin</artifactId>
|
||||
<configuration>
|
||||
<source>17</source>
|
||||
<target>17</target>
|
||||
<skipNexusStagingDeployMojo>${skip.deploy}</skipNexusStagingDeployMojo>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
<scm>
|
||||
<connection>scm:git:https://github.com/Godfather-Bots/godfather.git</connection>
|
||||
<url>https://github.com/Godfather-Bots/godfathere</url>
|
||||
<developerConnection>scm:git:https://github.com/Godfather-Bots/godfather.git</developerConnection>
|
||||
</scm>
|
||||
|
||||
<distributionManagement>
|
||||
<snapshotRepository>
|
||||
<id>ossrh</id>
|
||||
<url>https://s01.oss.sonatype.org/content/repositories/snapshots</url>
|
||||
</snapshotRepository>
|
||||
</distributionManagement>
|
||||
|
||||
<developers>
|
||||
<developer>
|
||||
<id>uPagge</id>
|
||||
<name>Struchkov Mark</name>
|
||||
<email>upagge@mail.ru</email>
|
||||
<organization>SADTECH</organization>
|
||||
</developer>
|
||||
</developers>
|
||||
|
||||
</project>
|
@ -134,11 +134,11 @@ public class GeneralAutoResponder<T extends Message> extends TimerTask {
|
||||
if (actionUnitMap.containsKey(unitAnswer.getType())) {
|
||||
ActionUnit actionUnit = actionUnitMap.get(unitAnswer.getType());
|
||||
MainUnit mainUnit = actionUnit.action(unitAnswer, event);
|
||||
if (!unitAnswer.equals(mainUnit)) return getAction(event, mainUnit);
|
||||
return mainUnit;
|
||||
}
|
||||
return !unitAnswer.equals(mainUnit) ? getAction(event, mainUnit) : mainUnit;
|
||||
} else {
|
||||
throw new NotFoundException("ActionUnit для типа " + unitAnswer.getType() + " не зарегистрирован");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
|
@ -2,7 +2,7 @@ package dev.struchkov.godfather.core.domain;
|
||||
|
||||
import dev.struchkov.godfather.context.utils.Description;
|
||||
import dev.struchkov.godfather.core.domain.unit.MainUnit;
|
||||
import dev.struchkov.godfather.core.service.usercode.CheckData;
|
||||
import dev.struchkov.godfather.context.service.usercode.CheckData;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
|
||||
|
@ -2,7 +2,7 @@ package dev.struchkov.godfather.core.domain.unit;
|
||||
|
||||
import dev.struchkov.godfather.context.domain.content.Message;
|
||||
import dev.struchkov.godfather.context.utils.Description;
|
||||
import dev.struchkov.godfather.core.service.usercode.CheckData;
|
||||
import dev.struchkov.godfather.context.service.usercode.CheckData;
|
||||
import dev.struchkov.godfather.core.utils.TypeUnit;
|
||||
import lombok.Builder;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
@ -3,7 +3,7 @@ package dev.struchkov.godfather.core.domain.unit;
|
||||
import dev.struchkov.godfather.context.domain.content.Message;
|
||||
import dev.struchkov.godfather.context.service.sender.Sending;
|
||||
import dev.struchkov.godfather.context.utils.Description;
|
||||
import dev.struchkov.godfather.core.service.usercode.ProcessingData;
|
||||
import dev.struchkov.godfather.context.service.usercode.ProcessingData;
|
||||
import dev.struchkov.godfather.core.utils.TypeUnit;
|
||||
import lombok.Builder;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
@ -1,9 +1,11 @@
|
||||
package dev.struchkov.godfather.core.domain.unit;
|
||||
|
||||
import dev.struchkov.godfather.context.domain.BoxAnswer;
|
||||
import dev.struchkov.godfather.context.domain.content.Message;
|
||||
import dev.struchkov.godfather.context.service.sender.Sending;
|
||||
import dev.struchkov.godfather.context.utils.Description;
|
||||
import dev.struchkov.godfather.core.service.usercode.Insert;
|
||||
import dev.struchkov.godfather.context.service.usercode.Insert;
|
||||
import dev.struchkov.godfather.context.service.usercode.ProcessingData;
|
||||
import dev.struchkov.godfather.core.utils.TypeUnit;
|
||||
import lombok.Builder;
|
||||
import lombok.EqualsAndHashCode;
|
||||
@ -20,10 +22,10 @@ import java.util.regex.Pattern;
|
||||
*/
|
||||
@Getter
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class AnswerText extends MainUnit {
|
||||
public class AnswerText<M extends Message> extends MainUnit {
|
||||
|
||||
@Description("Объект, который необходимо отправить пользователю")
|
||||
private final BoxAnswer boxAnswer;
|
||||
private final ProcessingData<M> boxAnswer;
|
||||
|
||||
@Description("Информация, которую необходимо вставить вместо маркеров в строку ответа")
|
||||
private final Insert insert;
|
||||
@ -39,7 +41,7 @@ public class AnswerText extends MainUnit {
|
||||
Integer priority,
|
||||
@Singular Set<MainUnit> nextUnits,
|
||||
UnitActiveType activeType,
|
||||
BoxAnswer boxAnswer,
|
||||
ProcessingData<M> boxAnswer,
|
||||
Insert insert,
|
||||
Sending sending) {
|
||||
super(keyWords, phrase, pattern, matchThreshold, priority, nextUnits, activeType, TypeUnit.TEXT);
|
||||
@ -49,7 +51,7 @@ public class AnswerText extends MainUnit {
|
||||
}
|
||||
|
||||
public static AnswerText of(String message) {
|
||||
return AnswerText.builder().boxAnswer(BoxAnswer.of(message)).build();
|
||||
return builder().boxAnswer(BoxAnswer.processing(message)).build();
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
package dev.struchkov.godfather.core.domain.unit;
|
||||
|
||||
import dev.struchkov.godfather.context.utils.Description;
|
||||
import dev.struchkov.godfather.core.service.usercode.CheckData;
|
||||
import dev.struchkov.godfather.context.service.usercode.CheckData;
|
||||
import dev.struchkov.godfather.core.utils.TypeUnit;
|
||||
import lombok.Builder;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
@ -3,7 +3,7 @@ package dev.struchkov.godfather.core.domain.unit;
|
||||
import dev.struchkov.godfather.context.utils.Description;
|
||||
import dev.struchkov.godfather.core.service.save.LocalPreservable;
|
||||
import dev.struchkov.godfather.core.service.save.Preservable;
|
||||
import dev.struchkov.godfather.core.service.usercode.ClarificationQuestion;
|
||||
import dev.struchkov.godfather.core.service.ClarificationQuestion;
|
||||
import dev.struchkov.godfather.core.utils.TypeUnit;
|
||||
import lombok.Builder;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
@ -1,4 +1,4 @@
|
||||
package dev.struchkov.godfather.core.service.usercode;
|
||||
package dev.struchkov.godfather.core.service;
|
||||
|
||||
import dev.struchkov.godfather.context.domain.content.Message;
|
||||
import dev.struchkov.godfather.core.domain.Clarification;
|
@ -56,7 +56,7 @@ public class AnswerAccountAction implements ActionUnit<AnswerAccount, Mail> {
|
||||
.keyBoard(KeyBoards.singelton(buttonAccount))
|
||||
.build();
|
||||
|
||||
return AnswerText.builder().boxAnswer(boxAnswer).build();
|
||||
return AnswerText.builder().boxAnswer(message -> boxAnswer).build();
|
||||
}
|
||||
|
||||
private void settingCheckTimer(AnswerAccount answerAccount, Mail mail, Integer accountId) {
|
||||
|
@ -25,7 +25,7 @@ public class AnswerTextAction implements ActionUnit<AnswerText, Message> {
|
||||
|
||||
@Override
|
||||
public MainUnit action(AnswerText answerText, Message message) {
|
||||
BoxAnswer boxAnswer = answerText.getBoxAnswer().toBuilder().build();
|
||||
BoxAnswer boxAnswer = answerText.getBoxAnswer().processing(message);
|
||||
if (answerText.getInsert() != null) {
|
||||
List<String> words = answerText.getInsert().insert(message.getPersonId());
|
||||
String newMessage = InsertWords.insert(boxAnswer.getMessage(), words);
|
||||
|
@ -43,7 +43,7 @@ public class AnswerValidityAction implements ActionUnit<AnswerValidity, Message>
|
||||
.clearKeyWords().keyWords(WORDS_YES_NO)
|
||||
.build();
|
||||
return AnswerText.builder()
|
||||
.boxAnswer(clarification.getQuestion())
|
||||
.boxAnswer(mes -> clarification.getQuestion())
|
||||
.nextUnit(newValidity)
|
||||
.build();
|
||||
}
|
||||
|
@ -4,7 +4,7 @@ import dev.struchkov.godfather.context.domain.content.Message;
|
||||
import dev.struchkov.godfather.context.utils.MessageUtils;
|
||||
import dev.struchkov.godfather.core.GeneralAutoResponder;
|
||||
import dev.struchkov.godfather.core.domain.Timer;
|
||||
import dev.struchkov.godfather.core.service.usercode.CheckData;
|
||||
import dev.struchkov.godfather.context.service.usercode.CheckData;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
import java.time.Clock;
|
||||
|
@ -65,7 +65,7 @@ public class QuestionUtils {
|
||||
.keyBoard(KeyBoards.verticalDuoMenuString(collectAnswer)).build();
|
||||
|
||||
AnswerText.AnswerTextBuilder answerTextBuilder = AnswerText.builder()
|
||||
.boxAnswer(boxAnswer);
|
||||
.boxAnswer(message -> boxAnswer);
|
||||
|
||||
for (QuestionAnswer questionAnswer : question.getQuestionAnswers()) {
|
||||
AnswerSave.AnswerSaveBuilder answerSaveBuilder = AnswerSave.<QuestionResult>builder()
|
||||
|
92
pom.xml
92
pom.xml
@ -6,12 +6,13 @@
|
||||
|
||||
<groupId>dev.struchkov.godfather</groupId>
|
||||
<artifactId>godfather-bot</artifactId>
|
||||
<version>0.0.1-RELEASE</version>
|
||||
<version>0.0.2</version>
|
||||
<packaging>pom</packaging>
|
||||
|
||||
<modules>
|
||||
<module>bot-context</module>
|
||||
<module>bot-core</module>
|
||||
</modules>
|
||||
<packaging>pom</packaging>
|
||||
|
||||
<name>GodFather Bot</name>
|
||||
<description>Абстрактная бииблиотека для помощи в реализации библиотек ботов для конкретных социальных сетей</description>
|
||||
@ -24,17 +25,20 @@
|
||||
</licenses>
|
||||
|
||||
<properties>
|
||||
<maven.compiler.source>17</maven.compiler.source>
|
||||
<maven.compiler.target>17</maven.compiler.target>
|
||||
<java.version>17</java.version>
|
||||
<maven.compiler.source>${java.version}</maven.compiler.source>
|
||||
<maven.compiler.target>${java.version}</maven.compiler.target>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
|
||||
|
||||
<godfather.context.ver>0.0.1-RELEASE</godfather.context.ver>
|
||||
<godfather.core.ver>0.0.1-RELEASE</godfather.core.ver>
|
||||
<godfather.context.ver>0.0.2</godfather.context.ver>
|
||||
<godfather.core.ver>0.0.2</godfather.core.ver>
|
||||
<autoresponder.ver>1.9.4-RELEASE</autoresponder.ver>
|
||||
|
||||
<gson.ver>2.8.9</gson.ver>
|
||||
<mail.ver>1.6.2</mail.ver>
|
||||
<lombok.ver>1.18.22</lombok.ver>
|
||||
<spring.data.jpa.ver>2.3.0.RELEASE</spring.data.jpa.ver>
|
||||
<spring.data.jpa.ver>2.6.1</spring.data.jpa.ver>
|
||||
<javax.persistence.api.ver>2.2</javax.persistence.api.ver>
|
||||
<validation.api.ver>2.0.1.Final</validation.api.ver>
|
||||
<commons.io.ver>2.11.0</commons.io.ver>
|
||||
@ -98,32 +102,6 @@
|
||||
</dependencies>
|
||||
</dependencyManagement>
|
||||
|
||||
<profiles>
|
||||
<profile>
|
||||
<id>release</id>
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.sonatype.plugins</groupId>
|
||||
<artifactId>nexus-staging-maven-plugin</artifactId>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-source-plugin</artifactId>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-gpg-plugin</artifactId>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-javadoc-plugin</artifactId>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</profile>
|
||||
</profiles>
|
||||
|
||||
<build>
|
||||
<pluginManagement>
|
||||
<plugins>
|
||||
@ -137,13 +115,6 @@
|
||||
<nexusUrl>https://s01.oss.sonatype.org/</nexusUrl>
|
||||
<autoReleaseAfterClose>true</autoReleaseAfterClose>
|
||||
</configuration>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>com.thoughtworks.xstream</groupId>
|
||||
<artifactId>xstream</artifactId>
|
||||
<version>${xstream.ver}</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
@ -184,11 +155,14 @@
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>${plugin.maven.compiler.ver}</version>
|
||||
<configuration>
|
||||
<gpgArguments>
|
||||
<gpgArgument>--pinentry-mode</gpgArgument>
|
||||
<gpgArgument>loopback</gpgArgument>
|
||||
</gpgArguments>
|
||||
<source>${java.version}</source>
|
||||
<target>${java.version}</target>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
@ -198,14 +172,36 @@
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<configuration>
|
||||
<source>17</source>
|
||||
<target>17</target>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
<profiles>
|
||||
<profile>
|
||||
<id>release</id>
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.sonatype.plugins</groupId>
|
||||
<artifactId>nexus-staging-maven-plugin</artifactId>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-source-plugin</artifactId>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-gpg-plugin</artifactId>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-javadoc-plugin</artifactId>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</profile>
|
||||
</profiles>
|
||||
|
||||
<scm>
|
||||
<connection>scm:git:https://github.com/Godfather-Bots/godfather.git</connection>
|
||||
<url>https://github.com/Godfather-Bots/godfathere</url>
|
||||
|
Loading…
Reference in New Issue
Block a user