How wout-m/discord-net-bots works
Main Components
• Core Library: The heart of the application, represented by the Discord.Bots.Core project. It includes configuration files, event handling classes (e.g., ReadyEvent, GuildEvent, InteractionEvent, MessageEvent), modules (AdminModule, BirthdayModule, ButtonModule, etc.), job scheduling components (BirthdayJob, JobFactory, QuartzExtension), models, and services.
• Individual Bot Projects: There are several bots such as Discord.Bots.ExWi, Discord.Bots.KGB, Discord.Bots.The_Wanderers_Helper, and a test project (Discord.Bots.Test). Each one has its own Program.cs, which functions as the entry point and ties into the core library.
• External Integrations and APIs: The bots interact with external services—for instance, the Open Trivia API, the InspiroBot API, and the various Discord APIs (using Discord.NET). Also note Quartz.NET for job scheduling.
• CI/CD and Deployment Environment: The presence of .github/workflows files points to automated builds/deployments for the different bots. The README and Dockerfile instructions indicate that Docker containers running on a Raspberry Pi (optionally managed via Portainer) are used for hosting.
Relationships and Interactions
• The Bot Projects (ExWi, KGB, Wanderers Helper, Test) depend on and reference the Core library, using its modules, events, and services to perform functions.
• The Core library’s event service listens and routes Discord events (like messages, reactions, new guild activity) to appropriate modules and jobs.
• External APIs (Open Trivia, InspiroBot) are integrated via modules to provide dynamic content or fun functionalities.
• Scheduled tasks (birthday checks) are managed by Quartz.NET through the job components in the core.
• The CI/CD pipeline (depicted by the GitHub workflows) builds and tests the solution, then packages the bots into Docker images for deployment.
Architectural Patterns and Design Principles
• Modular Design: The clear separation of shared functionality (in the Core project) from the various bot entry points emphasizes modularity and reuse.
• Event-Driven Architecture: The event handling system in the Core library suggests an event-driven approach, where Discord events trigger corresponding modules or services.
• Containerized Deployment: The Dockerfile and hosting instructions indicate that the bots are containerized for easier deployment and scalability.
Relevant Technologies and Frameworks
• .NET 6.0: The project’s primary runtime environment.
• Discord.NET: The library for creating Discord bots.
• Quartz.NET: Used for scheduled jobs (e.g., birthday checks).
• Docker: For containerizing and deploying the bots on a Raspberry Pi.