HIGH: Split api.py (3,219 lines) into FastAPI domain routers #32
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Problem
bot/api.py is a 3,219-line god module containing 100+ endpoints spanning every domain: mood management, evil/bipolar mode, GPU selection, autonomous triggers, profile picture management, manual messaging, figurine subscriptions, DM logging/blocking/analysis, image generation, voice call initiation, Cheshire Cat memory CRUD, configuration management, logging configuration, server CRUD, SSE chat streaming, and status/stats.
This makes the file extremely difficult to navigate, maintain, and review. Related endpoints are scattered throughout with no clear grouping.
Proposed Solution
Split into FastAPI APIRouter modules by domain:
Each router uses APIRouter(prefix='/domain', tags=['Domain']) and is included via app.include_router() in the factory.
Impact
Files Affected