From 93258c6f884f085593d70a8e044178c1c24549f2 Mon Sep 17 00:00:00 2001 From: Struchkov Mark Date: Fri, 17 Feb 2023 21:30:39 +0300 Subject: [PATCH] =?UTF-8?q?=D0=A0=D0=B5=D1=84=D0=B0=D0=BA=D1=82=D0=BE?= =?UTF-8?q?=D1=80=D0=B8=D0=BD=D0=B3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/impl/DiscussionServiceImpl.java | 66 +++++++++++-------- .../telegram/config/TelegramBotConfig.java | 7 ++ .../telegram/service/ErrorHandlerService.java | 9 ++- .../service/MessageSendTelegramService.java | 2 +- .../telegram/service/ReplaceUrlLocalhost.java | 4 +- .../gitlab/telegram/service/StartNotify.java | 3 +- .../notify/ConflictPrNotifyGenerator.java | 4 +- .../ConflictResolvePrNotifyGenerator.java | 4 +- .../notify/NewCommentNotifyGenerator.java | 4 +- .../NewMrForAssigneeNotifyGenerator.java | 4 +- .../notify/NewMrForReviewNotifyGenerator.java | 4 +- .../notify/NewProjectNotifyGenerator.java | 4 +- ...tor.java => NewThreadNotifyGenerator.java} | 6 +- .../notify/NotifyBoxAnswerGenerator.java | 3 +- .../notify/PipelineNotifyGenerator.java | 4 +- ...ator.java => StatusMrNotifyGenerator.java} | 12 ++-- ...te.java => ThreadCloseNotifyGenerate.java} | 6 +- ...ator.java => UpdateMrNotifyGenerator.java} | 6 +- .../bot/gitlab/telegram/unit/MenuConfig.java | 13 ++-- .../telegram/unit/command/AnswerNoteUnit.java | 6 +- .../unit/command/DisableNotifyMrUnit.java | 2 +- .../unit/command/DisableNotifyThreadUnit.java | 2 +- .../unit/command/EnableProjectNotify.java | 4 +- .../telegram/unit/flow/InitSettingFlow.java | 6 +- 24 files changed, 102 insertions(+), 83 deletions(-) rename telegram-bot/src/main/java/dev/struchkov/bot/gitlab/telegram/service/notify/{DiscussionNewNotifyGenerator.java => NewThreadNotifyGenerator.java} (92%) rename telegram-bot/src/main/java/dev/struchkov/bot/gitlab/telegram/service/notify/{StatusPrNotifyGenerator.java => StatusMrNotifyGenerator.java} (66%) rename telegram-bot/src/main/java/dev/struchkov/bot/gitlab/telegram/service/notify/{TaskCloseNotifyGenerate.java => ThreadCloseNotifyGenerate.java} (80%) rename telegram-bot/src/main/java/dev/struchkov/bot/gitlab/telegram/service/notify/{UpdatePrNotifyGenerator.java => UpdateMrNotifyGenerator.java} (93%) diff --git a/bot-core/src/main/java/dev/struchkov/bot/gitlab/core/service/impl/DiscussionServiceImpl.java b/bot-core/src/main/java/dev/struchkov/bot/gitlab/core/service/impl/DiscussionServiceImpl.java index 009ba79..1f9f5ae 100644 --- a/bot-core/src/main/java/dev/struchkov/bot/gitlab/core/service/impl/DiscussionServiceImpl.java +++ b/bot-core/src/main/java/dev/struchkov/bot/gitlab/core/service/impl/DiscussionServiceImpl.java @@ -78,7 +78,7 @@ public class DiscussionServiceImpl implements DiscussionService { discussion.setNotification(true); if (isNeedNotifyNewNote(discussion)) { - notifyNewDiscussion(discussion); + notifyNewThread(discussion); } else { notes.forEach(note -> notificationPersonal(discussion, note)); } @@ -131,33 +131,6 @@ public class DiscussionServiceImpl implements DiscussionService { return repository.save(discussion); } - /** - *

Уведомляет пользователя, если появился новый комментарий

- */ - private void notifyNewDiscussion(Discussion discussion) { - final Note firstNote = discussion.getFirstNote(); - final List notes = discussion.getNotes(); - - final MergeRequestForDiscussion mergeRequest = discussion.getMergeRequest(); - final DiscussionNewNotify.DiscussionNewNotifyBuilder notifyBuilder = DiscussionNewNotify.builder() - .threadId(discussion.getId()) - .mrName(mergeRequest.getTitle()) - .authorName(firstNote.getAuthor().getName()) - .discussionMessage(firstNote.getBody()) - .url(firstNote.getWebUrl()); - - if (notes.size() > 1) { - for (int i = 1; i < notes.size(); i++) { - final Note note = notes.get(i); - notifyBuilder.note( - new Pair<>(note.getAuthor().getName(), note.getBody()) - ); - } - } - - notifyService.send(notifyBuilder.build()); - } - private boolean isNeedNotifyNewNote(Discussion discussion) { final Note firstNote = discussion.getFirstNote(); final Long gitlabUserId = personInformation.getId(); @@ -349,7 +322,7 @@ public class DiscussionServiceImpl implements DiscussionService { /** * Уведомляет пользователя, если его никнейм упоминается в комментарии. */ - protected void notificationPersonal(Discussion discussion, Note note) { + private void notificationPersonal(Discussion discussion, Note note) { final DiscussionLevel discussionLevel = settingService.getLevelDiscussionNotify(); if (!WITHOUT_NOTIFY.equals(discussionLevel)) { final Matcher matcher = PATTERN.matcher(note.getBody()); @@ -390,4 +363,39 @@ public class DiscussionServiceImpl implements DiscussionService { } } + /** + *

Уведомляет пользователя, если появился новый комментарий

+ */ + private void notifyNewThread(Discussion discussion) { + final DiscussionLevel discussionLevel = settingService.getLevelDiscussionNotify(); + if (!WITHOUT_NOTIFY.equals(discussionLevel)) { + final Note firstNote = discussion.getFirstNote(); + + final MergeRequestForDiscussion mergeRequest = discussion.getMergeRequest(); + DiscussionNewNotify.DiscussionNewNotifyBuilder messageBuilder = DiscussionNewNotify.builder() + .threadId(discussion.getId()) + .mrName(mergeRequest.getTitle()) + .authorName(firstNote.getAuthor().getName()); + + if (NOTIFY_WITH_CONTEXT.equals(discussionLevel)) { + final List notes = discussion.getNotes(); + + messageBuilder + .discussionMessage(firstNote.getBody()) + .url(firstNote.getWebUrl()); + + if (notes.size() > 1) { + for (int i = 1; i < notes.size(); i++) { + final Note note = notes.get(i); + messageBuilder.note( + new Pair<>(note.getAuthor().getName(), note.getBody()) + ); + } + } + } + + notifyService.send(messageBuilder.build()); + } + } + } diff --git a/telegram-bot/src/main/java/dev/struchkov/bot/gitlab/telegram/config/TelegramBotConfig.java b/telegram-bot/src/main/java/dev/struchkov/bot/gitlab/telegram/config/TelegramBotConfig.java index ce60a58..fc12af2 100644 --- a/telegram-bot/src/main/java/dev/struchkov/bot/gitlab/telegram/config/TelegramBotConfig.java +++ b/telegram-bot/src/main/java/dev/struchkov/bot/gitlab/telegram/config/TelegramBotConfig.java @@ -31,9 +31,11 @@ import dev.struchkov.godfather.telegram.main.context.TelegramConnect; import dev.struchkov.godfather.telegram.simple.consumer.EventDistributorService; import dev.struchkov.godfather.telegram.simple.context.service.EventDistributor; 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.MailAutoresponderTelegram; import dev.struchkov.godfather.telegram.simple.core.TelegramConnectBot; import dev.struchkov.godfather.telegram.simple.core.service.SenderMapRepository; +import dev.struchkov.godfather.telegram.simple.core.service.TelegramServiceImpl; import dev.struchkov.godfather.telegram.simple.sender.TelegramSender; import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; @@ -58,6 +60,11 @@ public class TelegramBotConfig { return Executors.newFixedThreadPool(3); } + @Bean + public TelegramService telegramService(TelegramConnect telegramConnect) { + return new TelegramServiceImpl(telegramConnect); + } + @Bean public StorylineContext storylineContext() { return new StorylineContextMapImpl(); diff --git a/telegram-bot/src/main/java/dev/struchkov/bot/gitlab/telegram/service/ErrorHandlerService.java b/telegram-bot/src/main/java/dev/struchkov/bot/gitlab/telegram/service/ErrorHandlerService.java index 8287aa2..8260378 100644 --- a/telegram-bot/src/main/java/dev/struchkov/bot/gitlab/telegram/service/ErrorHandlerService.java +++ b/telegram-bot/src/main/java/dev/struchkov/bot/gitlab/telegram/service/ErrorHandlerService.java @@ -1,27 +1,30 @@ package dev.struchkov.bot.gitlab.telegram.service; -import dev.struchkov.godfather.main.domain.BoxAnswer; +import dev.struchkov.bot.gitlab.core.config.properties.PersonProperty; import dev.struchkov.godfather.main.domain.content.Message; import dev.struchkov.godfather.simple.context.service.ErrorHandler; +import dev.struchkov.godfather.simple.domain.BoxAnswer; import dev.struchkov.godfather.telegram.simple.context.service.TelegramSending; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.springframework.stereotype.Service; -import static dev.struchkov.godfather.main.domain.BoxAnswer.boxAnswer; +import static dev.struchkov.godfather.simple.domain.BoxAnswer.boxAnswer; + @Slf4j @Service @RequiredArgsConstructor public class ErrorHandlerService implements ErrorHandler { + private final PersonProperty personProperty; private final TelegramSending telegramSending; @Override public void handle(Message message, Exception e) { log.error(e.getMessage(), e); final BoxAnswer boxAnswer = boxAnswer(e.getMessage()); - boxAnswer.setRecipientIfNull(message.getPersonId()); + boxAnswer.setRecipientIfNull(personProperty.getTelegramId()); telegramSending.send(boxAnswer); } diff --git a/telegram-bot/src/main/java/dev/struchkov/bot/gitlab/telegram/service/MessageSendTelegramService.java b/telegram-bot/src/main/java/dev/struchkov/bot/gitlab/telegram/service/MessageSendTelegramService.java index 6083b07..b65404e 100644 --- a/telegram-bot/src/main/java/dev/struchkov/bot/gitlab/telegram/service/MessageSendTelegramService.java +++ b/telegram-bot/src/main/java/dev/struchkov/bot/gitlab/telegram/service/MessageSendTelegramService.java @@ -4,7 +4,7 @@ import dev.struchkov.bot.gitlab.context.domain.PersonInformation; import dev.struchkov.bot.gitlab.context.domain.notify.Notify; import dev.struchkov.bot.gitlab.context.service.MessageSendService; import dev.struchkov.bot.gitlab.telegram.service.notify.NotifyBoxAnswerGenerator; -import dev.struchkov.godfather.main.domain.BoxAnswer; +import dev.struchkov.godfather.simple.domain.BoxAnswer; import dev.struchkov.godfather.telegram.simple.context.service.TelegramSending; import lombok.NonNull; import org.springframework.stereotype.Service; diff --git a/telegram-bot/src/main/java/dev/struchkov/bot/gitlab/telegram/service/ReplaceUrlLocalhost.java b/telegram-bot/src/main/java/dev/struchkov/bot/gitlab/telegram/service/ReplaceUrlLocalhost.java index 4d184b3..3ca9768 100644 --- a/telegram-bot/src/main/java/dev/struchkov/bot/gitlab/telegram/service/ReplaceUrlLocalhost.java +++ b/telegram-bot/src/main/java/dev/struchkov/bot/gitlab/telegram/service/ReplaceUrlLocalhost.java @@ -1,8 +1,8 @@ package dev.struchkov.bot.gitlab.telegram.service; import dev.struchkov.bot.gitlab.core.config.properties.GitlabProperty; -import dev.struchkov.godfather.main.domain.BoxAnswer; -import dev.struchkov.godfather.simple.context.service.PreSendProcessing; +import dev.struchkov.godfather.simple.domain.BoxAnswer; +import dev.struchkov.godfather.simple.domain.action.PreSendProcessing; import lombok.RequiredArgsConstructor; import org.springframework.stereotype.Component; diff --git a/telegram-bot/src/main/java/dev/struchkov/bot/gitlab/telegram/service/StartNotify.java b/telegram-bot/src/main/java/dev/struchkov/bot/gitlab/telegram/service/StartNotify.java index 8477c31..d40c30b 100644 --- a/telegram-bot/src/main/java/dev/struchkov/bot/gitlab/telegram/service/StartNotify.java +++ b/telegram-bot/src/main/java/dev/struchkov/bot/gitlab/telegram/service/StartNotify.java @@ -3,7 +3,7 @@ package dev.struchkov.bot.gitlab.telegram.service; import dev.struchkov.bot.gitlab.context.service.AppSettingService; import dev.struchkov.bot.gitlab.core.config.properties.AppProperty; import dev.struchkov.bot.gitlab.core.config.properties.PersonProperty; -import dev.struchkov.godfather.main.domain.BoxAnswer; +import dev.struchkov.godfather.simple.domain.BoxAnswer; import dev.struchkov.godfather.telegram.main.context.BoxAnswerPayload; import dev.struchkov.godfather.telegram.simple.context.service.TelegramSending; import jakarta.annotation.PostConstruct; @@ -44,7 +44,6 @@ public class StartNotify { ) .payload(BoxAnswerPayload.DISABLE_WEB_PAGE_PREVIEW, true) .build(); - sending.send(boxAnswer); } } diff --git a/telegram-bot/src/main/java/dev/struchkov/bot/gitlab/telegram/service/notify/ConflictPrNotifyGenerator.java b/telegram-bot/src/main/java/dev/struchkov/bot/gitlab/telegram/service/notify/ConflictPrNotifyGenerator.java index 98043dc..9038a22 100644 --- a/telegram-bot/src/main/java/dev/struchkov/bot/gitlab/telegram/service/notify/ConflictPrNotifyGenerator.java +++ b/telegram-bot/src/main/java/dev/struchkov/bot/gitlab/telegram/service/notify/ConflictPrNotifyGenerator.java @@ -2,16 +2,16 @@ package dev.struchkov.bot.gitlab.telegram.service.notify; import dev.struchkov.bot.gitlab.context.domain.notify.mergerequest.ConflictMrNotify; import dev.struchkov.bot.gitlab.context.utils.Icons; -import dev.struchkov.godfather.main.domain.BoxAnswer; +import dev.struchkov.godfather.simple.domain.BoxAnswer; import org.springframework.stereotype.Component; import static dev.struchkov.bot.gitlab.telegram.utils.Const.BUTTON_ARG_CONFIRMATION; import static dev.struchkov.bot.gitlab.telegram.utils.Const.BUTTON_ARG_DISABLE_NOTIFY_MR_ID; import static dev.struchkov.bot.gitlab.telegram.utils.Const.BUTTON_VALUE_FALSE; import static dev.struchkov.bot.gitlab.telegram.utils.UnitName.DELETE_MESSAGE; -import static dev.struchkov.godfather.main.domain.BoxAnswer.boxAnswer; import static dev.struchkov.godfather.main.domain.keyboard.button.SimpleButton.simpleButton; import static dev.struchkov.godfather.main.domain.keyboard.simple.SimpleKeyBoardLine.simpleLine; +import static dev.struchkov.godfather.simple.domain.BoxAnswer.boxAnswer; import static dev.struchkov.godfather.telegram.domain.keyboard.InlineKeyBoard.inlineKeyBoard; import static dev.struchkov.godfather.telegram.domain.keyboard.button.UrlButton.urlButton; import static dev.struchkov.haiti.utils.Strings.escapeMarkdown; diff --git a/telegram-bot/src/main/java/dev/struchkov/bot/gitlab/telegram/service/notify/ConflictResolvePrNotifyGenerator.java b/telegram-bot/src/main/java/dev/struchkov/bot/gitlab/telegram/service/notify/ConflictResolvePrNotifyGenerator.java index d41f868..46ff208 100644 --- a/telegram-bot/src/main/java/dev/struchkov/bot/gitlab/telegram/service/notify/ConflictResolvePrNotifyGenerator.java +++ b/telegram-bot/src/main/java/dev/struchkov/bot/gitlab/telegram/service/notify/ConflictResolvePrNotifyGenerator.java @@ -2,16 +2,16 @@ package dev.struchkov.bot.gitlab.telegram.service.notify; import dev.struchkov.bot.gitlab.context.domain.notify.mergerequest.ConflictResolveMrNotify; import dev.struchkov.bot.gitlab.context.utils.Icons; -import dev.struchkov.godfather.main.domain.BoxAnswer; +import dev.struchkov.godfather.simple.domain.BoxAnswer; import org.springframework.stereotype.Component; import static dev.struchkov.bot.gitlab.telegram.utils.Const.BUTTON_ARG_CONFIRMATION; import static dev.struchkov.bot.gitlab.telegram.utils.Const.BUTTON_ARG_DISABLE_NOTIFY_MR_ID; import static dev.struchkov.bot.gitlab.telegram.utils.Const.BUTTON_VALUE_FALSE; import static dev.struchkov.bot.gitlab.telegram.utils.UnitName.DELETE_MESSAGE; -import static dev.struchkov.godfather.main.domain.BoxAnswer.boxAnswer; import static dev.struchkov.godfather.main.domain.keyboard.button.SimpleButton.simpleButton; import static dev.struchkov.godfather.main.domain.keyboard.simple.SimpleKeyBoardLine.simpleLine; +import static dev.struchkov.godfather.simple.domain.BoxAnswer.boxAnswer; import static dev.struchkov.godfather.telegram.domain.keyboard.InlineKeyBoard.inlineKeyBoard; import static dev.struchkov.godfather.telegram.domain.keyboard.button.UrlButton.urlButton; import static dev.struchkov.haiti.utils.Strings.escapeMarkdown; diff --git a/telegram-bot/src/main/java/dev/struchkov/bot/gitlab/telegram/service/notify/NewCommentNotifyGenerator.java b/telegram-bot/src/main/java/dev/struchkov/bot/gitlab/telegram/service/notify/NewCommentNotifyGenerator.java index 4959105..df64778 100644 --- a/telegram-bot/src/main/java/dev/struchkov/bot/gitlab/telegram/service/notify/NewCommentNotifyGenerator.java +++ b/telegram-bot/src/main/java/dev/struchkov/bot/gitlab/telegram/service/notify/NewCommentNotifyGenerator.java @@ -2,7 +2,7 @@ package dev.struchkov.bot.gitlab.telegram.service.notify; import dev.struchkov.bot.gitlab.context.domain.notify.comment.NewCommentNotify; import dev.struchkov.bot.gitlab.context.utils.Icons; -import dev.struchkov.godfather.main.domain.BoxAnswer; +import dev.struchkov.godfather.simple.domain.BoxAnswer; import lombok.RequiredArgsConstructor; import org.springframework.stereotype.Component; @@ -10,8 +10,8 @@ import static dev.struchkov.bot.gitlab.telegram.utils.Const.BUTTON_ARG_CONFIRMAT import static dev.struchkov.bot.gitlab.telegram.utils.Const.BUTTON_ARG_DISABLE_NOTIFY_THREAD_ID; import static dev.struchkov.bot.gitlab.telegram.utils.Const.BUTTON_VALUE_FALSE; import static dev.struchkov.bot.gitlab.telegram.utils.UnitName.DELETE_MESSAGE; -import static dev.struchkov.godfather.main.domain.BoxAnswer.boxAnswer; import static dev.struchkov.godfather.main.domain.keyboard.button.SimpleButton.simpleButton; +import static dev.struchkov.godfather.simple.domain.BoxAnswer.boxAnswer; import static dev.struchkov.godfather.telegram.domain.keyboard.InlineKeyBoard.inlineKeyBoard; import static dev.struchkov.godfather.telegram.domain.keyboard.button.UrlButton.urlButton; import static dev.struchkov.haiti.utils.Checker.checkNotNull; diff --git a/telegram-bot/src/main/java/dev/struchkov/bot/gitlab/telegram/service/notify/NewMrForAssigneeNotifyGenerator.java b/telegram-bot/src/main/java/dev/struchkov/bot/gitlab/telegram/service/notify/NewMrForAssigneeNotifyGenerator.java index d98c565..2e44ee4 100644 --- a/telegram-bot/src/main/java/dev/struchkov/bot/gitlab/telegram/service/notify/NewMrForAssigneeNotifyGenerator.java +++ b/telegram-bot/src/main/java/dev/struchkov/bot/gitlab/telegram/service/notify/NewMrForAssigneeNotifyGenerator.java @@ -2,7 +2,7 @@ package dev.struchkov.bot.gitlab.telegram.service.notify; import dev.struchkov.bot.gitlab.context.domain.notify.mergerequest.NewMrForAssignee; import dev.struchkov.bot.gitlab.context.utils.Icons; -import dev.struchkov.godfather.main.domain.BoxAnswer; +import dev.struchkov.godfather.simple.domain.BoxAnswer; import org.springframework.stereotype.Component; import java.util.List; @@ -12,9 +12,9 @@ import static dev.struchkov.bot.gitlab.telegram.utils.Const.BUTTON_ARG_CONFIRMAT import static dev.struchkov.bot.gitlab.telegram.utils.Const.BUTTON_ARG_DISABLE_NOTIFY_MR_ID; import static dev.struchkov.bot.gitlab.telegram.utils.Const.BUTTON_VALUE_FALSE; import static dev.struchkov.bot.gitlab.telegram.utils.UnitName.DELETE_MESSAGE; -import static dev.struchkov.godfather.main.domain.BoxAnswer.boxAnswer; import static dev.struchkov.godfather.main.domain.keyboard.button.SimpleButton.simpleButton; import static dev.struchkov.godfather.main.domain.keyboard.simple.SimpleKeyBoardLine.simpleLine; +import static dev.struchkov.godfather.simple.domain.BoxAnswer.boxAnswer; import static dev.struchkov.godfather.telegram.domain.keyboard.InlineKeyBoard.inlineKeyBoard; import static dev.struchkov.godfather.telegram.domain.keyboard.button.UrlButton.urlButton; import static dev.struchkov.haiti.utils.Checker.checkNotEmpty; diff --git a/telegram-bot/src/main/java/dev/struchkov/bot/gitlab/telegram/service/notify/NewMrForReviewNotifyGenerator.java b/telegram-bot/src/main/java/dev/struchkov/bot/gitlab/telegram/service/notify/NewMrForReviewNotifyGenerator.java index 953eefe..93a9c02 100644 --- a/telegram-bot/src/main/java/dev/struchkov/bot/gitlab/telegram/service/notify/NewMrForReviewNotifyGenerator.java +++ b/telegram-bot/src/main/java/dev/struchkov/bot/gitlab/telegram/service/notify/NewMrForReviewNotifyGenerator.java @@ -2,7 +2,7 @@ package dev.struchkov.bot.gitlab.telegram.service.notify; import dev.struchkov.bot.gitlab.context.domain.notify.mergerequest.NewMrForReview; import dev.struchkov.bot.gitlab.context.utils.Icons; -import dev.struchkov.godfather.main.domain.BoxAnswer; +import dev.struchkov.godfather.simple.domain.BoxAnswer; import org.springframework.stereotype.Component; import java.util.stream.Collectors; @@ -11,9 +11,9 @@ import static dev.struchkov.bot.gitlab.telegram.utils.Const.BUTTON_ARG_CONFIRMAT import static dev.struchkov.bot.gitlab.telegram.utils.Const.BUTTON_ARG_DISABLE_NOTIFY_MR_ID; import static dev.struchkov.bot.gitlab.telegram.utils.Const.BUTTON_VALUE_FALSE; import static dev.struchkov.bot.gitlab.telegram.utils.UnitName.DELETE_MESSAGE; -import static dev.struchkov.godfather.main.domain.BoxAnswer.boxAnswer; import static dev.struchkov.godfather.main.domain.keyboard.button.SimpleButton.simpleButton; import static dev.struchkov.godfather.main.domain.keyboard.simple.SimpleKeyBoardLine.simpleLine; +import static dev.struchkov.godfather.simple.domain.BoxAnswer.boxAnswer; import static dev.struchkov.godfather.telegram.domain.keyboard.InlineKeyBoard.inlineKeyBoard; import static dev.struchkov.godfather.telegram.domain.keyboard.button.UrlButton.urlButton; import static dev.struchkov.haiti.utils.Checker.checkNotNull; diff --git a/telegram-bot/src/main/java/dev/struchkov/bot/gitlab/telegram/service/notify/NewProjectNotifyGenerator.java b/telegram-bot/src/main/java/dev/struchkov/bot/gitlab/telegram/service/notify/NewProjectNotifyGenerator.java index fdb7b94..79784f2 100644 --- a/telegram-bot/src/main/java/dev/struchkov/bot/gitlab/telegram/service/notify/NewProjectNotifyGenerator.java +++ b/telegram-bot/src/main/java/dev/struchkov/bot/gitlab/telegram/service/notify/NewProjectNotifyGenerator.java @@ -3,7 +3,7 @@ package dev.struchkov.bot.gitlab.telegram.service.notify; import dev.struchkov.bot.gitlab.context.domain.notify.project.NewProjectNotify; import dev.struchkov.bot.gitlab.context.utils.Icons; import dev.struchkov.bot.gitlab.telegram.utils.Const; -import dev.struchkov.godfather.main.domain.BoxAnswer; +import dev.struchkov.godfather.simple.domain.BoxAnswer; import dev.struchkov.haiti.utils.Checker; import dev.struchkov.haiti.utils.Strings; import org.springframework.stereotype.Component; @@ -11,9 +11,9 @@ import org.springframework.stereotype.Component; import java.util.Optional; import static dev.struchkov.bot.gitlab.telegram.utils.UnitName.DELETE_MESSAGE; -import static dev.struchkov.godfather.main.domain.BoxAnswer.boxAnswer; import static dev.struchkov.godfather.main.domain.keyboard.button.SimpleButton.simpleButton; import static dev.struchkov.godfather.main.domain.keyboard.simple.SimpleKeyBoardLine.simpleLine; +import static dev.struchkov.godfather.simple.domain.BoxAnswer.boxAnswer; import static dev.struchkov.godfather.telegram.domain.keyboard.InlineKeyBoard.inlineKeyBoard; import static dev.struchkov.godfather.telegram.domain.keyboard.button.UrlButton.urlButton; import static dev.struchkov.haiti.utils.Strings.escapeMarkdown; diff --git a/telegram-bot/src/main/java/dev/struchkov/bot/gitlab/telegram/service/notify/DiscussionNewNotifyGenerator.java b/telegram-bot/src/main/java/dev/struchkov/bot/gitlab/telegram/service/notify/NewThreadNotifyGenerator.java similarity index 92% rename from telegram-bot/src/main/java/dev/struchkov/bot/gitlab/telegram/service/notify/DiscussionNewNotifyGenerator.java rename to telegram-bot/src/main/java/dev/struchkov/bot/gitlab/telegram/service/notify/NewThreadNotifyGenerator.java index c8d4cce..5ed1a4d 100644 --- a/telegram-bot/src/main/java/dev/struchkov/bot/gitlab/telegram/service/notify/DiscussionNewNotifyGenerator.java +++ b/telegram-bot/src/main/java/dev/struchkov/bot/gitlab/telegram/service/notify/NewThreadNotifyGenerator.java @@ -2,7 +2,7 @@ package dev.struchkov.bot.gitlab.telegram.service.notify; import dev.struchkov.bot.gitlab.context.domain.notify.task.DiscussionNewNotify; import dev.struchkov.bot.gitlab.context.utils.Icons; -import dev.struchkov.godfather.main.domain.BoxAnswer; +import dev.struchkov.godfather.simple.domain.BoxAnswer; import dev.struchkov.haiti.utils.Pair; import org.springframework.stereotype.Component; @@ -13,15 +13,15 @@ import static dev.struchkov.bot.gitlab.telegram.utils.Const.BUTTON_ARG_CONFIRMAT import static dev.struchkov.bot.gitlab.telegram.utils.Const.BUTTON_ARG_DISABLE_NOTIFY_THREAD_ID; import static dev.struchkov.bot.gitlab.telegram.utils.Const.BUTTON_VALUE_FALSE; import static dev.struchkov.bot.gitlab.telegram.utils.UnitName.DELETE_MESSAGE; -import static dev.struchkov.godfather.main.domain.BoxAnswer.boxAnswer; import static dev.struchkov.godfather.main.domain.keyboard.button.SimpleButton.simpleButton; +import static dev.struchkov.godfather.simple.domain.BoxAnswer.boxAnswer; import static dev.struchkov.godfather.telegram.domain.keyboard.InlineKeyBoard.inlineKeyBoard; import static dev.struchkov.godfather.telegram.domain.keyboard.button.UrlButton.urlButton; import static dev.struchkov.haiti.utils.Checker.checkNotEmpty; import static dev.struchkov.haiti.utils.Strings.escapeMarkdown; @Component -public class DiscussionNewNotifyGenerator implements NotifyBoxAnswerGenerator { +public class NewThreadNotifyGenerator implements NotifyBoxAnswerGenerator { @Override public BoxAnswer generate(DiscussionNewNotify notify) { diff --git a/telegram-bot/src/main/java/dev/struchkov/bot/gitlab/telegram/service/notify/NotifyBoxAnswerGenerator.java b/telegram-bot/src/main/java/dev/struchkov/bot/gitlab/telegram/service/notify/NotifyBoxAnswerGenerator.java index ac06aa9..79ad30f 100644 --- a/telegram-bot/src/main/java/dev/struchkov/bot/gitlab/telegram/service/notify/NotifyBoxAnswerGenerator.java +++ b/telegram-bot/src/main/java/dev/struchkov/bot/gitlab/telegram/service/notify/NotifyBoxAnswerGenerator.java @@ -1,6 +1,7 @@ package dev.struchkov.bot.gitlab.telegram.service.notify; -import dev.struchkov.godfather.main.domain.BoxAnswer; + +import dev.struchkov.godfather.simple.domain.BoxAnswer; import java.util.List; import java.util.stream.Collectors; diff --git a/telegram-bot/src/main/java/dev/struchkov/bot/gitlab/telegram/service/notify/PipelineNotifyGenerator.java b/telegram-bot/src/main/java/dev/struchkov/bot/gitlab/telegram/service/notify/PipelineNotifyGenerator.java index a61aa9d..27aa3d2 100644 --- a/telegram-bot/src/main/java/dev/struchkov/bot/gitlab/telegram/service/notify/PipelineNotifyGenerator.java +++ b/telegram-bot/src/main/java/dev/struchkov/bot/gitlab/telegram/service/notify/PipelineNotifyGenerator.java @@ -3,7 +3,7 @@ package dev.struchkov.bot.gitlab.telegram.service.notify; import dev.struchkov.bot.gitlab.context.domain.notify.pipeline.PipelineNotify; import dev.struchkov.bot.gitlab.context.service.ProjectService; import dev.struchkov.bot.gitlab.context.utils.Icons; -import dev.struchkov.godfather.main.domain.BoxAnswer; +import dev.struchkov.godfather.simple.domain.BoxAnswer; import dev.struchkov.haiti.utils.Strings; import lombok.RequiredArgsConstructor; import org.springframework.stereotype.Service; @@ -11,9 +11,9 @@ import org.springframework.stereotype.Service; import java.util.Optional; import static dev.struchkov.bot.gitlab.telegram.utils.UnitName.DELETE_MESSAGE; -import static dev.struchkov.godfather.main.domain.BoxAnswer.boxAnswer; import static dev.struchkov.godfather.main.domain.keyboard.button.SimpleButton.simpleButton; import static dev.struchkov.godfather.main.domain.keyboard.simple.SimpleKeyBoardLine.simpleLine; +import static dev.struchkov.godfather.simple.domain.BoxAnswer.boxAnswer; import static dev.struchkov.godfather.telegram.domain.keyboard.InlineKeyBoard.inlineKeyBoard; import static dev.struchkov.godfather.telegram.domain.keyboard.button.UrlButton.urlButton; diff --git a/telegram-bot/src/main/java/dev/struchkov/bot/gitlab/telegram/service/notify/StatusPrNotifyGenerator.java b/telegram-bot/src/main/java/dev/struchkov/bot/gitlab/telegram/service/notify/StatusMrNotifyGenerator.java similarity index 66% rename from telegram-bot/src/main/java/dev/struchkov/bot/gitlab/telegram/service/notify/StatusPrNotifyGenerator.java rename to telegram-bot/src/main/java/dev/struchkov/bot/gitlab/telegram/service/notify/StatusMrNotifyGenerator.java index 3c86804..a430b8b 100644 --- a/telegram-bot/src/main/java/dev/struchkov/bot/gitlab/telegram/service/notify/StatusPrNotifyGenerator.java +++ b/telegram-bot/src/main/java/dev/struchkov/bot/gitlab/telegram/service/notify/StatusMrNotifyGenerator.java @@ -2,21 +2,21 @@ package dev.struchkov.bot.gitlab.telegram.service.notify; import dev.struchkov.bot.gitlab.context.domain.notify.mergerequest.StatusMrNotify; import dev.struchkov.bot.gitlab.context.utils.Icons; -import dev.struchkov.godfather.main.domain.BoxAnswer; +import dev.struchkov.godfather.simple.domain.BoxAnswer; import org.springframework.stereotype.Component; -import static dev.struchkov.bot.gitlab.context.utils.Icons.link; -import static dev.struchkov.godfather.main.domain.BoxAnswer.boxAnswer; +import static dev.struchkov.godfather.simple.domain.BoxAnswer.boxAnswer; +import static dev.struchkov.haiti.utils.Strings.escapeMarkdown; @Component -public class StatusPrNotifyGenerator implements NotifyBoxAnswerGenerator { +public class StatusMrNotifyGenerator implements NotifyBoxAnswerGenerator { @Override public BoxAnswer generate(StatusMrNotify notify) { - final StringBuilder builder = new StringBuilder(Icons.PEN).append(" *MergeRequest status changed | ").append(notify.getProjectName()).append("*") + final StringBuilder builder = new StringBuilder(Icons.PEN).append(" *MergeRequest status changed*") .append(Icons.HR) - .append(link(notify.getTitle(), notify.getUrl())) + .append(escapeMarkdown(notify.getTitle())) .append(Icons.HR) .append(notify.getOldStatus().name()).append(Icons.ARROW).append(notify.getNewStatus().name()); diff --git a/telegram-bot/src/main/java/dev/struchkov/bot/gitlab/telegram/service/notify/TaskCloseNotifyGenerate.java b/telegram-bot/src/main/java/dev/struchkov/bot/gitlab/telegram/service/notify/ThreadCloseNotifyGenerate.java similarity index 80% rename from telegram-bot/src/main/java/dev/struchkov/bot/gitlab/telegram/service/notify/TaskCloseNotifyGenerate.java rename to telegram-bot/src/main/java/dev/struchkov/bot/gitlab/telegram/service/notify/ThreadCloseNotifyGenerate.java index be6d42a..231736b 100644 --- a/telegram-bot/src/main/java/dev/struchkov/bot/gitlab/telegram/service/notify/TaskCloseNotifyGenerate.java +++ b/telegram-bot/src/main/java/dev/struchkov/bot/gitlab/telegram/service/notify/ThreadCloseNotifyGenerate.java @@ -2,15 +2,15 @@ package dev.struchkov.bot.gitlab.telegram.service.notify; import dev.struchkov.bot.gitlab.context.domain.notify.task.TaskCloseNotify; import dev.struchkov.bot.gitlab.context.utils.Icons; -import dev.struchkov.godfather.main.domain.BoxAnswer; +import dev.struchkov.godfather.simple.domain.BoxAnswer; import org.springframework.stereotype.Component; import static dev.struchkov.bot.gitlab.context.utils.Icons.link; -import static dev.struchkov.godfather.main.domain.BoxAnswer.boxAnswer; +import static dev.struchkov.godfather.simple.domain.BoxAnswer.boxAnswer; import static dev.struchkov.haiti.utils.Strings.escapeMarkdown; @Component -public class TaskCloseNotifyGenerate implements NotifyBoxAnswerGenerator { +public class ThreadCloseNotifyGenerate implements NotifyBoxAnswerGenerator { @Override public BoxAnswer generate(TaskCloseNotify notify) { diff --git a/telegram-bot/src/main/java/dev/struchkov/bot/gitlab/telegram/service/notify/UpdatePrNotifyGenerator.java b/telegram-bot/src/main/java/dev/struchkov/bot/gitlab/telegram/service/notify/UpdateMrNotifyGenerator.java similarity index 93% rename from telegram-bot/src/main/java/dev/struchkov/bot/gitlab/telegram/service/notify/UpdatePrNotifyGenerator.java rename to telegram-bot/src/main/java/dev/struchkov/bot/gitlab/telegram/service/notify/UpdateMrNotifyGenerator.java index 97417a0..c7b2f52 100644 --- a/telegram-bot/src/main/java/dev/struchkov/bot/gitlab/telegram/service/notify/UpdatePrNotifyGenerator.java +++ b/telegram-bot/src/main/java/dev/struchkov/bot/gitlab/telegram/service/notify/UpdateMrNotifyGenerator.java @@ -2,23 +2,23 @@ package dev.struchkov.bot.gitlab.telegram.service.notify; import dev.struchkov.bot.gitlab.context.domain.notify.mergerequest.UpdateMrNotify; import dev.struchkov.bot.gitlab.context.utils.Icons; -import dev.struchkov.godfather.main.domain.BoxAnswer; +import dev.struchkov.godfather.simple.domain.BoxAnswer; import org.springframework.stereotype.Component; import static dev.struchkov.bot.gitlab.telegram.utils.Const.BUTTON_ARG_CONFIRMATION; import static dev.struchkov.bot.gitlab.telegram.utils.Const.BUTTON_ARG_DISABLE_NOTIFY_MR_ID; import static dev.struchkov.bot.gitlab.telegram.utils.Const.BUTTON_VALUE_FALSE; import static dev.struchkov.bot.gitlab.telegram.utils.UnitName.DELETE_MESSAGE; -import static dev.struchkov.godfather.main.domain.BoxAnswer.boxAnswer; import static dev.struchkov.godfather.main.domain.keyboard.button.SimpleButton.simpleButton; import static dev.struchkov.godfather.main.domain.keyboard.simple.SimpleKeyBoardLine.simpleLine; +import static dev.struchkov.godfather.simple.domain.BoxAnswer.boxAnswer; import static dev.struchkov.godfather.telegram.domain.keyboard.InlineKeyBoard.inlineKeyBoard; import static dev.struchkov.godfather.telegram.domain.keyboard.button.UrlButton.urlButton; import static dev.struchkov.haiti.utils.Checker.checkNotNull; import static dev.struchkov.haiti.utils.Strings.escapeMarkdown; @Component -public class UpdatePrNotifyGenerator implements NotifyBoxAnswerGenerator { +public class UpdateMrNotifyGenerator implements NotifyBoxAnswerGenerator { @Override public BoxAnswer generate(UpdateMrNotify notify) { diff --git a/telegram-bot/src/main/java/dev/struchkov/bot/gitlab/telegram/unit/MenuConfig.java b/telegram-bot/src/main/java/dev/struchkov/bot/gitlab/telegram/unit/MenuConfig.java index 02f392f..85be065 100644 --- a/telegram-bot/src/main/java/dev/struchkov/bot/gitlab/telegram/unit/MenuConfig.java +++ b/telegram-bot/src/main/java/dev/struchkov/bot/gitlab/telegram/unit/MenuConfig.java @@ -11,15 +11,16 @@ import dev.struchkov.bot.gitlab.context.utils.Icons; import dev.struchkov.bot.gitlab.core.config.properties.GitlabProperty; import dev.struchkov.bot.gitlab.core.service.parser.ProjectParser; import dev.struchkov.bot.gitlab.telegram.utils.UnitName; -import dev.struchkov.godfather.main.domain.BoxAnswer; import dev.struchkov.godfather.main.domain.annotation.Unit; import dev.struchkov.godfather.main.domain.content.Mail; import dev.struchkov.godfather.simple.core.unit.AnswerText; import dev.struchkov.godfather.simple.core.unit.MainUnit; +import dev.struchkov.godfather.simple.domain.BoxAnswer; import dev.struchkov.godfather.telegram.domain.attachment.LinkAttachment; import dev.struchkov.godfather.telegram.domain.keyboard.InlineKeyBoard; import dev.struchkov.godfather.telegram.main.context.MailPayload; import dev.struchkov.godfather.telegram.main.core.util.Attachments; +import dev.struchkov.godfather.telegram.simple.context.service.TelegramService; import dev.struchkov.haiti.utils.Checker; import lombok.RequiredArgsConstructor; import org.springframework.stereotype.Component; @@ -36,10 +37,10 @@ import static dev.struchkov.bot.gitlab.telegram.utils.UnitName.GET_ASSIGNEE_MERG import static dev.struchkov.bot.gitlab.telegram.utils.UnitName.GET_TASKS; import static dev.struchkov.bot.gitlab.telegram.utils.UnitName.SETTINGS; import static dev.struchkov.bot.gitlab.telegram.utils.UnitName.TEXT_ADD_NEW_PROJECT; -import static dev.struchkov.godfather.main.domain.BoxAnswer.boxAnswer; -import static dev.struchkov.godfather.main.domain.BoxAnswer.replaceBoxAnswer; import static dev.struchkov.godfather.main.domain.keyboard.button.SimpleButton.simpleButton; import static dev.struchkov.godfather.main.domain.keyboard.simple.SimpleKeyBoardLine.simpleLine; +import static dev.struchkov.godfather.simple.domain.BoxAnswer.boxAnswer; +import static dev.struchkov.godfather.simple.domain.BoxAnswer.replaceBoxAnswer; import static dev.struchkov.godfather.telegram.domain.keyboard.InlineKeyBoard.inlineKeyBoard; import static dev.struchkov.godfather.telegram.simple.core.util.TriggerChecks.clickButtonRaw; import static dev.struchkov.godfather.telegram.simple.core.util.TriggerChecks.isLinks; @@ -59,6 +60,7 @@ public class MenuConfig { private final ProjectParser projectParser; + private final TelegramService telegramService; private final ProjectService projectService; private final NoteService noteService; private final MergeRequestsService mergeRequestsService; @@ -79,7 +81,10 @@ public class MenuConfig { ).append("\n") .append("\uD83D\uDCAC: ").append(message.getText()) .toString(); - return BoxAnswer.builder().recipientPersonId(personInformation.getTelegramId()).message(messageText).build(); + return BoxAnswer.builder() + .recipientPersonId(personInformation.getTelegramId()) + .message(messageText) + .build(); }) .build(); } diff --git a/telegram-bot/src/main/java/dev/struchkov/bot/gitlab/telegram/unit/command/AnswerNoteUnit.java b/telegram-bot/src/main/java/dev/struchkov/bot/gitlab/telegram/unit/command/AnswerNoteUnit.java index 0848aad..48dc1bf 100644 --- a/telegram-bot/src/main/java/dev/struchkov/bot/gitlab/telegram/unit/command/AnswerNoteUnit.java +++ b/telegram-bot/src/main/java/dev/struchkov/bot/gitlab/telegram/unit/command/AnswerNoteUnit.java @@ -10,19 +10,17 @@ import dev.struchkov.godfather.main.domain.content.Mail; import dev.struchkov.godfather.simple.core.unit.AnswerText; import dev.struchkov.godfather.telegram.domain.attachment.LinkAttachment; import dev.struchkov.godfather.telegram.main.core.util.Attachments; -import dev.struchkov.godfather.telegram.simple.context.service.TelegramSending; import dev.struchkov.haiti.utils.Checker; import lombok.RequiredArgsConstructor; import org.springframework.stereotype.Component; import java.text.MessageFormat; import java.util.List; -import java.util.concurrent.ScheduledExecutorService; import java.util.regex.Matcher; import java.util.regex.Pattern; import static dev.struchkov.bot.gitlab.telegram.utils.UnitName.ANSWER_NOTE; -import static dev.struchkov.godfather.main.domain.BoxAnswer.boxAnswer; +import static dev.struchkov.godfather.simple.domain.BoxAnswer.boxAnswer; @Component @RequiredArgsConstructor @@ -34,8 +32,6 @@ public class AnswerNoteUnit { private final AppSettingService settingService; private final NoteService noteService; private final DiscussionService discussionService; - private final ScheduledExecutorService scheduledExecutorService; - private final TelegramSending telegramSending; //TODO [07.02.2023|uPagge]: Можно возвращать ссылку на ответ @Unit(value = ANSWER_NOTE, global = true) diff --git a/telegram-bot/src/main/java/dev/struchkov/bot/gitlab/telegram/unit/command/DisableNotifyMrUnit.java b/telegram-bot/src/main/java/dev/struchkov/bot/gitlab/telegram/unit/command/DisableNotifyMrUnit.java index 90a5808..b03b9f5 100644 --- a/telegram-bot/src/main/java/dev/struchkov/bot/gitlab/telegram/unit/command/DisableNotifyMrUnit.java +++ b/telegram-bot/src/main/java/dev/struchkov/bot/gitlab/telegram/unit/command/DisableNotifyMrUnit.java @@ -22,9 +22,9 @@ import static dev.struchkov.bot.gitlab.telegram.utils.Const.BUTTON_ARG_DISABLE_N import static dev.struchkov.bot.gitlab.telegram.utils.Const.BUTTON_VALUE_TRUE; import static dev.struchkov.bot.gitlab.telegram.utils.UnitName.DELETE_MESSAGE; import static dev.struchkov.bot.gitlab.telegram.utils.UnitName.DISABLE_NOTIFY_MR; -import static dev.struchkov.godfather.main.domain.BoxAnswer.replaceBoxAnswer; import static dev.struchkov.godfather.main.domain.keyboard.button.SimpleButton.simpleButton; import static dev.struchkov.godfather.main.domain.keyboard.simple.SimpleKeyBoardLine.simpleLine; +import static dev.struchkov.godfather.simple.domain.BoxAnswer.replaceBoxAnswer; import static dev.struchkov.godfather.telegram.domain.keyboard.InlineKeyBoard.inlineKeyBoard; @Component diff --git a/telegram-bot/src/main/java/dev/struchkov/bot/gitlab/telegram/unit/command/DisableNotifyThreadUnit.java b/telegram-bot/src/main/java/dev/struchkov/bot/gitlab/telegram/unit/command/DisableNotifyThreadUnit.java index 024f4b4..ea4ac01 100644 --- a/telegram-bot/src/main/java/dev/struchkov/bot/gitlab/telegram/unit/command/DisableNotifyThreadUnit.java +++ b/telegram-bot/src/main/java/dev/struchkov/bot/gitlab/telegram/unit/command/DisableNotifyThreadUnit.java @@ -22,9 +22,9 @@ import static dev.struchkov.bot.gitlab.telegram.utils.Const.BUTTON_ARG_DISABLE_N import static dev.struchkov.bot.gitlab.telegram.utils.Const.BUTTON_VALUE_TRUE; import static dev.struchkov.bot.gitlab.telegram.utils.UnitName.DELETE_MESSAGE; import static dev.struchkov.bot.gitlab.telegram.utils.UnitName.DISABLE_NOTIFY_THREAD; -import static dev.struchkov.godfather.main.domain.BoxAnswer.replaceBoxAnswer; import static dev.struchkov.godfather.main.domain.keyboard.button.SimpleButton.simpleButton; import static dev.struchkov.godfather.main.domain.keyboard.simple.SimpleKeyBoardLine.simpleLine; +import static dev.struchkov.godfather.simple.domain.BoxAnswer.replaceBoxAnswer; import static dev.struchkov.godfather.telegram.domain.keyboard.InlineKeyBoard.inlineKeyBoard; @Component diff --git a/telegram-bot/src/main/java/dev/struchkov/bot/gitlab/telegram/unit/command/EnableProjectNotify.java b/telegram-bot/src/main/java/dev/struchkov/bot/gitlab/telegram/unit/command/EnableProjectNotify.java index 2db429b..8801249 100644 --- a/telegram-bot/src/main/java/dev/struchkov/bot/gitlab/telegram/unit/command/EnableProjectNotify.java +++ b/telegram-bot/src/main/java/dev/struchkov/bot/gitlab/telegram/unit/command/EnableProjectNotify.java @@ -22,7 +22,7 @@ import java.util.concurrent.ScheduledExecutorService; import java.util.concurrent.TimeUnit; import static dev.struchkov.bot.gitlab.telegram.utils.Const.BUTTON_ARG_ENABLE_NOTIFY_PROJECT_ID; -import static dev.struchkov.godfather.main.domain.BoxAnswer.replaceBoxAnswer; +import static dev.struchkov.godfather.simple.domain.BoxAnswer.replaceBoxAnswer; @Component @RequiredArgsConstructor @@ -65,7 +65,7 @@ public class EnableProjectNotify { return replaceBoxAnswer(mail.getId(), Icons.GOOD + " you will now receive notifications!"); } ) - .callBack( + .callBack( sentBox -> scheduledExecutorService.schedule(() -> sending.deleteMessage(sentBox.getPersonId(), sentBox.getMessageId()), 5, TimeUnit.SECONDS) ) .build(); diff --git a/telegram-bot/src/main/java/dev/struchkov/bot/gitlab/telegram/unit/flow/InitSettingFlow.java b/telegram-bot/src/main/java/dev/struchkov/bot/gitlab/telegram/unit/flow/InitSettingFlow.java index 6df7fc6..f129323 100644 --- a/telegram-bot/src/main/java/dev/struchkov/bot/gitlab/telegram/unit/flow/InitSettingFlow.java +++ b/telegram-bot/src/main/java/dev/struchkov/bot/gitlab/telegram/unit/flow/InitSettingFlow.java @@ -11,11 +11,11 @@ import dev.struchkov.bot.gitlab.core.service.parser.DiscussionParser; import dev.struchkov.bot.gitlab.core.service.parser.MergeRequestParser; import dev.struchkov.bot.gitlab.core.service.parser.PipelineParser; import dev.struchkov.bot.gitlab.core.service.parser.ProjectParser; -import dev.struchkov.godfather.main.domain.BoxAnswer; import dev.struchkov.godfather.main.domain.annotation.Unit; import dev.struchkov.godfather.main.domain.content.Mail; import dev.struchkov.godfather.simple.core.unit.AnswerText; import dev.struchkov.godfather.simple.core.unit.MainUnit; +import dev.struchkov.godfather.simple.domain.BoxAnswer; import dev.struchkov.godfather.telegram.domain.attachment.ButtonClickAttachment; import dev.struchkov.godfather.telegram.main.core.util.Attachments; import dev.struchkov.godfather.telegram.simple.context.service.TelegramSending; @@ -42,10 +42,10 @@ import static dev.struchkov.bot.gitlab.telegram.utils.UnitName.TEXT_PARSER_PRIVA import static dev.struchkov.bot.gitlab.telegram.utils.UnitName.TEXT_PRIVACY_SETTING; import static dev.struchkov.bot.gitlab.telegram.utils.UnitName.TEXT_PRIVACY_SETTING_THREAD_LEVEL; import static dev.struchkov.godfather.main.core.unit.UnitActiveType.AFTER; -import static dev.struchkov.godfather.main.domain.BoxAnswer.boxAnswer; -import static dev.struchkov.godfather.main.domain.BoxAnswer.replaceBoxAnswer; import static dev.struchkov.godfather.main.domain.keyboard.button.SimpleButton.simpleButton; import static dev.struchkov.godfather.main.domain.keyboard.simple.SimpleKeyBoardLine.simpleLine; +import static dev.struchkov.godfather.simple.domain.BoxAnswer.boxAnswer; +import static dev.struchkov.godfather.simple.domain.BoxAnswer.replaceBoxAnswer; import static dev.struchkov.godfather.telegram.domain.keyboard.InlineKeyBoard.inlineKeyBoard; import static dev.struchkov.godfather.telegram.main.context.BoxAnswerPayload.DISABLE_WEB_PAGE_PREVIEW; import static dev.struchkov.godfather.telegram.main.core.util.InlineKeyBoards.verticalMenuButton;