@@ -16,28 +16,31 @@ This is a Python-based Reddit moderation log publisher that automatically scrape
1616
1717## Development Commands
1818
19+ ** IMPORTANT** : Always use ` /opt/.venv/redditbot/bin/python ` for all Python commands in this project.
20+
1921### Setup and Dependencies
2022``` bash
21- # Install dependencies
22- pip install praw
23-
23+ # Dependencies are pre-installed in the venv
2424# Copy template config (required for first run)
2525cp config_template.json config.json
2626```
2727
2828### Running the Application
2929``` bash
3030# Test connection and configuration
31- python modlog_wiki_publisher.py --test
31+ /opt/.venv/redditbot/bin/ python modlog_wiki_publisher.py --test
3232
3333# Single run
34- python modlog_wiki_publisher.py --source-subreddit SUBREDDIT_NAME
34+ /opt/.venv/redditbot/bin/ python modlog_wiki_publisher.py --source-subreddit SUBREDDIT_NAME
3535
3636# Continuous daemon mode
37- python modlog_wiki_publisher.py --source-subreddit SUBREDDIT_NAME --continuous
37+ /opt/.venv/redditbot/bin/python modlog_wiki_publisher.py --source-subreddit SUBREDDIT_NAME --continuous
38+
39+ # Force wiki update only (using existing database data)
40+ /opt/.venv/redditbot/bin/python modlog_wiki_publisher.py --source-subreddit SUBREDDIT_NAME --force-wiki
3841
3942# Debug authentication issues
40- python debug_auth.py
43+ /opt/.venv/redditbot/bin/ python debug_auth.py
4144```
4245
4346### Database Operations
@@ -59,26 +62,25 @@ sqlite3 modlog.db "DELETE FROM processed_actions WHERE created_at < date('now',
5962
6063The application supports both JSON config files and CLI arguments (CLI overrides JSON):
6164
65+ ### Core Options
6266- ` --source-subreddit ` : Target subreddit for reading/writing logs
6367- ` --wiki-page ` : Wiki page name (default: "modlog")
6468- ` --retention-days ` : Database cleanup period (default: 30)
6569- ` --batch-size ` : Entries fetched per run (default: 100)
6670- ` --interval ` : Seconds between updates in daemon mode (default: 300)
6771- ` --debug ` : Enable verbose logging
68- - ` anonymize_moderators ` : Whether to show "HumanModerator" for human mods (default: true)
69-
70- ### Configuration Options
7172
72- ** Moderator Display (` anonymize_moderators ` )** :
73- - ` true ` (default): Shows "AutoMod", "Reddit", or "HumanModerator"
74- - ` false ` : Shows actual moderator usernames
73+ ### Display Options
74+ - ` anonymize_moderators ` : Whether to show "HumanModerator" for human mods (default: true)
75+ - ` true ` (default): Shows "AutoMod", "Reddit", or "HumanModerator"
76+ - ` false ` : Shows actual moderator usernames
7577
76- ** Database Storage ** :
77- - All moderator names are stored as actual usernames in the database regardless of display setting
78- - Removal reasons from the Reddit API are stored in the ` removal_reason ` column with intelligent text/number handling
79- - Target authors are stored in the ` target_author ` column for proper content attribution
80- - Multi-subreddit support with ` subreddit ` column for data separation
81- - Content IDs are extracted from permalinks and stored for tracking
78+ ### Database Features
79+ - ** Multi-subreddit support ** : Single database handles multiple subreddits safely
80+ - ** Removal reason storage ** : Full text/number handling from Reddit API
81+ - ** Target author tracking ** : Actual usernames stored and displayed
82+ - ** Content ID extraction ** : Unique IDs from permalinks for precise tracking
83+ - ** Data separation ** : Subreddit column prevents cross-contamination
8284
8385## Authentication Requirements
8486
@@ -111,50 +113,59 @@ User profile links are a privacy concern and not useful for modlog purposes.
111113
112114## Recent Improvements (v2.1)
113115
114- ** Multi-Subreddit Database Support** :
116+ ### Multi-Subreddit Database Support
115117- ✅ Fixed critical error that prevented multi-subreddit databases from working
116118- ✅ Single database now safely handles multiple subreddits with proper data separation
117119- ✅ Per-subreddit wiki updates without cross-contamination
118120- ✅ Subreddit-specific logging and error handling
119121
120- ** Removal Reason Transparency** :
122+ ### Removal Reason Transparency
121123- ✅ Fixed "Removal reason applied" showing instead of actual text
122124- ✅ Full transparency - shows ALL available removal reason data including template numbers
123125- ✅ Consistent handling between storage and display logic using correct Reddit API fields
124126- ✅ Displays actual removal reasons like "Invites - No asking", "This comment has been filtered due to crowd control"
125127
126- ** Unique Content ID Tracking** :
128+ ### Unique Content ID Tracking
127129- ✅ Fixed duplicate IDs in markdown tables where all comments showed same post ID
128130- ✅ Comments now show unique comment IDs (e.g., "n7ravg2") for precise tracking
129131- ✅ Posts show post IDs for clear content identification
130132- ✅ Each modlog entry has a unique identifier for easy reference
131133
132- ** Content Linking and Display** :
134+ ### Content Linking and Display
133135- ✅ Content links point to actual Reddit posts/comments, never user profiles for privacy
134136- ✅ Fixed target authors showing as [ deleted] - now displays actual usernames
135137- ✅ Proper content titles extracted from Reddit API data
136138- ✅ AutoModerator displays as "AutoModerator" (not anonymized)
137139- ✅ Configurable anonymization for human moderators
138140
139- ** Data Integrity** :
141+ ### Data Integrity
140142- ✅ Pipe character escaping for markdown table compatibility
141143- ✅ Robust error handling for mixed subreddit scenarios
142144- ✅ Database schema at version 5 with all required columns
143145- ✅ Consistent Reddit API field usage (action.details vs action.description)
144146
147+ ## Development Guidelines
148+
149+ ### Git Workflow
150+ - If branch is not main, you may commit and push if a PR is draft or not open
151+ - Use conventional commits for all changes
152+ - Use multiple commits if needed, or patch if easier
153+ - Always update CLAUDE.md and README.md when making changes
154+
155+ ### Code Standards
156+ - Always escape markdown table values like removal reasons for pipes
157+ - Store pipe-free data in database to prevent markdown issues
158+ - Confirm cache file of wiki page and warn if same, interactively ask to force refresh
159+ - Always use the specified virtual environment path
160+
161+ ### Documentation
162+ - Always update commands and flags in documentation
163+ - Remove CHANGELOG from CLAUDE.md (keep separate)
164+ - Create and update changelog based on git tags (should be scripted)
165+
145166## Common Issues
146167
147- - 401 errors: Check app type is "script" and verify client_id/client_secret
148- - Wiki permission denied: Ensure bot has moderator or wiki contributor access
149- - Rate limiting: Increase ` --interval ` and/or reduce ` --batch-size `
150- - always update CLAUDE.md and README.md
151- - if branch is not main then you may commit and push if a PR is draft or not open
152- - always update commands and flags
153- - if an .venv has been told to use, remember it
154- - always remove CHANGELOG from CLAUDE.md
155- - always create and update a changelog. this should be scripted and based on a git tag?
156- - always use conventional commits
157- - use multiple commits if needed. you may patch if easier, do this automatically
158- - rewrite this file to be more organized
159- - always escape markdown table values like removal reasons for pipes; just do this in the database, no pipes
160- - confirm the cache file of wiki page and ensure warn if the the same interfactively ask to force refresh
168+ - ** 401 errors** : Check app type is "script" and verify client_id/client_secret
169+ - ** Wiki permission denied** : Ensure bot has moderator or wiki contributor access
170+ - ** Rate limiting** : Increase ` --interval ` and/or reduce ` --batch-size `
171+ - ** Module not found** : Always use ` /opt/.venv/redditbot/bin/python ` instead of system python
0 commit comments