From c6ac30f743167c5276569c7b95b586e9827a4e9e Mon Sep 17 00:00:00 2001 From: Vitaly Takmazov Date: Mon, 18 Dec 2017 12:14:56 +0300 Subject: telegram: allow attachment without text, process /start --- .../src/main/java/com/juick/api/controllers/TelegramWebhook.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'juick-api/src/main/java/com/juick') diff --git a/juick-api/src/main/java/com/juick/api/controllers/TelegramWebhook.java b/juick-api/src/main/java/com/juick/api/controllers/TelegramWebhook.java index 2ac805cd..dd4ebc06 100644 --- a/juick-api/src/main/java/com/juick/api/controllers/TelegramWebhook.java +++ b/juick-api/src/main/java/com/juick/api/controllers/TelegramWebhook.java @@ -121,8 +121,11 @@ public class TelegramWebhook { if (StringUtils.isBlank(text)) { text = message.caption(); } - if (StringUtils.isNotEmpty(text)) { - if (text.equalsIgnoreCase("/login")) { + if (StringUtils.isBlank(text)) { + text = StringUtils.EMPTY; + } + if (StringUtils.isNotEmpty(text) || StringUtils.isNotEmpty(attachment)) { + if (text.equalsIgnoreCase("/login") || text.equalsIgnoreCase("/start")) { String msgUrl = "http://juick.com/login?" + usersService.getHashByUID(user_from.getUid()); String msg = String.format("Hi, %s!\nTap to [log in](%s)", user_from.getName(), msgUrl); telegramBotManager.telegramNotify(message.from().id().longValue(), msg); -- cgit v1.2.3