major-domo-v2/utils
Cal Corum 8ebbc26a0d CLAUDE: Add automatic transaction logging to #transaction-log channel
Implemented automatic posting of transaction notifications to #transaction-log
channel when transactions are submitted via /dropadd or /ilmove commands.

**New Utility:**
- `utils/transaction_logging.py` - Centralized transaction logging function
  - `post_transaction_to_log()` - Posts transaction embed to #transaction-log
  - Uses team's ML affiliate for consistent branding
  - Displays team thumbnail, colors, and player moves
  - Shows season from transaction data (not hardcoded)
  - Format matches legacy transaction log embeds

**Integration Points:**
- `/dropadd` (scheduled transactions) - Posts when submitted
- `/ilmove` (immediate transactions) - Posts when executed
- Both use shared `post_transaction_to_log()` function

**Embed Format:**
```
Week 18 Transaction
[Team Name]
Player Moves:
- **PlayerName** (sWAR) from OLDTEAM to NEWTEAM
- **PlayerName** (sWAR) from OLDTEAM to NEWTEAM
[Team Thumbnail]
Footer: "SBa Season 12" with SBA logo
```

**Features:**
- Automatic ML affiliate lookup for consistent team display
- Team colors and thumbnails in embeds
- Season number from transaction data
- Graceful error handling (logs warnings, doesn't block submission)
- Matches legacy embed format exactly

**Files Changed:**
- NEW: `utils/transaction_logging.py` - Transaction logging utility
- MODIFIED: `views/transaction_embed.py` - Added logging calls on submission

**Testing:**
- Transaction builder tests pass (31/31)
- No new test failures introduced
- Logging is non-blocking (submission succeeds even if logging fails)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-23 12:24:37 -05:00
..
__init__.py CLAUDE: Initial commit for discord-app-v2 rebuild 2025-08-15 00:04:50 -05:00
autocomplete.py CLAUDE: Refine injury roll display and cleanup imports 2025-10-16 22:20:13 -05:00
cache.py CLAUDE: Fix type annotations in CacheManager for JSON-serializable types 2025-10-14 00:22:01 -05:00
CLAUDE.md CLAUDE: Add comprehensive CLAUDE.md documentation files for AI agent guidance 2025-10-20 20:30:07 -05:00
decorators.py CLAUDE: Major bot enhancements - Admin commands, player stats, standings, schedules 2025-08-28 15:32:38 -05:00
discord_helpers.py CLAUDE: Refactor scorebug display and add dynamic channel visibility 2025-10-22 16:58:21 -05:00
listeners.py Refactored listener logic and added SpoilerListener 2025-10-22 14:59:19 -05:00
logging.py CLAUDE: SUCCESSFUL STARTUP - Discord Bot v2.0 fully operational 2025-08-16 07:36:47 -05:00
random_gen.py CLAUDE: Major bot enhancements - Admin commands, player stats, standings, schedules 2025-08-28 15:32:38 -05:00
scorebug_helpers.py CLAUDE: Refactor scorebug display and add dynamic channel visibility 2025-10-22 16:58:21 -05:00
team_utils.py CLAUDE: Refine injury roll display and cleanup imports 2025-10-16 22:20:13 -05:00
text_utils.py CLAUDE: Add smart text splitting for Discord embed fields 2025-10-21 14:46:24 -05:00
transaction_logging.py CLAUDE: Add automatic transaction logging to #transaction-log channel 2025-10-23 12:24:37 -05:00