Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/disgoorg/disgo/llms.txt

Use this file to discover all available pages before exploring further.

Installation

Get started with DisGo by installing the library in your Go project. DisGo is distributed as a standard Go module and integrates seamlessly with Go’s tooling.

Requirements

Go version

Go 1.24.0 or higher required

Discord bot

Bot token from Discord Developer Portal
1

Install Go

If you don’t have Go installed, download it from the official Go website. Verify your installation:
go version
You should see output like go version go1.24.0 linux/amd64 or higher.
DisGo requires Go 1.24.0 or later due to its use of modern Go features including generics and the standard library’s log/slog package.
2

Create a new Go project

Initialize a new Go module for your bot:
mkdir my-discord-bot
cd my-discord-bot
go mod init example.com/my-discord-bot
Replace example.com/my-discord-bot with your own module path.
3

Install DisGo

Add DisGo to your project using go get:
go get github.com/disgoorg/disgo
This will download DisGo and its dependencies, then update your go.mod file automatically.
DisGo follows semantic versioning. The latest stable version is recommended for production bots.
4

Verify installation

Check that DisGo was added to your go.mod file:
cat go.mod
You should see DisGo listed in the require section:
go.mod
module example.com/my-discord-bot

go 1.24.0

require github.com/disgoorg/disgo v0.18.0
The version number may differ depending on the latest release.

Core dependencies

DisGo automatically installs its required dependencies:

gorilla/websocket

WebSocket implementation for Gateway connections

disgoorg/snowflake

Discord snowflake ID handling

disgoorg/json

Optimized JSON marshaling/unmarshaling

golang.org/x/crypto

Cryptographic operations for voice encryption

Optional dependencies

Depending on your bot’s features, you may want to install additional DisGo ecosystem packages: If you’re building a music bot, install DisGolink to integrate with Lavalink:
go get github.com/disgoorg/disgolink/v3

Paginator utilities

For interactive pagination in your bot:
go get github.com/disgoorg/paginator

Create your Discord bot

Before you can run your bot, you need to create a bot application in the Discord Developer Portal:
1

Visit the Developer Portal

Go to the Discord Developer Portal and sign in.
2

Create a new application

Click New Application, give it a name, and create it.
3

Create a bot user

Navigate to the Bot section in the sidebar and click Add Bot.
4

Get your token

Under the Token section, click Copy to copy your bot token.
Never share your bot token! Anyone with your token can control your bot. If your token is compromised, regenerate it immediately in the Developer Portal.
5

Configure privileged intents (if needed)

Some features require privileged intents:
  • Presence Intent: For user status updates
  • Server Members Intent: For member join/leave events
  • Message Content Intent: For reading message content
Enable the intents your bot needs in the Bot section.
6

Generate invite link

Go to OAuth2URL Generator:
  1. Select the bot scope
  2. Select the permissions your bot needs
  3. Copy the generated URL and open it to invite your bot to a server

Environment setup

Store your bot token securely using environment variables:
.env
DISCORD_TOKEN=your_bot_token_here
Add .env to your .gitignore file to prevent accidentally committing your token to version control.
In your code, read the token from the environment:
main.go
package main

import (
    "os"
    "github.com/disgoorg/disgo"
)

func main() {
    token := os.Getenv("DISCORD_TOKEN")
    if token == "" {
        panic("DISCORD_TOKEN environment variable is not set")
    }

    client, err := disgo.New(token)
    if err != nil {
        panic(err)
    }

    // Your bot code here
}

Next steps

Now that DisGo is installed, you’re ready to build your first bot:

Quickstart

Build a ping-pong bot in minutes

Basic concepts

Understand DisGo’s architecture

Build docs developers (and LLMs) love