Add docs for the CLI module
This commit is contained in:
+25
-25
@@ -1,78 +1,78 @@
|
||||
//! Payphone is a Discord bot that allows users to make calls to each other, similar to a phone
|
||||
//! system.
|
||||
//!
|
||||
//!
|
||||
//! # Setting Up
|
||||
//!
|
||||
//!
|
||||
//! First of all, clone the Git repository and navigate to the project directory:
|
||||
//!
|
||||
//!
|
||||
//! ```shell
|
||||
//! $ git clone --branch rewrite https://git.nyeki.dev/payphone/payphone.git
|
||||
//! $ cd payphone
|
||||
//! ```
|
||||
//!
|
||||
//!
|
||||
//! To boot up Payphone, you'll need both a Discord bot token and a Scylla database cluster with
|
||||
//! at least 3 nodes.
|
||||
//!
|
||||
//!
|
||||
//! - To get a Discord bot token, create a new bot application on the
|
||||
//! [Discord Developer Portal](https://discord.com/developers/applications).
|
||||
//!
|
||||
//!
|
||||
//! - To set up a Scylla database cluster, make sure to have Docker and Docker Compose installed
|
||||
//! and run `docker compose up -d`. A development cluster will be created with 3 nodes, with one
|
||||
//! of them listening at `127.0.0.1:9042`.
|
||||
//!
|
||||
//!
|
||||
//! To stop the database cluster at any time, run `docker compose down`. To stop it and delete the
|
||||
//! volumes (resetting the database), run `docker compose down -v`.
|
||||
//!
|
||||
//!
|
||||
//! ## Booting Up
|
||||
//!
|
||||
//!
|
||||
//! Payphone has a CLI interface that allows you to pass the bot token and database URL as CLI
|
||||
//! arguments. To get all possible arguments, run the following command:
|
||||
//!
|
||||
//!
|
||||
//! ```shell
|
||||
//! $ cargo run -- --help
|
||||
//! ```
|
||||
//!
|
||||
//!
|
||||
//! Payphone also supports configuration via environment variables and `.env` files by default.
|
||||
//!
|
||||
//!
|
||||
//! ```env
|
||||
//! PAYPHONE_TOKEN="your_discord_bot_token"
|
||||
//! ```
|
||||
//!
|
||||
//!
|
||||
//! All environment variables are prefixed with `PAYPHONE_` and can be used to override the CLI
|
||||
//! arguments.
|
||||
//!
|
||||
//!
|
||||
//! # Framework
|
||||
//!
|
||||
//!
|
||||
//! Payphone has a custom framework that allows you to create commands, components, and event
|
||||
//! handlers easily. The framework is designed to be modular and extensible, allowing you to add
|
||||
//! new features and commands without modifying the core codebase. The documentation for the
|
||||
//! framework is all in the [`framework`] module.
|
||||
//!
|
||||
//!
|
||||
//! # Database
|
||||
//!
|
||||
//!
|
||||
//! The database Payphone runs on is ScyllaDB, a high-performance NoSQL database compatible with
|
||||
//! Apache Cassandra. For documentation on how to interact with the database, check the
|
||||
//! Apache Cassandra. For documentation on how to interact with the database, check the
|
||||
//! [`database`] module's documentation.
|
||||
//!
|
||||
//!
|
||||
//! # Application Code
|
||||
//!
|
||||
//!
|
||||
//! Payphone's application code is under the [`groups`] module. It contains all commands, events,
|
||||
//! embeds, and other configurations for the bot grouped in submodules (e.g. [`groups::calls`],
|
||||
//! [`groups::about`], etc.), all which can be found at the [`groups`] module's documentation.
|
||||
//!
|
||||
//!
|
||||
//! Each submodule contains files like `commands.rs`, `events.rs`, `embeds.rs`, and `components.rs`
|
||||
//! that define the commands, events, embeds, and components for that group. Some common file names
|
||||
//! are:
|
||||
//!
|
||||
//!
|
||||
//! - `commands.rs`: Contains the commands for the group.
|
||||
//! - `events.rs`: Contains the event handlers for the group.
|
||||
//! - `embeds.rs`: Contains the embeds for the group.
|
||||
//! - `components.rs`: Contains the components for the group (action rows, buttons, soon also
|
||||
//! select menus).
|
||||
//!
|
||||
//!
|
||||
//! Always try to follow the same structure and patterns as the existing code to maintain
|
||||
//! consistency and readability.
|
||||
//!
|
||||
//!
|
||||
//! More documentation about each group can be found in the respective submodule's documentation.
|
||||
|
||||
use clap::Parser;
|
||||
@@ -117,7 +117,7 @@ pub async fn main() {
|
||||
env!("CARGO_PKG_VERSION")
|
||||
);
|
||||
|
||||
let db = database::init(args.database_url)
|
||||
let db = database::init(args.database_addr)
|
||||
.await
|
||||
.expect("Could not connect to the database!");
|
||||
|
||||
|
||||
Reference in New Issue
Block a user