From de0584e2f45044996395d7827b1796d6ce7456c2 Mon Sep 17 00:00:00 2001 From: Jude Southworth Date: Thu, 23 Mar 2023 15:49:10 +0000 Subject: [PATCH] Update README.md --- README.md | 27 ++++++++++++++++++--------- 1 file changed, 18 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index 343992c..d703a7f 100644 --- a/README.md +++ b/README.md @@ -2,23 +2,32 @@ A bot for managing sound effects in Discord. -### Building +## Installing -`sudo apt install gcc gcc-multilib cmake ffmpeg` +Download a .deb file from the releases and install with `sudo apt install ./soundfx_rs-a.b.c_arm64.deb`. You will also need a database set up. Install MySQL 8. -Run the migrations in the `migrations` directory to set up the database. +## Running & config -Use the Cargo.toml file to build it. Needs Rust 1.52+ +The bot is installed as a systemd service `soundfx-rs`. Use `systemctl start soundfx-rs` and `systemctl stop soundfx-rs` to respectively start and stop the bot. -### Running & Config +Config options are provided in a file `/etc/soundfx-rs/default.env` -The bot connects to the MySQL server URL defined in a `.env` file in the working directory of the program. - -Config options: +Options: * `DISCORD_TOKEN`- your token (required) * `DATABASE_URL`- your database URL (required) -* `MAX_SOUNDS`- specifies how many sounds a user should be allowed without Patreon +* `MAX_SOUNDS`- specifies how many sounds a user should be allowed without having the `PATREON_ROLE` specified below * `PATREON_GUILD`- specifies the ID of the guild being used for Patreon benefits * `PATREON_ROLE`- specifies the role being checked for Patreon benefits * `CACHING_LOCATION`- specifies the location in which to cache the audio files (defaults to `/tmp/`) * `UPLOAD_MAX_SIZE`- specifies the maximum upload size to permit in bytes. Defaults to 2MB + +## Building from source + +1. Install build dependencies: `sudo apt install gcc gcc-multilib cmake ffmpeg libopus-dev` +2. Install database server: `sudo apt install mysql-server-8.0`. Create a database called `soundfx` +3. Install Cargo and Rust from https://rustup.rs +4. Install SQLx CLI: `cargo install sqlx-cli` +5. From the source code directory, execute `sqlx migrate run` +6. Build with cargo: `cargo build --release` + +When running from source, the config options above can be configured simply as environment variables.