brew install openjdk@11 maven
sudo apt install openjdk-11-jre maven
git clone https://github.com/kyleyannelli/KMusicBot && cd KMusicBot
.kmusicbot-core
directory, and create a file called .env, like so:
DISCORD_BOT_TOKEN="YOUR_BOT_TOKEN"
SPOTIFY_CLIENT_ID="YOUR_SPOTIFY_CLIENT_ID" SPOTIFY_SECRET_ID="YOUR_SPOTIFY_SECRET_ID"
MAX_RECOMMENDER_THREADS=10 MAX_COMMAND_THREADS=10
6. Go to the root directory of the project... `cd ../`
7. Run the bot:
- With Docker: `./BuildThenRunWithDocker -d`
- Without Docker: `mvn clean install && cd kmusicbot-core && mvn exec:java`
8. Done :)
### With a Database
1. Follow steps 1-6 from [Without a Database](#without-a-database).
2. If you already setup the SQL user and know what you're doing, skip to step 13. Install MariaDB (or MySQL). On MacOS, `brew install mariadb`. Debian-based/Ubuntu, `sudo apt install mariadb-server`.
3. Run the command `sudo mysql`.
4. You are now in the MariaDB/MySQL CLI. You need to create a database and a user. First, the database.
`CREATE DATABASE MAKE_YOUR_OWN_NAME_PLEASE;` You now have a database with the name you created!
5. Now, creating the user. This requires you to be aware of where the database and bot are running from. If they are running on the same machine, we can use localhost.
`CREATE USER 'kmusic'@'localhost' IDENTIFIED BY 'very-strong-password-please-dont-use-this;' Make SURE to create a STRONG password.
6. From here we need to ensure this kmusic@localhost user can access MAKE_YOUR_OWN_NAME_PLEASE database, and only that database. Do not grant *.*.
`GRANT ALL PRIVILEGES ON MAKE_YOUR_OWN_NAME_PLEASE.* TO 'kmusic'@'localhost' WITH GRANT OPTION;'
7. To ensure the changes are in place, finally, run `FLUSH PRIVILEGES;` You can now exit the SQL CLI with `exit;`
8. Now, make sure you are in the kmusicbot-database directory. From there, in `src/main/resources/`, copy the `hibernate.cfg.xml.example` to `hibernate.cfg.xml` and `liquibase.properties.example` to `liquibase.properties`
9. Begin with the hibernate file. Adjust the line with the URL like so, `jdbc:mariadb://localhost:3306/MAKE_YOUR_OWN_NAME_PLEASE`
Next, adjust the user and password accordingly.
10. Moving onto the liquibase file, do the same!
11. That was a lot of steps, I know. Your bot will now record user listening activity. You can now continue back from step 7 of [Without a Database](#without-a-database).
## Running the Web API Service
#### I will not provide assistance with DNS, Port Forwarding, and the like.
1. From the Discord Developer portal, obtain your OAuth credentials (ID & Secret). Write them down.
2. Go into the kmusicbot-api, create a file called .env, like so:
DISCORD_CLIENT_ID="" DISCORD_CLIENT_SECRET=""
DISCORD_REDIRECT_URI="https://FQDN/api/callback"
ENCRYPTION_PASS="notSomethingLike1234Please"
CORS_URI="https://music.kmfg.dev"
COOKIE_URI="kmfg.dev"
3. Make sure the entire project has been compiled, if not, go to the root directory and `mvn clean install`.
In `kmusicbot-api` run `mvn exec:java`. Your API is now running!
#### I do not plan on adding a guide for Windows.