aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFuwn <[email protected]>2025-09-22 23:54:14 -0700
committerFuwn <[email protected]>2025-09-22 23:54:14 -0700
commit31b6e0b0431c38056f6fade758aa281ddefe08d1 (patch)
tree9ed648cc9400a47f4ee043bcb89516abd85844c9
parentfeat(irm): Update evaluation logic (diff)
downloadumabot-31b6e0b0431c38056f6fade758aa281ddefe08d1.tar.xz
umabot-31b6e0b0431c38056f6fade758aa281ddefe08d1.zip
feat(bot): Skip applying rules for approved posts
-rw-r--r--src/umabot/bot.py14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/umabot/bot.py b/src/umabot/bot.py
index 4b13aab..86e13ee 100644
--- a/src/umabot/bot.py
+++ b/src/umabot/bot.py
@@ -158,6 +158,11 @@ class UmaBot:
def _apply_rules(self, submission):
"""Apply all rules to a submission."""
try:
+ # Skip all rules if post is already approved
+ if self._is_post_approved(submission):
+ self.logger.info(f"Post {submission.id} is already approved, skipping all rules")
+ return
+
# Apply each rule
for rule in self.rules:
if rule.execute(submission):
@@ -167,6 +172,15 @@ class UmaBot:
except Exception as e:
self.logger.error(f"Error applying rules to {submission.id}: {e}")
+ def _is_post_approved(self, submission):
+ """Check if a post is already approved by moderators."""
+ try:
+ # Check if the post has been approved by moderators
+ return getattr(submission, 'approved', False)
+ except Exception as e:
+ self.logger.error(f"Error checking approval status for {submission.id}: {e}")
+ return False
+
def add_rule(self, rule):
"""Add a new rule to the bot."""
self.rules.append(rule)