Manual Setup (No Plugin)
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
- Gradle (Kotlin)
- Gradle (Groovy)
- Maven
- SBT
Add the core dependency to your gradle/libs.versions.toml file.
Then, add the required Gradle plugins to your build.gradle.kts file.
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/"))
}
}
Add the core dependency to your gradle/libs.versions.toml file.
Then, add the required Gradle plugins to your build.gradle file.
Finally, add the required repositories, source sets and dependency to your build.gradle file.
repositories {
// ...
mavenCentral()
maven {
name "KordEx (Snapshots, R2)"
url "https://snapshots-repo.kordex.dev"
}
maven {
name "KordEx (Releases, R2)"
url "https://releases-repo.kordex.dev"
}
maven {
name "KordEx (Snapshots + Mirror, Reposilite)"
url "https://repo.kordex.dev/snapshots"
}
maven {
name "KordEx (Mirror, R2)"
url "https://mirror-repo.kordex.dev"
}
}
dependencies {
// ...
implementation libs.kord.extensions.core
ksp libs.kord.extensions.ap
}
sourceSets.main.java.srcDirs += target.layout.buildDirectory.file("generated/ksp/main/kotlin/")
sourceSets.test.java.srcDirs += target.layout.buildDirectory.file("generated/ksp/test/kotlin/")
Kord Extensions is developed using Gradle, and none of the developers are familiar with Maven.
While Gradle is highly recommended, if you do decide to use Maven, we'd appreciate feedback on the below instructions — especially if corrections or more detail is required.
The following instructions don't configure the KSP plugin or kotlinx.serialization. For more information, please see the linked pages.
Add the following to your pom.xml file.
For more information, see the official Maven guide for Kotlin.
Kord Extensions is developed using Gradle, and none of the developers are familiar with SBT.
While Gradle is highly recommended, if you do decide to use SBT, we'd appreciate feedback on the below instructions — especially if corrections or more detail is required.
The following instructions don't configure the KSP plugin. As of this writing, it seems to be impossible to reasonably configure KSP using SBT.
Add the following to your project/plugins.sbt file.
addSbtPlugin("org.jetbrains.scala" % "sbt-kotlin-plugin" % "3.1.5")
Then, add the following to your build.sbt file.
For more information, see the official Kotlin SBT plugin.
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 ofnone,minimal,standardorextra.- May also be provided using the
dataCollectionsystem property orDATA_COLLECTIONenvironmental variable. - Defaults to
standardif not provided.
- May also be provided using the
versions.bot- Your bot's version.- Used exclusively to provide a default value for
botVersionin your bot's configuration builder.
- Used exclusively to provide a default value for
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.