aboutsummaryrefslogtreecommitdiff
path: root/juick-server/src/main/java/com/juick/server/TelegramBotManager.java
diff options
context:
space:
mode:
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.java12
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();