Исправление форматирования сообщений

This commit is contained in:
Struchkov Mark 2024-01-19 20:41:34 +03:00
parent 4eb678ce53
commit 905e13053e
No known key found for this signature in database
GPG Key ID: A3F0AC3F0FA52F3C
2 changed files with 15 additions and 9 deletions

View File

@ -3,6 +3,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.simple.domain.BoxAnswer;
import dev.struchkov.godfather.telegram.main.context.BoxAnswerPayload;
import org.springframework.stereotype.Component;
import java.util.List;
@ -12,7 +13,6 @@ 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.simple.domain.BoxAnswer.boxAnswer;
import static dev.struchkov.godfather.telegram.domain.keyboard.InlineKeyBoard.inlineKeyBoard;
import static dev.struchkov.godfather.telegram.domain.keyboard.SimpleKeyBoardLine.keyBoardLine;
import static dev.struchkov.godfather.telegram.domain.keyboard.button.SimpleButton.simpleButton;
@ -59,16 +59,19 @@ public class NewMrForAssigneeNotifyGenerator implements NotifyBoxAnswerGenerator
final String notifyMessage = builder.toString();
return boxAnswer(
notifyMessage,
inlineKeyBoard(
keyBoardLine(
simpleButton(Icons.VIEW, DELETE_MESSAGE),
urlButton(Icons.LINK, notify.getUrl()),
simpleButton(Icons.DISABLE_NOTIFY, "[" + BUTTON_ARG_DISABLE_NOTIFY_MR_ID + ":" + notify.getMrId() + ";" + BUTTON_ARG_CONFIRMATION + ":" + BUTTON_VALUE_FALSE + "]")
return BoxAnswer.builder()
.message(notifyMessage)
.keyBoard(
inlineKeyBoard(
keyBoardLine(
simpleButton(Icons.VIEW, DELETE_MESSAGE),
urlButton(Icons.LINK, notify.getUrl()),
simpleButton(Icons.DISABLE_NOTIFY, "[" + BUTTON_ARG_DISABLE_NOTIFY_MR_ID + ":" + notify.getMrId() + ";" + BUTTON_ARG_CONFIRMATION + ":" + BUTTON_VALUE_FALSE + "]")
)
)
)
);
.payload(BoxAnswerPayload.ENABLE_MARKDOWN)
.build();
}
@Override

View File

@ -50,6 +50,7 @@ import static dev.struchkov.godfather.telegram.domain.keyboard.InlineKeyBoard.in
import static dev.struchkov.godfather.telegram.domain.keyboard.SimpleKeyBoardLine.keyBoardLine;
import static dev.struchkov.godfather.telegram.domain.keyboard.button.SimpleButton.simpleButton;
import static dev.struchkov.godfather.telegram.main.context.BoxAnswerPayload.DISABLE_WEB_PAGE_PREVIEW;
import static dev.struchkov.godfather.telegram.main.context.BoxAnswerPayload.ENABLE_MARKDOWN;
import static dev.struchkov.godfather.telegram.main.core.util.InlineKeyBoards.verticalMenuButton;
import static dev.struchkov.godfather.telegram.main.core.util.UnitTrigger.clickButtonRaw;
import static dev.struchkov.godfather.telegram.main.core.util.UnitTrigger.isButtonClick;
@ -118,6 +119,7 @@ public class InitSettingFlow implements PersonUnitConfiguration {
"""
)
.payload(DISABLE_WEB_PAGE_PREVIEW, true)
.payload(ENABLE_MARKDOWN, true)
.keyBoard(
inlineKeyBoard(
keyBoardLine(
@ -609,6 +611,7 @@ public class InitSettingFlow implements PersonUnitConfiguration {
"""
).keyBoard(inlineKeyBoard(simpleButton("Open Menu", "/start")))
.payload(DISABLE_WEB_PAGE_PREVIEW, true)
.payload(ENABLE_MARKDOWN)
.build();
}
)