Add documentation for main.rs

This commit is contained in:
2025-08-13 00:21:36 -03:00
parent fd71345cd0
commit 80ed00f796
+11
View File
@@ -139,6 +139,10 @@ mod logging;
mod state; mod state;
mod utils; mod utils;
/// Payphone's main entrypoint function.
///
/// Parses ENV variables and CLI arguments, sets up the logger, and runs [`start`] or [`docs`]
/// depending on the command.
#[tokio::main] #[tokio::main]
pub async fn main() { pub async fn main() {
dotenvy::dotenv().ok(); dotenvy::dotenv().ok();
@@ -162,6 +166,9 @@ pub async fn main() {
} }
} }
/// Starts a Payphone shard.
///
/// TODO: Support multiple shards.
async fn start(token: String, database_addr: String) { async fn start(token: String, database_addr: String) {
log::info!("Welcome to Payphone, Nyeki!"); log::info!("Welcome to Payphone, Nyeki!");
log::info!( log::info!(
@@ -195,6 +202,10 @@ async fn start(token: String, database_addr: String) {
bot.run(&token).await.expect("Could not run bot!"); bot.run(&token).await.expect("Could not run bot!");
} }
/// Boots up a documentation server.
///
/// It compiles the crate's documentation and recompiles it automatically when the source code
/// changes.
async fn docs(bind: SocketAddr, open_on_start: bool) { async fn docs(bind: SocketAddr, open_on_start: bool) {
log::info!("Compiling documentation..."); log::info!("Compiling documentation...");