diff options
author | 2018-10-05 01:38:04 +0300 | |
---|---|---|
committer | 2018-10-05 01:38:04 +0300 | |
commit | fe761771ce3cb65b00dc3a826c51b9f20ff6c72d (patch) | |
tree | 7671e1bd31dfc10f10d1110048efc313762c6dfe /juick-server/src/main/java/com/juick/server/TelegramBotManager.java | |
parent | a6824b011325df07caf284352f09c2b9f76155c7 (diff) |
TopEvent: Announce in Fediverse, like in XMPP/Telegram
Diffstat (limited to 'juick-server/src/main/java/com/juick/server/TelegramBotManager.java')
-rw-r--r-- | juick-server/src/main/java/com/juick/server/TelegramBotManager.java | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/juick-server/src/main/java/com/juick/server/TelegramBotManager.java b/juick-server/src/main/java/com/juick/server/TelegramBotManager.java index ab1675f5..12f195aa 100644 --- a/juick-server/src/main/java/com/juick/server/TelegramBotManager.java +++ b/juick-server/src/main/java/com/juick/server/TelegramBotManager.java @@ -253,7 +253,7 @@ public class TelegramBotManager implements NotificationListener { telegramMessage.replyToMessageId(replyTo); } telegramMessage.parseMode(ParseMode.Markdown).disableWebPagePreview(true); - bot.execute(telegramMessage, new Callback<SendMessage, SendResponse>() { + bot.execute(telegramMessage, new Callback<>() { @Override public void onResponse(SendMessage request, SendResponse response) { processTelegramResponse(chatId, response, source); @@ -272,7 +272,7 @@ public class TelegramBotManager implements NotificationListener { telegramPhoto.replyToMessageId(replyTo); } telegramPhoto.parseMode(ParseMode.Markdown); - bot.execute(telegramPhoto, new Callback<SendPhoto, SendResponse>() { + bot.execute(telegramPhoto, new Callback<>() { @Override public void onResponse(SendPhoto request, SendResponse response) { processTelegramResponse(chatId, response, source); @@ -393,6 +393,14 @@ public class TelegramBotManager implements NotificationListener { } @Override + public void processTopEvent(TopEvent topEvent) { + com.juick.Message message = topEvent.getMessage(); + telegramService.getTelegramIdentifiers(Collections.singletonList(message.getUser())) + .forEach(c -> telegramNotify(c, String.format("Your [post](%s) became popular!", + formatUrl(message)), new com.juick.Message())); + } + + @Override public void processSubscribeEvent(SubscribeEvent subscribeEvent) { User subscriber = subscribeEvent.getUser(); User target = subscribeEvent.getToUser(); |