Skip to content

Commit

Permalink
add JDA-KTS support
Browse files Browse the repository at this point in the history
  • Loading branch information
dkim19375 committed May 21, 2021
1 parent 69df2ec commit acf96cb
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
15 changes: 14 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ THE API IS STILL VERY NEW, RESULTING IN FREQUENT CHANGES**
work, please notify me!**

## Adding the dependency
Gradle:
```groovy
repositories {
maven { url = 'https://jitpack.io' }
Expand All @@ -18,7 +19,19 @@ dependencies {
implementation 'com.github.dkim19375:dkim19375JDAUtils:VERSION'
}
```

Maven:
```xml
<repository>
<id>jitpack</id>
<name>jitpack</name>
<url>https://jitpack.io/</url>
</repository>
<dependency>
<groupId>com.github.dkim19375</groupId>
<artifactId>dkim19375JDAUtils</artifactId>
<version>VERSION</version>
</dependency>
```
## Setting up the bot
A class, that holds information such as the commands, needs to be
created. It extends `me.dkim19375.dkim19375JDAUtils.BotBase`.
Expand Down
5 changes: 5 additions & 0 deletions src/main/kotlin/me/dkim19375/dkim19375jdautils/BotBase.kt
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package me.dkim19375.dkim19375jdautils

import dev.minn.jda.ktx.injectKTX
import me.dkim19375.dkim19375jdautils.annotation.API
import me.dkim19375.dkim19375jdautils.command.Command
import me.dkim19375.dkim19375jdautils.command.HelpCommand
Expand All @@ -24,6 +25,7 @@ import kotlin.system.exitProcess
abstract class BotBase {
abstract val name: String
abstract val token: String
open val injectKTS = false
open val customListener: CustomListener = object : CustomListener() {}
open val intents = mutableSetOf(GatewayIntent.GUILD_MESSAGE_REACTIONS, GatewayIntent.DIRECT_MESSAGE_REACTIONS)

Expand Down Expand Up @@ -61,6 +63,9 @@ abstract class BotBase {
started = true
println("Starting bot")
val builder = JDABuilder.createDefault(token)
if (injectKTS) {
builder.injectKTX()
}
builder.enableIntents(intents)
val jda = builder.build()
this.jda = jda
Expand Down

0 comments on commit acf96cb

Please sign in to comment.