aboutsummaryrefslogtreecommitdiff
path: root/juick-server
diff options
context:
space:
mode:
authorGravatar Vitaly Takmazov2018-02-26 11:12:31 +0300
committerGravatar Vitaly Takmazov2018-02-26 11:12:31 +0300
commit230cf552ce3f4a693d445e2e328975c699bf5f28 (patch)
tree96b8c5660f6ca2f4dbabb718de0a667e4e34c14e /juick-server
parent81f82943e8c37f47bd02d7490935121ff16f6d71 (diff)
telegram: trim photo caption to 200 characters
Diffstat (limited to 'juick-server')
-rw-r--r--juick-server/src/main/java/com/juick/server/TelegramBotManager.java3
1 files changed, 2 insertions, 1 deletions
diff --git a/juick-server/src/main/java/com/juick/server/TelegramBotManager.java b/juick-server/src/main/java/com/juick/server/TelegramBotManager.java
index 0d765b71..b264d080 100644
--- a/juick-server/src/main/java/com/juick/server/TelegramBotManager.java
+++ b/juick-server/src/main/java/com/juick/server/TelegramBotManager.java
@@ -262,7 +262,8 @@ public class TelegramBotManager implements ApplicationListener<MessageEvent> {
});
} else {
SendPhoto telegramPhoto = new SendPhoto(chatId, attachment);
- telegramPhoto.caption(msg);
+ String trimmedPost = msg.length() > 160 ? msg.substring(0, 159) + "..." : msg;
+ telegramPhoto.caption(trimmedPost);
if (replyTo > 0) {
telegramPhoto.replyToMessageId(replyTo);
}