Skip to content

Commit

Permalink
Created README.md, removed useless gradle plugins.
Browse files Browse the repository at this point in the history
  • Loading branch information
Laxystem committed Dec 13, 2023
1 parent 3a7eea7 commit a348529
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 773 deletions.
69 changes: 16 additions & 53 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,54 +1,17 @@
# 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 message commands and slash commands.
* A basic bot configuration that enables slash commands and shows you how to conditionally provide a different
message command prefix for different guilds.
* A Gradle Kotlin build script that uses the Kotlin Discord public maven repo, Detekt for linting (with a
fairly strict configuration) and a Git commit hook plugin that runs Detekt when you make a commit - this uses Gradle
7's new version catalog feature, for easy configuration of dependencies.
* GitHub 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've reasonable logging out of the box.

**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.

## Potential Changes

* The `.yml` files in `.github/` are used to configure GitHub apps. If you're not using them, you can remove 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](https://choosealicense.com/) if you're not sure where to start.
* In the `build.gradle.kts`:
* Set the `group` and `version` properties as appropriate.
* If you're not using this to test KordEx builds, you can remove the `mavenLocal()` from the `repositories` block.
* In the `application` and `tasks.jar` blocks, update the main class path/name as appropriate.
* To target a newer/older Java version, change the options in the `KotlinCompile` configuration and `java` blocks
* 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 TODOs 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.

## 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:

```dotenv
TOKEN=abc...
TEST_SERVER=123...
# Super Trouper

## Running

Create a `.env` file before running the bot.

```properties
TOKEN=
AUTOMATIC_CHANNEL_CREATION_MEMBER_LIMIT=30
IS_DEV_ENV=true
DONATE_URL=
LICENSE=Mozilla Public License 2.0
LICENSE_URL=https://www.mozilla.org/en-US/MPL/2.0/
OFFICIAL_SERVER=1130171551636004864
OFFICIAL_SERVER_URL=https://discord.gg/xJu6MH2KUc
REPO_URL=https://github.com/LaylaMeower/SuperTrouper
```

Create this file, fill it out, and run the `run` gradle task for testing in development.
10 changes: 0 additions & 10 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ plugins {
kotlin("plugin.serialization")

id("com.github.johnrengelman.shadow")
id("io.gitlab.arturbosch.detekt")
}

group = "quest.laxla"
Expand All @@ -26,7 +25,6 @@ repositories {
}
}

val detekt: String by project
val kordex: String by project
val serialization: String by project
val logback: String by project
Expand All @@ -43,8 +41,6 @@ dependencies {
implementation("io.github.oshai:kotlin-logging:$klogging")
runtimeOnly("org.slf4j:slf4j-api:$slf4j")
runtimeOnly("ch.qos.logback:logback-classic:$logback")

detektPlugins("io.gitlab.arturbosch.detekt:detekt-formatting:$detekt")
}

application {
Expand All @@ -68,9 +64,3 @@ java {
sourceCompatibility = java
targetCompatibility = java
}

detekt {
buildUponDefaultConfig = true

config.from(rootProject.files("detekt.yml"))
}
Loading

0 comments on commit a348529

Please sign in to comment.