diff options
| author | Fuwn <[email protected]> | 2025-09-18 22:21:58 -0700 |
|---|---|---|
| committer | Fuwn <[email protected]> | 2025-09-18 22:21:58 -0700 |
| commit | 3a5627e8e451d22fd5b795acd62890322f90c63c (patch) | |
| tree | 80cc137731e0ef917e875fa5c8f00615aacbeb10 | |
| parent | fix(irm): Send removal message as Mod Mail (diff) | |
| download | umabot-3a5627e8e451d22fd5b795acd62890322f90c63c.tar.xz umabot-3a5627e8e451d22fd5b795acd62890322f90c63c.zip | |
fix(irm): Image identification and Mod Mail bugs
| -rw-r--r-- | src/umabot/rules/intelligent_moderator_base.py | 21 | ||||
| -rw-r--r-- | src/umabot/rules/intelligent_roleplay_moderator.py | 4 |
2 files changed, 20 insertions, 5 deletions
diff --git a/src/umabot/rules/intelligent_moderator_base.py b/src/umabot/rules/intelligent_moderator_base.py index 2d04f14..39c00b0 100644 --- a/src/umabot/rules/intelligent_moderator_base.py +++ b/src/umabot/rules/intelligent_moderator_base.py @@ -189,8 +189,23 @@ Word Count: {word_count} return True # Check for gallery posts - these always have media - if self._is_gallery(submission): - return True + try: + if hasattr(submission, 'is_gallery') and submission.is_gallery: + return True + except AttributeError: + pass + + # Check for image posts (not self posts) + if not self._is_self(submission): + url = self._get_url(submission) + if url: + url_lower = url.lower() + # Check if it's a direct image link + if any(ext in url_lower for ext in ['.jpg', '.jpeg', '.png', '.gif', '.webp']): + return True + # Check if it's from a known image hosting domain + if any(domain in url_lower for domain in ['imgur.com', 'i.imgur.com', 'redd.it', 'i.redd.it']): + return True # Check for self posts with media links if self._is_self(submission) and self._get_content(submission): @@ -237,7 +252,7 @@ Word Count: {word_count} try: if self._is_video(submission): return "video" - elif self._is_gallery(submission): + elif hasattr(submission, 'is_gallery') and submission.is_gallery: return "gallery" else: url = self._get_url(submission) diff --git a/src/umabot/rules/intelligent_roleplay_moderator.py b/src/umabot/rules/intelligent_roleplay_moderator.py index 17298e0..bd5a892 100644 --- a/src/umabot/rules/intelligent_roleplay_moderator.py +++ b/src/umabot/rules/intelligent_roleplay_moderator.py @@ -122,7 +122,7 @@ class IntelligentRoleplayModerator(Rule, IntelligentModeratorBase): self.subreddit.modmail.create( subject=subject, body=message, - recipient=submission.author, + recipient=submission.author.name, author_hidden=True ) self.logger.info(f"Sent art flair change notification to {username}") @@ -151,7 +151,7 @@ class IntelligentRoleplayModerator(Rule, IntelligentModeratorBase): self.subreddit.modmail.create( subject=subject, body=message, - recipient=submission.author, + recipient=submission.author.name, author_hidden=True ) self.logger.info(f"Sent low-effort removal notification to {username}") |