aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/com/juick
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/com/juick')
-rw-r--r--src/main/java/com/juick/TelegramBotManager.java4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/main/java/com/juick/TelegramBotManager.java b/src/main/java/com/juick/TelegramBotManager.java
index 3335b61af..dec0bd1de 100644
--- a/src/main/java/com/juick/TelegramBotManager.java
+++ b/src/main/java/com/juick/TelegramBotManager.java
@@ -60,6 +60,7 @@ import java.io.IOException;
import java.net.URI;
import java.net.URL;
import java.util.*;
+import java.util.stream.Stream;
import static com.juick.util.formatters.PlainTextFormatter.formatPost;
import static com.juick.util.formatters.PlainTextFormatter.formatUrl;
@@ -147,7 +148,8 @@ public class TelegramBotManager implements NotificationListener {
com.juick.model.Message originalMessage = rid == 0 ? messagesService.getMessage(mid).orElseThrow(IllegalStateException::new)
: messagesService.getReply(mid, rid);
User author = originalMessage.getUser();
- String newMessageText = StringUtils.defaultString(message.text());
+ String newMessageText = Stream.of(message.text(), message.caption()).filter(Objects::nonNull)
+ .findFirst().orElse(StringUtils.EMPTY);
if (user_from.equals(author) && canUpdateMessage(originalMessage, newMessageText)) {
if (messagesService.updateMessage(mid, rid, newMessageText, false)) {
telegramNotify(message.chat().id(), "Message updated", new com.juick.model.Message());