From 308bd9700d64b627981229fe304fccd50154b7f9 Mon Sep 17 00:00:00 2001 From: Vitaly Takmazov Date: Sat, 28 Oct 2017 11:26:37 +0300 Subject: api: fix Telegram login command --- juick-api/src/main/java/com/juick/api/TelegramBotManager.java | 8 ++++---- .../src/main/java/com/juick/api/controllers/TelegramWebhook.java | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) (limited to 'juick-api/src/main/java/com') 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 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() { 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"); } } } -- cgit v1.2.3