diff options
author | Vitaly Takmazov | 2018-02-26 11:12:31 +0300 |
---|---|---|
committer | Vitaly Takmazov | 2018-02-26 11:12:31 +0300 |
commit | 230cf552ce3f4a693d445e2e328975c699bf5f28 (patch) | |
tree | 96b8c5660f6ca2f4dbabb718de0a667e4e34c14e | |
parent | 81f82943e8c37f47bd02d7490935121ff16f6d71 (diff) |
telegram: trim photo caption to 200 characters
-rw-r--r-- | juick-server/src/main/java/com/juick/server/TelegramBotManager.java | 3 |
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); } |