При разбивке большого сообщения на несколько добавил клавиатуру в последнее сообщение
This commit is contained in:
parent
824a95a305
commit
23e01a3145
@ -320,19 +320,21 @@ public class TelegramSender implements TelegramSending {
|
||||
while (message.length() > maxMessageLength) {
|
||||
String subMessage = message.substring(0, maxMessageLength);
|
||||
message = message.substring(maxMessageLength);
|
||||
split.add(createNewTextAnswer(boxAnswer, subMessage));
|
||||
split.add(createNewTextAnswer(boxAnswer, subMessage, false));
|
||||
}
|
||||
|
||||
split.add(createNewTextAnswer(boxAnswer, message));
|
||||
split.add(createNewTextAnswer(boxAnswer, message, true));
|
||||
|
||||
return Multi.createFrom().iterable(split);
|
||||
}
|
||||
|
||||
private SendMessage createNewTextAnswer(BoxAnswer boxAnswer, String subMessage) {
|
||||
private SendMessage createNewTextAnswer(BoxAnswer boxAnswer, String subMessage, boolean lastMessage) {
|
||||
final SendMessage sendMessage = new SendMessage();
|
||||
sendMessage.setChatId(boxAnswer.getRecipientPersonId());
|
||||
sendMessage.setText(subMessage);
|
||||
if (lastMessage) {
|
||||
sendMessage.setReplyMarkup(convertKeyBoard(boxAnswer.getKeyBoard()));
|
||||
}
|
||||
|
||||
boxAnswer.getPayLoad(ENABLE_MARKDOWN).ifPresent(sendMessage::enableMarkdown);
|
||||
boxAnswer.getPayLoad(ENABLE_HTML).ifPresent(sendMessage::enableHtml);
|
||||
|
Loading…
Reference in New Issue
Block a user