How aonghasmackay/mackaysmememachine works
Main Components
a) Discord Interface Layer
• Discord.js client connection
• Event handlers (from /events directory)
• Command handlers (from /commands directory)
b) Application Core
• Command processing logic
• Event processing system
• Authentication/Authorization (admin checks)
c) Database Layer
• Sequelize ORM
• Two main models: Users and Leaderboard
• Database connection management
d) Scheduled Tasks System
• Cron jobs for balance resets
• Leaderboard updates
e) Auxiliary Services
• Health check endpoint (Express server)
• Logging system
• Blue: Discord-related components
• Green: Core application logic
• Yellow: Database components
• Orange: Scheduled tasks
• Gray: Auxiliary services
[Component Relationships]
┌─────────────────────────────────────┐
• Discord API │
• ┘
• ↕
┌─────────────────────────────────────┐
• Discord.js Client │
• ┘
┌─────────────────┐ ┌─────────────────┐
• Event Handlers │ │ Command Handlers │
• ┘ └─────────────────┘
• ↓ ↓
┌─────────────────────────────────────┐
• Core Logic Layer │
• Score Processing │
• User Management │
• Admin Verification │
• ┘
┌─────────────┐ ┌─────────────┐ ┌─────────────┐
• Sequelize │ │ Cron Jobs │ │ Express │
• ORM │ │ Scheduler │ │HealthCheck │
• ┘ └─────────────┘ └─────────────┘
• ↓ ↓ ↓
┌─────────────┐ ┌─────────────┐ ┌─────────────┐
• Database │ │ Logging │ │ Health │
• (SQL) │ │ System │ │ Status │
• ┘ └─────────────┘ └─────────────┘
Important Details
• Two main data models (Users and Leaderboard) in the database layer
• Two custom emoji reaction paths in the event handling system
• Daily balance reset and monthly leaderboard update cron jobs
• Admin-only command paths separately from regular commands
• Logging system's interaction with all components
Key Interactions to Emphasize
• Reaction events → Score processing → Database updates
• Command processing → Authorization → Action execution
• Scheduled tasks → Database operations
• Health check endpoint → System status
Additional Notes
• A note about the single-server limitation
• Configuration dependency (config.json)
• Debug mode paths
• Admin-only functionalities