Work In Progress
This documentation is in beta. It's missing lots of content, search is broken, and many links go nowhere. These problems will be fixed before release, but there's plenty of work left!
Skip to main content

Manual Setup (No Plugin)

warning

This tutorial aims to provide a guide to creating a standard project setup without using our template projects or the KordEx Gradle plugin.

We strongly recommend using the Gradle plugin if possible, and most of this documentation will assume that you are. For more information on setting up a project with the plugin, see this guide instead.


Dependency Information

  • Kord Extensions Version:
  • Minimum JDK:
  • Repo: https://snapshots-repo.kordex.dev
  • Coordinate: dev.kordex:kord-extensions

Requirements

Before getting started, please ensure you have the following:

  • A new or existing project, configured with your build system of choice.
  • A Java Development Kit version compatible with your build system, and at least version .

Dependencies

Kord Extensions provides multiple dependencies, depending on what your project needs:

  • Annotation Processor: dev.kordex:annotation-processor (KSP annotation processor required for a few things)
  • Core: dev.kordex:kord-extensions (Required core module containing everything you need to write a Discord bot)
    • Kord Extensions includes the API dependencies listed on the version picker page. If you need to use them, remember not to depend on them directly.
  • Token Parser: dev.kordex:token-parser (Library for parsing chat command strings into usable token streams)

It also provides many extra modules, split into categories. For more information, see the corresponding directory on GitHub.

Build Configuration

Add the core dependency to your gradle/libs.versions.toml file.

Please wait, loading versions...

Then, add the required Gradle plugins to your build.gradle.kts file.

Please wait, loading versions...

Finally, add the required repositories, source sets and dependency to your build.gradle.kts file.

repositories {
// ...

mavenCentral()

maven {
name = "KordEx (Snapshots, R2)"
url = uri("https://snapshots-repo.kordex.dev")
}

maven {
name = "KordEx (Releases, R2)"
url = uri("https://releases-repo.kordex.dev")
}

maven {
name = "KordEx (Snapshots + Mirror, Reposilite)"
url = uri("https://repo.kordex.dev/snapshots")
}

maven {
name = "KordEx (Mirror, R2)"
url = uri("https://mirror-repo.kordex.dev")
}
}

dependencies {
// ...

implementation(libs.kord.extensions.core)
ksp(libs.kord.extensions.ap)
}

sourceSets.getByName("main") {
java {
srcDir(target.layout.buildDirectory.file("generated/ksp/main/kotlin/"))
}
}

sourceSets.getByName("test") {
java {
srcDir(target.layout.buildDirectory.file("generated/ksp/test/kotlin/"))
}
}

Resource Files

The KordEx Gradle plugin normally generates some .properties files to be included with your bot. These files provide some additional configuration options, as well as bundling some version information with your bot.

Bot Settings

You can add some properties to src/main/resources/kordex.properties.

The following properties are optional, and failing to provide them won't break anything:

  • modules - List of first-party Kord Extensions modules used by your bot.
    • Used exclusively for data collection.
  • settings.dataCollection - Data collection level, one of none, minimal, standard or extra.
    • May also be provided using the dataCollection system property or DATA_COLLECTION environmental variable.
    • Defaults to standard if not provided.
  • versions.bot - Your bot's version.
    • Used exclusively to provide a default value for botVersion in your bot's configuration builder.
  • versions.kord - The version of Kord used to build your bot.
    • Used exclusively for logging and data collection.
    • Defaults to the version used to build Kord Extensions if not provided.