Skip to content

DiscordKit

An ergonomic framework for building Discord applications in Go.

DiscordKit is a framework layer built on top of discordgo.

It keeps discordgo as the transport and Discord data-model layer while adding the application-level tools that developers commonly build themselves: interaction routing, typed command builders, Components V2, forms, middleware, custom ID routing, command synchronization, and a safer response lifecycle.

Built on discordgo

Keep using familiar discordgo types and APIs. DiscordKit is additive, not a replacement for the underlying library.

One interaction router

Route slash commands, components, modal submissions, and autocomplete interactions through one consistent handler model.

Typed builders

Build commands, options, components, and forms through expressive Go APIs with validation before requests reach Discord.

Components V2

Compose modern Discord messages using containers, sections, text displays, buttons, selects, media, files, and other Components V2 primitives.

Predictable responses

DiscordKit tracks the interaction response lifecycle and catches invalid operations such as acknowledging the same interaction twice.

Escape hatches included

Access the underlying *discordgo.Session, interaction, and raw Discord component types whenever you need lower-level control.

A minimal DiscordKit application still looks and feels like a normal discordgo application:

s, err := discordgo.New("Bot " + os.Getenv("DISCORD_TOKEN"))
if err != nil {
log.Fatal(err)
}
router := discordkit.NewRouter()
router.Command("ping", func(c *discordkit.Context) error {
return c.ReplyText("Pong!")
})
s.AddHandler(router.Handle)

DiscordKit does not hide Discord or discordgo from you. It focuses on reducing the repetitive application infrastructure around interactions.

If this is your first DiscordKit application, continue with Getting Started.

If you already use discordgo, read DiscordKit and discordgo first to understand where DiscordKit fits into an existing application.