Skip to content

Installing HalpBot

Pumbas600 edited this page Jan 23, 2022 · 8 revisions

Prerequisites

  • Java 16+
  • JDA version 4.3.0_285+

This beginners guide is created using IntelliJ. You can download the community version for free from here. If you're a student, you can get the ultimate version for free through an educational license.

Creating a Project in IntelliJ

The first step to creating a Java bot is to create the project which is where we will create all the code for our bot. After clicking on IntelliJ, you can create a new project by selecting the New Project button.

[Insert image here]

You'll then want to select a Gradle project (Gradle will be what we use to manage the dependencies our bot requires). You'll also want to make sure that the project SDK if 16+ and that the only additional libraries and frameworks selected is Java.

[Inset image here]

Is your project SDK not 16? Click on the dropdown and then Download JDK. You can then select version 16 from that the popup to download the appropriate JDK (Java Development Kit - Basically the version of java we're using).

After selecting Next, we then need to name our project and set the group id for our project. This is used to distinguish the files created by you from those created by any dependencies you might be using (This is particularly important in the event that there are two java files with the same name as this group id is the only way to distingish between them).

[Insert image here]

When your press Finish, IntelliJ will then automatically create our project with a few files. The important one for us is build.gradle. This is where we will be adding our dependencies so that we can use Halpbot.

In that file, there's a few thing's we'll want to add

Adding HalpBot to Your Project

You can add HalpBot to your project by downloading HalpBot-Core-1.0.1.jar from here: https://github.com/pumbas600/HalpBot/releases/tag/1.0.1

In your project create a new folder called libs and place the downloaded .jar inside. Your project should look something like this:

HalpBotJarFile

In your build.gradle file, you'll then need to add the following:

repositories {
    mavenCentral()

    // Import the JDA Library
    maven {
        name 'm2-dv8tion'
        url 'https://m2.dv8tion.net/releases'
    }
}

dependencies {
    // Load all .jar files from /libs
    implementation fileTree(dir: 'libs', include: '*.jar')
    // Load the JDA Library
    implementation 'net.dv8tion:JDA:4.3.0_285'
}

// This is used by the built in 'Halp' command to generate command usages.
tasks.withType(JavaCompile) {
    options.compilerArgs << '-parameters'
}

And just like that, you're all set to start using HalpBot.

Continue to: Creating Your First Command

Clone this wiki locally