Architecture Overview
Anisecord follows a modular, feature-centric architecture designed to separate business logic from Discord infrastructure.
Directory Structure
bot/
├── core/ # Core infrastructure and shared functionality
│ ├── bot.py # Main Bot class (extensions loading, error handling)
│ ├── config.py # Environment configuration
│ └── user/ # User Domain (Settings, Feature Gating)
├── features/ # Self-contained business features
│ ├── nutrition/ # Nutrition Coach Logic
│ └── sns_x/ # SNS-X (Twitter Draft) Logic
└── services/ # Shared Services and Adapters
├── discord/ # Discord API Data Access
└── llm/ # LLM Provider Access (Gemini via litellm)
Module Responsibilities
Layer Design
Within each Feature or Service, we adhere to a simplified Domain-Driven Design (DDD) approach:
Cog (Controller) |
Orchestrates the flow. Receives user input (interactions), calls Repositories to fetch data, uses Domain logic to process it, and sends responses back to the user. |
Domain |
Contains pure logic and data structures. It defines "how" to process data (e.g., formatting a prompt) but knows nothing about where data comes from (Database/API). |
Repository |
Handles data fetching and persistence. It acts as an interface to external worlds (Discord History, Database, LLMs). |