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 behaviour
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
}
}
Replace {version}
with the latest version number on maven central.
For Snapshots replace {version}
with {branch}-SNAPSHOT
e.g: 0.7.x-SNAPSHOT
repositories {
mavenCentral()
// Kord Snapshots Repository (Optional):
maven("https://oss.sonatype.org/content/repositories/snapshots")
}
dependencies {
implementation("dev.kord:kord-core:{version}")
}
repositories {
mavenCentral()
// Kord Snapshots Repository (Optional):
maven("https://oss.sonatype.org/content/repositories/snapshots")
}
dependencies {
implementation("dev.kord:kord-core:{version}")
}
<repository>
<id>snapshots-repo</id>
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
<releases>
<enabled>false</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
<dependency>
<groupId>dev.kord</groupId>
<artifactId>kord-core-jvm</artifactId>
<version>{version}</version>
</dependency>