Compare commits

..

No commits in common. "4a93ab527457d60f64334ec07cf02fbd3f48be3e" and "015c3246a73aee63e46d857c6563b164033292df" have entirely different histories.

3 changed files with 37 additions and 13 deletions

View File

@ -10,7 +10,7 @@
<groupId>dev.struchkov.godfather.telegram</groupId> <groupId>dev.struchkov.godfather.telegram</groupId>
<artifactId>telegram-bot-spring-boot-starter</artifactId> <artifactId>telegram-bot-spring-boot-starter</artifactId>
<version>0.0.58-SNAPSHOT</version> <version>0.0.56-SNAPSHOT</version>
<properties> <properties>
<java.version>17</java.version> <java.version>17</java.version>
@ -19,8 +19,8 @@
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding> <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<godfather.version>0.0.63</godfather.version> <godfather.version>0.0.59-SNAPSHOT</godfather.version>
<telegram.bot.version>0.0.63</telegram.bot.version> <telegram.bot.version>0.0.60-SNAPSHOT</telegram.bot.version>
<!-- https://mvnrepository.com/artifact/org.apache.maven.plugins/maven-compiler-plugin --> <!-- https://mvnrepository.com/artifact/org.apache.maven.plugins/maven-compiler-plugin -->
<plugin.maven.compiler.ver>3.10.1</plugin.maven.compiler.ver> <plugin.maven.compiler.ver>3.10.1</plugin.maven.compiler.ver>
@ -297,7 +297,7 @@
<url>https://git.struchkov.dev/Godfather-Bots/telegram-bot-spring-boot-starter</url> <url>https://git.struchkov.dev/Godfather-Bots/telegram-bot-spring-boot-starter</url>
<developerConnection>scm:git:https://git.struchkov.dev/Godfather-Bots/telegram-bot-spring-boot-starter.git <developerConnection>scm:git:https://git.struchkov.dev/Godfather-Bots/telegram-bot-spring-boot-starter.git
</developerConnection> </developerConnection>
<tag>v.0.0.56</tag> <tag>HEAD</tag>
</scm> </scm>
<developers> <developers>

View File

@ -2,10 +2,13 @@ package dev.struchkov.godfather.telegram.starter.config;
import dev.struchkov.godfather.main.domain.content.ChatMail; import dev.struchkov.godfather.main.domain.content.ChatMail;
import dev.struchkov.godfather.main.domain.content.Mail; import dev.struchkov.godfather.main.domain.content.Mail;
import dev.struchkov.godfather.simple.context.repository.PersonSettingRepository;
import dev.struchkov.godfather.simple.context.repository.StorylineRepository;
import dev.struchkov.godfather.simple.context.repository.UnitPointerRepository; import dev.struchkov.godfather.simple.context.repository.UnitPointerRepository;
import dev.struchkov.godfather.simple.context.service.ErrorHandler; import dev.struchkov.godfather.simple.context.service.ErrorHandler;
import dev.struchkov.godfather.simple.context.service.EventDispatching; import dev.struchkov.godfather.simple.context.service.EventDispatching;
import dev.struchkov.godfather.simple.context.service.EventHandler; import dev.struchkov.godfather.simple.context.service.EventHandler;
import dev.struchkov.godfather.simple.context.service.PersonSettingService;
import dev.struchkov.godfather.simple.context.service.UnitPointerService; import dev.struchkov.godfather.simple.context.service.UnitPointerService;
import dev.struchkov.godfather.simple.core.EventDispatchingImpl; import dev.struchkov.godfather.simple.core.EventDispatchingImpl;
import dev.struchkov.godfather.simple.core.action.AnswerCheckAction; import dev.struchkov.godfather.simple.core.action.AnswerCheckAction;
@ -14,6 +17,7 @@ import dev.struchkov.godfather.simple.core.action.AnswerTextChatMailAction;
import dev.struchkov.godfather.simple.core.action.AnswerTextMailAction; import dev.struchkov.godfather.simple.core.action.AnswerTextMailAction;
import dev.struchkov.godfather.simple.core.provider.ChatStoryLineHandler; import dev.struchkov.godfather.simple.core.provider.ChatStoryLineHandler;
import dev.struchkov.godfather.simple.core.provider.PersonStoryLineHandler; import dev.struchkov.godfather.simple.core.provider.PersonStoryLineHandler;
import dev.struchkov.godfather.simple.core.service.PersonSettingServiceImpl;
import dev.struchkov.godfather.simple.core.service.StorylineMailService; import dev.struchkov.godfather.simple.core.service.StorylineMailService;
import dev.struchkov.godfather.simple.core.service.StorylineService; import dev.struchkov.godfather.simple.core.service.StorylineService;
import dev.struchkov.godfather.simple.core.service.UnitPointerServiceImpl; import dev.struchkov.godfather.simple.core.service.UnitPointerServiceImpl;
@ -70,6 +74,12 @@ public class TelegramBotAutoconfiguration {
return new UnitPointerServiceImpl(unitPointerRepository); return new UnitPointerServiceImpl(unitPointerRepository);
} }
@Bean
@ConditionalOnBean(PersonSettingRepository.class)
public PersonSettingService personSettingService(PersonSettingRepository personSettingRepository) {
return new PersonSettingServiceImpl(personSettingRepository);
}
@Bean @Bean
@ConditionalOnBean(TelegramConnect.class) @ConditionalOnBean(TelegramConnect.class)
public TelegramSending sending( public TelegramSending sending(
@ -87,25 +97,29 @@ public class TelegramBotAutoconfiguration {
} }
@Bean("mailStorylineService") @Bean("mailStorylineService")
@ConditionalOnBean(value = {UnitPointerService.class, PersonUnitConfiguration.class}) @ConditionalOnBean(value = {UnitPointerService.class, StorylineRepository.class, PersonUnitConfiguration.class})
public StorylineService<Mail> mailStorylineService( public StorylineService<Mail> mailStorylineService(
UnitPointerService unitPointerService, UnitPointerService unitPointerService,
StorylineRepository storylineRepository,
List<PersonUnitConfiguration> personUnitConfigurations List<PersonUnitConfiguration> personUnitConfigurations
) { ) {
return new StorylineMailService<>( return new StorylineMailService<>(
unitPointerService, unitPointerService,
storylineRepository,
new ArrayList<>(personUnitConfigurations) new ArrayList<>(personUnitConfigurations)
); );
} }
@Bean("chatMailStorylineService") @Bean("chatMailStorylineService")
@ConditionalOnBean(value = {UnitPointerService.class, ChatUnitConfiguration.class}) @ConditionalOnBean(value = {UnitPointerService.class, StorylineRepository.class, ChatUnitConfiguration.class})
public StorylineService<ChatMail> chatMailStorylineService( public StorylineService<ChatMail> chatMailStorylineService(
UnitPointerService unitPointerService, UnitPointerService unitPointerService,
StorylineRepository storylineRepository,
List<ChatUnitConfiguration> chatUnitConfigurations List<ChatUnitConfiguration> chatUnitConfigurations
) { ) {
return new StorylineMailService<>( return new StorylineMailService<>(
unitPointerService, unitPointerService,
storylineRepository,
new ArrayList<>(chatUnitConfigurations) new ArrayList<>(chatUnitConfigurations)
); );
} }
@ -114,13 +128,14 @@ public class TelegramBotAutoconfiguration {
@ConditionalOnBean(name = "chatMailStorylineService") @ConditionalOnBean(name = "chatMailStorylineService")
public ChatMailAutoresponderTelegram chatMailAutoresponderTelegram( public ChatMailAutoresponderTelegram chatMailAutoresponderTelegram(
@Qualifier(AUTORESPONDER_EXECUTORS_SERVICE) ObjectProvider<ExecutorService> executorServiceProvider, @Qualifier(AUTORESPONDER_EXECUTORS_SERVICE) ObjectProvider<ExecutorService> executorServiceProvider,
PersonSettingService personSettingService,
ObjectProvider<ErrorHandler> errorHandlerProvider, ObjectProvider<ErrorHandler> errorHandlerProvider,
ObjectProvider<AnswerTextChatMailAction> answerTextActionProvider, ObjectProvider<AnswerTextChatMailAction> answerTextActionProvider,
TelegramSending telegramSending, TelegramSending telegramSending,
StorylineService<ChatMail> storylineService StorylineService<ChatMail> storylineService
) { ) {
final ChatMailAutoresponderTelegram autoresponder = new ChatMailAutoresponderTelegram(storylineService); final ChatMailAutoresponderTelegram autoresponder = new ChatMailAutoresponderTelegram(personSettingService, storylineService);
autoresponder.registrationActionUnit(new AnswerCheckAction(telegramSending)); autoresponder.registrationActionUnit(new AnswerCheckAction(telegramSending));
autoresponder.registrationActionUnit(new AnswerSaveAction<>()); autoresponder.registrationActionUnit(new AnswerSaveAction<>());
@ -149,12 +164,13 @@ public class TelegramBotAutoconfiguration {
public MailAutoresponderTelegram messageAutoresponderTelegram( public MailAutoresponderTelegram messageAutoresponderTelegram(
@Qualifier(AUTORESPONDER_EXECUTORS_SERVICE) ObjectProvider<ExecutorService> executorServiceProvider, @Qualifier(AUTORESPONDER_EXECUTORS_SERVICE) ObjectProvider<ExecutorService> executorServiceProvider,
TelegramSending sending, TelegramSending sending,
PersonSettingService personSettingService,
ObjectProvider<ErrorHandler> errorHandlerProvider, ObjectProvider<ErrorHandler> errorHandlerProvider,
ObjectProvider<AnswerTextMailAction> answerTextActionProvider, ObjectProvider<AnswerTextMailAction> answerTextActionProvider,
StorylineService<Mail> storylineService StorylineService<Mail> storylineService
) { ) {
final MailAutoresponderTelegram autoresponder = new MailAutoresponderTelegram(storylineService); final MailAutoresponderTelegram autoresponder = new MailAutoresponderTelegram(personSettingService, storylineService);
autoresponder.registrationActionUnit(new AnswerCheckAction(sending)); autoresponder.registrationActionUnit(new AnswerCheckAction(sending));
autoresponder.registrationActionUnit(new AnswerSaveAction<>()); autoresponder.registrationActionUnit(new AnswerSaveAction<>());

View File

@ -1,10 +1,12 @@
package dev.struchkov.godfather.telegram.starter.config; package dev.struchkov.godfather.telegram.starter.config;
import dev.struchkov.godfather.simple.context.repository.PersonSettingRepository;
import dev.struchkov.godfather.simple.context.repository.StorylineContext; import dev.struchkov.godfather.simple.context.repository.StorylineContext;
import dev.struchkov.godfather.simple.context.repository.StorylineHistoryRepository; import dev.struchkov.godfather.simple.context.repository.StorylineRepository;
import dev.struchkov.godfather.simple.context.repository.UnitPointerRepository; import dev.struchkov.godfather.simple.context.repository.UnitPointerRepository;
import dev.struchkov.godfather.simple.core.service.StorylineContextMapImpl; import dev.struchkov.godfather.simple.core.service.StorylineContextMapImpl;
import dev.struchkov.godfather.simple.data.repository.impl.StorylineMapHistoryRepository; import dev.struchkov.godfather.simple.data.repository.impl.PersonSettingLocalRepository;
import dev.struchkov.godfather.simple.data.repository.impl.StorylineMapRepository;
import dev.struchkov.godfather.simple.data.repository.impl.UnitPointLocalRepository; import dev.struchkov.godfather.simple.data.repository.impl.UnitPointLocalRepository;
import dev.struchkov.godfather.telegram.simple.context.repository.SenderRepository; import dev.struchkov.godfather.telegram.simple.context.repository.SenderRepository;
import dev.struchkov.godfather.telegram.simple.context.service.TelegramConnect; import dev.struchkov.godfather.telegram.simple.context.service.TelegramConnect;
@ -26,12 +28,18 @@ public class TelegramBotDataConfiguration {
return new UnitPointLocalRepository(); return new UnitPointLocalRepository();
} }
@Bean
@ConditionalOnBean(TelegramConnect.class)
@ConditionalOnMissingBean(PersonSettingRepository.class)
public PersonSettingRepository personSettingRepository() {
return new PersonSettingLocalRepository();
}
@Bean @Bean
@ConditionalOnBean(TelegramConnect.class) @ConditionalOnBean(TelegramConnect.class)
@ConditionalOnMissingBean(StorylineHistoryRepository.class) @ConditionalOnMissingBean(StorylineRepository.class)
public StorylineHistoryRepository storylineHistoryRepository() { public StorylineRepository storylineRepository() {
return new StorylineMapHistoryRepository(); return new StorylineMapRepository();
} }
@Bean @Bean