diff options
| author | Fuwn <[email protected]> | 2025-09-19 16:08:58 -0700 |
|---|---|---|
| committer | Fuwn <[email protected]> | 2025-09-19 16:08:58 -0700 |
| commit | b28fc51ef081f80e688e95e47072b21236710b71 (patch) | |
| tree | a13e42192ee79f139f043c1c60d5412cc3652171 | |
| parent | fix(irm): Missing media attribute handling (diff) | |
| download | umabot-b28fc51ef081f80e688e95e47072b21236710b71.tar.xz umabot-b28fc51ef081f80e688e95e47072b21236710b71.zip | |
feat: Update strings from roleplay to in character
| -rw-r--r-- | README.md | 48 | ||||
| -rw-r--r-- | TEST_MODERATOR_README.md | 14 | ||||
| -rw-r--r-- | env.example | 8 | ||||
| -rw-r--r-- | src/umabot/config.py | 2 | ||||
| -rw-r--r-- | src/umabot/rules/intelligent_moderator_base.py | 10 | ||||
| -rw-r--r-- | src/umabot/rules/intelligent_roleplay_moderator.py | 6 | ||||
| -rwxr-xr-x | test_moderator.py | 6 |
7 files changed, 47 insertions, 47 deletions
@@ -5,18 +5,18 @@ A modular Reddit bot for automated post moderation built with Python and PRAW. ## Features - **Spam Detection**: Automatically removes posts from users who post more than 3 times in 24 hours -- **Intelligent Roleplay Moderator**: Uses GPT-5-nano to evaluate roleplay posts and make smart moderation decisions +- **Intelligent In-Character Moderator**: Uses GPT-5-nano to evaluate in-character posts and make smart moderation decisions - **Modular Design**: Easy to add new moderation rules - **Configurable Messages**: Customizable removal messages - **Dry Run Mode**: Test the bot without actually removing posts - **Comprehensive Logging**: Detailed logs for monitoring and debugging -### Intelligent Roleplay Moderation +### Intelligent In-Character Moderation -The bot features an advanced AI-powered roleplay moderator that: +The bot features an advanced AI-powered in-character moderator that: -- **Auto-Flairing**: Automatically changes roleplay posts to "Art" flair when they're primarily showcasing artwork -- **Quality Control**: Removes low-effort roleplay posts while preserving high-quality content +- **Auto-Flairing**: Automatically changes in-character posts to "Art" flair when they're primarily showcasing artwork +- **Quality Control**: Removes low-effort in-character posts while preserving high-quality content - **Smart Evaluation**: Uses GPT-5-nano to analyze post content, creativity, effort, and engagement potential - **User Communication**: Sends detailed mod mail explaining decisions and providing guidance @@ -61,7 +61,7 @@ OPENAI_API_KEY=your_openai_api_key_here SUBREDDIT_NAME=your_subreddit_name # Bot Messages -ROLEPLAY_MESSAGE=Your post has been removed. Only one roleplay post is allowed per user. +ROLEPLAY_MESSAGE=Your post has been removed. Only one in-character post is allowed per user. # Bot Settings CHECK_INTERVAL=60 @@ -158,24 +158,24 @@ The bot can be deployed on any platform that supports Python: ### Environment Variables -| Variable | Description | Default | -| ----------------------------- | ------------------------------------------ | -------------- | -| `REDDIT_CLIENT_ID` | Reddit API client ID | Required | -| `REDDIT_CLIENT_SECRET` | Reddit API client secret | Required | -| `REDDIT_USERNAME` | Reddit bot username | Required | -| `REDDIT_PASSWORD` | Reddit bot password | Required | -| `REDDIT_USER_AGENT` | User agent string | `UmaBot/0.1.0` | -| `SUBREDDIT_NAME` | Target subreddit name | Required | -| `ROLEPLAY_MESSAGE` | Message for roleplay removals | Customizable | -| `CHECK_INTERVAL` | Seconds between checks | `60` | -| `MAX_POSTS_PER_DAY` | Max posts per user in time window | `3` | -| `MAX_ROLEPLAY_POSTS_PER_DAY` | Max roleplay posts per user in time window | `1` | -| `POST_LIMIT_WINDOW_HOURS` | Time window for post limits (hours) | `24` | -| `ROLEPLAY_LIMIT_WINDOW_HOURS` | Time window for roleplay limits (hours) | `24` | -| `ROLEPLAY_SURGE_THRESHOLD_1` | First surge threshold for roleplay posts | `20` | -| `ROLEPLAY_SURGE_THRESHOLD_2` | Second surge threshold for roleplay posts | `40` | -| `ROLEPLAY_SURGE_THRESHOLD_3` | Third surge threshold for roleplay posts | `60` | -| `DRY_RUN` | Enable dry-run mode | `false` | +| Variable | Description | Default | +| ----------------------------- | ---------------------------------------------- | -------------- | +| `REDDIT_CLIENT_ID` | Reddit API client ID | Required | +| `REDDIT_CLIENT_SECRET` | Reddit API client secret | Required | +| `REDDIT_USERNAME` | Reddit bot username | Required | +| `REDDIT_PASSWORD` | Reddit bot password | Required | +| `REDDIT_USER_AGENT` | User agent string | `UmaBot/0.1.0` | +| `SUBREDDIT_NAME` | Target subreddit name | Required | +| `ROLEPLAY_MESSAGE` | Message for in-character removals | Customizable | +| `CHECK_INTERVAL` | Seconds between checks | `60` | +| `MAX_POSTS_PER_DAY` | Max posts per user in time window | `3` | +| `MAX_ROLEPLAY_POSTS_PER_DAY` | Max in-character posts per user in time window | `1` | +| `POST_LIMIT_WINDOW_HOURS` | Time window for post limits (hours) | `24` | +| `ROLEPLAY_LIMIT_WINDOW_HOURS` | Time window for in-character limits (hours) | `24` | +| `ROLEPLAY_SURGE_THRESHOLD_1` | First surge threshold for in-character posts | `20` | +| `ROLEPLAY_SURGE_THRESHOLD_2` | Second surge threshold for in-character posts | `40` | +| `ROLEPLAY_SURGE_THRESHOLD_3` | Third surge threshold for in-character posts | `60` | +| `DRY_RUN` | Enable dry-run mode | `false` | ## Development diff --git a/TEST_MODERATOR_README.md b/TEST_MODERATOR_README.md index bfde61f..ac76303 100644 --- a/TEST_MODERATOR_README.md +++ b/TEST_MODERATOR_README.md @@ -1,6 +1,6 @@ # Test Moderator CLI -A command-line tool for testing the intelligent roleplay moderator against text files before deploying it to production. +A command-line tool for testing the intelligent in-character moderator against text files before deploying it to production. ## Features @@ -64,10 +64,10 @@ export OPENAI_API_KEY="sk-your-key-here" The `test_posts/` directory contains sample files demonstrating different types of content: - **`artwork_showcase.txt`**: Art-focused post that should be re-flaired -- **`high_quality_roleplay.txt`**: Well-written roleplay that should be allowed +- **`high_quality_roleplay.txt`**: Well-written in-character content that should be allowed - **`low_effort_post.txt`**: Minimal content that should be removed -- **`basic_roleplay.txt`**: Simple roleplay that might be borderline -- **`poetic_roleplay.txt`**: Creative, high-quality roleplay content +- **`basic_roleplay.txt`**: Simple in-character content that might be borderline +- **`poetic_roleplay.txt`**: Creative, high-quality in-character content ## Understanding Results @@ -109,15 +109,15 @@ Content Preview: Check out this amazing artwork I drew of Tokai Teio! She's so b Should be Art: True Is Low Effort: False Confidence: 0.95 - Reasoning: This post is primarily showcasing artwork with detailed description of the art process, making it more suitable for the Art flair than Roleplay. + Reasoning: This post is primarily showcasing artwork with detailed description of the art process, making it more suitable for the Art flair than In Character. š Actions: šØ Change flair to Art š§ Mod Mail (Art Flair Change): Subject: Your post flair has been changed to Art - Message: Your roleplay post has been automatically re-flaired as 'Art' because it appears to be primarily showcasing artwork or visual content rather than roleplay. - Reasoning: This post is primarily showcasing artwork with detailed description of the art process, making it more suitable for the Art flair than Roleplay. + Message: Your in-character post has been automatically re-flaired as 'Art' because it appears to be primarily showcasing artwork or visual content rather than in-character content. + Reasoning: This post is primarily showcasing artwork with detailed description of the art process, making it more suitable for the Art flair than In Character. ``` ## Setup diff --git a/env.example b/env.example index 92d7eed..d01bc34 100644 --- a/env.example +++ b/env.example @@ -16,20 +16,20 @@ SUBREDDIT_NAME=your_subreddit_name # Bot Messages # Customize these messages as needed -ROLEPLAY_MESSAGE=Your post has been removed. Only one roleplay post is allowed per user. +ROLEPLAY_MESSAGE=Your post has been removed. Only one in-character post is allowed per user. # Bot Settings # How often to check for new posts (in seconds) CHECK_INTERVAL=60 # Maximum number of posts a user can make in the time window MAX_POSTS_PER_DAY=3 -# Maximum number of roleplay posts a user can make in the time window +# Maximum number of in-character posts a user can make in the time window MAX_ROLEPLAY_POSTS_PER_DAY=1 # Time window for post limits (in hours) POST_LIMIT_WINDOW_HOURS=24 -# Time window for roleplay post limits (in hours) +# Time window for in-character post limits (in hours) ROLEPLAY_LIMIT_WINDOW_HOURS=24 -# Surge-based roleplay limiting thresholds +# Surge-based in-character limiting thresholds ROLEPLAY_SURGE_THRESHOLD_1=20 ROLEPLAY_SURGE_THRESHOLD_2=40 ROLEPLAY_SURGE_THRESHOLD_3=60 diff --git a/src/umabot/config.py b/src/umabot/config.py index af53e87..6d8ebdc 100644 --- a/src/umabot/config.py +++ b/src/umabot/config.py @@ -52,7 +52,7 @@ class Config: subreddit_name=os.getenv("SUBREDDIT_NAME", ""), roleplay_message=os.getenv( "ROLEPLAY_MESSAGE", - "Your post has been removed. Only one roleplay post is allowed per user." + "Your post has been removed. Only one in-character post is allowed per user." ), check_interval=int(os.getenv("CHECK_INTERVAL", "60")), max_posts_per_day=int(os.getenv("MAX_POSTS_PER_DAY", "3")), diff --git a/src/umabot/rules/intelligent_moderator_base.py b/src/umabot/rules/intelligent_moderator_base.py index 2d04f14..228374c 100644 --- a/src/umabot/rules/intelligent_moderator_base.py +++ b/src/umabot/rules/intelligent_moderator_base.py @@ -18,9 +18,9 @@ class IntelligentModeratorBase(ABC): # Evaluation prompt self.evaluation_prompt = """ -You are an expert moderator for a roleplay subreddit. Your job is to evaluate roleplay posts and determine: +You are an expert moderator for an in-character subreddit. Your job is to evaluate in-character posts and determine: -1. Whether this post would be better flaired as "Art" instead of "Roleplay" +1. Whether this post would be better flaired as "Art" instead of "In Character" 2. Whether this is low-effort content that should be removed For each post, respond with a JSON object containing: @@ -32,8 +32,8 @@ For each post, respond with a JSON object containing: }} Guidelines: -- A post should be flaired as "Art" if it's primarily showcasing artwork, images, or visual content with minimal roleplay text -- A post is "low-effort" if it lacks substance, creativity, or meaningful roleplay content +- A post should be flaired as "Art" if it's primarily showcasing artwork, images, or visual content with minimal in-character text +- A post is "low-effort" if it lacks substance, creativity, or meaningful in-character content - Consider factors like: word count, creativity, effort, engagement potential, originality - Be strict but fair - err on the side of allowing content unless it's clearly low quality - High confidence (0.8+) for clear cases, lower confidence for borderline cases @@ -99,7 +99,7 @@ Word Count: {word_count} response = self.openai_client.chat.completions.create( model="gpt-5-nano", messages=[ - {"role": "system", "content": "You are an expert roleplay moderator. Always respond with valid JSON only. Do not include any text before or after the JSON object."}, + {"role": "system", "content": "You are an expert in-character moderator. Always respond with valid JSON only. Do not include any text before or after the JSON object."}, {"role": "user", "content": prompt} ], max_completion_tokens=2000 diff --git a/src/umabot/rules/intelligent_roleplay_moderator.py b/src/umabot/rules/intelligent_roleplay_moderator.py index 96e0ed9..7f46640 100644 --- a/src/umabot/rules/intelligent_roleplay_moderator.py +++ b/src/umabot/rules/intelligent_roleplay_moderator.py @@ -119,7 +119,7 @@ class IntelligentRoleplayModerator(Rule, IntelligentModeratorBase): # Format reasoning based on configuration (never include for art flair changes) formatted_reasoning = self._format_reasoning(evaluation, is_art_flair_change=True) - message = f"Hello u/{username},\n\nYour roleplay post has been automatically re-flaired as \"Art\" because it appears to be primarily showcasing artwork or visual content rather than roleplay." + message = f"Hello u/{username},\n\nYour in-character post has been automatically re-flaired as \"Art\" because it appears to be primarily showcasing artwork or visual content rather than in-character content." # Add reasoning if configured if formatted_reasoning: @@ -142,13 +142,13 @@ class IntelligentRoleplayModerator(Rule, IntelligentModeratorBase): # Format reasoning based on configuration formatted_reasoning = self._format_reasoning(evaluation) - message = f"Hello u/{username},\n\nYour roleplay post has been removed because it was determined to be low-effort content." + message = f"Hello u/{username},\n\nYour in-character post has been removed because it was determined to be low-effort content." # Add reasoning if configured if formatted_reasoning: message += f"\n\nReasoning: {formatted_reasoning}" - message += f"\n\nPost link: https://reddit.com{submission.permalink}\n\nTo improve your roleplay posts, consider:\n- Adding more detailed descriptions\n- Creating engaging scenarios\n- Including meaningful character interactions\n- Ensuring your content adds value to the community\n\nIf you enjoy active roleplay, join the official r/okbuddyumamusume Discord server! It features a comprehensive layout of channels, forums, roles, bots, events, and more! https://discord.gg/okbuddyumamusume\n\nIf you believe this was done in error, please contact the moderators via Mod Mail.\n\nThank you for understanding!" + message += f"\n\nPost link: https://reddit.com{submission.permalink}\n\nTo improve your in-character posts, consider:\n- Adding more detailed descriptions\n- Creating engaging scenarios\n- Including meaningful character interactions\n- Ensuring your content adds value to the community\n\nIf you enjoy active roleplay, join the official r/okbuddyumamusume Discord server! It features a comprehensive layout of channels, forums, roles, bots, events, and more! https://discord.gg/okbuddyumamusume\n\nIf you believe this was done in error, please contact the moderators via Mod Mail.\n\nThank you for understanding!" submission.author.message(subject, message) self.logger.info(f"Sent low-effort removal notification to {username}") diff --git a/test_moderator.py b/test_moderator.py index af9d4a5..3a108e7 100755 --- a/test_moderator.py +++ b/test_moderator.py @@ -419,7 +419,7 @@ def print_results(results: List[Dict[str, Any]], pause: bool = False, moderator: if "CHANGE_FLAIR_TO_ART" in actions: print(f"\nš§ Mod Mail (Art Flair Change):") print(f" Subject: Your post flair has been changed to Art") - print(f" Message: Your roleplay post has been automatically re-flaired as 'Art' because it appears to be primarily showcasing artwork or visual content rather than roleplay.") + print(f" Message: Your in-character post has been automatically re-flaired as 'Art' because it appears to be primarily showcasing artwork or visual content rather than in-character content.") # Format reasoning based on moderator's reasoning level (never include for art flair changes) if moderator: @@ -432,8 +432,8 @@ def print_results(results: List[Dict[str, Any]], pause: bool = False, moderator: if "REMOVE_POST" in actions: print(f"\nš§ Mod Mail (Low Effort Removal):") - print(f" Subject: Your roleplay post has been removed for low-effort") - print(f" Message: Your roleplay post has been removed because it was determined to be low-effort content.") + print(f" Subject: Your in-character post has been removed for low-effort") + print(f" Message: Your in-character post has been removed because it was determined to be low-effort content.") # Format reasoning based on moderator's reasoning level if moderator: |