From b49b7d2829d1afd0642455fe9affc2d83703c535 Mon Sep 17 00:00:00 2001 From: Struchkov Mark Date: Wed, 15 Feb 2023 23:18:03 +0300 Subject: [PATCH] =?UTF-8?q?=D0=9D=D0=B5=D0=B1=D0=BE=D0=BB=D1=8C=D1=88?= =?UTF-8?q?=D0=B8=D0=B5=20=D0=B4=D0=BE=D1=80=D0=B0=D0=B1=D0=BE=D1=82=D0=BA?= =?UTF-8?q?=D0=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../bot/gitlab/core/service/parser/ProjectParser.java | 2 +- .../bot/gitlab/telegram/service/StartNotify.java | 8 ++++++++ .../struchkov/bot/gitlab/telegram/unit/MenuConfig.java | 10 +++++++--- 3 files changed, 16 insertions(+), 4 deletions(-) diff --git a/bot-core/src/main/java/dev/struchkov/bot/gitlab/core/service/parser/ProjectParser.java b/bot-core/src/main/java/dev/struchkov/bot/gitlab/core/service/parser/ProjectParser.java index d644ac5..925fcab 100644 --- a/bot-core/src/main/java/dev/struchkov/bot/gitlab/core/service/parser/ProjectParser.java +++ b/bot-core/src/main/java/dev/struchkov/bot/gitlab/core/service/parser/ProjectParser.java @@ -92,7 +92,7 @@ public class ProjectParser { .header(ACCEPT) .header(StringUtils.H_PRIVATE_TOKEN, personProperty.getToken()) .execute(ProjectJson.class) - .orElseThrow(convertException("Ошибка получения репозитория.")); + .orElseThrow(convertException("Error adding a repository")); if (!projectService.existsById(projectJson.getId())) { createNewPersons(List.of(projectJson)); final Project newProject = conversionService.convert(projectJson, Project.class); 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 e1556f8..6bd3e22 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 @@ -10,6 +10,9 @@ import jakarta.annotation.PostConstruct; import lombok.RequiredArgsConstructor; import org.springframework.stereotype.Component; +import static dev.struchkov.godfather.main.domain.keyboard.button.SimpleButton.simpleButton; +import static dev.struchkov.godfather.telegram.domain.keyboard.InlineKeyBoard.inlineKeyBoard; + /** * @author upagge 19.01.2021 */ @@ -34,6 +37,11 @@ public class StartNotify { "\n\uD83D\uDC68\u200D\uD83D\uDCBB️ Developer: [uPagge](https://mark.struchkov.dev)" + "\n\uD83D\uDC1B Issue: [GitHub Issue](https://github.com/uPagge/gitlab-notification/issues)" ) + .keyBoard( + inlineKeyBoard( + simpleButton("Open General Menu", "/start") + ) + ) .payload(BoxAnswerPayload.DISABLE_WEB_PAGE_PREVIEW, true) .build(); 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 1d2e26d..02f392f 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 @@ -84,7 +84,7 @@ public class MenuConfig { .build(); } - @Unit(value = GENERAL_MENU, main = true) + @Unit(value = GENERAL_MENU, main = true, global = true) public AnswerText menu( @Unit(SETTINGS) MainUnit settings, @Unit(TEXT_ADD_NEW_PROJECT) MainUnit textAddNewProject, @@ -102,9 +102,13 @@ public class MenuConfig { return false; }) .answer(mail -> { - final String messageText = "This is the bot menu, select a new item"; + final String messageText = """ + This is the bot menu, select a item. + -- -- -- -- -- + At the moment, you can only add new repositories. But in future versions, the possibilities will expand. + """; final InlineKeyBoard generalMenuKeyBoard = inlineKeyBoard( - simpleLine(simpleButton("Add project", TEXT_ADD_NEW_PROJECT)) + simpleLine(simpleButton("Add repository", TEXT_ADD_NEW_PROJECT)) // simpleLine( // simpleButton("My tasks", GET_TASKS), // simpleButton("Merge Request", GET_ASSIGNEE_MERGE_REQUEST)