diff options
| author | Fuwn <[email protected]> | 2025-09-17 21:57:28 -0700 |
|---|---|---|
| committer | Fuwn <[email protected]> | 2025-09-17 21:57:28 -0700 |
| commit | 9dc7bbd747a6d2d0c27e132993bd27f89a071ba1 (patch) | |
| tree | 367587721a69a0a83410e9351fff9baf3e8e2442 /test_moderator.py | |
| parent | revert: "feat(intelligent_moderator): Update low-effort removal user message" (diff) | |
| download | umabot-9dc7bbd747a6d2d0c27e132993bd27f89a071ba1.tar.xz umabot-9dc7bbd747a6d2d0c27e132993bd27f89a071ba1.zip | |
feat(intelligent_moderator): Treat videos as media
Diffstat (limited to 'test_moderator.py')
| -rwxr-xr-x | test_moderator.py | 41 |
1 files changed, 37 insertions, 4 deletions
diff --git a/test_moderator.py b/test_moderator.py index 939d214..af9d4a5 100755 --- a/test_moderator.py +++ b/test_moderator.py @@ -187,15 +187,48 @@ class TestIntelligentModerator(IntelligentModeratorBase): with open(file_path, 'r', encoding='utf-8') as f: content = f.read().strip() + # Parse file content to extract metadata + lines = content.split('\n') + title = file_path.stem.replace('_', ' ').title() + body = content + is_video = False + is_gallery = False + + # Check if file contains metadata markers + if "Title:" in content and "Body:" in content: + # Parse structured content + title_line = None + body_start = None + for i, line in enumerate(lines): + if line.startswith("Title:"): + title_line = line + elif line.startswith("Body:"): + body_start = i + break + + if title_line: + title = title_line.replace("Title:", "").strip() + + if body_start is not None: + body_lines = lines[body_start + 1:] + # Remove metadata lines + body_lines = [line for line in body_lines if not line.startswith(("Has Media:", "Media Type:"))] + body = '\n'.join(body_lines).strip() + + # Check for video indicators in content + content_lower = content.lower() + if "video" in content_lower or "mp4" in content_lower or "webm" in content_lower: + is_video = True + # Create mock submission submission = MockSubmission( id=f"test_{file_path.stem}", - title=file_path.stem.replace('_', ' ').title(), - selftext=content, + title=title, + selftext=body, url="", - is_video=False, + is_video=is_video, is_self=True, - is_gallery=False, + is_gallery=is_gallery, link_flair_text="Roleplay", author=MockAuthor(author_name) ) |