Skip to content

Commit

Permalink
NSFW check
Browse files Browse the repository at this point in the history
  • Loading branch information
yvasyliev committed Jun 25, 2023
1 parent d9113cb commit 780ebe9
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/main/java/com/github/yvasyliev/config/AppConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
import com.github.yvasyliev.telegram.TelegramSenderBotImpl;
import com.github.yvasyliev.telegram.chain.FilterAuthorChain;
import com.github.yvasyliev.telegram.chain.NOPRepeaterChain;
import com.github.yvasyliev.telegram.chain.NsfwCheckChain;
import com.github.yvasyliev.telegram.chain.RepeatGif;
import com.github.yvasyliev.telegram.chain.RepeatMultiplePhotos;
import com.github.yvasyliev.telegram.chain.RepeatNestedPost;
Expand Down Expand Up @@ -94,7 +95,7 @@ public RedditPostService redditPostService() {

@Bean
public SubredditPostRepeaterChain repeatNestedPost() {
return new RepeatNestedPost(repeatText());
return new RepeatNestedPost(nsfwCheckChain());
}

@Bean
Expand Down Expand Up @@ -141,4 +142,9 @@ public SubredditPostRepeaterChain repeatPoll() {
public SubredditPostRepeaterChain filterAuthorChain() {
return new FilterAuthorChain(repeatNestedPost());
}

@Bean
public SubredditPostRepeaterChain nsfwCheckChain() {
return new NsfwCheckChain(repeatText());
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package com.github.yvasyliev.telegram.chain;

import com.fasterxml.jackson.databind.JsonNode;
import com.github.yvasyliev.telegram.TelegramSenderBot;

public class NsfwCheckChain extends SubredditPostRepeaterChain {
public NsfwCheckChain(SubredditPostRepeaterChain nextChain) {
super(nextChain);
}

@Override
public void repeatRedditPost(JsonNode data, TelegramSenderBot telegramSenderBot, boolean needModerate) {
super.repeatRedditPost(data, telegramSenderBot, hasSpoiler(data));
}
}

0 comments on commit 780ebe9

Please sign in to comment.