Humble beginnings for documentation
parent
d006209857
commit
44433dd891
|
@ -0,0 +1,72 @@
|
||||||
|
# Compiling from source
|
||||||
|
## Initial setup
|
||||||
|
Spoticord is built using [rust](https://www.rust-lang.org/), so you'll need to install that first. It is cross-platform, so it should work on Windows, Linux and MacOS. You can find more info about how to install rust [here](https://www.rust-lang.org/tools/install).
|
||||||
|
|
||||||
|
### Rust formatter
|
||||||
|
Spoticord uses [rustfmt](https://github.com/rust-lang/rustfmt) to format the code, and we ask everyone that contributes to Spoticord to use it as well. You can install it by running the following command in your terminal:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
rustup component add rustfmt
|
||||||
|
```
|
||||||
|
|
||||||
|
If you are using VSCode, you can install the [rust-analyzer](https://marketplace.visualstudio.com/items?itemName=matklad.rust-analyzer) extension, which will automatically format your code when you save it (if you have `format on save` enabled). Although rust-analyzer is recommended anyway, as it provides a lot of useful features.
|
||||||
|
|
||||||
|
## Build dependencies
|
||||||
|
On Windows you'll need to install the [Visual Studio Build Tools](https://visualstudio.microsoft.com/downloads/#build-tools-for-visual-studio-2019) to be able to compile executables in rust (this will also be explained during the rust installation).
|
||||||
|
|
||||||
|
If you are on Linux, you can use your package manager to install the following dependencies:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
# Debian/Ubuntu
|
||||||
|
sudo apt install build-essential
|
||||||
|
|
||||||
|
# Arch
|
||||||
|
sudo pacman -S base-devel
|
||||||
|
|
||||||
|
# Fedora
|
||||||
|
sudo dnf install gcc
|
||||||
|
```
|
||||||
|
|
||||||
|
Additionally, you will need to install CMake and OpenSSL (Linux only). On Windows, you can download CMake [here](https://cmake.org/download/). On Linux, you can use your package manager to install them:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
# Debian/Ubuntu
|
||||||
|
sudo apt install cmake libssl-dev
|
||||||
|
|
||||||
|
# Arch
|
||||||
|
sudo pacman -S cmake openssl
|
||||||
|
|
||||||
|
# Fedora
|
||||||
|
sudo dnf install cmake openssl-devel
|
||||||
|
```
|
||||||
|
|
||||||
|
## Compiling
|
||||||
|
Now that you have all the dependencies installed, you can compile Spoticord. To do this, you'll first need to clone the repository:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
git clone https://github.com/SpoticordMusic/spoticord.git
|
||||||
|
```
|
||||||
|
|
||||||
|
After cloning the repo run the following command in the root of the repository:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
cargo build --release
|
||||||
|
```
|
||||||
|
|
||||||
|
Or if you want to build a release version:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
cargo build --release
|
||||||
|
```
|
||||||
|
|
||||||
|
This will compile the bot and place the executable in `target/release`. You can now run the bot by running the following command:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
./target/release/spoticord
|
||||||
|
```
|
||||||
|
|
||||||
|
If you are actively developing Spoticord, you can use the following command to build and run the bot (this is easier than building and running the bot manually):
|
||||||
|
|
||||||
|
```sh
|
||||||
|
cargo run
|
||||||
|
```
|
32
README.md
32
README.md
|
@ -1,3 +1,35 @@
|
||||||
# Spoticord
|
# Spoticord
|
||||||
|
|
||||||
Spoticord is a Discord music bot that allows you to control your music using the Spotify app.
|
Spoticord is a Discord music bot that allows you to control your music using the Spotify app.
|
||||||
|
Spoticord is built on top of [librespot](https://github.com/librespot-org/librespot) (with tiny additional changes), to allow full control using the Spotify client, with [serenity](https://github.com/serenity-rs/serenity) and [songbird](https://github.com/serenity-rs/songbird) for Discord communication.
|
||||||
|
Being built on top of rust, Spoticord is relatively lightweight and can run on low-spec hardware.
|
||||||
|
|
||||||
|
## How to use
|
||||||
|
### Official bot
|
||||||
|
Spoticord is being hosted as an official bot. You can find more info about how to use this bot over at [the Spoticord website](https://spoticord.com/).
|
||||||
|
|
||||||
|
### Environment variables
|
||||||
|
Spoticord uses environment variables to configure itself. The following variables are required:
|
||||||
|
- `DISCORD_TOKEN`: The Discord bot token used for authenticating with Discord.
|
||||||
|
- `DATABASE_URL`: The base URL of the database API used for storing user data. This base URL must point to an instance of [the Spoticord Database API](https://github.com/SpoticordMusic/spoticord-database).
|
||||||
|
- `SPOTICORD_ACCOUNTS_URL`: The base URL of the accounts frontend used for authenticating with Spotify. This base URL must point to an instance of [the Spoticord Accounts frontend](https://github.com/SpoticordMusic/spoticord-accounts).
|
||||||
|
|
||||||
|
Additionally you can configure the following variables:
|
||||||
|
- `GUILD_ID`: The ID of the Discord server where this bot will create commands for. This is used during testing to prevent the bot from creating slash commands in other servers, as well as getting the commands quicker. This variable is optional, and if not set, the bot will create commands in all servers it is in (this may take up to 15 minutes).
|
||||||
|
- `KV_URL`: The connection URL of a redis-server instance used for storing realtime data. While not required, not providing one will cause the bot to spit out quite a bit of errors. You might want to comment out those error lines in `main.rs`.
|
||||||
|
|
||||||
|
#### Providing environment variables
|
||||||
|
You can provide environment variables in a `.env` file at the root of the working directory of Spoticord.
|
||||||
|
You can also provide environment variables the normal way, e.g. the command line, using `export` (or `set` for Windows) or using docker.
|
||||||
|
Environment variables set this way take precedence over those in the `.env` file (if one exists).
|
||||||
|
|
||||||
|
# Compiling
|
||||||
|
For information about how to compile Spoticord from source, check out [COMPILING.md](COMPILING.md).
|
||||||
|
|
||||||
|
# Contact
|
||||||
|
![Discord Shield](https://discordapp.com/api/guilds/779292533053456404/widget.png?style=shield)
|
||||||
|
|
||||||
|
If you have any questions, feel free to join the [Spoticord Discord server](https://discord.gg/wRCyhVqBZ5)!
|
||||||
|
|
||||||
|
# License
|
||||||
|
Spoticord is licensed under the [Apache License 2.0](LICENSE).
|
|
@ -68,7 +68,7 @@ async fn main() {
|
||||||
warn!("No .env file found, expecting all necessary environment variables");
|
warn!("No .env file found, expecting all necessary environment variables");
|
||||||
}
|
}
|
||||||
|
|
||||||
let token = env::var("TOKEN").expect("a token in the environment");
|
let token = env::var("DISCORD_TOKEN").expect("a token in the environment");
|
||||||
let db_url = env::var("DATABASE_URL").expect("a database URL in the environment");
|
let db_url = env::var("DATABASE_URL").expect("a database URL in the environment");
|
||||||
let kv_url = env::var("KV_URL").expect("a redis URL in the environment");
|
let kv_url = env::var("KV_URL").expect("a redis URL in the environment");
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue