# Discord Data Collector - Agent Guide ## Commands - **Setup**: `python setup.py` - Install dependencies and create config files - **Run Main**: `python main.py` - Start Discord data collector - **CLI Tools**: `python cli.py [command]` - Available: export, stats, search, backup, cleanup, test - **Test Imports**: `python test_imports.py` - Verify all dependencies work - **Install Dependencies**: `pip install -r requirements.txt` ## Architecture - **Entry Points**: `main.py` (main app), `cli.py` (CLI tools), `setup.py` (installation) - **Core Modules**: - `src/client.py` - Discord client implementation with data collection - `src/database.py` - MariaDB database manager with UserData dataclass - `src/config.py` - TOML/env configuration management - `src/rate_limiter.py` - API rate limiting - `src/logger.py` - Logging setup - **Data Storage**: JSON files in `data/` directory, backups in `data/backups/` - **Configuration**: `config.toml` for app settings, `.env` for Discord token ## Code Style - **Python**: 3.8+ required, async/await patterns throughout - **Imports**: Standard library first, third-party, then local (`from .module import Class`) - **Error Handling**: Comprehensive try/catch with logging, graceful degradation - **Naming**: snake_case for variables/functions, PascalCase for classes - **Types**: Type hints required (`typing` module), dataclasses for data structures - **Async**: All I/O operations use async/await, proper cleanup in finally blocks