aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/umabot/rules/intelligent_moderator_base.py39
1 files changed, 20 insertions, 19 deletions
diff --git a/src/umabot/rules/intelligent_moderator_base.py b/src/umabot/rules/intelligent_moderator_base.py
index 56035e8..2d04f14 100644
--- a/src/umabot/rules/intelligent_moderator_base.py
+++ b/src/umabot/rules/intelligent_moderator_base.py
@@ -184,21 +184,26 @@ Word Count: {word_count}
def _has_media(self, submission: Any) -> bool:
"""Check if a submission has media attached."""
try:
- # Check for image/video posts
- if self._is_video(submission) or self._is_self(submission):
- # For self posts, check if they contain media links
- if self._is_self(submission) and self._get_content(submission):
- # Look for common media URLs in the text
- media_indicators = [
- 'imgur.com', 'i.imgur.com', 'redd.it', 'i.redd.it',
- 'youtube.com', 'youtu.be', 'vimeo.com', 'gfycat.com',
- 'streamable.com', 'twitter.com', 'x.com', 'tiktok.com',
- 'instagram.com', 'facebook.com', 'discord.com', 'discordapp.com'
- ]
-
- text_lower = self._get_content(submission).lower()
- return any(indicator in text_lower for indicator in media_indicators)
- return False
+ # Check for video posts - these always have media
+ if self._is_video(submission):
+ return True
+
+ # Check for gallery posts - these always have media
+ if self._is_gallery(submission):
+ return True
+
+ # Check for self posts with media links
+ if self._is_self(submission) and self._get_content(submission):
+ # Look for common media URLs in the text
+ media_indicators = [
+ 'imgur.com', 'i.imgur.com', 'redd.it', 'i.redd.it',
+ 'youtube.com', 'youtu.be', 'vimeo.com', 'gfycat.com',
+ 'streamable.com', 'twitter.com', 'x.com', 'tiktok.com',
+ 'instagram.com', 'facebook.com', 'discord.com', 'discordapp.com'
+ ]
+
+ text_lower = self._get_content(submission).lower()
+ return any(indicator in text_lower for indicator in media_indicators)
# Check for link posts with media
url = self._get_url(submission)
@@ -221,10 +226,6 @@ Word Count: {word_count}
if any(domain in url_lower for domain in media_domains):
return True
- # Check for gallery posts
- if self._is_gallery(submission):
- return True
-
return False
except Exception as e: