diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
new file mode 100644
index 0000000..249d706
--- /dev/null
+++ b/.gitlab-ci.yml
@@ -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'
\ No newline at end of file
diff --git a/bot-context/pom.xml b/bot-context/pom.xml
index 8b84588..526502d 100644
--- a/bot-context/pom.xml
+++ b/bot-context/pom.xml
@@ -6,7 +6,7 @@
dev.struchkov.godfather
godfather-bot
- 0.0.1-RELEASE
+ 0.0.2
bot-context
@@ -15,13 +15,10 @@
Bot Context
Доменные сущности, интерфейсы, для библиотеки Godfather
- https://github.com/Godfather-Bots/godfather
-
-
- BSD 3-Clause "New" or "Revised" License
- https://github.com/Godfather-Bots/godfather/blob/master/LICENSE
-
-
+
+
+ false
+
@@ -55,25 +52,15 @@
org.apache.maven.plugins
maven-compiler-plugin
+
+
+ org.sonatype.plugins
+ nexus-staging-maven-plugin
-
- 17
+ ${skip.deploy}
-
- scm:git:https://github.com/Godfather-Bots/godfather.git
- https://github.com/Godfather-Bots/godfathere
- scm:git:https://github.com/Godfather-Bots/godfather.git
-
-
-
-
- ossrh
- https://s01.oss.sonatype.org/content/repositories/snapshots
-
-
-
\ No newline at end of file
diff --git a/bot-context/src/main/java/dev/struchkov/godfather/context/domain/BoxAnswer.java b/bot-context/src/main/java/dev/struchkov/godfather/context/domain/BoxAnswer.java
index 3baddef..9adf30d 100644
--- a/bot-context/src/main/java/dev/struchkov/godfather/context/domain/BoxAnswer.java
+++ b/bot-context/src/main/java/dev/struchkov/godfather/context/domain/BoxAnswer.java
@@ -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 ProcessingData processing(String messageText) {
+ return (message) -> builder().message(messageText).build();
+ }
+
}
diff --git a/bot-context/src/main/java/dev/struchkov/godfather/context/domain/content/attachment/AttachmentType.java b/bot-context/src/main/java/dev/struchkov/godfather/context/domain/content/attachment/AttachmentType.java
index 35e20f2..696f5f4 100644
--- a/bot-context/src/main/java/dev/struchkov/godfather/context/domain/content/attachment/AttachmentType.java
+++ b/bot-context/src/main/java/dev/struchkov/godfather/context/domain/content/attachment/AttachmentType.java
@@ -8,6 +8,7 @@ package dev.struchkov.godfather.context.domain.content.attachment;
public enum AttachmentType {
AUDIO_MESSAGE,
- GEO
+ GEO,
+ LINK
}
diff --git a/bot-context/src/main/java/dev/struchkov/godfather/context/domain/content/attachment/Link.java b/bot-context/src/main/java/dev/struchkov/godfather/context/domain/content/attachment/Link.java
new file mode 100644
index 0000000..8acf6e9
--- /dev/null
+++ b/bot-context/src/main/java/dev/struchkov/godfather/context/domain/content/attachment/Link.java
@@ -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;
+ }
+
+}
diff --git a/bot-core/src/main/java/dev/struchkov/godfather/core/service/usercode/CheckData.java b/bot-context/src/main/java/dev/struchkov/godfather/context/service/usercode/CheckData.java
similarity index 74%
rename from bot-core/src/main/java/dev/struchkov/godfather/core/service/usercode/CheckData.java
rename to bot-context/src/main/java/dev/struchkov/godfather/context/service/usercode/CheckData.java
index 969c27c..f153164 100644
--- a/bot-core/src/main/java/dev/struchkov/godfather/core/service/usercode/CheckData.java
+++ b/bot-context/src/main/java/dev/struchkov/godfather/context/service/usercode/CheckData.java
@@ -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;
diff --git a/bot-core/src/main/java/dev/struchkov/godfather/core/service/usercode/Insert.java b/bot-context/src/main/java/dev/struchkov/godfather/context/service/usercode/Insert.java
similarity index 66%
rename from bot-core/src/main/java/dev/struchkov/godfather/core/service/usercode/Insert.java
rename to bot-context/src/main/java/dev/struchkov/godfather/context/service/usercode/Insert.java
index 87ce0c0..6d4e3f2 100644
--- a/bot-core/src/main/java/dev/struchkov/godfather/core/service/usercode/Insert.java
+++ b/bot-context/src/main/java/dev/struchkov/godfather/context/service/usercode/Insert.java
@@ -1,4 +1,4 @@
-package dev.struchkov.godfather.core.service.usercode;
+package dev.struchkov.godfather.context.service.usercode;
import java.util.List;
diff --git a/bot-core/src/main/java/dev/struchkov/godfather/core/service/usercode/ProcessingData.java b/bot-context/src/main/java/dev/struchkov/godfather/context/service/usercode/ProcessingData.java
similarity index 80%
rename from bot-core/src/main/java/dev/struchkov/godfather/core/service/usercode/ProcessingData.java
rename to bot-context/src/main/java/dev/struchkov/godfather/context/service/usercode/ProcessingData.java
index 5fe70b6..fda5b84 100644
--- a/bot-core/src/main/java/dev/struchkov/godfather/core/service/usercode/ProcessingData.java
+++ b/bot-context/src/main/java/dev/struchkov/godfather/context/service/usercode/ProcessingData.java
@@ -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;
diff --git a/bot-core/pom.xml b/bot-core/pom.xml
index 63023ef..0057aa4 100644
--- a/bot-core/pom.xml
+++ b/bot-core/pom.xml
@@ -6,7 +6,7 @@
dev.struchkov.godfather
godfather-bot
- 0.0.1-RELEASE
+ 0.0.2
bot-core
@@ -15,13 +15,10 @@
Bot Core
Реализация основной логики для создания ботов без привязки к конкретным социальным сетям.
- https://github.com/Godfather-Bots/godfather
-
-
- BSD 3-Clause "New" or "Revised" License
- https://github.com/Godfather-Bots/godfather/blob/master/LICENSE
-
-
+
+
+ false
+
@@ -45,34 +42,15 @@
org.apache.maven.plugins
maven-compiler-plugin
+
+
+ org.sonatype.plugins
+ nexus-staging-maven-plugin
-
- 17
+ ${skip.deploy}
-
- scm:git:https://github.com/Godfather-Bots/godfather.git
- https://github.com/Godfather-Bots/godfathere
- scm:git:https://github.com/Godfather-Bots/godfather.git
-
-
-
-
- ossrh
- https://s01.oss.sonatype.org/content/repositories/snapshots
-
-
-
-
-
- uPagge
- Struchkov Mark
- upagge@mail.ru
- SADTECH
-
-
-
\ No newline at end of file
diff --git a/bot-core/src/main/java/dev/struchkov/godfather/core/GeneralAutoResponder.java b/bot-core/src/main/java/dev/struchkov/godfather/core/GeneralAutoResponder.java
index b53555d..d629839 100644
--- a/bot-core/src/main/java/dev/struchkov/godfather/core/GeneralAutoResponder.java
+++ b/bot-core/src/main/java/dev/struchkov/godfather/core/GeneralAutoResponder.java
@@ -134,10 +134,10 @@ public class GeneralAutoResponder 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() + " не зарегистрирован");
}
- throw new NotFoundException("ActionUnit для типа " + unitAnswer.getType() + " не зарегистрирован");
}
@Override
diff --git a/bot-core/src/main/java/dev/struchkov/godfather/core/domain/Timer.java b/bot-core/src/main/java/dev/struchkov/godfather/core/domain/Timer.java
index 2599b98..562b683 100644
--- a/bot-core/src/main/java/dev/struchkov/godfather/core/domain/Timer.java
+++ b/bot-core/src/main/java/dev/struchkov/godfather/core/domain/Timer.java
@@ -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;
diff --git a/bot-core/src/main/java/dev/struchkov/godfather/core/domain/unit/AnswerCheck.java b/bot-core/src/main/java/dev/struchkov/godfather/core/domain/unit/AnswerCheck.java
index c555550..4be832a 100644
--- a/bot-core/src/main/java/dev/struchkov/godfather/core/domain/unit/AnswerCheck.java
+++ b/bot-core/src/main/java/dev/struchkov/godfather/core/domain/unit/AnswerCheck.java
@@ -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;
diff --git a/bot-core/src/main/java/dev/struchkov/godfather/core/domain/unit/AnswerProcessing.java b/bot-core/src/main/java/dev/struchkov/godfather/core/domain/unit/AnswerProcessing.java
index 1b5f4cf..ee1d151 100644
--- a/bot-core/src/main/java/dev/struchkov/godfather/core/domain/unit/AnswerProcessing.java
+++ b/bot-core/src/main/java/dev/struchkov/godfather/core/domain/unit/AnswerProcessing.java
@@ -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;
diff --git a/bot-core/src/main/java/dev/struchkov/godfather/core/domain/unit/AnswerText.java b/bot-core/src/main/java/dev/struchkov/godfather/core/domain/unit/AnswerText.java
index 6e5e76f..f2e186a 100644
--- a/bot-core/src/main/java/dev/struchkov/godfather/core/domain/unit/AnswerText.java
+++ b/bot-core/src/main/java/dev/struchkov/godfather/core/domain/unit/AnswerText.java
@@ -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 extends MainUnit {
@Description("Объект, который необходимо отправить пользователю")
- private final BoxAnswer boxAnswer;
+ private final ProcessingData boxAnswer;
@Description("Информация, которую необходимо вставить вместо маркеров в строку ответа")
private final Insert insert;
@@ -39,7 +41,7 @@ public class AnswerText extends MainUnit {
Integer priority,
@Singular Set nextUnits,
UnitActiveType activeType,
- BoxAnswer boxAnswer,
+ ProcessingData 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();
}
}
diff --git a/bot-core/src/main/java/dev/struchkov/godfather/core/domain/unit/AnswerTimer.java b/bot-core/src/main/java/dev/struchkov/godfather/core/domain/unit/AnswerTimer.java
index 29abe01..9e176e3 100644
--- a/bot-core/src/main/java/dev/struchkov/godfather/core/domain/unit/AnswerTimer.java
+++ b/bot-core/src/main/java/dev/struchkov/godfather/core/domain/unit/AnswerTimer.java
@@ -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;
diff --git a/bot-core/src/main/java/dev/struchkov/godfather/core/domain/unit/AnswerValidity.java b/bot-core/src/main/java/dev/struchkov/godfather/core/domain/unit/AnswerValidity.java
index de0b6b8..0d98697 100644
--- a/bot-core/src/main/java/dev/struchkov/godfather/core/domain/unit/AnswerValidity.java
+++ b/bot-core/src/main/java/dev/struchkov/godfather/core/domain/unit/AnswerValidity.java
@@ -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;
diff --git a/bot-core/src/main/java/dev/struchkov/godfather/core/service/usercode/ClarificationQuestion.java b/bot-core/src/main/java/dev/struchkov/godfather/core/service/ClarificationQuestion.java
similarity index 82%
rename from bot-core/src/main/java/dev/struchkov/godfather/core/service/usercode/ClarificationQuestion.java
rename to bot-core/src/main/java/dev/struchkov/godfather/core/service/ClarificationQuestion.java
index ead7fad..6ab7122 100644
--- a/bot-core/src/main/java/dev/struchkov/godfather/core/service/usercode/ClarificationQuestion.java
+++ b/bot-core/src/main/java/dev/struchkov/godfather/core/service/ClarificationQuestion.java
@@ -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;
diff --git a/bot-core/src/main/java/dev/struchkov/godfather/core/service/action/AnswerAccountAction.java b/bot-core/src/main/java/dev/struchkov/godfather/core/service/action/AnswerAccountAction.java
index ec35fe7..19bccc2 100644
--- a/bot-core/src/main/java/dev/struchkov/godfather/core/service/action/AnswerAccountAction.java
+++ b/bot-core/src/main/java/dev/struchkov/godfather/core/service/action/AnswerAccountAction.java
@@ -56,7 +56,7 @@ public class AnswerAccountAction implements ActionUnit {
.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) {
diff --git a/bot-core/src/main/java/dev/struchkov/godfather/core/service/action/AnswerTextAction.java b/bot-core/src/main/java/dev/struchkov/godfather/core/service/action/AnswerTextAction.java
index 520d0f7..c0d3d0b 100644
--- a/bot-core/src/main/java/dev/struchkov/godfather/core/service/action/AnswerTextAction.java
+++ b/bot-core/src/main/java/dev/struchkov/godfather/core/service/action/AnswerTextAction.java
@@ -25,7 +25,7 @@ public class AnswerTextAction implements ActionUnit {
@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 words = answerText.getInsert().insert(message.getPersonId());
String newMessage = InsertWords.insert(boxAnswer.getMessage(), words);
diff --git a/bot-core/src/main/java/dev/struchkov/godfather/core/service/action/AnswerValidityAction.java b/bot-core/src/main/java/dev/struchkov/godfather/core/service/action/AnswerValidityAction.java
index f858391..d07b20a 100644
--- a/bot-core/src/main/java/dev/struchkov/godfather/core/service/action/AnswerValidityAction.java
+++ b/bot-core/src/main/java/dev/struchkov/godfather/core/service/action/AnswerValidityAction.java
@@ -43,7 +43,7 @@ public class AnswerValidityAction implements ActionUnit
.clearKeyWords().keyWords(WORDS_YES_NO)
.build();
return AnswerText.builder()
- .boxAnswer(clarification.getQuestion())
+ .boxAnswer(mes -> clarification.getQuestion())
.nextUnit(newValidity)
.build();
}
diff --git a/bot-core/src/main/java/dev/struchkov/godfather/core/service/timer/TimerActionTask.java b/bot-core/src/main/java/dev/struchkov/godfather/core/service/timer/TimerActionTask.java
index 87748a5..5b4a1cc 100644
--- a/bot-core/src/main/java/dev/struchkov/godfather/core/service/timer/TimerActionTask.java
+++ b/bot-core/src/main/java/dev/struchkov/godfather/core/service/timer/TimerActionTask.java
@@ -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;
diff --git a/bot-core/src/main/java/dev/struchkov/godfather/core/utils/QuestionUtils.java b/bot-core/src/main/java/dev/struchkov/godfather/core/utils/QuestionUtils.java
index e6876ee..d66114c 100644
--- a/bot-core/src/main/java/dev/struchkov/godfather/core/utils/QuestionUtils.java
+++ b/bot-core/src/main/java/dev/struchkov/godfather/core/utils/QuestionUtils.java
@@ -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.builder()
diff --git a/pom.xml b/pom.xml
index fcf9020..2816d54 100644
--- a/pom.xml
+++ b/pom.xml
@@ -6,12 +6,13 @@
dev.struchkov.godfather
godfather-bot
- 0.0.1-RELEASE
+ 0.0.2
+ pom
+
bot-context
bot-core
- pom
GodFather Bot
Абстрактная бииблиотека для помощи в реализации библиотек ботов для конкретных социальных сетей
@@ -24,17 +25,20 @@
- 17
- 17
+ 17
+ ${java.version}
+ ${java.version}
+ UTF-8
+ UTF-8
- 0.0.1-RELEASE
- 0.0.1-RELEASE
+ 0.0.2
+ 0.0.2
1.9.4-RELEASE
2.8.9
1.6.2
1.18.22
- 2.3.0.RELEASE
+ 2.6.1
2.2
2.0.1.Final
2.11.0
@@ -98,32 +102,6 @@
-
-
- release
-
-
-
- org.sonatype.plugins
- nexus-staging-maven-plugin
-
-
- org.apache.maven.plugins
- maven-source-plugin
-
-
- org.apache.maven.plugins
- maven-gpg-plugin
-
-
- org.apache.maven.plugins
- maven-javadoc-plugin
-
-
-
-
-
-
@@ -137,13 +115,6 @@
https://s01.oss.sonatype.org/
true
-
-
- com.thoughtworks.xstream
- xstream
- ${xstream.ver}
-
-
org.apache.maven.plugins
@@ -184,11 +155,14 @@
+
+
+ org.apache.maven.plugins
+ maven-compiler-plugin
+ ${plugin.maven.compiler.ver}
-
- --pinentry-mode
- loopback
-
+
+ ${java.version}
@@ -198,14 +172,36 @@
org.apache.maven.plugins
maven-compiler-plugin
-
-
- 17
-
+
+
+ release
+
+
+
+ org.sonatype.plugins
+ nexus-staging-maven-plugin
+
+
+ org.apache.maven.plugins
+ maven-source-plugin
+
+
+ org.apache.maven.plugins
+ maven-gpg-plugin
+
+
+ org.apache.maven.plugins
+ maven-javadoc-plugin
+
+
+
+
+
+
scm:git:https://github.com/Godfather-Bots/godfather.git
https://github.com/Godfather-Bots/godfathere