Skip to content

Environment

Aaron Peterham edited this page Dec 27, 2022 · 2 revisions

There are two ways to run the bot.

Both require you to complete the steps on this page

  • Without Docker

    Build the project, set up a mysql database, and java -jar jarfilehere
  • With Docker

    Build the project, change the .env variables, and docker compose up

Set up Local Environment

Requirements

I'll skip a tutorial on how to install gradle, java, and the text editor.

Build

Cloning

Clone the repository from Github. The master branch should always be in a functional state. Ask to be invited so you can push commits to the repository

Gradle sync

From here, you can refresh gradle to sync the dependencies. There is a gradle menu on the top-right of IntelliJ. The refresh icon will sync gradle with the build.gradle file to sync the dependencies.

gradle.properties

In the ./gradle.properties file, set the botsBuildDir= to the (possibly absolute) path location you want the shadowJar to build to. The folder ${botsBuildDir}/ambrosia will hold the generated configuration files later. Note that you can also set this variable in gradle.properties in GRADLE_USER_HOME

shadowJar

Run the gradle shadowJar task. It will build in the ./build directory, and copy to ${botsBuildDir}/ambrosia if you have it set. To run the shadowJar task. Using the menu specified in the Gradle Sync section of this tutorial, You can navigate the tree %ProjectName% > Tasks > shadow > shadowJar.

Database

Head over to one of the following depending on how you plan to run the bot

After you've completed the steps in one of these guides, continue to the next section here for configuration.

Configuration

Database Connection

Fill in the appropriate fields for the database connection in the generated ./Database/Config/Database.config.json.
Then change isConfigured to true, and DROP_THE_DATABASE_AND_RECREATE to true
Then run the bot again to generate more files. Again it should fail, but with a different warning

Discord Bot

Fill in the appropriate fields for the discord bot in the generated ./Discord/Config/Discord.config.json. Refer to Developer Portal for your Bot token.

Fill in the appropritate fields in ./Discord/Config/Permissions.config.json as well.

Finishing up

You should be able to run the bot now! Remember to change DROP_THE_DATABASE_AND_RECREATE back to false

Clone this wiki locally