Kord core
is an implementation of the discord api build on top of the gateway, rest and
cache modules. It features a high level representation of Discord's entities and
their behavior in a non-blocking, coroutine focused, event-driven design.
suspend fun main() {
val kord = Kord("your bot token")
// Flow style
kord.events
.filterIsInstance<MessageCreateEvent>()
.map { it.message }
.filter { it.author?.isBot == false }
.filter { it.content == "!ping" }
.onEach { it.channel.createMessage("pong") }
.launchIn(kord)
// Simplified style
kord.on<MessageCreateEvent> {
if (message.author?.isBot == true) return@on
if (message.content == "!ping") message.channel.createMessage("pong")
}
kord.login {
@OptIn(PrivilegedIntent::class)
intents += Intent.MessageContent
}
}
See the root README for more information.
dependencies {
implementation("dev.kord:kord-core:{version}")
}
dependencies {
implementation("dev.kord:kord-core:{version}")
}
<dependency>
<groupId>dev.kord</groupId>
<artifactId>kord-core-jvm</artifactId>
<version>{version}</version>
</dependency>