Compare commits
19 Commits
Author | SHA1 | Date |
---|---|---|
Struchkov Mark | ef189e9baa | |
Struchkov Mark | 4a93ab5274 | |
Struchkov Mark | 88e4a82372 | |
Struchkov Mark | f616dd30ba | |
Struchkov Mark | ef605cf098 | |
Struchkov Mark | 084f39be0b | |
Struchkov Mark | 5e433b76ef | |
Struchkov Mark | 015c3246a7 | |
Struchkov Mark | 502767a514 | |
Struchkov Mark | 9e5a8756d4 | |
Struchkov Mark | 1da4bda2f4 | |
Struchkov Mark | 16b94d8508 | |
Struchkov Mark | 030b62e179 | |
Struchkov Mark | 6e11f53a8c | |
Struchkov Mark | 7e3f8343f3 | |
Struchkov Mark | aa64f06dd8 | |
Struchkov Mark | ffd90c9d68 | |
Struchkov Mark | bea9978ef6 | |
Struchkov Mark | 91ccbb5a90 |
13
.drone.yml
13
.drone.yml
|
@ -13,9 +13,8 @@ volumes:
|
|||
path: /drone/volume/m2
|
||||
|
||||
steps:
|
||||
|
||||
- name: publish
|
||||
image: maven:3.8.5-openjdk-17
|
||||
image: hub.docker.struchkov.dev/maven:3.9.5-eclipse-temurin-17-alpine
|
||||
privileged: true
|
||||
volumes:
|
||||
- name: m2
|
||||
|
@ -42,9 +41,8 @@ volumes:
|
|||
path: /drone/volume/m2
|
||||
|
||||
steps:
|
||||
|
||||
- name: publish maven central
|
||||
image: maven:3.8.5-openjdk-17
|
||||
image: hub.docker.struchkov.dev/maven:3.9.5-eclipse-temurin-17-alpine
|
||||
privileged: true
|
||||
volumes:
|
||||
- name: m2
|
||||
|
@ -57,6 +55,7 @@ steps:
|
|||
GPG_PASSPHRASE:
|
||||
from_secret: GPG_PASSPHRASE
|
||||
commands:
|
||||
- apk add --no-cache gnupg
|
||||
- echo "$GPG_PRIVATE_KEY" >> gpg.key
|
||||
- echo "$MAVEN_SETTINGS" >> maven-settings.xml
|
||||
- gpg --pinentry-mode loopback --passphrase $GPG_PASSPHRASE --import gpg.key
|
||||
|
@ -77,9 +76,8 @@ volumes:
|
|||
path: /drone/volume/m2
|
||||
|
||||
steps:
|
||||
|
||||
- name: publish struchkov nexus
|
||||
image: maven:3.8.5-openjdk-17
|
||||
image: hub.docker.struchkov.dev/maven:3.9.5-eclipse-temurin-17-alpine
|
||||
privileged: true
|
||||
volumes:
|
||||
- name: m2
|
||||
|
@ -92,6 +90,7 @@ steps:
|
|||
GPG_PASSPHRASE:
|
||||
from_secret: GPG_PASSPHRASE
|
||||
commands:
|
||||
- apk add --no-cache gnupg
|
||||
- echo "$GPG_PRIVATE_KEY" >> gpg.key
|
||||
- echo "$MAVEN_SETTINGS" >> maven-settings.xml
|
||||
- gpg --pinentry-mode loopback --passphrase $GPG_PASSPHRASE --import gpg.key
|
||||
|
@ -99,6 +98,6 @@ steps:
|
|||
|
||||
---
|
||||
kind: signature
|
||||
hmac: 6aa5185200940abe95b0bb1c4cb7fc958faee27e88fb3ae4e4694b9a2da871b0
|
||||
hmac: 66796c2b300a4fe5e185561985fb867cb7f0ce0ab98babd264a4bf2ff6246228
|
||||
|
||||
...
|
||||
|
|
20
pom.xml
20
pom.xml
|
@ -10,7 +10,7 @@
|
|||
|
||||
<groupId>dev.struchkov.godfather.telegram</groupId>
|
||||
<artifactId>telegram-bot-spring-boot-starter</artifactId>
|
||||
<version>0.0.53</version>
|
||||
<version>1.0.0-SNAPSHOT</version>
|
||||
|
||||
<properties>
|
||||
<java.version>17</java.version>
|
||||
|
@ -19,21 +19,23 @@
|
|||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
|
||||
|
||||
<telegram.bot.version>0.0.52</telegram.bot.version>
|
||||
<godfather.version>0.0.53</godfather.version>
|
||||
<!-- https://mvnrepository.com/artifact/dev.struchkov.godfather/bot-data-simple -->
|
||||
<godfather.version>1.2.0</godfather.version>
|
||||
<!-- https://mvnrepository.com/artifact/dev.struchkov.godfather.telegram/telegram-consumer-simple -->
|
||||
<telegram.bot.version>1.4.0</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>
|
||||
<plugin.maven.compiler.ver>3.12.1</plugin.maven.compiler.ver>
|
||||
<!-- https://mvnrepository.com/artifact/org.sonatype.plugins/nexus-staging-maven-plugin -->
|
||||
<plugin.nexus.staging.ver>1.6.13</plugin.nexus.staging.ver>
|
||||
<!-- https://mvnrepository.com/artifact/org.apache.maven.plugins/maven-source-plugin -->
|
||||
<plugin.maven.source.ver>3.2.1</plugin.maven.source.ver>
|
||||
<plugin.maven.source.ver>3.3.0</plugin.maven.source.ver>
|
||||
<!-- https://mvnrepository.com/artifact/org.apache.maven.plugins/maven-javadoc-plugin -->
|
||||
<plugin.maven.javadoc.ver>3.5.0</plugin.maven.javadoc.ver>
|
||||
<plugin.maven.javadoc.ver>3.6.3</plugin.maven.javadoc.ver>
|
||||
<!-- https://mvnrepository.com/artifact/org.apache.maven.plugins/maven-gpg-plugin -->
|
||||
<plugin.maven.gpg.ver>3.0.1</plugin.maven.gpg.ver>
|
||||
<plugin.maven.gpg.ver>3.1.0</plugin.maven.gpg.ver>
|
||||
<!-- https://mvnrepository.com/artifact/org.apache.maven.plugins/maven-release-plugin -->
|
||||
<plugin.maven.release.ver>3.0.0-M7</plugin.maven.release.ver>
|
||||
<plugin.maven.release.ver>3.0.1</plugin.maven.release.ver>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
|
@ -297,7 +299,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>v.0.0.53</tag>
|
||||
<tag>v.0.0.56</tag>
|
||||
</scm>
|
||||
|
||||
<developers>
|
||||
|
|
|
@ -2,32 +2,29 @@ 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;
|
||||
import dev.struchkov.godfather.simple.core.action.AnswerSaveAction;
|
||||
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;
|
||||
import dev.struchkov.godfather.telegram.main.context.TelegramConnect;
|
||||
import dev.struchkov.godfather.telegram.simple.consumer.EventDistributorService;
|
||||
import dev.struchkov.godfather.telegram.simple.context.repository.SenderRepository;
|
||||
import dev.struchkov.godfather.telegram.simple.context.service.EventDistributor;
|
||||
import dev.struchkov.godfather.telegram.simple.context.service.TelegramConnect;
|
||||
import dev.struchkov.godfather.telegram.simple.context.service.TelegramSending;
|
||||
import dev.struchkov.godfather.telegram.simple.context.service.TelegramService;
|
||||
import dev.struchkov.godfather.telegram.simple.core.ChatMailAutoresponderTelegram;
|
||||
import dev.struchkov.godfather.telegram.simple.core.MailAutoresponderTelegram;
|
||||
import dev.struchkov.godfather.telegram.simple.core.TelegramConnectBot;
|
||||
import dev.struchkov.godfather.telegram.simple.core.service.TelegramServiceImpl;
|
||||
import dev.struchkov.godfather.telegram.simple.sender.TelegramSender;
|
||||
import dev.struchkov.godfather.telegram.starter.ChatUnitConfiguration;
|
||||
|
@ -37,6 +34,7 @@ import org.springframework.beans.factory.ObjectProvider;
|
|||
import org.springframework.beans.factory.annotation.Qualifier;
|
||||
import org.springframework.boot.autoconfigure.AutoConfigureAfter;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
|
@ -52,7 +50,7 @@ import static dev.struchkov.haiti.utils.Checker.checkNotNull;
|
|||
@AutoConfigureAfter(TelegramBotDataConfiguration.class)
|
||||
public class TelegramBotAutoconfiguration {
|
||||
|
||||
@ConditionalOnBean(TelegramConnectBot.class)
|
||||
@ConditionalOnBean(TelegramConnect.class)
|
||||
@Bean(AUTORESPONDER_EXECUTORS_SERVICE)
|
||||
public ExecutorService executorService(
|
||||
TelegramBotAutoresponderProperty autoresponderProperty
|
||||
|
@ -72,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(
|
||||
|
@ -95,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)
|
||||
);
|
||||
}
|
||||
|
@ -126,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<>());
|
||||
|
||||
|
@ -162,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<>());
|
||||
|
||||
|
@ -205,11 +191,18 @@ public class TelegramBotAutoconfiguration {
|
|||
}
|
||||
|
||||
@Bean
|
||||
@ConditionalOnBean(TelegramConnectBot.class)
|
||||
@ConditionalOnMissingBean(EventDispatching.class)
|
||||
public EventDispatching eventDispatching(List<EventHandler> eventHandlers) {
|
||||
return new EventDispatchingImpl(eventHandlers);
|
||||
}
|
||||
|
||||
@Bean
|
||||
@ConditionalOnBean(EventDispatching.class)
|
||||
@ConditionalOnMissingBean(EventDistributor.class)
|
||||
public EventDistributor eventDistributor(
|
||||
TelegramConnectBot telegramConnect, List<? extends EventHandler> eventProviders
|
||||
TelegramConnect telegramConnect, EventDispatching eventDispatching
|
||||
) {
|
||||
return new EventDistributorService(telegramConnect, (List<EventHandler>) eventProviders);
|
||||
return new EventDistributorService(telegramConnect, eventDispatching);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,15 +1,13 @@
|
|||
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.core.TelegramConnectBot;
|
||||
import dev.struchkov.godfather.telegram.simple.context.service.TelegramConnect;
|
||||
import dev.struchkov.godfather.telegram.simple.core.service.SenderMapRepository;
|
||||
import org.springframework.boot.autoconfigure.AutoConfigureAfter;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
|
||||
|
@ -22,24 +20,18 @@ import org.springframework.context.annotation.Configuration;
|
|||
public class TelegramBotDataConfiguration {
|
||||
|
||||
@Bean
|
||||
@ConditionalOnBean(TelegramConnectBot.class)
|
||||
@ConditionalOnBean(TelegramConnect.class)
|
||||
@ConditionalOnMissingBean(UnitPointerRepository.class)
|
||||
public UnitPointerRepository unitPointerRepository() {
|
||||
return new UnitPointLocalRepository();
|
||||
}
|
||||
|
||||
@Bean
|
||||
@ConditionalOnBean(TelegramConnectBot.class)
|
||||
@ConditionalOnMissingBean(PersonSettingRepository.class)
|
||||
public PersonSettingRepository personSettingRepository() {
|
||||
return new PersonSettingLocalRepository();
|
||||
}
|
||||
|
||||
@Bean
|
||||
@ConditionalOnBean(TelegramConnectBot.class)
|
||||
@ConditionalOnMissingBean(StorylineRepository.class)
|
||||
public StorylineRepository storylineRepository() {
|
||||
return new StorylineMapRepository();
|
||||
@ConditionalOnBean(TelegramConnect.class)
|
||||
@ConditionalOnMissingBean(StorylineHistoryRepository.class)
|
||||
public StorylineHistoryRepository storylineHistoryRepository() {
|
||||
return new StorylineMapHistoryRepository();
|
||||
}
|
||||
|
||||
@Bean
|
||||
|
@ -49,7 +41,7 @@ public class TelegramBotDataConfiguration {
|
|||
}
|
||||
|
||||
@Bean
|
||||
@ConditionalOnBean(TelegramConnectBot.class)
|
||||
@ConditionalOnBean(TelegramConnect.class)
|
||||
public StorylineContext storylineContext() {
|
||||
return new StorylineContextMapImpl();
|
||||
}
|
||||
|
|
|
@ -2,8 +2,10 @@ package dev.struchkov.godfather.telegram.starter.config;
|
|||
|
||||
import dev.struchkov.godfather.telegram.domain.config.ProxyConfig;
|
||||
import dev.struchkov.godfather.telegram.domain.config.TelegramBotConfig;
|
||||
import dev.struchkov.godfather.telegram.main.core.TelegramDefaultConnect;
|
||||
import dev.struchkov.godfather.telegram.simple.core.TelegramConnectBot;
|
||||
import dev.struchkov.godfather.telegram.simple.context.service.TelegramConnect;
|
||||
import dev.struchkov.godfather.telegram.simple.core.TelegramDefaultConnect;
|
||||
import dev.struchkov.godfather.telegram.simple.core.TelegramPollingConnect;
|
||||
import dev.struchkov.godfather.telegram.simple.core.TelegramWebhookConnect;
|
||||
import dev.struchkov.godfather.telegram.starter.property.TelegramBotAutoresponderProperty;
|
||||
import org.springframework.beans.factory.ObjectProvider;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
||||
|
@ -49,13 +51,20 @@ public class TelegramBotPropertyConfiguration {
|
|||
@Bean
|
||||
@Primary
|
||||
@ConditionalOnProperty(prefix = "telegram.bot", name = "username")
|
||||
public TelegramConnectBot telegramConnectBot(TelegramBotConfig telegramConfig) {
|
||||
return new TelegramConnectBot(telegramConfig);
|
||||
public TelegramConnect telegramConnectBot(TelegramBotConfig telegramConfig) {
|
||||
return new TelegramPollingConnect(telegramConfig);
|
||||
}
|
||||
|
||||
@Bean
|
||||
@Primary
|
||||
@ConditionalOnProperty(prefix = "telegram.bot", name = "webhook-url")
|
||||
public TelegramConnect telegramWebhookConnect(TelegramBotConfig telegramConfig) {
|
||||
return new TelegramWebhookConnect(telegramConfig);
|
||||
}
|
||||
|
||||
@Bean
|
||||
@ConditionalOnProperty(prefix = "telegram.bot", name = "token")
|
||||
public TelegramDefaultConnect telegramDefaultConnect(TelegramBotConfig telegramConfig) {
|
||||
public TelegramConnect telegramDefaultConnect(TelegramBotConfig telegramConfig) {
|
||||
return new TelegramDefaultConnect(telegramConfig);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue