Saturday, October 31, 2026
HomeGolangA zero-dependency Discord API v10 driver for Go - Releases

A zero-dependency Discord API v10 driver for Go – Releases


gda is a low-level Go driver for the Discord API v10 and Gateway WebSocket protocol, applied utilizing solely the Go normal library (web/http, crypto/ed25519, compress/zlib).

Structure & Design

  • Zero Exterior Dependencies: Pure Go 1.24 stdlib. Zero third-party packages in go.mod.
  • Charge Limiting: Pre-flight, route-bucketed coordination monitoring Discord’s per-route header buckets and world limits in reminiscence earlier than request execution.
  • Interactions: Unified router for software instructions and elements over each persistent Gateway WebSockets and stateless HTTPS webhooks with Ed25519 verification.
  • Gateway: WebSocket state machine with heartbeat watchdog, session resume and non-compulsory zlib stream decompression.
  • State Administration: Zero default in-memory caching for guilds, channels or members. Cache structure is delegated totally to the appliance layer.

Set up & Utilization

go get github.com/sfossl/gda@v0.1.0
package deal important

import (
	"context"
	"fmt"
	"log"
	"os"

	"github.com/sfossl/gda"
	"github.com/sfossl/gda/varieties"
)

func important() {
	shopper, err := gda.New(
		os.Getenv("DISCORD_TOKEN"),
		gda.WithIntents(varieties.IntentGuildMessages|varieties.IntentMessageContent),
	)
	if err != nil {
		log.Deadly(err)
	}

	shopper.OnReady(func(ctx context.Context, r *varieties.ReadyEvent) {
		fmt.Printf("Linked as %sn", r.Person.Username)
	})

	shopper.OnMessageCreate(func(ctx context.Context, msg *varieties.Message) {
		if msg.Creator.Bot {
			return
		}
		if msg.Content material == "ping" {
			fmt.Printf("Ping acquired from %sn", msg.Creator.Username)
		}
	})

	if err := shopper.Begin(context.Background()); err != nil {
		log.Deadly(err)
	}
}

Suggestions, bug reviews and benchmarks could be submitted at GitHub Points.

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular

Recent Comments