InitCommit

This commit is contained in:
Struchkov Mark 2023-03-14 21:07:45 +03:00
parent 5359054d70
commit f9be4e810d
Signed by: upagge
GPG Key ID: D3018BE7BA428CA6
3 changed files with 54 additions and 3 deletions

38
pom.xml
View File

@ -51,6 +51,44 @@
</dependency>
</dependencies>
<repositories>
<repository>
<id>struchkov-nexus-release</id>
<url>https://nexus.struchkov.dev/repository/maven-releases/</url>
<releases>
<enabled>true</enabled>
<updatePolicy>always</updatePolicy>
<checksumPolicy>fail</checksumPolicy>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
<repository>
<id>struchkov-nexus-snapshot</id>
<url>https://nexus.struchkov.dev/repository/maven-snapshots/</url>
<releases>
<enabled>false</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
<updatePolicy>always</updatePolicy>
<checksumPolicy>warn</checksumPolicy>
</snapshots>
</repository>
</repositories>
<distributionManagement>
<repository>
<id>struchkov-nexus-release</id>
<url>https://nexus.struchkov.dev/repository/maven-releases/</url>
</repository>
<snapshotRepository>
<id>struchkov-nexus-snapshot</id>
<url>https://nexus.struchkov.dev/repository/maven-snapshots/</url>
</snapshotRepository>
</distributionManagement>
<build>
<plugins>
<plugin>

View File

@ -6,5 +6,6 @@ import lombok.experimental.UtilityClass;
public class UnitName {
public static final String GENERAL_MENU = "GENERAL_MENU";
public static final String HOW_ARE_YOU_ANSWER = "HOW_ARE_YOU_ANSWER";
}

View File

@ -2,20 +2,32 @@ package dev.struchkov.example.bot.units;
import dev.struchkov.godfather.main.domain.annotation.Unit;
import dev.struchkov.godfather.main.domain.content.Mail;
import dev.struchkov.godfather.simple.domain.BoxAnswer;
import dev.struchkov.godfather.simple.domain.unit.AnswerText;
import dev.struchkov.godfather.simple.domain.unit.MainUnit;
import dev.struchkov.godfather.telegram.starter.UnitConfiguration;
import org.springframework.stereotype.Component;
import static dev.struchkov.example.bot.UnitName.GENERAL_MENU;
import static dev.struchkov.example.bot.UnitName.HOW_ARE_YOU_ANSWER;
import static dev.struchkov.godfather.simple.domain.BoxAnswer.boxAnswer;
@Component
public class GeneralMenu implements UnitConfiguration {
@Unit(value = GENERAL_MENU, main = true)
public AnswerText<Mail> generalMenu() {
public AnswerText<Mail> generalMenu(
@Unit(HOW_ARE_YOU_ANSWER) MainUnit<Mail> howAreYouAnswer
) {
return AnswerText.<Mail>builder()
.answer(BoxAnswer.boxAnswer("hello"))
.answer(boxAnswer("Hello!"))
.next(howAreYouAnswer)
.build();
}
@Unit(HOW_ARE_YOU_ANSWER)
public AnswerText<Mail> howAreYouAnswer() {
return AnswerText.<Mail>builder()
.answer(boxAnswer("I'm fine. Thank you"))
.build();
}