How to Contribute
So, you'd like to contribute to discord-api-types
but don't know where to start or what to do? Here are some of the
things you need to keep in mind before opening a pull request!
We recommend you contribute either through locally editing the files on your desktop (which means also installing
npm
dependencies as this will ensure not only a consistent code style, but also that the
deno
types stay in sync automatically) or through a service like
GitHub Codespaces
.
No problem! We await you with open hands in our Discord Server
in the #developing-djs
channel.
Install npm dependencies first​
One of the most crucial steps is installing npm
dependencies via npm ci
. This ensures that
linting can be done, and it also sets up the git
hooks for building the deno
types and automatically
formatting/linting the code when you commit it.
If you forget to install npm
dependencies, or are doing the contributions through other
means (like directly from GitHub web), you might see a comment like this one being sent as a review to your pull
request:
The easiest way to solve this is to run the build:deno
script (yarn build:deno
) and pushing the results.
Figure out if the update you want to contribute respects our rules about documentation​
We will not document client-only / client related types. If you plan on contributing, make sure the types you want to document can be used by bots and are intended for usage by bots. This is a hard rule that will never change.
Not every single update to the API is valid to be documented here. Our main stance for documentation is that properties
must be known and documented on Discord's API Documentation repository
,
must be mentioned in an open pull request, must have received the green light to be used, or must be present in the
stable OpenAPI specification.
With that aside, there are times where documentation for certain types is not approved/merged by Discord on the grounds
that it isn't helpful for bots
(or similar), but it would actually benefit bot developers to have it documented (one
good example is the UserFlags SPAMMER
flag). As such, if you think your update should still be merged, please propose
it and we will be handled on a case by case basis. If approved, your update will be documented with an @unstable
tag.
It will also not be subject to the same versioning rules as the rest of the types.
Figure out what API versions need to receive the update​
discord-api-types
has multiple API versions in the repository, some of which may be considered deprecated
or
discontinued
as we keep them till the version is completely dead before removing them. This is a good time to figure
out which API versions need to be updated, and you can use the table below to guide you.
You can also check Discord's API versioning table
if
you want to be 1000% sure.
API Version | Should receive updates |
---|---|
10 | Yes |
9 | Yes |
8 | No |
7 | No |
6 | No |
If the version you want to contribute to is not listed above (for instance if a new API version rolls out) or if the
version you want to contribute to is for a different part of the API (for instance voice
), feel free to submit it and
we will review it accordingly.
Figure out where exactly are the files you need to modify to make the update​
The file structure might seem confusing at first, especially if it's your first time contributing, but we're here to guide you through it.
When you clone the repository for the first time, you'll see a folder structure like this (we've not mentioned some
tooling specific files like .eslintrc.json
to keep the structure clean). We've highlighted the important folders and
files you need to keep in mind when contributing.
├── deno
├── gateway
├── node_modules (once you ran `npm ci`)
├── payloads
├── rest
├── rpc
├── scripts