Skip to main content

Installation

Get DisGoLink installed and ready for building your Discord music bot.

Prerequisites

Before installing DisGoLink, ensure you have the following:
1

Go 1.21 or higher

DisGoLink requires Go 1.21+. Check your Go version:
go version
If you need to install or update Go, visit golang.org/doc/install.
2

A Discord Bot Application

You’ll need a Discord bot token. Create a bot at the Discord Developer Portal if you haven’t already.
Make sure to enable the “Server Members Intent” and “Message Content Intent” in your bot’s settings if needed.
3

A Running Lavalink Server

DisGoLink connects to a Lavalink server to handle audio processing. You can:
DisGoLink requires Lavalink 4.0.0 or higher. Earlier versions are not compatible.
Install DisGoLink v3 using Go modules:
go get github.com/disgoorg/disgolink/v3
This command downloads DisGoLink and adds it to your go.mod file.

Package Structure

DisGoLink consists of two main packages:
import (
    "github.com/disgoorg/disgolink/v3/disgolink"
    "github.com/disgoorg/snowflake/v2"
)

// Create a new Lavalink client
var userID = snowflake.ID(1234567890)
lavalinkClient := disgolink.New(userID)
The high-level client interface. This is where you’ll:
  • Create and manage the Lavalink client
  • Add and configure nodes
  • Create and control players
  • Register event listeners
  • Handle plugins
Low-level protocol types and structures. This package contains:
  • Track and playlist types
  • Player state structures
  • Event message types
  • Filter and effect definitions
  • REST API request/response types

Verify Installation

Create a simple test file to verify everything is installed correctly:
test.go
package main

import (
    "fmt"
    
    "github.com/disgoorg/disgolink/v3/disgolink"
    "github.com/disgoorg/snowflake/v2"
)

func main() {
    // Create a client
    client := disgolink.New(snowflake.ID(123456789))
    
    fmt.Println("DisGoLink installed successfully!")
    fmt.Printf("DisGoLink version: %s\n", disgolink.Version)
    
    // Clean up
    client.Close()
}
Run the test:
go run test.go
You should see:
DisGoLink installed successfully!
DisGoLink version: v3.x.x

Additional Dependencies

Depending on your Discord library choice, you’ll need to install it as well:
go get github.com/disgoorg/disgo
DisGoLink is designed to work best with DisGo as both libraries use the same Snowflake implementation, avoiding type conversion overhead.

Optional: Install Plugins

Extend DisGoLink with official plugins:
# SponsorBlock support
go get github.com/disgoorg/sponsorblock-plugin

# Advanced queue management
go get github.com/disgoorg/lavaqueue-plugin

# Additional audio sources
go get github.com/disgoorg/lavasrc-plugin

# Synchronized lyrics
go get github.com/disgoorg/lavalyrics-plugin

# Enhanced search
go get github.com/disgoorg/lavasearch-plugin
If you haven’t set up a Lavalink server yet, here’s a quick Docker setup:
docker-compose.yml
version: '3.8'

services:
  lavalink:
    image: ghcr.io/lavalink-devs/lavalink:4
    container_name: lavalink
    restart: unless-stopped
    environment:
      - _JAVA_OPTIONS=-Xmx2G
      - SERVER_PORT=2333
      - LAVALINK_SERVER_PASSWORD=youshallnotpass
    volumes:
      - ./application.yml:/opt/Lavalink/application.yml
    ports:
      - "2333:2333"
Start Lavalink:
docker-compose up -d

Troubleshooting

Module Resolution Issues

If you encounter module resolution errors:
go mod tidy
go mod download

Version Conflicts

Ensure you’re using DisGoLink v3:
go get github.com/disgoorg/disgolink/v3@latest

Snowflake Type Errors

Make sure you’re importing the correct Snowflake package:
import "github.com/disgoorg/snowflake/v2"

Next Steps

Now that DisGoLink is installed, you’re ready to build your first music bot!

Next: Quickstart

Learn how to create a working Discord music bot with DisGoLink

Build docs developers (and LLMs) love