How meizubot/bot works
Main Components
a. Discord Bot Core
• This as a central component
• Connection to Discord API
• Core/ directory components (bot.py, context.py)
b. Extension System
• Extensions into logical categories:
• Core Features (general.py, useful.py)
• Gaming Features (games/osu.py, casino.py)
• Integration Features (twitter.py, api.py)
• Internal Operations (internal/*)
• Interactive Features (giveaways.py, interactions.py)
c. Database Layer
• PostgreSQL database
• Connection to utils/db.py
• Different SQL schemas (from scripts/sql/*)
• Users
• Events
• Stats
• Twitch
• General
d. Web Interface
• FastAPI/Uvicorn server
• IPC connection to bot
• Connection to database
e. Utility Layer
• Utils/ directory components
• Utilities:
• Button system (buttons/)
• Database utilities (db.py)
• Logging system (logging.py)
• Time utilities (time.py)
• Database connections from both bot and web interface
• IPC communication between bot and web server
• Extensions to core bot component
• Utility layer supporting all components
Important Details
• Configuration flow (config.yml)
• Logging structure (logs/ directory)
• Extension loading system
• Error handling flow (internal/errorhandler.py)
• Background task system (background.py)
Architectural Patterns to Highlight
• Plugin-based architecture (extensions/)
• Event-driven design (Discord bot events)
• Service layer pattern (utils/)
• MVC-like pattern in web interface
Data Access Layer (Database & Utils)
• Component types
• Any abbreviations used
Keep the abstraction level focused on the major components while showing the relationship between the bot, web interface, and database, as these are the key architectural elements of the system.
Remember to emphasize the asynchronous nature of the system, particularly in the bot's interaction with Discord's API and the database operations.