From c079533ee4f02fa53ac429c89177a14b985dade3 Mon Sep 17 00:00:00 2001 From: Vitaly Takmazov Date: Thu, 14 Jul 2016 12:43:16 +0300 Subject: juick-api: telegram message text can be null --- juick-api/src/main/java/com/juick/api/TelegramBotHook.java | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'juick-api/src/main/java/com/juick/api') diff --git a/juick-api/src/main/java/com/juick/api/TelegramBotHook.java b/juick-api/src/main/java/com/juick/api/TelegramBotHook.java index f98bbc01..29b32af2 100644 --- a/juick-api/src/main/java/com/juick/api/TelegramBotHook.java +++ b/juick-api/src/main/java/com/juick/api/TelegramBotHook.java @@ -165,10 +165,15 @@ public class TelegramBotHook { } else { if (user_from.getUID() == 0) { telegramSignupNotify(message.from().id().longValue(), UserQueries.getSignUpHashByTelegramID(jdbc, message.from().id().longValue(), username)); - } else if (message.text().equalsIgnoreCase("/login")) { - String msg = String.format("Hi, %s!\nTap to log in", user_from.getUName()); - String msgUrl = "http://juick.com/login?" + UserQueries.getHashByUID(jdbc, user_from.getUID()); - telegramNotify(message.from().id().longValue(), msg, msgUrl); + } else { + String text = message.text(); + if (text != null) { + if (text.equalsIgnoreCase("/login")) { + String msg = String.format("Hi, %s!\nTap to log in", user_from.getUName()); + String msgUrl = "http://juick.com/login?" + UserQueries.getHashByUID(jdbc, user_from.getUID()); + telegramNotify(message.from().id().longValue(), msg, msgUrl); + } + } } } } -- cgit v1.2.3