Skip to content

Latest commit

 

History

History
98 lines (59 loc) · 4.16 KB

CONTRIBUTING.md

File metadata and controls

98 lines (59 loc) · 4.16 KB

Contributing

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

Package Description
wrapper API Wrapper.
cache Cache.
shard Shard Manager.
tools Utility 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.53.3.

Directory Command Description GOWORK
disgo golangci-lint run ./wrapper/... Perform static code analysis on the API Wrapper. default
./_examples golangci-lint run ./... Perform static code analysis on the examples. default
./_gen golangci-lint run ./... Perform static code analysis on the generator. off
disgo golangci-lint run ./cache/... Perform static code analysis on the Disgo Cache. default
disgo golangci-lint run ./shard/... Perform static code analysis on the Shard Manager. default
disgo golangci-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 are used to test logic.

Integration Tests

Integration tests are used to ensure functionality between the API Wrapper and Discord.

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 Connections (UDP Decision, Audio Processing using Opus)
  2. Cache

Get assigned a feature or example now.