Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Adds a configurable “blocked words” filter so posts/comments containing configured terms are skipped during thread/comment selection.
Changes:
- Add
_contains_blocked_words()helper that checksreddit.thread.blocked_wordsfrom config. - Skip submissions whose title/selftext contains a blocked word.
- Skip top-level comments whose body contains a blocked word, and expose
blocked_wordsin the config template.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| utils/subreddit.py | Adds blocked-words helper and filters candidate submissions. |
| utils/.config.template.toml | Introduces reddit.thread.blocked_words config option. |
| reddit/subreddit.py | Filters out blocked-word top-level comments using the new helper. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| from utils.console import print_step, print_substep | ||
| from utils.posttextparser import posttextparser | ||
| from utils.subreddit import get_subreddit_undone | ||
| from utils.subreddit import _contains_blocked_words, get_subreddit_undone |
Comment on lines
+11
to
+16
| blocked_raw = settings.config["reddit"]["thread"].get("blocked_words", "") | ||
| if not blocked_raw: | ||
| return False | ||
| blocked = [w.strip().lower() for w in blocked_raw.split(",") if w.strip()] | ||
| text_lower = text.lower() | ||
| return any(word in text_lower for word in blocked) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.