diff options
author | Vitaly Takmazov | 2017-10-28 11:26:37 +0300 |
---|---|---|
committer | Vitaly Takmazov | 2017-10-28 11:26:37 +0300 |
commit | 308bd9700d64b627981229fe304fccd50154b7f9 (patch) | |
tree | d4682431ec7c9378deec35ab37e3bc7518bef0d6 /juick-api | |
parent | ef3c9087501f0eb4349c0f27740854502bf9e169 (diff) |
api: fix Telegram login command
Diffstat (limited to 'juick-api')
-rw-r--r-- | juick-api/src/main/java/com/juick/api/TelegramBotManager.java | 8 | ||||
-rw-r--r-- | juick-api/src/main/java/com/juick/api/controllers/TelegramWebhook.java | 8 |
2 files changed, 8 insertions, 8 deletions
diff --git a/juick-api/src/main/java/com/juick/api/TelegramBotManager.java b/juick-api/src/main/java/com/juick/api/TelegramBotManager.java index 33e71fee..256084c3 100644 --- a/juick-api/src/main/java/com/juick/api/TelegramBotManager.java +++ b/juick-api/src/main/java/com/juick/api/TelegramBotManager.java @@ -124,20 +124,20 @@ public class TelegramBotManager extends TextWebSocketHandler { List<Long> chats = telegramService.getChats(); // registered subscribed users - users.forEach(c -> telegramNotify(c, msg, msgUrl)); + users.forEach(c -> telegramNotify(c, msg)); // anonymous - chats.stream().filter(u -> telegramService.getUser(u) == 0).forEach(c -> telegramNotify(c, msg, msgUrl)); + chats.stream().filter(u -> telegramService.getUser(u) == 0).forEach(c -> telegramNotify(c, msg)); } else { // get quote com.juick.Message msg = messagesService.getReply(jmsg.getMid(), jmsg.getRid()); String fmsg = String.format("[%s](%s) %s", MSG_LINK, msgUrl, formatPost(msg)); telegramService.getTelegramIdentifiers( subscriptionService.getUsersSubscribedToComments(jmsg.getMid(), jmsg.getUser().getUid()) - ).forEach(c -> telegramNotify(c, fmsg, msgUrl)); + ).forEach(c -> telegramNotify(c, fmsg)); } } - public void telegramNotify(Long c, String msg, String msgUrl) { + public void telegramNotify(Long c, String msg) { SendMessage telegramMessage = new SendMessage(c, msg); telegramMessage.parseMode(ParseMode.Markdown); bot.execute(telegramMessage, new Callback<SendMessage, SendResponse>() { 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 ef2456b5..bb0ce1ea 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 @@ -122,9 +122,9 @@ public class TelegramWebhook { } if (StringUtils.isNotEmpty(text)) { if (text.equalsIgnoreCase("/login")) { - String msg = String.format("Hi, %s!\nTap to log in", user_from.getName()); String msgUrl = "http://juick.com/login?" + usersService.getHashByUID(user_from.getUid()); - telegramBotManager.telegramNotify(message.from().id().longValue(), msg, msgUrl); + String msg = String.format("Hi, %s!\nTap to [log in](%s)", user_from.getName(), msgUrl); + telegramBotManager.telegramNotify(message.from().id().longValue(), msg); } else { Message replyMessage = message.replyToMessage(); if (replyMessage != null) { @@ -143,12 +143,12 @@ public class TelegramWebhook { prefix = String.format("#%d/%d ", mid, rid); } apiServer.processMessage(user_from, prefix + finalText, finalAttachment); - telegramBotManager.telegramNotify(finalMessage.from().id().longValue(), "reply sent", null); + telegramBotManager.telegramNotify(finalMessage.from().id().longValue(), "reply sent"); } }); } else { apiServer.processMessage(user_from, text, attachment); - telegramBotManager.telegramNotify(message.from().id().longValue(), "message sent", null); + telegramBotManager.telegramNotify(message.from().id().longValue(), "message sent"); } } } |