diff options
| -rw-r--r-- | src/umabot/bot.py | 14 |
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) |