Contributing

March 1, 2025 ยท View on GitHub

License

You agree to license any contribution to this library under the Apache License 2.0.

Pull Requests

Pull requests must follow the code specification and work with all test cases.

Domain

The domain of Disgo in providing an API for HTTP/WebSocket requests. The program uses provided structures (from the Discord API) to provide simple abstractions for end users (developers).

Project Structure

The repository contains a README, Examples, Code Generator, Cache, Shard Manager, API Tools, and API Wrapper.

Disgo

PackageDescription
wrapperAPI Wrapper.
cacheCache.
shardShard Manager.
toolsUtility Tools.

A bundler is used to package the API into a disgo package (disgo.go).

Structs

Structs are sourced from Dasgo.

disgo.User
disgo.GetUser

Requests

Resource GET, DELETE, POST, PUT, BULK (GET, ...) Send() functions are generated from the respective requests object. For more information, read the requests README.

Code Specification

Code Generation

Disgo uses generators to easily update and maintain over 10,000 lines of code. For more information, read gen.

Comments

Comments follow Effective Go and explain why more than what (unless the "what" isn't intuitive).

Static Code Analysis

Disgo uses golangci-lint in order to statically analyze code. You can install golangci-lint with go install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.64.5.

DirectoryCommandDescriptionGOWORK
disgogolangci-lint run ./wrapper/...Perform static code analysis on the API Wrapper.default
./_examplesgolangci-lint run ./...Perform static code analysis on the examples.default
./_gengolangci-lint run ./...Perform static code analysis on the generator.off
disgogolangci-lint run ./cache/...Perform static code analysis on the Disgo Cache.default
disgogolangci-lint run ./shard/...Perform static code analysis on the Shard Manager.default
disgogolangci-lint run ./tools/...Perform static code analysis on the Tools package.default
Runtime Errors
  1. If you receive a diff error, add a diff tool in your PATH: There is one located in the Git/bin directory.
  2. If you receive File is not ... with -..., use golangci-lint run --disable-all --no-config -Egofmt --fix or ignore it.
  3. If you receive main module ... does not contain package ..., set GOWORK=off.

Fieldalignment

Disgo fieldaligns bundled code to save memory.

Test

Unit Tests

Unit tests test logic.

Integration Tests

Integration tests prove functionality between the API Wrapper and Discord.

TestWhat feature is tested?
coverage_test.goDiscord API Feature Coverage
ratelimit_test.goGlobal, Per-Route, Gateway Rate Limits
session_test.goDisgo Gateway Session
voice_test.goDisgo Voice Connection

Running Tests

Use go test to run the tests in the current directory.

Use go test ./<dir> to run tests in a given directory (from the current directory).

Use Github Action Workflow Files to find the correct test command and environment variables for a module.

Roadmap

Disgo is STABLE.

The following additional features are being implemented:

  1. Voice Audio Processing
  2. Cache

Get assigned a feature or example now.