Compare commits

...

6 Commits

3 changed files with 13 additions and 37 deletions

View File

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

View File

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

View File

@ -1,12 +1,10 @@
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.StorylineRepository;
import dev.struchkov.godfather.simple.context.repository.StorylineHistoryRepository;
import dev.struchkov.godfather.simple.context.repository.UnitPointerRepository;
import dev.struchkov.godfather.simple.core.service.StorylineContextMapImpl;
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.StorylineMapHistoryRepository;
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.service.TelegramConnect;
@ -28,18 +26,12 @@ public class TelegramBotDataConfiguration {
return new UnitPointLocalRepository();
}
@Bean
@ConditionalOnBean(TelegramConnect.class)
@ConditionalOnMissingBean(PersonSettingRepository.class)
public PersonSettingRepository personSettingRepository() {
return new PersonSettingLocalRepository();
}
@Bean
@ConditionalOnBean(TelegramConnect.class)
@ConditionalOnMissingBean(StorylineRepository.class)
public StorylineRepository storylineRepository() {
return new StorylineMapRepository();
@ConditionalOnMissingBean(StorylineHistoryRepository.class)
public StorylineHistoryRepository storylineHistoryRepository() {
return new StorylineMapHistoryRepository();
}
@Bean