
Security News
pnpm 10.16 Adds New Setting for Delayed Dependency Updates
pnpm's new minimumReleaseAge setting delays package updates to prevent supply chain attacks, with other tools like Taze and NCU following suit.
com.jessecorbett:diskord-core-js
Advanced tools
A multiplatform Kotlin client for Discord bots with a simple and concise DSL supporting JVM and NodeJS
Built as a lean client using coroutines that gets the intricacies of rate limits, async, and data models out of your way in a clean and easy to use SDK
Using Diskord? Drop by our discord server
It is strongly recommended to use Gradle version 7 or higher
// Kotlin build.gradle.kts
repositories {
mavenCentral()
}
dependencies {
implementation("com.jessecorbett:diskord-bot:5.5.1")
}
Note: The diskord-bot
artifact bundles org.slf4j:slf4j-simple
to provide basic logging to STDOUT with no
configuration. This can be excluded in favor of your own slf4j logger using gradle exclusion:
// Kotlin build.gradle.kts
configurations {
implementation {
exclude("org.slf4j", "slf4j-simple")
}
}
The library is packaged into two artifacts.
diskord-core
is the low level implementation of the Discord API.
Read more
diskord-bot
provides an easier to use API for common bot functions.
Read more
For an example project you can easily clone to get started, look at the diskord-starter repo.
There are also a collection of examples in the diskord-examples repo.
import com.jessecorbett.diskord.bot.*
import com.jessecorbett.diskord.util.*
suspend fun main() {
bot(TOKEN) {
// Generic hook set for all events
events {
onGuildMemberAdd {
channel(WELCOME_CHANNEL_ID).sendMessage("Welcome to the server, ${it.user?.username}!")
}
}
// Modern interactions API for slash commands, user commands, etc
interactions {
slashCommand("echo", "Makes the bot say something") {
val message by stringParameter("message", "The message", optional = true)
callback {
respond {
content = if (message != null) {
message
} else {
"The message was null, because it is optional"
}
}
}
}
commandGroup("emoji", "Send an emoji to the server", guildId = "424046347428167688") {
subgroup("smile", "Smile emoji") {
slashCommand("slight", "A slight smile emoji") {
callback {
respond {
content = "🙂"
}
}
}
}
slashCommand("shh", "The shh emoji") {
val secret by stringParameter("secret", "Send the emoji secretly")
callback {
respond {
content = "🤫"
if (secret) {
ephemeral
}
}
}
}
}
}
// The old-fashioned way, it uses messages, such as .ping, for commands
classicCommands("!") {
command("ping") {
it.respond("pong")
}
}
}
}
FAQs
A Kotlin wrapper around the Discord API
We found that com.jessecorbett:diskord-core-js demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
pnpm's new minimumReleaseAge setting delays package updates to prevent supply chain attacks, with other tools like Taze and NCU following suit.
Security News
The Rust Security Response WG is warning of phishing emails from rustfoundation.dev targeting crates.io users.
Product
Socket now lets you customize pull request alert headers, helping security teams share clear guidance right in PRs to speed reviews and reduce back-and-forth.