Skip to content

Home

DiscordKt is a Kotlin Discord library, built on top of Kord - a Kotlin Discord API. For full documentation, you must choose a branch.

Release Snapshot

Syntax Samples

Below are some syntax samples for the library.

Startup

fun main(args: Array<String>) {
    val token = "your-bot-token"

    bot(token) {
      prefix { "+" }
    }
}

Commands

fun demo() = commands("Demo") {
    command("Hello") {
        description = "A 'Hello World' command."
        execute {
            respond("Hello World!")
        }
    }

    command("Add") {
        description = "Add two numbers together."
        execute(IntegerArg, IntegerArg) {
            val (first, second) = args
            respond(first + second)
        }
    }
}

Events

fun testListeners() = listeners {
    on<MessageCreateEvent> {
        println(message.content)
    }
}