Template repository for quickly getting started with a KordEx bot https://kordex.dev
Find a file Use this template
2025-09-18 18:34:14 +01:00
.forgejo/workflows Add GH workflows 2025-09-08 12:50:52 +01:00
.idea KordEx 2.3.6-SNAPSHOT 2025-09-18 18:34:14 +01:00
gradle KordEx 2.3.6-SNAPSHOT 2025-09-18 18:34:14 +01:00
src/main fix typo and remove generated comment (#57) 2025-08-10 10:09:19 +01:00
workflows/.github Add GH workflows 2025-09-08 12:50:52 +01:00
.editorconfig CI: Java 17, dependency graph 2023-08-20 16:43:53 +01:00
.env.example feat(env): Created an example .env file for easy copy and pasting. (#5) 2023-11-30 21:13:09 +00:00
.gitattributes It's an example bot! 2021-03-07 16:46:41 +00:00
.gitignore Update .gitignore and Dockerfile for new project requirements 2024-08-13 20:55:08 +01:00
build.gradle.kts Update KordEx and deps, fix logging 2025-05-30 10:18:58 +01:00
detekt.yml Update Java, add editorconfig, reformat 2023-08-16 12:36:52 +01:00
Dockerfile Switch to Forgejo workflow 2025-09-07 12:47:46 +01:00
gradle.properties KordEx 1.9.0, Gradle 8.8 2024-07-01 19:52:52 +01:00
gradlew Update Gradle and plugin, switch to distribution plugin from shadow 2025-03-23 16:41:18 +00:00
gradlew.bat Update Gradle and plugin, switch to distribution plugin from shadow 2025-03-23 16:41:18 +00:00
LICENSE Initial commit 2021-03-07 12:12:24 +00:00
README.md Add GH workflows 2025-09-08 12:50:52 +01:00
settings.gradle.kts Use gradle version catalogs for kordex and plugin versions (#53) 2024-11-23 14:08:02 +00:00

KordEx Bot Template

This repository contains a basic KordEx example bot for you to use as a template for your own KordEx bots. This includes the following:

  • A basic extension that allows you to slap other people, using both chat commands and slash commands.
  • A basic bot configuration that enables slash commands and shows you how to conditionally provide a different chat command prefix for different guilds.
  • A Gradle Kotlin build script that uses the KordEx Gradle plugin and Detekt for linting (with a fairly strict configuration) this uses Gradle 7's new version catalogue feature, for easy configuration of dependencies.
  • Forgejo CI scripts that build the bot and publish its artefacts.
  • A reasonable .gitignore file, including one in the .idea folder that ignores files that you shouldn't commit if you're using IDEA yourself, you should install the Ignore plugin to handle changes to this for you.
  • A Groovy-based Logback config, so you have reasonable logging out of the box.
  • A default set of translations in src/main/resources/translations, and automatic generation of Key objects.
  • Automatic generation of a Dockerfile via a createDockerFile task, also run at build time.
  • The buildscript packages the bot using the Gradle distribution plugin, with the final distribution placed in build/distributions in both .tar and .zip format.

Note: This template includes a .editorconfig file that defaults to using tabs for indentation in almost all file types. This is because tabs are more accessible for the blind, or those with impaired vision. We won't accept feedback or PRs targeting this approach, though you can always change it in your projects.

Potential Changes

  • The .yml files in .forgejo/ are used to configure Forgejo Actions. If you're not using them, you can remove them.
  • The workflows folder contains sample GitHub Actions workflows, if you're building your project on GitHub. Delete .forgejo/ and move workflows/.github into the project's root folder to use them.
  • The provided LICENSE file contains The Unlicense, which makes this repository public domain. You will probably want to change this—we suggest looking at Choose a License if you're not sure where to start.
  • In the build.gradle.kts:
    • Set the group and version properties as appropriate.
    • In the kordEx and tasks.jar block, update the main class path/name as appropriate.
    • In the kordEx block, update the KordEx version if needed.
  • In the settings.gradle.kts, update the name of the root project as appropriate.
  • The bundled Detekt config is pretty strict—you can check over detekt.yml if you want to change it, but you need to follow the to-dos in that file regardless.
  • The Logback configuration is in src/main/resources/logback.groovy. If the logging setup doesn't suit, you can change it there.
  • The default translation bundle in src/main/resources/translations will likely need to be renamed for your project.
  • In src/main/dist, read the README.md file and consider adding any relevant plugins there.

Bundled Bot

  • App.kt includes a basic bot, which uses environment variables (or variables in a .env file) for the testing guild ID (TEST_SERVER) and the bot's token (TOKEN). You can specify these either directly as environment variables, or as KEY=value pairs in a file named .env. Some example code is also included that shows one potential way of providing different command prefixes for different servers.
  • TestExtension.kt includes an example extension that creates a slap command - this command works as both a message command and slash command, and allows you to slap other users with whatever you wish, defaulting to a large, smelly trout.

To test the bot, we recommend using a .env file that looks like the following:

TOKEN=abc...
TEST_SERVER=123...

Create this file, fill it out, and run the run gradle task for testing in development.

Further Reading

To learn more about KordEx and how to work with it, please read the documentation.

For more information on the KordEx Gradle plugin and what you can do with it, please read this README.