Добавил поддержку html
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
27f21ce24a
commit
ae6ffab2a8
@ -9,6 +9,7 @@ public final class BoxAnswerPayload {
|
||||
public static final ContextKey<Boolean> DISABLE_WEB_PAGE_PREVIEW = ContextKey.of("DISABLE_WEB_PAGE_PREVIEW", Boolean.class);
|
||||
public static final ContextKey<Boolean> DISABLE_NOTIFICATION = ContextKey.of("DISABLE_NOTIFICATION", Boolean.class);
|
||||
public static final ContextKey<Boolean> ENABLE_MARKDOWN = ContextKey.of("ENABLE_MARKDOWN", Boolean.class);
|
||||
public static final ContextKey<Boolean> ENABLE_HTML = ContextKey.of("ENABLE_HTML", Boolean.class);
|
||||
public static final ContextKey<SendInvoice> INVOICE = ContextKey.of("INVOICE", SendInvoice.class);
|
||||
|
||||
private BoxAnswerPayload() {
|
||||
|
@ -32,6 +32,7 @@ import java.util.concurrent.CompletableFuture;
|
||||
|
||||
import static dev.struchkov.godfather.telegram.main.context.BoxAnswerPayload.DISABLE_NOTIFICATION;
|
||||
import static dev.struchkov.godfather.telegram.main.context.BoxAnswerPayload.DISABLE_WEB_PAGE_PREVIEW;
|
||||
import static dev.struchkov.godfather.telegram.main.context.BoxAnswerPayload.ENABLE_HTML;
|
||||
import static dev.struchkov.godfather.telegram.main.context.BoxAnswerPayload.ENABLE_MARKDOWN;
|
||||
import static dev.struchkov.godfather.telegram.main.sender.util.KeyBoardConvert.convertInlineKeyBoard;
|
||||
import static dev.struchkov.godfather.telegram.main.sender.util.KeyBoardConvert.convertKeyBoard;
|
||||
@ -103,6 +104,7 @@ public class TelegramSender implements TelegramSending {
|
||||
editMessageText.setReplyMarkup(convertInlineKeyBoard((InlineKeyBoard) boxAnswer.getKeyBoard()));
|
||||
|
||||
boxAnswer.getPayLoad(ENABLE_MARKDOWN).ifPresent(editMessageText::enableMarkdown);
|
||||
boxAnswer.getPayLoad(ENABLE_HTML).ifPresent(editMessageText::enableHtml);
|
||||
boxAnswer.getPayLoad(DISABLE_WEB_PAGE_PREVIEW).ifPresent(
|
||||
isDisable -> {
|
||||
if (TRUE.equals(isDisable)) editMessageText.disableWebPagePreview();
|
||||
@ -170,6 +172,7 @@ public class TelegramSender implements TelegramSending {
|
||||
editMessageText.setReplyMarkup(convertInlineKeyBoard((InlineKeyBoard) boxAnswer.getKeyBoard()));
|
||||
|
||||
boxAnswer.getPayLoad(ENABLE_MARKDOWN).ifPresent(editMessageText::enableMarkdown);
|
||||
boxAnswer.getPayLoad(ENABLE_HTML).ifPresent(editMessageText::enableHtml);
|
||||
boxAnswer.getPayLoad(DISABLE_WEB_PAGE_PREVIEW).ifPresent(isDisable -> {
|
||||
if (TRUE.equals(isDisable)) editMessageText.disableWebPagePreview();
|
||||
});
|
||||
@ -249,6 +252,7 @@ public class TelegramSender implements TelegramSending {
|
||||
sendMessage.setReplyMarkup(convertKeyBoard(boxAnswer.getKeyBoard()));
|
||||
|
||||
boxAnswer.getPayLoad(ENABLE_MARKDOWN).ifPresent(sendMessage::enableMarkdown);
|
||||
boxAnswer.getPayLoad(ENABLE_HTML).ifPresent(sendMessage::enableHtml);
|
||||
boxAnswer.getPayLoad(DISABLE_WEB_PAGE_PREVIEW).ifPresent(isDisable -> {
|
||||
if (TRUE.equals(isDisable)) sendMessage.disableWebPagePreview();
|
||||
});
|
||||
|
@ -17,6 +17,7 @@ import dev.struchkov.godfather.telegram.simple.domain.attachment.send.PhotoSendA
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.telegram.telegrambots.meta.api.methods.ParseMode;
|
||||
import org.telegram.telegrambots.meta.api.methods.invoices.SendInvoice;
|
||||
import org.telegram.telegrambots.meta.api.methods.send.SendDocument;
|
||||
import org.telegram.telegrambots.meta.api.methods.send.SendMessage;
|
||||
@ -36,6 +37,7 @@ import java.util.Optional;
|
||||
|
||||
import static dev.struchkov.godfather.telegram.main.context.BoxAnswerPayload.DISABLE_NOTIFICATION;
|
||||
import static dev.struchkov.godfather.telegram.main.context.BoxAnswerPayload.DISABLE_WEB_PAGE_PREVIEW;
|
||||
import static dev.struchkov.godfather.telegram.main.context.BoxAnswerPayload.ENABLE_HTML;
|
||||
import static dev.struchkov.godfather.telegram.main.context.BoxAnswerPayload.ENABLE_MARKDOWN;
|
||||
import static dev.struchkov.godfather.telegram.main.sender.util.KeyBoardConvert.convertInlineKeyBoard;
|
||||
import static dev.struchkov.godfather.telegram.main.sender.util.KeyBoardConvert.convertKeyBoard;
|
||||
@ -105,6 +107,7 @@ public class TelegramSender implements TelegramSending {
|
||||
editMessageText.setReplyMarkup(convertInlineKeyBoard((InlineKeyBoard) boxAnswer.getKeyBoard()));
|
||||
|
||||
boxAnswer.getPayLoad(ENABLE_MARKDOWN).ifPresent(editMessageText::enableMarkdown);
|
||||
boxAnswer.getPayLoad(ENABLE_HTML).ifPresent(editMessageText::enableHtml);
|
||||
boxAnswer.getPayLoad(DISABLE_WEB_PAGE_PREVIEW).ifPresent(isDisable -> {
|
||||
if (TRUE.equals(isDisable)) editMessageText.disableWebPagePreview();
|
||||
});
|
||||
@ -173,6 +176,7 @@ public class TelegramSender implements TelegramSending {
|
||||
editMessageText.setReplyMarkup(convertInlineKeyBoard((InlineKeyBoard) boxAnswer.getKeyBoard()));
|
||||
|
||||
boxAnswer.getPayLoad(ENABLE_MARKDOWN).ifPresent(editMessageText::enableMarkdown);
|
||||
boxAnswer.getPayLoad(ENABLE_HTML).ifPresent(editMessageText::enableHtml);
|
||||
boxAnswer.getPayLoad(DISABLE_WEB_PAGE_PREVIEW).ifPresent(isDisable -> {
|
||||
if (TRUE.equals(isDisable)) editMessageText.disableWebPagePreview();
|
||||
});
|
||||
@ -242,7 +246,10 @@ public class TelegramSender implements TelegramSending {
|
||||
if (TRUE.equals(isDisable)) sendPhoto.disableNotification();
|
||||
});
|
||||
boxAnswer.getPayLoad(ENABLE_MARKDOWN).ifPresent(isEnable -> {
|
||||
if (TRUE.equals(isEnable)) sendPhoto.setParseMode("Markdown");
|
||||
if (TRUE.equals(isEnable)) sendPhoto.setParseMode(ParseMode.MARKDOWN);
|
||||
});
|
||||
boxAnswer.getPayLoad(ENABLE_HTML).ifPresent(isEnable -> {
|
||||
if (TRUE.equals(isEnable)) sendPhoto.setParseMode(ParseMode.HTML);
|
||||
});
|
||||
|
||||
Message execute = null;
|
||||
@ -280,7 +287,10 @@ public class TelegramSender implements TelegramSending {
|
||||
if (TRUE.equals(isDisable)) sendDocument.disableNotification();
|
||||
});
|
||||
boxAnswer.getPayLoad(ENABLE_MARKDOWN).ifPresent(isEnable -> {
|
||||
if (TRUE.equals(isEnable)) sendDocument.setParseMode("Markdown");
|
||||
if (TRUE.equals(isEnable)) sendDocument.setParseMode(ParseMode.MARKDOWN);
|
||||
});
|
||||
boxAnswer.getPayLoad(ENABLE_HTML).ifPresent(isEnable -> {
|
||||
if (TRUE.equals(isEnable)) sendDocument.setParseMode(ParseMode.HTML);
|
||||
});
|
||||
|
||||
Message execute = null;
|
||||
@ -358,6 +368,7 @@ public class TelegramSender implements TelegramSending {
|
||||
sendMessage.setReplyMarkup(convertKeyBoard(boxAnswer.getKeyBoard()));
|
||||
|
||||
boxAnswer.getPayLoad(ENABLE_MARKDOWN).ifPresent(sendMessage::enableMarkdown);
|
||||
boxAnswer.getPayLoad(ENABLE_HTML).ifPresent(sendMessage::enableHtml);
|
||||
boxAnswer.getPayLoad(DISABLE_WEB_PAGE_PREVIEW).ifPresent(isDisable -> {
|
||||
if (TRUE.equals(isDisable)) sendMessage.disableWebPagePreview();
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user