diff options
Diffstat (limited to 'juick-api/src')
-rw-r--r-- | juick-api/src/main/java/com/juick/api/TelegramBotManager.java | 9 |
1 files changed, 7 insertions, 2 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 161680e9..4de5c840 100644 --- a/juick-api/src/main/java/com/juick/api/TelegramBotManager.java +++ b/juick-api/src/main/java/com/juick/api/TelegramBotManager.java @@ -19,6 +19,7 @@ package com.juick.api; import com.fasterxml.jackson.databind.ObjectMapper; import com.juick.service.MessagesService; +import com.juick.service.SubscriptionService; import com.juick.service.TelegramService; import com.pengrad.telegrambot.Callback; import com.pengrad.telegrambot.TelegramBot; @@ -64,6 +65,8 @@ public class TelegramBotManager extends TextWebSocketHandler { @Inject private MessagesService messagesService; @Inject + private SubscriptionService subscriptionService; + @Inject private ObjectMapper jsonMapper; private WebSocketSession session; @@ -115,7 +118,7 @@ public class TelegramBotManager extends TextWebSocketHandler { if (jmsg.getRid() == 0) { String msg = formatPost(jmsg); - List<Long> users = telegramService.getSubscribers(jmsg.getUser().getUid()); + List<Long> users = telegramService.getTelegramIdentifiers(subscriptionService.getSubscribedUsers(jmsg.getUser().getUid(), jmsg.getMid())); List<Long> chats = telegramService.getChats(); // registered subscribed users @@ -126,7 +129,9 @@ public class TelegramBotManager extends TextWebSocketHandler { // get quote com.juick.Message msg = messagesService.getReply(jmsg.getMid(), jmsg.getRid()); String fmsg = formatPost(msg); - telegramService.getSubscribersToComments(jmsg.getMid(), jmsg.getUser().getUid()).forEach(c -> telegramNotify(c, fmsg, msgUrl)); + telegramService.getTelegramIdentifiers( + subscriptionService.getUsersSubscribedToComments(jmsg.getMid(), jmsg.getUser().getUid()) + ).forEach(c -> telegramNotify(c, fmsg, msgUrl)); } } |