From e35b200d03ae4d34d917c0d0732f72188b1a644c Mon Sep 17 00:00:00 2001 From: Rafael Bradley Date: Wed, 13 Aug 2025 14:34:26 -0300 Subject: [PATCH] Add docs for the servers sub-module of groups --- src/groups/mod.rs | 8 ++++---- src/groups/servers/events.rs | 5 +++++ src/groups/servers/mod.rs | 5 +++++ 3 files changed, 14 insertions(+), 4 deletions(-) diff --git a/src/groups/mod.rs b/src/groups/mod.rs index e116d92..d51cf4e 100644 --- a/src/groups/mod.rs +++ b/src/groups/mod.rs @@ -1,16 +1,16 @@ //! Payphone-specific code. All features like calls and moderation go here. -//! +//! //! Sub-modules in this module usually follow the same structure: -//! +//! //! - A `mod.rs` file exporting the public API of the sub-module. //! - A `commands.rs` file containing the command definitions. //! - A `embeds.rs` file containing embed-generating functions for those commands. //! - A `events.rs` file containing event handlers related to the features the sub-module covers. //! - Any additional modules the sub-module may specifically require. -//! +//! //! An example of extra modules not listed above is the [`calls::moderation`] module, which //! includes the tools for parsing messages and detecting rule breakings in them. -//! +//! //! > *Note that not all sub-modules have commands, nor they all have event listeners, etc. Each of //! > them only defines the modules they need.* diff --git a/src/groups/servers/events.rs b/src/groups/servers/events.rs index 3fb423c..436a9b4 100644 --- a/src/groups/servers/events.rs +++ b/src/groups/servers/events.rs @@ -1,3 +1,5 @@ +//! The event handlers for the servers sub-module. + use std::sync::Arc; use async_trait::async_trait; @@ -14,6 +16,7 @@ use crate::{ state::State, }; +/// Adds servers to the DB when they get created. #[derive(Debug)] pub struct ServerCreateHandler; @@ -43,6 +46,7 @@ impl OnServerCreateHandler for ServerCreateHandler { } } +/// Updates DB server data when a server gets updated. #[derive(Debug)] pub struct ServerUpdateHandler; @@ -74,6 +78,7 @@ impl OnServerUpdateHandler for ServerUpdateHandler { } } +/// Deletes servers from the DB when they get deleted or payphone is kicked. #[derive(Debug)] pub struct ServerDeleteHandler; diff --git a/src/groups/servers/mod.rs b/src/groups/servers/mod.rs index a9970c2..bcdab60 100644 --- a/src/groups/servers/mod.rs +++ b/src/groups/servers/mod.rs @@ -1 +1,6 @@ +//! Payphone's Discord server-related features. +//! +//! This sub-module is responsible for registering servers in the database, updating them when they +//! update, and removing them when they get deleted or Payphone is kicked. + pub mod events;