diff options
author | Vitaly Takmazov | 2016-11-15 14:21:27 +0300 |
---|---|---|
committer | Vitaly Takmazov | 2016-11-15 14:21:27 +0300 |
commit | 51d9de02265d6cc9d6045d79497d2a987ae2f7f7 (patch) | |
tree | d7dd2e534452cab45b8ebdba1e52c498951c5035 /juick-api/src/main/java/com/juick/api/TelegramBotHook.java | |
parent | 32a6feb195171e06d60117ad758cc8beb50e5ca3 (diff) |
core classes are now serializeable with JAXB (to use as babbler extension)
Diffstat (limited to 'juick-api/src/main/java/com/juick/api/TelegramBotHook.java')
-rw-r--r-- | juick-api/src/main/java/com/juick/api/TelegramBotHook.java | 16 |
1 files changed, 8 insertions, 8 deletions
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 2ec380db..e089250b 100644 --- a/juick-api/src/main/java/com/juick/api/TelegramBotHook.java +++ b/juick-api/src/main/java/com/juick/api/TelegramBotHook.java @@ -72,10 +72,10 @@ public class TelegramBotHook { com.juick.Message jmsg = ms.deserialize(new JSONObject(text)); logger.info("got jmsg: " + ms.serialize(jmsg).toString()); String msgUrl = formatUrl(jmsg); - if (jmsg.getRID() == 0) { + if (jmsg.getRid() == 0) { String msg = formatPost(jmsg); - List<Long> users = getSubscribers(jmsg.getUser().getUID()); + List<Long> users = getSubscribers(jmsg.getUser().getUid()); List<Long> chats = getChats(); // registered subscribed users @@ -84,9 +84,9 @@ public class TelegramBotHook { chats.stream().filter(u -> getUser(u) == 0).forEach(c -> telegramNotify(c, msg, msgUrl)); } else { // get quote - com.juick.Message msg = MessagesQueries.getReply(jdbc, jmsg.getMID(), jmsg.getRID()); + com.juick.Message msg = MessagesQueries.getReply(jdbc, jmsg.getMid(), jmsg.getRid()); String fmsg = formatPost(msg); - getSubscribersToComments(jmsg.getMID(), jmsg.getUser().getUID()).stream() + getSubscribersToComments(jmsg.getMid(), jmsg.getUser().getUid()).stream() .forEach(c -> telegramNotify(c, fmsg, msgUrl)); } } @@ -141,7 +141,7 @@ public class TelegramBotHook { } logger.info(String.format("got telegram msg %s", message.toString())); User user_from = UserQueries.getUserByUID(jdbc, getUser(message.chat().id())).orElse(new User()); - logger.info(String.format("Found juick user %d", user_from.getUID())); + logger.info(String.format("Found juick user %d", user_from.getUid())); List<Long> chats = getChats(); String username = message.from().username(); @@ -154,14 +154,14 @@ public class TelegramBotHook { createTelegramUser(message.from().id(), username); telegramSignupNotify(message.from().id().longValue(), UserQueries.getSignUpHashByTelegramID(jdbc, message.from().id().longValue(), username)); } else { - if (user_from.getUID() == 0) { + if (user_from.getUid() == 0) { telegramSignupNotify(message.from().id().longValue(), UserQueries.getSignUpHashByTelegramID(jdbc, message.from().id().longValue(), username)); } 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()); + String msg = String.format("Hi, %s!\nTap to log in", user_from.getName()); + String msgUrl = "http://juick.com/login?" + UserQueries.getHashByUID(jdbc, user_from.getUid()); telegramNotify(message.from().id().longValue(), msg, msgUrl); } /* else { ProtocolReply reply = protocol.getReply(user_from, text); |