aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/com/juick/server
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/com/juick/server')
-rw-r--r--src/main/java/com/juick/server/TelegramBotManager.java22
1 files changed, 13 insertions, 9 deletions
diff --git a/src/main/java/com/juick/server/TelegramBotManager.java b/src/main/java/com/juick/server/TelegramBotManager.java
index 66362c193..9e53fbe10 100644
--- a/src/main/java/com/juick/server/TelegramBotManager.java
+++ b/src/main/java/com/juick/server/TelegramBotManager.java
@@ -96,6 +96,8 @@ public class TelegramBotManager implements NotificationListener {
private ApplicationEventPublisher applicationEventPublisher;
@Value("${upload_tmp_dir:#{systemEnvironment['TEMP'] ?: '/tmp'}}")
private String tmpDir;
+ @Value("${service_user:juick}")
+ private String serviceUser;
private static final String MSG_LINK = "🔗";
@@ -423,17 +425,19 @@ public class TelegramBotManager implements NotificationListener {
@Override
public void processLikeEvent(LikeEvent likeEvent) {
User liker = likeEvent.getUser();
- com.juick.Message message = likeEvent.getMessage();
- List<User> subscribers = likeEvent.getSubscribers();
- logger.info("Like received in tg listener");
- if (!userService.isInBLAny(message.getUser().getUid(), liker.getUid())) {
- telegramService.getTelegramIdentifiers(Collections.singletonList(message.getUser()))
- .forEach(c -> telegramNotify(c, String.format("%s recommends your [post](%s)",
+ if (!liker.getName().equals(serviceUser)) {
+ com.juick.Message message = likeEvent.getMessage();
+ List<User> subscribers = likeEvent.getSubscribers();
+ logger.info("Like received in tg listener");
+ if (!userService.isInBLAny(message.getUser().getUid(), liker.getUid())) {
+ telegramService.getTelegramIdentifiers(Collections.singletonList(message.getUser()))
+ .forEach(c -> telegramNotify(c, String.format("%s recommends your [post](%s)",
+ MessageUtils.getMarkdownUser(liker), formatUrl(message)), new com.juick.Message()));
+ }
+ telegramService.getTelegramIdentifiers(subscribers)
+ .forEach(c -> telegramNotify(c, String.format("%s recommends you someone's [post](%s)",
MessageUtils.getMarkdownUser(liker), formatUrl(message)), new com.juick.Message()));
}
- telegramService.getTelegramIdentifiers(subscribers)
- .forEach(c -> telegramNotify(c, String.format("%s recommends you someone's [post](%s)",
- MessageUtils.getMarkdownUser(liker), formatUrl(message)), new com.juick.Message()));
}
@Override