Skip to content

Add blocking words#2473

Merged
cyteon merged 2 commits intomasterfrom
blocked-words
Mar 17, 2026
Merged

Add blocking words#2473
cyteon merged 2 commits intomasterfrom
blocked-words

Conversation

@cyteon
Copy link
Collaborator

@cyteon cyteon commented Mar 17, 2026

No description provided.

@cyteon cyteon merged commit 569f250 into master Mar 17, 2026
2 checks passed
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 checks reddit.thread.blocked_words from config.
  • Skip submissions whose title/selftext contains a blocked word.
  • Skip top-level comments whose body contains a blocked word, and expose blocked_words in 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)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants