From 230cf552ce3f4a693d445e2e328975c699bf5f28 Mon Sep 17 00:00:00 2001 From: Vitaly Takmazov Date: Mon, 26 Feb 2018 11:12:31 +0300 Subject: telegram: trim photo caption to 200 characters --- juick-server/src/main/java/com/juick/server/TelegramBotManager.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'juick-server/src/main/java/com/juick') 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 { }); } 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); } -- cgit v1.2.3