22 lines
662 B
Kotlin
22 lines
662 B
Kotlin
|
package nl.voidcorp.discord
|
||
|
|
||
|
import net.dv8tion.jda.api.JDABuilder
|
||
|
import nl.voidcorp.discord.command.Command
|
||
|
import nl.voidcorp.discord.command.CommandMessage
|
||
|
import nl.voidcorp.discord.command.CommandResult
|
||
|
import nl.voidcorp.discord.events.CommandListener
|
||
|
import nl.voidcorp.discord.events.OttoListener
|
||
|
import org.springframework.stereotype.Component
|
||
|
|
||
|
@Component
|
||
|
class Loader(listener: CommandListener) {
|
||
|
init {
|
||
|
val token = System.getenv("DISCORD_TOKEN") ?: throw RuntimeException("'DISCORD_TOKEN' not set!")
|
||
|
|
||
|
val builder = JDABuilder(token)
|
||
|
|
||
|
builder.addEventListeners(OttoListener, listener)
|
||
|
|
||
|
jda = builder.build()
|
||
|
}
|
||
|
}
|