I don’t take any responsibility for blocked Discord accounts that used this module.

Using this on a user account is prohibited by the Discord TOS and can lead to the account block.

Note

This repository always can be removed by the author of kord. I didn’t test many times, so I can’t doubt everything working.

Kord

Kord is still in an experimental stage, as such we can’t guarantee API stability between releases. While we’d love for you to try out our library, we don’t recommend you use this in production just yet.

If you have any feedback, we’d love to hear it, hit us up on discord or write up an issue if you have any suggestions!

What is Kord

Kord is a coroutine-based, modularized implementation of the Discord API, written 100% in Kotlin.

Why use Kord

Kord was created as an answer to the frustrations of writing Discord bots with other JVM libraries, which either use thread-blocking code or verbose and scope restrictive reactive systems. We believe an API written from the ground up in Kotlin with coroutines can give you the best of both worlds: The conciseness of imperative code with the concurrency of reactive code.

Aside from coroutines, we also wanted to give the user full access to lower level APIs. Sometimes you have to do some unconventional things, and we want to allow you to do those in a safe and supported way.

Documentation

Installation

will added soon 🙂

Modules

Core

A higher level API, combining rest and gateway, with additional (optional) caching. Unless you’re writing your own abstractions, we’d recommend using this.

suspend fun main() {
    val kord = Kord("your account token")

    kord.on<MessageCreateEvent> {
        val content = message.content
        val channel = message.channel
        if (!prefixCommand.startsWith(prefix)) return@on

        val rawArguments = content.split(" ")
        val prefixCommand = rawArguments[0]
        message.delete()
        when (prefixCommand.substring(prefix.length).lowercase()) {
            "ping" -> {
                val calc = System.currentTimeMillis()
                val message = channel.createMessage("Calculating ping...")
                message.edit { this.content = ":ping_pong: Pong!\nCalculated ping : ${System.currentTimeMillis() - calc}ms, Gateway Ping : ${kord.gateway.averagePing}" }
            }
        }
    }

    kord.login()
}

will added more maybe

FAQ

Will you support kotlin multi-platform

We will, there’s an issue open to track the features we want/need to make a transition to MPP smooth.

When will you document your code

Yes.

GitHub

View Github