This commit is contained in:
2026-03-12 22:56:57 +00:00
parent f4faabe44d
commit 6d2d04ea40
8 changed files with 162 additions and 1 deletions
+24
View File
@@ -1,6 +1,10 @@
import os
import praw
from config import get_reddit, Config
from update_checker import start_update_checker
BOT_VERSION = "2.2.0" # Change this for new releases
BOT_NAME = "ModReplyBot" # Change this if bot name changes
import time
@@ -151,6 +155,12 @@ class ModReplyBot:
self.tag_comments[tag] = comment
self.tag_statuses[tag] = status
self.tag_flair_ids[tag] = flair_id
# Parse ignore_tags
self.ignore_tags = set()
for entry in config.get('ignore_tags', []):
tag_val = entry.get('tag', '').strip().lower() if isinstance(entry, dict) else str(entry).strip().lower()
if tag_val:
self.ignore_tags.add(tag_val)
self._last_config_error_revision = None
return True
@@ -255,6 +265,18 @@ class ModReplyBot:
title_tags = re.findall(r'\[(.*?)\]', title)
title_tags_lower = [t.strip().lower() for t in title_tags]
print(f"[TAG WATCH] Post {submission.id}: title='{title}', flair='{flair}', title_tags={title_tags_lower}")
# Ignore if any ignore_tag matches flair or title tag
ignore = False
if flair in self.ignore_tags:
ignore = True
else:
for tag in title_tags_lower:
if tag in self.ignore_tags:
ignore = True
break
if ignore:
print(f"[TAG WATCH] Ignoring post {submission.id} due to ignore tag.")
continue
matched_tag = None
if flair in self.tag_comments:
matched_tag = flair
@@ -484,4 +506,6 @@ class ModReplyBot:
if __name__ == "__main__":
bot = ModReplyBot()
# Start update checker thread
start_update_checker(bot.reddit, Config.SUBREDDIT, BOT_NAME, BOT_VERSION)
bot.run()