diff --git a/.github/workflows/docs.yaml b/.github/workflows/docs.yaml index 351551b698..69f8419138 100644 --- a/.github/workflows/docs.yaml +++ b/.github/workflows/docs.yaml @@ -22,12 +22,12 @@ jobs: with: node-version: 20 cache: npm + cache-dependency-path: tools/package-lock.json - name: Install dependencies run: npm ci + working-directory: tools - name: Check Markdown Tables - run: | - shopt -s globstar - npx markdown-table-formatter docs/**/*.{md,mdx} --check - shell: bash + run: npm run test:tables + working-directory: tools diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 6cc6208987..9bb68aa6f0 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -19,20 +19,13 @@ jobs: with: node-version: 20 cache: npm + cache-dependency-path: tools/package-lock.json - run: npm ci + working-directory: tools - run: npm run lint + working-directory: tools - run: npm run build - links: - name: Check Links - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v5 - - uses: actions/setup-node@v5 - with: - node-version: 20 - cache: npm - - run: npm ci - - run: npm run test:links + working-directory: tools mdx: name: Validate mdx runs-on: ubuntu-latest @@ -42,5 +35,8 @@ jobs: with: node-version: 20 cache: npm + cache-dependency-path: tools/package-lock.json - run: npm ci + working-directory: tools - run: npm run test:build + working-directory: tools diff --git a/.gitignore b/.gitignore index e979de24b3..162dc1edf1 100644 --- a/.gitignore +++ b/.gitignore @@ -3,4 +3,4 @@ node_modules/ dist/ .idea -xml_output/ \ No newline at end of file +xml_output/ diff --git a/.prettierignore b/.prettierignore deleted file mode 100644 index 96c0ecc381..0000000000 --- a/.prettierignore +++ /dev/null @@ -1 +0,0 @@ -docs/ \ No newline at end of file diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 48f2b315a9..84a1020936 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -22,82 +22,13 @@ See the [README](https://github.com/discord/discord-api-docs/blob/main/README.md ## Markdown Syntax -This repository uses special markdown syntax that helps style the resulting web version of the documentation. +Our documentation uses standard [Markdown](https://www.markdownguide.org/basic-syntax/) syntax with some additional [MDX](https://mdxjs.com/) features. -### H6 Headings +We also support the following formatting from Mintlify: -H6 headings should be used above tables and code blocks to properly label them. - -### Linking - -Links between docs can be achieved by using a hash symbol (#), plus the markdown file name, plus a slash, and finally the dash-separated anchor. For instance, to link to the above H6 heading section: - -```md -[Links to README.md H6](#README/h6-headings) -``` - -### Alert Boxes - -Alert boxes are created by placing a line with 3 colons (`:::`) before and after the text. The first 3 colons must be followed by a label specifying the alert box type. For example, to create a warning alert: - -``` -:::warn -Something that requires warning here -::: -``` - -Currently the following types are available: `info`, `warn`, `danger` and `preview` - -![Available alert types](static/images/alerts.webp) - -### MDX Components - -There are a few reusable MDX components that can be used on pages with the `mdx` extension. - -#### Collapsibles - -Collapsibles allow you to show/hide content on a page that may be secondary to the page's primary content. They have four fields that can be set: `title`, `description`, `icon`, and an `open` flag (which makes the collapsible element open by default). - -Available options for `icon`: - -- `"list"` -- `"view"` -- `"question"` -- `"code"` -- `"warning"` - -###### Example - -![Collapsible MDX Component with the list icon](static/images/mdx-collapsible.webp) - -```markdown - -Collapsed content - -``` - -#### Buttons - -Buttons are simply... clickable buttons. They take `href` and `color` as arguments, but currently we only use `"brand"` as a value for `color`. - -###### Example - -![Button MDX Component](static/images/mdx-button.webp) - -```markdown - -``` - -#### Cards - -Cards let you display links in a card format. They accept two arguments, `title` and `link`. - -###### Example - -![Card MDX Component](static/images/mdx-card.webp) - -```markdown - -This is the content inside of the card~ - -``` +- [Format Text](https://www.mintlify.com/docs/create/text) +- [Format Code](https://www.mintlify.com/docs/create/code) +- [Images & Embeds](https://www.mintlify.com/docs/create/image-embeds) +- [Files](https://www.mintlify.com/docs/create/files) +- [Lists & Tables](https://www.mintlify.com/docs/create/list-table) +- [Available Components](https://www.mintlify.com/docs/components/accordions) \ No newline at end of file diff --git a/README.md b/README.md index 62e6492bdf..678ad3ee77 100644 --- a/README.md +++ b/README.md @@ -1,15 +1,36 @@ -# Discord API Documentation +# Discord for Developers Documentation -This repo contains the official Discord API documentation, which can be viewed online [HERE](https://discord.com/developers/docs/intro). Before submitting pull-requests, please remember to _fully_ read the [Contributing](CONTRIBUTING.md) guidelines. +This repo contains the official Discord for Developers documentation, which can be viewed online [HERE](https://discord.com/developers/docs/intro). Before submitting pull-requests, please remember to _fully_ read the [Contributing](CONTRIBUTING.md) guidelines. -This repository reflects the Discord API as it is meant to be accessed by third-party applications. It omits features and capabilities that are not generally available, or are not fully supported for third-party usage. +This repository reflects the Discord Developer Platform as it is meant to be accessed by third-party applications. It omits features and capabilities that are not generally available, or are not fully supported for third-party usage. We welcome your contributions! -- Issue tracker: Discord API bugs -- Discussions: Discord API feature and improvement requests +- Issue tracker: [Discord API bugs](https://github.com/discord/discord-api-docs/issues) +- Discussions: [Discord API feature and improvement requests](https://github.com/discord/discord-api-docs/discussions/categories/api-feature-requests-ideas) - Pull Requests: See [Contributing.md](https://github.com/discord/discord-api-docs/blob/main/CONTRIBUTING.md) for types of changes accepted and specific markdown syntax used in the documentation. +### Local Preview + +Install the [Mintlify CLI](https://www.npmjs.com/package/mintlify) to preview the documentation changes locally. To install, use the following command + +``` +npm i -g mintlify +``` + +Run the `mintlify dev` in the `discord` directory to see your changes locally. + +``` +cd discord +mintlify dev +``` + +Your local browser should open automatically to the correct page, but if not, navigate to: + +``` +http://localhost:3000/developers/docs/intro +``` + ## Need some help? Here are some Discord servers that can help you out with everything Discord API: diff --git a/discord/.vale.ini b/discord/.vale.ini new file mode 100644 index 0000000000..8f3499328e --- /dev/null +++ b/discord/.vale.ini @@ -0,0 +1,38 @@ +# Top level styles +StylesPath = ./vale +MinAlertLevel = suggestion +IgnoredScopes = code, tt, img, url, a +SkippedScopes = script, style, pre, figure, code + +# Vocabularies +Vocab = Mintlify, Discord + +# This is required since Vale doesn't officially support MDX +[formats] +mdx = md + +# MDX support +[*.mdx] +BasedOnStyles = Vale +Vale.Terms = NO # Enforces really harsh capitalization rules, keep off + +# `import ...`, `export ...` +# `` +# `...` +# `{ ... }` +# Words with underscores +# Markdown links [text](url) +# Content within square brackets (markdown link text) +TokenIgnores = (?sm)((?:import|export) .+?$), \ +(?)(?!`), \ +(<[A-Z]\w+>.+?<\/[A-Z]\w+>), \ +(\w*_\w*), \ +(\[.+?\]\(.+?\)), \ +(\[.+?\]) + +# Exclude: +# `` +BlockIgnores = (?sm)^(<\w+\n .*\s\/>)$, \ +(?sm)^({.+.*}) + +CommentDelimiters = {/*, */} diff --git a/docs/activities/building-an-activity.mdx b/discord/developers/docs/activities/building-an-activity.mdx similarity index 73% rename from docs/activities/building-an-activity.mdx rename to discord/developers/docs/activities/building-an-activity.mdx index a84d9bb717..1f6140d102 100644 --- a/docs/activities/building-an-activity.mdx +++ b/discord/developers/docs/activities/building-an-activity.mdx @@ -1,12 +1,14 @@ --- -sidebar_label: Quickstart +title: Building Your First Activity in Discord +sidebarTitle: Quickstart +description: Step-by-step tutorial for creating your first Discord Activity. --- -# Building Your First Activity in Discord +import {LinkButton} from '/snippets/linkbutton.jsx' -[Activities](/docs/activities/overview) are web-based games and apps that can be run within Discord. Activities are embedded in iframes within the Discord client, and can be launched from the App Launcher or when responding to interactions. +[Activities](/developers/docs/activities/overview) are web-based games and apps that can be run within Discord. Activities are embedded in iframes within the Discord client, and can be launched from the App Launcher or when responding to interactions. -If this is your first time learning about Activities, check out the [Activities Overview](/docs/activities/overview) for more information and a collection of more advanced [sample projects](/docs/activities/overview#sample-projects). +If this is your first time learning about Activities, check out the [Activities Overview](/developers/docs/activities/overview) for more information and a collection of more advanced [sample projects](/developers/docs/activities/overview#sample-projects). ## Introduction @@ -14,20 +16,20 @@ In this guide, we'll be building a Discord app with a basic Activity that handle It assumes an understanding of [JavaScript](https://developer.mozilla.org/en-US/docs/Learn/Getting_started_with_the_web/JavaScript_basics) and [async functions](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/async_function), and a basic understanding of frontend frameworks like [React](https://react.dev/) and [Vue](https://vuejs.org/). If you are still learning to program, there are many free education resources to explore like [The Odin Project](https://www.theodinproject.com/paths/foundations/courses/foundations), [Codecademy](https://www.codecademy.com/learn/paths/web-development), and [Khan Academy](https://www.khanacademy.org/computing/computer-programming/programming). - + -![Building Your First Activity Tutorial](images/activities/tutorial-hero.webp) +![Building Your First Activity Tutorial](/images/activities/tutorial-hero.png) - + - + - **[discord/getting-started-activity](https://github.com/discord/getting-started-activity)**, a project template to get you started - **[@discord/embedded-app-sdk](https://github.com/discord/embedded-app-sdk)**, the SDK used to communicate between your app and Discord when building Activities - **[Node.js](https://nodejs.org)**, latest version -- **[Express](https://expressjs.com)**, a popular JavaScript web framework we'll use to create a server to handle authenticatication and serve our app +- **[Express](https://expressjs.com)**, a popular JavaScript web framework we'll use to create a server to handle authentication and serve our app - **[Vite](https://vite.dev/)**, a build tool for modern JavaScript projects that will make your application easier to serve - **[cloudflared](https://github.com/cloudflare/cloudflared?tab=readme-ov-file#installing-cloudflared)**, for bridging your local development server to the internet - + --- @@ -51,22 +53,22 @@ The sample project you cloned is broken into two parts: - `client` is the sample Activity's frontend, built with vanilla JavaScript and integrated with [Vite](https://vitejs.dev/) to help with local development. - `server` is a backend using vanilla JavaScript, Node.js, and Express. However, as you're building your own Activity, you can use whichever backend you prefer. - + ``` ├── client -│ ├── main.js -> your Activity frontend -│ ├── index.html -│ ├── package.json -| |── rocket.png -│ ├── vite.config.js +├────── main.js -> your Activity frontend +├────── index.html +├────── package.json +├────── rocket.png +├────── vite.config.js ├── server -│ ├── package.json -│ ├── server.js -> your Activity backend +├────── package.json +├────── server.js -> your Activity backend └── .env -> your credentials, IDs and secrets ``` - + ### Install project dependencies @@ -92,14 +94,14 @@ If you visit http://localhost:5173/ you should see a vanilla JS frontend templat While it's not much at the moment, in the following steps we'll connect it to the backend services, make it runnable in Discord, and power it up by populating it with data we pull from Discord APIs. - + By the end of Step 1, you should have: -- An understanding of what Discord [Activities](/docs/activities/overview) are +- An understanding of what Discord [Activities](/developers/docs/activities/overview) are - Developer Mode enabled on your Discord account - Cloned the [sample project](https://github.com/discord/getting-started-activity) to your development environment - Installed the front-end dependencies (in the `client` folder) - + --- @@ -107,51 +109,51 @@ By the end of Step 1, you should have: With our project set up, let's create our app and configure the Activity. Create a new app in the developer portal if you don't have one already: - +Create App Enter a name for your app, select a development team, then press **Create**. -:::info + **Development Team Access** Launching a non-distributed Activity is limited to you or members of the developer team, so if you're collaborating with others during development, create a [developer team](https://discord.com/developers/teams) and set it to the owner when you create the app. -::: + After you create your app, you'll land on the **General Overview** page of the app's settings, where you can update basic information about your app like its description and icon. ### Choose installation contexts -Apps in Discord can be installed to different **[installation contexts](/docs/resources/application#installation-context)**: servers, user accounts, or both. +Apps in Discord can be installed to different **[installation contexts](/developers/docs/resources/application#installation-context)**: servers, user accounts, or both. The recommended *and* default behavior for apps is supporting both installation contexts, which lets the installer to choose the context during the installation flow. However, you can change the default behavior by changing the supported installation contexts in your app's settings. - + As mentioned, installation contexts determine where your app can be installed. The installation context affect things like who can manage the installation, where the app's commands can appear, and the data returned in response to interactions. -- Apps installed in a **[server context](/docs/resources/application#server-context)** (server-installed apps) must be authorized by a server member with the `MANAGE_GUILD` permission, and are visible to all members of the server. -- Apps installed in a **[user context](/docs/resources/application#user-context)** (user-installed apps) are visible only to the authorizing user, and therefore don't require any server-specific permissions. Apps installed to a user context are visible across all of the user's servers, DMs, and GDMs—however, they're limited to using commands. +- Apps installed in a **[server context](/developers/docs/resources/application#server-context)** (server-installed apps) must be authorized by a server member with the `MANAGE_GUILD` permission, and are visible to all members of the server. +- Apps installed in a **[user context](/developers/docs/resources/application#user-context)** (user-installed apps) are visible only to the authorizing user, and therefore don't require any server-specific permissions. Apps installed to a user context are visible across all of the user's servers, DMs, and GDMs—however, they're limited to using commands. -Details about installation contexts is in the [Application documentation](/docs/resources/application#installation-context) and the [Developing a User-Installable App tutorial](/docs/tutorials/developing-a-user-installable-app). - +Details about installation contexts is in the [Application documentation](/developers/docs/resources/application#installation-context) and the [Developing a User-Installable App tutorial](/developers/docs/tutorials/developing-a-user-installable-app). + Click on **Installation** in the left sidebar, then under **Installation Contexts** make sure both "User Install" and "Guild Install" are selected. This will make sure users can launch our app's Activity across Discord servers, DMs, and Group DMs. ### Add a Redirect URI -Next, we'll add a Redirect URI, which is where a user is typically redirected to after authorizing with your app when going through the standard OAuth flow. While setting up a Redirect URI is required, the Embedded App SDK automatically handles redirecting users back to your Activity when the RPC [`authorize` command](/docs/developer-tools/embedded-app-sdk#authorize) is called. +Next, we'll add a Redirect URI, which is where a user is typically redirected to after authorizing with your app when going through the standard OAuth flow. While setting up a Redirect URI is required, the Embedded App SDK automatically handles redirecting users back to your Activity when the RPC [`authorize` command](/developers/docs/developer-tools/embedded-app-sdk#authorize) is called. -You can learn more about the OAuth flow and redirect URIs in the [OAuth2 documentation](/docs/topics/oauth2), but since we're only authorizing in an Activity, we'll just use a placeholder value (`https://127.0.0.1`) and let the Embedded App SDK handle the rest. +You can learn more about the OAuth flow and redirect URIs in the [OAuth2 documentation](/developers/docs/topics/oauth2), but since we're only authorizing in an Activity, we'll just use a placeholder value (`https://127.0.0.1`) and let the Embedded App SDK handle the rest. Click on **OAuth2** on the sidebar in your app's settings. Under **Redirects**, enter `https://127.0.0.1` as a placeholder value then click **Save Changes**. -![Redirect URI in Activity Settings](images/activities/oauth2-redirect.webp) +![Redirect URI in Activity Settings](/images/activities/oauth2-redirect.png) ### Fetch Your OAuth2 Credentials To use information related to a user (like their username) or a server (like the server's avatar), your app must be granted specific OAuth **scopes**. -For our sample app, we'll be requesting three scopes: `identify` to access basic information about a user, `guilds` to access basic information about the servers a user is in, and `applications.commands` to install [commands](/docs/interactions/overview#commands). We'll request these later on in the guide, but a full list of scopes you can request is in the [OAuth2 documentation](/docs/topics/oauth2#shared-resources-oauth2-scopes). +For our sample app, we'll be requesting three scopes: `identify` to access basic information about a user, `guilds` to access basic information about the servers a user is in, and `applications.commands` to install [commands](/developers/docs/interactions/overview#commands). We'll request these later on in the guide, but a full list of scopes you can request is in the [OAuth2 documentation](/developers/docs/topics/oauth2#shared-resources-oauth2-scopes). When requesting scopes later on, you'll need to pass your app's OAuth2 identifiers. For now, we'll copy these identifiers into your project's environment file. @@ -161,38 +163,38 @@ In the root of your project, there is an `example.env` file. From the root of yo cp example.env .env ``` -:::warn + **Secure Your Secrets** Your `DISCORD_CLIENT_SECRET` and `DISCORD_BOT_TOKEN` are *highly* sensitive secrets. Never share either secrets or check them into any kind of version control. -::: + Back in your app's settings, click on **OAuth2** on the sidebar: 1. **Client ID**: Copy the value for Client ID and add it to your `.env` file as **`VITE_CLIENT_ID`**. This is the public ID that Discord associates with your app, and is almost always the same as your App ID. 2. **Client Secret**: Copy the value for Client Secret and add it to your `.env` as **`DISCORD_CLIENT_SECRET`**. This is a private, sensitive identifier that your app will use to grant an OAuth2 `access_token`, and should never be shared or checked into version control. -:::info + **Why is there a VITE_ prefix before our Client ID?** Prefixing the `CLIENT_ID` environment variable with `VITE_` makes it accessible to our client-side code. This security measure ensures that only the variables you intend to be accessible in the browser are available, and all other environment variables remain private. You can read details in the [Vite documentation](https://vitejs.dev/guide/env-and-mode). -::: + - + By the end of Step 2, make sure you have: - Set up a placeholder Redirect URI - Added your app's Client ID and Client Secret to your project's `.env` file. - + ## Step 3: Setting Up the Embedded App SDK -With our project and app set up, we're going to install and configure the [Embedded App SDK](/docs/developer-tools/embedded-app-sdk) which we'll use extensively through the rest of this guide. +With our project and app set up, we're going to install and configure the [Embedded App SDK](/developers/docs/developer-tools/embedded-app-sdk) which we'll use extensively through the rest of this guide. -The Embedded App SDK is a first-party SDK that handles the communication between Discord and your Activity with [commands](/docs/developer-tools/embedded-app-sdk#sdk-commands) to interact with the Discord client (like fetching information about the channel) and [events](/docs/developer-tools/embedded-app-sdk#sdk-events) to listen for user actions and changes in state (like when a user starts or stops speaking). +The Embedded App SDK is a first-party SDK that handles the communication between Discord and your Activity with [commands](/developers/docs/developer-tools/embedded-app-sdk#sdk-commands) to interact with the Discord client (like fetching information about the channel) and [events](/developers/docs/developer-tools/embedded-app-sdk#sdk-events) to listen for user actions and changes in state (like when a user starts or stops speaking). -:::info -The events and commands available in the Embedded App SDK are a subset of the [RPC API](/docs/topics/rpc) ones, so referencing the RPC documentation can be helpful to understand what's happening under the hood when developing Activities. -::: + +The events and commands available in the Embedded App SDK are a subset of the [RPC API](/developers/docs/topics/rpc) ones, so referencing the RPC documentation can be helpful to understand what's happening under the hood when developing Activities. + ### Install the SDK @@ -210,9 +212,9 @@ Once installed, we need to import it into our client code and instantiate it to To instantiate the SDK, we will use the environment variables we set up in Step 2. -We also set up a check for the [`ready` event](/docs/developer-tools/embedded-app-sdk#ready) with an async/await function which allows us to output a log or perform other actions once the handshake was successful. +We also set up a check for the [`ready` event](/developers/docs/developer-tools/embedded-app-sdk#ready) with an async/await function which allows us to output a log or perform other actions once the handshake was successful. - + In `getting-started-activity/client/main.js`, let's import and instantiate the SDK: @@ -242,20 +244,20 @@ document.querySelector('#app').innerHTML = ` `; ``` - + -:::warn + **Time to leave your browser behind** -Once you add the SDK to your app, you will **not** be able to view your app inside your web browser. In the next step, we will run your Activity inside of Discord. In the next step, we will go over how to view your app in Discord. -::: +Once you add the SDK to your app, you will *not* be able to view your app inside your web browser. In the next step, we will run your Activity inside of Discord. In the next step, we will go over how to view your app in Discord. + - + By the end of Step 3, make sure you have: - Installed the Embedded App SDK to your project - Imported the SDK in your project's `client/main.js` file - + --- @@ -306,17 +308,17 @@ Copy the URL from the output, as we'll need to add it to our app's settings. ### Set up your Activity URL Mapping -Because Activities are in a sandbox enviornment and go through the Discord proxy, you'll need to add a public URL mapping to serve your application and make external requests in your Activity. Since we're developing locally, we'll use the public endpoint we just set up. +Because Activities are in a sandbox environment and go through the Discord proxy, you'll need to add a public URL mapping to serve your application and make external requests in your Activity. Since we're developing locally, we'll use the public endpoint we just set up. Back in your app's settings, click on the **URL Mappings** page under **Activities** on the left-hand sidebar. Enter the URL you generated from `cloudflared` in the previous step. -![Configuring your URL Mapping](images/activities/url-mapping-tutorial.webp) +![Configuring your URL Mapping](/images/activities/url-mapping-tutorial.png) | PREFIX | TARGET | |--------|-----------------------------------------| | `/` | `funky-jogging-bunny.trycloudflare.com` | -Read details about URL Mapping [in the development guide](/docs/activities/development-guides/local-development#url-mapping). +Read details about URL Mapping [in the development guide](/developers/docs/activities/development-guides/local-development#url-mapping). ### Enable Activities @@ -324,13 +326,13 @@ Next, we'll need to enable Activities for your app. On the left hand sidebar und Find the first checkbox, labeled `Enable Activities`. Turn it on 🎉 -![Enabling Activities in Settings](images/activities/enable-activities.webp) +![Enabling Activities in Settings](/images/activities/enable-activities.png) #### Default Entry Point Command -When you enable Activities for your app, a [default Entry Point command](/docs/interactions/application-commands#default-entry-point-command) called "Launch" is automatically created. This [Entry Point command](/docs/interactions/application-commands#entry-point-commands) is the primary way for users to launch your Activity in Discord. +When you enable Activities for your app, a [default Entry Point command](/developers/docs/interactions/application-commands#default-entry-point-command) called "Launch" is automatically created. This [Entry Point command](/developers/docs/interactions/application-commands#entry-point-commands) is the primary way for users to launch your Activity in Discord. -By default, interactions with this command will result in Discord opening your Activity for the user and posting a message in the channel where it was launched from. However, if you prefer to handle the interactions in your app, you can update the [`handler` field](/docs/interactions/application-commands#entry-point-handlers) or create your own. Additional details are in the Entry Point command [documentation](/docs/interactions/application-commands#entry-point-commands) and [development guide](/docs/activities/development-guides/user-actions#setting-up-an-entry-point-command). +By default, interactions with this command will result in Discord opening your Activity for the user and posting a message in the channel where it was launched from. However, if you prefer to handle the interactions in your app, you can update the [`handler` field](/developers/docs/interactions/application-commands#entry-point-handlers) or create your own. Additional details are in the Entry Point command [documentation](/developers/docs/interactions/application-commands#entry-point-commands) and [development guide](/developers/docs/activities/development-guides/user-actions#setting-up-an-entry-point-command). ### Running your Activity in Discord @@ -341,24 +343,24 @@ Navigate to your Discord test server and, in any voice and or text channel, open Clicking on your app will launch your locally running app from inside Discord! -![Running your activity](images/activities/start-activity.webp) +![Running your activity](/images/activities/start-activity.png) -:::info + **Customizing your Activity** -If you'd like to set images for your Activity, you can learn how to do that [here](/docs/activities/development-guides/assets-and-metadata#setting-up-activity-metadata). -::: +If you'd like to set images for your Activity, you can learn how to do that [here](/developers/docs/activities/development-guides/assets-and-metadata#setting-up-activity-metadata). + We're looking pretty good so far, but we haven't wired up any Discord functionality yet. Let's do that next. - + By the end of Step 4, make sure you have: - Set up a public endpoint - Added an Activity URL Mapping in your app's settings - Enabled Activities for your app - Successfully launched your Activity in Discord - + --- @@ -368,18 +370,18 @@ To authenticate your Activity with the users playing it, we must finish implemen We will use `express` for this example, but any backend language or framework will work here. - + This diagram illustrates the common pattern for granting a user an OAuth2 access_token: -![Flow diagram for Oauth2](images/activities/oauth-flow-diagram.svg) +![Flow diagram for Oauth2](/images/activities/oauth-flow-diagram.svg) We will be implementing this pattern in this tutorial, but more example implementations can also be found in this sample project: -- [Back-end code](https://github.com/discord/embedded-app-sdk-examples/blob/main/discord-embedded-app-starter/packages/server/src/app.ts) -- [Front-end code](https://github.com/discord/embedded-app-sdk-examples/blob/main/discord-embedded-app-starter/packages/client/src/main.ts) +- [Back-end code](https://github.com/discord/embedded-app-sdk-examples/blob/main/discord-activity-starter/packages/server/src/app.ts) +- [Front-end code](https://github.com/discord/embedded-app-sdk-examples/blob/main/discord-activity-starter/packages/client/src/main.ts) - + ``` # move into our server directory @@ -391,7 +393,7 @@ npm install We aren't going to edit the server code here, but it consists of a single POST route for `/api/token` that allows us to perform the OAuth2 flow from the server securely. - + In the `getting-started-activity/server/server.js` file, the following code should already be present: @@ -434,7 +436,7 @@ app.listen(port, () => { console.log(`Server listening at http://localhost:${port}`); }); ``` - + Now, start the project's backend server: @@ -451,25 +453,25 @@ You should output similar to the following: Server listening at http://localhost:3001 ``` -We can now run our server and client-side apps in separate terminal windows. You can see other ways to set this up in the other [sample projects](/docs/activities/overview#sample-projects). +We can now run our server and client-side apps in separate terminal windows. You can see other ways to set this up in the other [sample projects](/developers/docs/activities/overview#sample-projects). ### Calling external resources from your activity Before we call your backend activity server, we need to be aware of the Discord proxy and understand how to avoid any Content Security Policy (CSP) issues. -Learn more about this topic in the guides for [Constructing a Full URL](/docs/activities/development-guides/networking#construct-a-full-url) and [Using External Resources](/docs/activities/development-guides/networking#using-external-resources). +Learn more about this topic in the guides for [Constructing a Full URL](/developers/docs/activities/development-guides/networking#construct-a-full-url) and [Using External Resources](/developers/docs/activities/development-guides/networking#using-external-resources). ### Calling your backend server from your client We're almost there! Now, we need our client application to communicate with our server so we can start the OAuth process and get an access token. -:::info + **What is vite.config.js?** To allow our frontend app to call our Express server, Vite requires us to set up a proxy for `/api/*` to our backend server, which is running on port 3001. In their docs, you can learn more about [Vite](https://vitejs.dev/). -::: + - + Copy the following code in your project's `getting-started-activity/client/main.js` file: @@ -537,24 +539,24 @@ document.querySelector('#app').innerHTML = ` `; ``` - + Now if we relaunch our app, we'll be prompted to authorize with Discord using the `identify`, `guilds`, and `applications.commands` scopes. -![Prompt to authorize Activity](images/activities/tutorial-auth.webp) +![Prompt to authorize Activity](/images/activities/tutorial-auth.png) -:::warn + **Safe storage of tokens** Access tokens and refresh tokens are powerful, and should be treated similarly to passwords or other highly-sensitive data. Store both types of tokens securely and in an encrypted manner. -::: + - + By the end of Step 5, make sure you have: - Updated your `client/main.js` to call the backend to support user authorization and authentication - Been able to successfully complete the authorization flow for your app when opening your Activity - + --- @@ -564,7 +566,7 @@ Now that we have authenticated our users, we can start interacting with contextu Let's use the SDK to get details about the channel that our activity is running in. We can do this by writing a new async function that uses the `commands.getChannel` SDK method. - + In the same `getting-started-activity/client/main.js` file, paste the following function: @@ -602,18 +604,18 @@ setupDiscordSdk().then(() => { }); ``` - + If you close and rejoin the Activity, you should now see the name of the current channel. -![Discord Activities](images/activities/tutorial-channel-name.webp) +![Discord Activities](/images/activities/tutorial-channel-name.png) - + By the end of Step 6, make sure you have: - Updated your `client/main.js` code to fetch the channel name using the SDK - Added a call to the new function in the callback for `setupDiscordSdk()` - + --- @@ -622,15 +624,15 @@ By the end of Step 6, make sure you have: Since we requested the `identify` and `guilds` scopes, you can also use the authorized `access_token` we received earlier to fetch those resources via the API. In the following code block, we will: -1. Call the [`GET /users/@me/guilds`](/docs/resources/user#get-current-user-guilds) endpoint with `auth.access_token` to get a list of the guilds the authorizing user is in +1. Call the [`GET /users/@me/guilds`](/developers/docs/resources/user#get-current-user-guilds) endpoint with `auth.access_token` to get a list of the guilds the authorizing user is in 2. Iterate over each guild to find the guild we are in based on the `guildId` defined in discordSdk 3. Create a new HTML image element with the guild avatar and append it to our frontend -:::info -In this example, we use a pure `fetch` request to make the API call, but you can us one of the JavaScript [community-built libraries](/docs/developer-tools/community-resources) if you prefer. -::: + +In this example, we use a pure `fetch` request to make the API call, but you can us one of the JavaScript [community-built libraries](/developers/docs/developer-tools/community-resources) if you prefer. + - + In the same `client/main.js` file, add the following function: @@ -676,18 +678,18 @@ setupDiscordSdk().then(() => { appendGuildAvatar(); }); ``` - + If we relaunch our Activity, we will see the current server's avatar render in our Activity. -![Discord Activities](images/activities/tutorial-hero.webp) +![Discord Activities](/images/activities/tutorial-hero.png) - + At this point, you should have your Activity up and running. For Step 7, you should have: -- Updated your `client/main.js` code to fetch the guild information using the [`GET /users/@me/guilds`](/docs/resources/user#get-current-user-guilds) API endpoint +- Updated your `client/main.js` code to fetch the guild information using the [`GET /users/@me/guilds`](/developers/docs/resources/user#get-current-user-guilds) API endpoint - Added a call to the new function in the callback for `setupDiscordSdk()` - + --- @@ -695,16 +697,20 @@ At this point, you should have your Activity up and running. For Step 7, you sho Congrats on building your first Activity! 🎉 -This is an intentionally simple example to get you started with the communication between your Activity and Discord using the Embedded App SDK and APIs. From here, you can explore the [Activities documentation](/docs/activities/overview) and other resources. +This is an intentionally simple example to get you started with the communication between your Activity and Discord using the Embedded App SDK and APIs. From here, you can explore the [Activities documentation](/developers/docs/activities/overview) and other resources. - - +import {WrenchIcon} from '/snippets/icons/WrenchIcon.jsx' +import {ForumIcon} from '/snippets/icons/ForumIcon.jsx' +import {GlobeEarthIcon} from '/snippets/icons/GlobeEarthIcon.jsx' + + + }> Follow our Activities Development Guides for suggested development practices and considerations. - + }> Try out the full range of Embedded App SDK features in the playground app, or explore some of the other examples - + }> Join our community to ask questions about the API, attend events hosted by the Discord platform team, and interact with other Activities developers - + diff --git a/docs/activities/design-patterns.mdx b/discord/developers/docs/activities/design-patterns.mdx similarity index 91% rename from docs/activities/design-patterns.mdx rename to discord/developers/docs/activities/design-patterns.mdx index 9d7693f1bc..0ab4836e8a 100644 --- a/docs/activities/design-patterns.mdx +++ b/discord/developers/docs/activities/design-patterns.mdx @@ -1,8 +1,10 @@ --- -sidebar_label: Design Patterns +title: Activity Design Patterns +sidebarTitle: Design Patterns +description: Best practices and design principles for creating engaging Discord Activities. --- -# Activity Design Patterns +import {ManualAnchor} from '/snippets/manualanchor.jsx' Before building your Activity, here are some guiding principles for you to consider for a successful user experience. @@ -49,8 +51,7 @@ When in an Activity with others, make the actions and presence of the others vis - If a user has customized their server nickname or avatar, use their server nickname or avatar in game. - Show when a user is speaking in the voice call, or whether they're active or inactive. -![Speech bubbles in Bobble League](images/activities/bobble-bash.webp) - +![Speech bubbles in Bobble League](/images/activities/bobble-bash.png) ### Respect user privacy - For Activity sessions that match users from various servers, usernames and avatars should be anonymized by default. @@ -67,12 +68,12 @@ Make your app fast, easy to join, and maximize fun to launch a crowd favorite. - Surprise and delight is about caring about the small details of how a person experiences your work. - Put the right emotion in when they least expect it to deliver the magic. -![Bobble League](images/activities/bobble-league.webp) +![Bobble League](/images/activities/bobble-league.png) ### Keep load times as low as possible - This allows for easier drop-in drop-out behavior for the large portion of mobile users on Discord. -- See the below [Quality & Testing Recommendations](/docs/activities/design-patterns#quality-and-testing) for key areas of minimum quality support and testing recommendations. -- See the below [Technical Considerations](/docs/activities/design-patterns#technical-considerations) for recommendations on how to partition loading and work with various development tools to reduce load times. +- See the below [Quality & Testing Recommendations](/developers/docs/activities/design-patterns#quality-and-testing) for key areas of minimum quality support and testing recommendations. +- See the below [Technical Considerations](/developers/docs/activities/design-patterns#technical-considerations) for recommendations on how to partition loading and work with various development tools to reduce load times. - Consider different screen sizes and orientations across desktop and mobile devices and make sure UI elements scale appropriately. ### Support drop-in, drop-out behavior @@ -80,7 +81,7 @@ Make your app fast, easy to join, and maximize fun to launch a crowd favorite. - Activities are frictionless to join and easy to discover, so you can expect that users will join mid-experience. Give those users something to do, even if it's just letting them spectate until they can join without being disruptive. In the same vein, users can leave without notice or become afk (away from keyboard). Handle these cases gracefully. - Create a case for users who have joined a call but have not yet started playing or engaging. Allow these users to "spectate" other users who are playing. This can also be helpful for Activities that have an ideal number in mind for play. -![Support drop-in, drop-out behavior in your Activity](images/activities/eights.webp) +![Support drop-in, drop-out behavior in your Activity](/images/activities/eights.png) ### Make your app as available as possible @@ -89,7 +90,7 @@ Make your app fast, easy to join, and maximize fun to launch a crowd favorite. - Discord device usage is split between mobile and desktop platforms. #### Discord is a Global Audience - - Consider supporting a multitude of languages and cultures to make your app more useable for all Discord users. + - Consider supporting a multitude of languages and cultures to make your app more usable for all Discord users. #### Implement Invites - The Embedded App SDK allows for sending invites from within an Activity out to other friended users. @@ -105,7 +106,7 @@ Discord is a social platform where users talk to each other. Sharing and invites - Share photos or GIFs that capture moments of fun and memorable, or something to brag about. Don't make things shareable just to feature the activity. - Sharing a high score alone may not be very engaging, but sharing a really good move made in a game, or a collaborative drawing that creates a memory is a conversation starter and may make others want to join in on the fun. -![Shared Moment from Chess in the Park](images/activities/chess-victory.webp) +![Shared Moment from Chess in the Park](/images/activities/chess-victory.png) #### Activities in Text Channels - The Activity user interface, copy and user flows should not rely on people in voice to explain, organize, clarify, or instruct about how the activity works. @@ -114,9 +115,9 @@ Discord is a social platform where users talk to each other. Sharing and invites ### Monetization Considerations -:::preview + Monetization in Activities will be available soon. Keep the following considerations in mind as you design your Activity. -::: + - Avoid prohibitive gates in front of participation (e.g. login wall / paywall), especially early in the user journey. - Avoid monetized unlocks that give unfair advantage to other non-paying players or users (i.e. "pay to win"). @@ -142,6 +143,7 @@ Monetization in Activities will be available soon. Keep the following considerat ### Activities close when the last participant in the Activity leaves it - The next time the Activity is launched, even if it’s in the same DM or Voice Channel, it will be a different instance and could have different participants. + ### If a game is launched, what % of the time do users reach different phases of the game? - This includes launch → start, as there can be a large dropoff between these two (especially if you don’t support solo play or small group sizes). - This also includes various check points in the game, including what % of sessions that start a game reach the end of that game! @@ -149,10 +151,12 @@ Monetization in Activities will be available soon. Keep the following considerat - For non-games, you may want to analyze a certain action instead (such as queueing a video / song for a co-watching / co-listening Activity). - If drop-off is really high at a certain point, see if you can figure out why or change flows. + ### How many games are played in a session? - More games per session isn’t inherently better (you may have an Activity that is meant to be one long game), but is a good baseline to understand. - If you expect to see a lot of repeat plays per session and don’t, it can be worth digging in to understand more. + ### How does the group size impact various key metrics? - For example, are larger sessions more or less likely to reach the end of a game? To replay? Etc. - This can help you catch if your Activity has unexpected weak points in different group sizes — maybe the game drags on if there are too many people or isn’t compelling enough if there’s only two. @@ -162,7 +166,7 @@ Monetization in Activities will be available soon. Keep the following considerat ## Co-Watching / Co-Listening -- Co-watching and co-listening should be more than just screen-sharing. Consider creative ways to to make each user's experience impacted by other participants. +- Co-watching and co-listening should be more than just screen-sharing. Consider creative ways to make each user's experience impacted by other participants. - Consider providing host-controls so that playback isn't overly chaotic. If host controls are provided, make sure everyone can participate in some way, even if it's just recommending content to the host. - If content is not available for everyone in the activity (for example, geo-restricted content), make sure that information is known when the content is queued and when it's playing. The host is generally interested in creating a good experience for their friends. Playback of content should be in sync with others in a local channel or call. - Familiar design patterns can help to get people to participate in your Activity right away. Most Discord users are extremely familiar with media browsing (Spotify, YouTube, Netflix, etc.) and will immediately understand your content if you follow these patterns. diff --git a/discord/developers/docs/activities/development-guides.mdx b/discord/developers/docs/activities/development-guides.mdx new file mode 100644 index 0000000000..3bf845c5cb --- /dev/null +++ b/discord/developers/docs/activities/development-guides.mdx @@ -0,0 +1,138 @@ +--- +title: Activity Development Guides Glossary +sidebarTitle: Glossary +description: Definitions and explanations of key terms used in Discord Activities development. +--- + +These guides include suggested development practices, SDK commands, and user flows for you to consider while building your Activity. These will help to provide your users with a consistent and clear experience while interacting with your application. + +## Local Development + + + Get up and running with a local development application. + + + How to launch your app on mobile and desktop Discord clients. + + + Configure the Discord proxy to allow network requests to necessary external endpoints. + + + How to use the various levels of logging while building your application. + + + +## User Actions + + + Open an external link from within your app. + + + Open the Application Channel Invite dialog within Discord. + + + Open a dialog to share media from your application to a channel, DM, or GDM. + + + Configure a command that allows users to open your Activity from the App Launcher. + + + Open a dialog to enable hardware acceleration for compute-intensive applications. + + + +## Mobile + + + Update your application settings to support iOS and Android. + + + Ensure that your app's assets fall within mobile-safe areas. + + + Respond to thermal state changes surfaced from iOS and Android. + + + +## Layout + + + Configure and subscribe to changes in application orientation. + + + Subscribe to layout mode changes to update your application's user interface. + + + +## Networking + + + Working with our Activity Proxy + + + Generate a full URL when working with network requests. + + + Allow network requests to external resources from inside the Discord proxy. + + + Keep things safe and secure in your Activity. + + + +## Multiplayer Experience + + + Managing instances to ensure users join the same instance as their friends. + + + Use the SDK to fetch the users currently connected to an instance. + + + Retrieve and render the usernames and avatars of users connected to your application. + + + Validating activity sessions are via a Discord client before adding them to an instance's session. + + + +## Growth and Referrals + + + Encourage your users to share links to your activity by adding tracking and offering rewards for engagement. + + + + For off-platform sharing of rewards, promotions, or limited time experiences. + + + + An API to be able to generate ephemeral links with a customizable embed. + + + +## Assets & Metadata + + + Best practices for configuring how your application shows up in Discord. + + + Best practices for configuring how your application shows up in Discord. + + + +## Production Readiness + + + Manage asset caching in your application and the Discord Activity proxy. + + + Stay within rate limits to keep the fun going in your Activity. + + + Network routing considerations when preparing your Activity for production use. + + + Future-proof your application and support new commands as they become available in the SDK. + + diff --git a/docs/activities/development-guides/assets-and-metadata.mdx b/discord/developers/docs/activities/development-guides/assets-and-metadata.mdx similarity index 92% rename from docs/activities/development-guides/assets-and-metadata.mdx rename to discord/developers/docs/activities/development-guides/assets-and-metadata.mdx index 584ad60e2e..6d358261bd 100644 --- a/docs/activities/development-guides/assets-and-metadata.mdx +++ b/discord/developers/docs/activities/development-guides/assets-and-metadata.mdx @@ -1,11 +1,8 @@ --- -sidebar_label: Assets and Metadata +title: Assets and Metadata +description: Guide to managing Activity assets, metadata, and configuration. --- -[Home](/docs/intro) > [Activities](/docs/activities/overview) > [Development Guides](/docs/activities/development-guides) > {sidebar_label} - -# Assets and Metadata - ## Setting Up Activity Metadata The Activity Shelf is where users can see what Activities can be played. It has various metadata and art assets that can be configured. @@ -20,9 +17,9 @@ To update your app's metadata in the Discord Developer Portal, navigate to the ` - Leaving this field empty defaults to `Unlimited participants`. - Max Participants is also displayed under the name in the 2-up view. -:::info + An app can have a different application name and avatar from the application's bot username and avatar. Both sets of metadata are public-facing and may be visible in various situations when a user interacts with your app. You can view your bot's username on the `Settings -> Bot` tab. -::: + --- diff --git a/docs/activities/development-guides/growth-and-referrals.mdx b/discord/developers/docs/activities/development-guides/growth-and-referrals.mdx similarity index 90% rename from docs/activities/development-guides/growth-and-referrals.mdx rename to discord/developers/docs/activities/development-guides/growth-and-referrals.mdx index 65ada36768..145d2a9bf2 100644 --- a/docs/activities/development-guides/growth-and-referrals.mdx +++ b/discord/developers/docs/activities/development-guides/growth-and-referrals.mdx @@ -1,11 +1,8 @@ --- -sidebar_label: Growth and Referrals +title: Growth and Referrals +description: Implement growth strategies and referral systems in Discord Activities. --- -[Home](/docs/intro) > [Activities](/docs/activities/overview) > [Development Guides](/docs/activities/development-guides) > {sidebar_label} - -# Growth and Referrals - ## Prompting Users to Share Incentivized Links Incentivized sharing can help grow your Activity through network effects. You can use links in several different ways such as: @@ -28,7 +25,7 @@ This guide covers implementing a referral link which will feature a reward syste When implementing sharing, you'll need to: 1. Generate a unique ID for tracking the promotion -2. Call the [`shareLink`](/docs/developer-tools/embedded-app-sdk#sharelink) command +2. Call the [`shareLink`](/developers/docs/developer-tools/embedded-app-sdk#sharelink) command 3. Track the share attempt ```javascript @@ -102,7 +99,7 @@ async function handleReferral() { ## Creating and Managing Custom Incentivized Links -This guide covers creating a customizable [Incentivized Link](/docs/activities/development-guides/growth-and-referrals#prompting-users-to-share-incentivized-links) through the dev portal, and then retrieving the link to be able to share it off-platform. Incentivized Links are used to customize how the embed appears to users. +This guide covers creating a customizable [Incentivized Link](/developers/docs/activities/development-guides/growth-and-referrals#prompting-users-to-share-incentivized-links) through the dev portal, and then retrieving the link to be able to share it off-platform. Incentivized Links are used to customize how the embed appears to users. #### Creating a Link @@ -128,9 +125,9 @@ Once you're satisfied with your changes you can click on the copy icon on the ro 1. Click on the trash icon on the row of the link you're trying to delete. 2. You'll have a confirm dialog pop up. -:::warn + Deleting is irreversible and immediate. Ensure that your link isn't in active use before deleting and/or that your activity gracefully handles any click-throughs from the link. -::: + #### Best Practices @@ -140,7 +137,7 @@ Deleting is irreversible and immediate. Ensure that your link isn't in active us #### User Experience -![custom-link-embed](images/activities/custom-link-embed.webp) +![custom-link-embed](/images/activities/custom-link-embed.png) Users will see an embed with your information displayed. Clicking "Play" opens the activity and passes through the `custom_id` you've set. A `referrer_id` will be present for links shared on Discord. @@ -148,7 +145,7 @@ Users will see an embed with your information displayed. Clicking "Play" opens t ## Generating a Custom Link Within Your Activity -This guide covers creating a customizable [Incentivized Link](/docs/activities/development-guides/growth-and-referrals#prompting-users-to-share-incentivized-links) within your activity, and using the `shareLink` API to share the link. +This guide covers creating a customizable [Incentivized Link](/developers/docs/activities/development-guides/growth-and-referrals#prompting-users-to-share-incentivized-links) within your activity, and using the `shareLink` API to share the link. * Allows you to customize the way the link is presented to users via the embed * Can be generated on-demand within your activity diff --git a/docs/activities/development-guides/layout.mdx b/discord/developers/docs/activities/development-guides/layout.mdx similarity index 94% rename from docs/activities/development-guides/layout.mdx rename to discord/developers/docs/activities/development-guides/layout.mdx index ca7966590e..bc76d41d31 100644 --- a/docs/activities/development-guides/layout.mdx +++ b/discord/developers/docs/activities/development-guides/layout.mdx @@ -1,11 +1,8 @@ --- -sidebar_label: Layout +title: Layout +description: Design effective layouts and user interfaces for Discord Activities. --- -[Home](/docs/intro) > [Activities](/docs/activities/overview) > [Development Guides](/docs/activities/development-guides) > {sidebar_label} - -# Layout - ## Application Orientation #### Locking Application Orientation @@ -34,7 +31,7 @@ discordSdk.commands.setOrientationLockState({ It's also possible to configure an application with a default orientation lock state via the Developer Portal. Using this method, the Discord app will apply the orientation lock when launching the application before the SDK has been initialized. This can create a smoother application launch flow where the application starts in the correct orientation rather than switching to the correct orientation after some delay after the application requests an orientation lock via the SDK. The Developer Portal supports setting a different default orientation lock states for phones versus tablets. -![default-orientation-lock-state](images/activities/default_orientation_lock_state.webp) +![default-orientation-lock-state](/images/activities/default_orientation_lock_state.png) #### Subscribing to Screen Orientation Updates diff --git a/docs/activities/development-guides/local-development.mdx b/discord/developers/docs/activities/development-guides/local-development.mdx similarity index 84% rename from docs/activities/development-guides/local-development.mdx rename to discord/developers/docs/activities/development-guides/local-development.mdx index 79d6503c61..920466c62f 100644 --- a/docs/activities/development-guides/local-development.mdx +++ b/discord/developers/docs/activities/development-guides/local-development.mdx @@ -1,16 +1,14 @@ --- -sidebar_label: Local Development +title: Local Development +sidebarTitle: Local Development +description: Set up local development environment for Discord Activities. --- -[Home](/docs/intro) > [Activities](/docs/activities/overview) > [Development Guides](/docs/activities/development-guides) > {sidebar_label} - -# Local Development - ## Run Your Application Locally -It is possible to load your application via a localhost port or other unique URL. This URL must support an HTTPS connection to load on the web/desktop Discord app (HTTPS is not required for mobile). The downside to this flow is that your application's network traffic will not pass through Discord's proxy, which means any requests made by the application will need to use a full URL instead of a ["mapped"](/docs/activities/development-guides/local-development#url-mapping) URL. +It is possible to load your application via a localhost port or other unique URL. This URL must support an HTTPS connection to load on the web/desktop Discord app (HTTPS is not required for mobile). The downside to this flow is that your application's network traffic will not pass through Discord's proxy, which means any requests made by the application will need to use a full URL instead of a ["mapped"](/developers/docs/activities/development-guides/local-development#url-mapping) URL. -To run your locally hosted application, follow the instructions for [Launching your Application from the Discord Client](/docs/activities/development-guides/local-development#launch-your-application-from-the-discord-client) and set the Application URL Override to the address of your application's web server. +To run your locally hosted application, follow the instructions for [Launching your Application from the Discord Client](/developers/docs/activities/development-guides/local-development#launch-your-application-from-the-discord-client) and set the Application URL Override to the address of your application's web server. ### Running Your Application Through A Network Tunnel @@ -18,13 +16,13 @@ Although it is possible to test your application locally, we recommend developin 1. Create a new application in the Discord Developer portal. 2. Enable Activities for your app. -3. Set up the application's [URL mapping](/docs/activities/development-guides/local-development#url-mapping). +3. Set up the application's [URL mapping](/developers/docs/activities/development-guides/local-development#url-mapping). 4. Locally, spin up your web server. 5. Install and run a tunnel solution, such as [cloudflared](https://github.com/cloudflare/cloudflared#installing-cloudflared). You will point it to your local web server. -:::info + Your web server can be HTTP and your network tunnel can upgrade the connection to HTTPS. -::: + If using cloudflared, you will run the following command, replace `3000` with your web server's port. @@ -41,13 +39,13 @@ https://funky-jogging-bunny.trycloudflare.com In the Discord Developer Portal, update the Application URL mapping for `/` url to `funky-jogging-bunny.trycloudflare.com` to match your network tunnel address and save your changes. -![Configuring your URL Mapping](images/activities/url-mapping-tutorial.webp) +![Configuring your URL Mapping](/images/activities/url-mapping-tutorial.png) -:::warn + If you do not own the URL that you are using to host the application (i.e. ngrok's free tier), someone else could claim that domain and host a malicious site in its place. Please be aware of these risks, and if you have to use a domain you do not own, be sure to reset your URL mapping when you are done using the tunnel. -::: + -Follow the instructions for [Launching your Application from the Discord Client](/docs/activities/development-guides/local-development#launch-your-application-from-the-discord-client). Application URL Override should not be enabled. +Follow the instructions for [Launching your Application from the Discord Client](/developers/docs/activities/development-guides/local-development#launch-your-application-from-the-discord-client). Application URL Override should not be enabled. ### Running Your Application In Production @@ -55,12 +53,12 @@ The flow for setting up your production application is very similar: 1. If not made yet, create a new application. 2. Enable Activities for your app. -3. Set up the application's [URL Mapping](/docs/activities/development-guides/local-development#url-mapping). The URL for your application's html should be set to the `/` route. -4. Follow the instructions for [Launching your Application from the Discord Client](/docs/activities/development-guides/local-development#launch-your-application-from-the-discord-client). Application URL Override should not be enabled. +3. Set up the application's [URL Mapping](/developers/docs/activities/development-guides/local-development#url-mapping). The URL for your application's html should be set to the `/` route. +4. Follow the instructions for [Launching your Application from the Discord Client](/developers/docs/activities/development-guides/local-development#launch-your-application-from-the-discord-client). Application URL Override should not be enabled. This application now uses the same configuration it will use once it is fully published ✨. -![application-test-mode-prod](images/activities/application-test-mode-prod.webp) +![application-test-mode-prod](/images/activities/application-test-mode-prod.gif) --- @@ -72,7 +70,7 @@ To see you app inside of Discord in the Activity Shelf: #### Web -1. Select ⚙️User Settings > App Settings > Advanced and toggle on `Developer Mode` +1. Select ⚙️ User Settings > App Settings > Advanced and toggle on `Developer Mode` 3. Close the settings window and enter a voice channel. 4. From either the RTC Panel or the Center Control Tray, click on the "Rocket Button" to open the Activity shelf. You should now see all of the same applications that you have access to in the developer portal. Note: The shelf will only include applications which have been flagged as "Embedded". 6. Click on an activity to launch it! @@ -96,7 +94,7 @@ Because your application is "sandboxed", it will be unable to make network reque To add or modify your application's URL mappings, click on `Activities -> URL Mappings` and set the prefix and target values for each mapping as needed. -![Configuring your URL Mapping](images/activities/url-mapping-tutorial.webp) +![Configuring your URL Mapping](/images/activities/url-mapping-tutorial.png) #### Prefix/Target formatting rules @@ -111,7 +109,7 @@ To add or modify your application's URL mappings, click on `Activities -> URL Ma | ✅ DO | ❌ DON'T | |--------------------------------------------------------------|------------------------------------------------------------------| | Requests mapped correctly | Requests to /foo/bar will incorrectly be sent to `foo.com` | -| ![url-mapping-do.png](images/activities/url-mapping-do.webp) | ![url-mapping-dont.png](images/activities/url-mapping-dont.webp) | +| ![url-mapping-do.png](/images/activities/url-mapping-do.png) | ![url-mapping-dont.png](/images/activities/url-mapping-dont.png) | #### Exceptions @@ -161,7 +159,7 @@ The first section of Debug Logs are not your application logs but Discord specif When you scroll down the page, your application logs should be visible. -![debug-logs-filtering](images/activities/debug-logs-filtering.webp) +![debug-logs-filtering](/images/activities/debug-logs-filtering.gif) #### Sharing Application Logs from Mobile diff --git a/docs/activities/development-guides/mobile.mdx b/discord/developers/docs/activities/development-guides/mobile.mdx similarity index 92% rename from docs/activities/development-guides/mobile.mdx rename to discord/developers/docs/activities/development-guides/mobile.mdx index 8e12e81298..630cc63b1a 100644 --- a/docs/activities/development-guides/mobile.mdx +++ b/discord/developers/docs/activities/development-guides/mobile.mdx @@ -1,11 +1,8 @@ --- -sidebar_label: Mobile +title: Mobile +description: Design and optimize Discord Activities for mobile devices. --- -[Home](/docs/intro) > [Activities](/docs/activities/overview) > [Development Guides](/docs/activities/development-guides) > {sidebar_label} - -# Mobile - ## Supported Platforms: Web, iOS, Android By default, your Activity will be launchable on web/desktop. To enable or disable support for Web/iOS/Android, do the following: @@ -15,7 +12,7 @@ By default, your Activity will be launchable on web/desktop. To enable or disabl - Select `Activities` -> `Settings` in the left-side of the developer portal, or visit `https://discord.com/developers//embedded/settings` - From check the appropriate checkboxes in the developer portal, and save your changes -![supported-platforms](images/activities/supported-platforms.webp) +![supported-platforms](/images/activities/supported-platforms.png) --- @@ -23,7 +20,7 @@ By default, your Activity will be launchable on web/desktop. To enable or disabl As an example, you can define your safe area insets as below in CSS: -``` +```css :root { --sait: var(--discord-safe-area-inset-top, env(safe-area-inset-top)); --saib: var(--discord-safe-area-inset-bottom, env(safe-area-inset-bottom)); @@ -36,7 +33,7 @@ This prefers the `--discord-safe-area-inset-*` variable and will fallback to the You can then reference these values: -``` +```css body { padding-left: var(--sail); padding-right: var(--sair); @@ -87,6 +84,6 @@ discordSdk.subscribe('THERMAL_STATE_UPDATE', handleThermalStateUpdate); Discord will publish the current thermal state upon event subscription, and it will also publish any thermal state changes that happen afterward. -:::info + On Android devices, the thermal state updates will only be available on Android 10 and higher. -::: + diff --git a/docs/activities/development-guides/multiplayer-experience.mdx b/discord/developers/docs/activities/development-guides/multiplayer-experience.mdx similarity index 96% rename from docs/activities/development-guides/multiplayer-experience.mdx rename to discord/developers/docs/activities/development-guides/multiplayer-experience.mdx index 70610f48d2..38f608adc8 100644 --- a/docs/activities/development-guides/multiplayer-experience.mdx +++ b/discord/developers/docs/activities/development-guides/multiplayer-experience.mdx @@ -1,16 +1,13 @@ --- -sidebar_label: Multiplayer Experience +title: Multiplayer Experience +description: Design and implement engaging multiplayer experiences in Discord Activities. --- -[Home](/docs/intro) > [Activities](/docs/activities/overview) > [Development Guides](/docs/activities/development-guides) > {sidebar_label} - -# Multiplayer Experience - ## Activity Instance Management When a user clicks "Join Application", they expect to enter the same application that their friends are participating in. Whether the application is a shared drawing canvas, board game, collaborative playlist, or first-person shooter; the two users should have access to the same shared data. In this documentation, we refer to this shared data as an **application instance**. -![join-application](images/activities/join-application.webp) +![join-application](/images/activities/join-application.png) The Embedded App SDK allows your app to talk bidirectionally with the Discord Client. The `instanceId` is necessary for your application, as well as Discord, to understand which unique instance of an application it is talking to. @@ -59,7 +56,7 @@ discordSdk.unsubscribe(Events.ACTIVITY_INSTANCE_PARTICIPANTS_UPDATE, updateParti ## Render Avatars and Names -Check out detailed documentation on where and how Discord stores common image assets [here](/docs/reference#image-formatting-cdn-endpoints). +Check out detailed documentation on where and how Discord stores common image assets [here](/developers/docs/reference#image-formatting-cdn-endpoints). Here's a basic example for retrieving a user's avatar and username @@ -247,4 +244,5 @@ except BadSignatureError: Proxy authentication is entirely optional and provided as an additional security layer for apps that choose to implement it. In the below flow diagram, we show how the server can deliver the activity website, only for valid users in a valid activity instance: -![application-test-mode-prod](images/activities/activity-instance-validation.webp) + +![activity-instance-validation](/images/activities/activity-instance-validation.jpg) diff --git a/docs/activities/development-guides/networking.mdx b/discord/developers/docs/activities/development-guides/networking.mdx similarity index 93% rename from docs/activities/development-guides/networking.mdx rename to discord/developers/docs/activities/development-guides/networking.mdx index 56960cc6a6..f46e34a6d3 100644 --- a/docs/activities/development-guides/networking.mdx +++ b/discord/developers/docs/activities/development-guides/networking.mdx @@ -1,11 +1,8 @@ --- -sidebar_label: Networking +title: Networking +description: Learn networking patterns and best practices for Discord Activities. --- -[Home](/docs/intro) > [Activities](/docs/activities/overview) > [Development Guides](/docs/activities/development-guides) > {sidebar_label} - -# Networking - ## Activity Proxy Considerations All network traffic is routed through the Discord Proxy for various security reasons. @@ -50,7 +47,7 @@ In other words, given an application client id of `12345678` ## Using External Resources -Activities in Discord are "sandboxed" via a Discord proxy. This is done to hide the users' IP addresses as well as block URLs from known malicious endpoints. To achieve this, the Discord Developer Portal has a section for [configuring URL Mappings](/docs/activities/development-guides/local-development#url-mapping) for your application. +Activities in Discord are "sandboxed" via a Discord proxy. This is done to hide the users' IP addresses as well as block URLs from known malicious endpoints. To achieve this, the Discord Developer Portal has a section for [configuring URL Mappings](/developers/docs/activities/development-guides/local-development#url-mapping) for your application. One edge-case of URL mappings is that third-party NPM modules or other resources may reference external (non-sandboxed) urls. @@ -85,9 +82,9 @@ async function setupApp() { } ``` -:::info + Note: `patchUrlMappings` is modifying your browser's `fetch`, `WebSocket`, and `XMLHttpRequest.prototype.open` global variables. Depending on the library, you may see side effects from using this helper function. It should be used only when necessary. -::: + --- diff --git a/docs/activities/development-guides/production-readiness.mdx b/discord/developers/docs/activities/development-guides/production-readiness.mdx similarity index 86% rename from docs/activities/development-guides/production-readiness.mdx rename to discord/developers/docs/activities/development-guides/production-readiness.mdx index 4465505769..f3e541e962 100644 --- a/docs/activities/development-guides/production-readiness.mdx +++ b/discord/developers/docs/activities/development-guides/production-readiness.mdx @@ -1,20 +1,17 @@ --- -sidebar_label: Production Readiness +title: Production Readiness +description: Prepare your Discord Activity for production deployment. --- -[Home](/docs/intro) > [Activities](/docs/activities/overview) > [Development Guides](/docs/activities/development-guides) > {sidebar_label} - -# Production Readiness - ## Cache Busting -All assets loaded by your application will respect [cache headers](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Cache-Control). One exception is that Discord's application proxy will remove any cache headers for assets whose `content-type` headers include `text/html`. For all non-`text/html` content that your application plans to serve, be sure your application has a cache-busting strategy. This is often built into build processes. If your application has a static filename for its javascript or css, please be sure to implement cache busting techniques, for example [webpack enables creating a content hash and manifest](https://webpack.js.org/guides/caching/) as a part of the build process. +All assets loaded by your application will respect [cache headers](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Cache-Control). One exception is that Discord's application proxy will remove any cache headers for assets whose `content-type` headers include `text/html`. For all non-`text/html` content that your application plans to serve, be sure your application has a cache-busting strategy. This is often built into build processes. If your application has a static filename for its javascript or css, please be sure to implement cache busting techniques, for example [webpack enables creating dynamic file names](https://webpack.js.org/guides/caching/). ---- ## Handling Rate Limits -Be sure network requests made by your application's client and server will be able to respect Discord API's rate limiting [as described here](/docs/topics/rate-limits). +Be sure network requests made by your application's client and server will be able to respect Discord API's rate limiting [as described here](/developers/docs/topics/rate-limits). See [this implementation in the Activity Starter project](https://github.com/discord/embedded-app-sdk-examples/blob/main/discord-activity-starter/packages/server/src/utils.ts) for an example of how to respect the `retry_after` header when you receive a 429 error. diff --git a/docs/activities/development-guides/user-actions.mdx b/discord/developers/docs/activities/development-guides/user-actions.mdx similarity index 63% rename from docs/activities/development-guides/user-actions.mdx rename to discord/developers/docs/activities/development-guides/user-actions.mdx index 8e4366d5ae..7c8e55f192 100644 --- a/docs/activities/development-guides/user-actions.mdx +++ b/discord/developers/docs/activities/development-guides/user-actions.mdx @@ -1,11 +1,8 @@ --- -sidebar_label: User Actions +title: User Actions +description: Implement user interactions and actions in Discord Activities. --- -[Home](/docs/intro) > [Activities](/docs/activities/overview) > [Development Guides](/docs/activities/development-guides) > {sidebar_label} - -# User Actions - ## Open External Link Since Activities are sandboxed, your app will need to perform a command in order for users to launch any external links. Users will be prompted inside Discord whether or not they want to open the external link. @@ -25,7 +22,7 @@ discordSdk.commands.openExternalLink({ #### User Experience -![external-link-modal](images/activities/external-link-modal.webp) +![external-link-modal](/images/activities/external-link-modal.png) Users will see a modal inside the Discord app notifying them whether or not they want to proceed. By clicking **_Trust this Domain_**, users will not see a modal for that specific domain again. @@ -33,7 +30,7 @@ Users will see a modal inside the Discord app notifying them whether or not they ## Open Invite Dialog -Getting an Application Channel Invite, as outlined in [these docs](/docs/resources/invite#get-invite), is not granted by any OAuth scopes. Nonetheless, the `openInviteDialog` command is available via the SDK. This command opens the Application Channel Invite UI within the discord client without requiring additional OAuth scopes. +Getting an Application Channel Invite, as outlined in [these docs](/developers/docs/resources/invite#get-invite), is not granted by any OAuth scopes. Nonetheless, the `openInviteDialog` command is available via the SDK. This command opens the Application Channel Invite UI within the discord client without requiring additional OAuth scopes. This command returns an error when called from DM (Direct Message) contexts, so should only be called in Guild Voice or Text Channels. Similarly, this command returns an error if the user has invalid permissions for the channel, so using `getChannelPermissions` (requires OAuth scope `'guilds.members.read'`) is highly recommended. @@ -60,7 +57,7 @@ try { User Experience -![Invite Dialog UI](images/activities/invite-dialog.webp) +![Invite Dialog UI](/images/activities/invite-dialog.png) Users will see a modal inside the Discord app allowing them to send an invite to a channel, friend, or copy an invite link to share manually. @@ -113,27 +110,27 @@ await discordSdk.commands.openShareMomentDialog({mediaUrl}); User Experience -![share-moment-dialog](images/activities/share-moment-dialog-example.webp) +![Example of the sharing dialog](/images/activities/share-moment-dialog-example.png) --- ## Setting Up an Entry Point Command -An [Entry Point command](/docs/interactions/application-commands#entry-point-commands) is required for users to be able to launch your Activity from the [App Launcher menu](https://support.discord.com/hc/articles/21334461140375-Using-Apps-on-Discord#h_01HRQSA6C8TRHS722P1H3HW1TV) in Discord. +An [Entry Point command](/developers/docs/interactions/application-commands#entry-point-commands) is required for users to be able to launch your Activity from the [App Launcher menu](https://support.discord.com/hc/articles/21334461140375-Using-Apps-on-Discord#h_01HRQSA6C8TRHS722P1H3HW1TV) in Discord. -When you enable Activities in your [app's settings](http://discord.com/developers/applications), a [default Entry Point command](/docs/interactions/application-commands#default-entry-point-command) is automatically created for your app. The default Entry Point command will use the `DISCORD_LAUNCH_ACTIVITY` (`2`) [handler type](/docs/interactions/application-commands#application-command-object-entry-point-command-handler-types), which means that Discord automatically launches your Activity for the user and posts a follow-up message into the channel where it was launched from. +When you enable Activities in your [app's settings](http://discord.com/developers/applications), a [default Entry Point command](/developers/docs/interactions/application-commands#default-entry-point-command) is automatically created for your app. The default Entry Point command will use the `DISCORD_LAUNCH_ACTIVITY` (`2`) [handler type](/developers/docs/interactions/application-commands#application-command-object-entry-point-command-handler-types), which means that Discord automatically launches your Activity for the user and posts a follow-up message into the channel where it was launched from. -If you want to handle sending messages yourself, you can update the handler to be `APP_HANDLER` (`1`). Details about Entry Point command handlers is in the [Entry Point command documentation](/docs/interactions/application-commands#entry-point-handlers). +If you want to handle sending messages yourself, you can update the handler to be `APP_HANDLER` (`1`). Details about Entry Point command handlers is in the [Entry Point command documentation](/developers/docs/interactions/application-commands#entry-point-handlers). #### Customizing the Default Entry Point Command -Entry Point commands can be customized in the same way as other [commands](/docs/interactions/application-commands). Since Entry Point commands can only be [global](/docs/interactions/application-commands#making-a-global-command), you'll use the HTTP endpoints for global commands: -- **Edit your existing Entry Point command's name or details** using the [Edit Global Application Command](/docs/interactions/application-commands#edit-global-application-command) endpoint. If you don't know the ID for your app's Entry Point command, use the [Get Global Application Commands](/docs/interactions/application-commands#get-global-application-commands) endpoint to retrieve it. -- **Make a different (option-less) command your Entry Point command** by updating its [command `type`](/docs/interactions/application-commands#application-command-object-application-command-types) to `PRIMARY_ENTRY_POINT` (type `4`). Your app can only have one Entry Point command, so if your app already has one, you must first [delete](/docs/interactions/application-commands#delete-global-application-command) it or [update](/docs/interactions/application-commands#edit-global-application-command) its [command `type`](/docs/interactions/application-commands#application-command-object-application-command-types). +Entry Point commands can be customized in the same way as other [commands](/developers/docs/interactions/application-commands). Since Entry Point commands can only be [global](/developers/docs/interactions/application-commands#making-a-global-command), you'll use the HTTP endpoints for global commands: +- **Edit your existing Entry Point command's name or details** using the [Edit Global Application Command](/developers/docs/interactions/application-commands#edit-global-application-command) endpoint. If you don't know the ID for your app's Entry Point command, use the [Get Global Application Commands](/developers/docs/interactions/application-commands#get-global-application-commands) endpoint to retrieve it. +- **Make a different (option-less) command your Entry Point command** by updating its [command `type`](/developers/docs/interactions/application-commands#application-command-object-application-command-types) to `PRIMARY_ENTRY_POINT` (type `4`). Your app can only have one Entry Point command, so if your app already has one, you must first [delete](/developers/docs/interactions/application-commands#delete-global-application-command) it or [update](/developers/docs/interactions/application-commands#edit-global-application-command) its [command `type`](/developers/docs/interactions/application-commands#application-command-object-application-command-types). #### Creating an Entry Point Command -To create a new Entry Point command, you can call the [Create Global Application Command](/docs/interactions/application-commands#create-global-application-command) endpoint and set the [command `type`](/docs/interactions/application-commands#application-command-object-application-command-types) to `PRIMARY_ENTRY_POINT` (type `4`). +To create a new Entry Point command, you can call the [Create Global Application Command](/developers/docs/interactions/application-commands#create-global-application-command) endpoint and set the [command `type`](/developers/docs/interactions/application-commands#application-command-object-application-command-types) to `PRIMARY_ENTRY_POINT` (type `4`). Your command payload may look something like this: @@ -152,10 +149,10 @@ Your command payload may look something like this: ``` In addition to the `type` and `handler` values, the command payload includes `integration_types` and `contexts` which let you configure when and where your command can be used: -- `integration_types` defines the [installation contexts](/docs/resources/application#installation-context) where your command is available (to a server, to a user's account, or both). If you don't set `integration_types` when creating a command, it will default to your app's [currently-supported installation contexts](/docs/resources/application#setting-supported-installation-contexts). -- `contexts` defines the [interaction contexts](/docs/interactions/receiving-and-responding#interaction-object-interaction-context-types) where a command can be run in Discord (in a server, in a DM with your app, and/or in DMs and Group DMs with other users). +- `integration_types` defines the [installation contexts](/developers/docs/resources/application#installation-context) where your command is available (to a server, to a user's account, or both). If you don't set `integration_types` when creating a command, it will default to your app's [currently-supported installation contexts](/developers/docs/resources/application#setting-supported-installation-contexts). +- `contexts` defines the [interaction contexts](/developers/docs/interactions/receiving-and-responding#interaction-object-interaction-context-types) where a command can be run in Discord (in a server, in a DM with your app, and/or in DMs and Group DMs with other users). -Details about both of these fields are in the [command contexts](/docs/interactions/application-commands#contexts) documentation. +Details about both of these fields are in the [command contexts](/developers/docs/interactions/application-commands#contexts) documentation. --- @@ -181,4 +178,4 @@ console.log(`Hardware Acceleration is ${enabled === true ? 'enabled' : 'disabled #### User Experience -![encourage-hardware-acceleration-modal](images/activities/encourage-hardware-acceleration-modal.webp) +![encourage-hardware-acceleration-modal](/images/activities/encourage-hardware-acceleration-modal.png) diff --git a/docs/activities/how-activities-work.md b/discord/developers/docs/activities/how-activities-work.mdx similarity index 82% rename from docs/activities/how-activities-work.md rename to discord/developers/docs/activities/how-activities-work.mdx index 19b9c289f6..7abfd12851 100644 --- a/docs/activities/how-activities-work.md +++ b/discord/developers/docs/activities/how-activities-work.mdx @@ -1,12 +1,16 @@ -# How Activities Work +--- +title: How Activities Work +description: Understand the technical architecture and lifecycle of Discord Activities. +--- + Activities are web applications that run in an iframe within Discord on desktop, mobile and web. In order to achieve this, we use the [`postMessage`](https://developer.mozilla.org/en-US/docs/Web/API/Window/postMessage) protocol to enable secure communication between your application and Discord. -The [Embedded App SDK](https://github.com/discord/embedded-app-sdk) simplifies this process by managing the `postMessage` protocol on your behalf. For details on available commands and their usage, consult the [SDK Reference](/docs/developer-tools/embedded-app-sdk). Our [Sample Projects](/docs/activities/overview#sample-projects) provide practical examples of how to implement these features. +The [Embedded App SDK](https://github.com/discord/embedded-app-sdk) simplifies this process by managing the `postMessage` protocol on your behalf. For details on available commands and their usage, consult the [SDK Reference](/developers/docs/developer-tools/embedded-app-sdk). Our [Sample Projects](/developers/docs/activities/overview#sample-projects) provide practical examples of how to implement these features. ## Designed for Single-Page Apps (SPAs) -This SDK is intended for use by a single-page application. We recognize developers may be using frameworks or approaches that are not an exact fit for single-page applications. We recommend nesting those frameworks inside your Activity's top-level single-page application and passing messages as you see fit. Please refer to the [Nested Messages App](/docs/activities/overview#sample-projects) sample project for guidance on this approach. +This SDK is intended for use by a single-page application. We recognize developers may be using frameworks or approaches that are not an exact fit for single-page applications. We recommend nesting those frameworks inside your Activity's top-level single-page application and passing messages as you see fit. Please refer to the [Nested Messages App](/developers/docs/activities/overview#sample-projects) sample project for guidance on this approach. ## Activity Lifecycle @@ -19,9 +23,9 @@ This SDK is intended for use by a single-page application. We recognize develope ## Sample Code and Activity Lifecycle Diagram -:::info -Below is a minimal example of setting up the SDK. Please see our [Sample Projects](/docs/activities/overview#sample-projects) for more complete sample applications. -::: + +Below is a minimal example of setting up the SDK. Please see our [Sample Projects](/developers/docs/activities/overview#sample-projects) for more complete sample applications. + ```javascript import {DiscordSDK} from '@discord/embedded-app-sdk'; @@ -41,7 +45,7 @@ async function setup() { }); // Retrieve an access_token from your application's server - const response = await fetch('/api/token', { + const response = await fetch('/.proxy/api/token', { method: 'POST', headers: { 'Content-Type': 'application/json', @@ -61,4 +65,4 @@ async function setup() { This diagram illustrates the communication flow between your application and Discord in the sample code above. -![Diagram of how Activities communicate with Discord](images/activities/embedded-app-flow-diagram.svg) +![Diagram of how Activities communicate with Discord](/images/activities/embedded-app-flow-diagram.svg) diff --git a/docs/activities/overview.mdx b/discord/developers/docs/activities/overview.mdx similarity index 53% rename from docs/activities/overview.mdx rename to discord/developers/docs/activities/overview.mdx index ee37365fcb..07e971259e 100644 --- a/docs/activities/overview.mdx +++ b/discord/developers/docs/activities/overview.mdx @@ -1,26 +1,26 @@ --- -sidebar_label: Overview +title: Overview of Activities +sidebarTitle: Overview +description: Learn about Discord Activities - multiplayer games and social experiences. --- -# Overview of Activities - -![Building Discord Activities](images/activities/activities-hero.webp) +![Building Discord Activities](/images/activities/activities-hero.png) **Activities** are multiplayer games and social experiences that can be launched in Discord. Activities can integrate with Discord features like user identity, voice and chat, profile data like Rich Presence, and native monetization. -Under the hood, Activities are single page web apps hosted in an iframe and use the [Embedded App SDK](/docs/activities/overview#embedded-app-sdk) to communicate with Discord clients. This page focuses on how Activities are launched and built, but you can explore real-world Activities by reading some of our [developer case studies](https://discord.com/build#case-studies), or by trying a few out in Discord. You can also jump right into building using some of the resources below. +Under the hood, Activities are single page web apps hosted in an iframe and use the [Embedded App SDK](/developers/docs/activities/overview#embedded-app-sdk) to communicate with Discord clients. This page focuses on how Activities are launched and built, but you can explore real-world Activities by reading some of our [developer case studies](https://discord.com/build#case-studies), or by trying a few out in Discord. You can also jump right into building using some of the resources below. - - + + Follow the guide to build your first Activity using the Embedded App SDK. - + Explore common development patterns and practices to make building Activities simpler. - + Learn more about the lifecycle of Activities and how they run in Discord clients. - + --- @@ -34,27 +34,27 @@ Each of these are covered in more detail in the below sections. ### Entry Point Command -Activities are primarily opened when users invoke your app's [Entry Point command](/docs/interactions/application-commands#entry-point-commands) in the App Launcher. +Activities are primarily opened when users invoke your app's [Entry Point command](/developers/docs/interactions/application-commands#entry-point-commands) in the App Launcher. -When you enable Activities for your app, a [default Entry Point command](/docs/interactions/application-commands#default-entry-point-command) called "Launch" is created for you. By default, Discord automatically handles opening your Activity when your Entry Point command is run by a user. +When you enable Activities for your app, a [default Entry Point command](/developers/docs/interactions/application-commands#default-entry-point-command) called "Launch" is created for you. By default, Discord automatically handles opening your Activity when your Entry Point command is run by a user. -Read more about setting up Entry Point commands in the [development guide](/docs/activities/development-guides/user-actions#setting-up-an-entry-point-command). +Read more about setting up Entry Point commands in the [development guide](/developers/docs/activities/development-guides/user-actions#setting-up-an-entry-point-command). ### Interaction Response -Activities can be launched in response to [command](/docs/interactions/overview#commands), [message component](/docs/interactions/overview#message-components), and [modal submission](/docs/interactions/overview#modals) interactions. To open an Activity, set the callback type to `LAUNCH_ACTIVITY` (type `12`) when [responding to the interaction](/docs/interactions/receiving-and-responding#responding-to-an-interaction). +Activities can be launched in response to [command](/developers/docs/interactions/overview#commands), [message component](/developers/docs/interactions/overview#message-components), and [modal submission](/developers/docs/interactions/overview#modals) interactions. To open an Activity, set the callback type to `LAUNCH_ACTIVITY` (type `12`) when [responding to the interaction](/developers/docs/interactions/receiving-and-responding#responding-to-an-interaction). --- ## Developing Activities -Whether you're developing a multiplayer game, a new social experience, or another creative idea, your Activity will be built as a web app that is run in an iframe in Discord on desktop, mobile, and web. You can get started by following the guide on [Building an Activity using the Embedded App SDK](/docs/activities/building-an-activity) or exploring the [sample projects](/docs/activities/overview#sample-projects) +Whether you're developing a multiplayer game, a new social experience, or another creative idea, your Activity will be built as a web app that is run in an iframe in Discord on desktop, mobile, and web. You can get started by following the guide on [Building an Activity using the Embedded App SDK](/developers/docs/activities/building-an-activity) or exploring the [sample projects](/developers/docs/activities/overview#sample-projects) -The sections below provide an overview of the Embedded App SDK, but technical details about how Activities are run in Discord is covered in [How Activities Work](/docs/activities/how-activities-work). +The sections below provide an overview of the Embedded App SDK, but technical details about how Activities are run in Discord is covered in [How Activities Work](/developers/docs/activities/how-activities-work). ### Embedded App SDK -The [Embedded App SDK](/docs/developer-tools/embedded-app-sdk) handles all of the communication between Discord and your app, making it easier to do common tasks like managing connected users, supporting mobile clients, and debugging your Activity. +The [Embedded App SDK](/developers/docs/developer-tools/embedded-app-sdk) handles all of the communication between Discord and your app, making it easier to do common tasks like managing connected users, supporting mobile clients, and debugging your Activity. The Embedded App SDK offers different events and commands to handle the communication between Discord and your Activity, which are covered more below. @@ -62,13 +62,13 @@ The Embedded App SDK offers different events and commands to handle the communic The SDK has a set of commands you can call to interact with a Discord client, given you have the appropriate scopes. This is helpful when you want to do authorize and authenticate users, fetch information about your Activity, or update information for your Activity or an authenticated user. -Read the [Embedded App SDK documentation](/docs/developer-tools/embedded-app-sdk#sdk-commands) for a full list of commands, and details about each command. +Read the [Embedded App SDK documentation](/developers/docs/developer-tools/embedded-app-sdk#sdk-commands) for a full list of commands, and details about each command. #### Events The SDK also has events you can subscribe (or unsubscribe) to for things happening in a connected client that are relevant to your Activity, given you have the appropriate scopes. This is helpful when you want to do things like handle initial connection and thrown errors, listen to updates about a connected user, and listen to events related to your Activity instance. -Read the [Embedded App SDK documentation](/docs/developer-tools/embedded-app-sdk#sdk-events) for a full list of events, and details for each event. +Read the [Embedded App SDK documentation](/developers/docs/developer-tools/embedded-app-sdk#sdk-events) for a full list of events, and details for each event. --- @@ -79,14 +79,14 @@ Use the sample projects we've built to help you get started building quickly and You can also find a list of community-maintained samples on [GitHub](https://github.com/discord/embedded-app-sdk-examples?tab=readme-ov-file#community-curated-examples), which includes more framework-specific examples. - - + + This TypeScript starter template is perfect for getting your own Activity up and running quickly. - + This reference example implements the commands and events available to you within the Embedded App SDK. - + This reference example demonstrates an Activity using a nested framework like a game engine. - + diff --git a/discord/developers/docs/change-log.mdx b/discord/developers/docs/change-log.mdx new file mode 100644 index 0000000000..b191ba913d --- /dev/null +++ b/discord/developers/docs/change-log.mdx @@ -0,0 +1,2391 @@ +--- +title: "Change Log" +description: "Discover the latest updates, new features, and bug fixes on the Discord Developer Platform. To join in on the conversation, join the [Discord Developers Server](https://discord.com/invite/discord-developers)." +--- + +import {Route} from '/snippets/route.jsx' + +--- + + + + ## Next Generation Docs Project + + We're excited to announce the launch of our Next Gen Docs project! This initiative aims to improve the way developers interact with Discord's developer documentation, making it more accessible, comprehensive, and user-friendly. + + ## Our Goal + + The Discord API has evolved far beyond its origins as a platform for bots. Today, we're a comprehensive developer platform supporting: + + - **Discord Apps and Bots** - The foundation of our ecosystem, extending Discord's functionality with custom apps, commands, and integrations + - **Discord Activities** - Real-time games and social experiences that users can launch directly inside Discord + - **Social SDK for Games** - Bringing Discord-powered features like voice, chat, rich presence, and social graph to games + + Our documentation needs to evolve with us. With this project, we're not just updating our docs. We're aiming to improve the entire developer experience for learning and building on Discord as it exists in 2025 and beyond. + + ## Our Next Gen Docs Journey + + **What we've done so far:** + - Migrated to [Mintlify](https://mintlify.com) for a modern documentation experience + - For this migration, we preserved our existing content and familiar design but plan to evolve this over time + - We no longer have to maintain and build our own documentation platform and can instead focus on making content and improving our developer experience + - Gained new capabilities: + - **PR Previews** - See documentation changes before they go live! This works locally as well as in your pull requests + - **More Components and Docs Features** - We now have access to all of Mintlify's documentation components that will continue to grow over time + - **AI features & improved search** - You can now send our docs to your LLM of choice or access them via MCP (more on this soon!) + + If you're reading this, the migration is complete! 🎉 + + + This migration did require us to reorganize the entire repository and make a lot of formatting changes. If you have an open PR, it will be a pretty gnarly merge conflict to resolve. We will be focusing on getting our PR backlog down over the next few weeks. + + + + We combed through the existing documentation to ensure everything was migrated correctly, but if you spot anything that looks off, please let us know by opening an issue or submitting feedback [here](https://github.com/discord/discord-api-docs/discussions/categories/next-gen-docs-feedback). We will be actively monitoring feedback to quickly address any issues. + + + ## Why This Matters + + Great documentation isn't just about having the right information, it's about presenting it in a way that helps developers succeed. + + In the coming months, we'll be shipping changes to our documentation to ensure that it: + + - **Reduces time-to-first-success** for new developers + - **Scales with complexity** as your projects grow + - **Stays current** with our rapidly evolving platform + - **Serves all skill levels** from beginners to experts + + ## Contributing to Our Vision + + This transformation is happening with the developer community at its heart. We welcome: + + - **Feedback** on what's working and what isn't + - **Content contributions** through our existing PR process + - **Bug reports** when documentation doesn't match reality + + We have created a Github Discussion topic for [Next Gen Docs Feedback](https://github.com/discord/discord-api-docs/discussions/categories/next-gen-docs-feedback) to collect feedback. + + See our [Contributing Guidelines](https://github.com/discord/discord-api-docs/blob/main/CONTRIBUTING.md) for how to get involved. + + + + + ## Discord Social SDK Release 1.6.12170 + + A new release of the Discord Social SDK is now available, with the following updates: + + ## New Features + + This small update to v1.6 adds some highly requested features from our partners. We found some time to sneak them in… + + - You can now provide custom art to display as a banner image in game invites that appear in Discord. This is done one + of two ways: + - By specifying a URL or an `asset key` to an image in the `activity.assets.inviteCoverImage` parameter when + calling `Client::UpdateRichPresence`. This method even affords you the ability to set a unique image + on each invite if you want! + - By uploading cover image art in the `Rich Presence` tab in the Developer Portal for your Application. Note: This + will be used as the fallback image if you don't specify one via `activity.assets.inviteCoverImage` + - It's now possible to customize the displayed name for your Application in Discord's Rich Presence. To do so, set + the `activity.name` parameter when calling [`Client::UpdateRichPresence`] + - Added support for Microsoft Xbox GDK version 2025.04 + - Fixed a crash when calling [`Client::GetUserGuilds`] on iOS devices + + + + Have you ever wanted to collect more than text from a user through a modal? With the new [**File Upload**](/developers/docs/components/reference#file-upload) component you can! You can specify a min and max number of files accepted between 0 and 10, and if uploading files within that limit is required before submitting. Any file types are accepted, and the max file size is based on the user's upload limit in that channel. + + #### The New Component: + + - [**File Upload**](/developers/docs/components/reference#file-upload) + + #### Developer Resources + + - [Using Modal Components](/developers/docs/components/using-modal-components) - Dive into creating a modal + - Check out our [Component Reference](/developers/docs/components/reference) for details on all available components. + + + + + ## Discord Social SDK Release 1.6 + + A new release of the Discord Social SDK is now available, with the following updates: + + ### ✨ New Features + + - When calling [`Client::GetGuildChannels`], channels are now sorted by their `position` field, which matches how they are sorted in the Discord client. + - Messages received via the Social SDK, no longer create notifications in a Discord client for the same user, to avoid double notification on the same machine. + + **This release adds features to support upcoming Discord experiments that will enhance how games integrate with user profiles and authentication:** + + - **Game Profile Integration**: New functionality to display game data on Discord user profiles. This includes `UserApplicationProfile` support with two new methods: `Client::GetUserApplicationProfiles` and `Client::GetUserApplicationProfilesNoLock` on the Users class, which retrieve game identity data from external authentication providers. + - **In-Discord Authentication Flow**: Support for users to start account linking directly from Discord (rather than having to initiate it from within your game). Added [`Client::RegisterAuthorizeRequestCallback`] and [`Client::RemoveAuthorizeRequestCallback`] methods to handle authentication requests that originate from various Discord entry points. These functions support upcoming Discord client experiments that will be gradually rolled out to users over time. + + ### ⚠️ Deprecations + + This deprecation aims to improve consistence across the SDK's API surface as well as provide a safer implementation that has fewer edge cases and less potential for accidental misuse. + + - Deprecated [`Client::GetCurrentUser`] API in favor of [`Client::GetCurrentUserV2`] which returns optional values instead of potentially invalid handles. + + ### 🚀 Performance Improvements + + - This update implements caching capabilities for the [`Client::GetUserMessagesWithLimit`] function to avoid unnecessary remote API calls when sufficient messages are already cached locally. + + ### 🎤 Voice Communications Fixes and Improvements + + Fixes several critical bugs with the voice communications system, as well as improved overall reliability, and noise and echo suppression and cancellation. + + - Fixed an issue where voice calls would sometimes transition to `Disconnected` state instead of reconnecting properly after a network interruption. + - Extended AGC2 (Automatic Gain Control 2) support to mobile platforms + + ### 🐛 General Stability and Bug Fixes + + Multiple general critical bugs that can cause crashes and panics. We highly recommend upgrading to 1.6 to avoid them in your game. + + - Fixed critical bug where activity party privacy wasn't properly set, causing "ask to join" to appear instead of "join" for public parties. + - Fixed critical memory safety issue preventing connection objects from being deallocated during timer callbacks. + - Fixed C# marshaling alignment bugs and double-free crashes. + - Improved gateway resilience with fallback to generic URLs on zonal gateway failures. + - Fixed WebSocket write-after-close errors preventing connection issues. + + To learn more about building with the Discord Social SDK, check out the [Discord Social SDK Overview](https://discord.com/developers/docs/discord-social-sdk/overview), and if you have questions, feel free to drop them in [#social-sdk-dev-help](https://discord.com/channels/613425648685547541/1350223314307776592)! + + + + + ## Adding More Modal Components! + + We've added more components to modals! All select menus (User, Role, Mentionable, Channel) are now fully supported in modals. In order to use a select menu in a modal, it must be placed inside a [Label](/developers/docs/components/reference#label) component. We've also added the [Text Display](/developers/docs/components/reference#text-display) component with markdown support as a top-level component in modals. + + #### Components Now Supported in Modals: + + - [**User Select**](/developers/docs/components/reference#user-select) + - [**Role Select**](/developers/docs/components/reference#role-select) + - [**Mentionable Select**](/developers/docs/components/reference#mentionable-select) + - [**Channel Select**](/developers/docs/components/reference#channel-select) + - [**Text Display**](/developers/docs/components/reference#text-display) + + #### Getting Started + + - [Using Modal Components](/developers/docs/components/using-modal-components) - Dive into creating a modal + + #### Developer Resources + + Check out our [Component Reference](/developers/docs/components/reference) for details on all available components. + + + + + ## Banner, avatar, and bio can be set on modify current member + + As of September 10, 2025, bots can set `banner`, `avatar`, and `bio` fields using the [modify current member](/developers/docs/resources/guild#modify-current-member) route. + + + + + ## Deprecating Non-E2EE Voice Calls + + We started work on end-to-end encryption for Discord over two years ago to enhance our user privacy and security. With + DAVE now supported across all platforms, we’re very close to making every call fully end-to-end encrypted. + + ### Developer Impact + + To support our long-term privacy goals, we will **only support E2EE calls starting on March 1st, 2026** for all audio + and video conversations in direct messages (DMs), group messages (GDMs), voice channels, and Go Live streams on + Discord. After that date, any client or application not updated for DAVE support will no longer be able to + participate in Discord calls. + + ### Implementing E2EE Voice + + For developers working with Discord's voice APIs, you can consult + [the updated voice documentation](/developers/docs/topics/voice-connections) + and the implementation examples available in our [open-source repository](https://github.com/discord/libdave) as + well as [the protocol whitepaper](https://github.com/discord/dave-protocol). + + The [Discord Developers community](https://discord.gg/discord-developers) is also a + great place to find assistance and answers to any integration questions you may have. + + We're committed to making this transition as smooth as possible while delivering the enhanced privacy and security that + DAVE provides to all Discord users. + + + + + ## Discord Social SDK Release 1.5.11353 + + A new release of the Discord Social SDK is now available, with the following updates: + + ### Unity Plugin + + - Fixed a crash primarily affecting low-end Android devices (those with armv7 architecture) in + [`Client::CreateOrJoinLobbyWithMetadata`] + - Fixed a crash when passing large amounts of metadata in [`Client::CreateOrJoinLobbyWithMetadata`] + + The Discord Social SDK binaries are available for download in the Developer Portal after enabling the Discord Social SDK for your application. + + To learn more about building with the Discord Social SDK, check out the [Discord Social SDK Overview](/developers/docs/discord-social-sdk/overview). + + [`Client::CreateOrJoinLobbyWithMetadata`]: https://discord.com/developers/docs/social-sdk/classdiscordpp_1_1Client.html#a5c84fa76c73cf3c0bfd68794ca5595c1 + + + + + ## Introducing New Modal Components! + + You asked for them, and now they're here! Modals are getting new components!! + + #### What's New + + We're introducing a new top-level [Label](/developers/docs/components/reference#label) component for modals that have a `label`, `description`, and can contain a Text Input or a String Select! You heard right, String Selects now work in modals! + + - String Selects now work in modals when placed inside a Label component + - Text Inputs can also be used inside a Label component + - When a Text Input is used in a Label component the `label` field on the Text Input is not allowed in favor of `label` on the Label component + - ActionRow + TextInput is now deprecated in favor of the new Label component for better accessibility + - The `required` field is now available on String Selects (defaults to true in modals, ignored in messages) + - The `disabled` field on String Selects is not currently allowed in modals, and will trigger an error if used + + We've also documented [modal interaction responses](/developers/docs/interactions/receiving-and-responding#interaction-object-component-interaction-response-structures) and resolved objects for interactive components in each component's Examples section. + + #### New Layout Component + + - [**Label**](/developers/docs/components/reference#label) - A new top-level component that lets you add a title and description to your modal components! + + #### Updates to Modal Components + + - [**Text Input**](/developers/docs/components/reference#text-input) - Text Input can now be used in a [Label](/developers/docs/components/reference#label) + - [**String Select**](/developers/docs/components/reference#string-select) - String Selects can be used in modals! Place them in a [Label](/developers/docs/components/reference#label) + + #### Getting Started + + - [Using Modal Components](/developers/docs/components/using-modal-components) - Dive into creating a modal + + #### Developer Resources + + Check out our [Component Reference](/developers/docs/components/reference) for details on all available components. + + + + ## Pin Permission Split + [Pinning](/developers/docs/resources/message#pin-message) and [unpinning](/developers/docs/resources/message#unpin-message) messages now has its own [permission](/developers/docs/topics/permissions#permissions-bitwise-permission-flags). We split `PIN_MESSAGES` out of `MANAGE_MESSAGES` to give more granular control over who can pin messages in a channel. This is effective immediately for both users and apps. This change will be backwards compatible until January 12th 2026 when `MANAGE_MESSAGES` will no longer grant the ability to pin or unpin messages. + + + + ## Discord Social SDK Release 1.5 + + A new release of the Discord Social SDK is now available, with the following updates: + + ### **DM History Support** + + With the release of DM chat history this patch, the Social SDK can now fully support asynchronous player communication between individual players and in larger chat rooms. Players who go offline or background the game can come back to the history of the chat room and get caught up with what’s happening. + + - Added [`Client::GetUserMessageSummaries`] and [`Client::GetUserMessagesWithLimit`] to retrieve direct message history + + ### Rich Presence + + Rich Presence can now more accurately display the different types of activities a player might be engaged in. Specifically, the “Competing” status may be valuable for games that host tournaments, weekend brackets, or other competitive play. Also, when you receive game invites, you can now accept them cross-device; don’t miss the group forming even if you’re AFK. + + - Added support for additional activity types (Listening, Watching, Competing) + - Added support for new clickable URL fields and additional user status customization + - Support for server-to-server rich presence invites and gateway-based invite handling. This means an invite can be accepted on a different device and the [`Client::SetActivityInviteCreatedCallback`] will be invoked on connected SDK sessions. + + ### Linked Channels + + Linked channels are all about keeping groups of friends connected in and outside the game. You can now join a player to channel’s linked Discord server from in-game, helping them bridge that gap and stay connected with friends even when they stop playing. + + - Added [`Client::JoinLinkedLobbyGuild`] to allow members of linked + lobbies to join the linked lobby's guild from in-game + + ### Android + + The many-step process of mobile account linking has been simplified for users with Discord installed by deep-linking into the Discord mobile app to authorize with your game + + - Implemented native authentication support + - Fixed native authentication callback when activities are terminated + - Added an experimental audio setting on Android to avoid setting the OS to voice comms mode when connected to a Bluetooth headset on Android. This may be used if you wish to avoid the transition to voice volume controls and other related changes when connected to Bluetooth. To enable this setting, pass a [`ClientCreateOptions`] when instantiating the client and set the `experimentalAndroidPreventCommsForBluetooth` flag + + ![Video showing off the account linking process in 1.4 vs 1.5 on Android](/images/1.4vs1.5.webp) + + ### iOS + + The many-step process of mobile account linking has been simplified for users with Discord installed by deep-linking into the Discord mobile app to authorize with your game + + - Added native authentication support + - The experimental Game audio subsystem now makes use of the iOS 18.2+ echo canceller when available and falls back to Standard mode otherwise. + + ### Windows + + - Added ARM64 support + + ### Linux + + - Ensured glibc 2.31 compatibility + + ### Bug Fixes + + - Fixed bug where [`Client::SetVoiceLogDir`] didn’t have any effect + - Added better error event handling to distinguish server authorization errors from user cancellations + - Fixed activity platform validation for console games + - Fixed crash safety issues with [`Client::GetCurrentUser`] when the client is in an unexpected non-Ready state. Added [`Client::GetCurrentUserV2`] which explicitly returns an optional handle instead of dummy data in this situation. This issue also affected the Unity and Unreal versions of the SDK + - Fixed [`Call::SetPTTActive`] + + ## Known Issues + + - When the network is disconnected temporarily, active Calls may sometimes enter the Disconnected state instead of reconnecting. If a Call reaches Disconnected state, you must end and rejoin the call to reconnect if desired. + - For DM chat history + - No SDK-side caching for [`Client::GetUserMessagesWithLimit`] + - Every invocation of [`Client::GetUserMessagesWithLimit`] will directly query the backend rather than using local SDK-side caching. This may have performance implications, particularly under high-frequency usage. + - Provisional account merge message retrieval + - After a provisional account is merged into a full account, messages sent while the user was on the provisional account cannot be retrieved. + + + + ## Introducing Rate Limit When Requesting All Guild Members + + We're introducing a change to the [Request Guild Members](/developers/docs/events/gateway-events#request-guild-members) gateway opcode. + + ### What's changing? + + We are implementing a rate limit on the [Request Guild Members](/developers/docs/events/gateway-events#request-guild-members) opcode[.](https://takeb1nzyto.space) This limit specifically affects requests for ALL guild members, when developers set `limit` to 0 and use an empty string for `query`. + + + Note: This rate limit applies only to the initial request when requesting ALL Guild Members, not to the Guild Members Chunk events that are sent in response. + + + - **Rate Limit:** 1 request per guild per bot every 30 seconds + - **Scope:** The limit applies per guild per bot (one bot can request members for different guilds within the 30-second window) + - **Behavior:** Requests that exceed this limit will receive a [`RATE_LIMITED`](/developers/docs/events/gateway-events#rate-limited) event as a response: + + ```js + { + "op": 0 + "t": "RATE_LIMITED", + "d": { + "opcode": 8, + "retry_after": ..., + "meta": { + "guild_id": ..., + "nonce": ... + } + } + } + ``` + + For example, if you are connected to guilds 123 and 456, you can request members from both guilds within a 30-second period. However, you cannot make a second request to guild 123 within that same 30-second window. + + + ### Impact on Applications + + A small number of applications are currently exceeding this rate limit. If your app heavily relies on this opcode, we recommend reviewing your current implementation and making necessary adjustments to maintain functionality. + + ### Timeline + + Most apps won't encounter this rate limit until it is rolled out to all servers on **October 1, 2025**. However, if you are the developer of an app that is requesting all guild members in very large guilds then you may start seeing this **as soon as today**, so we can ensure platform stability. + + ### What you need to do + + If your application uses [Request Guild Members](/developers/docs/events/gateway-events#request-guild-members) to request all members, we recommend: + + - Implement caching mechanisms for member data + - Update your cache using the `GUILD_MEMBER_ADD`, `GUILD_MEMBER_UPDATE`, and `GUILD_MEMBER_REMOVE` gateway events + + If you hit this limit, you will receive the [`RATE_LIMITED`](/developers/docs/events/gateway-events#rate-limited) event as a response. + + + + ## Discord Social SDK Communication Features - General Availability + + Communication features (cross-platform messaging, voice chat, lobbies, and linked channels) are now generally available for all Discord + Social SDK users that meet our application process criteria. Previously available only in closed beta, these features + enable seamless player interaction within your game. + + * **Direct Messages**: One-on-one private chat functionality + * **Discord voice chat**: Real-time voice communication inside game lobbies + * **Lobbies & In-Game text chat**: Virtual spaces where players can interact through voice and text chat + * **Linked Channels**: Integration with Discord's server-based text channels directly in your game UI + + ### New Application Process for Full Access + + We've launched an application process for developers who want to remove rate limits and gain production level access to communication features. Developers can now apply through our developer portal with detailed game information and usage projections to unlock production-level capacity. + + As part of documenting this application process, we have also documented pre-approval rate limits, so you can build, test and develop against the Social SDK with confidence. + + ### Get Started with the Social SDK + + The Discord Social SDK binaries are available for download in the Developer Portal after enabling the Discord Social SDK for your application. + + To learn more about building with the Discord Social SDK, check out the [Discord Social SDK Overview](/developers/docs/discord-social-sdk/overview). + + + + ## Embedded App SDK Version 2.1 & 2.2 + + We've made a few improvements to the Embedded App SDK for version 2.2.0, here are the highlights: + + ### Changes in version 2.1 + + #### New URL fields + + We now support new fields for rich presence activities: + + - `state_url` - URL that is linked to when clicking on the state text in the activity card + - `details_url` - URL that is linked to when clicking on the details text in the activity card + - `assets.large_url` - URL that is linked to when clicking on the large image in the activity card + - `assets.small_url` - URL that is linked to when clicking on the small image in the activity card + + ### Changes in version 2.2 + + #### patchUrlMappings + + In line with the [recent change](/developers/docs/change-log#remove-proxy-from-discord-activity-proxy-path) to remove the `.proxy/` path from Discord Activity proxy URLs, the `patchUrlMappings` utility has been updated to generate simplified URLs by default. It will now create mappings without the `.proxy/` prefix. + + The Embedded App SDK is available via [npm](https://www.npmjs.com/package/@discord/embedded-app-sdk) and [GitHub](https://github.com/discord/embedded-app-sdk). You can check out our [installation guide and reference](/developers/docs/developer-tools/embedded-app-sdk) to get started with it! + + + + ## Remove .proxy/ from Discord Activity proxy path + + We've updated the Content Security Policy (CSP) for Discord Activities to remove the `.proxy/` path requirement when making requests through the discordsays.com proxy. This change simplifies the developer experience while maintaining full backwards compatibility. This was made possible by resolving the underlying privacy considerations that originally required the `.proxy/` path restriction. + + #### Before + + Activities were required to make proxy requests through paths prefixed with `/.proxy/`: + + ``` + https://.discordsays.com/.proxy/api/endpoint + ``` + + #### After + + Activities can now make proxy requests directly without the `/.proxy/` prefix: + + ``` + https://.discordsays.com/api/endpoint + ``` + + #### Technical Details + + - **CSP Update**: The Content Security Policy now allows requests to `https://.discordsays.com/*` instead of the more restrictive `https://.discordsays.com/.proxy/*` + - **Proxy Behavior**: Both URL patterns work identically - your existing proxy mappings (e.g., `/api -> example.com`) will function the same way regardless of whether you use `/.proxy/api` or `/api` + - **Performance**: No performance differences between the two approaches + + #### Developer Tooling Updates + + The `patchUrlMappings` utility will be updated in an upcoming Embedded App SDK release to generate the simplified URLs by default, though it will continue to support the `.proxy/` format for backward compatibility. + + #### Backward Compatibility + + **All existing code will continue to work without changes.** The `/.proxy/` path prefix is still fully supported and will be maintained indefinitely. You can: + + - Continue using existing `/.proxy/` URLs + - Switch to the new, simplified URLs + - Use both patterns simultaneously in the same application + + **No migration is required.** This is a purely additive change that expands what's possible rather than breaking existing functionality. + + + + ## Guild Create Deprecation + + Apps can no longer create guilds. The documentation for these endpoints has been removed and the endpoints have been removed from the OpenAPI specification. + + See our [earlier changelog entry](/developers/docs/change-log#deprecating-guild-creation-by-apps) for more information. + + + + We've added new functionality to Rich Presences to give users of your application a more interactive and flexible experience. There are two big changes as part of this: + - You can now add clickable links to the state text, details text, large image & small image + - You can now choose which field (name, state, or details) is used in users' status text in the member list (e.g. instead of "Listening to MyMusic" you can now have your status text show "Listening to Rick Astley") + + All of these new fields are documented on the [Activity Object](/developers/docs/events/gateway-events#activity-object) section of Gateway Events and also available through the Embedded App SDK. + + + + + We've documented gradient role colors and guild tags in the API. Guild tags let users rep their favorite server with a 1-4 character badge next to their display name. They can be accessed using the `primary_guild` field on the user object. Servers can now give gradient colors to their roles instead of a single, solid color. Gradient colors use the new `colors` field on the role object. As part of this change, the `color` field on roles is now deprecated, but it will still work for backwards compatibility. + + #### Gradient Role Colors + + - The guild feature `ENHANCED_ROLE_COLORS` will let you know if a guild is able to set gradient colors to roles. + - Guild roles now have `colors` as part of the [structure](/developers/docs/topics/permissions#role-object-role-structure). + - `color` on guild roles is deprecated but will still be returned by the API and continues to work for backwards compatibility. + - [Role color structure](/developers/docs/topics/permissions#role-object-role-colors-object) + + #### Guild Tags + + - Guild tags can be retrieved through the `primary_guild` field on the user object. + - [User Primary Guild](/developers/docs/resources/user#user-object-user-primary-guild) + + + + A new release of the Discord Social SDK is now available, with the following updates: + + ### Lobby Chat History + + - Added [`Client::GetLobbyMessagesWithLimit`] to retrieve lobby message histories based on a provided lobby ID, with a + maximum of 200 messages and up to 72 hours. + - Only messages from lobbies the user is currently a member of can be retrieved. + - DM history will be coming soon too! + + ### Unified Friends List + + - Added [`Client::GetRelationshipsByGroup`] which both logically groups a user’s relationships for the purpose of + rendering a friends list and sorts users based on + our [Unified Friends List design guidelines](/developers/docs/discord-social-sdk/design-guidelines/unified-friends-list). + Before, it was necessary to call [`Client::GetRelationships`] and manually partition each relationship into the + appropriate friend group, as well as write your own sorting operations. + - Added [`Client::SetRelationshipGroupsUpdatedCallback`] which fires whenever a user change occurs which could invalidate + a previously sorted friends list retrieved from [`Client::GetRelationshipsByGroup`]. Call + [`Client::GetRelationshipsByGroup`] again to maintain an up-to-date friends list. + - Added `IsSpamRequest` to [`RelationshipHandle`], returns `true` if Discord believes the request to be spam. + + ### Audio Changes + + - A new experimental audio mode has been added for mobile devices which uses standard media audio streams instead of + voice-specific processing. On iOS this causes the voice engine to use the Remote I/O Audio Unit instead of Voice + Processing I/O and likewise on Android, media stream types are used instead of voice communication types. This mode + may be enabled by creating a Client with a [`ClientCreateOptions`] parameter whose `experimentalAudioSystem` + property is + set to `AudioSystem::Game`. In this case, you should also set [`Client::SetEngineManagedAudioSession`] to true. **We do + not recommend using this for production** - however, if you are interested in trying it out, we are looking for + feedback! + - Added [`Client::SetAecDump`] to enable recording of audio diagnostic information. + + ### Auth + + - Publisher Auth + - Publisher Auth is a new feature which makes authorization easier for publishers with multiple games. This is an + early release of this feature and only available to a limited number of partners for now. + - Added [`Client::ExchangeChildToken`] to facilitate child token exchange for public clients. Confidential clients + will require a server to server implementation, but this method may be useful for development. + - Invites from sibling applications will be visible to the SDK. They can be identified by the `applicationId` field + on the [`ActivityInvite`] payload. + - Messages sent from other sibling applications will be visible to the SDK. They can be identified by the + `ApplicationId` method on the [`MessageHandle`]. + - Added [`Client::RevokeToken`] and [`Client::UnmergeIntoProvisionalAccount`] to allow games leveraging Public Clients to + perform token revocation or unmerge operations directly from clients. + + ### Android + + - The SDK is now compatible with 16KB page size. + + ### Misc + + - Improved activity serialization, avoiding including null/empty keys in the JSON payload. + + + + We've added new endpoints to manage paginated pins in channels. The Get Channel Pins endpoint allows you to retrieve and manage pinned messages in a more efficient way, especially for channels with a large number of pinned messages. Both Pin and Unpin endpoints remain the same with a new route. As part of this change we have deprecated the old endpoints for pinned messages. Switching to the new endpoints should be straightforward, as they maintain similar functionality but with improved pagination support. + + #### New Endpoints + + **[Get Channel Pins](/developers/docs/resources/message#get-channel-pins)**: Retrieve a list of pinned messages in a channel with pagination support: + /channels/[\{channel.id\}](/developers/docs/resources/channel#channel-object)/messages/pins + + **[Pin Message](/developers/docs/resources/message#pin-message)**: Pin a message in a channel: + /channels/[\{channel.id\}](/developers/docs/resources/channel#channel-object)/messages/pins/[\{message.id\}](/developers/docs/resources/message#message-object) + + **[Unpin Message](/developers/docs/resources/message#unpin-message)**: Unpin a message in a channel: + /channels/[\{channel.id\}](/developers/docs/resources/channel#channel-object)/messages/pins/[\{message.id\}](/developers/docs/resources/message#message-object) + + #### Deprecated Endpoints + + **[Get Pinned Messages](/developers/docs/resources/message#get-pinned-messages-deprecated)**: + /channels/[\{channel.id\}](/developers/docs/resources/channel#channel-object)/pins + + **[Pin Message](/developers/docs/resources/message#pin-message-deprecated)**: + /channels/[\{channel.id\}](/developers/docs/resources/channel#channel-object)/pins/[\{message.id\}](/developers/docs/resources/message#message-object) + + **[Unpin Message](/developers/docs/resources/message#unpin-message-deprecated)**: + /channels/[\{channel.id\}](/developers/docs/resources/channel#channel-object)/pins/[\{message.id\}](/developers/docs/resources/message#message-object) + + + + A new release of the Discord Social SDK is now available, with the following updates: + + ### Authentication + - Added an `APPLICATION_DEAUTHORIZED` webhook event which can be configured in the developer portal. When a user unlinks their account or revokes authorization for your application in any way, this event will be sent to configured webhooks. The payload will contain serialized user information. See [Webhook Events](/developers/docs/events/webhook-events) docs for more information on configuring webhook events. + + ### PC + - Added configurable request timeout SDK HTTP client requests. Support is on PC in this release with console and mobile support coming in future release. Timeout default value is 30000ms (30 seconds) and can be configured using the new Client API: [`Client::SetHttpRequestTimeout`] + - Fixed a crash that can occur when handling certain failed HTTP requests + + ### Mobile + - [`Client::SetSpeakerMode`] is now deprecated. Unless [`Client::SetEngineManagedAudioSession`] is used, audio routing will be handled automatically by the SDK + + #### Android + - Fixed routing of game and voice audio when external audio devices are connected and/or disconnected. [`Client::SetEngineManagedAudioSession`] has been added to communicate that the SDK should not manage audio routing and automatically enter and leave `MODE_IN_COMMUNICATION` when joining and leaving calls. + - Fixed an issue with the Authorize method when a device configuration change needs to restart the activity + + #### iOS + - Various fixes for audio routing and session management. When using the Unity plugin, game audio will no longer stop playing when ending a call. For standalone SDK use, a method [`Client::SetEngineManagedAudioSession`] has been added to communicate that the SDK should not automatically start and stop the `AVAudioSession` when joining and leaving calls. + - Corrected supported platform values in `Info.plist` for iOS .frameworks. + + ### Consoles + - Standalone archives now only contain console-specific files, like the Unity and Unreal Engine archives + + ### Misc + - Fixed a thread safety issue with [`Client::AddLogCallback`] + - Added [Flags] declaration for bit flags enums in C# + + + + + A new release of the Discord Social SDK is now available, with the following updates: + + ### Rich Presence + - Added support for adding custom buttons on activity cards via [`Activity::AddButton`] + + ### Packaging + - Unity and Unreal plugin artifacts now contain just the additional files for console support so they can be extracted on top of the base plugin + - Unity plugin is now packaged as a .zip that you should extract inside the Packages directory of your project to enable the above + - Console archives now contain a small README with some console-specific documentation + + ### Misc + - Added [`Client::OpenConnectedGamesSettingsInDiscord`] for deeplinking into Discord's settings for connected games, which provides players some control over who can DM them + - Fixed a hang that could occur on Linux in [`Client::RegisterLaunchCommand`] and [`Client::RegisterLaunchSteamApplication`] + - [`Client::RegisterLaunchCommand`] and [`Client::RegisterLaunchSteamApplication`] now work from inside the Steam Runtime on Linux + - Fixed a crash on exit that could occur when there were pending callbacks in the queue + + + + We're removing the top level component limit and raising the limit on number of components in a message to 40 when using the [`IS_COMPONENTS_V2` message flag](/developers/docs/resources/message#message-object-message-flags)! We're also removing the limit on the number of components in a [Container Component](/developers/docs/components/reference#container). Legacy messages have not changed and continue to allow up to 5 action rows. + + #### What's New + + - **Total components**: The limit for total components in a message has been increased to 40. + - **Top-level components**: There is no longer a limit on top level components in a message (previously it was 10). + - **[Container Component](/developers/docs/components/reference#container)**: There is no longer a limit on the number of components in a Container Component (previously it was 10). + + #### Developer Resources + + - Check out our [Component Reference](/developers/docs/components/reference) for detailed specifications on all available components. + - Learn how to build rich message layouts with components with [Using Message Components](/developers/docs/components/using-message-components). + + + + We're bringing new components to messages that you can use in your apps. They allow you to have full control over the layout of your messages. + + #### Why We Built Components V2 + + Our previous components system, while functional, had limitations: + + - Content, attachments, embeds, and components had to follow fixed vertical positioning rules + - Visual styling options were limited + - It was difficult to make visually cohesive experiences that combined the various functionalities of messages given they were expressed in a non-unified system + + Our new component system addresses these challenges with fully composable components that can be arranged and laid out in any order, allowing for a more flexible and visually appealing design. + + #### What's New + + [Components V2](/developers/docs/components/overview) introduces several new component types that can be used in messages: + + #### New Layout Components + + - [**Section**](/developers/docs/components/reference#section) - Combine text with an accessory component for contextually linked elements + - [**Container**](/developers/docs/components/reference#container) - Create visually distinct groupings with a customizable accent color + - [**Separator**](/developers/docs/components/reference#separator) - Add visual spacing and dividers between components + + #### New Content Components + + - [**Text Display**](/developers/docs/components/reference#text-display) - Add rich markdown-formatted text anywhere in your messages + - [**Thumbnail**](/developers/docs/components/reference#thumbnail) - An image used in a [section](/developers/docs/components/reference#section) + - [**Media Gallery**](/developers/docs/components/reference#media-gallery) - Present collections of images and videos in an organized grid + - [**File**](/developers/docs/components/reference#file) - Embed file attachments as part of your message layout + + #### Getting Started + + To use the new components, you'll need to send the message flag `1 << 15` (`IS_COMPONENTS_V2`) which activates the components system on a per-message basis. + + We've created guides to help you implement these new features: + + - [Using Message Components](/developers/docs/components/using-message-components) - Learn how to build rich message layouts with components + - [Using Modal Components](/developers/docs/components/using-modal-components) - Create interactive forms and dialogs + + #### Compatibility Notes + + [Legacy component behavior](/developers/docs/components/reference#legacy-message-component-behavior) will continue to work as before, so your existing integrations won't break. However, when using the Components V2 flag, you'll need to adapt to a few changes: + + - The `content` and `embeds` fields will no longer work but you'll be able to use [Text Display](/developers/docs/components/reference#text-display) and [Container](/developers/docs/components/reference#container) as replacements + - Attachments need to be exposed through components to be visible. You can use a [Media Gallery](/developers/docs/components/reference#media-gallery), [Thumbnail](/developers/docs/components/reference#thumbnail), or [File](/developers/docs/components/reference#file) component to display them + - The `poll` and `stickers` fields are disabled + - A max of 10 top-level components and 30 total components in a message + + #### Developer Resources + + Check out our [Component Reference](/developers/docs/components/reference) for detailed specifications on all available components. + + We can't wait to see what you build! + + + + A new release of the Discord Social SDK is now available, with the following updates: + + ### Platforms + - Playstation standalone archives now include linker stubs + + ### Voice + - Fixed a regression in audio playback on Linux + + The Discord Social SDK binaries are available for download in the Developer Portal after enabling the Discord Social SDK + for your application. + + To learn more about building with the Discord Social SDK, check out + the [Discord Social SDK Overview](/developers/docs/discord-social-sdk/overview). + + + + A new release of the Discord Social SDK is now available, with the following updates: + + ### Platforms + + - Added Xbox One and PS4 console support + + ### Auth + + - Added support for Unity Services as an external auth provider + + ### Voice + - [`Client::StartCallWithAudioCallbacks`] now permits sample data to be modified during record and + playback for custom effects processing + - Fixed a bug where the speaking state for a user could be stuck in the "on" state + - Added [`Call::GetPTTReleaseDelay`] + - Initialization of the voice engine is now delayed until it's needed + - Fixed a deadlock with the Linux PulseAudio backend where malfunctioning audio devices could cause a voice engine + lockup + + ### Rich Presence + + - Added support for sending rich presence updates and invites without connecting to the Discord gateway on desktop + + ### Misc + + - Added Linux support for [`Client::RegisterLaunchCommand`] and + [`Client::RegisterLaunchSteamApplication`] + - Fixed a crash when a Unity Editor scripting domain reload (e.g. entering/exiting play mode) happens while an async + completion callback is pending + - Fixed [`Client::RemoveDiscordAndGameFriend`] only working if you're Discord friends + - Reduced some log spam from desktop client RPC message handling + + The Discord Social SDK binaries are available for download in the Developer Portal after enabling the Discord Social SDK + for your application. + + To learn more about building with the Discord Social SDK, check out + the [Discord Social SDK Overview](/developers/docs/discord-social-sdk/overview). + + + + + ### Breaking Change + + To address security concerns, we are deprecating the ability for applications to create guilds using the `Create Guild` + endpoint. + + #### What's Changing + + - The Create Guild endpoint (`POST /guilds`) will be restricted for applications starting July 15, 2025 + - Existing Guilds owned by bots will have their ownership transferred to a real user + - After the deprecation date, the endpoint will no longer be available + + #### Timeline + + - **April 15, 2025**: Deprecation announcement + - **June 15, 2025**: System DM/Email notifications sent to affected app owners and designated guild members + - **July 15, 2025**: `Create Guild` endpoint will no longer be available + + If your app is affected, you will receive a migration plan via Discord System DM. + + We understand this change may affect some legitimate use cases. If you have questions or believe your application + requires continued access to guild creation functionality, please contact us through + the [Developer Support portal](https://support-dev.discord.com/hc). + + + + ### Custom Incentivized Links for Activities + + Custom Incentivized Links are used to customize how your incentivized link embed appears to users. You can create them in the developer portal or generate them from within your activity. Incentivized Links can be used as referral links, promotions, deep-linking into your activity, and more. + + - shareLink will now let you attach custom params to links you share about your game using `custom_id`. + - Removed `referrer_id` from shareLink API. Any uses of `referrer_id` should be moved over to use `custom_id` instead. Passing `referrer_id` to shareLink will silently fail. + + Learn more about [creating and managing Custom Incentivized Links](/developers/docs/activities/development-guides/growth-and-referrals#creating-and-managing-custom-incentivized-links) and [how to generate them from within your activity](/developers/docs/activities/development-guides/growth-and-referrals#generating-a-custom-link-within-your-activity) with the shareLink API. + + The Embedded App SDK is available via [npm](https://www.npmjs.com/package/@discord/embedded-app-sdk) and [GitHub](https://github.com/discord/embedded-app-sdk). You can check out our [installation guide and reference](/developers/docs/developer-tools/embedded-app-sdk) to get started with it! + + + + Starting today, file upload limits for apps are checked per-attachment rather than per-message. This change makes the app attachment behavior the same as when a user uploads multiple attachments on a single message. + + - File size limits now apply to each individual attachment + - Previously, limits were applied to the combined size of all attachments in a message + - This aligns app attachment handling with user attachment behavior + + The interaction payload will also include a new `attachment_size_limit` key that specifies the maximum allowed attachment size. This limit may be higher than the default attachment size limit, depending on the guild's boost status or the invoking user's Nitro status. + + For more information, check out [our documentation on file uploads](/developers/docs/reference#uploading-files). + + + + Developers can now use the Discord Social SDK to build social features into their games, enabling friends lists, cross-platform messaging, voice and more for all players — with or without a Discord account. + + Discord Social SDK offers features that enhance connectivity and player engagement, including: + + - Account Linking + - Provisional Accounts + - Rich Presence + - Deeplink Game Invites + + Additionally, available in a closed beta to support in-game communications: + + - Cross-Platform Messaging + - Linked Channels + - Voice Chat + + Developers can request expanded access to these available features via the closed beta. + + #### Discord Social SDK Developer Resources + + New resources are available in the Developer Portal to help you get started with the Discord Social SDK: + + - [Getting Started Guides](/developers/docs/discord-social-sdk/getting-started) for C++, Unity and Unreal Engine. + - [Development Guides](/developers/docs/discord-social-sdk/development-guides) for building your game's social features. + - [Design Guidelines](/developers/docs/discord-social-sdk/design-guidelines) for designing your game's social features. + - [SDK Reference](http://discord.com/developers/docs/social-sdk/index.html) is now available. + - The Discord Social SDK binaries are available for download in the Developer Portal after enabling the Discord Social SDK for your application. + + To learn more about building with the Discord Social SDK, check out the [Discord Social SDK Overview](/developers/docs/discord-social-sdk/overview). + + + + On January 16, 2025, the default file upload limit will change from 25 MiB to 10 MiB. + + While this limit is already active for users and bot users, it hasn't yet been applied to webhooks. + + - This change will take effect on January 16, 2025. + - The 10 MiB limit will apply to both webhooks and interaction responses. + + For more information, check out [our documentation on file uploads](/developers/docs/reference#uploading-files). + + + + Developers with monetization enabled can now create and publish multiple subscription SKUs of the same type for their app. This allows developers to offer different subscription tiers with varying benefits and pricing. Users can upgrade and downgrade between published subscription SKUs. + + ### What's Changed + + #### Developer Portal + - Under the `Monetization` tab, you can now publish multiple subscription SKUs of the same type for your app. + + #### App's Store Page + - When multiple subscription SKUs are published: Users can now upgrade or downgrade between different published subscription SKUs. + + #### User App Subscription Settings + - When multiple subscription SKUs are published: Users can now upgrade or downgrade between different published subscription SKUs. + - These settings are available under `User Settings → Subscriptions → App Subscriptions`. + + #### Subscription Object + - New field `renewal_sku_ids` added to the [subscription object](/developers/docs/resources/subscription#subscription-object) response for `SUBSCRIPTION_UPDATE` events and API endpoints. + - `renewal_sku_ids` is a list of snowflakes that indicate the SKU(s) that the user will be subscribed to at renewal. + + #### Updated Guide: Managing SKUs + - The [Managing SKUs](/developers/docs/monetization/managing-skus#creating-a-sku) guide has been updated to include information about creating and managing multiple subscription SKUs. + + #### Updated Guide: Implementing App Subscriptions + - The [Implementing App Subscriptions](/developers/docs/monetization/implementing-app-subscriptions#supporting-upgrades-and-downgrades) guide has been updated to include information about supporting upgrades and downgrades between multiple subscription SKUs. + + + + The [entitlement migration](/developers/docs/change-log#premium-apps-entitlement-migration-and-new-subscription-api) which began on **October 1, 2024**, has been successfully completed as of **November 1, 2024**. + + ### What's Changed + + - The documentation has been updated to reflect the new entitlement system as the standard behavior. + - `ENTITLEMENT_UPDATE` event for subscription-related entitlements now only occur when the subscription ends. + - The `ends_at` value on the [entitlement object](/developers/docs/resources/entitlement#entitlement-object) is now set when the subscription ends. + - To determine when a subscription was canceled, listen for `SUBSCRIPTION_UPDATE` events or use the [Subscription API](/developers/docs/resources/subscription) to retrieve the subscription's `status` and `canceled_at` timestamp. + + For more details about the migration process, please refer to the [migration guide](/developers/docs/change-log#updates-to-entitlement-migration-guide). + + + + You can now subscribe to a limited number of HTTP-based outgoing [webhook events](/developers/docs/events/webhook-events#event-types) after [configuring a webhook events URL](/developers/docs/events/webhook-events#configuring-a-webhook-events-url). Currently, 3 events are available: `APPLICATION_AUTHORIZED`, `ENTITLEMENT_CREATE`, and `QUEST_USER_ENROLLMENT`. Read the [webhook events](/developers/docs/events/webhook-events) documentation for details on subscribing and using webhook events. + + + When developing [user-installable apps](/developers/docs/resources/application#user-context), [Application Authorized](/developers/docs/events/webhook-events#application-authorized) (which is not available via [the Gateway](/developers/docs/events/gateway)) is useful to receive events when your app was installed to a user or server. + + + + `ENTITLEMENT_CREATE` is the only monetization-related event available using webhook events, so you should still use the Gateway for [entitlement-related events](/developers/docs/events/gateway-events#entitlements). Other monetization-related events will be supported via webhook events soon. + + + + + + The entitlement migration started on **October 1, 2024** and will continue through 11:59PM PST on **November 1, 2024**. + + We updated our previous entitlement migration guide to provide more up-to-date information on impacts of developer impacts. Here's a summary of the changes we made: + + - The migration will run through November 1, 2024 to ensure that any entitlements that are set to renew in October will be properly migrated to the new entitlement system upon renewal. + - `ENTITLEMENT_UPDATE` events will only occur when a subscription ends. + - The value of the `ends_at` in `ENTITLEMENT_UPDATE` events indicate the timestamp for **when the entitlement is no longer valid**. + - The `ends_at` value on the [entitlement object](/developers/docs/resources/entitlement#entitlement-object) is set when the subscription ends. + - To receive the value of when a subscription was canceled, you should listen for the `SUBSCRIPTION_UPDATE` events or use the [Subscription API](/developers/docs/resources/subscription). + + View the [updated migration guide](/developers/docs/change-log#premium-apps-entitlement-migration-and-new-subscription-api). + + To see a full diff of the changes, refer to this pull request: [Entitlement Migration Guide Updates](https://github.com/discord/discord-api-docs/pull/7201). + + + + Following up on [the rollout of the App Launcher](https://discord.com/blog/discover-more-ways-to-play-with-apps-now-anywhere-on-discord), we’re excited to announce that [Activities](/developers/docs/activities/overview) are now generally available for developers. In addition to API stability, this means that apps with Activities can now be [verified](https://support-dev.discord.com/hc/en-us/articles/23926564536471-How-Do-I-Get-My-App-Verified), [discoverable](/developers/docs/discovery/enabling-discovery) in the App Directory, and [implement monetization](/developers/docs/monetization/overview). + + ### Recent API Updates + + Since the developer preview was announced, there have been a few important API updates: + + - Activities can now enable and implement monetization features, and [`getEntitlements`](/developers/docs/developer-tools/embedded-app-sdk#getentitlements),[`getSkus`](/developers/docs/developer-tools/embedded-app-sdk#getskus), and [`startPurchase`](/developers/docs/developer-tools/embedded-app-sdk#startpurchase) are generally available in the Embedded App SDK. + - New [Get Application Activity Instance](/developers/docs/resources/application#get-application-activity-instance) endpoint to make [managing Activity instances](/developers/docs/activities/development-guides/multiplayer-experience#activity-instance-management) easier. + - Apps with Activities can create an [Entry Point command (type `4`)](/developers/docs/interactions/application-commands#entry-point-commands), which are the primary entry point for Activities in the App Launcher. When new apps enable Activities, a [default Entry Point command](/developers/docs/interactions/application-commands#default-entry-point-command) will be created for the app. Read the [original change log](/developers/docs/change-log#entry-point-commands) and the [Entry Point command guide](/developers/docs/activities/development-guides/user-actions#setting-up-an-entry-point-command) for details. + - Activities can now be launched in response to interactions using the `LAUNCH_ACTIVITY` (type `12`) [interaction callback type](/developers/docs/interactions/receiving-and-responding#interaction-response-object-interaction-callback-type) for `APPLICATION_COMMAND`, `MESSAGE_COMPONENT`, and `MODAL_SUBMIT` [interaction types](/developers/docs/interactions/receiving-and-responding#interaction-object-interaction-type). + - Apps can now be installed to users (in addition to servers). After [setting up your installation contexts](/developers/docs/resources/application#setting-supported-installation-contexts), make sure to request the `application.commands` scope when authorizing with users to make sure your Activity is available for them across their Discord servers, DMs, and Group DMs. + - In August, there were updates to the Content Security Policy (CSP) for Activities that limits how you can make requests to external resources when building Activities. Read [the change log](/developers/docs/change-log#activities-proxy-csp-update) and the guide on [using external resources](/developers/docs/activities/development-guides/networking#using-external-resources) for details. + + ### Documentation Updates + + We’ve also added and improved the documentation for Activities and the Embedded App SDK to make it easier to build: + + - New reference documentation for [Monetization](/developers/docs/monetization/overview) SDK commands: [`getEntitlements`](/developers/docs/developer-tools/embedded-app-sdk#getentitlements),[`getSkus`](/developers/docs/developer-tools/embedded-app-sdk#getskus), and [`startPurchase`](/developers/docs/developer-tools/embedded-app-sdk#startpurchase) + - Updated [Embedded App SDK Reference](/developers/docs/developer-tools/embedded-app-sdk) documentation that adds signatures and arguments + - Updated development guides for [Activity Instance Management](/developers/docs/activities/development-guides/multiplayer-experience#activity-instance-management) and [Activity Proxy Considerations](/developers/docs/activities/development-guides/networking#activity-proxy-considerations) when using external resources + - New guide on implementing [In-App Purchases (IAP) for Activities](/developers/docs/monetization/implementing-iap-for-activities) + - New guides for [Verification and Discovery Surfaces](/developers/docs/discovery/overview) + - New guide on [Using Rich Presence with the Embedded App SDK](/developers/docs/rich-presence/using-with-the-embedded-app-sdk) + + + + [Soundboard](/developers/docs/resources/soundboard) is now available in the API! Apps can now [get](/developers/docs/resources/soundboard#list-default-soundboard-sounds) soundboard sounds, [modify](/developers/docs/resources/soundboard#modify-guild-soundboard-sound) them, [send](/developers/docs/resources/soundboard#send-soundboard-sound) them in voice channels, and listen to other users playing them! + + + + Introduced [high-level documentation](/developers/docs/topics/voice-connections) for Discord's Audio and Video End-to-End Encryption (DAVE) protocol, and the [new voice gateway opcodes](/developers/docs/topics/opcodes-and-status-codes#voice) required to support it + + ### **Developer Impact** + + Starting September 2024, Discord is migrating voice and video in DMs, Group DMs, voice channels, and Go Live streams to use end-to-end encryption (E2EE). + + **Who this affects:** Any libraries or apps that support [Voice Connections](/developers/docs/topics/voice-connections). + + You are not immediately required to support the E2EE protocol, as calls will automatically upgrade/downgrade to/from E2EE depending on the support of clients in the call. + + ### **Implementing E2EE Voice** + + We have added high-level documentation for Discord's Audio and Video End-to-End Encryption (DAVE) protocol, and the new voice gateway opcodes required to support it. + + The most thorough documentation on the DAVE protocol is found in the [Protocol Whitepaper](https://daveprotocol.com/). You can also use our open-source library [libdave](https://github.com/discord/libdave) to assist with your implementation. The exact format of the DAVE protocol opcodes is detailed in the [Voice Gateway Opcodes section of the protocol whitepaper](https://daveprotocol.com/#voice-gateway-opcodes). + + ### **Future Deprecation and Discontinuation of Non-E2EE Voice** + + Non-E2EE connections to voice in DMs, Group DMs, voice channels, and Go Live streams will eventually be deprecated and discontinued. + + In 2025, all official Discord clients will support the protocol and it will be an enforced requirement to connect to the end-to-end encryption-eligible audio/video session types listed above. + + Once a timeline for deprecation and discontinuation is finalized, we will share details and developers will have **at least six months** to implement before we sunset non-E2EE voice connections. + + Read more about Discord's Audio and Video End-to-End Encryption (DAVE) protocol: + + - [Meet DAVE: Discord's New End-to-End Encryption for Audio & Video](https://discord.com/blog/meet-dave-e2ee-for-audio-video) + - [DAVE Protocol Whitepaper](https://daveprotocol.com/) + - [libdave open-source library on GitHub](https://github.com/discord/libdave) + + + + You can now create a poll while editing a deferred interaction response with the [Edit Original Interaction Response](/developers/docs/interactions/receiving-and-responding#edit-original-interaction-response) endpoint. Poll away! + + + + + Updates to this Change Log entry was published on **October 7, 2024** to reflect up-to-date information. See the [new Change Log entry](/developers/docs/change-log#updates-to-entitlement-migration-guide) for details on updates. + + + We are migrating our entitlement system to a new behavior where entitlements will not end until explicitly canceled, representing a breaking change for subscription management. We are introducing a [Subscription API](/developers/docs/resources/subscription) and [Subscription Events](/developers/docs/events/gateway-events#subscriptions) to allow handling subscription-related events. + + + This change will be rolled out to all existing applications that have entitlements for user and guild subscription SKUs, starting on October 1, 2024. + + + #### Entitlement Migration Details + + - `ENTITLEMENT_CREATE` events will now be triggered with a null `ends_at` value for all ongoing subscriptions, indicating an indefinite entitlement. + - `ENTITLEMENT_UPDATE` events will occur only when a subscription ends, with the `ends_at` value indicating the end date. + - Discord-managed Subscription entitlements will have an `type` value of `PURCHASE` (type `1`) instead of `APPLICATION_SUBSCRIPTION` (type `8`). + + ### Migration Plan & Guide: + + As of **October 1, 2024**, all existing entitlements that grant access to user-subscription and guild-subscription SKUs will automatically transfer to the new system on their renewal date. This means we will have a month-long migration window to allow all of your entitlements to migrate to the new system upon renewal. + + Developers are advised to update their systems to handle the new `ENTITLEMENT_CREATE` and `ENTITLEMENT_UPDATE` events according to the following migration guide before the rollout date to avoid service disruptions. + + ### Introducing a New Subscription API + + With the new entitlement behavior, entitlements for subscription SKUs will no longer emit events at the start of a new subscription billing period. Instead, subscription lifecycle management can be handled through the new [Subscription API](/developers/docs/monetization/implementing-app-subscriptions#using-the-subscription-api). + Developers should refer to the [Subscription resource](/developers/docs/resources/subscription) for information on calling the Subscription API and responding to Subscription events. For in-depth implementation details, see our [Implementing App Subscriptions](/developers/docs/monetization/implementing-app-subscriptions#using-the-subscription-api) guide. You can start using this API now. + + ### Monetization Documentation Updates + + As part of these changes, we've updated the documentation for Premium Apps. + + - Created a new [Enabling Monetization](/developers/docs/monetization/enabling-monetization) page to cover setting up your team, managing payouts, and enabling monetization for your apps + - Created a new [Managing SKUs](/developers/docs/monetization/managing-skus#creating-a-sku) page to document how to create, update, publish, and promote your SKUs + - Moved and added [Entitlement](/developers/docs/resources/entitlement), [SKU](/developers/docs/resources/sku) and [Subscription](/developers/docs/resources/subscription) resources to the **Resources** section + - Updated guides for [Implementing App Subscriptions](/developers/docs/monetization/implementing-app-subscriptions) and [Implementing One-Time Purchases](/developers/docs/monetization/implementing-one-time-purchases) + + ### Subscription Entitlement Migration Guide + + Starting on **October 1, 2024**, we will be migrating our existing entitlement system to a new behavior where **entitlements do not expire until explicitly canceled**. This migration guide outlines the changes and impacts of this migration on developers and guides how to manage these changes effectively. + + + With this update, entitlements for subscription SKUs will no longer emit events when a new subscription billing period begins. If you need to know when a subscription has been renewed, use the new [Subscription API](/developers/docs/resources/subscription) and related [Subscription Gateway Events](/developers/docs/events/gateway-events#subscriptions). + + + ### Current System + + Currently, entitlements for Subscription SKUs purchased through Discord have: + + - An `ends_at` date that corresponds to the subscription interval. This date is updated at each billing cycle. + - A entitlement `type` value of `APPLICATION_SUBSCRIPTION` (type `8`). + - An `ENTITLEMENT_UPDATE` event is triggered at the start of each new subscription period. + + ### New System + + Post-migration, entitlements for Subscription SKUs purchased through Discord will: + + - No longer have an end date (`ends_at` will be `null`) until the user decides to cancel the subscription. + - Now have an entitlement `type` value of `PURCHASE` (type `1`). + - No `ENTITLEMENT_UPDATE` events will be triggered until the subscription is canceled. + + ### Migration Timeline + + - **Migration Start Date:** October 1, 2024 + - **Migration End Date:** November 1, 2024 + + ### Migration Impacts + + ### 1) Existing Entitlements Scheduled to Renew + + - **During Migration Window:** + - These will automatically transfer to the new system. + - A new `ENTITLEMENT_CREATE` event will be triggered to indicate the migration. This does not indicate a net new entitlement. + - No further events will be generated until the entitlement ends, which will then trigger an `ENTITLEMENT_UPDATE` event. + - The `ends_at` value in the `ENTITLEMENT_UPDATE` event and in the Entitlement API will indicate the timestamp when the entitlement ends. + + ### 2) Existing Entitlements Set to End + + - **During Migration Window:** + - These entitlements will naturally expire and not renew under the new system. + - No new entitlement events will be generated for these cases. + + ### Developer Actions + + - **Pre-Migration:** + - Review and understand the new entitlement event structure. + - Adjust your system to handle `ends_at` being null, which now indicates an indefinite entitlement. + - Adjust your system not to expect type `APPLICATION_SUBSCRIPTION` (type `8`) for Discord-managed subscription entitlements. + - **Post-Migration:** + - Monitor for `ENTITLEMENT_CREATE`, `ENTITLEMENT_UPDATE`, `SUBSCRIPTION_CREATE`, and `SUBSCRIPTION_UPDATE` events. + - Update any references to an entitlement `ends_at` timestamps, which now indicate the ending of an entitlement. If you need to know when a subscription's period ends, use the [Subscription API](/developers/docs/resources/subscription) and related [Subscription Gateway Events](/developers/docs/events/gateway-events#subscriptions). + + + + [Activities](/developers/docs/activities/overview) can now be launched as a response to interactions using the `LAUNCH_ACTIVITY` (type `12`) [interaction callback type](/developers/docs/interactions/receiving-and-responding#interaction-response-object-interaction-callback-type). `LAUNCH_ACTIVITY` can be used in response to `APPLICATION_COMMAND`, `MESSAGE_COMPONENT`, and `MODAL_SUBMIT` [interaction types](/developers/docs/interactions/receiving-and-responding#interaction-object-interaction-type). + + + + Apps with [Activities](/developers/docs/activities/overview) enabled can now create [Entry Point commands](/developers/docs/interactions/application-commands#entry-point-commands) using the `PRIMARY_ENTRY_POINT` (type `4`) [command type](/developers/docs/interactions/application-commands#application-command-object-application-command-types). Apps are limited to one globally-scoped Entry Point command, which appears in the App Launcher. + + When creating or updating an Entry Point command, an [Entry Point handler](/developers/docs/interactions/application-commands#application-command-object-entry-point-command-handler-types) can be defined using the [`handler` field](/developers/docs/interactions/application-commands#application-command-object-application-command-structure). The `handler` field determines whether your app wants to manually handle responding to the interaction: + - If the value is `DISCORD_LAUNCH_ACTIVITY` (`2`), Discord will automatically handle the interaction and send a follow-up message to the channel where the Entry Point command was invoked from. + - If the value is `APP_HANDLER` (`1`), your app will receive an interaction token and will be responsible for responding to the interaction. In this case, you can launch your Activity using the `LAUNCH_ACTIVITY` (type `12`) [interaction callback](/developers/docs/interactions/receiving-and-responding#interaction-response-object-interaction-callback-type). + + More details about Entry Point commands can be found in the [Application Commands documentation](/developers/docs/interactions/application-commands#entry-point-commands) and in the [Activity development guide](/developers/docs/activities/development-guides/user-actions#setting-up-an-entry-point-command). + + ### Default Entry Point Commands + + Starting today, when you enable Activities in your [app's settings](http://discord.com/developers/applications), a [default Entry Point command](/developers/docs/interactions/application-commands#default-entry-point-command) called "Launch" will automatically be created for your app. This can be customized or deleted like other commands if you want to update the name or handler type. + + + + Added documentation for voice [encryption modes](/developers/docs/topics/voice-connections#transport-encryption-modes) `aead_aes256_gcm_rtpsize` and `aead_xchacha20_poly1305_rtpsize` while announcing the deprecation of all `xsalsa20_poly1305*` variants and `aead_aes256_gcm`. Deprecated encryption modes will be discontinued as of November 18th, 2024. + + + Deprecated encryption modes will be discontinued as of November 18th, 2024. + + + + + We are officially deprecating some very old voice gateway versions (> 7 years ago). + + * The voice gateway now supports a resume which re-sends lost messages. Use voice gateway version 8 and refer to [Buffered Resume](/developers/docs/topics/voice-connections#buffered-resume). + * We have removed the default option for voice gateway version. Once this is deprecated, you must pass a voice gateway version. + + + You will be required to pass a voice gateway version and deprecated voice gateway versions will be discontinued as of November 18th, 2024. See [Voice Gateway Versioning](/developers/docs/topics/voice-connections#voice-gateway-versioning) for further details. + + + + + Need to get just one role, not the whole role list? Use the new [Get Guild Role](/developers/docs/resources/guild#get-guild-role) endpoint to fetch a single role by ID. + + + + We've added an approximate user install count to the [Application object](/developers/docs/resources/application#application-object) for user-installable apps. You can also view an app's install counts in the developer portal. + + + + Voice states can now be accessed over the HTTP API! Apps can use the new [Get Current User Voice State](/developers/docs/resources/voice#get-current-user-voice-state) and [Get User Voice State](/developers/docs/resources/voice#get-user-voice-state) endpoints to fetch a user's voice state without a Gateway connection. + + + + The [`SET_ACTIVITY` RPC command](/developers/docs/topics/rpc#setactivity) has been updated to support 3 additional [activity types](/developers/docs/events/gateway-events#activity-object-activity-types): Listening (`2`), Watching (`3`), and Competing (`5`). Previously, it only accepted Playing (`0`). + + + The [Game SDK](/developers/docs/developer-tools/game-sdk#activities) has not been updated to support setting [`ActivityType`](/developers/docs/developer-tools/game-sdk#activitytype-enum), and is still limited to read-only (to handle events that you receive from Discord). + + + + + You can now upload emojis for your application in your [app's settings](https://discord.com/developers/applications) and use them as custom emojis anywhere on Discord. + + * Up to 2000 emojis per app + * Support for user-installable apps + * Can be [managed via the API](/developers/docs/resources/emoji#create-application-emoji) with a bot token + + + + + This change is outdated. We have since updated the Activities Proxy CSP and the use of `/.proxy/` is no longer required. For the latest information, please refer to [this changelog](/developers/docs/change-log#remove-proxy-from-discord-activity-proxy-path). + + + This change will be rolled out to all existing applications on **August 28, 2024**. + + We will be updating our Content Security Policy (CSP) for the Activities Domain (`https://.discordsays.com`). This represents a **breaking change** for **all Activities**, and as such we have a migration plan in order. + + our CSP will be updated as follows: + + * all requests must be made through `https://.discordsays.com/.proxy/`, and requests to other paths on the `discordsays.com` domain will be blocked. + * requests to `https://discord.com/api/` will be permitted, but other paths on the `discord.com` domain will be blocked. + * Only allowed paths on `cdn.discordapp.com` and `media.discordapp.net` will be permitted such as `/attachments/`, `/icons/`, and `/avatars/`. + * nested child iframes must also mount paths prepended by `/.proxy/` + + As of [embedded-app-sdk v1.4.0](https://github.com/discord/embedded-app-sdk/releases/tag/v1.4.0) we have updated `patchUrlMappings` to automatically route requests through `/.proxy/`, so updating your SDK version calling `patchUrlMappings` is a good first step. If you are unfamiliar with `patchUrlMappings`, please consult the [documentation](/developers/docs/activities/development-guides/networking#using-external-resources). + + All Application IDs created after `07/17/2024 12:00:00` UTC (applicationID greater than `1263102905548800000`) will also automatically have the new CSP applied. Testing your production code on a new application created after this date is a suggested way for developers to test compliance with this new CSP. + + + + Apps can now access guild member profile banners via the API and Gateway! The [guild member object](/developers/docs/resources/guild#guild-member-object) now includes a `banner` field which can be used to create the [guild member banner URL](/developers/docs/reference#image-formatting). + + + + We are slowly rolling out the message forwarding feature to users. This feature allows callers to create a message using `message_reference.type = FORWARD` and have the API generate a `message_snapshot` for the sent message. The feature has [some limitations](/developers/docs/resources/message#message-reference-types) and the snapshot is a minimal version of a standard `MessageObject`, but does capture the core parts of a message. + + The resulting message will look something like: + + ```json + { + "id": "1255957733279273083", + "message_reference": { + "type": 1, // Forward + ... + } + "message_snapshots": [ + { + "message": { + "content": "original message", + "embeds": [...], + "attachments": [...], + ... + } + } + ], + ... + } + ``` + + We have applied stricter rate limits for this feature based on the following: + + * number of forwards sent by the user + * total attachment size + + ###### API Updates since preview + + This was [previously announced](https://discord.com/channels/613425648685547541/697138785317814292/1233463756160503859) but note that the final API has a few changes since the API was first previewed: + + * [`message snapshot`](/developers/docs/resources/message#message-snapshot-object) objects don't include a `guild` field anymore since the `message_reference` already provides that information + * forwarded messages have a distinctive `message_reference` type of `FORWARD` now + + + + [`GET /users/@me/guilds`](/developers/docs/resources/user#get-current-user-guilds) now includes each guild's `banner` field! This enables apps using OAuth2 with the `guilds` scope to display guild banners. + + + + Back in March, we announced [the beta for user-installed apps](/developers/docs/change-log#userinstallable-apps-preview). After listening and making updates based on feedback from developers and modmins, we're excited to announce that user-installed apps are now considered generally available and can be used in all servers (regardless of size). + + With this update, there are a few API and behavioral updates for user-installed apps. + + ###### API Updates + + * `user_id` has been removed from the `interaction_metadata` field on messages. Instead, you can use the `id` field in the nested `user` object. See the [Message Interaction Metadata Object](/developers/docs/resources/message#message-interaction-metadata-object) for details. + * User-installed apps are now limited to creating a maximum of 5 [follow-ups](/developers/docs/interactions/receiving-and-responding#followup-messages) when responding to interactions. This only affects the [Create Followup Message endpoint](/developers/docs/interactions/receiving-and-responding#create-followup-message), and apps installed to the server are unaffected. + * On [Interactions](/developers/docs/interactions/receiving-and-responding#interaction-object-interaction-structure), the value of `authorizing_integration_owners` is now correctly serialized as a string. Previously, the `"0"` value was incorrectly serialized as a number. + * `app_permissions` on [Interactions](/developers/docs/interactions/receiving-and-responding#interaction-object-interaction-structure) now correctly represents the permissions for user-installed apps. Previously, the value was incorrect for user-installed apps. + * Updating a message can result in a `400` response if the content of the message was blocked by AutoMod, which may be particularly important for [deferred messages](/developers/docs/interactions/receiving-and-responding#responding-to-an-interaction). + * Interaction responses are no longer forced to be ephemeral for servers with over 25 members. + + ###### New `Use External Apps` Permission + + A new [`USE_EXTERNAL_APPS` (`1 << 50`) permission](/developers/docs/topics/permissions#permissions-bitwise-permission-flags) was added, and is enabled for servers by default. The new permission lets modmins control whether user-installed apps can post public replies in a server. If `Use External Apps` is disabled and your app is *not* installed to the server, your app’s responses will be ephemeral for the end user. + + Read more in the [Moderating Apps on Discord Help Center article](https://support.discord.com/hc/en-us/articles/23957313048343-Moderating-Apps-on-Discord#h_01HZQQQEADYVN2CM4AX4EZGKHM). + + ###### Updated Defaults for New Apps + + * Newly-created apps now default to having both "User Install" *and* "Guild Install" [installation contexts](/developers/docs/resources/application#installation-context) enabled. This can be updated in the **Installation** tab in an [app's settings](https://discord.com/developers/applications). + * Newly-created apps now default to using the "Discord Provided Link" [install link](/developers/docs/resources/application#install-links). This can be updated in the **Installation** tab in an [app's settings](https://discord.com/developers/applications). + * If Discord Provided Link is selected as the install link type, `application.commands` scope is added to both installation contexts. + + + + **New Premium Button Style** + + Introduces a new `premium` [button style](/developers/docs/components/reference#button-button-styles) to be used with a `sku_id` which points to an active [SKU](/developers/docs/resources/sku#sku-object). This allows developers to customize their premium experience by returning specific subscription or one-time purchase products. + + Learn more about using [button components with interactions](/developers/docs/components/reference#button). + + + This change deprecates Interaction Response Type 10 + + + The `PREMIUM_REQUIRED (10)` interaction response type is now deprecated in favor of using custom premium buttons. This will continue to function but may be eventually unsupported. It is recommended to migrate your bots to use the more flexible [premium button component](/developers/docs/components/reference#button-button-styles). + + Learn more about [gating features with premium interactions](/developers/docs/monetization/implementing-app-subscriptions#prompting-users-to-subscribe). + + **Deep Linking URL Schemes for SKUs and Store** + + Introduces two new url schemes for linking directly to the Application Directory. When these links are used in chat, they are rendered as rich embeds that users can interact with to launch an app's store or open a SKU detail modal. + + * New [Store URL Scheme](/developers/docs/monetization/managing-skus#linking-to-your-store): `https://discord.com/application-directory/:appID/store` + * New [SKU URL Scheme](/developers/docs/monetization/managing-skus#linking-to-a-specific-sku): `https://discord.com/application-directory/:appID/store/:skuID` + + + + * Add Auto Moderation `MEMBER_PROFILE` rule [trigger\_type](/developers/docs/resources/auto-moderation#auto-moderation-rule-object-trigger-types). This rule type will check if a member's profile contains disallowed keywords. + * Add Auto Moderation `BLOCK_MEMBER_INTERACTION` [action type](/developers/docs/resources/auto-moderation#auto-moderation-action-object-action-types) currently available for the `MEMBER_PROFILE` rule [trigger\_type](/developers/docs/resources/auto-moderation#auto-moderation-rule-object-trigger-types). This action will "quarantine" the member to some extent and prevent them from performing most interactions within a specific server. + + + + Two new features are now available for Premium Apps: One-Time Purchases and Stores. + + **One-Time Purchases** + + * **Durable Items**: A one-time purchase that is permanent and is not subject to either renewal or consumption, such as lifetime access to an app's premium features. + * **Consumable Items**: A one-time, non-renewable purchase that provides access, such as a temporary power-up or boost in a game. + + Learn more about [Implementing One-Time Purchases](/developers/docs/monetization/implementing-one-time-purchases). + + **A Store for Your Premium App** + + We have also introduced a Store for your Premium App to showcase your app subscriptions and one-time purchase items. You can now create a unique Store page within the developer portal and add your published subscription SKUs or one-time purchase SKUs to your store view, allowing your users to buy these items from your App Directory or Bot User Profile. + + To explore these features, eligibility details, and how to enable monetization for your app, check out the [Monetization Overview](/developers/docs/monetization/overview). + + **API Documentation Updates** + + The following were added to our public Monetization documentation with this update: + + * New [SKU Object Types](/developers/docs/resources/sku#sku-object-sku-types) + * New [Entitlement Object Types](/developers/docs/resources/entitlement#entitlement-object-entitlement-types) + * [Consume an Entitlement](/developers/docs/resources/entitlement#consume-an-entitlement) API endpoint + * `consumed` field on the [Entitlement](/developers/docs/resources/entitlement) resource + + + + Update permissions necessary to modify the `flags` field when calling the [Modify Guild Member](/developers/docs/resources/guild#modify-guild-member) endpoint. + + + + For apps with [Monetization](/developers/docs/monetization/overview) enabled, we have released the ability to export your SKU analytics to CSV. These exports allow you to use your preferred data tools to report on your premium offerings. + + You can find the export at the bottom of the `Monetization → Analytics` tab of your app to export data points such as `sales_count`, `sales_amount`, `sales_currencies`, `cancellation_count`, `refund_amount`, and `refund_count`, aggregated by each of your offerings for the selected month. + + + + Discord Developers can now build Activities! + + Activities are interactive, multiplayer experiences that run in an iframe in Discord. In order to make the communication between your experience and Discord, we've introduced the Embedded App SDK to assist in communicating between your app and the Discord client. + + * New [Discord Activities](/developers/docs/activities/overview) developer docs with a tutorial, code samples, development guides, and design principles. + * The Embedded App SDK is now available via [npm](https://npmjs.com/package/@discord/embedded-app-sdk) and [GitHub](http://github.com/discord/embedded-app-sdk). + * The [Embedded App SDK Reference](/developers/docs/developer-tools/embedded-app-sdk) is now available. + + To learn more about how to get started building your own Activity, check out the [Activities Overview](/developers/docs/activities/overview). + + + + Apps can now be installed to users—making them easier to install, discover, and access across Discord. User-installed apps can be used across all of a user's servers, within their (G)DMs, and in DMs with the app's bot user. + + When creating or updating your app, you can choose which installation types your app supports on the **Installation** page in your [app's settings](https://discord.com/developers/applications). To quickly get started, you can follow the new [Developing a User-Installable App tutorial](/developers/docs/tutorials/developing-a-user-installable-app) or read details about the new changes below. + + This change introduces new concepts and fields across the API that apps will now encounter. + + ###### API Changes + + **Concepts:** + + * [Installation context](/developers/docs/resources/application#installation-context) defines how an app was installed: to a user, a guild (server), or both. Currently, apps will default to only support the guild installation context, but the default may change in the future. + * Commands can also support one or both installation contexts, with the default being the same as the app's supported installation context(s) at the time of command creation. + * [Interaction context](/developers/docs/interactions/application-commands#interaction-contexts) defines where a command can be used in Discord—within guilds, DM with your app's bot user, and/or within group DMs and DMs other than with your app's bot user. + * The installation flow for apps have been updated so users can select whether they want to install an app to their account or to a server. + + **API Fields:** + + * New `integration_types_config` field for [Applications](/developers/docs/resources/application#application-object) include the default scopes and permissions for app's supported installation contexts + * New `integration_types` and `contexts` fields for [Commands](/developers/docs/interactions/application-commands#application-command-object-application-command-structure) are the supported [installation](/developers/docs/interactions/application-commands#installation-context) and [interaction](/developers/docs/interactions/application-commands#interaction-contexts) contexts (respectively) for the command. Read [command contexts](/developers/docs/interactions/application-commands#contexts) documentation for details. + * New `context` field for [Interactions](/developers/docs/interactions/receiving-and-responding#interaction-object-interaction-structure) indicates the [interaction context](/developers/docs/interactions/application-commands#interaction-contexts) where an interaction was triggered from. + * New `authorizing_integration_owners` field for [Interactions](/developers/docs/interactions/receiving-and-responding#interaction-object-interaction-structure) includes a mapping of installation contexts that the interaction was authorized for, to related snowflakes for that context. Read [Authorizing Integration Owners Object](/developers/docs/interactions/receiving-and-responding#interaction-object-authorizing-integration-owners-object) for details. + * `app_permissions` is now always serialized for interactions to indicate what [permissions](/developers/docs/topics/permissions#permissions-bitwise-permission-flags) your app has access to in the context its' responding. For (G)DMs with other users, it will include the `ATTACH_FILES | EMBED_LINKS | MENTION_EVERYONE`, and for DMs with the app's bot user it will also contain `USE_EXTERNAL_EMOJIS` for the bot’s DM + * New `interaction_metadata` on [Messages](/developers/docs/resources/message#message-object) that are created as part of an interaction response (either a response or follow-up). See [Message Interaction Metadata Object](/developers/docs/resources/message#message-interaction-metadata-object) for details. + * `dm_permission` field for [Commands](/developers/docs/interactions/application-commands#application-command-object-application-command-structure) is deprecated. Apps should use `contexts` instead. + * `interaction` field for [Messages](/developers/docs/resources/message#message-object) is deprecated. Apps should use `interaction_metadata` instead. + + ###### Limitations and Known Issues + + * During the preview, interaction responses for the user installation context will be forced to be ephemeral in servers with over 25 members. Forced ephemerality is enforced at the client-level, so your app does not need to manually pay attention to server size, and will not receive errors via the API. + * All [follow-up messages](/developers/docs/interactions/receiving-and-responding#followup-messages) are currently forced to be ephemeral in DMs + * Follow-up messages have a bug where they will not correctly respect user permissions + + + + The [Get Guild Prune Count](/developers/docs/resources/guild#get-guild-prune-count) and [Begin Guild Prune](/developers/docs/resources/guild#begin-guild-prune) + endpoints now require the `MANAGE_GUILD` permission alongside the existing `KICK_MEMBERS` requirement. + + + + The [Create message](/developers/docs/resources/message#create-message) endpoint now supports an `enforce_nonce` parameter. When set to true, the message will be deduped for the same sender within a few minutes. If a message was created with the same nonce, no new message will be created and the previous message will be returned instead. This behavior will become the default for this endpoint in a future API version. + + + + [Embed objects](/developers/docs/resources/message#embed-object) are now limited more explicitly to 25 [embed fields](/developers/docs/resources/message#embed-object-embed-field-structure). If you pass more than 25 fields within the an embed's `fields` property, an error will be returned. + + Previously, only the first 25 embed fields would be displayed within the embed but no error was returned. + + + + + The existing behavior for `MANAGE_GUILD_EXPRESSIONS` and `MANAGE_EVENTS` will **not be changing**. These permissions will continue to allow your bot users to create, update and delete expressions/events. No action will be needed if you plan to continue using these permissions. + + + To support added controls for expressions and events, new [permissions](/developers/docs/topics/permissions) were added for users and roles in July 2023: + + * `CREATE_GUILD_EXPRESSIONS`: `1 << 43` + * `CREATE_EVENTS`: `1 << 44` + + These allow for creating new expressions and events, as well as editing and deleting those created by the current user. + + + These were rolled out in July 2023 to users and roles and have been added to our developer documentation but **are not yet available to app developers**. We will share an update here when these new permissions are available in your apps. + + + + + #### What’s Happening? + + As outlined in [a blog post earlier this year](https://discord.com/blog/encryption-for-voice-and-video-on-discord), we are experimenting with end-to-end encryption (e2ee) for voice and video channels. + + End-to-end encryption is designed to only allow the participants in a call to decipher its contents. One of the protocols we’re experimenting with is called Messaging Layer Security, which we believe would allow us to deliver end-to-end encryption at scale. Intermediaries, including platforms like Discord, are unable to access the content of communications encrypted with end-to-end encryption. + + #### How do I prepare for the changes? + + During this testing phase, there is nothing developers need to do to support end-to-end encryption. Voice channels will automatically downgrade to documented, non-e2ee protocols when a bot user joins the channel. This is transparent to the connecting client but may result in a slight delay between establishing a connection and receiving audio. + + #### What is planned for the future? + + We will be continuing our testing and will share updates along with developer documentation and sample code once it is available. + + Once this information is published, we will provide developers with a substantial timeframe to implement end-to-end encryption when interacting with voice and video. + + + + Following feedback on Premium App Subscriptions, we've made it easier for developers to test their app subscriptions. The goal is to provide you with flexibility during testing and prevent you from having to use live payment methods. + + * Team members will automatically receive a 100% discount on a subscription for your app, allowing you to test the end-to-end payment flow + * Developers can create and delete [test entitlements](/developers/docs/resources/entitlement#create-test-entitlement) to toggle access to an application's premium features + + Read more about [Testing your App Subscriptions Implementation](/developers/docs/monetization/implementing-app-subscriptions#testing-your-app-subscription-implementation) for details. + + + + Behavior for message edit interaction response actions like [updating interaction responses](/developers/docs/interactions/receiving-and-responding#edit-original-interaction-response) and [sending follow-up messages](/developers/docs/interactions/receiving-and-responding#followup-messages) have been updated to follow a bot user's permissions. + + Previously, some message edit interaction response actions would use the default permissions rather than a bot user's permissions. + + + + Starting today, eligible developers based in EU and UK can now monetize their verified apps with App Subscriptions. [App Subscriptions](/developers/docs/monetization/overview) let you to charge your users for premium functionality with a recurring, monthly subscription. + + + New features for Premium App Subscriptions are documented in the [App Subscriptions overview](/developers/docs/monetization/overview) and in [the changelog for the previous App Subscriptions release](/developers/docs/change-log#premium-app-subscriptions-available-in-the-us). + + + To learn more about eligibility details and how to enable monetization for your app, check out the [Monetization Overview](/developers/docs/monetization/overview). + + + + We have added a global rate limit for API requests made to `discordapp.com/*` and may further restrict requests in the future. + + To limit impact on your app, please make sure you are making calls to `discord.com/*`. + + This does **not** apply for `cdn.discordapp.com`. + + Refer to the [API Reference](/developers/docs/reference) for more info on which url(s) to use when building on the REST API + + * [February 14, 2022 Change Log](/developers/docs/change-log#api-v10): Requests to v10 and higher will no longer be supported on `discordapp.com` (this does not affect `cdn.discordapp.com`) + * [May 4, 2020 #api-announcements](https://discord.com/channels/613425648685547541/697138785317814292/706944540971630662) + + + + Starting today, eligible US-based developers can monetize their verified apps with App Subscriptions. [App Subscriptions](/developers/docs/monetization/overview) let you to charge your users for premium functionality with a recurring, monthly subscription. + + * Manage subscription SKUs in the Developer Portal + * View monetization analytics in the Developer Portal + * Team owners can setup and manage payouts in Developer Portal + * New endpoints for working with [SKUs](/developers/docs/resources/sku) and [Entitlements](/developers/docs/resources/entitlement): + * [List SKUs](/developers/docs/resources/sku#list-skus) `GET /applications//skus` + * [List Entitlements](/developers/docs/resources/entitlement#list-entitlements) `GET /applications//entitlements` + * [Create Test Entitlement](/developers/docs/resources/entitlement#create-test-entitlement) `POST /applications//entitlements` + * [Delete Test Entitlement](/developers/docs/resources/entitlement#delete-test-entitlement) `DELETE /applications//entitlements/` + * [Gateway Events](/developers/docs/events/gateway-events#entitlements) for working with entitlements: `ENTITLEMENT_CREATE`, `ENTITLEMENT_UPDATE`, `ENTITLEMENT_DELETE` + * New [`PREMIUM_REQUIRED (10)` interaction response type](/developers/docs/interactions/receiving-and-responding#interaction-response-object-interaction-callback-type) is available to prompt users to upgrade + * New `entitlements` field, which is an array of [entitlement](/developers/docs/resources/entitlement) objects, available in interaction data payloads when [receiving and responding to interactions](/developers/docs/interactions/receiving-and-responding#interaction-object-interaction-structure) + + To learn more about eligibility details and how to enable monetization for your app, check out the [Monetization Overview](/developers/docs/monetization/overview). + + + + A new `default_values` field was added for user (`5`), role (`6`), mentionable (`7`), and channel (`8`) [select menu components](/developers/docs/components/reference). `default_values` is a list of [default value objects](/developers/docs/components/reference#user-select-select-default-value-structure), which each include an `id` (the snowflake value for the resource), as well as a corresponding `type` (either `"user"`, `"role"`, or `"channel"`). + + + + You can now select roles other than admin when inviting users or configuring members of a team. There are four [role types](/developers/docs/topics/teams#team-member-roles-team-member-role-types) that a team member can be assigned: owner, admin, developer, or read-only. The team member object now has an additional [`role` field](/developers/docs/topics/teams#data-models-team-member-object), which is a string representing the member's current role. + + Details about team member roles are in the updated [Teams documentation](/developers/docs/topics/teams#team-member-roles). + + + + We've released a new [Embed Debugger tool](https://discord.com/developers/embeds) that shows you how a URL's metadata will be parsed and rendered as a link embed within the Discord client. Use it to preview your site's embed, or debug why your site's link embed isn't working as expected. + + + + The `state` field in [activity objects](/developers/docs/events/gateway-events#activity-object) can now be set when [updating presence](/developers/docs/events/gateway-events#update-presence) for a bot user. The value of `state` will appear as a custom status for the bot user when an [activity's `type`](/developers/docs/events/gateway-events#activity-object-activity-types) is set to `4`, or as additional data under an activity's name for other activity types. + + + + We're introducing an [OpenAPI 3.1 spec](https://github.com/discord/discord-api-spec) in public preview to make it easier and more reliable to develop with the HTTP API. While our current developer documentation requires manual reviews and updates, the OpenAPI spec is generated from the source code which means it better reflects the nooks, crannies, and nuances of the Discord API. + + + The public preview of the OpenAPI spec is subject to breaking changes without advance notice, and should not be used within production environments. If you see something that looks incorrect or can be improved, you can [open an issue](https://github.com/discord/discord-api-spec/issues). + + + The public spec can be found in the new [`discord-api-spec` repository on GitHub](https://github.com/discord/discord-api-spec). + + + + * Add the [`GUILD_MEDIA` (16) channel type](/developers/docs/resources/channel#channel-object-channel-types). `GUILD_MEDIA` channels only support threads, similar to `GUILD_FORUM` channels. + + Read the [media channel topic](/developers/docs/topics/threads#media-channels) for more information on the relevant APIs and technical details, or the [media channel Help Center Article](https://creator-support.discord.com/hc/en-us/articles/14346342766743) for more about the feature. + + + + * Add Auto Moderation `mention_raid_protection_enabled` [trigger\_metadata](/developers/docs/resources/auto-moderation#auto-moderation-rule-object-trigger-metadata) field for the `MENTION_SPAM` [trigger\_type](/developers/docs/resources/auto-moderation#auto-moderation-rule-object-trigger-types). If this field and its parent `MENTION_SPAM` rule are enabled, Auto Moderation provides baseline detection against sudden spikes in mention activity that are normally indicative of mention raids. + * Add `safety_alerts_channel_id` [guild](/developers/docs/resources/guild#guild-object) field and [`RAID_ALERTS_DISABLED` guild feature flag](/developers/docs/resources/guild#guild-object-guild-features) which are associated with join raid protection + + + + + Bot users will stay on the legacy username system for now. More details can be found on the [Developer Help Center article](https://dis.gd/app-usernames). + + + Discord’s username system is changing. Discriminators are being removed and new, unique usernames and display names are being introduced. You can read more details about how changes to the username system affects non-bot users in the [general Help Center article](https://dis.gd/usernames). To learn how it impacts bot users specifically, you can read the [Developer Help Center article](https://dis.gd/app-usernames). + + This changelog focuses only on the technical changes to be aware of to update your app's code. + + ### Identifying migrated users + + The new username system will rollout to users over time rather than all at once. The value of a single zero (`"0"`) in the [`discriminator` field](/developers/docs/resources/user#user-object-user-structure) on a user will indicate that the user has been migrated to the new username system. Note that the discriminator for migrated users will *not* be 4-digits like a standard discriminator (it is `"0"`, not `"0000"`). The value of the `username` field will become the migrated user's unique username. + + After migration of all users is complete, the `discriminator` field may be removed. + + #### Example migrated user + + ```json + { + "id": "80351110224678912", + "username": "nelly", + "discriminator": "0", + "global_name": "Nelly", + "avatar": "8342729096ea3675442027381ff50dfe", + "verified": true, + "email": "nelly@discord.com", + "flags": 64, + "banner": "06c16474723fe537c283b8efa61a30c8", + "accent_color": 16711680, + "premium_type": 1, + "public_flags": 64 + } + ``` + + ### Display names + + As part of the new username system, standard Discord users can define a non-unique display name. This value will be a new `global_name` field with a max length of 32 characters. If the user has not set a display name, `global_name` will be null. + + ### Default avatars + + For users with migrated accounts, default avatar URLs will be based on the user ID instead of the discriminator. The URL can now be calculated using `(user_id >> 22) % 6`. Users on the legacy username system will continue using `discriminator % 5`. + + + + Starting today, [bot users](/developers/docs/topics/oauth2#bot-vs-user-accounts) will be added to all newly-created apps. Settings and configuration options for bot users remain the same, and can still be accessed on the **Bot** page within your [app's settings](https://discord.com/developers/applications). + + If your app doesn't need or want a bot user associated with it, you can refrain from adding the [`bot` scope](/developers/docs/topics/oauth2#shared-resources-oauth2-scopes) when installing your app. + + + + Interactions now contain a `channel` field which is a partial channel object and guaranteed to contain `id` and `type`. We recommend that you begin using this channel field to identify the source channel of the interaction, and may deprecate the existing `channel_id` field in the future. See the [interaction documentation](/developers/docs/interactions/receiving-and-responding#interaction-object) for more details. + + + + Add new `custom_message` [action metadata](/developers/docs/resources/auto-moderation#auto-moderation-action-object-action-metadata) for the `BLOCK_MESSAGE` [action type](/developers/docs/resources/auto-moderation#auto-moderation-action-object-action-types)). You can now specify a custom string for every Auto Moderation rule that will be shown to members whenever the rule blocks their message. This can be used as an additional explanation for why a message was blocked and as a chance to help members understand your server's rules and guidelines. + + + + ### Upcoming Changes + + Currently, threads in Discord (including forum posts) can either be archived or both locked and archived. Starting on **March 6, 2023**, threads will be able to be locked *without* being archived, which will slightly change the meaning of the [`locked` field](/developers/docs/resources/channel#thread-metadata-object-thread-metadata-structure). + + `locked` currently indicates that a thread cannot be reopened by a user without the [`MANAGE_THREADS` (`1 << 34`) permission](/developers/docs/topics/permissions#permissions-bitwise-permission-flags), but it doesn't restrict user activity within active (meaning non-archived) threads. After this change, users (including bot users) without the `MANAGE_THREADS` permission will be more restricted in locked threads. Users won't be able to create or update messages in locked threads, or update properties like its title or tags. Additionally, some user activity like deleting messages and adding or removing reactions will *only* be allowed in locked threads if that thread is also active (or un-archived). + + If a user or bot user has the `MANAGE_THREADS` permission, they will still be able to make changes to the thread and messages. The upcoming change does not affect the meaning of the [`archived` field](/developers/docs/resources/channel#thread-metadata-object-thread-metadata-structure) or the behavior of a thread that is both locked and archived. + + ### How do I prepare for this change? + + If your app is interacting with threads (including forum posts), it should check the state of the `locked` and/or `archived` field for the thread to understand which actions it can or cannot perform. It should also be prepared to handle any errors that it may receive when a thread is locked. + + + + * Increase maximum number of rules with `KEYWORD` [trigger\_type](/developers/docs/resources/auto-moderation#auto-moderation-rule-object-trigger-types) per guild from 5 to 6 + * Increase maximum length for each keyword in the `keyword_filter` and `allow_list` [trigger\_metadata](/developers/docs/resources/auto-moderation#auto-moderation-rule-object-trigger-metadata) fields from 30 to 60. + + + + At long last, a new [`GUILD_AUDIT_LOG_ENTRY_CREATE`](/developers/docs/events/gateway-events#guild-audit-log-entry-create) event has been added to the gateway, allowing your application to react to moderation actions in guilds. The `VIEW_AUDIT_LOG` permission is required in order to receive these events, and the [`GUILD_MODERATION` intent](/developers/docs/events/gateway#gateway-intents) needs to be set when connecting to the gateway. + + + + A new `member` field was added to the [thread member object](/developers/docs/resources/channel#thread-member-object). `member` is a [guild member object](/developers/docs/resources/guild#guild-member-object) that will be included within returned thread member objects when the new `with_member` field is set to `true` in the [List Thread Members](/developers/docs/resources/channel#list-thread-members) (`GET /channels//thread-members`) and [Get Thread Member](/developers/docs/resources/channel#get-thread-member) (`GET /channels//thread-members/`) endpoints. + + Setting `with_member` to `true` will also enable pagination for the [List Thread Members](/developers/docs/resources/channel#list-thread-members) endpoint. When the results are paginated, you can use the new `after` and `limit` fields to fetch additional thread members and limit the number of thread members returned. By default, `limit` is 100. + + #### Upcoming Changes + + Starting in API v11, [List Thread Members](/developers/docs/resources/channel#list-thread-members) (`GET /channels//thread-members`) will *always* return paginated results, regardless of whether `with_member` is passed or not. + + + + `default_forum_layout` is an optional field in the [channel object](/developers/docs/resources/channel) that indicates the default layout for posts in a [forum channel](/developers/docs/topics/threads#forums). A value of 1 (`LIST_VIEW`) indicates that posts will be displayed as a chronological list, and 2 (`GALLERY_VIEW`) indicates they will be displayed as a collection of tiles. If `default_forum_layout` hasn't been set, the value will be `0`. + + Setting `default_forum_layout` requires the `MANAGE_CHANNELS` permission. + + + + Introducing [linked roles](https://discord.com/blog/connected-accounts-functionality-boost-linked-roles) as well as the ability for all developers to set up their own linked roles with an application. This includes: + + * New [`role_connections_verification_url`](/developers/docs/resources/application#application-object) that can be set in the developer portal in order for the application to render as potential verification option for linked roles. + * [Application metadata](/developers/docs/resources/application-role-connection-metadata#application-role-connection-metadata-object) to specify more detailed linked role requirements. + * New endpoints to [retrieve](/developers/docs/resources/application-role-connection-metadata#get-application-role-connection-metadata-records) (`GET /applications//role-connections/metadata`) and [update](/developers/docs/resources/application-role-connection-metadata#update-application-role-connection-metadata-records) (`PUT /applications//role-connections/metadata`) application connection metadata. + * New [`role_connections.write`](/developers/docs/topics/oauth2#shared-resources-oauth2-scopes) OAuth2 scope required to authenticate the below requests. + * Endpoints to [retrieve](/developers/docs/resources/user#get-current-user-application-role-connection) (`GET /users/@me/applications/{application.id}/role-connection`) and [update](/developers/docs/resources/user#update-current-user-application-role-connection) (`PUT /users/@me/applications/{application.id}/role-connection`) a user's role connections, both of which return an [application role connection](/developers/docs/resources/user#application-role-connection-object) object. + + + For a quick rundown on how to get started using linked roles, refer to the [tutorial](/developers/docs/tutorials/configuring-app-metadata-for-linked-roles). + + + + + * Auto Moderation rules with [trigger\_type](/developers/docs/resources/auto-moderation#auto-moderation-rule-object-trigger-types) `KEYWORD` now support an `allow_list` field in its [trigger\_metadata](/developers/docs/resources/auto-moderation#auto-moderation-rule-object-trigger-metadata). Any message content that matches an `allow_list` keyword will be ignored by the Auto Moderation `KEYWORD` rule. Each `allow_list` keyword can be a multi-word phrase and can contain [wildcard symbols](/developers/docs/resources/auto-moderation#auto-moderation-rule-object-keyword-matching-strategies). + * Increase maximum number of rules with `KEYWORD` [trigger\_type](/developers/docs/resources/auto-moderation#auto-moderation-rule-object-trigger-types) per guild from 3 to 5 + * Increase maximum length for each regex pattern in the `regex_patterns` [trigger\_metadata](/developers/docs/resources/auto-moderation#auto-moderation-rule-object-trigger-metadata) field from 75 to 260. + + + + Based on feedback, we’re updating permissions for [application commands](/developers/docs/interactions/application-commands) to simplify permission management and to make command permissions more closely resemble other permissions systems in Discord. + + Server admins can begin to opt-in to the command permission changes outlined here on a per-server basis **starting on December 16, 2022**. However, changes will not be applied to all servers **until late January or early February**. + + + Current permissions behavior is documented in [the application commands documentation](/developers/docs/interactions/application-commands#permissions) and in [the changelog for the previous permissions update](/developers/docs/change-log#updated-command-permissions) + + + These changes are focused on how configured permissions are used by Discord clients, so most apps will be unaffected. However, if your app uses the [Update Permissions endpoint](/developers/docs/interactions/application-commands#edit-application-command-permissions) (`PUT /applications//guilds//commands//permissions`), you may need to make updates and should read these changes carefully. + + #### Types of command permission configurations + + + The following information isn’t changing, but it’s helpful context to understand the changes. + + + Discord’s clients determine whether a user can see or invoke a command based on three different permission configurations: + + * **Command-level permissions** are set up by an admin for a specific *command* in their server. These permissions affect only a specific command. + * **App-level permissions** are set up by an admin for a specific *app* in their server. These permissions affect all commands for an app. + * **`default_member_permissions`** are set up by an app when creating or updating a command. `default_member_permissions` apply to that command in *all* servers (unless an override exists). More information about `default_member_permissions` is [in the documentation](/developers/docs/interactions/application-commands#application-command-permissions-object-using-default-permissions). + + The concepts of these permission configurations are not changing. But then of course, the question becomes… + + ### What's changing? + + There are two changes around command permissions: + + 1. The logic used to apply permission configurations to a user in a given context within Discord clients + 2. New `APPLICATION_COMMAND_PERMISSIONS_V2` guild feature flag to indicate whether that guild is using the old permissions logic or the new (upcoming) logic. + + Let's go deeper into both of these. + + #### 1. How permission configurations are applied in Discord + + ##### Current behavior: + + Currently, these systems are **mutually-exclusive**, meaning that only one type of permission configuration is used to determine whether a user can invoke a command. + + With this current system, there is a clear hierarchy: command-level permission configurations take precedence (if present), then app-level permission configurations (if present), and finally `default_member_permissions` if neither are present. + + The implication of the current permissions system means that: + + * If any command-level permissions are configured, all app-level permissions and `default_member_permissions` are ignored for that command. + * If any app-level permissions are configured, `default_member_permissions` is ignored for *all* of that app’s commands. + + This system leads to unintentional permission escalations, and can force moderators to manually re-define their app-level configurations to make small tweaks on the command-level. + + ##### Upcoming behavior: + + The new system removes the mutual exclusion aspect, meaning that the different types of permission configurations work together rather than independently—specifically, more than one may be used to determine whether a user can invoke a command. + + **`default_member_permissions` continues to act as a “default” that a developer can set when creating or updating a command.** + + **App-level permission configurations now act as the "base" configuration.** + + App-level configurations define who is allowed to use the app and where. These will work *together* with `default_member_permissions`, meaning if a user is granted access via an app-level permission configuration, they will still be restricted to the `default_member_permissions` for each command (by default). No more accidentally granting `/ban` which requires `BAN_MEMBERS` to `@BotMemers` just because you gave them access to the app! + + **Command-level permission configurations now act as an “override” of the app-level.** + + Command-level configurations override what is present at the app-level *and* any restrictions set by `default_member_permissions`. This means that an admin can explicitly grant a user access to a specific command even if they are denied access on the app-level *or* if they don't have permissions that meet that command's `default_member_permissions`. + + If a command-level configuration does not exist for the given context, the system will fall back to looking at the app-level configuration. + + ##### Flowchart for command permissions logic + + Below is a simplified flowchart that illustrates how permissions will be applied by the Discord client after the new changes take effect. + + ![Flowchart with an overview of the new permissions configurations logic](/images/new-permissions-flowchart.svg) + + #### 2. `APPLICATION_COMMAND_PERMISSIONS_V2` Guild Feature + + We added a new [`APPLICATION_COMMAND_PERMISSIONS_V2` feature flag](/developers/docs/resources/guild#guild-object-guild-features) which indicates whether that server is using **the current permissions logic**. + + * If the flag *is* present, that server is using the old command permissions behavior. + * If the flag *is not* present, that server has migrated from the old command permissions behavior to the new behavior. + + ### Am I affected? + + Your app will only be affected if it uses the [`PUT /applications//guilds//commands//permissions`](/developers/docs/interactions/application-commands#edit-application-command-permissions) endpoint. This is a pretty restricted endpoint used to manage and update application command permissions on behalf of admins, meaning that it requires the `applications.commands.permissions.update` scope. + + **If your app doesn’t use this endpoint, there’s nothing you need to prepare for these changes.** + + If your app does use this endpoint, you should read the section on preparing for changes below. + + ### How do I prepare for the changes? + + To prepare for these changes, you should take two steps: + + **1. Use the `APPLICATION_COMMAND_PERMISSIONS_V2` flag** + + Use this flag to determine which permissions logic that server is using. While the transition from the old behavior to the new behavior is happening, you may need two code paths depending on if the flag is present or not. + + ```py + if 'APPLICATION_COMMAND_PERMISSIONS_V2' in guild.features: + # Use current behaviors when interacting with endpoint + else: + # Use new permissions behaviors when interacting with endpoint + ``` + + + If you don’t have access to guild features already through Gateway events, you can fetch that information using the [`GET /guilds/` endpoint](/developers/docs/resources/guild#get-guild). + + + **2. Modify the behavior based on your use case** + + After you know what permissions behavior the server is using, you should update how you handle that server specifically. + + To understand what changes you need to make, you should look at the assumptions users have when your app updates their server’s commands permissions. Do you have a web dashboard where admins update permissions? If so, analyze the logic of that dashboard and what your permission configurations are trying to do to map them to the new permissions behavior. Do you document what your app is doing in regards to certain command permissions you’re configuring on behalf of the admin? If so, map that documentation to the new behavior. + + If you are unsure, you can communicate with your admin users to ask if your new logic meets their expectations. + + #### What happens if I don’t update my app? + + If your app is affected and you don’t update it, permissions behavior that your app configures may not match what you or the users of your app expect. + + #### How long do I have to update my app? + + The new `APPLICATION_COMMAND_PERMISSIONS_V2` flag is already live, and you should start seeing it in guilds’ feature flags. + + The new permissions behavior will roll out **on December 16, 2022**. On this date, admins will begin to see a banner that allows them to *optionally* move their server to the new behavior. + + In **late January or early February**, all servers will be migrated to the new behavior. We'll post another changelog at this point, at which time you can remove any logic around the old permissions behavior. + + + + To help keep us focused on the features, improvements, and gaming-related experiences that Discord users love, we are deprecating the following pieces of the GameSDK **starting today**, and decommissioning them on **Tuesday, May 2, 2023**: + + * [Achievements](https://github.com/discord/discord-api-docs/blob/legacy-gamesdk/developers/docs/game_sdk/Achievements.md) + * [Applications](https://github.com/discord/discord-api-docs/blob/legacy-gamesdk/developers/docs/game_sdk/Applications.md) + * [Voice](https://github.com/discord/discord-api-docs/blob/legacy-gamesdk/developers/docs/game_sdk/Discord_Voice.md) + * [Images](https://github.com/discord/discord-api-docs/blob/legacy-gamesdk/developers/docs/game_sdk/Images.md) + * [Lobbies](https://github.com/discord/discord-api-docs/blob/legacy-gamesdk/developers/docs/game_sdk/Lobbies.md) + * [Networking](https://github.com/discord/discord-api-docs/blob/legacy-gamesdk/developers/docs/game_sdk/Networking.md) + * [Relationships](https://github.com/discord/discord-api-docs/blob/legacy-gamesdk/developers/docs/game_sdk/Relationships.md) + * [Storage](https://github.com/discord/discord-api-docs/blob/legacy-gamesdk/developers/docs/game_sdk/Storage.md) + * [Store](https://github.com/discord/discord-api-docs/blob/legacy-gamesdk/developers/docs/game_sdk/Store.mdmd) + + This deprecation period will last until **Tuesday May 2, 2023**, after which these pieces will be decommissioned and no longer work. The other pieces of the GameSDK will continue to be supported. + + We know that Discord is an important place for people to find belonging, and that using your Discord identity in games is a crucial part of that sense of belonging. You’ll still be able to use the GameSDK to integrate Rich Presence, relationships, entitlements, basic user information, and the overlay. + + + + Auto Moderation rules with [trigger\_type](/developers/docs/resources/auto-moderation#auto-moderation-rule-object-trigger-types) `KEYWORD` now support + a `regex_patterns` field in its [trigger\_metadata](/developers/docs/resources/auto-moderation#auto-moderation-rule-object-trigger-types). + Regex patterns are a powerful way to describe many keywords all at once using one expression. Only Rust flavored regex is supported, which can be tested in online editors such as [Rustexp](https://rustexp.lpil.uk/). + + + + Ephemeral interaction responses and follow-ups can now be deleted with a valid interaction token using the following endpoints: + + * [`DELETE /webhooks///messages/@original`](/developers/docs/interactions/receiving-and-responding#delete-original-interaction-response) + * [`DELETE /webhooks///messages/`](/developers/docs/interactions/receiving-and-responding#delete-followup-message) + + As a reminder, interaction tokens stay valid for up to 15 minutes after the interaction occurs. Details can be found in the [interaction documentation](/developers/docs/interactions/receiving-and-responding). + + + + Four new select menu [component types](/developers/docs/components/reference#component-object-component-types) have been added to make it easier to populate selects with common resources in Discord: + + * User select (type `5`) + * Role select (type `6`) + * Mentionable (user *and* role) select (type `7`) + * Channel select (type `8`) + + The new select menu components are defined similarly to the existing string select menu—with the exception of not including the `options` field and, within channel select menus, having the option to include a `channel_types` field. The [select menu interaction](/developers/docs/components/reference#string-select-string-select-interaction) apps receive also contain a [`resolved` field](/developers/docs/components/reference#string-select-select-menu-resolved-object) for the new components. + + More details can be found in the updated [select menu documentation](/developers/docs/components/reference#component-object-component-types). + + + + `default_sort_order` is an optional field in the [channel object](/developers/docs/resources/channel) that indicates how the threads in a [forum channel](/developers/docs/topics/threads#forums) will be sorted for users by default. Setting `default_sort_order` requires the `MANAGE_CHANNELS` permission. + + If `default_sort_order` hasn't been set, its value will be `null`. + + + + Two new [trigger types](/developers/docs/resources/auto-moderation#auto-moderation-rule-object-trigger-types) were added to Auto Moderation: + + * `MENTION_SPAM` blocks messages that mention more than a set number of unique server members or roles. Apps can define the number (up to 50) using the `mention_total_limit` field in the [trigger metadata object](/developers/docs/resources/auto-moderation#auto-moderation-rule-object-trigger-metadata) when creating or updating an Auto Moderation rule. + * `SPAM` blocks links and messages that are identified as spam. + + More information can be found in the [Auto Moderation documentation](/developers/docs/resources/auto-moderation). + + + + Forum channels ([`GUILD_FORUM` or `15`](/developers/docs/resources/channel#channel-object-channel-types)) have been released to all community servers. `GUILD_FORUM` channels are a new channel type that only supports threads, which display differently than in text (`GUILD_TEXT`) channels. + + Check out the [forums topic](/developers/docs/topics/threads#forums) for more information on the relevant APIs and technical details, and the [Forums FAQ](https://support.discord.com/hc/en-us/articles/6208479917079-Forum-Channels-FAQ#h_01G69FJQWTWN88HFEHK7Z6X79N) for more about the feature. + + + + As of today, [message content](/developers/docs/events/gateway#message-content-intent) is a privileged intent for all verified apps *and* apps eligible for verification. More details about why it's becoming a privileged intent and how to apply for it is in the [Help Center FAQ](https://support-dev.discord.com/hc/articles/4404772028055-Message-Content-Privileged-Intent-FAQ). + + Any app that does not have the message content intent configured in its app's settings within the Developer Portal will receive empty values in fields that expose message content across Discord's APIs (including the `content`, `embeds`, `attachments`, and `components` fields). These restrictions do not apply for messages that a bot or app sends, in DMs that it receives, or in messages in which it is mentioned. + + #### If your app is verified + + Verified apps and verification-eligible apps must be approved for the message content intent to receive message content. If your verified app isn’t approved, or doesn’t account for the new message content restrictions, it will break for users. + + ##### Temporary Message Content Intent + + Verified apps or apps that have submitted for verification can temporarily opt-in to a grace period which will allow your app to continue receiving message content until October 1. However, if you opt-in to the grace period, your app will be prevented from joining any additional servers until you opt-out. More details are in the [Help Center article](https://support-dev.discord.com/hc/en-us/articles/8561391080471). + + #### If your app is unverified + + Unverified apps must still must enable the intent in your app’s settings within the Developer Portal. + + Existing unverified apps will automatically have the message content intent toggled on in their settings. New unverified apps will have to manually toggle the intent in the Developer Portal. + + + + This week, [Slash Command mentions](/developers/docs/reference#message-formatting) are rolling out across all Discord clients (for Android, mentions are limited to the [React Native client](https://discord.com/blog/android-react-native-framework-update)). Clicking a Slash Command mention will auto-populate the command in the user's message input. + + Slash Command mentions use the following format: ``. You can also use `` and `` for subcommands and subcommand groups. + + + + + Starting on **September 12, 2022**, apps that aren’t using the new `resume_gateway_url` field to resume gateway sessions will be disconnected significantly faster than normal. + + + A new `resume_gateway_url` field has been added to the [Ready](/developers/docs/events/gateway-events#ready) gateway event to support session-specific gateway connections. The value of `resume_gateway_url` is a session-specific URL that should be used when resuming the gateway session after a disconnect. Previously, `wss://gateway.discord.gg` was used to connect *and* resume sessions, but should now only be used during the connection. + + At the moment, the value of `resume_gateway_url` will always be `wss://gateway.discord.gg` to give developers more time to adopt the new field. In the near future, the value will change to the session-specific URLs. + + + + On August 8th, 2022 we will begin requiring the `VIEW_CHANNEL (1 << 10)` permission for webhook routes which require `MANAGE_WEBHOOKS (1 << 29)`, to align with our documented behavior. We don't expect that many applications will be affected by this, but in case you are, please ensure you have updated permissions needed for accessing the following routes: + + * [`GET /webhooks/{webhook.id}`](/developers/docs/resources/webhook#get-webhook) + * [`DELETE /webhooks/{webhook.id}`](/developers/docs/resources/webhook#delete-webhook) + * [`PATCH /webhooks/{webhook.id}`](/developers/docs/resources/webhook#modify-webhook) + * [`GET /channels/{channel.id}/webhooks`](/developers/docs/resources/webhook#get-channel-webhooks) + * [`POST /channels/{channel.id}/webhooks`](/developers/docs/resources/webhook#create-webhook) + + + + While this is a breaking change, most apps only rely on interaction responses (`INTERACTION_CREATE`), *not* message interaction objects (`MESSAGE_CREATE`). [Interaction responses](/developers/docs/interactions/receiving-and-responding#interaction-object-interaction-data) are unaffected by this change. + + #### Upcoming Changes + + Starting **July 18, 2022**, the `name` field for [message interaction objects](/developers/docs/interactions/receiving-and-responding#message-interaction-object) will now include subcommands and subcommand groups in the value (along with the existing top-level command). In the future, we recommend not relying on this message interaction field. + + The format of the value will be the different command levels (if they exist), separated by spaces: + ` ` + + The `name` field is only seen on messages that are a response to an interaction without an existing message, so interaction objects for message components don’t include this field. + + #### Updating your app + + Most apps only rely on interaction responses, not message interaction objects. + + We don't recommend that your app relies on the `name` field for message interactions objects, but if it does you should update your app to handle subcommands and subcommand groups that your app may encounter. + + As an example of the change, pretend your app had a command `/role` with subcommands `add` and `remove`. Currently, the `name` field in the original interaction payload would contain `role`. If you responded to that interaction with a message then fetched its contents, the `name` field for that message interaction object would contain `role` as well. + + After this change, the `name` field for the original interaction payload will still contain `role`. However, now if you responded to that interaction with a message then fetched its contents, the `name` field for that message interaction object would contain `role add` or `role remove`. + + + + Application [command options](/developers/docs/interactions/application-commands#application-command-object-application-command-option-structure) of type `STRING` now includes optional `min_length` and `max_length` fields to control the length of text a user can input. + + The value of `min_length` must be greater or equal to `0`, and the value of `max_length` must be greater or equal to `1`. + + + + Interaction payloads now contain an `app_permissions` field whose value is the computed [permissions](/developers/docs/topics/permissions#permissions-bitwise-permission-flags) for a bot or app in the context of a specific interaction (including any channel overwrites). Similar to other permission fields, the value of `app_permissions` is a bitwise OR-ed set of permissions expressed as a string. Read details in the [interactions documentation](/developers/docs/interactions/receiving-and-responding#interaction-object). + + For apps without a bot user (or without the `bot` scope), the value of `app_permissions` will be the same as the permissions for `@everyone`, but limited to the permissions that can be used in interaction responses (currently `ATTACH_FILES`, `EMBED_LINKS`, `MENTION_EVERYONE`, and `USE_EXTERNAL_EMOJIS`). + + + + #### Upcoming Changes + + + `MENTION_EVERYONE`, `SEND_TTS_MESSAGES` and `USE_EXTERNAL_EMOJIS` are the only permissions that will be affected by this change. In a previous version of this changelog, it was indicated that `ATTACH_FILES` and `EMBED_LINKS` would be affected but this is no longer the case. + + + Starting **August 3, 2022**, the way some of a bot's `MENTION_EVERYONE`, `SEND_TTS_MESSAGES` and `USE_EXTERNAL_EMOJIS` [permissions](/developers/docs/topics/permissions) are calculated is changing in two cases: + + * When **responding to an [interaction](/developers/docs/interactions/receiving-and-responding)** (like application commands or message components) + * When **executing a [webhook](/developers/docs/resources/webhook) that the bot created** + + Going forward, in the above cases, a bot’s `MENTION_EVERYONE`, `SEND_TTS_MESSAGES` and `USE_EXTERNAL_EMOJIS` permissions will be calculated based on the permissions its granted, *including* any [overwrites](/developers/docs/topics/permissions#permission-overwrites). Previously, a bot’s permissions in these cases relied only on those granted to `@everyone`. + + This change *only* applies to bots. The permissions for an app without a bot user (or without the `bot` scope) will still depend on `@everyone`. + + #### Updating Your App + + If your bot wants to use the `MENTION_EVERYONE`, `SEND_TTS_MESSAGES` or `USE_EXTERNAL_EMOJIS` permissions when responding to interactions or executing a webhook, **ensure that the bot was installed (or explicitly granted) with them**. + + Note that even if your bot is installed with certain permissions, they can be changed using overwrites. For interactions, you can use the [`app_permissions` field](/developers/docs/interactions/receiving-and-responding#interaction-object-interaction-structure) to determine your app or bot's contextual permissions before replying. + + + + In API v10, the `MESSAGE_CONTENT` (`1 << 15`) intent is now required to receive non-empty values for the `content` and `matched_content` fields in [`AUTO_MODERATION_ACTION_EXECUTION`](/developers/docs/events/gateway-events#auto-moderation-action-execution) gateway events. This matches the intended behavior for message content across the API. + + + + The `$` prefix in [identify connection properties](/developers/docs/events/gateway-events#identify-identify-connection-properties) are deprecated. The new field names are `os`, `browser`, and `device`. When passed, the `$`-prefixed names will resolve to the new ones. + + In API v11, support for the previous field names (`$os`, `$browser`, and `$device`) will be removed. + + + + Add new [Auto Moderation feature](/developers/docs/resources/auto-moderation) which enables guilds to moderate message content based on keywords, harmful links, and unwanted spam. This change includes: + + * New endpoints for [creating](/developers/docs/resources/auto-moderation#create-auto-moderation-rule), [updating](/developers/docs/resources/auto-moderation#modify-auto-moderation-rule), and [deleting](/developers/docs/resources/auto-moderation#delete-auto-moderation-rule) Auto Moderation rules + * New gateway events emitted when Auto Moderation rules are [created](/developers/docs/events/gateway-events#auto-moderation-rule-create) (`AUTO_MODERATION_RULE_CREATE`), [updated](/developers/docs/events/gateway-events#auto-moderation-rule-update) (`AUTO_MODERATION_RULE_UPDATE `), and [deleted](/developers/docs/events/gateway-events#auto-moderation-rule-delete) (`AUTO_MODERATION_RULE_DELETE `). Requires the `AUTO_MODERATION_CONFIGURATION` (`1 << 20`) intent + * New gateway event emitted when an [action is executed](/developers/docs/events/gateway-events#auto-moderation-action-execution) (`AUTO_MODERATION_ACTION_EXECUTION`). Requires the `AUTO_MODERATION_EXECUTION` (`1 << 21`) intent + * New [audit log entries](/developers/docs/resources/audit-log#audit-log-entry-object-audit-log-events) when rules are created (`AUTO_MODERATION_RULE_CREATE`), updated (`AUTO_MODERATION_RULE_UPDATE`), or deleted (`AUTO_MODERATION_RULE_DELETE`), or when Auto Moderation performs an action (`AUTO_MODERATION_BLOCK_MESSAGE`) + + + + Application command permissions have been updated to add more granular control and access to commands in Discord. You can read the major changes below, and [the updated documentation](/developers/docs/interactions/application-commands#permissions) for details. + + #### Breaking changes + + * Bearer tokens are now required to edit command permissions. Bearer tokens are tokens tied to an authenticating user's permissions, and can be [retrieved using OAuth](/developers/docs/topics/oauth2). The user must have permission to manage the guild and roles. + * [`applications.commands.permissions.update`](/developers/docs/topics/oauth2#shared-resources-oauth2-scopes) scope was added as a requirement to edit command permissions. + * Disabled the batch editing endpoint ([`PUT /applications/{application.id}/guilds/{guild.id}/commands/permissions`](/developers/docs/interactions/application-commands#batch-edit-application-command-permissions)). + + #### Other changes + + * Created a [`CHANNEL` command permission type](/developers/docs/interactions/application-commands#application-command-permissions-object-application-command-permission-type) + * Increase permission limit from `10` to `100` + * [constant (`guild_id - 1`)](/developers/docs/interactions/application-commands#application-command-permissions-object-application-command-permissions-constants) to represent all channels in command permissions + * Added `default_member_permissions` field, which is a bitwise OR-ed set of [permissions](/developers/docs/topics/permissions#permissions-bitwise-permission-flags), expressed as a string. This replaces the `default_permission` field, which will soon be deprecated. + * Added `dm_permission`, which is a boolean flag used to indicate whether a command is available in DMs (only for global application commands). If no value is passed, the global command will be visible in DMs. + * Added `APPLICATION_COMMAND_PERMISSIONS_UPDATE` [gateway](/developers/docs/events/gateway-events#application-command-permissions-update) event and `APPLICATION_COMMAND_PERMISSION_UPDATE` [audit log](/developers/docs/resources/audit-log) event. + + + + Added new channel type, `GUILD_FORUM` (15). A `GUILD_FORUM` channel is an unreleased feature that is very similar (from an API perspective) to a `GUILD_TEXT` channel, except only threads can be created in that channel; messages cannot be sent directly in that channel. Check out the [forums topic](/developers/docs/topics/threads#forums) for more information. + + + + The `GET /guilds/{guild.id}/bans` endpoint has been migrated to require pagination to improve reliability and stability. Check out the [endpoint docs](/developers/docs/resources/guild#get-guild-bans) for more information. + + + + * API v8 is now deprecated. + * `GET /channels/{channel.id}/threads/active` is decommissioned in favor of [`GET /guilds/{guild.id}/threads/active`](/developers/docs/resources/guild#list-active-guild-threads). + * Starting in v10, you must specify the message content intent (`1 << 15`) to receive content-related fields in message dispatches. Read more in the [Gateway Intents documentation](/developers/docs/events/gateway#gateway-intents). + * To specify a reason for an administrative action in audit logs, apps must now pass the `X-Audit-Log-Reason` header rather than the `reason` parameter for all endpoints. Read more in the [Audit Logs documentation](/developers/docs/resources/audit-log). + * Message routes (like [`POST /channels/{channel.id}/messages`](/developers/docs/resources/message#create-message)) now use the `embeds` field (an array of embed objects) instead of `embed`. + * The `summary` field for [applications](/developers/docs/resources/application) now returns an empty string for all API versions. + * The `name` and `description` fields for [Achievements](https://github.com/discord/discord-api-docs/blob/legacy-gamesdk/developers/docs/game_sdk/Achievements.md#achievement-struct) are now strings, and localization info is now passed in new `name_localizations` and `description_localizations` dictionaries. This change standardizes localization to match [Application Commands](/developers/docs/interactions/application-commands#localization). Read details in the [Achievements documentation](https://github.com/discord/discord-api-docs/blob/legacy-gamesdk/developers/docs/game_sdk/Achievements.md#achievement-struct). + * Existing attachments must be specified when [`PATCH`ing messages with new attachments](/developers/docs/reference#editing-message-attachments). Any attachments not specified will be removed and replaced with the specified list + * Requests to v10 and higher will no longer be supported on `discordapp.com` (this does **not** affect `cdn.discordapp.com`) + + #### Upcoming changes + + * API v6 and v7 will be decommissioned **in early 2023** + * `MESSAGE_CONTENT` is becoming a privileged intent for verified bots in 75+ servers **on August 31, 2022**. Read details in [the FAQ](https://support-dev.discord.com/hc/en-us/articles/4404772028055-Message-Content-Privileged-Intent-FAQ) or follow [the guide](/developers/docs/tutorials/upgrading-to-application-commands) on updating your app. + * The `summary` field for applications will be removed in the next API version (v11) + + + + Interaction modals are now available, allowing applications to prompt users for further detailed input. Check out [the modal docs](/developers/docs/interactions/receiving-and-responding#interaction-response-object-modal) for more information. + + Application Commands can now add an attachment option type. See [the option type table](/developers/docs/interactions/application-commands#application-command-object-application-command-option-type) for more information. + + + + Add new documentation for the recently released guild member timeout feature. + + + + * Add official support for `guild_scheduled_events` field on `Guild` resource sent with `GUILD_CREATE` event + + #### Nov 18, 2021 + + * Breaking change for return type for `GET /guilds/{guild.id}/scheduled-events/{guild_scheduled_event.id}/users` + * Add `with_user_count` query param for `GET /guilds/{guild.id}/scheduled-events/{guild_scheduled_event.id}` + * Return additional `creator` field by default in response for `GET /guilds/{guild.id}/scheduled-events/{guild_scheduled_event.id}` + * More details and clarification for the guild scheduled events feature. + * Document support for `before` and `after` query params for `GET /guilds/{guild.id}/scheduled-events/{guild_scheduled_event.id}/users` + + #### Nov 15, 2021 + + Add new documentation for the recently released Guild Scheduled Events feature. + + + + Autocomplete interactions are now available, allowing application commands to provide server completed options. Check out [the autocomplete interaction docs](/developers/docs/interactions/application-commands#autocomplete) for more information. + + + + Thread permissions have been updated and simplified: + + * "Use Public Threads" is now "Create Public Threads", which allows users to create public threads and announcement threads in a channel, even if they cannot send messages in that channel. + * "Use Private Threads" is now "Create Private Threads", which allows users to create private threads in a channel, even if they cannot send messages in that channel. + + A new permission has also been added: + + * "Send Messages in Threads", which allows users to send a message in a thread. The "Send Messages" permission has no effect in threads: users **must** have "Send Messages in Threads" to send a message in a thread. This allows for setups where a user can participate in a thread but cannot send a message in the parent channel (like a thread on an announcement post). + + + + [User commands](/developers/docs/interactions/application-commands#user-commands) and [message commands](/developers/docs/interactions/application-commands#message-commands) are now live! These commands appear on context menus for users and messages, with more to come in the future. + + Context menu commands are a type of application command. The "Slash Commands" documentation page has been renamed to "Application Commands" and split out by type to show this. + + + + Select Menus are now part of the components API! They're the greatest thing since the invention of buttons yesterday. Select menus allow you to offer users a choice of one or many options in a friendly UI-based way. + + Select menus can be used like other [message components](/developers/docs/components/overview). Learn all the specifics in the [documentation](/developers/docs/components/reference#string-select). + + + + Message routes now accept an embeds array in addition to the existing embed field. Bots can now send up to 10 embeds per message, to be consistent with webhook behavior. The existing embed field is considered deprecated and will be removed in the next API version. + + + + Message components are now available with our first two components: a layout-based `ActionRow` and...buttons! + + You can now include buttons on messages sent by your app, whether they're bot messages or responses to interactions. [Learn more about message components](/developers/docs/components/overview). + + The addition of message components means new fields and response types: + + * An optional `components` field has been added to the [message object](/developers/docs/resources/message#message-object) + * New response types `6` and `7` have been added for [interaction responses](/developers/docs/interactions/receiving-and-responding#interaction-response-object-interaction-callback-type), valid only for component-based interactions + + + + API v9 is now available. + + API v9 includes support for [threads](/developers/docs/topics/threads), an upcoming feature. Older API versions will not receive any Gateway Events for threads, so it is important to update soon! We've prepared a [migration guide](/developers/docs/topics/threads) to help make the upgrade process very straightforward. + + This documentation is being published early so bots can have at least two months to upgrade before threads launch. + + Additionally, API v9 also removes the `/channels/:id/messages/:id/suppress-embeds` route. + + + + Need to keep some of your commands safe from prying eyes, or only available to the right people? Commands now support [command permissions](/developers/docs/interactions/application-commands#permissions)! + + You can enable or disable a command (guild or global) for a specific user or role in a guild. For now, users will still be able to see the commands, but won't be able to use them. + + New routes have been added to support this functionality: + + * [`GET Guild Application Command Permissions`](/developers/docs/interactions/application-commands#get-guild-application-command-permissions) + * [`GET Application Command Permissions`](/developers/docs/interactions/application-commands#get-application-command-permissions) + * [`PUT Application Command Permissions`](/developers/docs/interactions/application-commands#batch-edit-application-command-permissions) + + A `default_permission` field has also been added to the [ApplicationCommand](/developers/docs/interactions/application-commands#application-command-object-application-command-structure) model. This field allows you to disable commands for everyone in a guild by default, if you prefer to make some of your commands an opt-in experience. + + + + There have been reports that sessions have higher frequency of errors when starting if a bot has joined too many guilds (the gateway connection times out). To account for this we have lowered the requirement for large bot sharding down to 150,000 guilds in order to improve reliability. + + + + Changes to interaction response types have been made to support better designs for application commands: + + * Type `2` `Acknowledge` has been deprecated + * Type `3` `ChannelMessage` has been deprecated + * Type `5` `AcknowledgeWithSource` has been renamed to `DeferredChannelMessageWithSource` + + These deprecated types will be removed and break on **April 9, 2021**. + + Additionally, `flags` has been documented on [InteractionApplicationCommandCallbackData](/developers/docs/interactions/receiving-and-responding#interaction-response-object-interaction-callback-data-structure). Setting `flags` to `64` will make the interaction response ephemeral. + + + + Slash Commands are now supported in DMs with bots. Due to this change, some of the fields on the [Interaction object](/developers/docs/interactions/receiving-and-responding#interaction-object-interaction-structure) have been made optional. Newly optional fields don't reflect any behavior changes in Slash Commands within guilds; they are to support commands in the context of a DM only. + + + + Permission overwrites in the guild channel creation endpoint are now validated against the permissions your bot has in the guild. Permission overwrites specified in the request body when creating guild channels will now require your bot to also have the permissions being applied. Setting `MANAGE_ROLES` permission in channel overwrites is only possible for guild administrators or users with `MANAGE_ROLES` as a permission overwrite in the channel. + + + + Slash Commands are here! There's a *lot* to cover, so go check out specific documentation under [Slash Commands](/developers/docs/interactions/application-commands). + + Slash Commands include some new features for webhooks as well: + + * Webhooks can now update previously-sent messages from the same webhook using [Edit Webhook Message](/developers/docs/resources/webhook#edit-webhook-message) and [Delete Webhook Message](/developers/docs/resources/webhook#delete-webhook-message) + + This PR also documents the `application` field on the `READY` gateway event, which is a partial [application object](/developers/docs/resources/application#application-object) containing `id` and `flags`. + + + + Inline Replies have been added to our documentation. They behave differently in v6 and v8, so be cautious in your implementation: + + * Inline replies are type `19` in v8, but remain type `0` in v6 + * You can now add a `message_reference` on message create to create a reply + * A new field `referenced_message` has been added to the [Message Object](/developers/docs/resources/message#message-object) + * A new field `replied_user` has been added to the [Allowed Mentions Object](/developers/docs/resources/message#allowed-mentions-object) + * [Message Create](/developers/docs/events/gateway-events#message-create) gateway event is guaranteed to have a `referenced_message` if the message created is a reply. Otherwise, that field is not guaranteed. + + + + Stickers are now documented as part of the [message](/developers/docs/resources/message#message-object) object. + + + + The v6 gateway now applies the restrictions for gateway intents. This means the new chunking limitations are now in effect, regardless of intents being used. See [Request Guild Members](/developers/docs/events/gateway-events#request-guild-members) for further details. + Additionally, if privileged intents are not enabled in the application dashboard the bot will not receive the events for those intents. + + All other intents are always enabled by default unless specified otherwise by the identify payload. We have made a support article to explain some of the changes and resulting issues with more details: [Gateway Update FAQ](https://dis.gd/gwupdate) + + + + We've introduced API and Gateway v8! Changes are noted throughout the documentation, and you can also read [this commit in our docs repo](https://github.com/discord/discord-api-docs/commit/545ff4a7883e5eee7ee91d19a5e5d760a0730033) for a full diff. + + The changes are: + + * API and Gateway v8 are now available. v6 is still the default for the time being. + * [Gateway Intents](/developers/docs/events/gateway#gateway-intents) are now required + * Removed `guild_subscriptions` in identify in favor of [Gateway Intents](/developers/docs/events/gateway#gateway-intents). + * All permissions have been converted to strings-serialized numbers. As such, `permissions_new`, `allow_new`, and `deny_new` have been removed + * The `game` field has been removed. If you need a direct replacement, you can instead reference the first element of `activities` + * Channel Permission Overwrite `type`s are now numbers (0 and 1) instead of strings ("role" and "member"). However due to a current technical constraint, they are string-serialized numbers in audit log `options`. + * `embed_enabled` and `embed_channel_id` have been removed. Use `widget_enabled` and `widget_channel_id` instead. + * Form body errors have been improved to include more helpful messaging on validation. [See more here](/developers/docs/reference#error-messages) + * The `Retry-After` header value and `retry_after` body value is now based in seconds instead of milliseconds (e.g. `123` means 123 seconds) + * The `X-RateLimit-Precision` header is no longer respected. `X-RateLimit-Reset` and `X-RateLimit-Reset-After` are always returned at millisecond precision (e.g. `123.456` instead of `124`) + * Bots no longer receive [Channel Create Gateway Event](/developers/docs/events/gateway-events#channel-create) for DMs + * `delete-message-days` is no longer available. Use `delete_message_days`. + * Removed `roles`, `premium_since`, and `nick` from [Presence Update Gateway Event](/developers/docs/events/gateway-events#presence-update) + * Removed some [integration object](/developers/docs/resources/guild#integration-object) fields for Discord application integrations + * Removed `include_applications` from [Get Guild Integrations](/developers/docs/resources/guild#get-guild-integrations). Application integrations are always included. + * The following deprecated routes have been removed for better naming conventions: + + Removed in favor of `/guilds//widget`: + + * `/guilds//embed` + + Removed in favor of `/guilds//widget.json`: + + * `/servers//embed.json` + * `/servers//widget.json` + * `/guilds//embed.json` + + Removed in favor of `/guilds//widget.png`: + + * `/guilds//embed.png` + + Removed in favor of `/channels//messages/bulk-delete`: + + * `/channels//messages/bulk_delete/` + + Removed in favor of `/invites//`: + + * `/invite//` + + + + Documented `permissions_new`, `allow_new`, and `deny_new` as string-serialized permission bitfields. + + + + The legacy mention behavior for bots is now removed, and granular control of mentions should use the [Allowed Mentions](/developers/docs/resources/message#allowed-mentions-object) API moving forwards. + + + + The [Guild Members Chunk](/developers/docs/events/gateway-events#guild-members-chunk) gateway event now contains two properties: `chunk_index` and `chunk_count`. These values can be used to keep track of how many events you have left to receive in response to a [Request Guild Members](/developers/docs/events/gateway-events#request-guild-members) command. + + + + We've added a way to specify mentions in a more granular form. This change also begins the start of a 60 day deprecation cycle on legacy mention behavior. Read more: + + * [Allowed mentions object](/developers/docs/resources/message#allowed-mentions-object) + + + + We've added a new endpoint for deleting all reactions of a specific emoji from a message, as well as some new invite and reaction gateway events. Read more: + + * [Delete All Reactions for Emoji](/developers/docs/resources/message#delete-all-reactions-for-emoji) + * [Invite Create](/developers/docs/events/gateway-events#invite-create) + * [Invite Delete](/developers/docs/events/gateway-events#invite-delete) + * [Message Reaction Remove Emoji](/developers/docs/events/gateway-events#message-reaction-remove-emoji) + + + + The [Spectate](/developers/docs/developer-tools/game-sdk#onactivityspectate) functionality of Rich Presence no longer requires whitelisting or approval. + + + + We've added documentation around a brand new feature: [Gateway Intents!](/developers/docs/events/gateway#gateway-intents) Gateway Intents are a great way to specify which events you want to receive from our gateway. Go on, save yourself some bandwidth and CPU usage. + + Using Intents will change the behavior of some existing events and commands, so please refer to: + + * [Guild Create](/developers/docs/events/gateway-events#guild-create) + * [Request Guild Members](/developers/docs/events/gateway-events#request-guild-members) + * [Guild Member Add](/developers/docs/events/gateway-events#guild-member-add) + * [Guild Member Remove](/developers/docs/events/gateway-events#guild-member-remove) + * [Guild Member Update](/developers/docs/events/gateway-events#guild-member-update) + * [Presence Update](/developers/docs/events/gateway-events#presence-update) + * [List Guild Members](/developers/docs/resources/guild#list-guild-members) + + + + Updated our [IP discovery message](/developers/docs/topics/voice-connections#ip-discovery). The old message is deprecated and will be removed in the future. + + + + Fixed a bug from the 2.5.5 release that caused network handshakes to fail, resulting in no networking data being sent. The networking manager and integrated lobby networking should be full operational again after updating. + + + + We've shipped some updates to the GameSDK, including support for Linux as well as the IL2CPP backend system for Unity. These changes also fixed a bug in the [`SetUserAchievement()`](https://github.com/discord/discord-api-docs/blob/legacy-gamesdk/developers/docs/game_sdk/Achievements.md#setuserachievement) method. + + Get the latest at the top of the [Getting Started](/developers/docs/developer-tools/game-sdk#step-1-get-the-sdk) documentation. If you're looking for help interacting with the GameSDK or want to report a bug, join us on the [official Discord](https://discord.gg/discord-developers). + + + + News Channels are now changed to Announcement Channels. Developer License owners will continue to get access to them (both existing and new). Underlying channel type (GUILD\_NEWS = 5) remains the same. + + + + You can now get more precise rate limit reset times, via a new request header. Check out the [rate limits](/developers/docs/topics/rate-limits) documentation for more information. + + + + You can now use Bot tokens for authorization headers against the HTTP API for [Achievements](https://github.com/discord/discord-api-docs/blob/legacy-gamesdk/developers/docs/game_sdk/Achievements.md#the-api-way). + + + + Additional information around Teams has been added to both the API and the documentation. The [Teams](/developers/docs/topics/teams) page now includes information about the team and team member objects. Additionally, the [Get Current Application Information](/developers/docs/topics/oauth2#get-current-bot-application-information) endpoint now returns a `team` object if that application belongs to a team. That documentation has also been updated to includes fields that were missing for applications that are games sold on Discord. + + + + Additional information has been documented to support [Server Nitro Boosting](https://support.discord.com/hc/en-us/articles/360028038352-Server-Boosting). This includes the addition of a few [message types](/developers/docs/resources/message#message-object-message-types), as well as some [new fields on guilds](/developers/docs/resources/guild#guild-object-premium-tier). Please note that this feature is currently under experimentation, and these fields may be subject to change. + + + + The [Discord-RPC](https://github.com/discord/discord-rpc) implementation of Rich Presence has been deprecated in favor of Discord's new GameSDK. If you're interested in using Rich Presence, please read our [SDK Starter Guide](/developers/docs/developer-tools/game-sdk#getting-started) and check out the relevant functions in the [Activity Manager](/developers/docs/developer-tools/game-sdk#activities). + + + + The [Invite Object](/developers/docs/resources/invite#invite-object) now includes two additional fields, `target_user` and `target_user_type`. + + + + Ask to Join no longer requires approval or whitelisting to use. You are welcome to create in-game UI, but all Ask to Join requests are also now handled by the Discord overlay. + + There have also been some small additions to the Rich Presence SDK. The previously undocumented `UpdateHandlers()` function is now documented. + + + + Dispatch documentation around store listings has been removed. Store pages for the Discord Store are now managed entirely within the [Developer Portal](https://discord.com/developers). + + + + The [User object](/developers/docs/resources/user#user-object) now includes two new additional fields, `premium_type` and `flags`. These can be used to know the Nitro status of a user, or determine which HypeSquad house a user is in. + + + + The documentation has been updated to correctly note that the `private_channels` field in the [Ready](/developers/docs/events/gateway-events#ready) should be an empty array, as well as the response from `/users/@me/channels` for a bot user. This change has been in effect for a long time, but the documentation was not updated. + + + + We released server changes that allow guilds to represent an incomplete state of the member list in our clients, which results in inaccurate member lists and online counts over RPC. These fields are now deprecated and will now return an empty members array and an online count of 0 moving forward. + + + + Additional `activity` and `application` fields—as well as corresponding object documentation—have been added to the [Message](/developers/docs/resources/message#message-object) object in support of our newly-released [Spotify integration](https://support.discord.com/hc/en-us/articles/360000167212-Discord-Spotify-Connection) and previous Rich Presence enhancements. + + + + The [Get Guild Emoji](/developers/docs/resources/emoji#get-guild-emoji) response now also includes a user object if the emoji was added by a user. + + + + The [Accept Invite](/developers/docs/resources/invite) endpoint is deprecated starting today, and will be discontinued on March 23, 2018. The [Add Guild Member](/developers/docs/resources/guild#add-guild-member) endpoint should be used in its place. + + + + Additional sharding requirements and information for bots in over 100,000 guilds has been added. This requires a small change in numbers of shards for affected bots. See the [documentation](/developers/docs/events/gateway#sharding-for-large-bots) for more information. + + + + Rich Presence is now live and available for all developers! Rich Presence allows developers to closely integrate with Discord in a number of new, cool ways like: + + * Showing more information about a user's current game in their profile + * Allowing users to post invitations to join their party or spectate their game in chat + * Displaying "Spectate" and "Ask to Join" buttons on users' profiles + + For more information, check out our [Rich Presence site](https://discord.com/rich-presence). To get started on development, [read the docs](/developers/docs/rich-presence/overview)! + + + + [API](/developers/docs/reference#api-versioning) and Gateway versions below v6 are now discontinued after being previously deprecated. Version 6 is now the default API and Gateway version. Attempting to use a version below 6 will result in an error. + + + + Changes have been made throughout the documentation to reflect the addition of channel categories to Discord. These includes an additional field—`parent_id`—to the base [channel](/developers/docs/resources/channel#channel-object) object and a new [channel category example](/developers/docs/resources/channel#channel-object-example-channel-category). + + + + [Emoji endpoints](/developers/docs/resources/emoji) have been added to the API. Bots can now manage guild emojis to their robo-hearts' content! + + + + The `type` field in the [activity object](/developers/docs/events/gateway-events#activity-object) for [Gateway Status Update](/developers/docs/events/gateway-events#update-presence) and [Presence Update](/developers/docs/events/gateway-events#presence-update) payloads is no longer optional when the activity object is not null. + + + + After today, we are changing how default channels function. The "default" channel for a given user is now the channel with the highest position that their permissions allow them to see. New guilds will no longer have a default channel with the same id as the guild. Existing guilds will not have their #general channel id changed. It is possible, if permissions are set in such a way, that a user will not have a default channel in a guild. + + We saw a use case in many servers where the previously-default #general channel was being repurposed as an announcement-only, non-writable channel for new members by using bots to clear the entire message history. Now, that channel can simply be deleted and re-created with the desired permissions. This change also allows dynamic default channels for users based on permissions. + + We are also rolling out a change in conjunction that will allow Discord to remember your last-visited channel in a guild across sessions. Newly-joined users will be directed to the guild's default channel on first join; existing members will return to whichever channel they last visited. + + + + Audit logs are here! Well, they've been here all along, but now we've got [documentation](/developers/docs/resources/audit-log) about them. Check it out, but remember: with great power comes great responsibility. + + + + * [Channel](/developers/docs/resources/channel#channel-object) Object + * `is_private` removed + * [`type`](/developers/docs/resources/channel#channel-object-channel-types) is now an integer + * `recipient` is now `recipients`, an array of [user](/developers/docs/resources/user#user-object) objects + * [Message](/developers/docs/resources/message#message-object) Object + * [`type`](/developers/docs/resources/message#message-object-message-types) added to support system messages + * [Status Update](/developers/docs/events/gateway-events#update-presence-gateway-presence-update-structure) Object + * `idle_since` renamed to `since` + + +{/* Autogenerated Reference Links */} +[`Activity::AddButton`]: https://discord.com/developers/docs/social-sdk/classdiscordpp_1_1Activity.html#aab07650fcff18565eb78a1e2df46627e +[`ActivityInvite`]: https://discord.com/developers/docs/social-sdk/classdiscordpp_1_1ActivityInvite.html#af980f140c1459e1cd8f6ef3f3c07547c +[`Call::GetPTTReleaseDelay`]: https://discord.com/developers/docs/social-sdk/classdiscordpp_1_1Call.html#ab8dc6b1527728fecb17f266d5b3e9e6e +[`Call::SetPTTActive`]: https://discord.com/developers/docs/social-sdk/classdiscordpp_1_1Call.html#ac442b1d69b9256abbb188583c0c81c41 +[`Client::AddLogCallback`]: https://discord.com/developers/docs/social-sdk/classdiscordpp_1_1Client.html#af78996cff24a40f5dc7066beed16692c +[`Client::CreateOrJoinLobbyWithMetadata`]: https://discord.com/developers/docs/social-sdk/classdiscordpp_1_1Client.html#a5c84fa76c73cf3c0bfd68794ca5595c1 +[`Client::ExchangeChildToken`]: https://discord.com/developers/docs/social-sdk/classdiscordpp_1_1Client.html#a59f5d9d14f79eb318bf4d57f4e87a5c1 +[`Client::GetCurrentUser`]: https://discord.com/developers/docs/social-sdk/classdiscordpp_1_1Client.html#a7edea2a3dfe9ae560d5fa5ba8663b5cc +[`Client::GetCurrentUserV2`]: https://discord.com/developers/docs/social-sdk/classdiscordpp_1_1Client.html#ae52259570ba657252d91f5580636fe5d +[`Client::GetGuildChannels`]: https://discord.com/developers/docs/social-sdk/classdiscordpp_1_1Client.html#adba1e5a83c219a9c4f6dab1657778017 +[`Client::GetLobbyMessagesWithLimit`]: https://discord.com/developers/docs/social-sdk/classdiscordpp_1_1Client.html#a0586192e85caf548b8b321f1cb21301f +[`Client::GetRelationships`]: https://discord.com/developers/docs/social-sdk/classdiscordpp_1_1Client.html#ad481849835cd570f0e03adafcf90125d +[`Client::GetRelationshipsByGroup`]: https://discord.com/developers/docs/social-sdk/classdiscordpp_1_1Client.html#a9f7898d3f3d1ec92b06c662df70746d5 +[`Client::GetUserGuilds`]: https://discord.com/developers/docs/social-sdk/classdiscordpp_1_1Client.html#aac1ec02df6074ed9213ce230e6a42fe1 +[`Client::GetUserMessageSummaries`]: https://discord.com/developers/docs/social-sdk/classdiscordpp_1_1Client.html#a32dafc20ff1f99b019e40bdc81f46dde +[`Client::GetUserMessagesWithLimit`]: https://discord.com/developers/docs/social-sdk/classdiscordpp_1_1Client.html#a054a758a76c5873b38a4d79651a5f26c +[`Client::JoinLinkedLobbyGuild`]: https://discord.com/developers/docs/social-sdk/classdiscordpp_1_1Client.html#a54ec764e72e168de419ac14e24e8fc60 +[`Client::OpenConnectedGamesSettingsInDiscord`]: https://discord.com/developers/docs/social-sdk/classdiscordpp_1_1Client.html#a24f268f5eebe9919a3f774354eb577e0 +[`Client::RegisterAuthorizeRequestCallback`]: https://discord.com/developers/docs/social-sdk/classdiscordpp_1_1Client.html#a5f34b873e127a446c9ab549e4588ccd7 +[`Client::RegisterLaunchCommand`]: https://discord.com/developers/docs/social-sdk/classdiscordpp_1_1Client.html#a024d7222931fdcb7d09c2b107642ecab +[`Client::RegisterLaunchSteamApplication`]: https://discord.com/developers/docs/social-sdk/classdiscordpp_1_1Client.html#a45b2c791c5b06f77d457dacb53dfba40 +[`Client::RemoveAuthorizeRequestCallback`]: https://discord.com/developers/docs/social-sdk/classdiscordpp_1_1Client.html#ab7e48864b0cedf3e8572a228ca401f2a +[`Client::RemoveDiscordAndGameFriend`]: https://discord.com/developers/docs/social-sdk/classdiscordpp_1_1Client.html#aa6d393a3d98ec5d06faef49a57d1a89b +[`Client::RevokeToken`]: https://discord.com/developers/docs/social-sdk/classdiscordpp_1_1Client.html#a30ccea6366efaf0b884efcdcc28a6f2d +[`Client::SetActivityInviteCreatedCallback`]: https://discord.com/developers/docs/social-sdk/classdiscordpp_1_1Client.html#a3b4e37a222a8662506d763514774bedc +[`Client::SetAecDump`]: https://discord.com/developers/docs/social-sdk/classdiscordpp_1_1Client.html#a3a05b2cafaa546d915a5249c63f4059f +[`Client::SetEngineManagedAudioSession`]: https://discord.com/developers/docs/social-sdk/classdiscordpp_1_1Client.html#ade08897214152b9acfa79c263e77e366 +[`Client::SetHttpRequestTimeout`]: https://discord.com/developers/docs/social-sdk/classdiscordpp_1_1Client.html#ae5fe2518b0b1b05ee1745ab0a79096b9 +[`Client::SetRelationshipGroupsUpdatedCallback`]: https://discord.com/developers/docs/social-sdk/classdiscordpp_1_1Client.html#af12441ef091298f968075b7190851098 +[`Client::SetSpeakerMode`]: https://discord.com/developers/docs/social-sdk/classdiscordpp_1_1Client.html#ac269ab57407e3b83e2bb2d30895e666d +[`Client::SetVoiceLogDir`]: https://discord.com/developers/docs/social-sdk/classdiscordpp_1_1Client.html#a48c6b7e8bbc2b632a935acafc6a5f7a7 +[`Client::StartCallWithAudioCallbacks`]: https://discord.com/developers/docs/social-sdk/classdiscordpp_1_1Client.html#abcaa891769f9e912bfa0e06ff7221b05 +[`Client::UnmergeIntoProvisionalAccount`]: https://discord.com/developers/docs/social-sdk/classdiscordpp_1_1Client.html#a2da21ae8a3015e0e5e42c1a7226b256f +[`Client::UpdateRichPresence`]: https://discord.com/developers/docs/social-sdk/classdiscordpp_1_1Client.html#af0a85e30f2b3d8a0b502fd23744ee58e +[`ClientCreateOptions`]: https://discord.com/developers/docs/social-sdk/classdiscordpp_1_1ClientCreateOptions.html#ae655ad66ba64f443496c158307cc77b4 +[`MessageHandle`]: https://discord.com/developers/docs/social-sdk/classdiscordpp_1_1MessageHandle.html#ae25595b43bc74b0c4c92c5165d16382f +[`RelationshipHandle`]: https://discord.com/developers/docs/social-sdk/classdiscordpp_1_1RelationshipHandle.html#a7da36b15ad0b7d38ba658a622e9ded77 \ No newline at end of file diff --git a/docs/components/overview.mdx b/discord/developers/docs/components/overview.mdx similarity index 60% rename from docs/components/overview.mdx rename to discord/developers/docs/components/overview.mdx index 387015f945..b84391d11a 100644 --- a/docs/components/overview.mdx +++ b/discord/developers/docs/components/overview.mdx @@ -1,13 +1,13 @@ --- -sidebar_label: Overview -showTOC: false +title: Components Overview +sidebarTitle: Overview +mode: wide +description: Learn about Discord's interactive message components. --- -# Components Overview - Components allow you to add interactive elements to modals and the messages your app sends. They're accessible, customizable, and easy to use. -![](images/components/hero.webp) +![Image showing examples of components UI](/images/components/hero.png) Discord apps support three types of message components: layout components, content components, and interactive components. Each type of component has its own purpose and use cases. @@ -19,21 +19,25 @@ All components are customizable and can be organized using layout components to To use components, messages must be sent with the `IS_COMPONENTS_V2` flag (`1<<15`). Note that using this flag disables traditional content and embeds - all content must be sent as components instead. -:::info -[Legacy message component behavior](/docs/components/reference#legacy-message-component-behavior) will **not** be deprecated and will continue to be available to your apps on a message-by-message basis. However, we recommend using the new components for new projects and features. -::: + +[Legacy message component behavior](/developers/docs/components/reference#legacy-message-component-behavior) will **not** be deprecated and will continue to be available to your apps on a message-by-message basis. However, we recommend using the new components for new projects and features. + + +import {ChatDotsIcon} from '/snippets/icons/ChatDotsIcon.jsx' +import {CompassIcon} from '/snippets/icons/CompassIcon.jsx' +import {BrowserIcon} from '/snippets/icons/BrowserIcon.jsx' - - + + }> A guide on sending Message Components with examples. - + }> A guide on sending Modal Components with examples. - + }> Explore the Components reference documentation. - + --- diff --git a/docs/components/reference.mdx b/discord/developers/docs/components/reference.mdx similarity index 58% rename from docs/components/reference.mdx rename to discord/developers/docs/components/reference.mdx index 90af6e41cf..e5535646d9 100644 --- a/docs/components/reference.mdx +++ b/discord/developers/docs/components/reference.mdx @@ -1,8 +1,10 @@ --- +title: Component Reference sidebar_label: Component Reference +description: Complete reference for all Discord message components. --- -# Component Reference +import {ManualAnchor} from '/snippets/manualanchor.jsx' This document serves as a comprehensive reference for all available components. It covers three main categories: @@ -10,18 +12,18 @@ This document serves as a comprehensive reference for all available components. - **Content Components** - For displaying static text, images, and files (Text Display, Media Gallery, Thumbnails) - **Interactive Components** - For user interactions (Buttons, Select Menus, Text Input) -To use these components, you need to send the [message flag](/docs/resources/message#message-object-message-flags) `1 << 15` (IS_COMPONENTS_V2) which can be sent on a per-message basis. Once a message has been sent with this flag, it can't be removed from that message. This enables the new components system with the following changes: +To use these components, you need to send the [message flag](/developers/docs/resources/message#message-object-message-flags) `1 << 15` (IS_COMPONENTS_V2) which can be sent on a per-message basis. Once a message has been sent with this flag, it can't be removed from that message. This enables the new components system with the following changes: -- The `content` and `embeds` fields will no longer work but you'll be able to use [Text Display](/docs/components/reference#text-display) and [Container](/docs/components/reference#container) as replacements +- The `content` and `embeds` fields will no longer work but you'll be able to use [Text Display](/developers/docs/components/reference#text-display) and [Container](/developers/docs/components/reference#container) as replacements - Attachments won't show by default - they must be exposed through components - The `poll` and `stickers` fields are disabled - Messages allow up to 40 total components -:::info -[Legacy component behavior](/docs/components/reference#legacy-message-component-behavior) will continue to work but provide less flexibility and control over the message layout. -::: + +[Legacy component behavior](/developers/docs/components/reference#legacy-message-component-behavior) will continue to work but provide less flexibility and control over the message layout. + -For a practical guide on implementing these components, see our [Using Message Components](/docs/components/using-message-components) and [Using Modal Components](/docs/components/using-modal-components) documentation. +For a practical guide on implementing these components, see our [Using Message Components](/developers/docs/components/using-message-components) and [Using Modal Components](/developers/docs/components/using-modal-components) documentation. --- @@ -29,7 +31,7 @@ For a practical guide on implementing these components, see our [Using Message C Components allow you to style and structure your messages, modals, and interactions. They are interactive elements that can create rich user experiences in your Discord applications. -Components are a field on the [message object](/docs/resources/message#message-object) and [modal](/docs/interactions/receiving-and-responding#interaction-response-object-modal). You can use them when creating messages or responding to an interaction, like an [application command](/docs/interactions/application-commands). +Components are a field on the [message object](/developers/docs/resources/message#message-object) and [modal](/developers/docs/interactions/receiving-and-responding#interaction-response-object-modal). You can use them when creating messages or responding to an interaction, like an [application command](/developers/docs/interactions/application-commands). ### Component Object @@ -37,35 +39,35 @@ Components are a field on the [message object](/docs/resources/message#message-o The following is a complete table of available components. Details about each component are in the sections below. -| Type | Name | Description | Style | Usage | -|------|---------------------------------------------------------------------|----------------------------------------------------------------|-------------|----------------| -| 1 | [Action Row](/docs/components/reference#action-row) | Container to display a row of interactive components | Layout | Message | -| 2 | [Button](/docs/components/reference#button) | Button object | Interactive | Message | -| 3 | [String Select](/docs/components/reference#string-select) | Select menu for picking from defined text options | Interactive | Message, Modal | -| 4 | [Text Input](/docs/components/reference#text-input) | Text input object | Interactive | Modal | -| 5 | [User Select](/docs/components/reference#user-select) | Select menu for users | Interactive | Message, Modal | -| 6 | [Role Select](/docs/components/reference#role-select) | Select menu for roles | Interactive | Message, Modal | -| 7 | [Mentionable Select](/docs/components/reference#mentionable-select) | Select menu for mentionables (users *and* roles) | Interactive | Message, Modal | -| 8 | [Channel Select](/docs/components/reference#channel-select) | Select menu for channels | Interactive | Message, Modal | -| 9 | [Section](/docs/components/reference#section) | Container to display text alongside an accessory component | Layout | Message | -| 10 | [Text Display](/docs/components/reference#text-display) | Markdown text | Content | Message, Modal | -| 11 | [Thumbnail](/docs/components/reference#thumbnail) | Small image that can be used as an accessory | Content | Message | -| 12 | [Media Gallery](/docs/components/reference#media-gallery) | Display images and other media | Content | Message | -| 13 | [File](/docs/components/reference#file) | Displays an attached file | Content | Message | -| 14 | [Separator](/docs/components/reference#separator) | Component to add vertical padding between other components | Layout | Message | -| 17 | [Container](/docs/components/reference#container) | Container that visually groups a set of components | Layout | Message | -| 18 | [Label](/docs/components/reference#label) | Container associating a label and description with a component | Layout | Modal | -| 19 | [File Upload](/docs/components/reference#file-upload) | Component for uploading files | Interactive | Modal | +| Type | Name | Description | Style | Usage | +|------|--------------------------------------------------------------------------------|----------------------------------------------------------------|-------------|----------------| +| 1 | [Action Row](/developers/docs/components/reference#action-row) | Container to display a row of interactive components | Layout | Message | +| 2 | [Button](/developers/docs/components/reference#button) | Button object | Interactive | Message | +| 3 | [String Select](/developers/docs/components/reference#string-select) | Select menu for picking from defined text options | Interactive | Message, Modal | +| 4 | [Text Input](/developers/docs/components/reference#text-input) | Text input object | Interactive | Modal | +| 5 | [User Select](/developers/docs/components/reference#user-select) | Select menu for users | Interactive | Message, Modal | +| 6 | [Role Select](/developers/docs/components/reference#role-select) | Select menu for roles | Interactive | Message, Modal | +| 7 | [Mentionable Select](/developers/docs/components/reference#mentionable-select) | Select menu for mentionables (users *and* roles) | Interactive | Message, Modal | +| 8 | [Channel Select](/developers/docs/components/reference#channel-select) | Select menu for channels | Interactive | Message, Modal | +| 9 | [Section](/developers/docs/components/reference#section) | Container to display text alongside an accessory component | Layout | Message | +| 10 | [Text Display](/developers/docs/components/reference#text-display) | Markdown text | Content | Message, Modal | +| 11 | [Thumbnail](/developers/docs/components/reference#thumbnail) | Small image that can be used as an accessory | Content | Message | +| 12 | [Media Gallery](/developers/docs/components/reference#media-gallery) | Display images and other media | Content | Message | +| 13 | [File](/developers/docs/components/reference#file) | Displays an attached file | Content | Message | +| 14 | [Separator](/developers/docs/components/reference#separator) | Component to add vertical padding between other components | Layout | Message | +| 17 | [Container](/developers/docs/components/reference#container) | Container that visually groups a set of components | Layout | Message | +| 18 | [Label](/developers/docs/components/reference#label) | Container associating a label and description with a component | Layout | Modal | +| 19 | [File Upload](/developers/docs/components/reference#file-upload) | Component for uploading files | Interactive | Modal | -------------- ## Anatomy of a Component All components have the following fields: -| Field | Type | Description | -|-------|---------|------------------------------------------------------------------------------------------| -| type | integer | The [type](/docs/components/reference#component-object-component-types) of the component | -| id? | integer | 32 bit integer used as an optional identifier for component | +| Field | Type | Description | +|-------|---------|-----------------------------------------------------------------------------------------------------| +| type | integer | The [type](/developers/docs/components/reference#component-object-component-types) of the component | +| id? | integer | 32 bit integer used as an optional identifier for component | The `id` field is optional and is used to identify components in the response from an interaction. The `id` must be unique within the message and is generated sequentially if left empty. Generation of `id`s won't use another `id` that exists in the message if you have one defined for another component. Sending components with an `id` of `0` is allowed but will be treated as empty and replaced by the API. @@ -86,39 +88,39 @@ An Action Row is a top-level layout component. Action Rows can contain one of the following: -- Up to 5 contextually grouped [buttons](/docs/components/reference#button) -- A single select component ([string select](/docs/components/reference#string-select), [user select](/docs/components/reference#user-select), [role select](/docs/components/reference#role-select), [mentionable select](/docs/components/reference#mentionable-select), or [channel select](/docs/components/reference#channel-select)) +- Up to 5 contextually grouped [buttons](/developers/docs/components/reference#button) +- A single select component ([string select](/developers/docs/components/reference#string-select), [user select](/developers/docs/components/reference#user-select), [role select](/developers/docs/components/reference#role-select), [mentionable select](/developers/docs/components/reference#mentionable-select), or [channel select](/developers/docs/components/reference#channel-select)) -:::info -[Label](/docs/components/reference#label) is recommended for use over an Action Row in modals. Action Row with Text Inputs in modals are now deprecated. -::: + +[Label](/developers/docs/components/reference#label) is recommended for use over an Action Row in modals. Action Row with Text Inputs in modals are now deprecated. + ###### Action Row Structure -| Field | Type | Description | -|------------|-----------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------| -| type | integer | `1` for action row component | -| id? | integer | Optional identifier for component | -| components | array of [action row child components](/docs/components/reference#component-object-component-types) | Up to 5 interactive [button](/docs/components/reference#button) components or a single [select](/docs/components/reference#user-select) component | +| Field | Type | Description | +|------------|----------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| type | integer | `1` for action row component | +| id? | integer | Optional identifier for component | +| components | array of [action row child components](/developers/docs/components/reference#component-object-component-types) | Up to 5 interactive [button](/developers/docs/components/reference#button) components or a single [select](/developers/docs/components/reference#user-select) component | ###### Action Row Child Components -| Available Components | Description | -|---------------------------------------------------------------------|-------------------------------------------| -| [Button](/docs/components/reference#button) | An Action Row can contain up to 5 Buttons | -| [String Select](/docs/components/reference#string-select) | A single String Select | -| [User Select](/docs/components/reference#user-select) | A single User Select | -| [Role Select](/docs/components/reference#role-select) | A single Role Select | -| [Mentionable Select](/docs/components/reference#mentionable-select) | A single Mentionable Select | -| [Channel Select](/docs/components/reference#channel-select) | A single Channel Select | +| Available Components | Description | +|--------------------------------------------------------------------------------|-------------------------------------------| +| [Button](/developers/docs/components/reference#button) | An Action Row can contain up to 5 Buttons | +| [String Select](/developers/docs/components/reference#string-select) | A single String Select | +| [User Select](/developers/docs/components/reference#user-select) | A single User Select | +| [Role Select](/developers/docs/components/reference#role-select) | A single Role Select | +| [Mentionable Select](/developers/docs/components/reference#mentionable-select) | A single Mentionable Select | +| [Channel Select](/developers/docs/components/reference#channel-select) | A single Channel Select | ###### Examples - + - - ![Example of an Action Row with three buttons](images/components/action-row.webp) - + + ![Example of an Action Row with three buttons](/images/components/action-row.webp) + ```json { @@ -150,36 +152,36 @@ Action Rows can contain one of the following: ] } ``` - + -------------- ## Button -A Button is an interactive component that can only be used in messages. It creates clickable elements that users can interact with, sending an [interaction](/docs/interactions/receiving-and-responding#interaction-object) to your app when clicked. +A Button is an interactive component that can only be used in messages. It creates clickable elements that users can interact with, sending an [interaction](/developers/docs/interactions/receiving-and-responding#interaction-object) to your app when clicked. -Buttons must be placed inside an [Action Row](/docs/components/reference#action-row) or a [Section](/docs/components/reference#section)'s `accessory` field. +Buttons must be placed inside an [Action Row](/developers/docs/components/reference#action-row) or a [Section](/developers/docs/components/reference#section)'s `accessory` field. ###### Button Structure -| Field | Type | Description | -|-----------|-----------------------------------------------------|---------------------------------------------------------------------------------------------------------------------| -| type | integer | `2` for a button | -| id? | integer | Optional identifier for component | -| style | integer | A [button style](/docs/components/reference#button-button-styles) | -| label? | string | Text that appears on the button; max 80 characters | -| emoji? | partial [emoji](/docs/resources/emoji#emoji-object) | `name`, `id`, and `animated` | -| custom_id | string | Developer-defined identifier for the button; max 100 characters | -| sku_id? | snowflake | Identifier for a purchasable [SKU](/docs/resources/sku#sku-object), only available when using premium-style buttons | -| url? | string | URL for link-style buttons; max 512 characters | -| disabled? | boolean | Whether the button is disabled (defaults to `false`) | +| Field | Type | Description | +|-----------|----------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------| +| type | integer | `2` for a button | +| id? | integer | Optional identifier for component | +| style | integer | A [button style](/developers/docs/components/reference#button-button-styles) | +| label? | string | Text that appears on the button; max 80 characters | +| emoji? | partial [emoji](/developers/docs/resources/emoji#emoji-object) | `name`, `id`, and `animated` | +| custom_id | string | Developer-defined identifier for the button; max 100 characters | +| sku_id? | snowflake | Identifier for a purchasable [SKU](/developers/docs/resources/sku#sku-object), only available when using premium-style buttons | +| url? | string | URL for link-style buttons; max 512 characters | +| disabled? | boolean | Whether the button is disabled (defaults to `false`) | Buttons come in various styles to convey different types of actions. These styles also define what fields are valid for a button. - Non-link and non-premium buttons **must** have a `custom_id`, and cannot have a `url` or a `sku_id`. - Link buttons **must** have a `url`, and cannot have a `custom_id` -- Link buttons do not send an [interaction](/docs/interactions/receiving-and-responding#interaction-object) to your app when clicked +- Link buttons do not send an [interaction](/developers/docs/interactions/receiving-and-responding#interaction-object) to your app when clicked - Premium buttons **must** contain a `sku_id`, and cannot have a `custom_id`, `label`, `url`, or `emoji`. -- Premium buttons do not send an [interaction](/docs/interactions/receiving-and-responding#interaction-object) to your app when clicked +- Premium buttons do not send an [interaction](/developers/docs/interactions/receiving-and-responding#interaction-object) to your app when clicked ###### Button Styles @@ -195,7 +197,7 @@ Buttons come in various styles to convey different types of actions. These style ###### Examples - + ```json { @@ -215,12 +217,12 @@ Buttons come in various styles to convey different types of actions. These style ] } ``` - + - + When a user interacts with a Button in a message, this is the basic form of the interaction data payload you will receive. The full payload - is available in the [interaction](/docs/interactions/receiving-and-responding#interaction-object-interaction-structure) reference. + is available in the [interaction](/developers/docs/interactions/receiving-and-responding#interaction-object-interaction-structure) reference. ```json { @@ -234,7 +236,7 @@ Buttons come in various styles to convey different types of actions. These style }, } ``` - + ### Button Design Guidelines @@ -252,11 +254,11 @@ Buttons come in various styles to convey different types of actions. These style Use different button styles to create a hierarchy. Use only one `Primary` button per group. -![Example showing one primary button per button group](images/components/multiple-buttons-example-1.webp) +![Example showing one primary button per button group](/images/components/multiple-buttons-example-1.webp) If there are multiple buttons of equal significance, use the `Secondary` button style for all buttons. -![Example showing multiple buttons in a group with equal significance](images/components/multiple-buttons-example-2.webp) +![Example showing multiple buttons in a group with equal significance](/images/components/multiple-buttons-example-2.webp) ###### Premium Buttons @@ -266,30 +268,30 @@ Premium buttons will automatically have the following: - SKU name - SKU price -![A premium button](images/components/premium-button.webp) +![A premium button](/images/components/premium-button.webp) -------------- ## String Select A String Select is an interactive component that allows users to select one or more provided `options`. -String Selects can be configured for both single-select and multi-select behavior. When a user finishes making their choice(s) your app receives an [interaction](/docs/interactions/receiving-and-responding#interaction-object-interaction-structure). +String Selects can be configured for both single-select and multi-select behavior. When a user finishes making their choice(s) your app receives an [interaction](/developers/docs/interactions/receiving-and-responding#interaction-object-interaction-structure). -String Selects are available in messages and modals. They must be placed inside an [Action Row](/docs/components/reference#action-row) in messages and a [Label](/docs/components/reference#label) in modals. +String Selects are available in messages and modals. They must be placed inside an [Action Row](/developers/docs/components/reference#action-row) in messages and a [Label](/developers/docs/components/reference#label) in modals. ###### String Select Structure -| Field | Type | Description | -|---------------|---------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------| -| type | integer | `3` for string select | -| id? | integer | Optional identifier for component | -| custom_id | string | ID for the select menu; max 100 characters | -| options | array of [select options](/docs/components/reference#string-select-select-option-structure) | Specified choices in a select menu; max 25 | -| placeholder? | string | Placeholder text if nothing is selected or default; max 150 characters | -| min_values? | integer | Minimum number of items that must be chosen (defaults to 1); min 0, max 25 | -| max_values? | integer | Maximum number of items that can be chosen (defaults to 1); max 25 | -| required?\* | boolean | Whether the string select is required to answer in a modal (defaults to `true`) | -| disabled?\*\* | boolean | Whether select menu is disabled in a message (defaults to `false`) | +| Field | Type | Description | +|---------------|--------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------| +| type | integer | `3` for string select | +| id? | integer | Optional identifier for component | +| custom_id | string | ID for the select menu; max 100 characters | +| options | array of [select options](/developers/docs/components/reference#string-select-select-option-structure) | Specified choices in a select menu; max 25 | +| placeholder? | string | Placeholder text if nothing is selected or default; max 150 characters | +| min_values? | integer | Minimum number of items that must be chosen (defaults to 1); min 0, max 25 | +| max_values? | integer | Maximum number of items that can be chosen (defaults to 1); max 25 | +| required?\* | boolean | Whether the string select is required to answer in a modal (defaults to `true`) | +| disabled?\*\* | boolean | Whether select menu is disabled in a message (defaults to `false`) | \* The `required` field is only available for String Selects in modals. It is ignored in messages. @@ -297,13 +299,13 @@ String Selects are available in messages and modals. They must be placed inside ###### Select Option Structure -| Field | Type | Description | -|--------------|------------------------------------------------------------|----------------------------------------------------------| -| label | string | User-facing name of the option; max 100 characters | -| value | string | Dev-defined value of the option; max 100 characters | -| description? | string | Additional description of the option; max 100 characters | -| emoji? | partial [emoji](/docs/resources/emoji#emoji-object) object | `id`, `name`, and `animated` | -| default? | boolean | Will show this option as selected by default | +| Field | Type | Description | +|--------------|-----------------------------------------------------------------------|----------------------------------------------------------| +| label | string | User-facing name of the option; max 100 characters | +| value | string | Dev-defined value of the option; max 100 characters | +| description? | string | Additional description of the option; max 100 characters | +| emoji? | partial [emoji](/developers/docs/resources/emoji#emoji-object) object | `id`, `name`, and `animated` | +| default? | boolean | Will show this option as selected by default | ###### String Select Interaction Response Structure @@ -319,11 +321,11 @@ String Selects are available in messages and modals. They must be placed inside ###### Examples - + - - ![Example of a String Select with three options](images/components/string-select.webp) - + + ![Example of a String Select with three options](/images/components/string-select.webp) + ```json { @@ -362,12 +364,13 @@ String Selects are available in messages and modals. They must be placed inside ] } ``` - + - + + When a user interacts with a StringSelect in a message, this is the basic form of the interaction data payload you will receive. The full payload - is available in the [interaction](/docs/interactions/receiving-and-responding#interaction-object-interaction-structure) reference. + is available in the [interaction](/developers/docs/interactions/receiving-and-responding#interaction-object-interaction-structure) reference. ```json { @@ -383,13 +386,14 @@ String Selects are available in messages and modals. They must be placed inside }, } ``` - + - + + - - ![Example of a modal with a String Select](images/components/modal-string-select.webp) - + + ![Example of a modal with a String Select](/images/components/modal-string-select.webp) + ```json { @@ -431,12 +435,12 @@ String Selects are available in messages and modals. They must be placed inside } } ``` - + - + When a user submits a modal that contains a String Select, this is the basic form of the interaction data payload you will receive. The full payload - is available in the [interaction](/docs/interactions/receiving-and-responding#interaction-object-interaction-structure) reference. + is available in the [interaction](/developers/docs/interactions/receiving-and-responding#interaction-object-interaction-structure) reference. ```json { @@ -462,36 +466,36 @@ String Selects are available in messages and modals. They must be placed inside }, } ``` - + ------------ ## Text Input Text Input is an interactive component that allows users to enter free-form text responses in modals. It supports both short, single-line inputs and longer, multi-line paragraph inputs. -Text Inputs can only be used within modals and must be placed inside a [Label](/docs/components/reference#label). +Text Inputs can only be used within modals and must be placed inside a [Label](/developers/docs/components/reference#label). -:::info -We no longer recommend using Text Input within an [Action Row](/docs/components/reference#action-row) in modals. Going forward all Text Inputs should be placed inside a [Label](/docs/components/reference#label) component. -::: + +We no longer recommend using Text Input within an [Action Row](/developers/docs/components/reference#action-row) in modals. Going forward all Text Inputs should be placed inside a [Label](/developers/docs/components/reference#label) component. + ###### Text Input Structure -| Field | Type | Description | -|--------------|---------|---------------------------------------------------------------------------------| -| type | integer | `4` for a text input | -| id? | integer | Optional identifier for component | -| custom_id | string | Developer-defined identifier for the input; max 100 characters | -| style | integer | The [Text Input Style](/docs/components/reference#text-input-text-input-styles) | -| min_length? | integer | Minimum input length for a text input; min 0, max 4000 | -| max_length? | integer | Maximum input length for a text input; min 1, max 4000 | -| required? | boolean | Whether this component is required to be filled (defaults to `true`) | -| value? | string | Pre-filled value for this component; max 4000 characters | -| placeholder? | string | Custom placeholder text if the input is empty; max 100 characters | - -:::info -The `label` field on a Text Input is deprecated in favor of `label` and `description` on the [Label](/docs/components/reference#label) component. -::: +| Field | Type | Description | +|--------------|---------|--------------------------------------------------------------------------------------------| +| type | integer | `4` for a text input | +| id? | integer | Optional identifier for component | +| custom_id | string | Developer-defined identifier for the input; max 100 characters | +| style | integer | The [Text Input Style](/developers/docs/components/reference#text-input-text-input-styles) | +| min_length? | integer | Minimum input length for a text input; min 0, max 4000 | +| max_length? | integer | Maximum input length for a text input; min 1, max 4000 | +| required? | boolean | Whether this component is required to be filled (defaults to `true`) | +| value? | string | Pre-filled value for this component; max 4000 characters | +| placeholder? | string | Custom placeholder text if the input is empty; max 100 characters | + + +The `label` field on a Text Input is deprecated in favor of `label` and `description` on the [Label](/developers/docs/components/reference#label) component. + ###### Text Input Styles @@ -511,11 +515,11 @@ The `label` field on a Text Input is deprecated in favor of `label` and `descrip ###### Examples - + - - ![A modal with Text Input in a Label](images/components/modal-label.webp) - + + ![A modal with Text Input in a Label](/images/components/modal-label.webp) + ```json { @@ -542,12 +546,12 @@ The `label` field on a Text Input is deprecated in favor of `label` and `descrip } } ``` - + - + When a user submits a modal that contains a TextInput, this is the basic form of the interaction data payload you will receive. The full payload - is available in the [interaction](/docs/interactions/receiving-and-responding#interaction-object-interaction-structure) reference. + is available in the [interaction](/developers/docs/interactions/receiving-and-responding#interaction-object-interaction-structure) reference. ```json { @@ -571,30 +575,30 @@ The `label` field on a Text Input is deprecated in favor of `label` and `descrip }, } ``` - + -------------- ## User Select A User Select is an interactive component that allows users to select one or more users in a message or modal. Options are automatically populated based on the server's available users. -User Selects can be configured for both single-select and multi-select behavior. When a user finishes making their choice(s) your app receives an [interaction](/docs/interactions/receiving-and-responding#interaction-object-interaction-structure). +User Selects can be configured for both single-select and multi-select behavior. When a user finishes making their choice(s) your app receives an [interaction](/developers/docs/interactions/receiving-and-responding#interaction-object-interaction-structure). -User Selects are available in messages and modals. They must be placed inside an [Action Row](/docs/components/reference#action-row) in messages and a [Label](/docs/components/reference#label) in modals. +User Selects are available in messages and modals. They must be placed inside an [Action Row](/developers/docs/components/reference#action-row) in messages and a [Label](/developers/docs/components/reference#label) in modals. ###### User Select Structure -| Field | Type | Description | -|-----------------|---------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------| -| type | integer | `5` for user select | -| id? | integer | Optional identifier for component | -| custom_id | string | ID for the select menu; max 100 characters | -| placeholder? | string | Placeholder text if nothing is selected; max 150 characters | -| default_values? | array of [default value objects](/docs/components/reference#user-select-select-default-value-structure) | List of default values for auto-populated select menu components; number of default values must be in the range defined by `min_values` and `max_values` | -| min_values? | integer | Minimum number of items that must be chosen (defaults to 1); min 0, max 25 | -| max_values? | integer | Maximum number of items that can be chosen (defaults to 1); max 25 | -| required?\* | boolean | Whether the user select is required to answer in a modal (defaults to `true`) | -| disabled?\*\* | boolean | Whether select menu is disabled in a message (defaults to `false`) | +| Field | Type | Description | +|-----------------|--------------------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------| +| type | integer | `5` for user select | +| id? | integer | Optional identifier for component | +| custom_id | string | ID for the select menu; max 100 characters | +| placeholder? | string | Placeholder text if nothing is selected; max 150 characters | +| default_values? | array of [default value objects](/developers/docs/components/reference#user-select-select-default-value-structure) | List of default values for auto-populated select menu components; number of default values must be in the range defined by `min_values` and `max_values` | +| min_values? | integer | Minimum number of items that must be chosen (defaults to 1); min 0, max 25 | +| max_values? | integer | Maximum number of items that can be chosen (defaults to 1); max 25 | +| required?\* | boolean | Whether the user select is required to answer in a modal (defaults to `true`) | +| disabled?\*\* | boolean | Whether select menu is disabled in a message (defaults to `false`) | \* The `required` field is only available for User Selects in modals. It is ignored in messages. @@ -609,24 +613,24 @@ User Selects are available in messages and modals. They must be placed inside an ###### User Select Interaction Response Structure -| Field | Type | Description | -|------------------|---------------------------------------------------------------------------------------------------------|----------------------------------------------------------------| -| type\* | integer | `5` for a User Select | -| component_type\* | integer | `5` for a User Select | -| id | integer | Unique identifier for the component | -| custom_id | string | Developer-defined identifier for the input; max 100 characters | -| resolved | [resolved data](/docs/interactions/receiving-and-responding#interaction-object-resolved-data-structure) | Resolved entities from selected options | -| values | array of snowflakes | IDs of the selected users | +| Field | Type | Description | +|------------------|--------------------------------------------------------------------------------------------------------------------|----------------------------------------------------------------| +| type\* | integer | `5` for a User Select | +| component_type\* | integer | `5` for a User Select | +| id | integer | Unique identifier for the component | +| custom_id | string | Developer-defined identifier for the input; max 100 characters | +| resolved | [resolved data](/developers/docs/interactions/receiving-and-responding#interaction-object-resolved-data-structure) | Resolved entities from selected options | +| values | array of snowflakes | IDs of the selected users | \* In message interaction responses `component_type` will be returned and in modal interaction responses `type` will be returned. ###### Examples - + - - ![Example of a User Select with two people and an app in a server](images/components/user-select.webp) - + + ![Example of a User Select with two people and an app in a server](/images/components/user-select.webp) + ```json { @@ -645,16 +649,16 @@ User Selects are available in messages and modals. They must be placed inside an ] } ``` - + - + When a user interacts with a User Select in a message, this is the basic form of the interaction data payload you will receive. The full payload - is available in the [interaction](/docs/interactions/receiving-and-responding#interaction-object-interaction-structure) reference. + is available in the [interaction](/developers/docs/interactions/receiving-and-responding#interaction-object-interaction-structure) reference. - :::info + `members` and `users` may both be present in the `resolved` object when a user is selected. - ::: + ```json { @@ -707,13 +711,13 @@ User Selects are available in messages and modals. They must be placed inside an }, } ``` - + - + - - ![Example of a modal with a User Select](images/components/modal-user-select.webp) - + + ![Example of a modal with a User Select](/images/components/modal-user-select.webp) + ```json { @@ -736,12 +740,12 @@ User Selects are available in messages and modals. They must be placed inside an } } ``` - + - + When a user submits a modal that contains a User Select, this is the basic form of the interaction data payload you will receive. The full payload - is available in the [interaction](/docs/interactions/receiving-and-responding#interaction-object-interaction-structure) reference. + is available in the [interaction](/developers/docs/interactions/receiving-and-responding#interaction-object-interaction-structure) reference. ```json { @@ -816,30 +820,30 @@ User Selects are available in messages and modals. They must be placed inside an } } ``` - + -------------- ## Role Select A Role Select is an interactive component that allows users to select one or more roles in a message or modal. Options are automatically populated based on the server's available roles. -Role Selects can be configured for both single-select and multi-select behavior. When a user finishes making their choice(s) your app receives an [interaction](/docs/interactions/receiving-and-responding#interaction-object-interaction-structure). +Role Selects can be configured for both single-select and multi-select behavior. When a user finishes making their choice(s) your app receives an [interaction](/developers/docs/interactions/receiving-and-responding#interaction-object-interaction-structure). -Role Selects are available in messages and modals. They must be placed inside an [Action Row](/docs/components/reference#action-row) in messages and a [Label](/docs/components/reference#label) in modals. +Role Selects are available in messages and modals. They must be placed inside an [Action Row](/developers/docs/components/reference#action-row) in messages and a [Label](/developers/docs/components/reference#label) in modals. ###### Role Select Structure -| Field | Type | Description | -|-----------------|---------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------| -| type | integer | `6` for role select | -| id? | integer | Optional identifier for component | -| custom_id | string | ID for the select menu; max 100 characters | -| placeholder? | string | Placeholder text if nothing is selected; max 150 characters | -| default_values? | array of [default value objects](/docs/components/reference#user-select-select-default-value-structure) | List of default values for auto-populated select menu components; number of default values must be in the range defined by `min_values` and `max_values` | -| min_values? | integer | Minimum number of items that must be chosen (defaults to 1); min 0, max 25 | -| max_values? | integer | Maximum number of items that can be chosen (defaults to 1); max 25 | -| required?\* | boolean | Whether the role select is required to answer in a modal (defaults to `true`) | -| disabled?\*\* | boolean | Whether select menu is disabled in a message (defaults to `false`) | +| Field | Type | Description | +|-----------------|--------------------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------| +| type | integer | `6` for role select | +| id? | integer | Optional identifier for component | +| custom_id | string | ID for the select menu; max 100 characters | +| placeholder? | string | Placeholder text if nothing is selected; max 150 characters | +| default_values? | array of [default value objects](/developers/docs/components/reference#user-select-select-default-value-structure) | List of default values for auto-populated select menu components; number of default values must be in the range defined by `min_values` and `max_values` | +| min_values? | integer | Minimum number of items that must be chosen (defaults to 1); min 0, max 25 | +| max_values? | integer | Maximum number of items that can be chosen (defaults to 1); max 25 | +| required?\* | boolean | Whether the role select is required to answer in a modal (defaults to `true`) | +| disabled?\*\* | boolean | Whether select menu is disabled in a message (defaults to `false`) | \* The `required` field is only available for Role Selects in modals. It is ignored in messages. @@ -847,24 +851,24 @@ Role Selects are available in messages and modals. They must be placed inside an ###### Role Select Interaction Response Structure -| Field | Type | Description | -|------------------|---------------------------------------------------------------------------------------------------------|----------------------------------------------------------------| -| type\* | integer | `6` for a Role Select | -| component_type\* | integer | `6` for a Role Select | -| id | integer | Unique identifier for the component | -| custom_id | string | Developer-defined identifier for the input; max 100 characters | -| resolved | [resolved data](/docs/interactions/receiving-and-responding#interaction-object-resolved-data-structure) | Resolved entities from selected options | -| values | array of snowflakes | IDs of the selected roles | +| Field | Type | Description | +|------------------|--------------------------------------------------------------------------------------------------------------------|----------------------------------------------------------------| +| type\* | integer | `6` for a Role Select | +| component_type\* | integer | `6` for a Role Select | +| id | integer | Unique identifier for the component | +| custom_id | string | Developer-defined identifier for the input; max 100 characters | +| resolved | [resolved data](/developers/docs/interactions/receiving-and-responding#interaction-object-resolved-data-structure) | Resolved entities from selected options | +| values | array of snowflakes | IDs of the selected roles | \* In message interaction responses `component_type` will be returned and in modal interaction responses `type` will be returned. ###### Examples - + - - ![Example of a Role Select allowing up to 3 choices](images/components/role-select.webp) - + + ![Example of a Role Select allowing up to 3 choices](/images/components/role-select.webp) + ```json { @@ -885,12 +889,12 @@ Role Selects are available in messages and modals. They must be placed inside an ] } ``` - + - + When a user interacts with a Role Select in a message, this is the basic form of the interaction data payload you will receive. The full payload - is available in the [interaction](/docs/interactions/receiving-and-responding#interaction-object-interaction-structure) reference. + is available in the [interaction](/developers/docs/interactions/receiving-and-responding#interaction-object-interaction-structure) reference. ```json { @@ -930,13 +934,13 @@ Role Selects are available in messages and modals. They must be placed inside an }, } ``` - + - + - - ![Example of a modal with a Role Select](images/components/modal-role-select.webp) - + + ![Example of a modal with a Role Select](/images/components/modal-role-select.webp) + ```json { @@ -959,12 +963,12 @@ Role Selects are available in messages and modals. They must be placed inside an } } ``` - + - + When a user submits a modal that contains a Role Select, this is the basic form of the interaction data payload you will receive. The full payload - is available in the [interaction](/docs/interactions/receiving-and-responding#interaction-object-interaction-structure) reference. + is available in the [interaction](/developers/docs/interactions/receiving-and-responding#interaction-object-interaction-structure) reference. ```json { @@ -1033,30 +1037,30 @@ Role Selects are available in messages and modals. They must be placed inside an } } ``` - + --------------------- ## Mentionable Select A Mentionable Select is an interactive component that allows users to select one or more mentionables in a message or modal. Options are automatically populated based on available mentionables in the server. -Mentionable Selects can be configured for both single-select and multi-select behavior. When a user finishes making their choice(s), your app receives an [interaction](/docs/interactions/receiving-and-responding#interaction-object-interaction-structure). +Mentionable Selects can be configured for both single-select and multi-select behavior. When a user finishes making their choice(s), your app receives an [interaction](/developers/docs/interactions/receiving-and-responding#interaction-object-interaction-structure). -Mentionable Selects are available in messages and modals. They must be placed inside an [Action Row](/docs/components/reference#action-row) in messages and a [Label](/docs/components/reference#label) in modals. +Mentionable Selects are available in messages and modals. They must be placed inside an [Action Row](/developers/docs/components/reference#action-row) in messages and a [Label](/developers/docs/components/reference#label) in modals. ###### Mentionable Select Structure -| Field | Type | Description | -|-----------------|---------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------| -| type | integer | `7` for mentionable select | -| id? | integer | Optional identifier for component | -| custom_id | string | ID for the select menu; max 100 characters | -| placeholder? | string | Placeholder text if nothing is selected; max 150 characters | -| default_values? | array of [default value objects](/docs/components/reference#user-select-select-default-value-structure) | List of default values for auto-populated select menu components; number of default values must be in the range defined by `min_values` and `max_values` | -| min_values? | integer | Minimum number of items that must be chosen (defaults to 1); min 0, max 25 | -| max_values? | integer | Maximum number of items that can be chosen (defaults to 1); max 25 | -| required?\* | boolean | Whether the mentionable select is required to answer in a modal (defaults to `true`) | -| disabled?\*\* | boolean | Whether select menu is disabled in a message (defaults to `false`) | +| Field | Type | Description | +|-----------------|--------------------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------| +| type | integer | `7` for mentionable select | +| id? | integer | Optional identifier for component | +| custom_id | string | ID for the select menu; max 100 characters | +| placeholder? | string | Placeholder text if nothing is selected; max 150 characters | +| default_values? | array of [default value objects](/developers/docs/components/reference#user-select-select-default-value-structure) | List of default values for auto-populated select menu components; number of default values must be in the range defined by `min_values` and `max_values` | +| min_values? | integer | Minimum number of items that must be chosen (defaults to 1); min 0, max 25 | +| max_values? | integer | Maximum number of items that can be chosen (defaults to 1); max 25 | +| required?\* | boolean | Whether the mentionable select is required to answer in a modal (defaults to `true`) | +| disabled?\*\* | boolean | Whether select menu is disabled in a message (defaults to `false`) | \* The `required` field is only available for Mentionable Selects in modals. It is ignored in messages. @@ -1064,24 +1068,24 @@ Mentionable Selects are available in messages and modals. They must be placed in ###### Mentionable Select Interaction Response Structure -| Field | Type | Description | -|------------------|---------------------------------------------------------------------------------------------------------|----------------------------------------------------------------| -| type\* | integer | `7` for a Mentionable Select | -| component_type\* | integer | `7` for a Mentionable Select | -| id | integer | Unique identifier for the component | -| custom_id | string | Developer-defined identifier for the input; max 100 characters | -| resolved | [resolved data](/docs/interactions/receiving-and-responding#interaction-object-resolved-data-structure) | Resolved entities from selected options | -| values | array of snowflakes | IDs of the selected mentionables | +| Field | Type | Description | +|------------------|--------------------------------------------------------------------------------------------------------------------|----------------------------------------------------------------| +| type\* | integer | `7` for a Mentionable Select | +| component_type\* | integer | `7` for a Mentionable Select | +| id | integer | Unique identifier for the component | +| custom_id | string | Developer-defined identifier for the input; max 100 characters | +| resolved | [resolved data](/developers/docs/interactions/receiving-and-responding#interaction-object-resolved-data-structure) | Resolved entities from selected options | +| values | array of snowflakes | IDs of the selected mentionables | \* In message interaction responses `component_type` will be returned and in modal interaction responses `type` will be returned. ###### Examples - + - - ![Example of a Mentionable Select](images/components/mentionable-select.webp) - + + ![Example of a Mentionable Select](/images/components/mentionable-select.webp) + ```json { @@ -1100,16 +1104,16 @@ Mentionable Selects are available in messages and modals. They must be placed in ] } ``` - + - + When a user interacts with a Mentionable Select in a message, this is the basic form of the interaction data payload you will receive. The full payload - is available in the [interaction](/docs/interactions/receiving-and-responding#interaction-object-interaction-structure) reference. + is available in the [interaction](/developers/docs/interactions/receiving-and-responding#interaction-object-interaction-structure) reference. - :::info + `members` and `users` may both be present in the `resolved` object when a user is selected. - ::: + ```json { @@ -1184,13 +1188,13 @@ Mentionable Selects are available in messages and modals. They must be placed in }, } ``` - + - + - - ![Example of a modal with a Mentionable Select](images/components/modal-mentionable-select.webp) - + + ![Example of a modal with a Mentionable Select](/images/components/modal-mentionable-select.webp) + ```json { @@ -1212,12 +1216,12 @@ Mentionable Selects are available in messages and modals. They must be placed in } } ``` - + - + When a user submits a modal that contains a Mentionable Select, this is the basic form of the interaction data payload you will receive. The full payload - is available in the [interaction](/docs/interactions/receiving-and-responding#interaction-object-interaction-structure) reference. + is available in the [interaction](/developers/docs/interactions/receiving-and-responding#interaction-object-interaction-structure) reference. ```json { @@ -1266,31 +1270,31 @@ Mentionable Selects are available in messages and modals. They must be placed in } } ``` - + ----------------- ## Channel Select A Channel Select is an interactive component that allows users to select one or more channels in a message or modal. Options are automatically populated based on available channels in the server and can be filtered by channel types. -Channel Selects can be configured for both single-select and multi-select behavior. When a user finishes making their choice(s) your app receives an [interaction](/docs/interactions/receiving-and-responding#interaction-object-interaction-structure). +Channel Selects can be configured for both single-select and multi-select behavior. When a user finishes making their choice(s) your app receives an [interaction](/developers/docs/interactions/receiving-and-responding#interaction-object-interaction-structure). -Channel Selects are available in messages and modals. They must be placed inside an [Action Row](/docs/components/reference#action-row) in messages and a [Label](/docs/components/reference#label) in modals. +Channel Selects are available in messages and modals. They must be placed inside an [Action Row](/developers/docs/components/reference#action-row) in messages and a [Label](/developers/docs/components/reference#label) in modals. ###### Channel Select Structure -| Field | Type | Description | -|-----------------|---------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------| -| type | integer | `8` for channel select | -| id? | integer | Optional identifier for component | -| custom_id | string | ID for the select menu; max 100 characters | -| channel_types? | array of [channel types](/docs/resources/channel#channel-object-channel-types) | List of channel types to include in the channel select component | -| placeholder? | string | Placeholder text if nothing is selected; max 150 characters | -| default_values? | array of [default value objects](/docs/components/reference#user-select-select-default-value-structure) | List of default values for auto-populated select menu components; number of default values must be in the range defined by `min_values` and `max_values` | -| min_values? | integer | Minimum number of items that must be chosen (defaults to 1); min 0, max 25 | -| max_values? | integer | Maximum number of items that can be chosen (defaults to 1); max 25 | -| required?\* | boolean | Whether the channel select is required to answer in a modal (defaults to `true`) | -| disabled?\*\* | boolean | Whether select menu is disabled in a message (defaults to `false`) | +| Field | Type | Description | +|-----------------|--------------------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------| +| type | integer | `8` for channel select | +| id? | integer | Optional identifier for component | +| custom_id | string | ID for the select menu; max 100 characters | +| channel_types? | array of [channel types](/developers/docs/resources/channel#channel-object-channel-types) | List of channel types to include in the channel select component | +| placeholder? | string | Placeholder text if nothing is selected; max 150 characters | +| default_values? | array of [default value objects](/developers/docs/components/reference#user-select-select-default-value-structure) | List of default values for auto-populated select menu components; number of default values must be in the range defined by `min_values` and `max_values` | +| min_values? | integer | Minimum number of items that must be chosen (defaults to 1); min 0, max 25 | +| max_values? | integer | Maximum number of items that can be chosen (defaults to 1); max 25 | +| required?\* | boolean | Whether the channel select is required to answer in a modal (defaults to `true`) | +| disabled?\*\* | boolean | Whether select menu is disabled in a message (defaults to `false`) | \* The `required` field is only available for Channel Selects in modals. It is ignored in messages. @@ -1298,24 +1302,24 @@ Channel Selects are available in messages and modals. They must be placed inside ###### Channel Select Interaction Response Structure -| Field | Type | Description | -|------------------|---------------------------------------------------------------------------------------------------------|----------------------------------------------------------------| -| type\* | integer | `8` for a Channel Select | -| component_type\* | integer | `8` for a Channel Select | -| id | integer | Unique identifier for the component | -| custom_id | string | Developer-defined identifier for the input; max 100 characters | -| resolved | [resolved data](/docs/interactions/receiving-and-responding#interaction-object-resolved-data-structure) | Resolved entities from selected options | -| values | array of snowflakes | IDs of the selected channels | +| Field | Type | Description | +|------------------|--------------------------------------------------------------------------------------------------------------------|----------------------------------------------------------------| +| type\* | integer | `8` for a Channel Select | +| component_type\* | integer | `8` for a Channel Select | +| id | integer | Unique identifier for the component | +| custom_id | string | Developer-defined identifier for the input; max 100 characters | +| resolved | [resolved data](/developers/docs/interactions/receiving-and-responding#interaction-object-resolved-data-structure) | Resolved entities from selected options | +| values | array of snowflakes | IDs of the selected channels | \* In message interaction responses `component_type` will be returned and in modal interaction responses `type` will be returned. ###### Examples - + - - ![Example of a Channel Select for text channels](images/components/channel-select.webp) - + + ![Example of a Channel Select for text channels](/images/components/channel-select.webp) + ```json { @@ -1335,12 +1339,12 @@ Channel Selects are available in messages and modals. They must be placed inside ] } ``` - + - + When a user interacts with a Channel Select in a message, this is the basic form of the interaction data payload you will receive. The full payload - is available in the [interaction](/docs/interactions/receiving-and-responding#interaction-object-interaction-structure) reference. + is available in the [interaction](/developers/docs/interactions/receiving-and-responding#interaction-object-interaction-structure) reference. ```json { @@ -1375,13 +1379,13 @@ Channel Selects are available in messages and modals. They must be placed inside }, } ``` - + - + - - ![Example of a modal with a Channel Select](images/components/modal-channel-select.webp) - + + ![Example of a modal with a Channel Select](/images/components/modal-channel-select.webp) + ```json { @@ -1403,12 +1407,12 @@ Channel Selects are available in messages and modals. They must be placed inside } } ``` - + - + When a user submits a modal that contains a Channel Select, this is the basic form of the interaction data payload you will receive. The full payload - is available in the [interaction](/docs/interactions/receiving-and-responding#interaction-object-interaction-structure) reference. + is available in the [interaction](/developers/docs/interactions/receiving-and-responding#interaction-object-interaction-structure) reference. ```json { @@ -1452,54 +1456,54 @@ Channel Selects are available in messages and modals. They must be placed inside } } ``` - + --------- ## Section A Section is a top-level layout component that allows you to contextually associate content with an accessory component. -The typical use-case is to contextually associate [text content](/docs/components/reference#text-display) with -an [accessory](/docs/components/reference#section-section-accessory-components). +The typical use-case is to contextually associate [text content](/developers/docs/components/reference#text-display) with +an [accessory](/developers/docs/components/reference#section-section-accessory-components). Sections are currently only available in messages. -:::info -To use this component in messages you must send the [message flag](/docs/resources/message#message-object-message-flags) `1 << 15` (IS_COMPONENTS_V2) which can be activated on a per-message basis. -::: + + To use this component in messages you must send the [message flag](/developers/docs/resources/message#message-object-message-flags) `1 << 15` (IS_COMPONENTS_V2) which can be activated on a per-message basis. + ###### Section Structure -| Field | Type | Description | -|------------|--------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------| -| type | integer | `9` for section component | -| id? | integer | Optional identifier for component | -| components | array of [section child components](/docs/components/reference#section-section-child-components) | One to three child components representing the content of the section that is contextually associated to the accessory | -| accessory | [section accessory component](/docs/components/reference#section-section-accessory-components) | A component that is contextually associated to the content of the section | +| Field | Type | Description | +|------------|-------------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------| +| type | integer | `9` for section component | +| id? | integer | Optional identifier for component | +| components | array of [section child components](/developers/docs/components/reference#section-section-child-components) | One to three child components representing the content of the section that is contextually associated to the accessory | +| accessory | [section accessory component](/developers/docs/components/reference#section-section-accessory-components) | A component that is contextually associated to the content of the section | -:::info -Don't hardcode `components` to contain only text components. We may add other components in the future. Similarly, `accessory` may be expanded to include other components in the future. -::: + + Don't hardcode `components` to contain only text components. We may add other components in the future. Similarly, `accessory` may be expanded to include other components in the future. + ###### Section Child Components -| Available Components | -|---------------------------------------------------------| -| [Text Display](/docs/components/reference#text-display) | +| Available Components | +|--------------------------------------------------------------------| +| [Text Display](/developers/docs/components/reference#text-display) | ###### Section Accessory Components -| Available Components | -|---------------------------------------------------| -| [Button](/docs/components/reference#button) | -| [Thumbnail](/docs/components/reference#thumbnail) | +| Available Components | +|--------------------------------------------------------------| +| [Button](/developers/docs/components/reference#button) | +| [Thumbnail](/developers/docs/components/reference#thumbnail) | ###### Examples - + - - ![Example of a Section showing a fake game changelog and a thumbnail](images/components/section.webp) - + + ![Example of a Section showing a fake game changelog and a thumbnail](/images/components/section.webp) + ```json { @@ -1531,20 +1535,20 @@ Don't hardcode `components` to contain only text components. We may add other co ] } ``` - + --------------- ## Text Display A Text Display is a content component that allows you to add markdown formatted text, including mentions (users, roles, etc) and emojis. -The behavior of this component is extremely similar to the [`content` field of a message](/docs/resources/message#message-object), but allows you to add multiple text components, controlling the layout of your message. +The behavior of this component is extremely similar to the [`content` field of a message](/developers/docs/resources/message#message-object), but allows you to add multiple text components, controlling the layout of your message. When sent in a message, pingable mentions (@user, @role, etc) present in this component will ping and send notifications based on the -value of the [allowed mention object](/docs/resources/message#allowed-mentions-object) set in [`message.allowed_mentions`](/docs/resources/message#message-object). +value of the [allowed mention object](/developers/docs/resources/message#allowed-mentions-object) set in [`message.allowed_mentions`](/developers/docs/resources/message#message-object). -:::info -To use this component in messages you must send the [message flag](/docs/resources/message#message-object-message-flags) `1 << 15` (IS_COMPONENTS_V2) which can be activated on a per-message basis. -::: + + To use this component in messages you must send the [message flag](/developers/docs/resources/message#message-object-message-flags) `1 << 15` (IS_COMPONENTS_V2) which can be activated on a per-message basis. + ###### Text Display Structure @@ -1563,11 +1567,11 @@ To use this component in messages you must send the [message flag](/docs/resourc ###### Examples - + - - ![Example of a Text Display with markdown](images/components/text-display.webp) - + + ![Example of a Text Display with markdown](/images/components/text-display.webp) + ```json { @@ -1580,13 +1584,13 @@ To use this component in messages you must send the [message flag](/docs/resourc ] } ``` - + - + - - ![Example of a modal with a Text Display](images/components/modal-text-display.webp) - + + ![Example of a modal with a Text Display](/images/components/modal-text-display.webp) + ```json { @@ -1624,40 +1628,40 @@ To use this component in messages you must send the [message flag](/docs/resourc } } ``` - + ------------ ## Thumbnail A Thumbnail is a content component that displays visual media in a small form-factor. It is intended as an accessory for -to other content, and is primarily usable with [sections](/docs/components/reference#section). The media displayed is -defined by the [unfurled media item](/docs/components/reference#unfurled-media-item) structure, which supports +to other content, and is primarily usable with [sections](/developers/docs/components/reference#section). The media displayed is +defined by the [unfurled media item](/developers/docs/components/reference#unfurled-media-item) structure, which supports both uploaded media and externally hosted media. -Thumbnails are currently only available in messages as an accessory in a [section](/docs/components/reference#section). +Thumbnails are currently only available in messages as an accessory in a [section](/developers/docs/components/reference#section). Thumbnails currently only support images, including animated formats like GIF and WEBP. Videos are not supported at this time. -:::info -To use this component, you need to send the [message flag](/docs/resources/message#message-object-message-flags) `1 << 15` (IS_COMPONENTS_V2), which can be activated on a per-message basis. -::: + + To use this component, you need to send the [message flag](/developers/docs/resources/message#message-object-message-flags) `1 << 15` (IS_COMPONENTS_V2), which can be activated on a per-message basis. + ###### Thumbnail Structure -| Field | Type | Description | -|--------------|-----------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------| -| type | integer | `11` for thumbnail component | -| id? | integer | Optional identifier for component | -| media | [unfurled media item](/docs/components/reference#unfurled-media-item) | A url or attachment provided as an [unfurled media item](/docs/components/reference#unfurled-media-item) | -| description? | string | Alt text for the media, max 1024 characters | -| spoiler? | boolean | Whether the thumbnail should be a spoiler (or blurred out). Defaults to `false` | +| Field | Type | Description | +|--------------|----------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------| +| type | integer | `11` for thumbnail component | +| id? | integer | Optional identifier for component | +| media | [unfurled media item](/developers/docs/components/reference#unfurled-media-item) | A url or attachment provided as an [unfurled media item](/developers/docs/components/reference#unfurled-media-item) | +| description? | string | Alt text for the media, max 1024 characters | +| spoiler? | boolean | Whether the thumbnail should be a spoiler (or blurred out). Defaults to `false` | ###### Examples - + - - ![Example of a Section showing a fake game changelog and a thumbnail](images/components/section.webp) - + + ![Example of a Section showing a fake game changelog and a thumbnail](/images/components/section.webp) + ```json { @@ -1689,7 +1693,7 @@ To use this component, you need to send the [message flag](/docs/resources/messa ] } ``` - + ---------------- ## Media Gallery @@ -1699,33 +1703,33 @@ Each item can have optional descriptions and can be marked as spoilers. Media Galleries are currently only available in messages. -:::info -To use this component in messages you must send the [message flag](/docs/resources/message#message-object-message-flags) `1 << 15` (IS_COMPONENTS_V2) which can be activated on a per-message basis. -::: + + To use this component in messages you must send the [message flag](/developers/docs/resources/message#message-object-message-flags) `1 << 15` (IS_COMPONENTS_V2) which can be activated on a per-message basis. + ###### Media Gallery Structure -| Field | Type | Description | -|-------|-------------------------------------------------------------------------------------------------------|-----------------------------------| -| type | integer | `12` for media gallery component | -| id? | integer | Optional identifier for component | -| items | array of [media gallery items](/docs/components/reference#media-gallery-media-gallery-item-structure) | 1 to 10 media gallery items | +| Field | Type | Description | +|-------|------------------------------------------------------------------------------------------------------------------|-----------------------------------| +| type | integer | `12` for media gallery component | +| id? | integer | Optional identifier for component | +| items | array of [media gallery items](/developers/docs/components/reference#media-gallery-media-gallery-item-structure) | 1 to 10 media gallery items | ###### Media Gallery Item Structure -| Field | Type | Description | -|--------------|-----------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------| -| media | [unfurled media item](/docs/components/reference#unfurled-media-item) | A url or attachment provided as an [unfurled media item](/docs/components/reference#unfurled-media-item) | -| description? | string | Alt text for the media, max 1024 characters | -| spoiler? | boolean | Whether the media should be a spoiler (or blurred out). Defaults to `false` | +| Field | Type | Description | +|--------------|----------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------| +| media | [unfurled media item](/developers/docs/components/reference#unfurled-media-item) | A url or attachment provided as an [unfurled media item](/developers/docs/components/reference#unfurled-media-item) | +| description? | string | Alt text for the media, max 1024 characters | +| spoiler? | boolean | Whether the media should be a spoiler (or blurred out). Defaults to `false` | ###### Examples - + - - ![Example of a Media Gallery showing screenshots from live webcam feeds](images/components/media-gallery.webp) - + + ![Example of a Media Gallery showing screenshots from live webcam feeds](/images/components/media-gallery.webp) + ```json { @@ -1755,47 +1759,47 @@ To use this component in messages you must send the [message flag](/docs/resourc ] } ``` - + ------- ## File -A File is a top-level content component that allows you to display an [uploaded file](/docs/components/reference#uploading-a-file) as +A File is a top-level content component that allows you to display an [uploaded file](/developers/docs/components/reference#uploading-a-file) as an attachment to the message and reference it in the component. Each file component can only display 1 attached file, but you can upload multiple files and add them to different file components within your payload. Files are currently only available in messages. -:::info -The File component only supports using the `attachment://` protocol in [unfurled media item](/docs/components/reference#unfurled-media-item) -::: + + The File component only supports using the `attachment://` protocol in [unfurled media item](/developers/docs/components/reference#unfurled-media-item) + -:::info -To use this component in messages you must send the [message flag](/docs/resources/message#message-object-message-flags) `1 << 15` (IS_COMPONENTS_V2) which can be activated on a per-message basis. -::: + + To use this component in messages you must send the [message flag](/developers/docs/resources/message#message-object-message-flags) `1 << 15` (IS_COMPONENTS_V2) which can be activated on a per-message basis. + ###### File Structure -| Field | Type | Description | -|----------|-----------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------| -| type | integer | `13` for a file component | -| id? | integer | Optional identifier for component | -| file | [unfurled media item](/docs/components/reference#unfurled-media-item) | This unfurled media item is unique in that it **only** supports attachment references using the `attachment://` syntax | -| spoiler? | boolean | Whether the media should be a spoiler (or blurred out). Defaults to `false` | -| name | string | The name of the file. This field is ignored and provided by the API as part of the response | -| size | integer | The size of the file in bytes. This field is ignored and provided by the API as part of the response | +| Field | Type | Description | +|----------|----------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------| +| type | integer | `13` for a file component | +| id? | integer | Optional identifier for component | +| file | [unfurled media item](/developers/docs/components/reference#unfurled-media-item) | This unfurled media item is unique in that it **only** supports attachment references using the `attachment://` syntax | +| spoiler? | boolean | Whether the media should be a spoiler (or blurred out). Defaults to `false` | +| name | string | The name of the file. This field is ignored and provided by the API as part of the response | +| size | integer | The size of the file in bytes. This field is ignored and provided by the API as part of the response | ###### Examples - + - - ![Example of a File showing a download for a game and manual](images/components/file.webp) - + + ![Example of a File showing a download for a game and manual](/images/components/file.webp) + - :::info - This example makes use of the `attachment://` protocol functionality in [unfurled media item](/docs/components/reference#unfurled-media-item). - ::: + + This example makes use of the `attachment://` protocol functionality in [unfurled media item](/developers/docs/components/reference#unfurled-media-item). + ```json { @@ -1824,7 +1828,7 @@ To use this component in messages you must send the [message flag](/docs/resourc ] } ``` - + ------------ ## Separator @@ -1833,9 +1837,9 @@ A Separator is a top-level layout component that adds vertical padding and visua Separators are currently only available in messages. -:::info -To use this component in messages you must send the [message flag](/docs/resources/message#message-object-message-flags) `1 << 15` (IS_COMPONENTS_V2) which can be activated on a per-message basis. -::: + + To use this component in messages you must send the [message flag](/developers/docs/resources/message#message-object-message-flags) `1 << 15` (IS_COMPONENTS_V2) which can be activated on a per-message basis. + ###### Separator Structure @@ -1847,11 +1851,11 @@ To use this component in messages you must send the [message flag](/docs/resourc | spacing? | integer | Size of separator padding—`1` for small padding, `2` for large padding. Defaults to `1` | ###### Examples - + - - ![Example of a separator with large spacing dividing content](images/components/separator.webp) - + + ![Example of a separator with large spacing dividing content](/images/components/separator.webp) + ```json { @@ -1873,7 +1877,7 @@ To use this component in messages you must send the [message flag](/docs/resourc ] } ``` - + ------------ ## Container @@ -1883,38 +1887,38 @@ and have an optional customizable accent color bar. Containers are currently only available in messages. -:::info -To use this component in messages you must send the [message flag](/docs/resources/message#message-object-message-flags) `1 << 15` (IS_COMPONENTS_V2) which can be activated on a per-message basis. -::: + + To use this component in messages you must send the [message flag](/developers/docs/resources/message#message-object-message-flags) `1 << 15` (IS_COMPONENTS_V2) which can be activated on a per-message basis. + ###### Container Structure -| Field | Type | Description | -|---------------|--------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------| -| type | integer | `17` for container component | -| id? | integer | Optional identifier for component | -| components | array of [container child components](/docs/components/reference#container-container-child-components) | Child components that are encapsulated within the Container | -| accent_color? | ?integer | Color for the accent on the container as RGB from `0x000000` to `0xFFFFFF` | -| spoiler? | boolean | Whether the container should be a spoiler (or blurred out). Defaults to `false`. | +| Field | Type | Description | +|---------------|-------------------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------| +| type | integer | `17` for container component | +| id? | integer | Optional identifier for component | +| components | array of [container child components](/developers/docs/components/reference#container-container-child-components) | Child components that are encapsulated within the Container | +| accent_color? | ?integer | Color for the accent on the container as RGB from `0x000000` to `0xFFFFFF` | +| spoiler? | boolean | Whether the container should be a spoiler (or blurred out). Defaults to `false`. | ###### Container Child Components -| Available Components | -|-----------------------------------------------------------| -| [Action Row](/docs/components/reference#action-row) | -| [Text Display](/docs/components/reference#text-display) | -| [Section](/docs/components/reference#section) | -| [Media Gallery](/docs/components/reference#media-gallery) | -| [Separator](/docs/components/reference#separator) | -| [File](/docs/components/reference#file) | +| Available Components | +|----------------------------------------------------------------------| +| [Action Row](/developers/docs/components/reference#action-row) | +| [Text Display](/developers/docs/components/reference#text-display) | +| [Section](/developers/docs/components/reference#section) | +| [Media Gallery](/developers/docs/components/reference#media-gallery) | +| [Separator](/developers/docs/components/reference#separator) | +| [File](/developers/docs/components/reference#file) | ###### Examples - + - - ![Example of a container showing text, image, and buttons for a wild enemy encounter](images/components/container.webp) - + + ![Example of a container showing text, image, and buttons for a wild enemy encounter](/images/components/container.webp) + ```json { @@ -1968,66 +1972,66 @@ To use this component in messages you must send the [message flag](/docs/resourc ] } ``` - + -------- ## Label A Label is a top-level layout component. Labels wrap modal components with text as a label and optional description. -:::info -The `description` may display above or below the `component` depending on the platform. -::: + + The `description` may display above or below the `component` depending on the platform. + ###### Label Structure -| Field | Type | Description | -|--------------|----------------------------------------------------------------------------------|----------------------------------------------------------------| -| type | integer | `18` for a label | -| id? | integer | Optional identifier for component | -| label | string | The label text; max 45 characters | -| description? | string | An optional description text for the label; max 100 characters | -| component | [label child component](/docs/components/reference#label-label-child-components) | The component within the label | +| Field | Type | Description | +|--------------|---------------------------------------------------------------------------------------------|----------------------------------------------------------------| +| type | integer | `18` for a label | +| id? | integer | Optional identifier for component | +| label | string | The label text; max 45 characters | +| description? | string | An optional description text for the label; max 100 characters | +| component | [label child component](/developers/docs/components/reference#label-label-child-components) | The component within the label | ###### Label Child Components -| Available Components | -|---------------------------------------------------------------------| -| [Text Input](/docs/components/reference#text-input) | -| [String Select](/docs/components/reference#string-select) | -| [User Select](/docs/components/reference#user-select) | -| [Role Select](/docs/components/reference#role-select) | -| [Mentionable Select](/docs/components/reference#mentionable-select) | -| [Channel Select](/docs/components/reference#channel-select) | -| [File Upload](/docs/components/reference#file-upload) | +| Available Components | +|--------------------------------------------------------------------------------| +| [Text Input](/developers/docs/components/reference#text-input) | +| [String Select](/developers/docs/components/reference#string-select) | +| [User Select](/developers/docs/components/reference#user-select) | +| [Role Select](/developers/docs/components/reference#role-select) | +| [Mentionable Select](/developers/docs/components/reference#mentionable-select) | +| [Channel Select](/developers/docs/components/reference#channel-select) | +| [File Upload](/developers/docs/components/reference#file-upload) | ###### Label Interaction Response Structure -| Field | Type | Description | -|-----------|----------------------------------------------------------------------------------------------------------------------------|-------------------------------------| -| type | integer | `18` for a Label | -| id | integer | Unique identifier for the component | -| component | [label interaction response child component](/docs/components/reference#label-label-interaction-response-child-components) | The component within the label | +| Field | Type | Description | +|-----------|---------------------------------------------------------------------------------------------------------------------------------------|-------------------------------------| +| type | integer | `18` for a Label | +| id | integer | Unique identifier for the component | +| component | [label interaction response child component](/developers/docs/components/reference#label-label-interaction-response-child-components) | The component within the label | ###### Label Interaction Response Child Components -| Available Components | -|-----------------------------------------------------------------------------------------------------------------------| -| [Text Input](/docs/components/reference#text-input-text-input-interaction-response-structure) | -| [String Select](/docs/components/reference#string-select-string-select-interaction-response-structure) | -| [User Select](/docs/components/reference#user-select-user-select-interaction-response-structure) | -| [Role Select](/docs/components/reference#role-select-role-select-interaction-response-structure) | -| [Mentionable Select](/docs/components/reference#mentionable-select-mentionable-select-interaction-response-structure) | -| [Channel Select](/docs/components/reference#channel-select-channel-select-interaction-response-structure) | -| [File Upload](/docs/components/reference#file-upload-file-upload-interaction-response-structure) | +| Available Components | +|----------------------------------------------------------------------------------------------------------------------------------| +| [Text Input](/developers/docs/components/reference#text-input-text-input-interaction-response-structure) | +| [String Select](/developers/docs/components/reference#string-select-string-select-interaction-response-structure) | +| [User Select](/developers/docs/components/reference#user-select-user-select-interaction-response-structure) | +| [Role Select](/developers/docs/components/reference#role-select-role-select-interaction-response-structure) | +| [Mentionable Select](/developers/docs/components/reference#mentionable-select-mentionable-select-interaction-response-structure) | +| [Channel Select](/developers/docs/components/reference#channel-select-channel-select-interaction-response-structure) | +| [File Upload](/developers/docs/components/reference#file-upload-file-upload-interaction-response-structure) | ###### Examples - + - - ![A modal with Text Input in a Label](images/components/modal-label.webp) - + + ![A modal with Text Input in a Label](/images/components/modal-label.webp) + ```json { @@ -2054,7 +2058,7 @@ The `description` may display above or below the `component` depending on the pl } } ``` - + -------------- ## File Upload @@ -2170,12 +2174,12 @@ File Uploads are available on modals. They must be placed inside a [Label](/docs An Unfurled Media Item is a piece of media, represented by a URL, that is used within a component. It can be constructed via either uploading media to Discord, or by referencing external media via **a direct link** to the asset. -:::info -While the structure below is the full representation of an Unfurled Media Item, -**only the `url` field is settable by developers** when making requests that utilize this structure. + + While the structure below is the full representation of an Unfurled Media Item, + **only the `url` field is settable by developers** when making requests that utilize this structure. -All other fields will be automatically populated by Discord. -::: + All other fields will be automatically populated by Discord. + ###### Unfurled Media Item Structure @@ -2192,19 +2196,19 @@ All other fields will be automatically populated by Discord. ### Uploading a file -To upload a file with your message, you'll need to send your payload as `multipart/form-data` (rather than `application/json`) and include your file with a valid filename in your payload. Details and examples for uploading files can be found in the [API Reference](/docs/reference#uploading-files). +To upload a file with your message, you'll need to send your payload as `multipart/form-data` (rather than `application/json`) and include your file with a valid filename in your payload. Details and examples for uploading files can be found in the [API Reference](/developers/docs/reference#uploading-files). ## Legacy Message Component Behavior -Before the introduction of the `IS_COMPONENTS_V2` flag ([see changelog](/docs/change-log/2025-04-22-components-v2)), message components were sent in conjunction with message content. This means that you could send a message using a subset of the available components without setting the `IS_COMPONENTS_V2` flag, and the components would be included in the message content along with `content` and `embeds`. +Before the introduction of the `IS_COMPONENTS_V2` flag ([see changelog](/developers/docs/change-log#introducing-new-components-for-messages)), message components were sent in conjunction with message content. This means that you could send a message using a subset of the available components without setting the `IS_COMPONENTS_V2` flag, and the components would be included in the message content along with `content` and `embeds`. Additionally, components of messages preceding components V2 will contain an `id` of `0`. Apps using this Legacy Message Component behavior will continue to work as expected, but it is recommended to use the new `IS_COMPONENTS_V2` flag for new apps or features as they offer more options for layout and customization. -:::info -Legacy messages allow up to 5 action rows as top-level components -::: + + Legacy messages allow up to 5 action rows as top-level components + Legacy Message Component Example @@ -2225,4 +2229,4 @@ Legacy Message Component Example } ] } -``` +``` \ No newline at end of file diff --git a/docs/components/using-message-components.mdx b/discord/developers/docs/components/using-message-components.mdx similarity index 66% rename from docs/components/using-message-components.mdx rename to discord/developers/docs/components/using-message-components.mdx index a409559135..c852eda0d5 100644 --- a/docs/components/using-message-components.mdx +++ b/discord/developers/docs/components/using-message-components.mdx @@ -1,16 +1,16 @@ --- -sidebar_label: Using Message Components +title: Using Message Components +sidebarTitle: Using Message Components +description: Learn how to send interactive message components. --- -# Using Message Components - ## Overview Message components are a powerful way to add interactivity to your messages. They allow you to create rich, interactive experiences for your users, making it easier for them to engage with your content. -:::info -If you are sending components as part of a [webhook](/docs/resources/webhook) you'll need to use the [`?with_components=true`](/docs/resources/webhook#execute-webhook-query-string-params) query param otherwise they'll be ignored. -::: + +If you are sending components as part of a [webhook](/developers/docs/resources/webhook) you'll need to use the [`?with_components=true`](/developers/docs/resources/webhook#execute-webhook-query-string-params) query param otherwise they'll be ignored. + ### Prerequisites @@ -22,11 +22,11 @@ If you are sending components as part of a [webhook](/docs/resources/webhook) yo ## Sending a Message with a Component -To send a message with a component, you need to set the `IS_COMPONENTS_V2` flag (`1<<15`) in your message's `flags` field. This can be done when using [Message Create](/docs/resources/message#create-message), [Execute Webhook](/docs/resources/webhook#execute-webhook), or [responding to an interaction](/docs/interactions/receiving-and-responding#create-followup-message). +To send a message with a component, you need to set the `IS_COMPONENTS_V2` flag (`1<<15`) in your message's `flags` field. This can be done when using [Message Create](/developers/docs/resources/message#create-message), [Execute Webhook](/developers/docs/resources/webhook#execute-webhook), or [responding to an interaction](/developers/docs/interactions/receiving-and-responding#create-followup-message). -:::warn + Setting the `IS_COMPONENTS_V2` message flag cannot be reverted: once the message has been sent, the flag cannot be removed from the message when editing the message. -::: + This flag indicates that the message contains components and disables traditional content and embeds. @@ -66,7 +66,7 @@ To send a message with multiple components, you can include multiple component o ## Nesting Components with Layout Components -You can also nest components within layout components. This gives you more flexibility in displaying information, images, and interactive components to your users. Check out the [list of components](/docs/components/reference#component-object-component-types) for a complete list of available layout components. +You can also nest components within layout components. This gives you more flexibility in displaying information, images, and interactive components to your users. Check out the [list of components](/developers/docs/components/reference#component-object-component-types) for a complete list of available layout components. For example, you can create a message with an Action Row component that contains multiple Button components. @@ -101,10 +101,10 @@ For example, you can create a message with an Action Row component that contains ## Using Message Components with Interactions -When a user interacts with an interactive message component, your app will [receive an interaction event](/docs/interactions/overview). This event contains information about the interaction, including the type of interaction and the component that was interacted with. +When a user interacts with an interactive message component, your app will [receive an interaction event](/developers/docs/interactions/overview). This event contains information about the interaction, including the type of interaction and the component that was interacted with. -See the [list of supported component types](/docs/components/reference#component-object-component-types) for a list of interactive message components and their interaction event payloads. +See the [list of supported component types](/developers/docs/components/reference#component-object-component-types) for a list of interactive message components and their interaction event payloads. You can use this information to respond to the interaction, update the message, or perform other actions, such as displaying a modal based on the user's input. -Check out the [Interactions documentation](/docs/interactions/overview) for more information on handling interactions and responding to user input from interactive components. +Check out the [Interactions documentation](/developers/docs/interactions/overview) for more information on handling interactions and responding to user input from interactive components. diff --git a/docs/components/using-modal-components.mdx b/discord/developers/docs/components/using-modal-components.mdx similarity index 66% rename from docs/components/using-modal-components.mdx rename to discord/developers/docs/components/using-modal-components.mdx index 2f6aae3a7f..fe93b17e2c 100644 --- a/docs/components/using-modal-components.mdx +++ b/discord/developers/docs/components/using-modal-components.mdx @@ -1,9 +1,10 @@ --- -sidebar_label: Using Modal Components +title: Using Modal Components +sidebarTitle: Using Modal Components +mode: wide +description: Guide to creating and displaying modal dialogs with text input fields. --- -# Using Modal Components - ## Overview Modal components are a great way to collect freeform information from your users. @@ -17,9 +18,9 @@ Modal components are a great way to collect freeform information from your users ## Displaying a Modal -Displaying a modal can be done in response to an [interaction](/docs/interactions/receiving-and-responding). When displaying a modal you'll use an [interaction response](/docs/interactions/receiving-and-responding#interaction-response-object) with the [`MODAL`](/docs/interactions/receiving-and-responding#interaction-response-object-interaction-callback-type) interaction callback type and [modal fields](/docs/interactions/receiving-and-responding#interaction-response-object-modal). +Displaying a modal can be done in response to an [interaction](/developers/docs/interactions/receiving-and-responding). When displaying a modal you'll use an [interaction response](/developers/docs/interactions/receiving-and-responding#interaction-response-object) with the [`MODAL`](/developers/docs/interactions/receiving-and-responding#interaction-response-object-interaction-callback-type) interaction callback type and [modal fields](/developers/docs/interactions/receiving-and-responding#interaction-response-object-modal). -An example of a modal with a [String Select](/docs/components/reference#string-select) and [Text Input](/docs/components/reference#text-input) both wrapped in [Labels](/docs/components/reference#label): +An example of a modal with a [String Select](/developers/docs/components/reference#string-select) and [Text Input](/developers/docs/components/reference#text-input) both wrapped in [Labels](/developers/docs/components/reference#label): ```json { @@ -80,4 +81,4 @@ An example of a modal with a [String Select](/docs/components/reference#string-s } ``` -![Example of a modal with a String Select and a Text Input both wrapped in Labels](images/components/modal.webp) +![Example of a modal with a String Select and a Text Input both wrapped in Labels](/images/components/modal.png) diff --git a/docs/developer-tools/community-resources.mdx b/discord/developers/docs/developer-tools/community-resources.mdx similarity index 83% rename from docs/developer-tools/community-resources.mdx rename to discord/developers/docs/developer-tools/community-resources.mdx index bf11507fde..6a04dddc16 100644 --- a/docs/developer-tools/community-resources.mdx +++ b/discord/developers/docs/developer-tools/community-resources.mdx @@ -1,4 +1,9 @@ -# Community Resources +--- +title: Community Resources +description: Discover community-built libraries, tools, and resources for Discord development. +--- + +import {ManualAnchor} from '/snippets/manualanchor.jsx' Our community members create amazing tools and resources that help developers build and maintain their apps. From permissions calculators and embed visualizers to comprehensive libraries for interfacing with our API, our community has built a wealth of resources to make your development process smoother and more efficient. @@ -10,6 +15,7 @@ The [Official Discord Developers server](https://discord.gg/discord-developers) Discord does not maintain official SDKs. The following table is an inexhaustive list of third-party libraries that have valid rate limit implementations, are recently maintained, and have large communities of active bots. + ###### Discord Libraries | Name | Language | @@ -38,7 +44,7 @@ Discord does not maintain official SDKs. The following table is an inexhaustive ## Interactions -[Interactions](/docs/interactions/receiving-and-responding) are the great, new way of making a Discord bot. The following open-source libraries provide help for the security and authentication checks that are mandatory if you are receiving Interactions via outgoing webhook. They also include some types for the Interactions data models. +[Interactions](/developers/docs/interactions/receiving-and-responding) are the great, new way of making a Discord bot. The following open-source libraries provide help for the security and authentication checks that are mandatory if you are receiving Interactions via outgoing webhook. They also include some types for the Interactions data models. - C# - [Discord.Net.Rest](https://github.com/discord-net/Discord.Net) @@ -63,20 +69,19 @@ Discord does not maintain official SDKs. The following table is an inexhaustive - Other - [caddy-discord-interactions-verifier](https://github.com/CarsonHoffman/caddy-discord-interactions-verifier) - [BotForge's Application Commands Builder & Previewer](https://tools.botforge.org/appbuilder) - - [Rauf's Slash Command Generator](https://rauf.wtf/slash) - [Bsati's Slash Command Builder](https://bsati.github.io/dc-app-command-builder/) ## OpenAPI Specification -:::warn + The OpenAPI spec is currently in public preview and **is subject to breaking changes** -::: + The public preview of the [Discord HTTP API specification](https://github.com/discord/discord-api-spec) provides a standard [OpenAPI 3.1 spec](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md) for the HTTP API. ## Permission Calculators -[Permissions](/docs/topics/permissions#permissions) in Discord are tricky. Luckily, we've got really smart people who love us and have made some great permissions calculators. If you're making a bot for others, and you're not sure how to properly calculate permissions or generate your [authorization URL](/docs/topics/oauth2#bot-authorization-flow), these are great tools: +[Permissions](/developers/docs/topics/permissions) in Discord are tricky. Luckily, we've got really smart people who love us and have made some great permissions calculators. If you're making a bot for others, and you're not sure how to properly calculate permissions or generate your [authorization URL](/developers/docs/topics/oauth2#bot-authorization-flow), these are great tools: - [BotForge's Permissions Calculator](https://tools.botforge.org/permissions) - [FiniteReality's Permissions Calculator](https://finitereality.github.io/permissions-calculator/?v=0) @@ -84,7 +89,7 @@ The public preview of the [Discord HTTP API specification](https://github.com/di ## Intent Calculators -[Gateway Intents](/docs/events/gateway#gateway-intents) are pretty confusing at first. If you're not sure what to send in your [Identify payload](/docs/events/gateway-events#identify), then these tools may be of help: +[Gateway Intents](/developers/docs/events/gateway#gateway-intents) are pretty confusing at first. If you're not sure what to send in your [Identify payload](/developers/docs/events/gateway-events#identify), then these tools may be of help: - [ziad87's Intent Calculator](https://ziad87.net/intents/) - [Larko's Intent Calculator](https://discord-intents-calculator.vercel.app/) diff --git a/docs/developer-tools/embedded-app-sdk.mdx b/discord/developers/docs/developer-tools/embedded-app-sdk.mdx similarity index 61% rename from docs/developer-tools/embedded-app-sdk.mdx rename to discord/developers/docs/developer-tools/embedded-app-sdk.mdx index 2798ef9cd8..edd112c4b7 100644 --- a/docs/developer-tools/embedded-app-sdk.mdx +++ b/discord/developers/docs/developer-tools/embedded-app-sdk.mdx @@ -1,15 +1,19 @@ --- -sidebar_label: Embedded App SDK +title: Embedded App SDK Reference +sidebarTitle: Embedded App SDK +description: Complete reference for the Embedded App SDK. --- -# Embedded App SDK Reference +import {ManualAnchor} from '/snippets/manualanchor.jsx' The Embedded App SDK handles making RPC calls between your application and Discord. It is designed to assist developers in developing interactive Activities like games. -To learn more about building Activities, check out our [Building an Activity](/docs/activities/building-an-activity) tutorial or explore our [Sample Projects](/docs/activities/overview#sample-projects). +To learn more about building Activities, check out our [Building an Activity](/developers/docs/activities/building-an-activity) tutorial or explore our [Sample Projects](/developers/docs/activities/overview#sample-projects). --- +import {Monospace} from '/snippets/monospace.jsx' + ## Install the SDK The Embedded App SDK is available via **[npm](https://www.npmjs.com/package/@discord/embedded-app-sdk)** and **[GitHub](https://github.com/discord/embedded-app-sdk)**. @@ -32,12 +36,12 @@ const discordSdk = new DiscordSDK(DISCORD_CLIENT_ID); ## SDK Methods -| Name | Description | -|-------------------------------------------------------------------|-------------------------------------------------------------------------| -| [ready](/docs/developer-tools/embedded-app-sdk#ready) | Resolves when your app has successfully connected to the Discord client | -| [subscribe](/docs/developer-tools/embedded-app-sdk#subscribe) | Subscribe to an Embedded App SDK Event | -| [unsubscribe](/docs/developer-tools/embedded-app-sdk#unsubscribe) | Unsubscribe to an Embedded App SDK Event | -| [close](/docs/developer-tools/embedded-app-sdk#close) | Close an Embedded App | +| Name | Description | +|------------------------------------------------------------------------------|-------------------------------------------------------------------------| +| [ready](/developers/docs/developer-tools/embedded-app-sdk#ready) | Resolves when your app has successfully connected to the Discord client | +| [subscribe](/developers/docs/developer-tools/embedded-app-sdk#subscribe) | Subscribe to an Embedded App SDK Event | +| [unsubscribe](/developers/docs/developer-tools/embedded-app-sdk#unsubscribe) | Unsubscribe to an Embedded App SDK Event | +| [close](/developers/docs/developer-tools/embedded-app-sdk#close) | Close an Embedded App | ### ready() @@ -71,7 +75,7 @@ async function setup() { ### subscribe() -Used to subscribe to a specific event from the list of [SDK Events](/docs/developer-tools/embedded-app-sdk#sdk-events). +Used to subscribe to a specific event from the list of [SDK Events](/developers/docs/developer-tools/embedded-app-sdk#sdk-events). #### Supported Platforms | Web | iOS | Android | @@ -85,7 +89,7 @@ Depends on the event. Refer to the Required Scopes for the specific event you ar #### Signature -subscribe\(event: [Event](/docs/developer-tools/embedded-app-sdk#sdk-events), listener: (data: EventPayloadData\) => void, ...subscribeArgs: Partial\\>): Promise\<[EventEmitter](https://nodejs.org/docs/latest/api/events.html)\> +subscribe\(event: [Event](/developers/docs/developer-tools/embedded-app-sdk#sdk-events), listener: (data: EventPayloadData\) => void, ...subscribeArgs: Partial\\>): Promise\<[EventEmitter](https://nodejs.org/docs/latest/api/events.html)\> #### Usage @@ -98,7 +102,7 @@ await discordSdk.subscribe("SDK_EVENT_NAME", eventHandler, args); ### unsubscribe() -Used to unsubscribe to [SDK Events](/docs/developer-tools/embedded-app-sdk#sdk-events) that your app has already subscribed to. +Used to unsubscribe to [SDK Events](/developers/docs/developer-tools/embedded-app-sdk#sdk-events) that your app has already subscribed to. #### Supported Platforms | Web | iOS | Android | @@ -111,10 +115,10 @@ No scopes required #### Signature -_The `EventPayloadData` will vary based on the event you are unsubscribing from. See the specific [event](/docs/developer-tools/embedded-app-sdk#sdk-events) for details._ +_The `EventPayloadData` will vary based on the event you are unsubscribing from. See the specific [event](/developers/docs/developer-tools/embedded-app-sdk#sdk-events) for details._ -unsubscribe\(event: [Event](/docs/developer-tools/embedded-app-sdk#sdk-events), listener: (data: EventPayloadData\) => void, ...subscribeArgs: Partial\\>): Promise\<[EventEmitter](https://nodejs.org/docs/latest/api/events.html)\> +unsubscribe\(event: [Event](/developers/docs/developer-tools/embedded-app-sdk#sdk-events), listener: (data: EventPayloadData\) => void, ...subscribeArgs: Partial\\>): Promise\<[EventEmitter](https://nodejs.org/docs/latest/api/events.html)\> #### Usage @@ -141,7 +145,7 @@ No scopes required #### Signature -close(code: [RPCCloseCodes](/docs/developer-tools/embedded-app-sdk#rpcclosecodes), message: string): void +close(code: [RPCCloseCodes](/developers/docs/developer-tools/embedded-app-sdk#rpcclosecodes), message: string): void #### SDK Usage @@ -156,29 +160,29 @@ discordSdk.close(RPCCloseCodes.CLOSE_NORMAL, "You exited from app"); Developers can use these commands to interact with the Discord client. The following SDK commands are prefixed with `.commands`, such as, `discordSDK.commands.authenticate`. -| Name | Description | -|-------------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------| -| [authenticate](/docs/developer-tools/embedded-app-sdk#authenticate) | Authenticate an existing client with your app | -| [authorize](/docs/developer-tools/embedded-app-sdk#authorize) | Authorize a new client with your app | -| [captureLog](/docs/developer-tools/embedded-app-sdk#capturelog) | Forward logs to your own logger | -| [encourageHardwareAcceleration](/docs/developer-tools/embedded-app-sdk#encouragehardwareacceleration) | Presents a modal dialog to allow enabling of hardware acceleration | -| [getChannel](/docs/developer-tools/embedded-app-sdk#getchannel) | Returns information about the channel, per the channel_id | -| [getChannelPermissions](/docs/developer-tools/embedded-app-sdk#getchannelpermissions) | Returns permissions for the current user in the currently connected channel | -| [getEntitlements](/docs/developer-tools/embedded-app-sdk#getentitlements) | Returns a list of entitlements for the current user | -| [getInstanceConnectedParticipants](/docs/developer-tools/embedded-app-sdk#getinstanceconnectedparticipants) | Returns all participants connected to the instance | -| [getPlatformBehaviors](/docs/developer-tools/embedded-app-sdk#getplatformbehaviors) | Returns information about supported platform behaviors | -| [getRelationships](/docs/developer-tools/embedded-app-sdk#getrelationships) | Returns the current user's relationships | -| [getSkus](/docs/developer-tools/embedded-app-sdk#getskus) | Returns a list of your app's SKUs | -| [initiateImageUpload](/docs/developer-tools/embedded-app-sdk#initiateimageupload) | Presents the file upload flow in the Discord client | -| [openExternalLink](/docs/developer-tools/embedded-app-sdk#openexternallink) | Allows for opening an external link from within the Discord client | -| [openInviteDialog](/docs/developer-tools/embedded-app-sdk#openinvitedialog) | Presents a modal dialog with Channel Invite UI without requiring additional OAuth scopes | -| [openShareMomentDialog](/docs/developer-tools/embedded-app-sdk#opensharemomentdialog) | Presents a modal dialog to share media to a channel or DM | -| [setActivity](/docs/developer-tools/embedded-app-sdk#setactivity) | Modifies how your activity's rich presence is displayed in the Discord client | -| [setConfig](/docs/developer-tools/embedded-app-sdk#setconfig) | Set whether or not the PIP (picture-in-picture) is interactive | -| [setOrientationLockState](/docs/developer-tools/embedded-app-sdk#setorientationlockstate) | Set options for orientation and picture-in-picture (PIP) modes | -| [shareLink](/docs/developer-tools/embedded-app-sdk#sharelink) | Presents a modal for the user to share a link to your activity with custom query params | -| [startPurchase](/docs/developer-tools/embedded-app-sdk#startpurchase) | Launches the purchase flow for a specific SKU, per the sku_id | -| [userSettingsGetLocale](/docs/developer-tools/embedded-app-sdk#usersettingsgetlocale) | Returns the current user's locale | +| Name | Description | +|------------------------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------| +| [authenticate](/developers/docs/developer-tools/embedded-app-sdk#authenticate) | Authenticate an existing client with your app | +| [authorize](/developers/docs/developer-tools/embedded-app-sdk#authorize) | Authorize a new client with your app | +| [captureLog](/developers/docs/developer-tools/embedded-app-sdk#capturelog) | Forward logs to your own logger | +| [encourageHardwareAcceleration](/developers/docs/developer-tools/embedded-app-sdk#encouragehardwareacceleration) | Presents a modal dialog to allow enabling of hardware acceleration | +| [getChannel](/developers/docs/developer-tools/embedded-app-sdk#getchannel) | Returns information about the channel, per the channel_id | +| [getChannelPermissions](/developers/docs/developer-tools/embedded-app-sdk#getchannelpermissions) | Returns permissions for the current user in the currently connected channel | +| [getEntitlements](/developers/docs/developer-tools/embedded-app-sdk#getentitlements) | Returns a list of entitlements for the current user | +| [getInstanceConnectedParticipants](/developers/docs/developer-tools/embedded-app-sdk#getinstanceconnectedparticipants) | Returns all participants connected to the instance | +| [getPlatformBehaviors](/developers/docs/developer-tools/embedded-app-sdk#getplatformbehaviors) | Returns information about supported platform behaviors | +| [getRelationships](/developers/docs/developer-tools/embedded-app-sdk#getrelationships) | Returns the current user's relationships | +| [getSkus](/developers/docs/developer-tools/embedded-app-sdk#getskus) | Returns a list of your app's SKUs | +| [initiateImageUpload](/developers/docs/developer-tools/embedded-app-sdk#initiateimageupload) | Presents the file upload flow in the Discord client | +| [openExternalLink](/developers/docs/developer-tools/embedded-app-sdk#openexternallink) | Allows for opening an external link from within the Discord client | +| [openInviteDialog](/developers/docs/developer-tools/embedded-app-sdk#openinvitedialog) | Presents a modal dialog with Channel Invite UI without requiring additional OAuth scopes | +| [openShareMomentDialog](/developers/docs/developer-tools/embedded-app-sdk#opensharemomentdialog) | Presents a modal dialog to share media to a channel or DM | +| [setActivity](/developers/docs/developer-tools/embedded-app-sdk#setactivity) | Modifies how your activity's rich presence is displayed in the Discord client | +| [setConfig](/developers/docs/developer-tools/embedded-app-sdk#setconfig) | Set whether or not the PIP (picture-in-picture) is interactive | +| [setOrientationLockState](/developers/docs/developer-tools/embedded-app-sdk#setorientationlockstate) | Set options for orientation and picture-in-picture (PIP) modes | +| [shareLink](/developers/docs/developer-tools/embedded-app-sdk#sharelink) | Presents a modal for the user to share a link to your activity with custom query params | +| [startPurchase](/developers/docs/developer-tools/embedded-app-sdk#startpurchase) | Launches the purchase flow for a specific SKU, per the sku_id | +| [userSettingsGetLocale](/developers/docs/developer-tools/embedded-app-sdk#usersettingsgetlocale) | Returns the current user's locale | ### authenticate() @@ -196,7 +200,7 @@ No scopes required #### Signature -authenticate(args: [AuthenticateRequest](/docs/developer-tools/embedded-app-sdk#authenticaterequest)): Promise\<[AuthenticateResponse](/docs/developer-tools/embedded-app-sdk#authenticateresponse)\> +authenticate(args: [AuthenticateRequest](/developers/docs/developer-tools/embedded-app-sdk#authenticaterequest)): Promise\<[AuthenticateResponse](/developers/docs/developer-tools/embedded-app-sdk#authenticateresponse)\> #### Usage @@ -225,7 +229,7 @@ No scopes required #### Signature -authorize(args: [AuthorizeRequest](/docs/developer-tools/embedded-app-sdk#authorizerequest)): Promise\<[AuthorizeResponse](/docs/developer-tools/embedded-app-sdk#authorizeresponse)\> +authorize(args: [AuthorizeRequest](/developers/docs/developer-tools/embedded-app-sdk#authorizerequest)): Promise\<[AuthorizeResponse](/developers/docs/developer-tools/embedded-app-sdk#authorizeresponse)\> #### Usage @@ -278,7 +282,7 @@ No scopes required #### Signature -captureLog(args: [CaptureLogRequest](/docs/developer-tools/embedded-app-sdk#capturelogrequest)): Promise\ +captureLog(args: [CaptureLogRequest](/developers/docs/developer-tools/embedded-app-sdk#capturelogrequest)): Promise\ #### Usage @@ -308,7 +312,7 @@ No scopes required #### Signature -encourageHardwareAcceleration(): Promise\<[EncourageHardwareAccelerationResponse](/docs/developer-tools/embedded-app-sdk#encouragehardwareaccelerationresponse)\> +encourageHardwareAcceleration(): Promise\<[EncourageHardwareAccelerationResponse](/developers/docs/developer-tools/embedded-app-sdk#encouragehardwareaccelerationresponse)\> #### Usage @@ -336,7 +340,7 @@ Returns information about the channel for a provided channel ID. #### Signature -getChannel(args: [GetChannelRequest](/docs/developer-tools/embedded-app-sdk#getchannelrequest)): Promise\<[GetChannelResponse](/docs/developer-tools/embedded-app-sdk#getchannelresponse)\> +getChannel(args: [GetChannelRequest](/developers/docs/developer-tools/embedded-app-sdk#getchannelrequest)): Promise\<[GetChannelResponse](/developers/docs/developer-tools/embedded-app-sdk#getchannelresponse)\> #### Usage @@ -364,7 +368,7 @@ Returns permissions for the current user in the currently connected channel. #### Signature -getChannelPermissions(): Promise\<[GetChannelPermissionsResponse](/docs/developer-tools/embedded-app-sdk#getchannelpermissionsresponse)\> +getChannelPermissions(): Promise\<[GetChannelPermissionsResponse](/developers/docs/developer-tools/embedded-app-sdk#getchannelpermissionsresponse)\> #### Usage @@ -391,7 +395,7 @@ No scopes required #### Signature -getEntitlements(): Promise\<[GetEntitlementsResponse](/docs/developer-tools/embedded-app-sdk#getentitlementsresponse)\> +getEntitlements(): Promise\<[GetEntitlementsResponse](/developers/docs/developer-tools/embedded-app-sdk#getentitlementsresponse)\> #### Usage @@ -418,7 +422,7 @@ No scopes required #### Signature -getInstanceConnectedParticipants(): Promise\<[GetInstanceConnectedParticipantsResponse](/docs/developer-tools/embedded-app-sdk#getinstanceconnectedparticipantsresponse)\> +getInstanceConnectedParticipants(): Promise\<[GetInstanceConnectedParticipantsResponse](/developers/docs/developer-tools/embedded-app-sdk#getinstanceconnectedparticipantsresponse)\> #### Usage @@ -445,7 +449,7 @@ No scopes required #### Signature -getPlatformBehaviors(): Promise\<[GetPlatformBehaviorsResponse](/docs/developer-tools/embedded-app-sdk#getplatformbehaviorsresponse)\> +getPlatformBehaviors(): Promise\<[GetPlatformBehaviorsResponse](/developers/docs/developer-tools/embedded-app-sdk#getplatformbehaviorsresponse)\> #### Usage @@ -471,14 +475,14 @@ Returns the current user's relationships. - relationships.read -:::info + Requires Discord approval -::: + #### Signature -getRelationships(): Promise\<[GetRelationshipsResponse](/docs/developer-tools/embedded-app-sdk#getrelationshipsresponse)\> +getRelationships(): Promise\<[GetRelationshipsResponse](/developers/docs/developer-tools/embedded-app-sdk#getrelationshipsresponse)\> #### Usage @@ -505,7 +509,7 @@ No scopes required #### Signature -getSkus(): Promise\<[GetSkusResponse](/docs/developer-tools/embedded-app-sdk#getskusresponse)\> +getSkus(): Promise\<[GetSkusResponse](/developers/docs/developer-tools/embedded-app-sdk#getskusresponse)\> #### Usage @@ -532,7 +536,7 @@ No scopes required #### Signature -initiateImageUpload(): Promise\<[InitiateImageUploadResponse](/docs/developer-tools/embedded-app-sdk#initiateimageuploadresponse)\> +initiateImageUpload(): Promise\<[InitiateImageUploadResponse](/developers/docs/developer-tools/embedded-app-sdk#initiateimageuploadresponse)\> #### Usage @@ -559,7 +563,7 @@ No scopes required #### Signature -openExternalLink(args: [OpenExternalLinkRequest](/docs/developer-tools/embedded-app-sdk#openexternallinkrequest)): Promise\<[OpenExternalLinkResponse](/docs/developer-tools/embedded-app-sdk#openexternallinkresponse)\> +openExternalLink(args: [OpenExternalLinkRequest](/developers/docs/developer-tools/embedded-app-sdk#openexternallinkrequest)): Promise\<[OpenExternalLinkResponse](/developers/docs/developer-tools/embedded-app-sdk#openexternallinkresponse)\> #### Usage @@ -615,7 +619,7 @@ No scopes required #### Signature -openShareMomentDialog(args: [OpenShareMomentDialogRequest](/docs/developer-tools/embedded-app-sdk#opensharemomentdialogrequest)) Promise\ +openShareMomentDialog(args: [OpenShareMomentDialogRequest](/developers/docs/developer-tools/embedded-app-sdk#opensharemomentdialogrequest)) Promise\ #### Usage @@ -630,9 +634,9 @@ await discordSdk.commands.openShareMomentDialog({ ### setActivity() -Modifies how your Activity's Rich Presence data is displayed in the Discord client. The inner `activity` field is a partial [Activity object](/docs/events/gateway-events#activity-object-activity-structure). +Modifies how your Activity's Rich Presence data is displayed in the Discord client. The inner `activity` field is a partial [Activity object](/developers/docs/events/gateway-events#activity-object-activity-structure). -Read the guide on [Using Rich Presence with the Embedded App SDK](/docs/rich-presence/using-with-the-embedded-app-sdk) for more usage details. +Read the guide on [Using Rich Presence with the Embedded App SDK](/developers/docs/rich-presence/using-with-the-embedded-app-sdk) for more usage details. #### Supported Platforms @@ -647,7 +651,7 @@ Read the guide on [Using Rich Presence with the Embedded App SDK](/docs/rich-pre #### Signature -setActivity(args: [SetActivityRequest](/docs/developer-tools/embedded-app-sdk#setactivityrequest)): Promise\<[Activity](/docs/developer-tools/embedded-app-sdk#activity)\> +setActivity(args: [SetActivityRequest](/developers/docs/developer-tools/embedded-app-sdk#setactivityrequest)): Promise\<[Activity](/developers/docs/developer-tools/embedded-app-sdk#activity)\> #### Usage @@ -680,7 +684,7 @@ No scopes required #### Signature -setConfig(args: [SetConfigRequest](/docs/developer-tools/embedded-app-sdk#setconfigrequest)): Promise\<[SetConfigResponse](/docs/developer-tools/embedded-app-sdk#setconfigresponse)\> +setConfig(args: [SetConfigRequest](/developers/docs/developer-tools/embedded-app-sdk#setconfigrequest)): Promise\<[SetConfigResponse](/developers/docs/developer-tools/embedded-app-sdk#setconfigresponse)\> #### Usage @@ -709,7 +713,7 @@ No scopes required #### Signature -setOrientationLockState(args: [SetOrientationLockStateRequest](/docs/developer-tools/embedded-app-sdk#setorientationlockstaterequest)): Promise\ +setOrientationLockState(args: [SetOrientationLockStateRequest](/developers/docs/developer-tools/embedded-app-sdk#setorientationlockstaterequest)): Promise\ #### Usage @@ -743,7 +747,7 @@ No scopes required #### Signature -shareLink(args: [ShareLinkRequest](/docs/developer-tools/embedded-app-sdk#sharelinkrequest)): Promise\<[ShareLinkResponse](/docs/developer-tools/embedded-app-sdk#sharelinkresponse)\>\ +shareLink(args: [ShareLinkRequest](/developers/docs/developer-tools/embedded-app-sdk#sharelinkrequest)): Promise\<[ShareLinkResponse](/developers/docs/developer-tools/embedded-app-sdk#sharelinkresponse)\>\ #### Usage @@ -774,7 +778,7 @@ No scopes required #### Signature -startPurchase(args: [StartPurchaseRequest](/docs/developer-tools/embedded-app-sdk#startpurchaserequest)): Promise\<[StartPurchaseResponse](/docs/developer-tools/embedded-app-sdk#startpurchaseresponse)\> +startPurchase(args: [StartPurchaseRequest](/developers/docs/developer-tools/embedded-app-sdk#startpurchaserequest)): Promise\<[StartPurchaseResponse](/developers/docs/developer-tools/embedded-app-sdk#startpurchaseresponse)\> #### Usage @@ -801,7 +805,7 @@ Returns the current user's locale. #### Signature -userSettingsGetLocale(): Promise\<[UserSettingsGetLocaleResponse](/docs/developer-tools/embedded-app-sdk#usersettingsgetlocaleresponse)\> +userSettingsGetLocale(): Promise\<[UserSettingsGetLocaleResponse](/developers/docs/developer-tools/embedded-app-sdk#usersettingsgetlocaleresponse)\> #### Usage @@ -816,21 +820,21 @@ await discordSdk.commands.userSettingsGetLocale(); Developers may use the following events alongside the `subscribe()` SDK method to subscribe to events from Discord and supported devices. -| Name | Description | -|--------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------| -| [READY](/docs/developer-tools/embedded-app-sdk#ready) | non-subscription event sent immediately after connecting, contains server information | -| [ERROR](/docs/developer-tools/embedded-app-sdk#error) | non-subscription event sent when there is an error, including command responses | -| [VOICE_STATE_UPDATE](/docs/developer-tools/embedded-app-sdk#voicestateupdate) | sent when a user's voice state changes in a subscribed voice channel (mute, volume, etc.) | -| [SPEAKING_START](/docs/developer-tools/embedded-app-sdk#speakingstart) | sent when a user in a subscribed voice channel speaks | -| [SPEAKING_STOP](/docs/developer-tools/embedded-app-sdk#speakingstop) | sent when a user in a subscribed voice channel stops speaking | -| [ACTIVITY_LAYOUT_MODE_UPDATE](/docs/developer-tools/embedded-app-sdk#activitylayoutmodeupdate) | Received when a user changes the layout mode in the Discord client | -| [ORIENTATION_UPDATE](/docs/developer-tools/embedded-app-sdk#orientationupdate) | Received when screen orientation changes | -| [CURRENT_USER_UPDATE](/docs/developer-tools/embedded-app-sdk#currentuserupdate) | Received when the current user object changes | -| [CURRENT_GUILD_MEMBER_UPDATE](/docs/developer-tools/embedded-app-sdk#currentguildmemberupdate) | Received when the current guild member object changes | -| [THERMAL_STATE_UPDATE](/docs/developer-tools/embedded-app-sdk#thermalstateupdate) | Received when Android or iOS thermal states are surfaced to the Discord app | -| [ACTIVITY_INSTANCE_PARTICIPANTS_UPDATE](/docs/developer-tools/embedded-app-sdk#activityinstanceparticipantsupdate) | Received when the number of instance participants changes | -| [RELATIONSHIP_UPDATE](/docs/developer-tools/embedded-app-sdk#relationshipupdate) | Received when a relationship of the current user is updated | -| [ENTITLEMENT_CREATE](/docs/developer-tools/embedded-app-sdk#entitlementcreate) | Received when an entitlement is created for a SKU | +| Name | Description | +|-------------------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------| +| [READY](/developers/docs/developer-tools/embedded-app-sdk#ready) | non-subscription event sent immediately after connecting, contains server information | +| [ERROR](/developers/docs/developer-tools/embedded-app-sdk#error) | non-subscription event sent when there is an error, including command responses | +| [VOICE_STATE_UPDATE](/developers/docs/developer-tools/embedded-app-sdk#voicestateupdate) | sent when a user's voice state changes in a subscribed voice channel (mute, volume, etc.) | +| [SPEAKING_START](/developers/docs/developer-tools/embedded-app-sdk#speakingstart) | sent when a user in a subscribed voice channel speaks | +| [SPEAKING_STOP](/developers/docs/developer-tools/embedded-app-sdk#speakingstop) | sent when a user in a subscribed voice channel stops speaking | +| [ACTIVITY_LAYOUT_MODE_UPDATE](/developers/docs/developer-tools/embedded-app-sdk#activitylayoutmodeupdate) | Received when a user changes the layout mode in the Discord client | +| [ORIENTATION_UPDATE](/developers/docs/developer-tools/embedded-app-sdk#orientationupdate) | Received when screen orientation changes | +| [CURRENT_USER_UPDATE](/developers/docs/developer-tools/embedded-app-sdk#currentuserupdate) | Received when the current user object changes | +| [CURRENT_GUILD_MEMBER_UPDATE](/developers/docs/developer-tools/embedded-app-sdk#currentguildmemberupdate) | Received when the current guild member object changes | +| [THERMAL_STATE_UPDATE](/developers/docs/developer-tools/embedded-app-sdk#thermalstateupdate) | Received when Android or iOS thermal states are surfaced to the Discord app | +| [ACTIVITY_INSTANCE_PARTICIPANTS_UPDATE](/developers/docs/developer-tools/embedded-app-sdk#activityinstanceparticipantsupdate) | Received when the number of instance participants changes | +| [RELATIONSHIP_UPDATE](/developers/docs/developer-tools/embedded-app-sdk#relationshipupdate) | Received when a relationship of the current user is updated | +| [ENTITLEMENT_CREATE](/developers/docs/developer-tools/embedded-app-sdk#entitlementcreate) | Received when an entitlement is created for a SKU | ### READY @@ -872,6 +876,7 @@ No scopes required ``` --- + ### VOICE_STATE_UPDATE Received when a user's voice state changes in a subscribed voice channel (mute, volume, etc). @@ -909,6 +914,7 @@ Received when a user's voice state changes in a subscribed voice channel (mute, ``` --- + ### SPEAKING_START Received when a user in a subscribed voice channel speaks. @@ -928,6 +934,7 @@ Received when a user in a subscribed voice channel speaks. --- + ### SPEAKING_STOP Received when a user in a subscribed voice channel stops speaking. @@ -947,6 +954,7 @@ Received when a user in a subscribed voice channel stops speaking. --- + ### ACTIVITY_LAYOUT_MODE_UPDATE Received when a user changes the layout mode in the Discord client. @@ -965,6 +973,7 @@ No scopes required --- + ### ORIENTATION_UPDATE Received when screen orientation changes. @@ -983,6 +992,7 @@ No scopes required --- + ### CURRENT_USER_UPDATE Received when the current user object changes. @@ -1012,6 +1022,7 @@ Received when the current user object changes. --- + ### CURRENT_GUILD_MEMBER_UPDATE Received when the current guild member object changes. @@ -1039,6 +1050,7 @@ Received when the current guild member object changes. --- + ### THERMAL_STATE_UPDATE Received when Android or iOS thermal states are surfaced to the Discord mobile app. @@ -1056,6 +1068,7 @@ No scopes required --- + ### ACTIVITY_INSTANCE_PARTICIPANTS_UPDATE Received when the number of instance participants changes. @@ -1089,6 +1102,7 @@ No scopes required --- + ### RELATIONSHIP_UPDATE Received when a relationship of the current user is updated. @@ -1097,9 +1111,9 @@ Received when a relationship of the current user is updated. - relationships.read -:::info + Requires Discord approval -::: + #### Sample Event Payload ```javascript @@ -1124,34 +1138,35 @@ Requires Discord approval --- + ### ENTITLEMENT_CREATE -:::preview + Coming soon! Not available during Developer Preview -::: + ## SDK Interfaces #### Activity -| Property | Type | -|-----------------|-----------------------------------------------------------------------| -| name | string | -| type | number | -| url? | string \| null | -| created_at? | number \| null | -| timestamps? | [Timestamp](/docs/developer-tools/embedded-app-sdk#timestamp) \| null | -| application_id? | string \| null | -| details? | string \| null | -| details_url? | string \| null | -| state? | string \| null | -| state_url? | string \| null | -| emoji? | [Emoji](/docs/developer-tools/embedded-app-sdk#emoji) \| null | -| party? | [Party](/docs/developer-tools/embedded-app-sdk#party) \| null | -| assets? | [Assets](/docs/developer-tools/embedded-app-sdk#assets) \| null | -| secrets? | [Secrets](/docs/developer-tools/embedded-app-sdk#secrets) \| null | -| instance? | boolean \| null | -| flags? | number \| null | +| Property | Type | +|-----------------|----------------------------------------------------------------------------------| +| name | string | +| type | number | +| url? | string \| null | +| created_at? | number \| null | +| timestamps? | [Timestamp](/developers/docs/developer-tools/embedded-app-sdk#timestamp) \| null | +| application_id? | string \| null | +| details? | string \| null | +| details_url? | string \| null | +| state? | string \| null | +| state_url? | string \| null | +| emoji? | [Emoji](/developers/docs/developer-tools/embedded-app-sdk#emoji) \| null | +| party? | [Party](/developers/docs/developer-tools/embedded-app-sdk#party) \| null | +| assets? | [Assets](/developers/docs/developer-tools/embedded-app-sdk#assets) \| null | +| secrets? | [Secrets](/developers/docs/developer-tools/embedded-app-sdk#secrets) \| null | +| instance? | boolean \| null | +| flags? | number \| null | #### Assets @@ -1194,25 +1209,25 @@ Coming soon! Not available during Developer Preview #### AuthenticateResponse -| Property | Type | -|--------------|-------------------------------------------------------------------| -| access_token | string | -| user | [User](/docs/developer-tools/embedded-app-sdk#user) | -| scopes | string[] | -| expires | string | -| application | [Application](/docs/developer-tools/embedded-app-sdk#application) | +| Property | Type | +|--------------|------------------------------------------------------------------------------| +| access_token | string | +| user | [User](/developers/docs/developer-tools/embedded-app-sdk#user) | +| scopes | string[] | +| expires | string | +| application | [Application](/developers/docs/developer-tools/embedded-app-sdk#application) | #### AuthorizeRequest -| Property | Type | -|------------------------|---------------------------------------------------------------------| -| client_id | string | -| scope | [OAuthScopes](/docs/developer-tools/embedded-app-sdk#oauthscopes)[] | -| response_type? | 'code' | -| code_challenge? | string | -| state? | string | -| prompt? | 'none' | -| code_challenge_method? | 'S256' | +| Property | Type | +|------------------------|--------------------------------------------------------------------------------| +| client_id | string | +| scope | [OAuthScopes](/developers/docs/developer-tools/embedded-app-sdk#oauthscopes)[] | +| response_type? | 'code' | +| code_challenge? | string | +| state? | string | +| prompt? | 'none' | +| code_challenge_method? | 'S256' | #### AuthorizeResponse @@ -1229,10 +1244,10 @@ Coming soon! Not available during Developer Preview #### CaptureLogRequest -| Property | Type | -|----------|---------------------------------------------------------------------| -| level | [ConsoleLevel](/docs/developer-tools/embedded-app-sdk#consolelevel) | -| message | string | +| Property | Type | +|----------|--------------------------------------------------------------------------------| +| level | [ConsoleLevel](/developers/docs/developer-tools/embedded-app-sdk#consolelevel) | +| message | string | #### ChannelMention @@ -1245,21 +1260,21 @@ Coming soon! Not available during Developer Preview #### Embed -| Property | Type | -|--------------|-------------------------------------------------------------------------------| -| title? | string \| null | -| type? | string \| null | -| description? | string \| null | -| url? | string \| null | -| timestamp? | string \| null | -| color? | number \| null | -| footer? | [EmbedFooter](/docs/developer-tools/embedded-app-sdk#embedfooter) \| null | -| image? | Image \| null | -| thumbnail? | Image \| null | -| video? | Video \| null | -| provider? | [EmbedProvider](/docs/developer-tools/embedded-app-sdk#embedprovider) \| null | -| author? | [EmbedAuthor](/docs/developer-tools/embedded-app-sdk#embedauthor) \| null | -| fields? | [EmbedField](/docs/developer-tools/embedded-app-sdk#embedfield)[] \| null | +| Property | Type | +|--------------|------------------------------------------------------------------------------------------| +| title? | string \| null | +| type? | string \| null | +| description? | string \| null | +| url? | string \| null | +| timestamp? | string \| null | +| color? | number \| null | +| footer? | [EmbedFooter](/developers/docs/developer-tools/embedded-app-sdk#embedfooter) \| null | +| image? | Image \| null | +| thumbnail? | Image \| null | +| video? | Video \| null | +| provider? | [EmbedProvider](/developers/docs/developer-tools/embedded-app-sdk#embedprovider) \| null | +| author? | [EmbedAuthor](/developers/docs/developer-tools/embedded-app-sdk#embedauthor) \| null | +| fields? | [EmbedField](/developers/docs/developer-tools/embedded-app-sdk#embedfield)[] \| null | #### EmbedAuthor @@ -1295,16 +1310,16 @@ Coming soon! Not available during Developer Preview #### Emoji -| Property | Type | -|-----------------|-------------------------------------------------------------| -| id | string | -| name? | string \| null | -| roles? | string[] \| null | -| user? | [User](/docs/developer-tools/embedded-app-sdk#user) \| null | -| require_colons? | boolean \| null | -| managed? | boolean \| null | -| animated? | boolean \| null | -| available? | boolean \| null | +| Property | Type | +|-----------------|------------------------------------------------------------------------| +| id | string | +| name? | string \| null | +| roles? | string[] \| null | +| user? | [User](/developers/docs/developer-tools/embedded-app-sdk#user) \| null | +| require_colons? | boolean \| null | +| managed? | boolean \| null | +| animated? | boolean \| null | +| available? | boolean \| null | #### EncourageHardwareAccelerationResponse @@ -1345,30 +1360,30 @@ Coming soon! Not available during Developer Preview #### GetChannelResponse -| Property | Type | -|--------------|---------------------------------------------------------------------------------| -| id | string | -| type | [ChannelTypesObject](/docs/developer-tools/embedded-app-sdk#channeltypesobject) | -| guild_id? | string \| null | -| name? | string \| null | -| topic? | string \| null | -| bitrate? | number \| null | -| user_limit? | number \| null | -| position? | number \| null | -| voice_states | [UserVoiceState](/docs/developer-tools/embedded-app-sdk#uservoicestate)[] | -| messages | [Message](/docs/developer-tools/embedded-app-sdk#message)[] | +| Property | Type | +|--------------|--------------------------------------------------------------------------------------------| +| id | string | +| type | [ChannelTypesObject](/developers/docs/developer-tools/embedded-app-sdk#channeltypesobject) | +| guild_id? | string \| null | +| name? | string \| null | +| topic? | string \| null | +| bitrate? | number \| null | +| user_limit? | number \| null | +| position? | number \| null | +| voice_states | [UserVoiceState](/developers/docs/developer-tools/embedded-app-sdk#uservoicestate)[] | +| messages | [Message](/developers/docs/developer-tools/embedded-app-sdk#message)[] | #### GetEntitlementsResponse -| Property | Type | -|--------------|---------------------------------------------------------------------| -| entitlements | [Entitlement](/docs/developer-tools/embedded-app-sdk#entitlement)[] | +| Property | Type | +|--------------|--------------------------------------------------------------------------------| +| entitlements | [Entitlement](/developers/docs/developer-tools/embedded-app-sdk#entitlement)[] | #### GetInstanceConnectedParticipantsResponse -| Property | Type | -|--------------|-------------------------------------------------------| -| participants | [User](/docs/developer-tools/embedded-app-sdk#user)[] | +| Property | Type | +|--------------|------------------------------------------------------------------| +| participants | [User](/developers/docs/developer-tools/embedded-app-sdk#user)[] | #### GetPlatformBehaviorsResponse @@ -1378,37 +1393,37 @@ Coming soon! Not available during Developer Preview #### GetRelationshipsResponse -| Property | Type | -|---------------|-----------------------------------------------------------------------| -| relationships | [Relationship](/docs/developer-tools/embedded-app-sdk#relationship)[] | +| Property | Type | +|---------------|----------------------------------------------------------------------------------| +| relationships | [Relationship](/developers/docs/developer-tools/embedded-app-sdk#relationship)[] | #### GetSkusResponse -| Property | Type | -|----------|-----------------------------------------------------| -| skus | [Sku](/docs/developer-tools/embedded-app-sdk#sku)[] | +| Property | Type | +|----------|----------------------------------------------------------------| +| skus | [Sku](/developers/docs/developer-tools/embedded-app-sdk#sku)[] | #### GuildMember -| Property | Type | -|-----------|-----------------------------------------------------| -| user | [User](/docs/developer-tools/embedded-app-sdk#user) | -| nick? | string \| null | -| roles | string[] | -| joined_at | string | -| deaf | boolean | -| mute | boolean | +| Property | Type | +|-----------|----------------------------------------------------------------| +| user | [User](/developers/docs/developer-tools/embedded-app-sdk#user) | +| nick? | string \| null | +| roles | string[] | +| joined_at | string | +| deaf | boolean | +| mute | boolean | #### GuildMemberRPC -| Property | Type | -|-------------------------|---------------------------------------------------------------------------------------------| -| user_id | string | -| nick? | string \| null | -| guild_id | string | -| avatar? | string \| null | -| avatar_decoration_data? | [AvatarDecorationData](/docs/developer-tools/embedded-app-sdk#avatardecorationdata) \| null | -| color_string? | string \| null | +| Property | Type | +|-------------------------|--------------------------------------------------------------------------------------------------------| +| user_id | string | +| nick? | string \| null | +| guild_id | string | +| avatar? | string \| null | +| avatar_decoration_data? | [AvatarDecorationData](/developers/docs/developer-tools/embedded-app-sdk#avatardecorationdata) \| null | +| color_string? | string \| null | #### Image @@ -1427,34 +1442,34 @@ Coming soon! Not available during Developer Preview #### Message -| Property | Type | -|-------------------|---------------------------------------------------------------------------| -| id | string | -| channel_id | string | -| guild_id? | string \| null | -| author? | [User](/docs/developer-tools/embedded-app-sdk#user) \| null | -| member? | [GuildMember](/docs/developer-tools/embedded-app-sdk#guildmember) \| null | -| content | string | -| timestamp | string | -| edited_timestamp? | string \| null | -| tts | boolean | -| mention_everyone | boolean | -| mentions | [User](/docs/developer-tools/embedded-app-sdk#user)[] | -| mention_roles | string[] | -| mention_channels | [ChannelMention](/docs/developer-tools/embedded-app-sdk#channelmention)[] | -| attachments | [Attachment](/docs/developer-tools/embedded-app-sdk#attachment)[] | -| embeds | [Embed](/docs/developer-tools/embedded-app-sdk#embed)[] | -| reactions? | [Reaction](/docs/developer-tools/embedded-app-sdk#reaction)[] \| null | +| Property | Type | +|-------------------|--------------------------------------------------------------------------------------| +| id | string | +| channel_id | string | +| guild_id? | string \| null | +| author? | [User](/developers/docs/developer-tools/embedded-app-sdk#user) \| null | +| member? | [GuildMember](/developers/docs/developer-tools/embedded-app-sdk#guildmember) \| null | +| content | string | +| timestamp | string | +| edited_timestamp? | string \| null | +| tts | boolean | +| mention_everyone | boolean | +| mentions | [User](/developers/docs/developer-tools/embedded-app-sdk#user)[] | +| mention_roles | string[] | +| mention_channels | [ChannelMention](/developers/docs/developer-tools/embedded-app-sdk#channelmention)[] | +| attachments | [Attachment](/developers/docs/developer-tools/embedded-app-sdk#attachment)[] | +| embeds | [Embed](/developers/docs/developer-tools/embedded-app-sdk#embed)[] | +| reactions? | [Reaction](/developers/docs/developer-tools/embedded-app-sdk#reaction)[] \| null | | nonce? | string | number \| null | | pinned | boolean | | webhook_id? | string \| null | | type | number | -| activity? | [MessageActivity](/docs/developer-tools/embedded-app-sdk#messageactivity) \| null | -| application? | [MessageApplication](/docs/developer-tools/embedded-app-sdk#messageapplication) \| null | -| message_reference? | [MessageReference](/docs/developer-tools/embedded-app-sdk#messagereference) \| null | +| activity? | [MessageActivity](/developers/docs/developer-tools/embedded-app-sdk#messageactivity) \| null | +| application? | [MessageApplication](/developers/docs/developer-tools/embedded-app-sdk#messageapplication) \| null | +| message_reference? | [MessageReference](/developers/docs/developer-tools/embedded-app-sdk#messagereference) \| null | | flags? | number | | stickers? | Sticker[] \| null | -| referenced_message? | [Message](/docs/developer-tools/embedded-app-sdk#message) \| null | +| referenced_message? | [Message](/developers/docs/developer-tools/embedded-app-sdk#message) \| null | #### MessageActivity @@ -1489,9 +1504,9 @@ Coming soon! Not available during Developer Preview #### OpenExternalLinkResponse -:::warn + `{ opened: null }` is returned on Discord clients before December 2024 that do not report the open link result. -::: + | Property | Type | |----------|-----------------| @@ -1512,18 +1527,18 @@ Coming soon! Not available during Developer Preview #### Reaction -| Property | Type | -|----------|-------------------------------------------------------| -| count | number | -| me | boolean | -| emoji | [Emoji](/docs/developer-tools/embedded-app-sdk#emoji) | +| Property | Type | +|----------|------------------------------------------------------------------| +| count | number | +| me | boolean | +| emoji | [Emoji](/developers/docs/developer-tools/embedded-app-sdk#emoji) | #### Relationship -| Property | Type | -|----------|---------------------------------------------------------------------| -| type | [number](/docs/developer-tools/embedded-app-sdk#relationship-types) | -| user | [User](/docs/developer-tools/embedded-app-sdk#user) | +| Property | Type | +|----------|--------------------------------------------------------------------------------| +| type | [number](/developers/docs/developer-tools/embedded-app-sdk#relationship-types) | +| user | [User](/developers/docs/developer-tools/embedded-app-sdk#user) | #### Secrets @@ -1534,9 +1549,9 @@ Coming soon! Not available during Developer Preview #### SetActivityRequest -| Property | Type | -|----------|-------------------------------------------------------------| -| activity | [Activity](/docs/developer-tools/embedded-app-sdk#activity) | +| Property | Type | +|----------|------------------------------------------------------------------------| +| activity | [Activity](/developers/docs/developer-tools/embedded-app-sdk#activity) | #### SetConfigRequest @@ -1552,11 +1567,11 @@ Coming soon! Not available during Developer Preview #### SetOrientationLockStateRequest -| Property | Type | -|-------------------------------|-----------------------------------------------------------------------------------------------| -| lock_state | [OrientationLockState](/docs/developer-tools/embedded-app-sdk#orientationlockstatetypeobject) | -| picture_in_picture_lock_state | [OrientationLockState](/docs/developer-tools/embedded-app-sdk#orientationlockstatetypeobject) | -| grid_lock_state | [OrientationLockState](/docs/developer-tools/embedded-app-sdk#orientationlockstatetypeobject) | +| Property | Type | +|-------------------------------|----------------------------------------------------------------------------------------------------------| +| lock_state | [OrientationLockState](/developers/docs/developer-tools/embedded-app-sdk#orientationlockstatetypeobject) | +| picture_in_picture_lock_state | [OrientationLockState](/developers/docs/developer-tools/embedded-app-sdk#orientationlockstatetypeobject) | +| grid_lock_state | [OrientationLockState](/developers/docs/developer-tools/embedded-app-sdk#orientationlockstatetypeobject) | #### ShareLinkRequest @@ -1573,15 +1588,15 @@ Coming soon! Not available during Developer Preview #### Sku -| Property | Type | -|----------------|-----------------------------------------------------------------------| -| id | string | -| name | string | -| type | [SkuTypeObject](/docs/developer-tools/embedded-app-sdk#skutypeobject) | -| price | [SkuPrice](/docs/developer-tools/embedded-app-sdk#skuprice) | -| application_id | string | -| flags | number | -| release_date | string \| null | +| Property | Type | +|----------------|----------------------------------------------------------------------------------| +| id | string | +| name | string | +| type | [SkuTypeObject](/developers/docs/developer-tools/embedded-app-sdk#skutypeobject) | +| price | [SkuPrice](/developers/docs/developer-tools/embedded-app-sdk#skuprice) | +| application_id | string | +| flags | number | +| release_date | string \| null | #### SkuPrice @@ -1598,9 +1613,9 @@ Coming soon! Not available during Developer Preview #### StartPurchaseResponse -| Value | -|-----------------------------------------------------------------------------| -| [Entitlement](/docs/developer-tools/embedded-app-sdk#entitlement)[] \| null | +| Value | +|----------------------------------------------------------------------------------------| +| [Entitlement](/developers/docs/developer-tools/embedded-app-sdk#entitlement)[] \| null | #### Timestamp @@ -1611,17 +1626,17 @@ Coming soon! Not available during Developer Preview #### User -| Property | Type | -|------------------------|---------------------------------------------------------------------------------------------| -| id | string | -| username | string | -| discriminator | string | -| global_name? | string \| null | -| avatar? | string \| null | -| avatar_decoration_data | [AvatarDecorationData](/docs/developer-tools/embedded-app-sdk#avatardecorationdata) \| null | -| bot | boolean | -| flags? | number \| null | -| premium_type? | number \| null | +| Property | Type | +|------------------------|--------------------------------------------------------------------------------------------------------| +| id | string | +| username | string | +| discriminator | string | +| global_name? | string \| null | +| avatar? | string \| null | +| avatar_decoration_data | [AvatarDecorationData](/developers/docs/developer-tools/embedded-app-sdk#avatardecorationdata) \| null | +| bot | boolean | +| flags? | number \| null | +| premium_type? | number \| null | #### UserSettingsGetLocaleResponse @@ -1631,13 +1646,13 @@ Coming soon! Not available during Developer Preview #### UserVoiceState -| Property | Type | -|-------------|-----------------------------------------------------------------| -| mute | boolean | -| nick | string | -| user | [User](/docs/developer-tools/embedded-app-sdk#user) | -| voice_state | [VoiceState](/docs/developer-tools/embedded-app-sdk#voicestate) | -| volume | number | +| Property | Type | +|-------------|----------------------------------------------------------------------------| +| mute | boolean | +| nick | string | +| user | [User](/developers/docs/developer-tools/embedded-app-sdk#user) | +| voice_state | [VoiceState](/developers/docs/developer-tools/embedded-app-sdk#voicestate) | +| volume | number | #### Video diff --git a/docs/developer-tools/game-sdk.mdx b/discord/developers/docs/developer-tools/game-sdk.mdx similarity index 85% rename from docs/developer-tools/game-sdk.mdx rename to discord/developers/docs/developer-tools/game-sdk.mdx index a14d246949..196cd5703f 100644 --- a/docs/developer-tools/game-sdk.mdx +++ b/discord/developers/docs/developer-tools/game-sdk.mdx @@ -1,14 +1,16 @@ +--- +title: Game SDK +tag: "LEGACY" +description: Legacy Game SDK documentation for integrating games with Discord. +--- - -# Game SDK - -:::warn + **The Game SDK has been archived.** -We recommend using the [Discord Social SDK](/docs/discord-social-sdk/overview) for new projects. +We recommend using the [Discord Social SDK](/developers/docs/discord-social-sdk/overview) for new projects. -Existing projects using the Game SDK will continue to work, but we encourage you to migrate to the [Discord Social SDK](/docs/discord-social-sdk/overview) for new features and updates. -::: +Existing projects using the Game SDK will continue to work, but we encourage you to migrate to the [Discord Social SDK](/developers/docs/discord-social-sdk/overview) for new features and updates. + Welcome to the documentation for the Discord Game SDK! We're glad you made it. The Game SDK helps you develop your 3rd party game or app, and integrate it with Discord. @@ -16,7 +18,7 @@ Welcome to the documentation for the Discord Game SDK! We're glad you made it. T ## Getting Started -This section will walk you through the first few steps you need to take to get up-and-running with the Game SDK. After you download the SDK and configure your app, you can find more details in the [Using the SDK section](/docs/developer-tools/game-sdk#using-the-sdk). +This section will walk you through the first few steps you need to take to get up-and-running with the Game SDK. After you download the SDK and configure your app, you can find more details in the [Using the SDK section](/developers/docs/developer-tools/game-sdk#using-the-sdk). ### Step 1: Get the SDK @@ -31,15 +33,15 @@ These files are comprised of two parts: a "stub", and fallback modules. What tha ### Step 2: Create your App -Next, we need to set up the application for your game. An [app](/docs/resources/application) is the base "entity" in Discord for your game. +Next, we need to set up the application for your game. An [app](/developers/docs/resources/application) is the base "entity" in Discord for your game. Head over to our [developer site](https://discord.com/developers/) and create an account/log in if you haven't yet. The first thing we're going to do is create a Team. Teams are groups of developers working together on applications; you should create a team for your organization at [https://discord.com/developers/teams](https://discord.com/developers/teams). You can invite other users to join your team and work on applications together with you. Now that your team is created, you'll want to make an application. To do so, click on "Applications" at the top of the page and create an application. Make sure you pick your newly-created team in the `Team` dropdown. You want your team to own the application! Now that your app is made, let's dive into some more setup. -:::warn + If you're integrating our SDK into an already-released game, there's a good chance that we may _already have_ an application in our database for your game! Reach out to our [Dev Support](https://dis.gd/devsupport) to learn more -::: + First, we'll need to set an OAuth2 redirect URL. You can add `http://127.0.0.1` in there for now; this powers some behind-the-scenes stuff you don't need to worry about. @@ -56,7 +58,7 @@ Before you start developing, there are a couple of notes to keep in mind about t With that out of the way, let's start coding. Didn't think we'd get there so fast, did ya? _Think again!_ The dropdowns are code primers for the main languages of the SDK: C#, C, and C++. They'll get you up and running with the most basic examples, and then you're off to the races. - + - Open up that SDK zip that you downloaded. - Copy the contents of the `lib/` folder to `Assets/Plugins` in your Unity project - Copy the contents of the `csharp/` folder to `Assets/Plugins/DiscordGame SDK` @@ -80,9 +82,9 @@ var discord = new Discord.Discord(CLIENT_ID, (UInt64)Discord.CreateFlags.Default You're now free to use other functionality in the SDK! Make sure to call `discord.RunCallbacks()` in your main game loop; that's your `Update()` function. You're ready to go! Check out the rest of the documentation for more info on how to use the other pieces of the SDK. See an example of everything it can do in `examples/Program.cs` in the SDK zip file. - + - + - Open up that SDK zip that you downloaded. - Create a folder in your project directory called `DiscordGame SDK` and copy the contents of the `csharp/` folder to it - Build your solution then place the `.dll` in the directory of the `.exe` (either x86 or x86_64 version depending on your compile platform). If you compile for Any CPU you may need to perform additional wrapping around DLL importing (like setting the DLL directory dynamically) to make sure you load the correct DLL. @@ -106,9 +108,9 @@ var discord = new Discord.Discord(CLIENT_ID, (UInt64)Discord.CreateFlags.Default You're now free to use other functionality in the SDK! Make sure to call `discord.RunCallbacks()` in your main game loop; that's your `Update()` function. You're ready to go! Check out the rest of the documentation for more info on how to use the other pieces of the SDK. See an example of everything it can do in `examples/Program.cs` in the SDK zip file. - + - + Before jumping into the C binding, a word of caution. If you are using Unreal Engine 3, or need to support an older version of Visual Studio, you may at first see some unexpected crashes due to compile configurations. The way to fix this is to wrap the include statement for the Discord Game SDK header file like so: ```c @@ -149,9 +151,9 @@ DiscordCreate(DISCORD_VERSION, ¶ms, &app.core); - Make sure to call `core->run_callbacks(core, 0)` in your game loop. You're ready to go! Check out the rest of the documentation for more info on how to use the other pieces of the SDK. See an example of everything it can do in `examples/c/main.c` in the SDK zip file. - + - + First, you'll want to copy the header files and `.cpp` files to a folder somewhere in your project directory. For ease of a quickstart example, you can put them right inside your `Source/your-project-name` folder; I'd put them in a containing folder called something like `discord-files/`. Second, you'll want to copy the `.dll` and `.lib` files from the `lib/x86_64` folder of the downloaded zip. These files should be put in `your-project-name/Binaries/Win64/`. For win32, take the files from `x86/` and put them, in `your-project-name/Binaries/Win32`. @@ -232,20 +234,20 @@ void AMyPawn::SetupPlayerInputComponent(UInputComponent* PlayerInputComponent) Make sure you've got `core->RunCallbacks()` going every frame! You're ready to go! Check out the rest of the documentation for more info on how to use the other pieces of the SDK. See an example of everything it can do in `examples/cpp/main.cpp` in the SDK zip file. - + - + In your project folder, you'll want to make something like a "discord-files" folder, for organization. In that folder, copy all the `.h` and `.cpp` files from the zip. You want to include all the header and source files respectively in your project -![Correct Files](images/cpp-files-sdk.webp) +![Correct Files](/images/cpp-files-sdk.png) In your project settings, you'll want to include the relevant library (e.g. `discord_game_sdk.dll.lib`) as an additional dependency. -![Linked Library](images/lib-linked-sdk.webp) +![Linked Library](/images/lib-linked-sdk.png) - From there, you should be able to `#include "discord-files/discord.h"`, or whatever the path to that header file is, and have access to the code. - + ## Using the SDK @@ -257,11 +259,11 @@ This class is in charge of the creation of a few "manager" sub-classes to intera Each manager class contains its own functions and events used to interact with Discord in the context of the manager: -| Name | Description | -|----------------------------------------------------------------|------------------------------------------------------------| -| [`ActivityManager`](/docs/developer-tools/game-sdk#activities) | for Rich Presence and game invites | -| [`OverlayManager`](/docs/developer-tools/game-sdk#overlay) | for interacting with Discord's built-in overlay | -| [`UserManager`](/docs/developer-tools/game-sdk#users) | for fetching user data for a given id and the current user | +| Name | Description | +|---------------------------------------------------------------------------|------------------------------------------------------------| +| [`ActivityManager`](/developers/docs/developer-tools/game-sdk#activities) | for Rich Presence and game invites | +| [`OverlayManager`](/developers/docs/developer-tools/game-sdk#overlay) | for interacting with Discord's built-in overlay | +| [`UserManager`](/developers/docs/developer-tools/game-sdk#users) | for fetching user data for a given id and the current user | ### Using Functions in the SDK @@ -269,7 +271,7 @@ Most functions in the Discord Game SDK, uh, _function_ in a similar way. They ta Some functions behave with a normal return behavior; e.g. `RelationshipManager.Count()` just returns the number directly. Don't worry, it's outlined in the docs. - + ```c# var userManager = discord.GetUserManager(); @@ -295,24 +297,24 @@ userManager.OnCurrentUserUpdate += () => }; ``` - + ### Environment Variables Discord passes a number of environment variables down to the SDK. These are accessed by various functions in the SDK and can be changed for local testing by changing the value in your local environment. -| name | method | description | -|------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------| -| DISCORD_INSTANCE_ID | [Local Testing](/docs/developer-tools/game-sdk#testing-locally) | the locally running instance of Discord to connect to; allows you to choose between multiple running clients | -| DISCORD_ACCESS_TOKEN | [ApplicationManager.GetOAuth2Token()](https://github.com/discord/discord-api-docs/blob/legacy-gamesdk/docs/game_sdk/Applications.md#getoauth2token) | the connected user's bearer token | -| DISCORD_CURRENT_LOCALE | [ApplicationManager.GetCurrentLocale()](https://github.com/discord/discord-api-docs/blob/legacy-gamesdk/docs/game_sdk/Applications.md#getcurrentlocale) | the language that Discord is in for the connected user | -| DISCORD_CURRENT_BRANCH | [ApplicationManager.GetCurrentBranch()](https://github.com/discord/discord-api-docs/blob/legacy-gamesdk/docs/game_sdk/Applications.md#getcurrentbranch) | the branch of the running application that the user has launched | +| name | method | description | +|------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------| +| DISCORD_INSTANCE_ID | [Local Testing](/developers/docs/developer-tools/game-sdk#testing-locally) | the locally running instance of Discord to connect to; allows you to choose between multiple running clients | +| DISCORD_ACCESS_TOKEN | [ApplicationManager.GetOAuth2Token()](https://github.com/discord/discord-api-docs/blob/legacy-gamesdk/developers/docs/game_sdk/Applications.md#getoauth2token) | the connected user's bearer token | +| DISCORD_CURRENT_LOCALE | [ApplicationManager.GetCurrentLocale()](https://github.com/discord/discord-api-docs/blob/legacy-gamesdk/developers/docs/game_sdk/Applications.md#getcurrentlocale) | the language that Discord is in for the connected user | +| DISCORD_CURRENT_BRANCH | [ApplicationManager.GetCurrentBranch()](https://github.com/discord/discord-api-docs/blob/legacy-gamesdk/developers/docs/game_sdk/Applications.md#getcurrentbranch) | the branch of the running application that the user has launched | ### Error Handling Debugging is a pain, so before we get into the meat of the SDK, we want to make sure you're prepared for when things go awry. Within the Discord core is a function called `SetLogHook()`. It takes a `level`, which is minimum level of log message you want to listen to, and a callback function: - + ```cs public void LogProblemsFunction(Discord.LogLevel level, string message) @@ -324,7 +326,7 @@ discord.SetLogHook(Discord.LogLevel.Debug, LogProblemsFunction); ``` You should begin your integration by setting up this callback to help you debug. Helpfully, if you put a breakpoint inside the callback function you register here, you'll be able to see the stack trace for errors you run into (as long as they fail synchronously). Take the guess work out of debugging, or hey, ignore any and all logging by setting a callback that does nothing. We're not here to judge. - + ### Testing Locally @@ -332,11 +334,11 @@ While integrating the Discord Game SDK, you will probably find yourself wanting We know that getting a test build of a game on two separate machines can be both difficult and cumbersome. So, we've got a solution for you! - + -:::info + Value from environment variable `DISCORD_INSTANCE_ID` -::: + By using system environment variables, you can tell the SDK in a certain game client to connect to a specific Discord client. Here's how it works: @@ -363,18 +365,17 @@ var discord = new Discord(applicationId, Discord.CreateFlags.Default); This will set the environment variable only within the context of the running process, so don't worry about messing up global stuff. -:::danger + If you test with this, make sure to remove this code before pushing a production build. It will interfere with the way that Discord launches games for users. -::: + - + ### Data Models #### Result Enum - - + | Code | value | description | |------|---------------------------------|-------------------------------------------------------------------------------------------------| @@ -423,11 +424,11 @@ If you test with this, make sure to remove this code before pushing a production | 42 | PurchaseError | something went wrong during the purchase flow | | 43 | TransactionAborted | purchase flow aborted because the SDK is being torn down | - + #### LogLevel Enum - + | value | description | |---------|--------------------------------| @@ -436,18 +437,18 @@ If you test with this, make sure to remove this code before pushing a production | Info | Log info, warnings, and errors | | Debug | Log _all_ the things! | - + #### CreateFlags Enum - + | value | description | |------------------|---------------------------------------------------------------------| | Default | Requires Discord to be running to play the game | | NoRequireDiscord | Does not require Discord to be running, use this on other platforms | - + ### Functions @@ -479,9 +480,9 @@ var discord = new Discord(53908232506183680, (UInt64)Discord.CreateFlags.Default Destroys the instance. Wave goodbye, Nelly! You monster. In C# land, this is `Dispose()`. -:::info + The C++ binding does not include a `destroy()` method, as the destructor for the Core does the work for you. -::: + Returns `void`. @@ -574,13 +575,13 @@ var overlayManager = discord.GetOverlayManager(); ## Activities -:::info -Looking to build a game inside of Discord? Check out the (other) [Activities](/docs/activities/overview) and the [Embedded SDK](/docs/developer-tools/embedded-app-sdk) documentation. -::: + +Looking to build a game inside of Discord? Check out the (other) [Activities](/developers/docs/activities/overview) and the [Embedded SDK](/developers/docs/developer-tools/embedded-app-sdk) documentation. + Looking to integrate Rich Presence into your game? No need to manage multiple SDKs—this one does all that awesome stuff, too! Delight your players with the ability to post game invites in chat and party up directly from Discord. Surface interesting live game data in their profile for their friends, encouraging them to group up and play together. -For more detailed information and documentation around the Rich Presence feature set and integration tips, check out our [Rich Presence Documentation](/docs/rich-presence/overview). +For more detailed information and documentation around the Rich Presence feature set and integration tips, check out our [Rich Presence Documentation](/developers/docs/rich-presence/overview). ### Data Models @@ -596,17 +597,17 @@ For more detailed information and documentation around the Rich Presence feature #### Activity Struct -| name | type | description | -|---------------|---------------------------------------------------------------------------------|-----------------------------------------------------------------| -| applicationId | Int64 | your application id - this is a read-only field | -| name | string | name of the application - this is a read-only field | -| state | string | the player's current party status | -| details? | ?string | what the player is currently doing | -| timestamps? | ?[ActivityTimestamps](/docs/developer-tools/game-sdk#activitytimestamps-struct) | helps create elapsed/remaining timestamps on a player's profile | -| assets? | ?[ActivityAssets](/docs/developer-tools/game-sdk#activityassets-struct) | assets to display on the player's profile | -| party? | ?[ActivityParty](/docs/developer-tools/game-sdk#activityparty-struct) | information about the player's party | -| secrets? | ?[ActivitySecrets](/docs/developer-tools/game-sdk#activitysecrets-struct) | secret passwords for joining and spectating the player's game | -| instance? | ?bool | whether this activity is an instanced context, like a match | +| name | type | description | +|---------------|--------------------------------------------------------------------------------------------|-----------------------------------------------------------------| +| applicationId | Int64 | your application id - this is a read-only field | +| name | string | name of the application - this is a read-only field | +| state | string | the player's current party status | +| details? | ?string | what the player is currently doing | +| timestamps? | ?[ActivityTimestamps](/developers/docs/developer-tools/game-sdk#activitytimestamps-struct) | helps create elapsed/remaining timestamps on a player's profile | +| assets? | ?[ActivityAssets](/developers/docs/developer-tools/game-sdk#activityassets-struct) | assets to display on the player's profile | +| party? | ?[ActivityParty](/developers/docs/developer-tools/game-sdk#activityparty-struct) | information about the player's party | +| secrets? | ?[ActivitySecrets](/developers/docs/developer-tools/game-sdk#activitysecrets-struct) | secret passwords for joining and spectating the player's game | +| instance? | ?bool | whether this activity is an instanced context, like a match | #### ActivityTimestamps Struct @@ -617,12 +618,12 @@ For more detailed information and documentation around the Rich Presence feature #### ActivityAssets Struct -| name | type | description | -|-------------|---------|----------------------------------------------------------------------------------------------| -| largeImage? | ?string | see [Activity Asset Image](/docs/events/gateway-events#activity-object-activity-asset-image) | -| largeText? | ?string | hover text for the large image | -| smallImage? | ?string | see [Activity Asset Image](/docs/events/gateway-events#activity-object-activity-asset-image) | -| smallText? | ?string | hover text for the small image | +| name | type | description | +|-------------|---------|---------------------------------------------------------------------------------------------------------| +| largeImage? | ?string | see [Activity Asset Image](/developers/docs/events/gateway-events#activity-object-activity-asset-image) | +| largeText? | ?string | hover text for the large image | +| smallImage? | ?string | see [Activity Asset Image](/developers/docs/events/gateway-events#activity-object-activity-asset-image) | +| smallText? | ?string | hover text for the small image | #### ActivityParty Struct @@ -657,7 +658,7 @@ For more detailed information and documentation around the Rich Presence feature | Custom | 4 | | Competing | 5 | -For more details about the activity types, [see Gateway documentation](/docs/events/gateway-events#activity-object-activity-types). +For more details about the activity types, [see Gateway documentation](/developers/docs/events/gateway-events#activity-object-activity-types). `ActivityType` is strictly for the purpose of handling events that you receive from Discord; though the SDK will not reject a payload with an `ActivityType` sent, it will be discarded and will not change anything in the client. @@ -681,7 +682,7 @@ For more details about the activity types, [see Gateway documentation](/docs/eve If you want to hook up joining and spectating for your games, there are certain fields in the activity payload that need to be sent. Refer to the following handy table for what needs to be set for certain actions. - + | Field | Custom Artwork | Spectate | Join | Ask to Join | |--------------------------------|:--------------:|:--------:|:----:|:-----------:| @@ -699,7 +700,7 @@ If you want to hook up joining and spectating for your games, there are certain | ActivitySecrets.join | | | x | x | | ActivitySecrets.spectate | | x | | | - + ### Functions @@ -745,9 +746,9 @@ activityManager.RegisterSteam(1938123); Sets a user's presence in Discord to a new activity. This has a rate limit of 5 updates per 20 seconds. -:::info + It is possible for users to hide their presence on Discord (User Settings -> Game Activity). Presence set through this SDK may not be visible when this setting is toggled off. -::: + Returns a `Discord.Result` via callback. @@ -759,7 +760,7 @@ Returns a `Discord.Result` via callback. ###### Example - + ```cs var activity = new Discord.Activity @@ -807,7 +808,7 @@ activityManager.UpdateActivity(activity, (result) => }); ``` - + #### ClearActivity @@ -817,7 +818,7 @@ Results a `Discord.Result` via callback. ###### Example - + ```cs activityManager.ClearActivity((result) => @@ -833,7 +834,7 @@ activityManager.ClearActivity((result) => }); ``` - + #### SendRequestReply @@ -850,7 +851,7 @@ Returns a `Discord.Result` via callback. ###### Example - + ```cs activityManager.OnActivityJoinRequest += user => @@ -865,11 +866,11 @@ activityManager.OnActivityJoinRequest += user => }); } ``` - + #### SendInvite -Sends a game invite to a given user. If you do not have a valid activity with all the required fields, this call will error. See [Activity Action Field Requirements](/docs/developer-tools/game-sdk#activity-action-field-requirements) for the fields required to have join and spectate invites function properly. +Sends a game invite to a given user. If you do not have a valid activity with all the required fields, this call will error. See [Activity Action Field Requirements](/developers/docs/developer-tools/game-sdk#activity-action-field-requirements) for the fields required to have join and spectate invites function properly. Returns a `Discord.Result` via callback. @@ -883,7 +884,7 @@ Returns a `Discord.Result` via callback. ###### Example - + ```cs var userId = 53908232506183680; @@ -899,7 +900,7 @@ activityManager.SendInvite(userId, Discord.ActivityActionType.Join, "Come play!" } }); ``` - + #### AcceptInvite @@ -915,7 +916,7 @@ Returns a `Discord.Result` via callback. ###### Example - + ```cs activityManager.AcceptInvite(290926444748734466, (result) => @@ -930,7 +931,7 @@ activityManager.AcceptInvite(290926444748734466, (result) => } }); ``` - + ### Events @@ -946,7 +947,7 @@ Fires when a user accepts a game chat invite or receives confirmation from Askin ###### Example - + ```cs // Received when someone accepts a request to join or invite. @@ -1011,7 +1012,7 @@ void UpdateActivity(Discord.Discord discord) }); } ``` - + #### OnActivitySpectate @@ -1025,7 +1026,7 @@ Fires when a user accepts a spectate chat invite or clicks the Spectate button o ###### Example - + ```cs // Received when someone accepts a request to spectate @@ -1034,7 +1035,7 @@ activityManager.OnActivitySpectate += secret => Console.WriteLine("OnSpectate {0}", secret); }; ``` - + #### OnActivityJoinRequest @@ -1048,7 +1049,7 @@ Fires when a user asks to join the current user's game. ###### Example - + ```cs // A join request has been received. Render the request on the UI. @@ -1057,7 +1058,7 @@ activityManager.OnActivityJoinRequest += (ref Discord.User user) => Console.WriteLine("OnJoinRequest {0} {1}", user.Username, user.Id); }; ``` - + #### OnActivityInvite @@ -1073,7 +1074,7 @@ Fires when the user receives a join or spectate invite. ###### Example - + ```cs // An invite has been received. Consider rendering the user / activity on the UI. @@ -1086,11 +1087,11 @@ activityManager.OnActivityInvite += (Discord.ActivityActionType Type, ref Discor // }); }; ``` - + ### Inviting a User to a Game - + ```cs var discord = new Discord.Discord(clientId, Discord.CreateFlags.Default); @@ -1143,13 +1144,13 @@ activityManager.UpdateActivity(activity, (result) => }); }); ``` - + ## Overlay -:::warn + The overlay is only supported on Windows for DirectX or OpenGL games. Linux, Mac, and games using Vulkan are not supported. [Click here for more info.](https://support.discord.com/hc/en-us/articles/217659737-Games-Overlay-101) -::: + Discord comes with an awesome built-in overlay, and you may want to make use of it for your game. This manager will help you do just that! It gives you the current state of the overlay for the user, and allows you to update that state. @@ -1172,7 +1173,7 @@ Returns a `bool`. ###### Example - + ```cs if (!overlaymanager.IsEnabled()) @@ -1180,7 +1181,7 @@ if (!overlaymanager.IsEnabled()) Console.WriteLine("Overlay is not enabled. Modals will be shown in the Discord client instead"); } ``` - + #### IsLocked @@ -1188,7 +1189,7 @@ Check if the overlay is currently locked or unlocked ###### Example - + ```cs if (overlayManager.IsLocked()) @@ -1199,7 +1200,7 @@ if (overlayManager.IsLocked()) }); } ``` - + #### SetLocked @@ -1215,7 +1216,7 @@ Returns `Discord.Result` via callback. ###### Example - + ```cs overlayManager.SetLocked(true, (res) => @@ -1223,12 +1224,12 @@ overlayManager.SetLocked(true, (res) => Console.WriteLine("Overlay has been locked and modals have been closed"); }); ``` - + #### OpenActivityInvite -Opens the overlay modal for sending game invitations to users, channels, and servers. If you do not have a valid activity with all the required fields, this call will error. See [Activity Action Field Requirements](/docs/developer-tools/game-sdk#activity-action-field-requirements) for the fields required to have join and spectate invites function properly. +Opens the overlay modal for sending game invitations to users, channels, and servers. If you do not have a valid activity with all the required fields, this call will error. See [Activity Action Field Requirements](/developers/docs/developer-tools/game-sdk#activity-action-field-requirements) for the fields required to have join and spectate invites function properly. Returns a `Discord.Result` via callback. @@ -1240,7 +1241,7 @@ Returns a `Discord.Result` via callback. ###### Example - + ```cs overlayManager.OpenActivityInvite(Discord.ActivityActionType.Join, (result) => @@ -1251,13 +1252,13 @@ overlayManager.OpenActivityInvite(Discord.ActivityActionType.Join, (result) => } }); ``` - + #### OpenGuildInvite Opens the overlay modal for joining a Discord guild, given its invite code. An invite code for a server may look something like `fortnite` for a verified server—the full invite being `discord.gg/fortnite`—or something like `rjEeUJq` for a non-verified server, the full invite being `discord.gg/rjEeUJq`. -Returns a `Discord.Result` via callback. Note that a successful `Discord.Result` response does not necessarily mean that the user has joined the guild. If you want more granular control over and knowledge about users joining your guild, you may want to look into implementing the [`guilds.join` OAuth2 scope in an authorization code grant](/docs/topics/oauth2#authorization-code-grant) in conjunction with the [Add Guild Members](/docs/resources/guild#add-guild-member) endpoint. +Returns a `Discord.Result` via callback. Note that a successful `Discord.Result` response does not necessarily mean that the user has joined the guild. If you want more granular control over and knowledge about users joining your guild, you may want to look into implementing the [`guilds.join` OAuth2 scope in an authorization code grant](/developers/docs/topics/oauth2#authorization-code-grant) in conjunction with the [Add Guild Members](/developers/docs/resources/guild#add-guild-member) endpoint. ###### Parameters @@ -1267,7 +1268,7 @@ Returns a `Discord.Result` via callback. Note that a successful `Discord.Result` ###### Example - + ```cs overlayManager.OpenGuildInvite("rjEeUJq", (result) => @@ -1278,22 +1279,22 @@ overlayManager.OpenGuildInvite("rjEeUJq", (result) => } }); ``` - + #### OpenVoiceSettings Opens the overlay widget for voice settings for the currently connected application. These settings are unique to each user within the context of your application. That means that a user can have different favorite voice settings for each of their games! - + -![Screenshot of the Voice Settings modal for an application](images/game-overlay-sdk-voice-settings.webp) - +![Screenshot of the Voice Settings modal for an application](/images/game-overlay-sdk-voice-settings.webp) + Returns a `Discord.Result` via callback. ###### Example - + ```cs overlayManager.OpenVoiceSettings((result) => @@ -1304,7 +1305,7 @@ overlayManager.OpenVoiceSettings((result) => } }) ``` - + #### OnToggle @@ -1318,7 +1319,7 @@ Fires when the overlay is locked or unlocked (a.k.a. opened or closed) ###### Example - + ```cs overlayManager.OnToggle += overlayLock => @@ -1326,11 +1327,11 @@ overlayManager.OnToggle += overlayLock => Console.WriteLine("Overlay Locked: {0}", overlayLock); }; ``` - + #### Activate Overlay Invite Modal - + ```cs var discord = new Discord.Discord(clientId, Discord.CreateFlags.Default); @@ -1345,9 +1346,9 @@ overlayManager.OpenActivityInvite(ActivityActionType.Join, (result) => And that invite modal looks like this! -![Screenshot of an Invitation Modal in an application](images/game-overlay-sdk-invite.webp) +![Screenshot of an Invitation Modal in an application](/images/game-overlay-sdk-invite.webp) - + ## Users @@ -1388,23 +1389,23 @@ This manager helps retrieve basic user information for any user on Discord. #### GetCurrentUser -:::info -Before calling this function, you'll need to wait for the [OnCurrentUserUpdate](/docs/developer-tools/game-sdk#oncurrentuserupdate) callback to fire after instantiating the User manager. -::: + +Before calling this function, you'll need to wait for the [OnCurrentUserUpdate](/developers/docs/developer-tools/game-sdk#oncurrentuserupdate) callback to fire after instantiating the User manager. + -Fetch information about the currently connected user account. If you're interested in getting more detailed information about a user—for example, their email—check out our [GetCurrentUser](/docs/resources/user#get-current-user) API endpoint. You'll want to call this with an authorization header of `Bearer `, where `` is the token retrieved from a standard [OAuth2 Authorization Code Grant](/docs/topics/oauth2#authorization-code-grant) flow. +Fetch information about the currently connected user account. If you're interested in getting more detailed information about a user—for example, their email—check out our [GetCurrentUser](/developers/docs/resources/user#get-current-user) API endpoint. You'll want to call this with an authorization header of `Bearer `, where `` is the token retrieved from a standard [OAuth2 Authorization Code Grant](/developers/docs/topics/oauth2#authorization-code-grant) flow. Returns a `Discord.User`. ###### Example - + ```cs var user = userManager.GetCurrentUser(); Console.WriteLine("Connected to user {0}", user.Id); ``` - + #### GetUser @@ -1420,7 +1421,7 @@ Returns a `Discord.Result` and `ref Discord.User` via callback. ###### Example - + ```cs userManager.GetUser(userId, (Discord.Result result, ref Discord.User user) => @@ -1431,17 +1432,17 @@ userManager.GetUser(userId, (Discord.Result result, ref Discord.User user) => } }); ``` - + #### GetCurrentUserPremiumType -Get the [PremiumType](/docs/developer-tools/game-sdk#premiumtype-enum) for the currently connected user. +Get the [PremiumType](/developers/docs/developer-tools/game-sdk#premiumtype-enum) for the currently connected user. Returns `Discord.PremiumType`. ###### Example - + ```cs var userManager = discord.GetUserManager(); @@ -1462,23 +1463,23 @@ switch (premiumType) } ``` - + #### CurrentUserHasFlag -See whether or not the current user has a certain [UserFlag](/docs/developer-tools/game-sdk#userflag-enum) on their account. +See whether or not the current user has a certain [UserFlag](/developers/docs/developer-tools/game-sdk#userflag-enum) on their account. Returns `bool`. ###### Parameters -| name | type | description | -|------|----------------------------------------------------------|-----------------------------------------| -| flag | [UserFlag](/docs/developer-tools/game-sdk#userflag-enum) | the flag to check on the user's account | +| name | type | description | +|------|---------------------------------------------------------------------|-----------------------------------------| +| flag | [UserFlag](/developers/docs/developer-tools/game-sdk#userflag-enum) | the flag to check on the user's account | ###### Example - + ```cs var userManager = discord.GetUserManager(); @@ -1488,7 +1489,7 @@ if (userManager.CurrentUserHasFlag(Discord.UserFlag.HypeSquadHouse1)) } ``` - + ### Events @@ -1498,7 +1499,7 @@ Fires when the `User` struct of the currently connected user changes. They may h ###### Example - + ```cs var userManager = discord.GetUserManager(); @@ -1512,11 +1513,11 @@ userManager.OnCurrentUserUpdate += () => { Console.WriteLine(currentUser.Avatar); }; ``` - + ### Fetching Data About a Discord User - + ```cs var discord = new Discord.Discord(clientId, Discord.CreateFlags.Default); @@ -1534,4 +1535,4 @@ userManager.GetUser(450795363658366976, (Discord.Result result, ref Discord.User } }); ``` - + diff --git a/discord/developers/docs/discord-social-sdk/core-concepts.mdx b/discord/developers/docs/discord-social-sdk/core-concepts.mdx new file mode 100644 index 0000000000..7a73b25358 --- /dev/null +++ b/discord/developers/docs/discord-social-sdk/core-concepts.mdx @@ -0,0 +1,56 @@ +--- +title: Discord Social SDK Core Concepts Glossary +sidebarTitle: Glossary +description: Definitions and explanations of key terms used in the Discord Social SDK. +--- + +The Discord Social SDK allows you to build social features into your game, including friend lists, messaging, voice chat, and rich presence. Unlike a traditional SDK with built-in UI components, the Discord Social SDK provides access to raw data, allowing developers to create a fully customized experience that aligns with their game's aesthetic. + +## Core Concepts Overview + +import {TrophyIcon} from '/snippets/icons/TrophyIcon.jsx' +import {PhoneCallIcon} from '/snippets/icons/PhoneCallIcon.jsx' +import {HammerIcon} from '/snippets/icons/HammerIcon.jsx' +import {UserPlatformIcon} from '/snippets/icons/UserPlatformIcon.jsx' +import {UserIcon} from '/snippets/icons/UserIcon.jsx' + +Select a topic below to learn more about the Discord Social SDK: + + + }> + Explore social features like account linking, friends, and rich presence. + + }> + Learn about messaging, voice chat, and in-game lobbies. + + }> + Learn about the integration overview and implementation steps. + + }> + See supported platforms and download information. + + }> + Understand OAuth2 scopes and client types for authentication. + + + +--- + +## Next Steps + +After exploring these core concepts, you can start implementing the Discord Social SDK in your game: + +- **Ready to integrate?** Follow our [Getting Started](/developers/docs/discord-social-sdk/getting-started) guide for step-by-step setup instructions. +- **Need implementation details?** Check out the [Development Guides](/developers/docs/discord-social-sdk/development-guides) for specific feature implementations. +- **Looking for UI guidance?** Review the [Design Guidelines](/developers/docs/discord-social-sdk/design-guidelines) for best practices. + +--- + +## Change Log + +| Date | Changes | +|----------------|---------------------------| +| July 21, 2025 | restructure core concepts | +| June 30, 2025 | restructure oauth scopes | +| March 17, 2025 | initial release | diff --git a/docs/discord-social-sdk/core-concepts/communication-features.mdx b/discord/developers/docs/discord-social-sdk/core-concepts/communication-features.mdx similarity index 81% rename from docs/discord-social-sdk/core-concepts/communication-features.mdx rename to discord/developers/docs/discord-social-sdk/core-concepts/communication-features.mdx index d4911faac8..cde41474a2 100644 --- a/docs/discord-social-sdk/core-concepts/communication-features.mdx +++ b/discord/developers/docs/discord-social-sdk/core-concepts/communication-features.mdx @@ -1,24 +1,21 @@ --- -sidebar_label: Communication Features +title: Communication Features +description: "Learn about Discord Social SDK's communication features including direct messages and voice chat." --- -import SonyCallout from '../partials/callouts/sony.mdx'; - -[Home](/docs/intro) > [Discord Social SDK](/docs/discord-social-sdk/overview) > [Core Concepts](/docs/discord-social-sdk/core-concepts) > {sidebar_label} - -# Communication Features +import SonyCallout from '/snippets/discord-social-sdk/callouts/sony.mdx'; The Discord Social SDK provides powerful communication features to enhance player interaction in your game. These features include messaging, voice chat, and in-game lobbies, allowing players to connect seamlessly. -:::warn + The following communication features are available for development and testing, but their usage is capped with a rate limit. -::: + For more information about current rate limits for communication features, please see -[Rate Limits](/docs/discord-social-sdk/core-concepts/communication-features#rate-limits), and +[Rate Limits](/developers/docs/discord-social-sdk/core-concepts/communication-features#rate-limits), and see the -[Applying for Rate Limit Removal](/docs/discord-social-sdk/core-concepts/communication-features#applying-for-rate-limit-removal) +[Applying for Rate Limit Removal](/developers/docs/discord-social-sdk/core-concepts/communication-features#applying-for-rate-limit-removal) section below for how to remove those rate limits, such that you can use these features for full release. ## Messaging & Communication @@ -28,14 +25,14 @@ Users can communicate via direct messages (DMs) and voice calls: - DMs: One-on-one private chat ([`MessageHandle`]). - Calls: Real-time voice communication inside a game lobby ([`Call`]). -| Development Guides | -|------------------------------------------------------------------------------------------------| -| [Sending Direct Messages](/docs/discord-social-sdk/development-guides/sending-direct-messages) | -| [Managing Voice Chat](/docs/discord-social-sdk/development-guides/managing-voice-chat) | +| Development Guides | +|-----------------------------------------------------------------------------------------------------------| +| [Sending Direct Messages](/developers/docs/discord-social-sdk/development-guides/sending-direct-messages) | +| [Managing Voice Chat](/developers/docs/discord-social-sdk/development-guides/managing-voice-chat) | -| Design Guidelines | -|-------------------------------------------------------------------------------| -| [Direct Messages](/docs/discord-social-sdk/design-guidelines/direct-messages) | +| Design Guidelines | +|------------------------------------------------------------------------------------------| +| [Direct Messages](/developers/docs/discord-social-sdk/design-guidelines/direct-messages) | ## Lobbies & In-Game Chat @@ -44,21 +41,21 @@ A lobby is a virtual space where players can interact through voice and text cha - Your game controls lobbies, which can have different membership rules. - Integrated voice chat allows real-time communication among players in a session. -| Development Guides | -|---------------------------------------------------------------------------------| -| [Manging Lobbies](/docs/discord-social-sdk/development-guides/managing-lobbies) | +| Development Guides | +|--------------------------------------------------------------------------------------------| +| [Manging Lobbies](/developers/docs/discord-social-sdk/development-guides/managing-lobbies) | ## Linked Channels Games can link in-game chat with Discord's server-based text channels in their UI, allowing players to chat in a Discord server without leaving the game. -| Development Guides | -|--------------------------------------------------------------------------------| -| [Linked channels](/docs/discord-social-sdk/development-guides/linked-channels) | +| Development Guides | +|-------------------------------------------------------------------------------------------| +| [Linked channels](/developers/docs/discord-social-sdk/development-guides/linked-channels) | -| Design Guidelines | -|-------------------------------------------------------------------------------| -| [Linked channels](/docs/discord-social-sdk/design-guidelines/linked-channels) | +| Design Guidelines | +|------------------------------------------------------------------------------------------| +| [Linked channels](/developers/docs/discord-social-sdk/design-guidelines/linked-channels) | --- @@ -74,16 +71,16 @@ Prior to a successful application to remove rate limits, communication features * **Sending Messages to Lobby operations:** 100 requests every 2 hours * **Sending Direct Message operations:** 100 requests every 2 hours. -:::info + These are per-application rate limits, not per-user. -::: + These limitations are designed to provide sufficient capacity for development, testing, and small-scale demos while ensuring system stability. Once you gain full access through the rate limit removal application process, these restrictions are removed, allowing your game to scale to production levels. ## Applying for Rate Limit Removal To apply for removal of rate limits on Discord Social SDK communication features, you must meet the requirements -outlined in the [Application Requirements for Rate Limit Removal](/docs/discord-social-sdk/core-concepts/communication-features#application-requirements-for-rate-limit-removal) +outlined in the [Application Requirements for Rate Limit Removal](/developers/docs/discord-social-sdk/core-concepts/communication-features#application-requirements-for-rate-limit-removal) section below. Once you have met those requirements, you can apply for rate limit removal by following these steps: @@ -93,9 +90,9 @@ Once you have met those requirements, you can apply for rate limit removal by fo 3. Under the **Discord Social SDK** heading in the sidebar, click the **Comms Access** button 5. Fill out the application form with the required information and supporting materials -:::info + Video capture provided to the application should be in url format, hosted on a file or video-sharing service of your choice as an unlisted video -::: + ## Application Requirements for Rate Limit Removal @@ -109,16 +106,16 @@ Discord Social SDK text and/or voice communications for full release. You'll fin 5. **Age-restricted user protection:** You’ll need to confirm that you have appropriate measures in place for players’ access to the SDK features in your game, depending on their age. -:::info + These requirements detail the **minimum bar** to be eligible for Social SDK communications usage at scale. -Check out our [design guidelines](/docs/discord-social-sdk/design-guidelines) for what **“great”** looks like. Great +Check out our [design guidelines](/developers/docs/discord-social-sdk/design-guidelines) for what **“great”** looks like. Great integrations can drive higher player engagement and retention by creating seamless social experiences that keep players connected and coming back to your game. And of course, remember to make sure you are complying with our [Social SDK Terms](https://support-dev.discord.com/hc/en-us/articles/30225844245271-Discord-Social-SDK-Terms).

If you believe you meet these requirements, you can -[apply for access to full release comms features](/docs/discord-social-sdk/core-concepts/communication-features#applying-for-rate-limit-removal). +[apply for access to full release comms features](/developers/docs/discord-social-sdk/core-concepts/communication-features#applying-for-rate-limit-removal). Discord may approve or deny your access after review of your application and additional terms may apply. -::: +
### Minimum Required Feature Set @@ -131,15 +128,15 @@ Required features are… #### Option for Discord Account Linking -**Players must have the opportunity to [link their Discord account in-game](/docs/discord-social-sdk/design-guidelines/signing-in).** This ensures players can access the full Social SDK-powered experience, and connects your game to a player’s existing social network. +**Players must have the opportunity to [link their Discord account in-game](/developers/docs/discord-social-sdk/design-guidelines/signing-in).** This ensures players can access the full Social SDK-powered experience, and connects your game to a player’s existing social network. #### Rich Presence and Discord Joins -**Discord Users must be able to see [Rich Presence](/docs/discord-social-sdk/design-guidelines/status-rich-presence) updates for Discord-linked player accounts and join their game via Ask to Join.** This feature drives organic discovery and social engagement by showing friends what players are doing and creating opportunities for spontaneous social interaction and game sessions. +**Discord Users must be able to see [Rich Presence](/developers/docs/discord-social-sdk/design-guidelines/status-rich-presence) updates for Discord-linked player accounts and join their game via Ask to Join.** This feature drives organic discovery and social engagement by showing friends what players are doing and creating opportunities for spontaneous social interaction and game sessions. #### Full Access to Discord Friends -**Account-linked players must have their Discord friends accessible to them in-game, with supporting UI to take actions like [messaging](/docs/discord-social-sdk/design-guidelines/direct-messages), inviting, blocking, and ignoring**. This can be accomplished as a [Unified Friends List](/docs/discord-social-sdk/design-guidelines/unified-friends-list) which shows status across platforms, or as a simple in-game Discord friends list. Games should never copy and store Discord friend information (i.e. a player unlinking their Discord account should automatically remove Discord friend information in-game). +**Account-linked players must have their Discord friends accessible to them in-game, with supporting UI to take actions like [messaging](/developers/docs/discord-social-sdk/design-guidelines/direct-messages), inviting, blocking, and ignoring**. This can be accomplished as a [Unified Friends List](/developers/docs/discord-social-sdk/design-guidelines/unified-friends-list) which shows status across platforms, or as a simple in-game Discord friends list. Games should never copy and store Discord friend information (i.e. a player unlinking their Discord account should automatically remove Discord friend information in-game). ### Feature Functionality @@ -165,10 +162,10 @@ Required features are… * **Authorization fails/times out:** Show clear error message with retry option * **User wants to disconnect:** Provide deauthorization option in-game and maintain game functionality post-disconnect -:::info + These requirements represent the minimum standards for functionality. -To create an even better player experience, see our [Design Guidelines for Signing In](/docs/discord-social-sdk/design-guidelines/signing-in). -::: +To create an even better player experience, see our [Design Guidelines for Signing In](/developers/docs/discord-social-sdk/design-guidelines/signing-in). + #### Rich Presence @@ -189,10 +186,10 @@ To create an even better player experience, see our [Design Guidelines for Signi * **Network connectivity issues:** Queue presence updates and retry when connection restored * **Active and inactive clients**: Invites can complete even when one player doesn’t have the game client open on acceptance. -:::info + These requirements represent the minimum standards for functionality. -To create an even better player experience, see our [Design Guidelines for Rich Presence](/docs/discord-social-sdk/design-guidelines/status-rich-presence). -::: +To create an even better player experience, see our [Design Guidelines for Rich Presence](/developers/docs/discord-social-sdk/design-guidelines/status-rich-presence). + #### Unified Friends List @@ -216,10 +213,10 @@ To create an even better player experience, see our [Design Guidelines for Rich * **Special characters**: Non-standard characters in Discord usernames populate as expected. * **Unlinking Discord**: Player’s in-game friends list removes Discord friend entries when they unlink their Discord account -:::info + These requirements represent the minimum standards for functionality. -To create an even better player experience, see our [Design Guidelines for Unified Friends List](/docs/discord-social-sdk/design-guidelines/unified-friends-list). -::: +To create an even better player experience, see our [Design Guidelines for Unified Friends List](/developers/docs/discord-social-sdk/design-guidelines/unified-friends-list). + #### Direct Messages through Discord @@ -241,10 +238,10 @@ To create an even better player experience, see our [Design Guidelines for Unifi * **Blocked users:** Respect Discord blocking relationships and show appropriate messaging * **Network issues:** Queue messages locally and sync when connection restored -:::info + These requirements represent the minimum standards for functionality. -To create an even better player experience, see our [Design Guidelines for Direct Messages](/docs/discord-social-sdk/design-guidelines/direct-messages). -::: +To create an even better player experience, see our [Design Guidelines for Direct Messages](/developers/docs/discord-social-sdk/design-guidelines/direct-messages). + #### Linked Channels @@ -267,10 +264,10 @@ To create an even better player experience, see our [Design Guidelines for Direc * **Link establishment failure:** Show retry options and clear error messaging * **User wants to unlink:** Provide confirmation dialog and clean removal process -:::info + These requirements represent the minimum standards for functionality. -To create an even better player experience, see our [Design Guidelines for Linked Channels](/docs/discord-social-sdk/design-guidelines/linked-channels). -::: +To create an even better player experience, see our [Design Guidelines for Linked Channels](/developers/docs/discord-social-sdk/design-guidelines/linked-channels). + #### Voice Communications @@ -302,7 +299,7 @@ To create an even better player experience, see our [Design Guidelines for Linke * The entry point for account linking is visually persistent within its associated menu location (i.e. it can’t be a one time pop up that players can’t access again). * The entry point for account linking is discoverable by players through normal expected play (i.e. not buried in a sub-menu or requiring right-click access). * The option to unlink accounts is also surfaced in-game in a persistent and easily accessible manner. -* Users without linked accounts must have an associated token path for handling social features (see: [Provisional Accounts](/docs/discord-social-sdk/design-guidelines/provisional-accounts)). +* Users without linked accounts must have an associated token path for handling social features (see: [Provisional Accounts](/developers/docs/discord-social-sdk/design-guidelines/provisional-accounts)). **Conveyance Requirements:** @@ -312,9 +309,9 @@ To create an even better player experience, see our [Design Guidelines for Linke * **Contextual tooltips or hints** near social features that explain how they improve with Discord linking * **In-game messaging** that appears when players interact with limited social features, explaining how linking would enhance the experience -:::warn + Discord Account Linking entry points are prohibited on Sony platforms. -::: + #### Direct Messages through Discord @@ -332,11 +329,11 @@ To **unlock Discord text and/or voice communications for full release,** Social supporting materials in your application. You may submit your application and supporting materials under your application in the Developer Portal. -:::warn + **For integrations available on multiple platforms including Sony platforms, submit materials that reflect your non-Sony platform user experience.**

**For example:** Example Studio's *Wumpus Wars* is available to players on Sony PlayStation 5 and Xbox Series S and Xbox Series X. Example Studio submits the feature list and *Wumpus Wars* capture for Xbox. -::: +
#### List of SDK Features Integrated @@ -365,7 +362,7 @@ Acceptable format: url link * **1-5 minute video capture** of the complete user flow covering each SDK feature integrated * Videos must demonstrate end-to-end user flow as outlined in -[Feature Functionality](/docs/discord-social-sdk/core-concepts/communication-features#feature-functionality) +[Feature Functionality](/developers/docs/discord-social-sdk/core-concepts/communication-features#feature-functionality) * Show both successful flows and how negative options (errors, user denials) are handled * Include clear narration or on-screen text explaining each step * Ensure video quality allows reviewers to clearly see UI elements and user interactions @@ -380,21 +377,24 @@ With your application submission, **you confirm that you have met the requiremen ## Next Steps +import {UserPlatformIcon} from '/snippets/icons/UserPlatformIcon.jsx' +import {HammerIcon} from '/snippets/icons/HammerIcon.jsx' +import {BookCheckIcon} from '/snippets/icons/BookCheckIcon.jsx' + Learn about integration steps, check platform support, and explore implementation guides: - + + href="/developers/docs/discord-social-sdk/core-concepts/integration-overview" icon={}> Learn about the integration overview and implementation steps. - + }> See supported platforms and download information. - + }> Learn how to implement messaging, voice chat, and linked channels. - + --- diff --git a/docs/discord-social-sdk/core-concepts/core-features.mdx b/discord/developers/docs/discord-social-sdk/core-concepts/core-features.mdx similarity index 51% rename from docs/discord-social-sdk/core-concepts/core-features.mdx rename to discord/developers/docs/discord-social-sdk/core-concepts/core-features.mdx index 3f55af3497..6be6fecbca 100644 --- a/docs/discord-social-sdk/core-concepts/core-features.mdx +++ b/discord/developers/docs/discord-social-sdk/core-concepts/core-features.mdx @@ -1,38 +1,35 @@ --- -sidebar_label: Core Features +title: Core Features +description: Overview of the Discord Social SDK's core features including user identity and relationships. --- -[Home](/docs/intro) > [Discord Social SDK](/docs/discord-social-sdk/overview) > [Core Concepts](/docs/discord-social-sdk/core-concepts) > {sidebar_label} - -# Core Features - The Discord Social SDK offers a range of features to enhance social interactions within games. Developers can leverage these features to create a more engaging and connected experience for players in their game. ## Account Linking Account linking allows a game to authenticate users with their Discord credentials, gaining access to social features like friends, chat, and presence. This process uses OAuth2 authentication. -| Development Guides | -|----------------------------------------------------------------------------------------------------------| -| [Account Linking with Discord](/docs/discord-social-sdk/development-guides/account-linking-with-discord) | -| [Account Linking on Consoles](/docs/discord-social-sdk/development-guides/account-linking-on-consoles) | +| Development Guides | +|---------------------------------------------------------------------------------------------------------------------| +| [Account Linking with Discord](/developers/docs/discord-social-sdk/development-guides/account-linking-with-discord) | +| [Account Linking on Consoles](/developers/docs/discord-social-sdk/development-guides/account-linking-on-consoles) | -| Design Guidelines | -|----------------------------------------------------------------------------------| -| [Signing in with Discord](/docs/discord-social-sdk/design-guidelines/signing-in) | -| [Consoles](/docs/discord-social-sdk/design-guidelines/consoles) | +| Design Guidelines | +|---------------------------------------------------------------------------------------------| +| [Signing in with Discord](/developers/docs/discord-social-sdk/design-guidelines/signing-in) | +| [Consoles](/developers/docs/discord-social-sdk/design-guidelines/consoles) | ## Provisional Accounts Provisional accounts let players use social features in your game without linking a Discord account so all players can have a consistent gameplay experience. -| Development Guides | -|------------------------------------------------------------------------------------------------------| -| [Using Provisional Accounts](/docs/discord-social-sdk/development-guides/using-provisional-accounts) | +| Development Guides | +|-----------------------------------------------------------------------------------------------------------------| +| [Using Provisional Accounts](/developers/docs/discord-social-sdk/development-guides/using-provisional-accounts) | -| Design Guidelines | -|-----------------------------------------------------------------------------------------| -| [Provisional Accounts](/docs/discord-social-sdk/design-guidelines/provisional-accounts) | +| Design Guidelines | +|----------------------------------------------------------------------------------------------------| +| [Provisional Accounts](/developers/docs/discord-social-sdk/design-guidelines/provisional-accounts) | ## Friend System & Relationships @@ -41,14 +38,14 @@ The SDK models friendships and relationships in two ways: - Discord Friends: Persistent across all games. - Game-Specific Friends: Limited to the current game. -| Development Guides | -|----------------------------------------------------------------------------------------------------------------| -| [Creating a Unified Friends List](/docs/discord-social-sdk/development-guides/creating-a-unified-friends-list) | +| Development Guides | +|---------------------------------------------------------------------------------------------------------------------------| +| [Creating a Unified Friends List](/developers/docs/discord-social-sdk/development-guides/creating-a-unified-friends-list) | -| Design Guidelines | -|-----------------------------------------------------------------------------------------| -| [Unified Friends List](/docs/discord-social-sdk/design-guidelines/provisional-accounts) | -| [Game Friends](/docs/discord-social-sdk/design-guidelines/game-friends) | +| Design Guidelines | +|----------------------------------------------------------------------------------------------------| +| [Unified Friends List](/developers/docs/discord-social-sdk/design-guidelines/provisional-accounts) | +| [Game Friends](/developers/docs/discord-social-sdk/design-guidelines/game-friends) | ## Presence & Rich Presence @@ -58,34 +55,37 @@ Presence refers to a user's online status, while Rich Presence provides game-spe - Shows detailed game stats (e.g., what level they're playing and time played). - Allows users to send game invites through Discord and in-game. -| Development Guides | -|--------------------------------------------------------------------------------------------| -| [Setting Rich Presence](/docs/discord-social-sdk/development-guides/setting-rich-presence) | +| Development Guides | +|-------------------------------------------------------------------------------------------------------| +| [Setting Rich Presence](/developers/docs/discord-social-sdk/development-guides/setting-rich-presence) | -| Design Guidelines | -|-------------------------------------------------------------------------------------------| -| [Status & Rich Presence](/docs/discord-social-sdk/design-guidelines/status-rich-presence) | +| Design Guidelines | +|------------------------------------------------------------------------------------------------------| +| [Status & Rich Presence](/developers/docs/discord-social-sdk/design-guidelines/status-rich-presence) | --- ## Next Steps +import {PhoneCallIcon} from '/snippets/icons/PhoneCallIcon.jsx' +import {HammerIcon} from '/snippets/icons/HammerIcon.jsx' +import {BookCheckIcon} from '/snippets/icons/BookCheckIcon.jsx' + Learn the implementation steps, configure authentication, and explore development guides: - - + + }> Learn about messaging, voice chat, and in-game lobbies. + href="/developers/docs/discord-social-sdk/core-concepts/integration-overview" icon={}> Learn about the integration overview and implementation steps. - + }> Step-by-step guides for implementing each social feature. - + --- diff --git a/discord/developers/docs/discord-social-sdk/core-concepts/integration-overview.mdx b/discord/developers/docs/discord-social-sdk/core-concepts/integration-overview.mdx new file mode 100644 index 0000000000..fdb3f925eb --- /dev/null +++ b/discord/developers/docs/discord-social-sdk/core-concepts/integration-overview.mdx @@ -0,0 +1,59 @@ +--- +title: Integration Overview +description: High-level overview of integrating the Discord Social SDK into your application. +--- + +To implement the Discord Social SDK, developers for all platforms will generally follow these steps: + +1. Import the SDK +2. Initialize the SDK: + - Create a [`Client`] instance. + - Set up event listeners to monitor SDK events and callbacks +3. Authenticate users with flexible account options + - Link an existing Discord account via OAuth ([`Client::Authorize`]). + - Create and manage provisional accounts for users who don't have or want a Discord account ([`Client::GetProvisionalToken`]). +4. Implement social features + - Implement [unified friends list](/developers/docs/discord-social-sdk/development-guides/creating-a-unified-friends-list) and [relationships](/developers/docs/discord-social-sdk/development-guides/managing-relationships). + - Use [rich presence](/developers/docs/discord-social-sdk/development-guides/setting-rich-presence) for game activity updates. + - Set up [lobbies](/developers/docs/discord-social-sdk/development-guides/managing-lobbies) for multiplayer interaction and [game invites](/developers/docs/discord-social-sdk/development-guides/managing-game-invites). + - Manage [direct message](/developers/docs/discord-social-sdk/development-guides/sending-direct-messages), [linked channels](/developers/docs/discord-social-sdk/development-guides/creating-a-unified-friends-list), and [voice communication](/developers/docs/discord-social-sdk/development-guides/managing-voice-chat). +5. Handle events & API calls: + - Listen for changes in friend lists, presence updates, and chat messages. + - Use Discord's APIs to update statuses, send messages, and manage connections. + +This guide is a conceptual overview. If you're ready to start building, [follow our step-by-step guide](/developers/docs/discord-social-sdk/getting-started) to set up the SDK in your game engine. + +--- + +## Next Steps + +import {UserPlatformIcon} from '/snippets/icons/UserPlatformIcon.jsx' +import {PlayIcon} from '/snippets/icons/PlayIcon.jsx' +import {PhoneCallIcon} from '/snippets/icons/PhoneCallIcon.jsx' + +Check platform compatibility, explore communication features, and start your integration: + + + }> + See supported platforms and download information. + + }> + Learn about messaging, voice chat, and in-game lobbies. + + }> + Choose your platform and follow step-by-step setup instructions. + + + +--- + +## Change Log + +| Date | Changes | +|---------------|-----------------| +| July 21, 2025 | initial release | + +{/* Autogenerated Reference Links */} +[`Client`]: https://discord.com/developers/docs/social-sdk/classdiscordpp_1_1Client.html#a91716140c699d8ef0bdf6bfd7ee0ae13 +[`Client::Authorize`]: https://discord.com/developers/docs/social-sdk/classdiscordpp_1_1Client.html#ace94a58e27545a933d79db32b387a468 +[`Client::GetProvisionalToken`]: https://discord.com/developers/docs/social-sdk/classdiscordpp_1_1Client.html#a8003130b6c46e54ac68442483bf0480c \ No newline at end of file diff --git a/docs/discord-social-sdk/core-concepts/oauth2-scopes.mdx b/discord/developers/docs/discord-social-sdk/core-concepts/oauth2-scopes.mdx similarity index 68% rename from docs/discord-social-sdk/core-concepts/oauth2-scopes.mdx rename to discord/developers/docs/discord-social-sdk/core-concepts/oauth2-scopes.mdx index 4c9ef8ebc8..89e6f65bbf 100644 --- a/docs/discord-social-sdk/core-concepts/oauth2-scopes.mdx +++ b/discord/developers/docs/discord-social-sdk/core-concepts/oauth2-scopes.mdx @@ -1,11 +1,8 @@ --- -sidebar_label: OAuth2 Scopes +title: OAuth2 Scopes +description: Learn about OAuth2 scopes required for Discord Social SDK features. --- -[Home](/docs/intro) > [Discord Social SDK](/docs/discord-social-sdk/overview) > [Core Concepts](/docs/discord-social-sdk/core-concepts) > {sidebar_label} - -# OAuth2 Scopes - OAuth2 scopes define the level of access your app has to a user's Discord account What OAuth scopes are available to your integration are set via @@ -21,18 +18,18 @@ At a minimum, the Social SDK uses the following scopes to use features like rich The default presence features include: -* [Account Linking](/docs/discord-social-sdk/core-concepts/core-features#account-linking) -* [Provisional Accounts](/docs/discord-social-sdk/core-concepts/core-features#provisional-accounts) -* [Friend System & Relationships](/docs/discord-social-sdk/core-concepts/core-features#friend-system-relationships) -* [Presence & Rich Presence](/docs/discord-social-sdk/core-concepts/core-features#presence-rich-presence) +* [Account Linking](/developers/docs/discord-social-sdk/core-concepts/core-features#account-linking) +* [Provisional Accounts](/developers/docs/discord-social-sdk/core-concepts/core-features#provisional-accounts) +* [Friend System & Relationships](/developers/docs/discord-social-sdk/core-concepts/core-features#friend-system-relationships) +* [Presence & Rich Presence](/developers/docs/discord-social-sdk/core-concepts/core-features#presence-rich-presence) The Social SDK provides the helper method [`Client::GetDefaultPresenceScopes`], which returns `openid sdk.social_layer_presence`, that you can use when setting up your OAuth2 flow, for integrations that only need the above functionality. -:::warn + With only the default presence scopes, your game will not be able to use any of the limited access communications features. -::: + ## Default Communication Scopes @@ -43,22 +40,22 @@ of `sdk.social_layer`, which includes the `sdk.social_layer_presence` scope but - `sdk.social_layer` These communication features include: -* [Messaging & Communication](/docs/discord-social-sdk/core-concepts/communication-features#messaging-communication) -* [Lobbies & In-Game Chat](/docs/discord-social-sdk/core-concepts/communication-features#lobbies-ingame-chat) -* [Linked Channels](/docs/discord-social-sdk/core-concepts/communication-features#linked-channels) +* [Messaging & Communication](/developers/docs/discord-social-sdk/core-concepts/communication-features#messaging-communication) +* [Lobbies & In-Game Chat](/developers/docs/discord-social-sdk/core-concepts/communication-features#lobbies-ingame-chat) +* [Linked Channels](/developers/docs/discord-social-sdk/core-concepts/communication-features#linked-channels) The Social SDK provides the helper method [`Client::GetDefaultCommunicationScopes`], which returns `openid sdk.social_layer`, that you can use when setting up your OAuth2 flow, for integrations that integrates both the default and limited communications features. -:::preview -For more information about these features, please see [Core Concepts: Communication Features](/docs/discord-social-sdk/core-concepts/communication-features). -::: + +For more information about these features, please see [Core Concepts: Communication Features](/developers/docs/discord-social-sdk/core-concepts/communication-features). + If your game requires additional scopes, you can add them to the default scopes to authorize additional access from your users. You should only add scopes that are necessary for your game to function. Requesting unnecessary scopes can lead to user distrust and may result in users not linking their Discord account. -See [available OAuth2 scopes](/docs/topics/oauth2#shared-resources-oauth2-scopes) available with the Discord API. +See [available OAuth2 scopes](/developers/docs/topics/oauth2#shared-resources-oauth2-scopes) available with the Discord API. ## OAuth2 Client Types @@ -76,20 +73,25 @@ Some Social SDK methods require your Discord application to be a **Public Client ## Next Steps +import {PlayIcon} from '/snippets/icons/PlayIcon.jsx' +import {LinkIcon} from '/snippets/icons/LinkIcon.jsx' +import {PaintPaletteIcon} from '/snippets/icons/PaintPaletteIcon.jsx' + + + Start your integration, implement user authentication, and learn about UI design: - - + + }> Choose your platform and follow step-by-step setup instructions. - + }> Implement user authentication with Discord OAuth2. - + }> Learn how to design your game's UI to integrate social features. - + --- diff --git a/docs/discord-social-sdk/core-concepts/platform-compatibility.mdx b/discord/developers/docs/discord-social-sdk/core-concepts/platform-compatibility.mdx similarity index 69% rename from docs/discord-social-sdk/core-concepts/platform-compatibility.mdx rename to discord/developers/docs/discord-social-sdk/core-concepts/platform-compatibility.mdx index 2c3a61f242..566d697225 100644 --- a/docs/discord-social-sdk/core-concepts/platform-compatibility.mdx +++ b/discord/developers/docs/discord-social-sdk/core-concepts/platform-compatibility.mdx @@ -1,16 +1,13 @@ --- -sidebar_label: Platform Compatibility +title: Platform Compatibility +description: Learn about Discord Social SDK platform support and compatibility. --- -import ConsoleAccess from '../partials/callouts/console-access.mdx'; -import SonyCallout from '../partials/callouts/sony.mdx'; +import ConsoleAccess from '/snippets/discord-social-sdk/callouts/console-access.mdx'; +import SonyCallout from '/snippets/discord-social-sdk/callouts/sony.mdx'; -[Home](/docs/intro) > [Discord Social SDK](/docs/discord-social-sdk/overview) > [Core Concepts](/docs/discord-social-sdk/core-concepts) > {sidebar_label} - -# Platform Compatibility - -:::info -You can find instructions on how to download the SDK for each platform in the [Getting Started](/docs/discord-social-sdk/getting-started) guide. -::: + +You can find instructions on how to download the SDK for each platform in the [Getting Started](/developers/docs/discord-social-sdk/getting-started) guide. + The Discord Social SDK is available for the following platforms: @@ -30,10 +27,10 @@ The Discord Social SDK is available for the following platforms: | PlayStation 4 | Experimental | ✅ | ✅ | ❌ | | PlayStation 5 | Experimental | ✅ | ✅ | ✅ | -:::info + \* There are too many Linux distributions to test, but most distros with glibc 2.31, e.g. Ubuntu 20.04, or later should work. -::: + @@ -42,19 +39,23 @@ or later should work. ## Next Steps +import {TrophyIcon} from '/snippets/icons/TrophyIcon.jsx' +import {UserIcon} from '/snippets/icons/UserIcon.jsx' +import {PlayIcon} from '/snippets/icons/PlayIcon.jsx' + Configure authentication, explore features, and get started with setup: - - + + }> Understand OAuth2 scopes and client types for authentication. - + }> Explore social features like account linking, friends, and rich presence. - + }> Platform-specific setup instructions and download links. - + --- diff --git a/discord/developers/docs/discord-social-sdk/design-guidelines.mdx b/discord/developers/docs/discord-social-sdk/design-guidelines.mdx new file mode 100644 index 0000000000..f493d6467e --- /dev/null +++ b/discord/developers/docs/discord-social-sdk/design-guidelines.mdx @@ -0,0 +1,72 @@ +--- +title: Discord Social SDK Design Guidelines +sidebarTitle: Glossary +description: Definitions and explanations of key terms used in Discord Social SDK design guidelines. +--- + +These design guidelines provide best practices and guidelines for designing social features in your game. Following these patterns can create a seamless and engaging user experience that leverages SDK social features to enhance your game. + +If you are looking for a place to get started, we recommend you start with [Principles](/developers/docs/discord-social-sdk/design-guidelines/principles) or the [Getting Started](/developers/docs/discord-social-sdk/getting-started) guide. + +import {CrownIcon} from '/snippets/icons/CrownIcon.jsx' +import {UserPlusIcon} from '/snippets/icons/UserPlusIcon.jsx' +import {DpadIcon} from '/snippets/icons/DpadIcon.jsx' +import {ClydeIcon} from '/snippets/icons/ClydeIcon.jsx' +import {ContactsIcon} from '/snippets/icons/ContactsIcon.jsx' +import {ChatIcon} from '/snippets/icons/ChatIcon.jsx' +import {UserIcon} from '/snippets/icons/UserIcon.jsx' +import {UserStatusIcon} from '/snippets/icons/UserStatusIcon.jsx' +import {GameControllerIcon} from '/snippets/icons/GameControllerIcon.jsx' +import {GroupIcon} from '/snippets/icons/GroupIcon.jsx' +import {TextControllerIcon} from '/snippets/icons/TextControllerIcon.jsx' + + + + }> + Fundamental best practices for integrating Discord's social layer into your game. These principles ensure a seamless and engaging user experience. + + }> + Strategies for implementing user authentication and account linking, allowing players to connect their Discord accounts with your game. + + }> + Key integration points where your game can interact with Discord's services, enhancing the overall player experience through seamless connectivity. + + }> + Guidelines for using Discord's brand assets within your game, ensuring consistent and respectful representation of the Discord brand. + + }> + Techniques for designing a unified friends list - allowing players to see and interact with their Discord friends directly within your game. + + }> + Best practices for enabling direct messaging between players, facilitating private communication, and enhancing social interactions. + + }> + Best practices for implementing chat history in Discord Social SDK integrations + + }> + Best practices for implementing and managing access to the Discord social settings in games using the Discord Social SDK + + }> + Designing around provisional accounts for users who prefer not to link their Discord accounts, allowing them to enjoy social features still. + + }> + Leveraging Discord's presence and rich presence features to display detailed player status and game activity for in-game social interactions. + + }> + Integrating Discord's social features on console platforms, ensuring a consistent experience across different devices. + + }> + Techniques for managing and displaying in-game friends, allowing players to connect and play with their Discord friends easily. + + }> + Guidelines for linking Discord channels to your game, enabling players to connect and communicate across different platforms. + + + +--- + +## Change Log + +| Date | Changes | +|----------------|-----------------| +| March 17, 2025 | initial release | diff --git a/docs/discord-social-sdk/design-guidelines/branding-guidelines.mdx b/discord/developers/docs/discord-social-sdk/design-guidelines/branding-guidelines.mdx similarity index 72% rename from docs/discord-social-sdk/design-guidelines/branding-guidelines.mdx rename to discord/developers/docs/discord-social-sdk/design-guidelines/branding-guidelines.mdx index 1157217c58..fd25210bf9 100644 --- a/docs/discord-social-sdk/design-guidelines/branding-guidelines.mdx +++ b/discord/developers/docs/discord-social-sdk/design-guidelines/branding-guidelines.mdx @@ -1,18 +1,15 @@ --- -sidebar_label: Branding Guidelines +title: Branding Guidelines +description: Official branding guidelines for using Discord's brand assets in your integration. --- -[Home](/docs/intro) > [Discord Social SDK](/docs/discord-social-sdk/overview) > [Design Guidelines](/docs/discord-social-sdk/design-guidelines) > Branding Guidelines - -# Branding Guidelines - ## Discord Logo Download the Discord word-mark assets [discord.com/branding](https://discord.com/branding). Please do not edit, change, distort, recolor, or reconfigure the Discord logo. -![Discord Logo](images/social-sdk/design-guidelines/Brand-02.webp) +![Discord Logo](/images/social-sdk/design-guidelines/Brand-02.png) ## Buttons @@ -26,7 +23,7 @@ The Flexible buttons are intended to be restyled to match the game's aesthetic ( These pre-styled buttons leverage colors vetted by our Design Systems team to pass contrast ratios across different backgrounds. -![Brand Buttons](images/social-sdk/design-guidelines/Brand-03.webp) +![Brand Buttons](/images/social-sdk/design-guidelines/Brand-03.png) ## Spacing @@ -34,7 +31,7 @@ Ensure that there is adequate spacing between button text and the Discord logo a When using the Flexible button styling, ensure that your typeface's baseline and x-height are aligned to the Discord logo. -![Brand Spacing](images/social-sdk/design-guidelines/Brand-04.webp) +![Brand Spacing](/images/social-sdk/design-guidelines/Brand-04.png) ## Resources @@ -44,4 +41,4 @@ When using the Flexible button styling, ensure that your typeface's baseline and | Date | Changes | |----------------|-----------------| -| March 17, 2025 | initial release | +| March 17, 2025 | Initial Release | diff --git a/docs/discord-social-sdk/design-guidelines/chat-history.mdx b/discord/developers/docs/discord-social-sdk/design-guidelines/chat-history.mdx similarity index 65% rename from docs/discord-social-sdk/design-guidelines/chat-history.mdx rename to discord/developers/docs/discord-social-sdk/design-guidelines/chat-history.mdx index ddd0d1d3e6..e3da97525b 100644 --- a/docs/discord-social-sdk/design-guidelines/chat-history.mdx +++ b/discord/developers/docs/discord-social-sdk/design-guidelines/chat-history.mdx @@ -1,19 +1,15 @@ --- -sidebar_label: Chat History +title: Chat History +description: Design guidelines for displaying and managing chat history from Discord. --- -[Home](/docs/intro) > [Discord Social SDK](/docs/discord-social-sdk/overview) > [Design Guidelines](/docs/discord-social-sdk/design-guidelines) > Chat History - -# Chat History - - ## Style recommendations Chat history is a highly requested **optional** feature that helps players pick up conversations where they left off—whether they're returning to a lobby or jumping back into a linked channel. We recommend showing **timestamps** to give players better context about when messages were sent and seen. -![Badge when online elsewhere](images/social-sdk/design-guidelines/ChatHistory-02.webp) +![Badge when online elsewhere](/images/social-sdk/design-guidelines/ChatHistory-02.webp) ## Display logic @@ -21,13 +17,13 @@ If one player is messaging from a game lobby or linked channel, then chat histor When players return to a lobby or open a linked channel, we recommend surfacing **10 to 15** of the most recent messages to provide meaningful context. This isn't a hard limit—older messages can be revealed through scroll or loading more content, depending on your UI constraints. -![Message styling](images/social-sdk/design-guidelines/ChatHistory-03.webp) +![Message styling](/images/social-sdk/design-guidelines/ChatHistory-03.webp) --- ## Resources -- [Development Guide: Creating and Managing Lobbies](/docs/discord-social-sdk/development-guides/managing-lobbies) +- [Development Guide: Creating and Managing Lobbies](/developers/docs/discord-social-sdk/development-guides/managing-lobbies) ## Change Log diff --git a/docs/discord-social-sdk/design-guidelines/connection-points.mdx b/discord/developers/docs/discord-social-sdk/design-guidelines/connection-points.mdx similarity index 66% rename from docs/discord-social-sdk/design-guidelines/connection-points.mdx rename to discord/developers/docs/discord-social-sdk/design-guidelines/connection-points.mdx index 9cde704ec1..63ea8dc960 100644 --- a/docs/discord-social-sdk/design-guidelines/connection-points.mdx +++ b/discord/developers/docs/discord-social-sdk/design-guidelines/connection-points.mdx @@ -1,8 +1,9 @@ --- sidebar_label: Connection Points +description: Design guidelines for creating effective connection points between your application and Discord. --- -[Home](/docs/intro) > [Discord Social SDK](/docs/discord-social-sdk/overview) > [Design Guidelines](/docs/discord-social-sdk/design-guidelines) > Connection Points +[Home](/developers/docs/intro) > [Discord Social SDK](/developers/docs/discord-social-sdk/overview) > [Design Guidelines](/developers/docs/discord-social-sdk/design-guidelines) > Connection Points # Connection Points @@ -14,9 +15,9 @@ If the game has account management, then this connection point is **required**, Discord's sign-in button is presented as the **primary option** to log-in for the player amongst the list of **external identity-providers** due to providing deeper user-benefits than a standard OAuth login. -Please use the [**Blurple Button**](/docs/discord-social-sdk/design-guidelines/branding-guidelines#buttons) button styling for the sign-in connection point. +Please use the [**Blurple Button**](/developers/docs/discord-social-sdk/design-guidelines/branding-guidelines#buttons) button styling for the sign-in connection point. -![Signing In](images/social-sdk/design-guidelines/ConnectionPoints-03.webp) +![Signing In](/images/social-sdk/design-guidelines/ConnectionPoints-03.png) ## Friends list @@ -26,7 +27,7 @@ Select your preferred _button-styling_ for the friends list connection point (se After the player connects their account, the connection point is no longer visible. -![Friends List](images/social-sdk/design-guidelines/ConnectionPoints-04.webp) +![Friends List](/images/social-sdk/design-guidelines/ConnectionPoints-04.png) ## Content Guidelines @@ -34,7 +35,7 @@ Please use the strings shown here within the relevant contexts. These connection point strings should be consistent across all games that use the Discord Social SDK to help the user build recognition, trust, and understanding when taking this action. -![Content Guidelines](images/social-sdk/design-guidelines/ConnectionPoints-05.webp) +![Content Guidelines](/images/social-sdk/design-guidelines/ConnectionPoints-05.png) --- diff --git a/docs/discord-social-sdk/design-guidelines/consoles.mdx b/discord/developers/docs/discord-social-sdk/design-guidelines/consoles.mdx similarity index 58% rename from docs/discord-social-sdk/design-guidelines/consoles.mdx rename to discord/developers/docs/discord-social-sdk/design-guidelines/consoles.mdx index fd25681b3f..036551f828 100644 --- a/docs/discord-social-sdk/design-guidelines/consoles.mdx +++ b/discord/developers/docs/discord-social-sdk/design-guidelines/consoles.mdx @@ -1,12 +1,9 @@ --- -sidebar_label: Consoles +title: Consoles +description: Design guidelines for implementing Discord Social SDK features on gaming consoles. --- -import ConsoleAccess from '../partials/callouts/console-access.mdx'; - -[Home](/docs/intro) > [Discord Social SDK](/docs/discord-social-sdk/overview) > [Design Guidelines](/docs/discord-social-sdk/design-guidelines) > {sidebar_label} - -# {sidebar_label} +import ConsoleAccess from '/snippets/discord-social-sdk/callouts/console-access.mdx'; @@ -14,7 +11,7 @@ Players expect a consistent Discord social experience across devices—whether o Console players **will need a secondary device** to experience the full benefits of the Discord Social SDK. -![Connect on console](images/social-sdk/design-guidelines/Consoles-02.webp) +![Connect on console](/images/social-sdk/design-guidelines/Consoles-02.jpg) ## Connect to Discord on console @@ -24,31 +21,31 @@ Users will need to use a mobile device or computer in order to avoid the clunky A player without an existing Discord account can create one easily on the web. -![Connect on console](images/social-sdk/design-guidelines/Consoles-03.webp) +![Connect on console](/images/social-sdk/design-guidelines/Consoles-03.jpg) Users can skip the device code screen by scanning the QR code with their mobile camera. They will be prompted to authorize the game. If the Discord app is not detected upon scanning, users are prompted to sign in and connect via the web browser. If a player does not wish to use the QR scan, they will need to go to discord.com/activate to enter the 8-digit code. -![connecting with your phone](images/social-sdk/design-guidelines/Consoles-04.webp) +![connecting with your phone](/images/social-sdk/design-guidelines/Consoles-04.jpg) ## Chatting on console Game chat will be available for games who support the feature on consoles. However, unsupported rich media from Discord (i.e. attachments, polls, voice messages, etc.) should not include a clickable link icon. Similar to the auth flow, we do not want to encourage players to visit Discord in the console web browser—they should use secondary devices to view this content. -![chat on console](images/social-sdk/design-guidelines/Consoles-05.webp) +![chat on console](/images/social-sdk/design-guidelines/Consoles-05.jpg) ## Friends list on console -Please leverage the same [friends list guidelines](/docs/discord-social-sdk/design-guidelines/unified-friends-list) previously documented in the playbook. There are no notable differences in the friends list on console in comparison to other devices. However, consoles do not support hover interactions so there needs to be console-friendly way for players to access secondary information (such as alternate identities) about friends in the list. +Please leverage the same [friends list guidelines](/developers/docs/discord-social-sdk/design-guidelines/unified-friends-list) previously documented in the playbook. There are no notable differences in the friends list on console in comparison to other devices. However, consoles do not support hover interactions so there needs to be console-friendly way for players to access secondary information (such as alternate identities) about friends in the list. -![chat on console](images/social-sdk/design-guidelines/Consoles-06.webp) +![chat on console](/images/social-sdk/design-guidelines/Consoles-06.jpg) --- ## Resources -- [Development Guide: Account Linking on Consoles](/docs/discord-social-sdk/development-guides/account-linking-on-consoles) +- [Development Guide: Account Linking on Consoles](/developers/docs/discord-social-sdk/development-guides/account-linking-on-consoles) ## Change Log diff --git a/docs/discord-social-sdk/design-guidelines/direct-messages.mdx b/discord/developers/docs/discord-social-sdk/design-guidelines/direct-messages.mdx similarity index 55% rename from docs/discord-social-sdk/design-guidelines/direct-messages.mdx rename to discord/developers/docs/discord-social-sdk/design-guidelines/direct-messages.mdx index a992db8e79..860ff6da3e 100644 --- a/docs/discord-social-sdk/design-guidelines/direct-messages.mdx +++ b/discord/developers/docs/discord-social-sdk/design-guidelines/direct-messages.mdx @@ -1,38 +1,34 @@ --- -sidebar_label: Direct Messages +title: Direct Messages +description: Design guidelines for implementing Discord direct messaging features in your application. --- -[Home](/docs/intro) > [Discord Social SDK](/docs/discord-social-sdk/overview) > [Design Guidelines](/docs/discord-social-sdk/design-guidelines) > Direct Messages - -# Direct Messages - - ## Badge when online elsewhere -The badging logic in direct-messages is consistent with the logic detailed in the [Unified Friends List](/docs/discord-social-sdk/design-guidelines/unified-friends-list) section. +The badging logic in direct-messages is consistent with the logic detailed in the [Unified Friends List](/developers/docs/discord-social-sdk/design-guidelines/unified-friends-list) section. If the user is **online elsewhere** and is not in the game client, their usernames will include a **Discord badge**. Once they're online in the game-client, they will not retain the Discord badge. -![Badge when online elsewhere](images/social-sdk/design-guidelines/animated/DMs-02.gif) +![Badge when online elsewhere](/images/social-sdk/design-guidelines/animated/DMs-02.gif) ## Message styling Style the Discord logo to match a player's username color. The logo should feel tied to a user's identity, not the message content. -![Message styling](images/social-sdk/design-guidelines/DMs-03.webp) +![Message styling](/images/social-sdk/design-guidelines/DMs-03.png) ## Unsupported rich media Regardless of whether a user has signed into Discord, unsupported rich media content should be paired with an **external link icon**. When content isn't clickable, don't show the icon. -![Unsupported rich media](images/social-sdk/design-guidelines/DMs-04.webp) +![Unsupported rich media](/images/social-sdk/design-guidelines/DMs-04.png) --- ## Resources -- [Development Guide: Direct Messages](/docs/discord-social-sdk/development-guides/sending-direct-messages) +- [Development Guide: Direct Messages](/developers/docs/discord-social-sdk/development-guides/sending-direct-messages) ## Change Log diff --git a/docs/discord-social-sdk/design-guidelines/game-friends.mdx b/discord/developers/docs/discord-social-sdk/design-guidelines/game-friends.mdx similarity index 71% rename from docs/discord-social-sdk/design-guidelines/game-friends.mdx rename to discord/developers/docs/discord-social-sdk/design-guidelines/game-friends.mdx index 6e3c8b6805..ba84ba3972 100644 --- a/docs/discord-social-sdk/design-guidelines/game-friends.mdx +++ b/discord/developers/docs/discord-social-sdk/design-guidelines/game-friends.mdx @@ -1,14 +1,11 @@ --- -sidebar_label: Game Friends +title: Game Friends +description: Design guidelines for displaying and managing game friends and Discord relationships. --- -[Home](/docs/intro) > [Discord Social SDK](/docs/discord-social-sdk/overview) > [Design Guidelines](/docs/discord-social-sdk/design-guidelines) > {sidebar_label} - -# {sidebar_label} - -:::info + Any in-game imagery used in is purely fictional for concept purposes. -::: + ## User needs @@ -16,7 +13,7 @@ We've heard from players that they want more of a distinction between connection Users want more controls over how in-game relationships extend beyond the game client with communication, presence, and identity. -![User needs](images/social-sdk/design-guidelines/GameFriends-02.webp) +![User needs](/images/social-sdk/design-guidelines/GameFriends-02.png) ## Game Friends — A new tier @@ -24,7 +21,7 @@ Discord is introducing a new tier of friendship called **Game Friends**. Game Friends are a way to create an in-game relationship with another player that provides all of the in-game benefits, but limits how the relationship extends outside the game. -![Game Friends](images/social-sdk/design-guidelines/GameFriends-03.webp) +![Game Friends](/images/social-sdk/design-guidelines/GameFriends-03.png) ## Game vs Discord Friends @@ -36,13 +33,13 @@ A Game Friend **can reach Discord-connected friends outside the game** by DMing A Game Friend **cannot see your rich presence** beyond the game your friendship originated in. The exception is if both friends have their Discord accounts connected and are in a shared server. -![Game vs Discord Friends](images/social-sdk/design-guidelines/GameFriends-04.webp) +![Game vs Discord Friends](/images/social-sdk/design-guidelines/GameFriends-04.png) ## Equally-weighted When adding a new friend, **present two options to players with "Game Friends" listed first**, since it's the more localized/limited friend-tier. Please ensure that neither type of friend is pre-selected in the UI — present them equally to the user (ordering aside for above reasons). -![Equally-weighted friend options](images/social-sdk/design-guidelines/GameFriends-05.webp) +![Equally-weighted friend options](/images/social-sdk/design-guidelines/GameFriends-05.png) ## Adding friends @@ -50,37 +47,37 @@ If the user is not yet a friend, show both options of adding as either a Game or If a user is already your Game Friend, show the action to also add them on Discord. -![Adding friends](images/social-sdk/design-guidelines/GameFriends-06.webp) +![Adding friends](/images/social-sdk/design-guidelines/GameFriends-06.png) ## Removing friends When removing a Game Friend or Discord Friend, show players the standard "Remove Friend" action. The SDK will remove the friend across whatever friendships are applicable. -![Removing friends](images/social-sdk/design-guidelines/GameFriends-07.webp) +![Removing friends](/images/social-sdk/design-guidelines/GameFriends-07.png) ## Style guidelines When removing a Game Friend or Discord Friend, show players the standard "Remove Friend" action. The SDK will remove the friend across whatever friendships are applicable. -![Removing friends](images/social-sdk/design-guidelines/GameFriends-08.webp) +![Removing friends](/images/social-sdk/design-guidelines/GameFriends-08.png) ## UX, not UI The visual styling of the "Add Friend" menu-items is not intended to be prescriptive. So long as both options are equally-weighted, please use whichever UI fits your game's needs. -![UX, not UI](images/social-sdk/design-guidelines/GameFriends-09.webp) +![UX, not UI](/images/social-sdk/design-guidelines/GameFriends-09.png) ## Setting on Discord This mock showcases how the corresponding DM looks within Discord's UI. -![Removing friends](images/social-sdk/design-guidelines/GameFriends-10.webp) +![Removing friends](/images/social-sdk/design-guidelines/GameFriends-10.png) --- ## Resources -- [Development Guide: Managing Relationships](/docs/discord-social-sdk/development-guides/managing-relationships) +- [Development Guide: Managing Relationships](/developers/docs/discord-social-sdk/development-guides/managing-relationships) ## Change Log diff --git a/docs/discord-social-sdk/design-guidelines/linked-channels.mdx b/discord/developers/docs/discord-social-sdk/design-guidelines/linked-channels.mdx similarity index 75% rename from docs/discord-social-sdk/design-guidelines/linked-channels.mdx rename to discord/developers/docs/discord-social-sdk/design-guidelines/linked-channels.mdx index 1046735d01..aae8afa9e9 100644 --- a/docs/discord-social-sdk/design-guidelines/linked-channels.mdx +++ b/discord/developers/docs/discord-social-sdk/design-guidelines/linked-channels.mdx @@ -1,20 +1,13 @@ --- -sidebar_label: Linked Channels +title: Linked Channels +description: Design guidelines for integrating Discord channel functionality into your application. --- -[Home](/docs/intro) > [Discord Social SDK](/docs/discord-social-sdk/overview) > [Design Guidelines](/docs/discord-social-sdk/design-guidelines) > {sidebar_label} - -# {sidebar_label} - ## Link in-game chats to Discord Empower players to continue their conversations beyond the game. Now you can link an in-game chat to a text-channel on Discord. -![Link in-game chats to Discord](images/social-sdk/design-guidelines/animated/LinkedChannels-02.gif) - -### Linking a channel via the game - -![Linking a channel via the game](images/social-sdk/design-guidelines/animated/LinkedChannel-Setup.webp) +![Linking a channel via the game](/images/social-sdk/design-guidelines/animated/LinkedChannel-Setup.gif) ## Style guidelines @@ -30,7 +23,7 @@ The official feature-name that will be reflected across the Discord client is "L Please use the string guidance from above: "Link \{groupChat\} to Discord." For interface, use whichever UI treatment that fits your game's needs. -![Linked channel style guidelines](images/social-sdk/design-guidelines/LinkedChannels-04.webp) +![Linked channel style guidelines](/images/social-sdk/design-guidelines/LinkedChannels-04.png) ## Selecting a channel @@ -44,7 +37,7 @@ Please include the following in the selection UI: - List of **servers** and their nested **text-channels** with respective iconography (ie, private channel has a lock) - **Search bar** for channel-names -![Selecting a channel](images/social-sdk/design-guidelines/LinkedChannels-05.webp) +![Selecting a channel](/images/social-sdk/design-guidelines/LinkedChannels-05.png) ## Setup warning @@ -52,7 +45,7 @@ Players can link channels with **limited access** on Discord. Doing so will allo Show a **warning** when a user is about to link to a channel with limited access. We strongly recommend you use the copy shown to the right image. -![Setup warning](images/social-sdk/design-guidelines/LinkedChannels-06.webp) +![Setup warning](/images/social-sdk/design-guidelines/LinkedChannels-06.png) ## Success state & Entrypoint @@ -62,7 +55,7 @@ Separately, create a **persistent entrypoint** somewhere in the game UI. This pe [You can download the official "Linked Channels" channel-icon in our GitHub repository.](https://github.com/discord/discord-api-docs/blob/main/resources/discord-social-sdk) -![Success state & Entrypoint](images/social-sdk/design-guidelines/LinkedChannels-07.webp) +![Success state & Entrypoint](/images/social-sdk/design-guidelines/LinkedChannels-07.png) ## Removing Channel Link @@ -72,13 +65,13 @@ Players can remove the channel link from either the game client or the Discord c When "Remove channel-link" is interacted with, show the player a **confirmation** dialog to confirm this action. -![Removing Channel Link](images/social-sdk/design-guidelines/animated/LinkedChannels-08.gif) +![Removing Channel Link](/images/social-sdk/design-guidelines/animated/LinkedChannels-08.gif) --- ## Resources -- [Development Guide: Linked Channels](/docs/discord-social-sdk/development-guides/linked-channels) +- [Development Guide: Linked Channels](/developers/docs/discord-social-sdk/development-guides/linked-channels) - [Design Assets: Linked Channel Icon](https://github.com/discord/discord-api-docs/blob/main/resources/discord-social-sdk) ## Change Log diff --git a/docs/discord-social-sdk/design-guidelines/principles.mdx b/discord/developers/docs/discord-social-sdk/design-guidelines/principles.mdx similarity index 63% rename from docs/discord-social-sdk/design-guidelines/principles.mdx rename to discord/developers/docs/discord-social-sdk/design-guidelines/principles.mdx index 7c9b37462d..a129caaa7d 100644 --- a/docs/discord-social-sdk/design-guidelines/principles.mdx +++ b/discord/developers/docs/discord-social-sdk/design-guidelines/principles.mdx @@ -1,44 +1,41 @@ --- -sidebar_label: Principles +title: Principles +description: Core design principles for creating effective Discord Social SDK integrations. --- -[Home](/docs/intro) > [Discord Social SDK](/docs/discord-social-sdk/overview) > [Design Guidelines](/docs/discord-social-sdk/design-guidelines) > Principles - -# Principles - -:::info + Any in-game imagery used in is purely fictional for concept purposes. -::: + ## 1. Add Value for the Player This integration aims to bring value to the player's gaming experience. Branded connection points should highlight said value-add based on the context. -![Add Value for the Player](images/social-sdk/design-guidelines/Principle-03.webp) +![Add Value for the Player](/images/social-sdk/design-guidelines/Principle-03.png) ## 2. Foster trust with Discord's brand Lean into Discord's visual-styling to establish trust through brand recognition. The more players that connect, the more robust the social graph is for the game. -![Foster trust with Discord's brand](images/social-sdk/design-guidelines/Principle-04.webp) +![Foster trust with Discord's brand](/images/social-sdk/design-guidelines/Principle-04.png) ## 3. Promote Understanding through consistency Use consistent branding and user-flows across games to build expected behavior. We care about the UX, not the UI. -![Promote Understanding through consistency](images/social-sdk/design-guidelines/Principle-05.webp) +![Promote Understanding through consistency](/images/social-sdk/design-guidelines/Principle-05.png) ## 4. Prioritize the player's immersion Our focus is on preserving the player's immersion in the game. There are no requirements to replicate Discord's UI. The visual-design should feel as seamlessly integrated into the game as our SDKs. -![Prioritize the player's immersion](images/social-sdk/design-guidelines/Principle-06.webp) +![Prioritize the player's immersion](/images/social-sdk/design-guidelines/Principle-06.png) ## 5. Uphold data privacy, transparency, and control Each platform is in control and responsible for the data on their respective platforms. Players are informed of where their data shows up. -![Uphold data privacy, transparency, and control](images/social-sdk/design-guidelines/Principle-07.webp) +![Uphold data privacy, transparency, and control](/images/social-sdk/design-guidelines/Principle-07.png) --- diff --git a/docs/discord-social-sdk/design-guidelines/provisional-accounts.mdx b/discord/developers/docs/discord-social-sdk/design-guidelines/provisional-accounts.mdx similarity index 70% rename from docs/discord-social-sdk/design-guidelines/provisional-accounts.mdx rename to discord/developers/docs/discord-social-sdk/design-guidelines/provisional-accounts.mdx index a7d38a877d..5211bfea48 100644 --- a/docs/discord-social-sdk/design-guidelines/provisional-accounts.mdx +++ b/discord/developers/docs/discord-social-sdk/design-guidelines/provisional-accounts.mdx @@ -1,10 +1,9 @@ --- -sidebar_label: Provisional Accounts +title: Provisional Accounts +description: Design guidelines for handling provisional Discord accounts and onboarding users. --- -[Home](/docs/intro) > [Discord Social SDK](/docs/discord-social-sdk/overview) > [Design Guidelines](/docs/discord-social-sdk/design-guidelines) > Provisional Accounts - -# Provisional Accounts +import {ManualAnchor} from '/snippets/manualanchor.jsx' ## For those who don't connect a Discord account @@ -12,15 +11,16 @@ Not all users are going to link their Discord account to their game. This create The Discord Social SDK has built provisional accounts as a way for game-devs to create a lightweight, **limited Discord account** for unlinked users, so you can use the same APIs regardless of whether a user has connected their Discord account or not. -![Badge when online elsewhere](images/social-sdk/design-guidelines/Prov-02.webp) +![Badge when online elsewhere](/images/social-sdk/design-guidelines/Prov-02.png) + ## What is a provisional account? To players, a provisional account is simply a **standard account** that has yet to be linked to Discord. They have access to standard communication features you'd expect any game user to have. The complexity around provisional accounts that game-developers have to handle are invisible to players in the game. -![What is a provisional account?](images/social-sdk/design-guidelines/Prov-03.webp) +![What is a provisional account?](/images/social-sdk/design-guidelines/Prov-03.png) ## How provisional accounts look within the game @@ -28,7 +28,7 @@ Provisional accounts **won't have the Discord badge** by their username in the f Only players who've connected their Discord accounts and have provisional account friends from other games using the Discord Social SDK will see this state. -![How provisional accounts look within the game](images/social-sdk/design-guidelines/Prov-04.webp) +![How provisional accounts look within the game](/images/social-sdk/design-guidelines/Prov-04.png) ## How provisional accounts look within Discord @@ -36,13 +36,13 @@ Provisional accounts will leverage **branded avatars** and **text-hints** on Dis Because provisional accounts have limited capabilities, for example, you cannot start a voice or video call with them, it's important to visually distinguish them from Discord users. -![How provisional accounts look within Discord](images/social-sdk/design-guidelines/Prov-05.webp) +![How provisional accounts look within Discord](/images/social-sdk/design-guidelines/Prov-05.png) --- ## Resources -- [Development Guide: Using Provisional Accounts](/docs/discord-social-sdk/development-guides/using-provisional-accounts) +- [Development Guide: Using Provisional Accounts](/developers/docs/discord-social-sdk/development-guides/using-provisional-accounts) ## Change Log diff --git a/docs/discord-social-sdk/design-guidelines/signing-in.mdx b/discord/developers/docs/discord-social-sdk/design-guidelines/signing-in.mdx similarity index 68% rename from docs/discord-social-sdk/design-guidelines/signing-in.mdx rename to discord/developers/docs/discord-social-sdk/design-guidelines/signing-in.mdx index 975587cab2..a98e30ec05 100644 --- a/docs/discord-social-sdk/design-guidelines/signing-in.mdx +++ b/discord/developers/docs/discord-social-sdk/design-guidelines/signing-in.mdx @@ -1,38 +1,31 @@ --- -sidebar_label: Signing In +title: Signing In +description: Design guidelines for implementing Discord sign-in flows and authentication. --- -[Home](/docs/intro) > [Discord Social SDK](/docs/discord-social-sdk/overview) > [Design Guidelines](/docs/discord-social-sdk/design-guidelines) > Signing In - -# Signing In - -:::info + Any in-game imagery used in is purely fictional for concept purposes. -::: + ## Overall flow -Sign-in or log-in flows all begin with the interaction of a [**Discord-styled button**](/docs/discord-social-sdk/design-guidelines/branding-guidelines#buttons). +Sign-in or log-in flows all begin with the interaction of a [**Discord-styled button**](/developers/docs/discord-social-sdk/design-guidelines/branding-guidelines#buttons). The Discord Social SDK will support the user-journeys for those who already **have a Discord account** and those who **do not**. We will similarly support those who have Discord installed as well as those who do not (via browser). A player can also proceed **without** connecting their Discord and continue onwards to playing their game. -![Overall Flow](images/social-sdk/design-guidelines/SigningIn-02.webp) - -### Connecting your Discord account via Discord client (gif) - -![Connecting your Discord account via Discord client](images/social-sdk/design-guidelines/animated/Connecting-via-Client.webp) +![Overall Flow](/images/social-sdk/design-guidelines/SigningIn-02.png) ### Connecting your Discord account via Browser (gif) -![Connecting your Discord account via Browser](images/social-sdk/design-guidelines/animated/Connecting-via-Browser.webp) +![Connecting your Discord account via Browser](/images/social-sdk/design-guidelines/animated/Connecting-via-Browser.gif) ## Overlay Authorization Discord's [Overlay](https://support.discord.com/hc/en-us/articles/217659737-Game-Overlay-101) feature can be used to enable authorization without ever leaving the game. This is available for games who support the feature. -![Overlay Authorization](images/social-sdk/design-guidelines/SigningIn-05.webp) +![Overlay Authorization](/images/social-sdk/design-guidelines/SigningIn-05.png) ## Before the user connects @@ -46,7 +39,7 @@ This modal should include some of the key value props that the Discord Social SD - Show when player interacts with the friends list for the first time - Show in the authorization flow once a player taps the Discord connection point -![Before the user connects](images/social-sdk/design-guidelines/SigningIn-06.webp) +![Before the user connects](/images/social-sdk/design-guidelines/SigningIn-06.png) ## After the user connects @@ -60,7 +53,7 @@ Include the following points sequentially in the game' s writing-style. Remove a - You can chat with your friends here and on Discord - It might take some time for your game friends to show up in your Discord -![After the user connects](images/social-sdk/design-guidelines/SigningIn-07.webp) +![After the user connects](/images/social-sdk/design-guidelines/SigningIn-07.png) ## Error State @@ -70,13 +63,13 @@ Please include these key points sequentially in the game's writing-style: - We were unable to connect your Discord account - A call-to-action that redirects back to Discord with the initial authorization modal -![Error State](images/social-sdk/design-guidelines/SigningIn-08.webp) +![Error State](/images/social-sdk/design-guidelines/SigningIn-08.png) --- ## Resources -- [Development Guide: Account Linking with Discord](/docs/discord-social-sdk/development-guides/account-linking-with-discord) +- [Development Guide: Account Linking with Discord](/developers/docs/discord-social-sdk/development-guides/account-linking-with-discord) ## Change Log diff --git a/docs/discord-social-sdk/design-guidelines/social-settings.mdx b/discord/developers/docs/discord-social-sdk/design-guidelines/social-settings.mdx similarity index 59% rename from docs/discord-social-sdk/design-guidelines/social-settings.mdx rename to discord/developers/docs/discord-social-sdk/design-guidelines/social-settings.mdx index b869233c7e..0084236453 100644 --- a/docs/discord-social-sdk/design-guidelines/social-settings.mdx +++ b/discord/developers/docs/discord-social-sdk/design-guidelines/social-settings.mdx @@ -1,28 +1,25 @@ --- -sidebar_label: Social Settings +title: Social Settings +description: Design guidelines for implementing social settings and privacy controls. --- -[Home](/docs/intro) > [Discord Social SDK](/docs/discord-social-sdk/overview) > [Design Guidelines](/docs/discord-social-sdk/design-guidelines) > Social Settings - -# Social Settings - ## Evolving with users Discord is listening to feedback and releasing settings for players to tailor their social experience to their needs. These settings will continue to change and evolve with the SDK and Discord client. Discord Social SDK settings are global, meaning they will impact all games that use the Discord Social SDK. These settings live in the Discord client. -![Evolving with users](images/social-sdk/design-guidelines/SocialSettings-02.webp) +![Evolving with users](/images/social-sdk/design-guidelines/SocialSettings-02.webp) ## Main entrypoint An entrypoint is required in games to -[send players to the relevant Discord client settings page](/docs/discord-social-sdk/development-guides/sending-direct-messages#ingame-direct-message-settings). +[send players to the relevant Discord client settings page](/developers/docs/discord-social-sdk/development-guides/sending-direct-messages#ingame-direct-message-settings). Only players who have their Discord account connected should see this. Exactly like the auth flow, players will be redirected to the Discord client to manage their social settings. If they do not have the client, the browser will be the fallback. -![Main entrypoint](images/social-sdk/design-guidelines/SocialSettings-03.webp) +![Main entrypoint](/images/social-sdk/design-guidelines/SocialSettings-03.webp) ## Content guidelines @@ -30,16 +27,16 @@ The official settings title for players is "Discord Social Experience." Use this The description is optional, but if your game settings has the space, we recommend describing what users should expect to find when they navigate to Discord. -![Content guidelines](images/social-sdk/design-guidelines/SocialSettings-04.webp) +![Content guidelines](/images/social-sdk/design-guidelines/SocialSettings-04.webp) --- ## Resources -- [Development Guide: Direct Messages](/docs/discord-social-sdk/development-guides/sending-direct-messages) +- [Development Guide: Direct Messages](/developers/docs/discord-social-sdk/development-guides/sending-direct-messages) ## Change Log | Date | Changes | |--------------|-----------------| -| May 08, 2025 | initial release | \ No newline at end of file +| May 08, 2025 | Initial Release | diff --git a/docs/discord-social-sdk/design-guidelines/status-rich-presence.mdx b/discord/developers/docs/discord-social-sdk/design-guidelines/status-rich-presence.mdx similarity index 59% rename from docs/discord-social-sdk/design-guidelines/status-rich-presence.mdx rename to discord/developers/docs/discord-social-sdk/design-guidelines/status-rich-presence.mdx index cb0ff16621..3e0f2102a3 100644 --- a/docs/discord-social-sdk/design-guidelines/status-rich-presence.mdx +++ b/discord/developers/docs/discord-social-sdk/design-guidelines/status-rich-presence.mdx @@ -1,11 +1,8 @@ --- -sidebar_label: Status & Rich Presence +title: Status & Rich Presence +description: Design guidelines for displaying user status and Rich Presence information. --- -[Home](/docs/intro) > [Discord Social SDK](/docs/discord-social-sdk/overview) > [Design Guidelines](/docs/discord-social-sdk/design-guidelines) > Status & Rich Presence - -# Status & Rich Presence - This guide provides best practices and design guidelines for integrating status and rich presence features within your game. These features are essential for enhancing player engagement and providing real-time information about player activities. By following this guide, you will learn how to: @@ -16,11 +13,11 @@ By following this guide, you will learn how to: ## Core statuses, plus game-specific -![Core statuses, plus game-specific](images/social-sdk/design-guidelines/StatusPresence-02.webp) +![Core statuses, plus game-specific](/images/social-sdk/design-guidelines/StatusPresence-02.png) ## Status matrix -![Status matrix](images/social-sdk/design-guidelines/StatusPresence-03.webp) +![Status matrix](/images/social-sdk/design-guidelines/StatusPresence-03.png) ## Side-by-side @@ -28,7 +25,7 @@ Any of the **core statuses** (online, idle, DND, offline) will always be the sam You can customize the status icon, but custom icons will only render within the game. -![Side-by-side](images/social-sdk/design-guidelines/StatusPresence-04.webp) +![Side-by-side](/images/social-sdk/design-guidelines/StatusPresence-04.png) ## Core style guidelines @@ -38,24 +35,24 @@ In other words, as long as the status colors read as yellow/green/red, and the s Avatars are not required. -![Core style guidelines](images/social-sdk/design-guidelines/StatusPresence-05.webp) +![Core style guidelines](/images/social-sdk/design-guidelines/StatusPresence-05.png) ## Rich Presence The game developer should set rich presence — this will show in both the Discord and game client. -Please refer to [**Setting Rich Presence**](/docs/discord-social-sdk/development-guides/setting-rich-presence) for more information on Rich Presence, such as other types of traits that can be included. +Please refer to [**Setting Rich Presence**](/developers/docs/discord-social-sdk/development-guides/setting-rich-presence) for more information on Rich Presence, such as other types of traits that can be included. -![Rich Presence](images/social-sdk/design-guidelines/StatusPresence-06.webp) +![Rich Presence](/images/social-sdk/design-guidelines/StatusPresence-06.png) --- ## Resources -- [Development Guide: Setting Rich Presence](/docs/discord-social-sdk/development-guides/setting-rich-presence) +- [Development Guide: Setting Rich Presence](/developers/docs/discord-social-sdk/development-guides/setting-rich-presence) ## Change Log | Date | Changes | |----------------|-----------------| -| March 17, 2025 | initial release | +| March 17, 2025 | Initial Release | diff --git a/docs/discord-social-sdk/design-guidelines/unified-friends-list.mdx b/discord/developers/docs/discord-social-sdk/design-guidelines/unified-friends-list.mdx similarity index 77% rename from docs/discord-social-sdk/design-guidelines/unified-friends-list.mdx rename to discord/developers/docs/discord-social-sdk/design-guidelines/unified-friends-list.mdx index 89fc5c958e..3bbf030966 100644 --- a/docs/discord-social-sdk/design-guidelines/unified-friends-list.mdx +++ b/discord/developers/docs/discord-social-sdk/design-guidelines/unified-friends-list.mdx @@ -1,11 +1,8 @@ --- -sidebar_label: Unified Friends List +title: Unified Friends List +description: Design guidelines for creating unified friends lists that combine Discord relationships. --- -[Home](/docs/intro) > [Discord Social SDK](/docs/discord-social-sdk/overview) > [Design Guidelines](/docs/discord-social-sdk/design-guidelines) > {sidebar_label} - -# {sidebar_label} - This guide provides best practices and design guidelines for integrating a unified friends list within your game. The unified friends list is a crucial feature that allows players to see and interact with their friends across different platforms and games, enhancing their overall social gaming experience. By following this guide, you will learn how to: @@ -28,7 +25,7 @@ We'd love your feedback! Join [Discord Developers Server](https://discord.gg/dis the `#social-sdk-dev-help` channel if you would like to see more resources like this, or if you have suggestions for improvement. -[![starter pack](images/social-sdk/design-guidelines/starter_pack.webp)](https://www.figma.com/community/file/1512487996808869592/the-social-sdk-friend-list-starter-pack) +[![starter pack](/images/social-sdk/design-guidelines/starter_pack.webp)](https://www.figma.com/community/file/1512487996808869592/the-social-sdk-friend-list-starter-pack) [See Figma Resource↗](https://www.figma.com/community/file/1512487996808869592/the-social-sdk-friend-list-starter-pack) @@ -42,7 +39,7 @@ The **Online — GameTitle** section shows friends who are online in the same ga The **Online — Elsewhere** section shows friends who are online but not in the same game. However, they can be messaged or invited to play the game. -![Sectioning Friends List](images/social-sdk/design-guidelines/UFL-02.webp) +![Sectioning Friends List](/images/social-sdk/design-guidelines/UFL-02.png) ## Discord = Communication @@ -50,7 +47,7 @@ Show the Discord badge next to a player's name when they are **online elsewhere* The Discord logo represents **universal communication**. It aims to convey to users: “As a player, I know I can message or invite this friend to play a game anywhere Discord is present.” This means via phone, computer, and even console. -![Discord logo represents universal communication](images/social-sdk/design-guidelines/UFL-03.webp) +![Discord logo represents universal communication](/images/social-sdk/design-guidelines/UFL-03.png) ## Identities @@ -60,7 +57,7 @@ If the friend does not own the game, use their **Discord Display Name**. If the friend does not own the game nor have a linked Discord account, fall back to their **Provisional identity**. -![Displaying different relationships](images/social-sdk/design-guidelines/UFL-04.webp) +![Displaying different relationships](/images/social-sdk/design-guidelines/UFL-04.png) ## Examples of friends lists @@ -68,7 +65,7 @@ A player's **console ID** is effectively their **game ID**, as consoles require The examples to the right show how the hierarchy translates to consoles. -![Examples of friends lists](images/social-sdk/design-guidelines/UFL-05.webp) +![Examples of friends lists](/images/social-sdk/design-guidelines/UFL-05.png) ## How did we land here? @@ -76,17 +73,17 @@ It reduces sudden **name changes** within the game, which can be confusing to th It's also **scalable** and **inclusive** of provisional accounts who do not have Discord accounts connected. -![How did we land here?](images/social-sdk/design-guidelines/animated/UFL-06.gif) +![How did we land here?](/images/social-sdk/design-guidelines/animated/UFL-06.gif) ## Discord Display Names When referring to a player's Discord Identity, please use their **Discord Display Name**, and not their username. -:::info -See [How to Manage Special Characters in Discord Display Names](/docs/discord-social-sdk/how-to/handle-special-characters-display-names) for guidance on handling special characters in text chat and friend lists. -::: + +See [How to Manage Special Characters in Discord Display Names](/developers/docs/discord-social-sdk/how-to/handle-special-characters-display-names) for guidance on handling special characters in text chat and friend lists. + -![Discord display names](images/social-sdk/design-guidelines/UFL-07.webp) +![Discord display names](/images/social-sdk/design-guidelines/UFL-07.png) ## Scaling to Multiple Platforms @@ -96,13 +93,13 @@ Prioritize player needs by elevating available players to the top of the friends Avoid friend-lists organized by company. This hierarchy dilutes the value-prop of putting online players first, in favor of platform delineation. -![Scaling to Multiple Platforms](images/social-sdk/design-guidelines/UFL-08.webp) +![Scaling to Multiple Platforms](/images/social-sdk/design-guidelines/UFL-08.png) --- ## Resources -- [Development Guide: Creating a Unified Friends List](/docs/discord-social-sdk/development-guides/creating-a-unified-friends-list) +- [Development Guide: Creating a Unified Friends List](/developers/docs/discord-social-sdk/development-guides/creating-a-unified-friends-list) - [Figma File - The Social SDK: Friend List Starter Pack ↗](https://www.figma.com/community/file/1512487996808869592/the-social-sdk-friend-list-starter-pack) ## Change Log diff --git a/discord/developers/docs/discord-social-sdk/development-guides.mdx b/discord/developers/docs/discord-social-sdk/development-guides.mdx new file mode 100644 index 0000000000..e95f6749b8 --- /dev/null +++ b/discord/developers/docs/discord-social-sdk/development-guides.mdx @@ -0,0 +1,65 @@ +--- +title: Discord Social SDK Development Guides Glossary +sidebarTitle: Glossary +description: Definitions and explanations of key terms used in Discord Social SDK development guides. +--- + +These guides include suggested development practices, and user flows for you to consider while integrating the Discord Social SDK into your game. These will help provide your users with a consistent and clear experience while interacting with your game. + +If you are new to the Discord Social SDK, we recommend you start with the [Getting Started](/developers/docs/discord-social-sdk/getting-started) guide. + +import {UserPlusIcon} from '/snippets/icons/UserPlusIcon.jsx' +import {GameControllerIcon} from '/snippets/icons/GameControllerIcon.jsx' +import {MagicWandIcon} from '/snippets/icons/MagicWandIcon.jsx' +import {ListViewIcon} from '/snippets/icons/ListViewIcon.jsx' +import {UserStatusIcon} from '/snippets/icons/UserStatusIcon.jsx' +import {InboxIcon} from '/snippets/icons/InboxIcon.jsx' +import {ChatIcon} from '/snippets/icons/ChatIcon.jsx' +import {DoorEnterIcon} from '/snippets/icons/DoorEnterIcon.jsx' +import {TextControllerIcon} from '/snippets/icons/TextControllerIcon.jsx' +import {VoiceNormalIcon} from '/snippets/icons/VoiceNormalIcon.jsx' + + +## Authentication & Account Linking + + + }> + Learn how to authenticate users with their Discord accounts using OAuth2. + + }> + Implement Discord authentication flows for console platforms. + + }> + Give your users a seamless account experience with provisional accounts. + + + +## Game Relationships, Presence & Game Invites + + }> + Combine Discord and game-specific friends in one view. + + }> + Display detailed game status in Discord profiles. + + }> + Allow players to invite friends to join their game session or party. + + + +## Text & Voice Chat + + + }> + Enable private messaging between players. + + }> + Bring players together in a shared lobby with invites, text chat, and voice comms. + + }> + Connect game lobbies to Discord text channels. + + }> + Add in-game voice communication. + + diff --git a/docs/discord-social-sdk/development-guides/account-linking-on-consoles.mdx b/discord/developers/docs/discord-social-sdk/development-guides/account-linking-on-consoles.mdx similarity index 80% rename from docs/discord-social-sdk/development-guides/account-linking-on-consoles.mdx rename to discord/developers/docs/discord-social-sdk/development-guides/account-linking-on-consoles.mdx index e82cef5a5c..3486241326 100644 --- a/docs/discord-social-sdk/development-guides/account-linking-on-consoles.mdx +++ b/discord/developers/docs/discord-social-sdk/development-guides/account-linking-on-consoles.mdx @@ -1,13 +1,10 @@ --- -sidebar_label: Account Linking on Consoles +title: Account Linking on Consoles +description: Implement Discord account linking on gaming consoles. --- -import ConsoleAccess from '../partials/callouts/console-access.mdx'; -import PublicClient from '../partials/callouts/public-client.mdx'; -import SupportCallout from '../partials/callouts/support.mdx'; - -[Home](/docs/intro) > [Discord Social SDK](/docs/discord-social-sdk/overview) > [Development Guides](/docs/discord-social-sdk/development-guides) > {sidebar_label} - -# {sidebar_label} +import PublicClient from '/snippets/discord-social-sdk/callouts/public-client.mdx'; +import SupportCallout from '/snippets/discord-social-sdk/callouts/support.mdx'; +import ConsoleAccess from '/snippets/discord-social-sdk/callouts/console-access.mdx'; ## Overview @@ -24,7 +21,7 @@ By following this guide, you will learn how to: Before you begin, make sure you have: -- Read the [Core Concepts](/docs/discord-social-sdk/core-concepts) guide to understand: +- Read the [Core Concepts](/developers/docs/discord-social-sdk/core-concepts) guide to understand: - OAuth2 authentication flow - Discord application setup - SDK initialization @@ -35,7 +32,7 @@ Before you begin, make sure you have: -If you haven't completed these prerequisites, we recommend following the [Getting Started](/docs/discord-social-sdk/getting-started) guide. +If you haven't completed these prerequisites, we recommend following the [Getting Started](/developers/docs/discord-social-sdk/getting-started) guide. --- @@ -49,11 +46,11 @@ Console users cannot authenticate via a web browser. Instead, they follow these The SDK can manage this process automatically or allow manual token handling. -:::info + The OAuth2 flow requires a user's account to be verified -::: + -![Authorization screen from using OpenAuthorizeDeviceScreen and GetTokenFromDevice](images/social-sdk/development-guides/authorize_device.webp) +![Authorization screen from using OpenAuthorizeDeviceScreen and GetTokenFromDevice](/images/social-sdk/development-guides/authorize_device.png) --- @@ -96,11 +93,11 @@ If you plan to handle console authorization manually, you can follow these steps We'll be following the same OAuth2 device authorization flow as the automatic method, but you'll need to manually handle the polling and token exchange. -1. [Request a device code from Discord](/docs/discord-social-sdk/development-guides/account-linking-on-consoles#step-1-request-a-device-code-from-discord) -2. [Display the user verification information](/docs/discord-social-sdk/development-guides/account-linking-on-consoles#step-2-display-authorize-screen-with-qr-code-and-user-code) or open the authorization screen (optional) -3. [Poll for the user's authorization](/docs/discord-social-sdk/development-guides/account-linking-on-consoles#step-3-poll-for-users-authorization) -4. [Exchange the device code for an access token](/docs/discord-social-sdk/development-guides/account-linking-on-consoles#step-4-exchange-device-code-for-access-token) -5. [Handle the token response](/docs/discord-social-sdk/development-guides/account-linking-on-consoles#step-5-handle-token-response) and close authorization screen (optional) +1. [Request a device code from Discord](/developers/docs/discord-social-sdk/development-guides/account-linking-on-consoles#step-1-request-a-device-code-from-discord) +2. [Display the user verification information](/developers/docs/discord-social-sdk/development-guides/account-linking-on-consoles#step-2-display-authorize-screen-with-qr-code-and-user-code) or open the authorization screen (optional) +3. [Poll for the user's authorization](/developers/docs/discord-social-sdk/development-guides/account-linking-on-consoles#step-3-poll-for-users-authorization) +4. [Exchange the device code for an access token](/developers/docs/discord-social-sdk/development-guides/account-linking-on-consoles#step-4-exchange-device-code-for-access-token) +5. [Handle the token response](/developers/docs/discord-social-sdk/development-guides/account-linking-on-consoles#step-5-handle-token-response) and close authorization screen (optional) ### Step 1: Request a Device Code from Discord @@ -143,11 +140,11 @@ To open an authorization screen after requesting the user code, use [`Client::Op client->OpenAuthorizeDeviceScreen(user_code); ``` -:::info + You can also display the `verification_uri_complete` or `verification_uri` with `user_code` in your game's interface to allow the user to enter the code manually. -::: + -![Authorization screen from using OpenAuthorizeDeviceScreen and GetTokenFromDevice](images/social-sdk/development-guides/authorize_device.webp) +![Authorization screen from using OpenAuthorizeDeviceScreen and GetTokenFromDevice](/images/social-sdk/development-guides/authorize_device.png) Once the user approves the authorization request from a web browser or their mobile device, the `device_code` from Step 1 is ready to be exchanged for an access token. @@ -282,7 +279,7 @@ client->UpdateToken(discordpp::AuthorizationTokenType::Bearer, accessToken, [cli You'll want to store the access and refresh tokens for the player to use in future sessions. -Please note that `access_token` values do expire. You'll need to make use of the `refresh_token` to refresh the player's token, which is covered under [Refreshing Access Tokens](/docs/discord-social-sdk/development-guides/account-linking-with-discord#refreshing-access-tokens). +Please note that `access_token` values do expire. You'll need to make use of the `refresh_token` to refresh the player's token, which is covered under [Refreshing Access Tokens](/developers/docs/discord-social-sdk/development-guides/account-linking-with-discord#refreshing-access-tokens). --- @@ -290,17 +287,21 @@ Please note that `access_token` values do expire. You'll need to make use of the Now that you've successfully implemented account linking with Discord on a console, you can integrate more social features into your game. - - +import {PaintPaletteIcon} from '/snippets/icons/PaintPaletteIcon.jsx' +import {ListViewIcon} from '/snippets/icons/ListViewIcon.jsx' +import {UserIcon} from '/snippets/icons/UserIcon.jsx' + + + }> Combine Discord and game friends into a single list for easy management. - + }> Display game status and information to Discord friends. - + }> Follow our design guidelines when integrating Discord features into a console game. - + diff --git a/docs/discord-social-sdk/development-guides/account-linking-with-discord.mdx b/discord/developers/docs/discord-social-sdk/development-guides/account-linking-with-discord.mdx similarity index 79% rename from docs/discord-social-sdk/development-guides/account-linking-with-discord.mdx rename to discord/developers/docs/discord-social-sdk/development-guides/account-linking-with-discord.mdx index e45eab82cd..be8fb7459b 100644 --- a/docs/discord-social-sdk/development-guides/account-linking-with-discord.mdx +++ b/discord/developers/docs/discord-social-sdk/development-guides/account-linking-with-discord.mdx @@ -1,24 +1,21 @@ --- -sidebar_label: Account Linking with Discord +title: Account Linking with Discord +description: Implement account linking to connect user accounts between your application and Discord. --- -import PublicClient from '../partials/callouts/public-client.mdx'; -import SupportCallout from '../partials/callouts/support.mdx'; - -[Home](/docs/intro) > [Discord Social SDK](/docs/discord-social-sdk/overview) > [Development Guides](/docs/discord-social-sdk/development-guides) > {sidebar_label} - -# {sidebar_label} +import PublicClient from '/snippets/discord-social-sdk/callouts/public-client.mdx'; +import SupportCallout from '/snippets/discord-social-sdk/callouts/support.mdx'; ## Overview This guide explains how to authenticate users with their existing Discord accounts via OAuth2, enabling seamless login and access to Discord features. ### Flexible Account Options -If a player does not have a Discord account, you can use the SDK to [create a provisional account](/docs/discord-social-sdk/development-guides/using-provisional-accounts) instead so that they can still access your game's features. +If a player does not have a Discord account, you can use the SDK to [create a provisional account](/developers/docs/discord-social-sdk/development-guides/using-provisional-accounts) instead so that they can still access your game's features. ### Prerequisites Before you begin, make sure you have: -- Read the [Core Concepts](/docs/discord-social-sdk/core-concepts) guide to understand: +- Read the [Core Concepts](/developers/docs/discord-social-sdk/core-concepts) guide to understand: - OAuth2 authentication flow - Discord application setup - SDK initialization @@ -27,7 +24,7 @@ Before you begin, make sure you have: - Discord Social SDK downloaded and configured - Basic SDK integration working (initialization and connection) -If you haven't completed these prerequisites, we recommend first following the [Getting Started](/docs/discord-social-sdk/getting-started) guide. +If you haven't completed these prerequisites, we recommend first following the [Getting Started](/developers/docs/discord-social-sdk/getting-started) guide. --- @@ -36,16 +33,16 @@ If you haven't completed these prerequisites, we recommend first following the [ OAuth2 is the standard authentication flow that allows users to sign in using their Discord account. The process follows these steps: -1. [Request authorization](/docs/discord-social-sdk/development-guides/account-linking-with-discord#step-1-request-authorization): Your game sends an authentication request to Discord. -2. [User Approval](/docs/discord-social-sdk/development-guides/account-linking-with-discord#step-2-user-approval): The user approves the request, granting access to your application. -3. [Receive Authorization Code](/docs/discord-social-sdk/development-guides/account-linking-with-discord#step-3-receiving-the-authorization-code): After approval, Discord redirects the user to your app with an authorization code. -4. [Exchange for Tokens](/docs/discord-social-sdk/development-guides/account-linking-with-discord#step-4-exchanging-the-authorization-code-for-an-access-token): The authorization code is exchanged for: +1. [Request authorization](/developers/docs/discord-social-sdk/development-guides/account-linking-with-discord#step-1-request-authorization): Your game sends an authentication request to Discord. +2. [User Approval](/developers/docs/discord-social-sdk/development-guides/account-linking-with-discord#step-2-user-approval): The user approves the request, granting access to your application. +3. [Receive Authorization Code](/developers/docs/discord-social-sdk/development-guides/account-linking-with-discord#step-3-receiving-the-authorization-code): After approval, Discord redirects the user to your app with an authorization code. +4. [Exchange for Tokens](/developers/docs/discord-social-sdk/development-guides/account-linking-with-discord#step-4-exchanging-the-authorization-code-for-an-access-token): The authorization code is exchanged for: - Access Token, which is valid for ~7 days - Refresh Token, used to obtain a new access token -:::info + The OAuth2 flow requires a user's account to be verified -::: + ### OAuth2 using the Discord Social SDK @@ -65,7 +62,7 @@ For OAuth2 to work correctly, you must **register the correct redirect URIs** fo | **Desktop** | `http://127.0.0.1/callback` | | **Mobile** | `discord-APP_ID:/authorize/callback` _(replace `APP_ID` with your Discord application ID)_ | -### Step 1: Request Authorization +### Step 1: Request Authorization The SDK provides helper methods to simplify OAuth2 login. @@ -77,7 +74,7 @@ One of the required arguments to [`Client::Authorize`] is scopes, which is the s #### Authorization Code Verifier -If you are using [`Client::GetToken`] in [Step 4](/docs/discord-social-sdk/development-guides/account-linking-with-discord#step-4-exchanging-the-authorization-code-for-an-access-token), you will need to specify a "code challenge" and "code verifier" in your requests. We'll spare you the boring details of how that works (woo… crypto), as we've made a simple function to create these for you, [`Client::CreateAuthorizationCodeVerifier`], which you can use to generate the code challenge and verifier. +If you are using [`Client::GetToken`] in [Step 4](/developers/docs/discord-social-sdk/development-guides/account-linking-with-discord#step-4-exchanging-the-authorization-code-for-an-access-token), you will need to specify a "code challenge" and "code verifier" in your requests. We'll spare you the boring details of how that works (woo… crypto), as we've made a simple function to create these for you, [`Client::CreateAuthorizationCodeVerifier`], which you can use to generate the code challenge and verifier. ```cpp // Create a code verifier and challenge if using GetToken @@ -234,9 +231,9 @@ client->RefreshToken( If a user wants to disconnect their Discord account or if a token is compromised, you can revoke access and refresh tokens. -:::warn + When any valid access or refresh token is revoked, all of your application's access and refresh tokens for that user are immediately invalidated. -::: + ### Server-to-Server Token Revocation @@ -285,7 +282,7 @@ client->RevokeToken(YOUR_DISCORD_APPLICATION_ID, Users can unlink their account by removing access to your application on their Discord `User Settings -> Authorized Apps` page. -If you would like to be notified when a user unlinks this way, you can [configure you application to listen for the `APPLICATION_DEAUTHORIZED` webhook event](/docs/events/webhook-events#application-deauthorized). +If you would like to be notified when a user unlinks this way, you can [configure you application to listen for the `APPLICATION_DEAUTHORIZED` webhook event](/developers/docs/events/webhook-events#application-deauthorized). Otherwise, you will know that the user has unlinked because their access token and refresh token (if you have one) will be invalidated. --- @@ -294,17 +291,21 @@ Otherwise, you will know that the user has unlinked because their access token a Now that you've successfully implemented account linking with Discord, you can integrate more social features into your game. - - +import {PaintPaletteIcon} from '/snippets/icons/PaintPaletteIcon.jsx' +import {ListViewIcon} from '/snippets/icons/ListViewIcon.jsx' +import {UserIcon} from '/snippets/icons/UserIcon.jsx' + + + }> Design guidelines for account linking and user authentication - + }> Combine Discord and game friends into a single list for easy management. - + }> Display game status and information to Discord friends. - - + + diff --git a/docs/discord-social-sdk/development-guides/creating-a-unified-friends-list.mdx b/discord/developers/docs/discord-social-sdk/development-guides/creating-a-unified-friends-list.mdx similarity index 88% rename from docs/discord-social-sdk/development-guides/creating-a-unified-friends-list.mdx rename to discord/developers/docs/discord-social-sdk/development-guides/creating-a-unified-friends-list.mdx index 2b95ae6957..0d6084d489 100644 --- a/docs/discord-social-sdk/development-guides/creating-a-unified-friends-list.mdx +++ b/discord/developers/docs/discord-social-sdk/development-guides/creating-a-unified-friends-list.mdx @@ -1,12 +1,10 @@ --- -sidebar_label: Creating a Unified Friends List +title: Creating a Unified Friends List +description: Build a unified friends list that combines Discord relationships with your application. --- -import PublicClient from '../partials/callouts/public-client.mdx'; -import SupportCallout from '../partials/callouts/support.mdx'; +import PublicClient from '/snippets/discord-social-sdk/callouts/public-client.mdx'; +import SupportCallout from '/snippets/discord-social-sdk/callouts/support.mdx'; -[Home](/docs/intro) > [Discord Social SDK](/docs/discord-social-sdk/overview) > [Development Guides](/docs/discord-social-sdk/development-guides) > {sidebar_label} - -# Creating a Unified Friends List ## Overview @@ -19,9 +17,9 @@ A unified friends list combines both Discord and game-specific relationships in ### Prerequisites Before you begin, make sure you have: -- Set up the Discord Social SDK with [Getting Started Guide](/docs/discord-social-sdk/getting-started) -- Authenticated your users with [Development Guide: Account Linking](/docs/discord-social-sdk/development-guides/account-linking-with-discord) -- Understanding of relationship types with [Development Guide: Managing Relationships in Your Game](/docs/discord-social-sdk/development-guides/managing-relationships) +- Set up the Discord Social SDK with [Getting Started Guide](/developers/docs/discord-social-sdk/getting-started) +- Authenticated your users with [Development Guide: Account Linking](/developers/docs/discord-social-sdk/development-guides/account-linking-with-discord) +- Understanding of relationship types with [Development Guide: Managing Relationships in Your Game](/developers/docs/discord-social-sdk/development-guides/managing-relationships) ### Implementing a Unified Friends List @@ -31,12 +29,12 @@ for rendering the list, such as whether they are online or not. ### Relationships -[Relationships](/docs/discord-social-sdk/development-guides/managing-relationships) are how Discord models friends, +[Relationships](/developers/docs/discord-social-sdk/development-guides/managing-relationships) are how Discord models friends, friend requests, and more. All relationships for the current user are loaded when the Client connects. Each relationship has a target user id, and a type, such as `Friend`, `PendingOutgoing`, or `Blocked`. To allow users to manage their relationships in your game, you should provide a way to accept or reject friend -requests, block users, and manage pending requests. See [Development Guide: Managing Relationships in Your Game](/docs/discord-social-sdk/development-guides/managing-relationships) for implementation details. +requests, block users, and manage pending requests. See [Development Guide: Managing Relationships in Your Game](/developers/docs/discord-social-sdk/development-guides/managing-relationships) for implementation details. ### Users @@ -49,11 +47,11 @@ Presence is how Discord stores whether a user is currently online or not, as wel - Online Status: Online, Offline, Idle, etc. - Rich Presence: Any activities associated with the current game (or application in Discord parlance). -:::info + The SDK will only display activities associated with the current game, meaning you will not be able to see other game activities in Rich Presence, even if you can see them in the Discord client. -::: + -See our [Design Guidelines: Status & Rich Presence](/docs/discord-social-sdk/design-guidelines/status-rich-presence) for best practices on displaying presence information. +See our [Design Guidelines: Status & Rich Presence](/developers/docs/discord-social-sdk/design-guidelines/status-rich-presence) for best practices on displaying presence information. There are two ways in which you can create a unified friends list in your game: @@ -63,13 +61,13 @@ relationships and users for you. ## Approach 1: Using SDK Unified Friends List Helper Functions -:::info + This approach is recommended as it significantly reduces the amount of code you need to write and maintain compared to manually fetching and organizing relationships, while ensuring your friends list follows Discord's best practices. -::: + The Discord Social SDK provides built-in helper functions that automatically group and sort your friends list according -to Discord's [recommended design guidelines](/docs/discord-social-sdk/design-guidelines/unified-friends-list). +to Discord's [recommended design guidelines](/developers/docs/discord-social-sdk/design-guidelines/unified-friends-list). This approach is generally simpler and more maintainable than manually fetching and organizing relationships. The SDK automatically organizes friends into the three groups we find via [`RelationshipGroupType`]: @@ -227,12 +225,12 @@ void DisplayFriendsList(discordpp::Client& client) { } ``` -:::info + The `relationship.User()` function returns a [`UserHandle`] object that represents a user that the Discord Social SDK knows about. Handle objects maintain references to both the underlying data and the SDK instance, which means that when their data changes, existing handle objects automatically reflect these changes without needing to be recreated. -::: + We will want to call this function when the client is ready, so let's add it to our ready callback: @@ -260,7 +258,7 @@ This will output the raw relationship data to the console. You can use this info ### Step 2: Organize Relationships -Based on our design guidelines for a [Unified Friends List](/docs/discord-social-sdk/design-guidelines/unified-friends-list), you should separate the player's friends list into three sections: `Online - GameTitle`, `Online - Elsewhere`, and `Offline`. +Based on our design guidelines for a [Unified Friends List](/developers/docs/discord-social-sdk/design-guidelines/unified-friends-list), you should separate the player's friends list into three sections: `Online - GameTitle`, `Online - Elsewhere`, and `Offline`. Because we are building a text console application, we will use emojis to represent the status of each friend but you can use your own design elements to convey status and presence in your game. @@ -273,9 +271,9 @@ Let's update our `DisplayFriendsList` function to reflect our three sections and - We will sort each category alphabetically. - We will display each category separately. -:::info + This example is for reference only. Please make sure you use efficient data structures and cache data when appropriate to avoid performance issues in your game. -::: + ```cpp void DisplayFriendsList(std::shared_ptr client) { @@ -370,22 +368,22 @@ client->SetUserUpdatedCallback([&client](uint64_t userId) { Now your friends list will automatically update when the presence of a friend changes, such as when they go online, offline or start playing your game. -:::info + The automatic updates of the [`UserHandle`] object to the latest the user information should be sufficient for retrieving the most up-to-date user information. [`Client::SetUserUpdatedCallback`] may be more useful to identify times when you wish to re-sort your user list, or similar operations. -::: + --- ### Step 4: Monitor Changes in Relationships Let us setup two callbacks to handle relationship updates. -:::warn + These examples rebuild the friends list from scratch every time a relationship changes. For performance reasons, we recommend maintaining a collection of [`UserHandle`] objects and adding and removing them appropriately. -::: + #### Relationship Created Callback @@ -421,17 +419,21 @@ Now your friends list will automatically update when relationships change, such Now that you have a unified friends list, you can build on your social features by allowing players to manage relationships, send game invites, and more. Check out our other guides for more information: - - +import {PaintPaletteIcon} from '/snippets/icons/PaintPaletteIcon.jsx' +import {UserIcon} from '/snippets/icons/UserIcon.jsx' +import {InboxIcon} from '/snippets/icons/InboxIcon.jsx' + + + }> Best practices for designing your Unified Friends List. - + }> Allow players to manage their friends, friend requests, and blocked users. - + }> Allow players to invite friends to join their game session or party. - + diff --git a/docs/discord-social-sdk/development-guides/linked-channels.mdx b/discord/developers/docs/discord-social-sdk/development-guides/linked-channels.mdx similarity index 88% rename from docs/discord-social-sdk/development-guides/linked-channels.mdx rename to discord/developers/docs/discord-social-sdk/development-guides/linked-channels.mdx index 183a1493f9..1cac5dde73 100644 --- a/docs/discord-social-sdk/development-guides/linked-channels.mdx +++ b/discord/developers/docs/discord-social-sdk/development-guides/linked-channels.mdx @@ -1,15 +1,13 @@ --- -sidebar_label: Linked Channels +title: Linked Channels +description: Connect Discord channels with your application for seamless communication. --- -import RateLimitCallout from '../partials/callouts/rate-limit.mdx'; -import SupportCallout from '../partials/callouts/support.mdx'; -import CommsScopeWarning from '../partials/callouts/oauth-comms-scopes.mdx'; +import PublicClient from '/snippets/discord-social-sdk/callouts/public-client.mdx'; +import SupportCallout from '/snippets/discord-social-sdk/callouts/support.mdx'; +import LimitedAccessCallout from '/snippets/discord-social-sdk/callouts/limited-access.mdx'; +import CommsScopeWarning from '/snippets/discord-social-sdk/callouts/oauth-comms-scopes.mdx'; -[Home](/docs/intro) > [Discord Social SDK](/docs/discord-social-sdk/overview) > [Development Guides](/docs/discord-social-sdk/development-guides) > {sidebar_label} - -# {sidebar_label} - - + ## Overview @@ -24,8 +22,8 @@ When linked: Before implementing Linked Channels, make sure you have: -- [Set up the Discord Social SDK](/docs/discord-social-sdk/getting-started) -- An understanding of [Creating and Managing Lobbies](/docs/discord-social-sdk/development-guides/managing-lobbies) +- [Set up the Discord Social SDK](/developers/docs/discord-social-sdk/getting-started) +- An understanding of [Creating and Managing Lobbies](/developers/docs/discord-social-sdk/development-guides/managing-lobbies) @@ -62,9 +60,9 @@ Discord allows all channels the user can access in a server to be linked in game It's not possible for the game to know which users should have access to that channel. Every lobby member can view and reply to all messages sent in the linked channel. -:::warn + If you are going to allow private channels to be linked in-game, you must make sure that users are aware that their private channel will be viewable by everyone in the lobby. -::: + To help you identify which channels are public or private, we have added a `isViewableAndWriteableByAllMembers` boolean. You can use that boolean to prevent private channels from being linked or to know when to show a clear warning; it's up to you! @@ -72,7 +70,7 @@ To help you identify which channels are public or private, we have added a `isVi #### Linking A Lobby -The lobby member must have the `CanLinkLobby` flag set to link a channel to a lobby. This flag is disabled by default and must be explicitly set using the [Lobby API](/docs/resources/lobby) for users you want elevated permissions. We recommend only toggling this on for the equivalent of the administrator/owner of a lobby. +The lobby member must have the `CanLinkLobby` flag set to link a channel to a lobby. This flag is disabled by default and must be explicitly set using the [Lobby API](/developers/docs/resources/lobby) for users you want elevated permissions. We recommend only toggling this on for the equivalent of the administrator/owner of a lobby. This allows you, as the game developer, to say, "Only the admins of this guild are allowed to configure the linked channel." @@ -119,14 +117,14 @@ struct GuildChannel { ### Saving a channel link selection -Once the user has chosen a channel to link to, you can call [`Client::LinkChannelToLobby`] to set or change the channel a lobby is linked to. You can also use [`Client::UnlinkChannelFromLobby`] to remove the link. The conditions specified in [Linked Channel Requirements](/docs/discord-social-sdk/development-guides/linked-channels#channel-requirements) must be met for the given lobby, channel, and user. +Once the user has chosen a channel to link to, you can call [`Client::LinkChannelToLobby`] to set or change the channel a lobby is linked to. You can also use [`Client::UnlinkChannelFromLobby`] to remove the link. The conditions specified in [Linked Channel Requirements](/developers/docs/discord-social-sdk/development-guides/linked-channels#channel-requirements) must be met for the given lobby, channel, and user. ### Try It Out To test Linked Channels before building out a player interface, here are some steps you can follow to get things working in a prototype using the Discord API: -1. Create a lobby using the **[Create Lobby](/docs/resources/lobby#create-lobby)** endpoint. -2. Enable the `CanLinkLobby` flag (`1 << 0`) on your lobby member by either sending a request to the `/lobbies//members/` endpoint or by including the member data in the body of the [Create Lobby](/docs/resources/lobby#create-lobby) request. +1. Create a lobby using the **[Create Lobby](/developers/docs/resources/lobby#create-lobby)** endpoint. +2. Enable the `CanLinkLobby` flag (`1 << 0`) on your lobby member by either sending a request to the `/lobbies//members/` endpoint or by including the member data in the body of the [Create Lobby](/developers/docs/resources/lobby#create-lobby) request. 3. Identify a Discord server text channel that your `lobby_member` has the specified permissions enabled for (again, read/write and manage channels) and grab the channel's id. 4. Send a request to the `/lobbies//channel-linking` endpoint described above with the channel id. @@ -307,9 +305,9 @@ For example, an in-game player flow could look like: 3. When clicked, the SDK generates a unique invite and opens Discord 4. The player accepts the invite and becomes a Discord server member -:::info + Only players with linked Discord accounts can join the server. If a player is using a provisional account, you should prompt them to link their Discord account first. -::: + ```cpp const uint64_t lobbyId = 1234567890; @@ -349,26 +347,30 @@ client->JoinLinkedLobbyGuild( - **Desktop**: The SDK automatically opens the Discord client or web browser with the invite - **Console**: Since console platforms cannot navigate to Discord directly, you should display the invite URL in your game's UI so players can use it on another device -:::warn + Discord server admins cannot restrict who can join the server via this method. Any player in a linked lobby can generate an invitation to the server, regardless of their lobby permissions.
Make sure to make your players aware to only link channels in servers you trust your players to join, and/or provide in-game options to disable this feature for certain lobbies. -::: +
--- ## Next Steps - - +import {InboxIcon} from '/snippets/icons/InboxIcon.jsx' +import {ListViewIcon} from '/snippets/icons/ListViewIcon.jsx' +import {UserIcon} from '/snippets/icons/UserIcon.jsx' + + + }> Combine Discord and game friends into a single list for easy management. - + }> Display game status and information to Discord friends. - + }> Allow players to invite friends to join their game session or party. - + diff --git a/docs/discord-social-sdk/development-guides/managing-game-invites.mdx b/discord/developers/docs/discord-social-sdk/development-guides/managing-game-invites.mdx similarity index 88% rename from docs/discord-social-sdk/development-guides/managing-game-invites.mdx rename to discord/developers/docs/discord-social-sdk/development-guides/managing-game-invites.mdx index 089a4914be..0197a76a2d 100644 --- a/docs/discord-social-sdk/development-guides/managing-game-invites.mdx +++ b/discord/developers/docs/discord-social-sdk/development-guides/managing-game-invites.mdx @@ -1,31 +1,29 @@ --- -sidebar_label: Managing Game Invites +title: Managing Game Invites +description: Create and manage game invitations through Discord to bring friends into your application. --- -import PublicClient from '../partials/callouts/public-client.mdx'; -import SupportCallout from '../partials/callouts/support.mdx'; -[Home](/docs/intro) > [Discord Social SDK](/docs/discord-social-sdk/overview) > [Development Guides](/docs/discord-social-sdk/development-guides) > {sidebar_label} - -# {sidebar_label} +import PublicClient from '/snippets/discord-social-sdk/callouts/public-client.mdx'; +import SupportCallout from '/snippets/discord-social-sdk/callouts/support.mdx'; ## Overview Game Invites allow users to invite others to join their game session or party. This feature is available on the Discord client and the Social SDK. -:::info + **Game Invites are not a standalone feature** - they are **powered entirely by Rich Presence**. When you configure Rich Presence with party information, a join secret, and/or supported platforms, Discord automatically enables invite functionality. This guide shows you how to configure Rich Presence to unlock game invites. -::: + ### Prerequisites Before you begin, make sure you have: -- Completed the [Setting Rich Presence](/docs/discord-social-sdk/development-guides/setting-rich-presence) guide +- Completed the [Setting Rich Presence](/developers/docs/discord-social-sdk/development-guides/setting-rich-presence) guide - Understanding that without an active Rich Presence with party data, invites will not work -- Set up the Discord Social SDK with our [Getting Started guide](/docs/discord-social-sdk/getting-started) +- Set up the Discord Social SDK with our [Getting Started guide](/developers/docs/discord-social-sdk/getting-started) --- @@ -33,11 +31,11 @@ Before you begin, make sure you have: Game invites, or activity invites, are **powered by rich presence**. -We covered the basics of [Setting Rich Presence](/docs/discord-social-sdk/development-guides/setting-rich-presence) in a previous guide but let's go over the key points again. +We covered the basics of [Setting Rich Presence](/developers/docs/discord-social-sdk/development-guides/setting-rich-presence) in a previous guide but let's go over the key points again. -:::info -Let's talk about the naming of some Discord primitives first. Rich Presence, aka "Activity", can be thought of as the "current activity of a user" and is represented by the [`Activity`] class in the SDK and [in our gateway events](/docs/events/gateway-events#activity-object). This is not to be confused with [Discord Activities](/docs/activities/overview), which are embedded games that can also set and display rich presence. -::: + +Let's talk about the naming of some Discord primitives first. Rich Presence, aka "Activity", can be thought of as the "current activity of a user" and is represented by the [`Activity`] class in the SDK and [in our gateway events](/developers/docs/events/gateway-events#activity-object). This is not to be confused with [Discord Activities](/developers/docs/activities/overview), which are embedded games that can also set and display rich presence. + ### Setting Up Rich Presence @@ -94,7 +92,7 @@ We're almost there! Let's add the join secret next so we can send and receive ga The last step is to add a join secret to your rich presence activity. -The `Join Secret` is a generic secret that you can use to [join a Discord lobby](/docs/discord-social-sdk/development-guides/managing-lobbies), a game session, or something else. The game invite system is a way for players to share this secret value with other players - how you use it is up to you. +The `Join Secret` is a generic secret that you can use to [join a Discord lobby](/developers/docs/discord-social-sdk/development-guides/managing-lobbies), a game session, or something else. The game invite system is a way for players to share this secret value with other players - how you use it is up to you. You will also need to set the supported platforms for joining the game so that the Discord client can display the correct invite button for the user's platform. @@ -202,9 +200,9 @@ Users can send game invites directly through the Discord client. This feature is If a player has the required party, join secret, and supported platforms set in their rich presence, your game can send game invites programmatically through the SDK using [`Client::SendActivityInvite`]. -:::warn + [`Client::SendActivityInvite`] only works if Rich Presence is active with proper configuration -::: + ```cpp uint64_t targetUserId = 1111785262289277050; @@ -218,7 +216,7 @@ client->SendActivityInvite(targetUserId, inviteMessage, [](discordpp::ClientResu }); ``` -![Example of a sent game invite in the Discord client](images/social-sdk/development-guides/game-invite.webp) +![Example of a sent game invite in the Discord client](/images/social-sdk/development-guides/game-invite.webp) --- @@ -272,7 +270,7 @@ client->SetActivityJoinCallback([&client](std::string joinSecret) { ## Using Game Invites with Lobbies -Game invites can be used in conjunction with [Lobbies](/docs/discord-social-sdk/development-guides/managing-lobbies) to create a seamless experience for players to join a game session or party. +Game invites can be used in conjunction with [Lobbies](/developers/docs/discord-social-sdk/development-guides/managing-lobbies) to create a seamless experience for players to join a game session or party. When a player accepts a game invite, you can use the join secret to connect the two players in your game. @@ -284,9 +282,9 @@ An example flow might look like this: - Once accepted, the new user receives the join secret, and their client can call CreateOrJoinLobby(joinSecret) to join the lobby - Finally, the original user can notice that the lobby membership has changed, so they publish a new Rich Presence update containing the updated party size information -:::info + These examples use client-side lobby management but can also be adapted for lobbies created on the server side. -::: + ### Game Invite with Lobby Example @@ -448,8 +446,8 @@ activity.SetSupportedPlatforms( 1. The user receives and accepts an invite in Discord 2. Discord launches your game using your URL scheme: -``` -yourgame://_discord/join?secret=the_join_secret_you_set + ``` + yourgame://_discord/join?secret=the_join_secret_you_set ``` 3. Your game receives the URL and extracts the join secret 4. Use the secret to connect the player to the session @@ -470,17 +468,21 @@ activity.SetAssets(assets); ## Next Steps - - - Combine Discord and game friends into a single list for easy management. - - - Bring players together in a shared lobby with invites, text chat, and voice comms. - - - Enable private messaging between players. - - +import {ListViewIcon} from '/snippets/icons/ListViewIcon.jsx' +import {MagicDoorIcon} from '/snippets/icons/MagicDoorIcon.jsx' +import {InboxIcon} from '/snippets/icons/InboxIcon.jsx' + + + }> + Combine Discord and game friends into a single list for easy management. + + }> + Bring players together in a shared lobby with invites, text chat, and voice comms. + + }> + Enable private messaging between players. + + diff --git a/docs/discord-social-sdk/development-guides/managing-lobbies.mdx b/discord/developers/docs/discord-social-sdk/development-guides/managing-lobbies.mdx similarity index 82% rename from docs/discord-social-sdk/development-guides/managing-lobbies.mdx rename to discord/developers/docs/discord-social-sdk/development-guides/managing-lobbies.mdx index c4bc722763..1c1c24a42e 100644 --- a/docs/discord-social-sdk/development-guides/managing-lobbies.mdx +++ b/discord/developers/docs/discord-social-sdk/development-guides/managing-lobbies.mdx @@ -1,11 +1,15 @@ --- -sidebar_label: Managing Lobbies +title: Creating and Managing Lobbies +sidebarTitle: Managing Lobbies +description: Create and manage game lobbies with Discord Social SDK for matchmaking. --- -import RateLimitCallout from '../partials/callouts/rate-limit.mdx'; -import SupportCallout from '../partials/callouts/support.mdx'; -import CommsScopeWarning from '../partials/callouts/oauth-comms-scopes.mdx'; -[Home](/docs/intro) > [Discord Social SDK](/docs/discord-social-sdk/overview) > [Development Guides](/docs/discord-social-sdk/development-guides) > {sidebar_label} +import RateLimitCallout from '/snippets/discord-social-sdk/callouts/rate-limit.mdx'; +import PublicClient from '/snippets/discord-social-sdk/callouts/public-client.mdx'; +import SupportCallout from '/snippets/discord-social-sdk/callouts/support.mdx'; +import LimitedAccessCallout from '/snippets/discord-social-sdk/callouts/limited-access.mdx'; +import CommsScopeWarning from '/snippets/discord-social-sdk/callouts/oauth-comms-scopes.mdx'; + # Creating and Managing Lobbies @@ -25,7 +29,7 @@ This guide will show you how to: Before you begin, make sure you have: -- Set up the Discord Social SDK with our [Getting Started guide](/docs/discord-social-sdk/getting-started) +- Set up the Discord Social SDK with our [Getting Started guide](/developers/docs/discord-social-sdk/getting-started) @@ -62,11 +66,11 @@ There are two ways to manage lobbies: You can use the Discord HTTP API to create, update, and delete lobbies and manage lobby membership. -See the [Lobby](/docs/resources/lobby) API resource for available endpoints and [Use with Discord APIs](/docs/discord-social-sdk/how-to/use-with-discord-apis) for information on how to authenticate your requests. +See the [Lobby](/developers/docs/resources/lobby) API resource for available endpoints and [Use with Discord APIs](/developers/docs/discord-social-sdk/how-to/use-with-discord-apis) for information on how to authenticate your requests. -:::info + Clients will not be able to use [`Client::CreateOrJoinLobby`] or [`Client::LeaveLobby`] with lobbies created using the API. -::: + ### Client-Side Lobby Management @@ -75,7 +79,7 @@ The SDK client can also create and join lobbies. This works by associating a sec - The relevant SDK functions are [`Client::CreateOrJoinLobby`] and [`Client::LeaveLobby`]. - Lobby secrets are unique per game (ie: application). For example, use a new secret if you want to generate a new lobby at the end of the match. Calling [`Client::LeaveLobby`] and then [`Client::CreateOrJoinLobby`] with the same secret value will just re-add you to the same lobby. - Calling [`Client::CreateOrJoinLobby`] while the user is already in the lobby will update their metadata (if included) instead. -- Discord's Rich Presence system supports syncing this secret, too. Using this flow, clients can request to join another user's activity. When approved, the SDK will be given the secret, which you can access and join the associated lobby if you choose to do so. See the [Game Invites for Lobbies](/docs/discord-social-sdk/development-guides/managing-lobbies#creating-lobby-invites) example below. +- Discord's Rich Presence system supports syncing this secret, too. Using this flow, clients can request to join another user's activity. When approved, the SDK will be given the secret, which you can access and join the associated lobby if you choose to do so. See the [Game Invites for Lobbies](/developers/docs/discord-social-sdk/development-guides/managing-lobbies#creating-lobby-invites) example below. - If you want to keep track of metadata for the lobby or the lobby members, you can use the [`Client::CreateOrJoinLobbyWithMetadata`] function. This function takes a JSON object as an argument, which will be stored with the lobby and the lobby members. This metadata can be retrieved using the discordpp::Client::GetLobbyHandle function. ```cpp @@ -112,9 +116,9 @@ Lobbies are intended to be ephemeral and should be cleaned up when the game/matc This value defaults to 5 minutes, and we expect that for most use cases, that will be ok. But we understand there are use cases such as "world chat" that might want to exist longer. The maximum value for this "idle time" will likely be 7 days, so that would mean that the lobby only gets deleted if no one connects to it for an entire week. This should give a good amount of permanence to lobbies when needed, but there may be rare cases where a lobby does need to be "rebuilt" if everyone is offline for an extended period. -:::info + Lobbies created by the SDK client using the [`Client::CreateOrJoinLobby`] function currently have an additional limitation. The "secret" value used in this call expires after 30 days, so the lobby will still exist, but new users won't be able to join the lobby after that. -::: + --- @@ -197,13 +201,13 @@ This is particularly useful for: You can connect a lobby to a Discord text channel with Linked Channels. Linked Channels allows users to chat with each other in the lobby using Discord, even if they are not in the game. -See our guide on [Linked Channels](/docs/discord-social-sdk/development-guides/linked-channels) for more information on how to link a channel to a lobby. +See our guide on [Linked Channels](/developers/docs/discord-social-sdk/development-guides/linked-channels) for more information on how to link a channel to a lobby. --- ## Managing Voice Chat -See our guide on [Managing Voice Chat](/docs/discord-social-sdk/development-guides/managing-voice-chat) for more information on how to start a voice call in a lobby. +See our guide on [Managing Voice Chat](/developers/docs/discord-social-sdk/development-guides/managing-voice-chat) for more information on how to start a voice call in a lobby. --- @@ -211,7 +215,7 @@ See our guide on [Managing Voice Chat](/docs/discord-social-sdk/development-guid Your game can use lobbies and game invites to allow users to invite friends to join an existing lobby. -Check out the [Using Game Invites with Lobbies](/docs/discord-social-sdk/development-guides/managing-game-invites#using-game-invites-with-lobbies) example to try it out in your game. +Check out the [Using Game Invites with Lobbies](/developers/docs/discord-social-sdk/development-guides/managing-game-invites#using-game-invites-with-lobbies) example to try it out in your game. --- @@ -219,17 +223,21 @@ Check out the [Using Game Invites with Lobbies](/docs/discord-social-sdk/develop With your game able to create and manage lobbies, you can now implement additional features: - - +import {InboxIcon} from '/snippets/icons/InboxIcon.jsx' +import {VoiceNormalIcon} from '/snippets/icons/VoiceNormalIcon.jsx' +import {HashmarkIcon} from '/snippets/icons/HashmarkIcon.jsx' + + + }> Allow players to invite friends to join their game session or party. - + }> Add voice communication to your lobbies. - + }> Connect lobbies to Discord text channels. - + diff --git a/docs/discord-social-sdk/development-guides/managing-relationships.mdx b/discord/developers/docs/discord-social-sdk/development-guides/managing-relationships.mdx similarity index 87% rename from docs/discord-social-sdk/development-guides/managing-relationships.mdx rename to discord/developers/docs/discord-social-sdk/development-guides/managing-relationships.mdx index c2ab9a09b5..37580ede65 100644 --- a/docs/discord-social-sdk/development-guides/managing-relationships.mdx +++ b/discord/developers/docs/discord-social-sdk/development-guides/managing-relationships.mdx @@ -1,12 +1,10 @@ --- -sidebar_label: Managing Relationships +title: Managing Relationships in Your Game +sidebarTitle: Managing Relationships +description: Manage Discord user relationships including friends and blocked users in your application. --- -import PublicClient from '../partials/callouts/public-client.mdx'; -import SupportCallout from '../partials/callouts/support.mdx'; - -[Home](/docs/intro) > [Discord Social SDK](/docs/discord-social-sdk/overview) > [Development Guides](/docs/discord-social-sdk/development-guides) > {sidebar_label} - -# Managing Relationships in Your Game +import PublicClient from '/snippets/discord-social-sdk/callouts/public-client.mdx'; +import SupportCallout from '/snippets/discord-social-sdk/callouts/support.mdx'; ## Overview @@ -21,17 +19,17 @@ The Discord Social SDK lets you manage relationships between players in your gam Before you begin, make sure you have: -- Completed the [Getting Started](/docs/discord-social-sdk/getting-started) guide -- Completed the [Creating a Unified Friends List](/docs/discord-social-sdk/development-guides/creating-a-unified-friends-list) guide +- Completed the [Getting Started](/developers/docs/discord-social-sdk/getting-started) guide +- Completed the [Creating a Unified Friends List](/developers/docs/discord-social-sdk/development-guides/creating-a-unified-friends-list) guide --- ## Understanding Relationship Types Discord models the relationship between two users using the Relationship entity in the SDK. Relationships are not just for friends. They are also used to send and receive friend requests and block other users. -:::warn + While the SDK allows you to manage a user's relationships, you should never act without their explicit consent. You should not automatically send or accept friend requests. Only invoke APIs to manage relationships in response to a user action such as clicking a "Send Friend Request" button. -::: + ### Relationship Types We know that sometimes users will want to be friends with each other across all their games. If they start playing a new game, they can see all of their previous friends and don't start from scratch. But sometimes, they don't want to give out that access and only want to be friends in the current game they are playing. @@ -65,7 +63,7 @@ While our API technically supports users being both types of friends, you don't ## Relationship Actions -Once you've [created a unified friends list](/docs/discord-social-sdk/development-guides/creating-a-unified-friends-list), you can start managing relationships between players in your game. +Once you've [created a unified friends list](/developers/docs/discord-social-sdk/development-guides/creating-a-unified-friends-list), you can start managing relationships between players in your game. Here are some common actions you might want to take: @@ -232,17 +230,21 @@ client->UnblockUser(userId, [](discordpp::ClientResult result) { Continue learning about the Discord Social SDK with these guides: - - +import {ListViewIcon} from '/snippets/icons/ListViewIcon.jsx' +import {UserIcon} from '/snippets/icons/UserIcon.jsx' +import {InboxIcon} from '/snippets/icons/InboxIcon.jsx' + + + }> Combine Discord and game friends into a single list for easy management. - + }> Allow players to invite friends to join their game session or party. - + }> Bring players together in a shared lobby with invites, text chat, and voice comms. - + diff --git a/docs/discord-social-sdk/development-guides/managing-voice-chat.mdx b/discord/developers/docs/discord-social-sdk/development-guides/managing-voice-chat.mdx similarity index 91% rename from docs/discord-social-sdk/development-guides/managing-voice-chat.mdx rename to discord/developers/docs/discord-social-sdk/development-guides/managing-voice-chat.mdx index 401fcf0288..e7250ff191 100644 --- a/docs/discord-social-sdk/development-guides/managing-voice-chat.mdx +++ b/discord/developers/docs/discord-social-sdk/development-guides/managing-voice-chat.mdx @@ -1,13 +1,11 @@ --- -sidebar_label: Managing Voice Chat +title: Managing Voice Chat +description: Integrate Discord voice chat features into your application. --- -import RateLimitCallout from '../partials/callouts/rate-limit.mdx'; -import SupportCallout from '../partials/callouts/support.mdx'; -import CommsScopeWarning from '../partials/callouts/oauth-comms-scopes.mdx'; - -[Home](/docs/intro) > [Discord Social SDK](/docs/discord-social-sdk/overview) > [Development Guides](/docs/discord-social-sdk/development-guides) > {sidebar_label} - -# {sidebar_label} +import RateLimitCallout from '/snippets/discord-social-sdk/callouts/rate-limit.mdx'; +import PublicClient from '/snippets/discord-social-sdk/callouts/public-client.mdx'; +import SupportCallout from '/snippets/discord-social-sdk/callouts/support.mdx'; +import CommsScopeWarning from '/snippets/discord-social-sdk/callouts/oauth-comms-scopes.mdx'; @@ -36,10 +34,10 @@ Before you can start a voice call, you must complete these essential steps: 1. **Create or join a lobby** using the Discord Social SDK 2. **Add players to the lobby** - voice calls only work with lobby members -:::info + Essential Reading: For detailed instructions on creating lobbies, joining lobbies, and managing lobby members, see -the complete [Managing Lobbies Guide](/docs/discord-social-sdk/development-guides/managing-lobbies). -:::: +the complete [Managing Lobbies Guide](/developers/docs/discord-social-sdk/development-guides/managing-lobbies). + ### 2. Lobby Size Limitations @@ -89,9 +87,9 @@ lobby is created with that secret. - [`Client::StartCall`]: If a voice call is already active in the lobby, you'll join it. If not, a new voice call is started. -:::info + You don't need to check if a lobby exists or if a call is already ongoing. The SDK handles both scenarios seamlessly, making your code simpler and more reliable. -::: + ## Controlling Voice Features @@ -277,19 +275,23 @@ This information is particularly useful for: ## Next Steps - - +import {MagicWandIcon} from '/snippets/icons/MagicWandIcon.jsx' +import {ClydeIcon} from '/snippets/icons/ClydeIcon.jsx' +import {InboxIcon} from '/snippets/icons/InboxIcon.jsx' + + + }> Integrating and managing content moderation for your game when using the Discord Social SDK. - + }> Make requests to Discord's HTTP APIs from your game. - + }> Allow players to invite friends to join their game session or party. - + diff --git a/docs/discord-social-sdk/development-guides/sending-direct-messages.mdx b/discord/developers/docs/discord-social-sdk/development-guides/sending-direct-messages.mdx similarity index 84% rename from docs/discord-social-sdk/development-guides/sending-direct-messages.mdx rename to discord/developers/docs/discord-social-sdk/development-guides/sending-direct-messages.mdx index dc917bb6c2..a64c40abc0 100644 --- a/docs/discord-social-sdk/development-guides/sending-direct-messages.mdx +++ b/discord/developers/docs/discord-social-sdk/development-guides/sending-direct-messages.mdx @@ -1,13 +1,11 @@ --- -sidebar_label: Sending Direct Messages +title: Sending Direct Messages +description: Send direct messages to Discord users from your application. --- -import RateLimitCallout from '../partials/callouts/rate-limit.mdx'; -import SupportCallout from '../partials/callouts/support.mdx'; -import CommsScopeWarning from '../partials/callouts/oauth-comms-scopes.mdx'; - -[Home](/docs/intro) > [Discord Social SDK](/docs/discord-social-sdk/overview) > [Development Guides](/docs/discord-social-sdk/development-guides) > {sidebar_label} - -# {sidebar_label} +import RateLimitCallout from '/snippets/discord-social-sdk/callouts/rate-limit.mdx'; +import PublicClient from '/snippets/discord-social-sdk/callouts/public-client.mdx'; +import SupportCallout from '/snippets/discord-social-sdk/callouts/support.mdx'; +import CommsScopeWarning from '/snippets/discord-social-sdk/callouts/oauth-comms-scopes.mdx'; @@ -23,16 +21,16 @@ Direct Messages (DMs) allow players to communicate privately. This guide will sh Before you begin, make sure you have: -- Set up the Discord Social SDK with our [Getting Started guide](/docs/discord-social-sdk/getting-started) +- Set up the Discord Social SDK with our [Getting Started guide](/developers/docs/discord-social-sdk/getting-started) ### Types of Chat Messages -The Discord Social SDK SDK supports two types of chat: +The Discord Social SDK supports two types of chat: -- [Direct messages (DMs) between two users](/docs/discord-social-sdk/development-guides/sending-direct-messages#sending-a-direct-message-to-a-user) -- [Chat messages within a lobby](/docs/discord-social-sdk/development-guides/managing-lobbies#sending-messages-to-a-lobby) +- [Direct messages (DMs) between two users](/developers/docs/discord-social-sdk/development-guides/sending-direct-messages#sending-a-direct-message-to-a-user) +- [Chat messages within a lobby](/developers/docs/discord-social-sdk/development-guides/managing-lobbies#sending-messages-to-a-lobby) The SDK receives messages in the following channel types: @@ -46,9 +44,9 @@ Let's get started with sending a direct message to another user. ## Sending a Direct Message to a User -:::info + While the SDK allows you to send messages on behalf of a user, you must only do so in response to a user action. You should never automatically send messages. -::: + Here's how to send a direct message. You'll need the recipient's Discord ID and the message you want to send. @@ -70,7 +68,7 @@ client->SendUserMessage(recipientId, message, [](auto result, uint64_t messageId In some situations, messages from your game with the Social SDK will also appear in Discord. This will happen for: - 1 on 1 chat when at least one of the users is a full Discord user -- Lobby chat when the lobby is [linked to a Discord channel](/docs/discord-social-sdk/development-guides/linked-channels) +- Lobby chat when the lobby is [linked to a Discord channel](/developers/docs/discord-social-sdk/development-guides/linked-channels) - The message must have been sent by a user who is not banned on Discord. When messaging between provisional accounts or non-friends, channel ID and recipient ID is set to the other user's ID. These messages are sent ephemerally and do not persist within a channel. Because of that, you will not be able to resolve a [`ChannelHandle`] for them. @@ -104,7 +102,7 @@ As a convenience for game developers, the first time a user sends a message in t ### Message History The SDK keeps the 25 most recent messages in each channel in memory, including direct messages. For older messages, -see the [Getting Direct Message History](/docs/discord-social-sdk/development-guides/sending-direct-messages#getting-direct-message-history) +see the [Getting Direct Message History](/developers/docs/discord-social-sdk/development-guides/sending-direct-messages#getting-direct-message-history) section below to retrieve additional history from Discord's servers. A [`MessageHandle`] will keep working even after the SDK has discarded the message for being too old. @@ -116,7 +114,7 @@ Messages sent on Discord can contain content that may not be renderable in-game, You can use this metadata to render a placeholder message for players and can link out to Discord using [`Client::CanOpenMessageInDiscord`] and [`Client::OpenMessageInDiscord`]. -There is also more information about [messages in the Discord API](/docs/resources/message) documentation. +There is also more information about [messages in the Discord API](/developers/docs/resources/message) documentation. ## Getting Direct Message History @@ -193,7 +191,7 @@ This functionality is useful for: The Discord client provides a settings screen for users to be able to control who can DM them in-game via the Social SDK. -![Discord content and social - Connected game settings](images/social-sdk/development-guides/discord-game-dm-settings.webp) +![Discord content and social - Connected game settings](/images/social-sdk/development-guides/discord-game-dm-settings.png) You cannot control these settings directly with the Social SDK. However, you can call [`Client::OpenConnectedGamesSettingsInDiscord`], which opens the Connected Games settings in the Discord client, @@ -209,17 +207,21 @@ It is always a no-op for console platforms. Now that you know how to send and receive messages, check out these other Discord Social SDK features: - - +import {UserIcon} from '/snippets/icons/UserIcon.jsx' +import {MagicDoorIcon} from '/snippets/icons/MagicDoorIcon.jsx' +import {HashmarkIcon} from '/snippets/icons/HashmarkIcon.jsx' + + + }> Display in-game status and activity to friends. - + }> Bring players together in a shared lobby with invites, text chat, and voice comms. - + }> Enable text chat between a Discord channel and your game. - + diff --git a/docs/discord-social-sdk/development-guides/setting-rich-presence.mdx b/discord/developers/docs/discord-social-sdk/development-guides/setting-rich-presence.mdx similarity index 80% rename from docs/discord-social-sdk/development-guides/setting-rich-presence.mdx rename to discord/developers/docs/discord-social-sdk/development-guides/setting-rich-presence.mdx index 540c6a973b..3579fcd455 100644 --- a/docs/discord-social-sdk/development-guides/setting-rich-presence.mdx +++ b/discord/developers/docs/discord-social-sdk/development-guides/setting-rich-presence.mdx @@ -1,11 +1,9 @@ --- -sidebar_label: Setting Rich Presence +title: Setting Rich Presence +description: Update Discord Rich Presence from your application to display activity information. --- -import SupportCallout from '../partials/callouts/support.mdx'; - -[Home](/docs/intro) > [Discord Social SDK](/docs/discord-social-sdk/overview) > [Development Guides](/docs/discord-social-sdk/development-guides) > {sidebar_label} - -# {sidebar_label} +import PublicClient from '/snippets/discord-social-sdk/callouts/public-client.mdx'; +import SupportCallout from '/snippets/discord-social-sdk/callouts/support.mdx'; ## Overview @@ -14,7 +12,7 @@ Rich Presence allows you to display detailed information about what players are ### Prerequisites Before you begin, make sure you have: -- [Set up the Discord Social SDK](/docs/discord-social-sdk/getting-started) +- [Set up the Discord Social SDK](/developers/docs/discord-social-sdk/getting-started) - Connected to Discord with a valid client instance --- @@ -27,29 +25,29 @@ Rich Presence allows you to display detailed information about players' actions - Friend lists - Server member lists -:::info -Let's talk about the naming of some Discord primitives first. Rich Presence, aka "Activity", can be thought of as the "current activity of a user" and is represented by the [`Activity`] class in the SDK and [in our gateway events](/docs/events/gateway-events#activity-object). This is not to be confused with [Discord Activities](/docs/activities/overview), which are embedded games that can also set and display rich presence. -::: + +Let's talk about the naming of some Discord primitives first. Rich Presence, aka "Activity", can be thought of as the "current activity of a user" and is represented by the [`Activity`] class in the SDK and [in our gateway events](/developers/docs/events/gateway-events#activity-object). This is not to be confused with [Discord Activities](/developers/docs/activities/overview), which are embedded games that can also set and display rich presence. + Each [`Activity`] contains fields that describe the following: -| Field | Description | Purpose | -|----------------------|--------------------------|-------------------------------------------------------------------------------------------------------| -| `name` | Game or app name | Displayed in the user's profile | -| `type` | Activity type | What the player is doing (e.g., "Playing", "Watching", "Listening") | -| `details` | What the player is doing | Main activity description (e.g., "Playing Capture the Flag") | -| `state` | Their current status | Secondary status (e.g., "In Queue", "In Match, "In a group") | -| `party` | Party information | Shows party size and capacity (e.g., "2 of 4") | -| `timestamps` | Activity duration | Shows elapsed or remaining time | -| `assets` | Custom artwork | Game/map thumbnails and character icons | -| `secrets` | Join/spectate tokens | Enable [Game Invite](/docs/discord-social-sdk/development-guides/managing-game-invites) functionality | -| `supportedPlatforms` | Platform flags | Control where join buttons appear | +| Field | Description | Purpose | +|----------------------|--------------------------|------------------------------------------------------------------------------------------------------------------| +| `name` | Game or app name | Displayed in the user's profile | +| `type` | Activity type | What the player is doing (e.g., "Playing", "Watching", "Listening") | +| `details` | What the player is doing | Main activity description (e.g., "Playing Capture the Flag") | +| `state` | Their current status | Secondary status (e.g., "In Queue", "In Match, "In a group") | +| `party` | Party information | Shows party size and capacity (e.g., "2 of 4") | +| `timestamps` | Activity duration | Shows elapsed or remaining time | +| `assets` | Custom artwork | Game/map thumbnails and character icons | +| `secrets` | Join/spectate tokens | Enable [Game Invite](/developers/docs/discord-social-sdk/development-guides/managing-game-invites) functionality | +| `supportedPlatforms` | Platform flags | Control where join buttons appear | See below for examples of how to set these fields in your code. -:::info + While we support multiple [`ActivityTypes`], games should use `ActivityTypes::Playing` for `type`. The SDK automatically associates activity with your game, so fields like `name` will always show your game's name. -::: + ### Customizing Rich Presence @@ -69,11 +67,11 @@ You can control how lines 2 and 3 are rendered in Discord, here's the breakdown: This diagram visually shows the field mapping: -![Graphical representation of the legend for rich presence details](images/rp-legend.webp) +![Graphical representation of the legend for rich presence details](/images/rich-presence/legend.png) -:::info -For tips on designing Rich Presence, take a look at the [Rich Presence best practices guide](/docs/rich-presence/best-practices). -::: + +For tips on designing Rich Presence, take a look at the [Rich Presence best practices guide](/developers/docs/rich-presence/best-practices). + --- @@ -81,7 +79,7 @@ For tips on designing Rich Presence, take a look at the [Rich Presence best prac The Rich Presence invite image appears when invites are sent for a 3rd party game or app using the Discord Social SDK. After uploading an invite image for your app, you can see a preview of it to the right (under "IRL Invite Image Example"). -![Rich Presence invite image in app settings](images/rich-presence-invite-image.webp) +![Rich Presence invite image in app settings](/images/rich-presence/invite-image.png) --- @@ -91,21 +89,21 @@ While integrating Rich Presence, you'll likely want to upload custom art assets To add custom assets for Rich Presence, navigate to your app's settings and click Rich Presence on the left-hand sidebar. On the Art Assets page, you can upload two different types of assets. -![Rich Presence invite image in app settings](images/rich-presence-invite-image.webp) +![Rich Presence invite image in app settings](/images/rich-presence-invite-image.webp) Up to 300 custom assets can be added to your app for later use when setting Rich Presence for a Discord user. These assets can be anything that help orient others to what a user is doing inside of your Activity or 3rd party game. -If you need more than 300 custom assets or want to use images stored somewhere else, you can also [specify an external URL](/docs/events/gateway-events#activity-object-activity-asset-image) as long it still has the proper dimensions and size. +If you need more than 300 custom assets or want to use images stored somewhere else, you can also [specify an external URL](/developers/docs/events/gateway-events#activity-object-activity-asset-image) as long it still has the proper dimensions and size. -:::info -For tips on choosing assets, take a look at the [Rich Presence best practices guide](/docs/rich-presence/best-practices#have-interesting-expressive-art). -::: + +For tips on choosing assets, take a look at the [Rich Presence best practices guide](/developers/docs/rich-presence/best-practices#have-interesting-expressive-art). + When uploading Rich Presence assets, **the asset keys will automatically be changed to lowercase**. You can see this reflected in your app's settings after saving a newly uploaded asset, and you should keep it in mind when referencing any asset keys in your code. -Once you've uploaded these assets, you can use the asset key to reference them in your code when [Setting Assets in Rich Presence](/docs/discord-social-sdk/development-guides/setting-rich-presence#setting-assets). +Once you've uploaded these assets, you can use the asset key to reference them in your code when [Setting Assets in Rich Presence](/developers/docs/discord-social-sdk/development-guides/setting-rich-presence#setting-assets). -![Rich Presence assets in app settings](images/rich-presence-asset-images.webp) +![Rich Presence assets in app settings](/images/rich-presence/asset-images.png) --- @@ -159,9 +157,9 @@ assets.SetInviteCoverImage("invite-cover-image"); // Used for Game Invites activity.SetAssets(assets); ``` -:::info -If you need more than 300 custom assets or want to use images stored somewhere else, you can also [specify an external URL](/docs/events/gateway-events#activity-object-activity-asset-image) as long it still has the proper dimensions and size. -::: + +If you need more than 300 custom assets or want to use images stored somewhere else, you can also [specify an external URL](/developers/docs/events/gateway-events#activity-object-activity-asset-image) as long it still has the proper dimensions and size. + --- @@ -207,7 +205,7 @@ activity.SetStatusDisplayType(discordpp::StatusDisplayTypes::Details); ## Setting Party and Join Secret -You can also include party details and a join secret in your Rich Presence to power Game Invites. Check out the [Game Invites guide](/docs/discord-social-sdk/development-guides/managing-game-invites) for more information. +You can also include party details and a join secret in your Rich Presence to power Game Invites. Check out the [Game Invites guide](/developers/docs/discord-social-sdk/development-guides/managing-game-invites) for more information. ```cpp @@ -240,9 +238,9 @@ See the `ActivityGamePlatforms` enum for all supported platforms. ## Rich Presence Without Authentication -:::warn + Rich Presence via RPC (Remote Procedure Call) will only work with a running Discord desktop client. It does not support mobile, console or web clients. -::: + Unlike most other features of the Discord Social SDK, **Rich Presence can be set without authentication**. Instead of using [`Client::Connect`] to authenticate with Discord, you can use Rich Presence functionality by directly communicating @@ -293,17 +291,21 @@ client->UpdateRichPresence( Now that you've set up Rich Presence, you might want to explore: - - +import {UserIcon} from '/snippets/icons/UserIcon.jsx' +import {MagicDoorIcon} from '/snippets/icons/MagicDoorIcon.jsx' +import {InboxIcon} from '/snippets/icons/InboxIcon.jsx' + + + }> Allow players to invite friends to join their game session or party. - + }> Bring players together in a shared lobby with invites, text chat, and voice comms. - + }> Best practices for Rich Presence UI/UX. - + diff --git a/docs/discord-social-sdk/development-guides/using-provisional-accounts.mdx b/discord/developers/docs/discord-social-sdk/development-guides/using-provisional-accounts.mdx similarity index 87% rename from docs/discord-social-sdk/development-guides/using-provisional-accounts.mdx rename to discord/developers/docs/discord-social-sdk/development-guides/using-provisional-accounts.mdx index 46786bc478..a8b347c441 100644 --- a/docs/discord-social-sdk/development-guides/using-provisional-accounts.mdx +++ b/discord/developers/docs/discord-social-sdk/development-guides/using-provisional-accounts.mdx @@ -1,12 +1,11 @@ --- -sidebar_label: Using Provisional Accounts +title: Using Provisional Accounts +description: Implement provisional Discord accounts for users who don't have Discord accounts yet. --- -import PublicClient from '../partials/callouts/public-client.mdx'; -import SupportCallout from '../partials/callouts/support.mdx'; -[Home](/docs/intro) > [Discord Social SDK](/docs/discord-social-sdk/overview) > [Development Guides](/docs/discord-social-sdk/development-guides) > {sidebar_label} - -# Using Provisional Accounts +import {ManualAnchor} from '/snippets/manualanchor.jsx' +import PublicClient from '/snippets/discord-social-sdk/callouts/public-client.mdx'; +import SupportCallout from '/snippets/discord-social-sdk/callouts/support.mdx'; ## Overview @@ -31,11 +30,12 @@ This guide will show you how to: Before you begin, make sure you have: -- A basic understanding of how the SDK works from the [Getting Started Guide](/docs/discord-social-sdk/getting-started) +- A basic understanding of how the SDK works from the [Getting Started Guide](/developers/docs/discord-social-sdk/getting-started) - An external authentication provider set up for your game --- + ## What Are Provisional Accounts? Think of provisional accounts as temporary Discord accounts that: @@ -72,17 +72,17 @@ For existing Discord users who have added a provisional account as a game friend Discord offers a number of authentication methods, the one you use depends on how you game and account system is set up: -1. Use the [Bot Token Endpoint](/docs/discord-social-sdk/development-guides/using-provisional-accounts#server-authentication-with-bot-token-endpoint) if your game has an account system which uniquely identifies users. This is the recommended approach when possible. -2. Use the [Server Authentication with External Credentials Exchange](/docs/discord-social-sdk/development-guides/using-provisional-accounts#server-authentication-with-external-credentials-exchange) if you have an existing OIDC provider, or do not have an account system. -3. Use the [Client Side Token Exchange Method](/docs/discord-social-sdk/development-guides/using-provisional-accounts#authentication-for-public-clients) if you are using a Public Client. +1. Use the [Bot Token Endpoint](/developers/docs/discord-social-sdk/development-guides/using-provisional-accounts#server-authentication-with-bot-token-endpoint) if your game has an account system which uniquely identifies users. This is the recommended approach when possible. +2. Use the [Server Authentication with External Credentials Exchange](/developers/docs/discord-social-sdk/development-guides/using-provisional-accounts#server-authentication-with-external-credentials-exchange) if you have an existing OIDC provider, or do not have an account system. +3. Use the [Client Side Token Exchange Method](/developers/docs/discord-social-sdk/development-guides/using-provisional-accounts#authentication-for-public-clients) if you are using a Public Client. If you are using (2) or (3), you must configure you identity provider before being able to create provisional accounts. ### Configuring Your Identity Provider -:::warn + If you are using the bot token endpoint, no Identity Provider configuration is required. -::: + Open the Discord app for your game in the [Developer Portal](https://discord.com/developers/applications). Find the `External Auth` page under the `Discord Social SDK` section in the sidebar. @@ -118,15 +118,15 @@ You provide external authentication and uniquely identifies the user, and Discor - If there is no account associated with the identity, a new provisional account is created along with a new access token for the user. - If there is a provisional account associated with the identity, an access token is returned. -- If there is an existing _full Discord account_ associated with the identity, the request is aborted (See [Error Handling](/docs/discord-social-sdk/development-guides/using-provisional-accounts#error-handling)). +- If there is an existing _full Discord account_ associated with the identity, the request is aborted (See [Error Handling](/developers/docs/discord-social-sdk/development-guides/using-provisional-accounts#error-handling)). Once authentication is complete, you can use the access token as you would a full Discord user's access token. ### Server Authentication with Bot Token Endpoint -:::info + This is the preferred method of authentication. It ends up being the simplest choice for most provisional account integrations. -::: + ```python # filepath: your_game/server/auth.py @@ -228,9 +228,9 @@ The callback function will be invoked with an access token that expires in 1 hou You can use [`Client::SetTokenExpirationCallback`] to receive a callback when the current token is about to expire or expires. -:::info + When the token expires, the SDK will still receive updates, such as new messages sent in a lobby, and any voice calls will continue to be active. However, any new actions, such as sending a message or adding a friend, will fail. You can get a new token and pass it to UpdateToken without interrupting the user's experience. -::: + #### Provisional Account Access Token Storage @@ -295,10 +295,10 @@ client->UpdateProvisionalAccountDisplayName("CoolPlayer123", [](discordpp::Clien ## Merging Provisional Accounts -When a player wants to convert their provisional account to a full Discord account, we start a special version of the [access token request flow](/docs/discord-social-sdk/development-guides/account-linking-with-discord#requesting-access-tokens) where the provisional users external identity is included. +When a player wants to convert their provisional account to a full Discord account, we start a special version of the [access token request flow](/developers/docs/discord-social-sdk/development-guides/account-linking-with-discord#requesting-access-tokens) where the provisional users external identity is included. -- If you have a backend, follow [Merging Provisional Accounts for Servers](/docs/discord-social-sdk/development-guides/using-provisional-accounts#merging-provisional-accounts-for-servers) -- If you do not have a backend, follow [Merging Provisional Accounts for Public Clients ](/docs/discord-social-sdk/development-guides/using-provisional-accounts#merging-provisional-accounts-for-public-clients) +- If you have a backend, follow [Merging Provisional Accounts for Servers](/developers/docs/discord-social-sdk/development-guides/using-provisional-accounts#merging-provisional-accounts-for-servers) +- If you do not have a backend, follow [Merging Provisional Accounts for Public Clients ](/developers/docs/discord-social-sdk/development-guides/using-provisional-accounts#merging-provisional-accounts-for-public-clients) ### Merging Provisional Accounts for Servers @@ -334,12 +334,10 @@ def exchange_code_with_merge(code, redirect_uri, external_auth_token): ```python import requests - API_ENDPOINT = 'https://discord.com/api/v10' CLIENT_ID = '332269999912132097' CLIENT_SECRET = '937it3ow87i4ery69876wqire' EXTERNAL_AUTH_TYPE = 'OIDC' - def exchange_device_code_with_merge(device_code): data = { 'grant_type': 'urn:ietf:params:oauth:grant-type:device_code', @@ -456,9 +454,9 @@ When a player wants to unlink their Discord account from their provisional accou 2. A developer can unmerge the account using the unmerge endpoint on the Discord API 3. A developer can use the SDK helper method for public clients -:::warn + Unmerging invalidates all access/refresh tokens for the user. They cannot be used again after the unmerge operation completes. Any connected game sessions will be disconnected. -::: + ### Discord Users @@ -467,7 +465,7 @@ Users can unmerge their account by removing access to your application on their This method doesn't require any code changes from developers, but we recommend providing unmerging functionality through one of the options below for a better user experience. -If you would like to be notified when a user unlinks this way, you can [configure you application to listen for the `APPLICATION_DEAUTHORIZED` webhook event](/docs/events/webhook-events#application-deauthorized). +If you would like to be notified when a user unlinks this way, you can [configure you application to listen for the `APPLICATION_DEAUTHORIZED` webhook event](/developers/docs/events/webhook-events#application-deauthorized). Otherwise, you will know that the user has unlinked because their access token and refresh token (if you have one) will be invalidated. ### Unmerging Provisional Accounts for Servers @@ -494,9 +492,35 @@ def unmerge_provisional_account(external_auth_token): r.raise_for_status() ``` -:::info + If you have a server backend, you'll want to use the server-to-server unmerge endpoint rather than the SDK helper method to maintain better security and control over the unmerge process. -::: + + +#### Unmerging with Bot Token Endpoint + +If you're using the [Bot Token Endpoint](/docs/discord-social-sdk/development-guides/using-provisional-accounts#server-authentication-with-bot-token-endpoint) for authentication, you can unmerge accounts without an external auth token. + +```python +import requests + +API_ENDPOINT = 'https://discord.com/api/v10' +BOT_TOKEN = 'YOUR_BOT_TOKEN' + +def unmerge_provisional_account(external_user_id): + data = { + 'external_user_id': external_user_id # identifier used in the /token/bot endpoint + } + headers = { + 'Content-Type': 'application/json', + 'Authorization': f'Bot {BOT_TOKEN}' + } + r = requests.post('%s/provisional-accounts/unmerge/bot' % API_ENDPOINT, json=data, headers=headers) + r.raise_for_status() +``` + + +This endpoint can also be useful in cases where the Discord Auth token has been lost to to error or data loss, and an unmerge operation is required to migrate to a provisional account before re-linking a Discord account. + ### Unmerging Provisional Accounts for Public Clients @@ -569,18 +593,18 @@ When a user unmerges their account, a new provisional account is created with a * **❌ Discord friends who don't use this application**: Not transferred * **❌ DM message history**: Not moved to provisional accounts -:::info + Provisional accounts can have Discord friends, but can only message these friends when actively playing the game. -::: + ### Unmerge Request Failures You may receive an unmerge specific error code while attempting this operation: -Code | HTTP Status | Meaning | Solution | -|--------|-------------|--------------------------------------------|--------------------------------------------------------------------------| -| 50229 | 400 | Invalid user type | User account is provisional and cannot be unmerged | -| - | 404 | Unknown user | No user identity found for the provided external identity | +| Code | HTTP Status | Meaning | Solution | +|-------|-------------|-------------------|-----------------------------------------------------------| +| 50229 | 400 | Invalid user type | User account is provisional and cannot be unmerged | +| - | 404 | Unknown user | No user identity found for the provided external identity | --- @@ -589,17 +613,21 @@ Code | HTTP Status | Meaning | Solution Now that you've set up provisional accounts for your game, you can explore more features of the Discord Social SDK: - - +import {PaintPaletteIcon} from '/snippets/icons/PaintPaletteIcon.jsx' +import {ListViewIcon} from '/snippets/icons/ListViewIcon.jsx' +import {UserStatusIcon} from '/snippets/icons/UserStatusIcon.jsx' + + + }> Design guidelines for implementing provisional accounts in your game. - + }> Combine Discord and game friends into a single list for easy management. - + }> Display game status and information to Discord friends. - + @@ -619,4 +647,4 @@ Now that you've set up provisional accounts for your game, you can explore more [`Client::GetTokenFromProvisionalMerge`]: https://discord.com/developers/docs/social-sdk/classdiscordpp_1_1Client.html#a41062b7dafa331ddd2320daf1b4b273b [`Client::SetTokenExpirationCallback`]: https://discord.com/developers/docs/social-sdk/classdiscordpp_1_1Client.html#aab5bfc76809ea22e79f2f7a067ac4519 [`Client::UnmergeIntoProvisionalAccount`]: https://discord.com/developers/docs/social-sdk/classdiscordpp_1_1Client.html#a2da21ae8a3015e0e5e42c1a7226b256f -[`Client::UpdateProvisionalAccountDisplayName`]: https://discord.com/developers/docs/social-sdk/classdiscordpp_1_1Client.html#a7485979ab2d4c533b75f8efd5e50bc60 \ No newline at end of file +[`Client::UpdateProvisionalAccountDisplayName`]: https://discord.com/developers/docs/social-sdk/classdiscordpp_1_1Client.html#a7485979ab2d4c533b75f8efd5e50bc60 diff --git a/discord/developers/docs/discord-social-sdk/getting-started.mdx b/discord/developers/docs/discord-social-sdk/getting-started.mdx new file mode 100644 index 0000000000..33c418e0fb --- /dev/null +++ b/discord/developers/docs/discord-social-sdk/getting-started.mdx @@ -0,0 +1,37 @@ +--- +title: Getting Started with the Discord Social SDK +sidebarTitle: Glossary +description: Quick start guide for integrating the Discord Social SDK. +--- + +The Discord Social SDK allows you to integrate Discord social features into your game. With the Discord Social SDK, you can offer a seamless social experience for your players, allowing them to connect with their friends and communities on Discord without leaving your game. + +If this is your first time learning about the Discord Social SDK, check out the Discord Social SDK [Overview](/developers/docs/discord-social-sdk/overview) and [Core Concepts](/developers/docs/discord-social-sdk/core-concepts) for more information on what the SDK can do and how it can benefit your game. + +## Let's Get Started + +Select a platform to get started. + +If you are unsure which platform to choose, we recommend starting with the C++ guide to familiarize yourself with the SDK's core concepts. + + + + For use with custom engines or standalone applications. + + + For use with Unity. + + + For use with Unreal Engine. + + + + +To see a complete list of currently compatible platforms, check out our [Platform Compatibility](/developers/docs/discord-social-sdk/core-concepts/platform-compatibility) section. + + +--- + +## Next Steps + +After you've run through a guide for your preferred platform, you can implement features such as a unified friend list, rich presence, and more. Check out the [Development Guides](/developers/docs/discord-social-sdk/development-guides) for detailed information on using the SDK for each feature. \ No newline at end of file diff --git a/docs/discord-social-sdk/getting-started/partials/dylib-mac-error.mdx b/discord/developers/docs/discord-social-sdk/getting-started/partials/dylib-mac-error.mdx similarity index 62% rename from docs/discord-social-sdk/getting-started/partials/dylib-mac-error.mdx rename to discord/developers/docs/discord-social-sdk/getting-started/partials/dylib-mac-error.mdx index c82a072fb1..901a5e4a77 100644 --- a/docs/discord-social-sdk/getting-started/partials/dylib-mac-error.mdx +++ b/discord/developers/docs/discord-social-sdk/getting-started/partials/dylib-mac-error.mdx @@ -1,14 +1,14 @@ - + On Mac you may get the error "libdiscord_partner_sdk.dylib" Not Opened because Apple couldn't verify it. If this happens press **Done** on the popup. -![Error](images/social-sdk/getting-started/partials/error.webp) +![Error](/images/social-sdk/getting-started/partials/error.webp) You'll need to open your **System Settings > Privacy & Security** and scroll down to the **Security** section. It will tell you "libdiscord_partner_sdk.dylib" was blocked to protect your Mac. Press **Open Anyway** and try running again. -![Settings](images/social-sdk/getting-started/partials/settings-security.webp) +![Settings](/images/social-sdk/getting-started/partials/settings-security.webp) Now when you get the pop up you'll have the option to select **Open Anyway** and it will be able to use it successfully. -![Open](images/social-sdk/getting-started/partials/open-anyway.webp) +![Open](/images/social-sdk/getting-started/partials/open-anyway.webp) - \ No newline at end of file + \ No newline at end of file diff --git a/docs/discord-social-sdk/getting-started/partials/getting-started.mdx b/discord/developers/docs/discord-social-sdk/getting-started/partials/getting-started.mdx similarity index 94% rename from docs/discord-social-sdk/getting-started/partials/getting-started.mdx rename to discord/developers/docs/discord-social-sdk/getting-started/partials/getting-started.mdx index 07806bc4ab..a047bb55c6 100644 --- a/docs/discord-social-sdk/getting-started/partials/getting-started.mdx +++ b/discord/developers/docs/discord-social-sdk/getting-started/partials/getting-started.mdx @@ -18,9 +18,9 @@ Later, you can invite your team members to your new team to collaborate on your - See [`discordpp::Client::Authorize`](https://discord.com/developers/docs/social-sdk/classdiscordpp_1_1Client.html#ace94a58e27545a933d79db32b387a468) for more details on setting up more advanced redirect URIs. 4. Enable the `Public Client` toggle in the `OAuth2` tab. -:::warn -**Note:** This guide requires enabling **Public Client** to allow you to get started with the SDK quickly. Most games will not want to ship as a public client. This setting should be reviewed by your team prior to releasing your game. [Learn more about public clients](/docs/discord-social-sdk/core-concepts/oauth2-scopes#oauth2-client-types). -::: + +**Note:** This guide requires enabling **Public Client** to allow you to get started with the SDK quickly. Most games will not want to ship as a public client. This setting should be reviewed by your team prior to releasing your game. [Learn more about public clients](/developers/docs/discord-social-sdk/core-concepts/oauth2-scopes#oauth2-client-types). + --- diff --git a/docs/discord-social-sdk/getting-started/using-c++.mdx b/discord/developers/docs/discord-social-sdk/getting-started/using-c++.mdx similarity index 94% rename from docs/discord-social-sdk/getting-started/using-c++.mdx rename to discord/developers/docs/discord-social-sdk/getting-started/using-c++.mdx index 1514b44f74..84919719a1 100644 --- a/docs/discord-social-sdk/getting-started/using-c++.mdx +++ b/discord/developers/docs/discord-social-sdk/getting-started/using-c++.mdx @@ -1,14 +1,12 @@ --- -sidebar_label: Using Standalone C++ +sidebarTitle: Using Standalone C++ +title: Getting Started with C++ and the Discord Social SDK +description: Get started with the Discord Social SDK in C++ applications. --- -import AppCreationSteps from './partials/getting-started.mdx' -import ConsoleAccess from '../partials/callouts/console-access.mdx'; -import SupportCallout from '../partials/callouts/support.mdx'; -import DylibMacError from './partials/dylib-mac-error.mdx'; - -[Home](/docs/intro) > [Discord Social SDK](/docs/discord-social-sdk/overview) > {sidebar_label} - -# Getting Started with C++ and the Discord Social SDK +import AppCreationSteps from '/snippets/discord-social-sdk/partials/getting-started.mdx' +import ConsoleAccess from '/snippets/discord-social-sdk/callouts/console-access.mdx'; +import SupportCallout from '/snippets/discord-social-sdk/callouts/support.mdx'; +import DylibMacError from '/snippets/discord-social-sdk/partials/dylib-mac-error.mdx'; ## Overview @@ -61,13 +59,13 @@ To utilize the Discord Social SDK with C++, the following requirements must be m All of which can be found in the SDK download archive. -:::info + 💡 **Troubleshooting Tip:** If you encounter unresolved external symbols, ensure the SDK library is correctly linked in your build system. -::: + Let's see this in action by starting with a folder for our project and the Social SDK dependency: -``` +```bash mkdir MyGame cd MyGame mkdir lib @@ -77,13 +75,13 @@ Unzip the Social SDK archive into the `lib` directory. You should end up with a Within the `MyGame` directory, create a `CMakeLists.txt` file: -``` +```bash touch CMakeLists.txt ``` Add the following contents to the `CMakeLists.txt` file to set up the Social SDK dependency appropriately for your operating system: -``` +```cmake cmake_minimum_required(VERSION 3.10) project(DiscordSDKExample) @@ -131,13 +129,13 @@ endif() add_custom_command(TARGET DiscordSDKExample POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy_if_different "${DISCORD_SHARED_LIB}" - $; + $<TARGET_FILE_DIR:DiscordSDKExample> ) ``` Create a main.cpp file: -``` +```bash touch main.cpp ``` @@ -182,7 +180,7 @@ int main() { Compile and run the project: -``` +```bash mkdir build && cd build cmake .. cmake --build . @@ -230,7 +228,7 @@ client->SetStatusChangedCallback([client](discordpp::Client::Status status, disc }); ``` - + ```cpp #define DISCORDPP_IMPLEMENTATION @@ -284,20 +282,20 @@ int main() { return 0; } ``` - + -:::info + Most Discord features won't work until the status is [`Client::Status::Ready`]. The status callback lets you know exactly when you can start using them. -::: + ### What These Callbacks Do - The **logging callback** shows you what's happening behind the scenes - The **status callback** tells you when you're connected and ready to use Discord features -:::info + At this point, these callbacks **won't get called** since the client setup is not yet complete. However, very soon we will be using them to view debug information and see what our connection status is! -::: + To get to a [`Client::Status::Ready`] state, we need to authenticate with Discord. We'll do that shortly. @@ -371,9 +369,9 @@ client->Authorize(args, [client, codeVerifier](auto result, auto code, auto redi 3. Start the auth flow with [`Client::Authorize`], which opens a browser 4. When authorized, we exchange the code for an access token -:::warn + Never log or store access tokens insecurely! They should be treated as sensitive credentials. -::: + ### Testing It Out @@ -386,7 +384,7 @@ If you run into any issues: - Ensure you've added the redirect URL in your Discord Developer Portal - Check the console for specific error messages - + ```cpp #define DISCORDPP_IMPLEMENTATION #include "discordpp.h" @@ -471,7 +469,7 @@ int main() { return 0; } ``` - + --- @@ -500,9 +498,9 @@ client->UpdateToken(discordpp::AuthorizationTokenType::Bearer, accessToken, [cl 3. The SDK will begin connecting asynchronously 4. Our status callback (from Step 6) will tell us when we're ready -:::info + Watch your console output! You should see status updates as the connection is established. -::: + ### Testing the Connection @@ -522,7 +520,7 @@ If you don't see "Ready" status: Now that your client is in a ready state, we can start implementing Discord social features. - + ```cpp #define DISCORDPP_IMPLEMENTATION #include "discordpp.h" @@ -613,7 +611,7 @@ int main() { return 0; } ``` - + --- @@ -643,9 +641,9 @@ std::cout << "👥 Friends Count: " << client->GetRelationships().size() << std: 1. Run your program 2. Wait for the initial friend count -:::info + This relationship data forms the foundation for features like friend lists, activity feeds, and multiplayer invites! -::: + ### Troubleshooting @@ -657,7 +655,7 @@ If you're not seeing relationship data: Next, we'll learn how to show your game's activity on Discord with Rich Presence! - + ```cpp #define DISCORDPP_IMPLEMENTATION #include "discordpp.h" @@ -752,7 +750,7 @@ int main() { return 0; } ``` - + --- @@ -807,7 +805,7 @@ If you don't see your presence: - Verify your activity settings are valid - Make sure you're not invisible on Discord - + ```cpp #define DISCORDPP_IMPLEMENTATION #include "discordpp.h" @@ -917,7 +915,7 @@ int main() { return 0; } ``` - + --- @@ -945,17 +943,21 @@ Congratulations! You've successfully integrated the Discord Social SDK into your You have successfully set up the Discord Social SDK with C++ and authenticated with Discord! You can now use the SDK to add more social features in your project. - - +import {ListViewIcon} from '/snippets/icons/ListViewIcon.jsx' +import {UserStatusIcon} from '/snippets/icons/UserStatusIcon.jsx' +import {InboxIcon} from '/snippets/icons/InboxIcon.jsx' + + + }> Create a unified friends list combining Discord and game-specific friendships - + }> Customize your game's rich presence to show more advanced information and game invites - + }> Allow players to invite friends to join their game session or party. - + diff --git a/docs/discord-social-sdk/getting-started/using-unity.mdx b/discord/developers/docs/discord-social-sdk/getting-started/using-unity.mdx similarity index 80% rename from docs/discord-social-sdk/getting-started/using-unity.mdx rename to discord/developers/docs/discord-social-sdk/getting-started/using-unity.mdx index b073931fed..82f05dc6c4 100644 --- a/docs/discord-social-sdk/getting-started/using-unity.mdx +++ b/discord/developers/docs/discord-social-sdk/getting-started/using-unity.mdx @@ -1,14 +1,12 @@ --- -sidebar_label: Using Unity +title: Getting Started with Unity and the Discord Social SDK +sidebarTitle: Using Unity +description: Integrate the Discord Social SDK into Unity games. --- -import AppCreationSteps from './partials/getting-started.mdx' -import ConsoleAccess from '../partials/callouts/console-access.mdx'; -import SupportCallout from '../partials/callouts/support.mdx'; -import DylibMacError from './partials/dylib-mac-error.mdx'; - -[Home](/docs/intro) > [Discord Social SDK](/docs/discord-social-sdk/overview) > {sidebar_label} - -# Getting Started with Unity and the Discord Social SDK +import AppCreationSteps from '/snippets/discord-social-sdk/partials/getting-started.mdx' +import ConsoleAccess from '/snippets/discord-social-sdk/callouts/console-access.mdx'; +import SupportCallout from '/snippets/discord-social-sdk/callouts/support.mdx'; +import DylibMacError from '/snippets/discord-social-sdk/partials/dylib-mac-error.mdx'; ## Overview @@ -39,9 +37,9 @@ Let's walk through the steps in detail. 1. Click on the `Downloads` link under the Discord Social SDK section of the sidebar. 2. Select the latest version from the version dropdown and download the SDK for Unity. -:::info + A Unity sample project is available for download on this page, but we are not going to cover it in this guide. Explore it on your own after you finish this guide! -::: + --- @@ -103,49 +101,49 @@ Let's add some event handlers to monitor what's happening with our Discord conne We'll start by adding the following code to your `DiscordManager.cs`: ```cs - void Start() - { - client = new Client(); - - // Modifying LoggingSeverity will show you more or less logging information - client.AddLogCallback(OnLog, LoggingSeverity.Error); - client.SetStatusChangedCallback(OnStatusChanged); +void Start() +{ + client = new Client(); - // Make sure the button has a listener - if (loginButton != null) - { - //loginButton.onClick.AddListener(StartOAuthFlow); - } - else - { - Debug.LogError("Login button reference is missing, connect it in the inspector!"); - } + // Modifying LoggingSeverity will show you more or less logging information + client.AddLogCallback(OnLog, LoggingSeverity.Error); + client.SetStatusChangedCallback(OnStatusChanged); - // Set initial status text - if (statusText != null) - { - statusText.text = "Ready to login"; - } - else - { - Debug.LogError("Status text reference is missing, connect it in the inspector!"); - } + // Make sure the button has a listener + if (loginButton != null) + { + //loginButton.onClick.AddListener(StartOAuthFlow); + } + else + { + Debug.LogError("Login button reference is missing, connect it in the inspector!"); } - private void OnLog(string message, LoggingSeverity severity) + // Set initial status text + if (statusText != null) { - Debug.Log($"Log: {severity} - {message}"); + statusText.text = "Ready to login"; } + else + { + Debug.LogError("Status text reference is missing, connect it in the inspector!"); + } +} - private void OnStatusChanged(Client.Status status, Client.Error error, int errorCode) +private void OnLog(string message, LoggingSeverity severity) +{ + Debug.Log($"Log: {severity} - {message}"); +} + +private void OnStatusChanged(Client.Status status, Client.Error error, int errorCode) +{ + Debug.Log($"Status changed: {status}"); + statusText.text = status.ToString(); + if(error != Client.Error.None) { - Debug.Log($"Status changed: {status}"); - statusText.text = status.ToString(); - if(error != Client.Error.None) - { - Debug.LogError($"Error: {error}, code: {errorCode}"); - } + Debug.LogError($"Error: {error}, code: {errorCode}"); } +} ``` This will hook up the API status changes to your text in the game. Then we'll need to get your Client ID from the OAuth2 tab in the developer portal and paste it into the ClientID on the **DiscordManager** in the inspector. @@ -155,13 +153,13 @@ This will hook up the API status changes to your text in the game. Then we'll ne - The **logging callback** shows you what's happening behind the scenes and is a powerful tool for debugging - The **status callback** tells you when you're connected and ready to use Discord features -:::info -The Unity plugin handles running the SDK callbacks for you in Unity, no need to use [`RunCallbacks`] like we do in the [C++ guide](/docs/discord-social-sdk/getting-started/using-c++). -::: + +The Unity plugin handles running the SDK callbacks for you in Unity, no need to use [`RunCallbacks`] like we do in the [C++ guide](/developers/docs/discord-social-sdk/getting-started/using-c++). + -:::info + Most Discord features won't work until the status is `Ready`. The status callback lets you know when you can start using them. -::: + To get to a `Ready` state, we need to authenticate with Discord. Let's do that next. @@ -180,40 +178,41 @@ In this step, we'll implement OAuth2 authentication to support account linking w To start we'll add this code to your `DiscordManager.cs`: ```cs - private void StartOAuthFlow() { - var authorizationVerifier = client.CreateAuthorizationCodeVerifier(); - codeVerifier = authorizationVerifier.Verifier(); - - var args = new AuthorizationArgs(); - args.SetClientId(clientId); - args.SetScopes(Client.GetDefaultPresenceScopes()); - args.SetCodeChallenge(authorizationVerifier.Challenge()); - client.Authorize(args, OnAuthorizeResult); - } +private void StartOAuthFlow() { + var authorizationVerifier = client.CreateAuthorizationCodeVerifier(); + codeVerifier = authorizationVerifier.Verifier(); + + var args = new AuthorizationArgs(); + args.SetClientId(clientId); + args.SetScopes(Client.GetDefaultPresenceScopes()); + args.SetCodeChallenge(authorizationVerifier.Challenge()); + client.Authorize(args, OnAuthorizeResult); +} - private void OnAuthorizeResult(ClientResult result, string code, string redirectUri) { - Debug.Log($"Authorization result: [{result.Error()}] [{code}] [{redirectUri}]"); - if (!result.Successful()) { - return; - } - GetTokenFromCode(code, redirectUri); +private void OnAuthorizeResult(ClientResult result, string code, string redirectUri) { + Debug.Log($"Authorization result: [{result.Error()}] [{code}] [{redirectUri}]"); + if (!result.Successful()) { + return; } + GetTokenFromCode(code, redirectUri); +} - private void GetTokenFromCode(string code, string redirectUri) { - client.GetToken(clientId, - code, - codeVerifier, - redirectUri, - (result, token, refreshToken, tokenType, expiresIn, scope) => {}); - } +private void GetTokenFromCode(string code, string redirectUri) { + client.GetToken(clientId, + code, + codeVerifier, + redirectUri, + (result, token, refreshToken, tokenType, expiresIn, scope) => {}); +} ``` and then we'll uncomment `loginButton.onClick.AddListener(StartOAuthFlow);` in your `Start()` method + ```cs - if (loginButton != null) - { - loginButton.onClick.AddListener(StartOAuthFlow); - } +if (loginButton != null) +{ + loginButton.onClick.AddListener(StartOAuthFlow); +} ``` ### What's Happening Here? @@ -223,9 +222,9 @@ and then we'll uncomment `loginButton.onClick.AddListener(StartOAuthFlow);` in y 3. Start the auth flow with [`Client::Authorize`], which opens a browser 4. When authorized, we exchange the code for an access token -:::warn + Never log or store access tokens insecurely! They should be treated as sensitive credentials. -::: + ### Testing It Out @@ -238,7 +237,7 @@ Now, if you press play and click the button, it should start the OAuth flow! You - Ensure you've added the redirect URL in your Discord Developer Portal - Check the console for specific error messages - + ```cs using UnityEngine; using UnityEngine.UI; @@ -331,7 +330,7 @@ public class DiscordManager : MonoBehaviour } } ``` - + --- @@ -342,30 +341,30 @@ Now that we have our access token, let's connect to Discord! To start, we'll add this code to your `DiscordManager.cs`: ```cs - private void OnReceivedToken(string token) { - Debug.Log("Token received: " + token); - client.UpdateToken(AuthorizationTokenType.Bearer, token, (ClientResult result) => { client.Connect(); }); - } +private void OnReceivedToken(string token) { + Debug.Log("Token received: " + token); + client.UpdateToken(AuthorizationTokenType.Bearer, token, (ClientResult result) => { client.Connect(); }); +} - private void OnRetrieveTokenFailed() { statusText.text = "Failed to retrieve token"; } +private void OnRetrieveTokenFailed() { statusText.text = "Failed to retrieve token"; } ``` Then we'll update `GetTokenFromCode` to call these functions when it completes: ```cs - private void GetTokenFromCode(string code, string redirectUri) { - client.GetToken(clientId, - code, - codeVerifier, - redirectUri, - (result, token, refreshToken, tokenType, expiresIn, scope) => { - if (token != "") { - OnReceivedToken(token); - } else { - OnRetrieveTokenFailed(); - } - }); - } +private void GetTokenFromCode(string code, string redirectUri) { + client.GetToken(clientId, + code, + codeVerifier, + redirectUri, + (result, token, refreshToken, tokenType, expiresIn, scope) => { + if (token != "") { + OnReceivedToken(token); + } else { + OnRetrieveTokenFailed(); + } + }); +} ``` ### What's Happening Here? @@ -389,7 +388,7 @@ If you don't see `Ready` status: - Verify your `ClientID` set in the inspector is correct - + ```cs using UnityEngine; using UnityEngine.UI; @@ -495,7 +494,7 @@ public class DiscordManager : MonoBehaviour private void OnRetrieveTokenFailed() { statusText.text = "Failed to retrieve token"; } } ``` - + Now that your client is in a ready state, we can start implementing Discord social features. @@ -508,29 +507,29 @@ Let's access the user's Discord relationships (friends list) and display the cou Lets add some new code to your `DiscordManager.cs`: ```cs - private void ClientReady() - { - Debug.Log($"Friend Count: {client.GetRelationships().Count()}"); - } +private void ClientReady() +{ + Debug.Log($"Friend Count: {client.GetRelationships().Count()}"); +} ``` We want to call this when the client is ready to use which we'll know in our `OnStatusChanged` method: ```cs - private void OnStatusChanged(Client.Status status, Client.Error error, int errorCode) +private void OnStatusChanged(Client.Status status, Client.Error error, int errorCode) +{ + Debug.Log($"Status changed: {status}"); + statusText.text = status.ToString(); + if(error != Client.Error.None) { - Debug.Log($"Status changed: {status}"); - statusText.text = status.ToString(); - if(error != Client.Error.None) - { - Debug.LogError($"Error: {error}, code: {errorCode}"); - } + Debug.LogError($"Error: {error}, code: {errorCode}"); + } - if (status == Client.Status.Ready) - { - ClientReady(); - } + if (status == Client.Status.Ready) + { + ClientReady(); } +} ``` ### What This Code Does @@ -556,7 +555,7 @@ Friend Count: 42 Next, we'll learn how to show your game's activity on Discord with Rich Presence! - + ```cs using UnityEngine; using UnityEngine.UI; @@ -673,7 +672,7 @@ public class DiscordManager : MonoBehaviour private void OnRetrieveTokenFailed() { statusText.text = "Failed to retrieve token"; } } ``` - + --- @@ -684,22 +683,22 @@ Let's show your game's activity on Discord using Rich Presence. This feature let Update your `ClientReady` method with this code: ```cs - private void ClientReady() - { - Debug.Log($"Friend Count: {client.GetRelationships().Count()}"); - - Activity activity = new Activity(); - activity.SetType(ActivityTypes.Playing); - activity.SetState("In Competitive Match"); - activity.SetDetails("Rank: Diamond II"); - client.UpdateRichPresence(activity, (ClientResult result) => { - if (result.Successful()) { - Debug.Log("Rich presence updated!"); - } else { - Debug.LogError("Failed to update rich presence"); - } - }); - } +private void ClientReady() +{ + Debug.Log($"Friend Count: {client.GetRelationships().Count()}"); + + Activity activity = new Activity(); + activity.SetType(ActivityTypes.Playing); + activity.SetState("In Competitive Match"); + activity.SetDetails("Rank: Diamond II"); + client.UpdateRichPresence(activity, (ClientResult result) => { + if (result.Successful()) { + Debug.Log("Rich presence updated!"); + } else { + Debug.LogError("Failed to update rich presence"); + } + }); +} ``` ### What This Code Does @@ -725,7 +724,7 @@ If you don't see your presence: --- - + ```cs using UnityEngine; using UnityEngine.UI; @@ -853,7 +852,7 @@ public class DiscordManager : MonoBehaviour private void OnRetrieveTokenFailed() { statusText.text = "Failed to retrieve token"; } } ``` - + --- @@ -885,23 +884,24 @@ Congratulations! You've successfully integrated the Discord Social SDK into Unit Check out our [in depth sample for using the Social SDK in Unity](https://github.com/discord/social-sdk-unity-sample) following the best practices laid out in these guides. It contains easy to drop in prefabs with both code and UI to quickly integrate Discord's social features into your game. -![Video showing off the Unity sample with the Discord Social SDK](images/social-sdk/getting-started/unity-sample-preview.webp) +![Video showing off the Unity sample with the Discord Social SDK](/images/social-sdk/getting-started/unity-sample-preview.webp) -### Continuing On -Follow these guides to dive deeper into the features of the Discord Social SDK. +import {ListViewIcon} from '/snippets/icons/ListViewIcon.jsx' +import {UserStatusIcon} from '/snippets/icons/UserStatusIcon.jsx' +import {InboxIcon} from '/snippets/icons/InboxIcon.jsx' - - + + }> Create a unified friends list combining Discord and game-specific friendships - + }> Customize your game's rich presence to show more advanced information and game invites - + }> Allow players to invite friends to join their game session or party. - + diff --git a/docs/discord-social-sdk/getting-started/using-unreal-engine.mdx b/discord/developers/docs/discord-social-sdk/getting-started/using-unreal-engine.mdx similarity index 93% rename from docs/discord-social-sdk/getting-started/using-unreal-engine.mdx rename to discord/developers/docs/discord-social-sdk/getting-started/using-unreal-engine.mdx index 3128bc27ec..16328681a7 100644 --- a/docs/discord-social-sdk/getting-started/using-unreal-engine.mdx +++ b/discord/developers/docs/discord-social-sdk/getting-started/using-unreal-engine.mdx @@ -1,14 +1,12 @@ --- -sidebar_label: Using Unreal Engine +title: Getting Started with Unreal Engine and the Discord Social SDK +sidebarTitle: Using Unreal Engine +description: Integrate the Discord Social SDK into Unreal Engine games. --- -import AppCreationSteps from './partials/getting-started.mdx' -import ConsoleAccess from '../partials/callouts/console-access.mdx'; -import SupportCallout from '../partials/callouts/support.mdx'; -import DylibMacError from './partials/dylib-mac-error.mdx'; - -[Home](/docs/intro) > [Discord Social SDK](/docs/discord-social-sdk/overview) > {sidebar_label} - -# Getting Started with Unreal Engine and the Discord Social SDK +import AppCreationSteps from '/snippets/discord-social-sdk/partials/getting-started.mdx' +import ConsoleAccess from '/snippets/discord-social-sdk/callouts/console-access.mdx'; +import SupportCallout from '/snippets/discord-social-sdk/callouts/support.mdx'; +import DylibMacError from '/snippets/discord-social-sdk/partials/dylib-mac-error.mdx'; ## Overview @@ -19,9 +17,9 @@ This guide will walk you through integrating the Discord Social SDK into an Unre - Start the SDK and establish a connection - Request the number of Discord friends the player has -:::info + For the initial launch, the Unreal plugin has a name of `DiscordPartnerSDK` but this name will be changing to `DiscordSocialSDK` in a future version -::: + ### Prerequisites @@ -44,9 +42,9 @@ Let's walk through the steps in detail. 1. Click on the `Downloads` link under the Discord Social SDK section of the sidebar. 2. Select the latest version from the version dropdown and download the SDK for Unreal Engine. -:::info + A Unreal Engine sample project is available for download on this page, but we are not going to cover it in this guide. Explore it on your own after you finish this guide! -::: + --- @@ -56,9 +54,9 @@ A Unreal Engine sample project is available for download on this page, but we ar Select Third Person Unreal project (C++ language). We'll set the project name to `DiscordSocialUnreal`. -:::info + The code samples below assume the project name is `DiscordSocialUnreal`. If you use a different name, make sure to replace it in the code. -::: + Wait for the shaders to compile. This can take a while. @@ -70,9 +68,9 @@ Create a new directory named `Plugins` in the base of your project directory (`D Extract the Discord SDK archive in the Plugins directory. You should end up with a directory called `DiscordPartnerSDK` inside of Plugins `DiscordSocialUnreal/Plugins/DiscordPartnerSDK`. -:::info + Double check the name of the `DiscordPartnerSDK` folder once you've extracted it. It may change between versions and you'll need to add the correct name in the code below. -::: + Reload Unreal Editor and open the project. It should ask if you'd like to recompile the `DiscordPartnerSDK` plugin on launch. @@ -232,9 +230,9 @@ If Discord is open on your computer, you should see a prompt to authorize the co If the connection is successful, you should see a message in the Unreal Editor console that says, "Connected to Discord! Ready to go! You can now start using Discord features." -:::info + Most Discord features won't work until the status is `Ready`. The status callback lets you know when you can start using them. -::: + ### Troubleshooting @@ -254,10 +252,10 @@ Let's access the user's Discord relationships (friends list) and display the cou Add this code to the `Ready` section of `OnStatusChanged`: ```cpp - if (Status == EDiscordClientStatus::Ready) { - UE_LOG(LogTemplateCharacter, Log, TEXT("Connected to Discord! Ready to go! You can now start using Discord features.")); - UE_LOG(LogTemplateCharacter, Log, TEXT("👥 Friends Count: %d"), Discord->Client->GetRelationships().Num()); - } +if (Status == EDiscordClientStatus::Ready) { + UE_LOG(LogTemplateCharacter, Log, TEXT("Connected to Discord! Ready to go! You can now start using Discord features.")); + UE_LOG(LogTemplateCharacter, Log, TEXT("👥 Friends Count: %d"), Discord->Client->GetRelationships().Num()); +} ``` ### What This Code Does @@ -293,7 +291,7 @@ Let's show your game's activity on Discord using Rich Presence. This feature let Add this code to the `Ready` section of `OnStatusChanged`: ```cpp - if (Status == EDiscordClientStatus::Ready) { +if (Status == EDiscordClientStatus::Ready) { UE_LOG(LogTemplateCharacter, Log, TEXT("Connected to Discord! Ready to go! You can now start using Discord features.")); UE_LOG(LogTemplateCharacter, Log, TEXT("👥 Friends Count: %d"), Discord->Client->GetRelationships().Num()); @@ -303,8 +301,8 @@ Add this code to the `Ready` section of `OnStatusChanged`: Activity->SetType(EDiscordActivityTypes::Playing); Activity->SetState("In competitive match"); Activity->SetDetails("Rank: Diamond II"); - Discord->Client->UpdateRichPresence(Activity, FDiscordClientUpdateRichPresenceCallback::CreateUObject(this, &ADiscordSocialUnrealCharacter::OnRichPresenceUpdated)); - } + Discord->Client->UpdateRichPresence(Activity, FDiscordClientUpdateRichPresenceCallback::CreateUObject(this, &ADiscordSocialUnrealCharacter::OnRichPresenceUpdated)); +} ``` Then add this new method: @@ -347,7 +345,7 @@ If you don't see your presence: --- - + ```cs // Copyright Epic Games, Inc. All Rights Reserved. @@ -364,9 +362,9 @@ public class DiscordSocialUnreal : ModuleRules } } ``` - + - + ```cpp // Copyright Epic Games, Inc. All Rights Reserved. @@ -563,9 +561,9 @@ void ADiscordSocialUnrealCharacter::Look(const FInputActionValue& Value) } } ``` - + - + ```cpp // Copyright Epic Games, Inc. All Rights Reserved. @@ -659,7 +657,7 @@ public: FORCEINLINE class UCameraComponent* GetFollowCamera() const { return FollowCamera; } }; ``` - + --- @@ -689,17 +687,21 @@ Congratulations! You've successfully integrated the Discord Social SDK into your You have successfully set up the Discord Social SDK with Unreal Engine and authenticated with Discord! You can now use the SDK to add more social features in your project. - - +import {ListViewIcon} from '/snippets/icons/ListViewIcon.jsx' +import {UserStatusIcon} from '/snippets/icons/UserStatusIcon.jsx' +import {InboxIcon} from '/snippets/icons/InboxIcon.jsx' + + + }> Create a unified friends list combining Discord and game-specific friendships - + }> Customize your game's rich presence to show more advanced information and game invites - + }> Allow players to invite friends to join their game session or party. - + diff --git a/discord/developers/docs/discord-social-sdk/how-to.mdx b/discord/developers/docs/discord-social-sdk/how-to.mdx new file mode 100644 index 0000000000..ee17d28105 --- /dev/null +++ b/discord/developers/docs/discord-social-sdk/how-to.mdx @@ -0,0 +1,41 @@ +--- +title: Discord Social SDK How To Guides Glossary +sidebarTitle: Glossary +description: Definitions and explanations of key terms used in Discord Social SDK how-to guides. +--- + +These how-to guides offer common solutions for integrating Discord Social SDK features into your game. + +import {BugIcon} from '/snippets/icons/BugIcon.jsx' +import {ClydeIcon} from '/snippets/icons/ClydeIcon.jsx' +import {ShieldIcon} from '/snippets/icons/ShieldIcon.jsx' +import {StarShootingIcon} from '/snippets/icons/StarShootingIcon.jsx' +import {LettersIcon} from '/snippets/icons/LettersIcon.jsx' + + + }> + Use logging and debugging tools to troubleshoot issues. + + }> + Make requests to Discord's HTTP APIs from your game. + + }> + Integrating and managing content moderation for your game when using the Discord Social SDK. + + }> + Guidelines and best practices for announcing your Discord Social SDK integration to players. + + }> + Handling Unicode characters in Discord Display Names for your game's chat and friend lists. + + + +--- + +## Change Log + +| Date | Changes | +|---------------|-----------------------| +| July 23, 2025 | migrated several docs | +| June 17, 2025 | added How To category | diff --git a/docs/discord-social-sdk/how-to/debug-log.mdx b/discord/developers/docs/discord-social-sdk/how-to/debug-log.mdx similarity index 81% rename from docs/discord-social-sdk/how-to/debug-log.mdx rename to discord/developers/docs/discord-social-sdk/how-to/debug-log.mdx index 1adc35e1e6..73092ffd69 100644 --- a/docs/discord-social-sdk/how-to/debug-log.mdx +++ b/discord/developers/docs/discord-social-sdk/how-to/debug-log.mdx @@ -1,12 +1,9 @@ --- -sidebar_label: Debug & Log +title: Debug & Log +description: Learn how to enable and use debug logging in the Discord Social SDK. --- -import PublicClient from '../partials/callouts/public-client.mdx'; -import SupportCallout from '../partials/callouts/support.mdx'; - -[Home](/docs/intro) > [Discord Social SDK](/docs/discord-social-sdk/overview) > [How To](/docs/discord-social-sdk/how-to) > {sidebar_label} - -# {sidebar_label} +import PublicClient from '/snippets/discord-social-sdk/callouts/public-client.mdx'; +import SupportCallout from '/snippets/discord-social-sdk/callouts/support.mdx'; ## Overview @@ -16,9 +13,9 @@ This guide will help you understand how to install debugging symbols and handle Debugging symbols are hosted at https://storage.googleapis.com/discord-public-symbols. If using Visual Studio, you can add this link to the pdb locations under `Tools > Options > Debugging > Symbols`. -:::info + Note: You won't be able to browse files using that link, but that's ok. Individual files are accessible under the domain, and the URL functions properly as a symbol server, so it works in Visual Studio. -::: + ## Logging @@ -55,26 +52,26 @@ client->SetAecDump(false); - Testing AEC performance in different environments - Debugging audio processing pipeline issues -:::warn + AEC dump files can become large quickly as they contain raw waveform data. Remember to disable the diagnostic recording once you've captured the necessary data for analysis. -::: + --- ## Next Steps - - + + Learn how to get started with the Discord Social SDK. - + Understand the core concepts of the Discord Social SDK. - + Learn how to link user accounts with Discord. - + diff --git a/docs/discord-social-sdk/how-to/handle-special-characters-display-names.mdx b/discord/developers/docs/discord-social-sdk/how-to/handle-special-characters-display-names.mdx similarity index 90% rename from docs/discord-social-sdk/how-to/handle-special-characters-display-names.mdx rename to discord/developers/docs/discord-social-sdk/how-to/handle-special-characters-display-names.mdx index cb4a251c45..b73ffbe9b4 100644 --- a/docs/discord-social-sdk/how-to/handle-special-characters-display-names.mdx +++ b/discord/developers/docs/discord-social-sdk/how-to/handle-special-characters-display-names.mdx @@ -1,11 +1,9 @@ --- -sidebar_label: Handle Special Characters in Display Names +title: How To Handle Special Characters in Display Names +sidebarTitle: Handle Special Characters in Display Names +description: Properly handle and display Discord usernames with special characters and emojis. --- -[Home](/docs/intro) > [Discord Social SDK](/docs/discord-social-sdk/overview) > [How To](/docs/discord-social-sdk/how-to) > {sidebar_label} - -# How To Handle Special Characters in Display Names - The Social SDK [recommends](https://discord.com/developers/docs/discord-social-sdk/development-guides/creating-a-unified-friends-list#step-1-fetch-relationships) using an account's [Display Name](https://discord.com/developers/docs/slayer-sdk/classdiscordpp_1_1UserHandle.html#af6447fa2011bfa4fcd7e55bc56847f5c) in the Unified Friends List. However, Display Names support a large set of characters across the Unicode spec, and some of these characters may not be supported in a game's specified font. There are several options to address this: @@ -47,4 +45,4 @@ If a Display Name is not renderable at all, consider falling back to the user's | Date | Changes | |---------------|---------------------------------| -| June 17, 2025 | special characters how-to added | \ No newline at end of file +| June 17, 2025 | special characters how-to added | diff --git a/docs/discord-social-sdk/how-to/integrate-moderation.mdx b/discord/developers/docs/discord-social-sdk/how-to/integrate-moderation.mdx similarity index 86% rename from docs/discord-social-sdk/how-to/integrate-moderation.mdx rename to discord/developers/docs/discord-social-sdk/how-to/integrate-moderation.mdx index 9ac42b970b..5d375e4fab 100644 --- a/docs/discord-social-sdk/how-to/integrate-moderation.mdx +++ b/discord/developers/docs/discord-social-sdk/how-to/integrate-moderation.mdx @@ -1,12 +1,9 @@ --- -sidebar_label: Integrate Moderation +title: Integrate Moderation +description: Implement moderation features and safety controls in your application. --- -import PublicClient from '../partials/callouts/public-client.mdx'; -import SupportCallout from '../partials/callouts/support.mdx'; - -[Home](/docs/intro) > [Discord Social SDK](/docs/discord-social-sdk/overview) > [How To](/docs/discord-social-sdk/how-to) > {sidebar_label} - -# Moderation with the Discord Social SDK +import PublicClient from '/snippets/discord-social-sdk/callouts/public-client.mdx'; +import SupportCallout from '/snippets/discord-social-sdk/callouts/support.mdx'; {/* Script for converting mermaid sequence diagrams to SVG. @@ -27,9 +24,9 @@ Effective moderation is essential for creating healthy social experiences. This Before you begin, make sure you have: -- A basic understanding of how the SDK works from the [Getting Started Guide](/docs/discord-social-sdk/getting-started) +- A basic understanding of how the SDK works from the [Getting Started Guide](/developers/docs/discord-social-sdk/getting-started) - A basic understanding of your game's communication features -- Familiarity with [provisional accounts](/docs/discord-social-sdk/development-guides/using-provisional-accounts) +- Familiarity with [provisional accounts](/developers/docs/discord-social-sdk/development-guides/using-provisional-accounts) - Reviewed the [Discord Social SDK Terms](https://support-dev.discord.com/hc/en-us/articles/30225844245271-Discord-Social-SDK-Terms) ## Your Moderation Responsibilities @@ -68,8 +65,8 @@ An example moderation integration would be the following: - If it passes validation, the message is sent through the SDK - Messages can be optimistically rendered while validation occurs -{/* -``` + +```mermaid sequenceDiagram participant User participant GameClient @@ -108,9 +105,6 @@ sequenceDiagram end deactivate GameClient ``` -*/} -![Message sending sequence diagram](images/social-sdk/integrating-moderation/message-sending.svg) - ```cpp // Example: Validating a message before sending void validateAndSendMessage(const std::string& message) { @@ -142,15 +136,15 @@ void validateAndSendMessage(const std::string& message) { - When a message is received from players within Discord or a Game Client, your client sends it to your backend for validation - Once validation succeeds, render the message in the game -:::info + Depending on how long your content moderation processing takes, you may wish to optimistically render the incoming message, and remove or alter it if your moderation service deems it appropriate. However, this does pose the risk of temporarily exposing content to your game players that does not align with your moderation policies. -::: + -{/* -``` + +```mermaid sequenceDiagram participant DiscordSDK as Discord Social SDK participant GameClient as Game Client @@ -182,13 +176,10 @@ sequenceDiagram end deactivate GameClient ``` -*/} -![Message receiving sequence diagram](images/social-sdk/integrating-moderation/message-receiving.svg) - -:::info + You may wish to implement moderation caching on your backend to avoid redundant validation. This is especially true for lobby messages, which are sent to multiple recipients. -::: + As a reminder, you are responsible for any third-party moderation toolkits or services you use for your game and will ensure you comply with any applicable terms and laws, including obtaining consents from players as necessary for processing their data using such moderation services. @@ -196,22 +187,21 @@ As a reminder, you are responsible for any third-party moderation toolkits or se ### Discord Platform Bans -:::info + If a player has connected their Discord account with your game, and it is banned, their [`Client`] will be immediately disconnected, and that user will no longer be able to authenticate through Discord. -::: + The recommended path for integrating the Discord Social SDK is that your game has a primary authentication other than Discord that initially sets up a provisional account, and have the player link their Discord account to this primary authentication. This approach protects your users' game access and data if they encounter issues with their Discord account, such as a permanent or temporary ban. To implement this recommended path: -1. Create an account through a [non-Discord authentication provider](/docs/discord-social-sdk/development-guides/using-provisional-accounts#configuring-your-identity-provider), and create a provisional account attached to it. -2. When users later authenticate through Discord to link their account, have your game back end execute the [merge their provisional account with their Discord Account](/docs/discord-social-sdk/development-guides/using-provisional-accounts#merging-provisional-accounts). +1. Create an account through a [non-Discord authentication provider](/developers/docs/discord-social-sdk/development-guides/using-provisional-accounts#configuring-your-identity-provider), and create a provisional account attached to it. +2. When users later authenticate through Discord to link their account, have your game back end execute the [merge their provisional account with their Discord Account](/developers/docs/discord-social-sdk/development-guides/using-provisional-accounts#merging-provisional-accounts). 3. The account merging process will internally store the `externalAuthToken` from the provisional account against their Discord account. If a ban of the Discord account happens, that `externalAuthToken` will be attached to the new provisional account that is created in its stead, with the original Discord account's in-game friends, and will be available through the authentication provider the account was initially setup with. -4. As a last step, your game back end should maintain the record of the `externalAuthToken` against the user account, even after the account merging process, since it will be needed to [authenticate via a provisional account](/docs/discord-social-sdk/development-guides/using-provisional-accounts#implementing-provisional-accounts) should Discord authentication fails for a ban, or any other reason. +4. As a last step, your game back end should maintain the record of the `externalAuthToken` against the user account, even after the account merging process, since it will be needed to [authenticate via a provisional account](/developers/docs/discord-social-sdk/development-guides/using-provisional-accounts#implementing-provisional-accounts) should Discord authentication fails for a ban, or any other reason. -{/* -``` +```mermaid sequenceDiagram participant User participant Game @@ -249,23 +239,21 @@ sequenceDiagram Game-->>User: Access game end ``` -*/} -![Platform bans sequence diagram](images/social-sdk/integrating-moderation/platform-bans.svg) -:::warn + If you use Discord as the primary or sole authentication mechanism for your game, you risk players permanently losing access to their in-game data if their Discord account is banned, as there is no way to migrate them to a provisional account that is connected to an external authentication provider. -::: + -:::info + At this time, there is no API to look up if a player's Discord account has been banned. -::: + ### Discord Server Bans If you wish to tie your in-game moderation policies to a specific Discord server that you own, such as your official community server, you are able to retrieve ban information for your Discord Server via our REST APIs. -See the references for the REST endpoints[`{guild.id}/guilds/{guild.id}/bans`](/docs/resources/guild#get-guild-bans) -or [`/guilds/{guild.id}/bans/{user.id}`](/docs/resources/guild#get-guild-ban) +See the references for the REST endpoints[`{guild.id}/guilds/{guild.id}/bans`](/developers/docs/resources/guild#get-guild-bans) +or [`/guilds/{guild.id}/bans/{user.id}`](/developers/docs/resources/guild#get-guild-ban) for more information on retrieving all bans for your guild, or ban information for a specific user within your guild. ## Voice Chat Moderation @@ -294,20 +282,21 @@ auto call = client->StartCallWithAudioCallbacks(lobbyId, receivedCallback, captu ## Next Steps - - +import {ChatIcon} from '/snippets/icons/ChatIcon.jsx' +import {VoiceNormalIcon} from '/snippets/icons/VoiceNormalIcon.jsx' +import {TextControllerIcon} from '/snippets/icons/TextControllerIcon.jsx' + + + }> Enable private messaging between players. - + }> Add in-game voice communication. - + }> Connect game lobbies to Discord text channels. - + diff --git a/docs/discord-social-sdk/how-to/market-your-integration.mdx b/discord/developers/docs/discord-social-sdk/how-to/market-your-integration.mdx similarity index 84% rename from docs/discord-social-sdk/how-to/market-your-integration.mdx rename to discord/developers/docs/discord-social-sdk/how-to/market-your-integration.mdx index 1749998df8..984670f8e0 100644 --- a/docs/discord-social-sdk/how-to/market-your-integration.mdx +++ b/discord/developers/docs/discord-social-sdk/how-to/market-your-integration.mdx @@ -1,14 +1,11 @@ --- -sidebar_label: Market Your Integration +title: Market Your Integration +description: Best practices for marketing and promoting your Discord Social SDK integration. --- -[Home](/docs/intro) > [Discord Social SDK](/docs/discord-social-sdk/overview) > [How To](/docs/discord-social-sdk/how-to) > {sidebar_label} - -# How to Market Your Integration - ## Overview -Congrats! We’re so happy you’ve powered your game's social experiences with the Discord Social SDK, and now it’s time to +Congrats! We're so happy you've powered your game's social experiences with the Discord Social SDK, and now it's time to let your players know about it. This toolkit is meant to provide you with guidelines and best practices to help you have a strong go-to-market plan to make your players aware of the integration, answer their questions, and use Discord brand guidelines appropriately. @@ -27,9 +24,9 @@ Announcing **Discord Social SDK** features to your players has two goals: Player-facing messaging of Discord Social SDK is different from how we frame it to developers, like you. Below are some key messages you can pull into your announcement materials. -:::info + Our guidance focuses on features that encourage Discord account linking. It's the most important step for you and your players to experience the benefits of the integration. [Learn more about the impact of account linking](https://discord.com/developers/social-sdk).

If your announcements do not focus on Discord Social SDK features that require account linking, you can still generally use this guidance and our brand guidelines. -::: +
### A Note on the Product Name Technically, the full product name is "Discord Social SDK". However, we recommend announcing this integration to your players with more casual language and, in most cases, sharing the full product name with players is not needed. Please follow the below guidance that provides messaging we have found resonates well with players. @@ -48,20 +45,20 @@ Link your Discord account and play with friends more easily. ## Detailed Feature Descriptions -In case you’d like to reference specific features and their benefits to players, use this chart. +In case you'd like to reference specific features and their benefits to players, use this chart. -:::info -In most cases, players won’t need to know the actual “Feature Name”, but still referencing the description and use cases below are helpful for them! -::: + +In most cases, players won't need to know the actual “Feature Name”, but still referencing the description and use cases below are helpful for them! + | Feature Name | Short Description | Use Cases | |-----------------------------------|:---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|:-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| -| **Rich Presence** | Shows on Discord which games players are currently playing. | Knowing what your friends are doing in-game, so you know if they’d be available to play together

Joining a game directly from a friend’s profile (similar to game invites) | -| **Unified Friends List** | Players can access their Discord friends list from within the game. Includes friend tiers. | Sending game invites directly to friends from in-game

Knowing which of your friends is playing, and who isn’t playing but is online and could play

Not having to re-create your friends list social in a new game that you play | +| **Rich Presence** | Shows on Discord which games players are currently playing. | Knowing what your friends are doing in-game, so you know if they'd be available to play together

Joining a game directly from a friend's profile (similar to game invites) | +| **Unified Friends List** | Players can access their Discord friends list from within the game. Includes friend tiers. | Sending game invites directly to friends from in-game

Knowing which of your friends is playing, and who isn't playing but is online and could play

Not having to re-create your friends list social in a new game that you play | | **Deeplink Game Invites** | Users can send invites that link directly to specific game instances or parts of a game. | Challenging users to specific game instances | | **Flexible Account Requirements** | Users can choose to link their Discord account to unlock deeper integrated features such as the Unified Friends List and Rich Presence, but can also take advantage of the in-game social features without linking an account through an innovative "provisional account." | Account linking: Automatic Discord-based sign in, or, linking of your Discord account to a game account.
Take full advantage of the Discord integration

Provisional accounts: Provisional accounts let you use Discord's voice and text chat features while playing connected games \- without needing to create a Discord account first. | -| **Cross-Platform Messaging** | Allows players to communicate seamlessly both in-game and through Discord, even without a Discord account. | DMing your friends when they’re in-game and out of game

Receiving messages from your friends when you aren’t playing.

In-game text chat for guilds, matches, lobbies, etc. | -| **Linked Channels** | Players can link their in-game group chat with in-Discord channels, providing persistent group chats. | In-game guild/group chat mirrored in your guild’s/group’s Discord server

No more feeling isolated from the broader group if you’re online when everyone else isn’t, or vice-versa | +| **Cross-Platform Messaging** | Allows players to communicate seamlessly both in-game and through Discord, even without a Discord account. | DMing your friends when they're in-game and out of game

Receiving messages from your friends when you aren't playing.

In-game text chat for guilds, matches, lobbies, etc. | +| **Linked Channels** | Players can link their in-game group chat with in-Discord channels, providing persistent group chats. | In-game guild/group chat mirrored in your guild's/group's Discord server

No more feeling isolated from the broader group if you're online when everyone else isn't, or vice-versa | | **Discord Voice Chat** | High quality voice chat powered by Discord available directly in the game. | In-game voice chat for guilds, matches, lobbies, etc. | ## Integration Announcement Plan Recommendations @@ -102,9 +99,9 @@ If you would like to tag @Discord in any of your announcements, please feel free ## Discord Brand Assets & Guidance -We’re excited you’re helping us spread the word about Discord. We’d love to make sure you have the right assets to use and guidelines from our brand team. +We're excited you're helping us spread the word about Discord. We'd love to make sure you have the right assets to use and guidelines from our brand team. -When using Discord Marks and Brand Assets, you must always comply with Discord’s [Brand Guidelines found here](https://discord.com/branding). +When using Discord Marks and Brand Assets, you must always comply with Discord's [Brand Guidelines found here](https://discord.com/branding). As a reminder, you may not make any statement that suggests a partnership with, sponsorship by, or endorsement by Discord without our prior written approval in each instance. We also have some additional guidance below specific for your Discord Social SDK launch. ### Discord Logo and Wordmark @@ -112,12 +109,12 @@ As a reminder, you may not make any statement that suggests a partnership with, * [Download Link](https://discord.com/branding) * Guidance for Discord Social SDK * When using our logo or wordmark in your CTA buttons in-game, in social and blog post visual assets, please -review the Logo & Symbol sections of our brand guidelines. If you’re not sure about use or have questions, please reach out to your Discord point of contact. +review the Logo & Symbol sections of our brand guidelines. If you're not sure about use or have questions, please reach out to your Discord point of contact. * Please refer to our articles on in-game - [Connection Points](/docs/discord-social-sdk/design-guidelines/connection-points) and - [Overall Flow](/docs/discord-social-sdk/design-guidelines/signing-in#before-the-user-connects) for more guidance for in-game messaging. + [Connection Points](/developers/docs/discord-social-sdk/design-guidelines/connection-points) and + [Overall Flow](/developers/docs/discord-social-sdk/design-guidelines/signing-in#before-the-user-connects) for more guidance for in-game messaging. * Usage Guidance - * [Logo Usage Do’s and Don’ts](https://discord.com/branding) (Click "View Brand Kit" then "Logo" then "Usage"). + * [Logo Usage Do's and Don'ts](https://discord.com/branding) (Click "View Brand Kit" then "Logo" then "Usage"). ### Discord Bumper Splash Animation @@ -127,7 +124,7 @@ review the Logo & Symbol sections of our brand guidelines. If you’re not sure * [3 second bumper splash animation audio (Streaming)](https://cdn.discordapp.com/assets/content/f3070170acd3f62b08ba9a63ab71080f6f7a72be5c84b74d1b247b4767696045.wav) * Best Practice Guidance for Discord Social SDK * This can be used as an intro splash video to your game, video launch announcement of the SDK, or game trailer - content where Discord Social SDK features are shown. You should not use this splash video in your content if Discord Social SDK features aren’t present in the content. + content where Discord Social SDK features are shown. You should not use this splash video in your content if Discord Social SDK features aren't present in the content. * Usage Guidance * When using this splash animation in your video, always include this at the beginning of the video. This splash video should never go in the middle or end of your content. @@ -148,4 +145,4 @@ Please visit our [Discord Brand Guidelines](https://discord.com/branding) for ad | Date | Changes | |---------------|------------------| -| July 22, 2025 | initial creation | \ No newline at end of file +| July 22, 2025 | initial creation | diff --git a/docs/discord-social-sdk/how-to/use-with-discord-apis.mdx b/discord/developers/docs/discord-social-sdk/how-to/use-with-discord-apis.mdx similarity index 76% rename from docs/discord-social-sdk/how-to/use-with-discord-apis.mdx rename to discord/developers/docs/discord-social-sdk/how-to/use-with-discord-apis.mdx index e7a0d4e69e..2fcef6508e 100644 --- a/docs/discord-social-sdk/how-to/use-with-discord-apis.mdx +++ b/discord/developers/docs/discord-social-sdk/how-to/use-with-discord-apis.mdx @@ -1,12 +1,9 @@ --- -sidebar_label: Use with Discord APIs +title: Use with Discord APIs +description: Combine Discord Social SDK with Discord's REST APIs for enhanced functionality. --- -import PublicClient from '../partials/callouts/public-client.mdx'; -import SupportCallout from '../partials/callouts/support.mdx'; - -[Home](/docs/intro) > [Discord Social SDK](/docs/discord-social-sdk/overview) > [How To](/docs/discord-social-sdk/how-to) > {sidebar_label} - -# {sidebar_label} +import PublicClient from '/snippets/discord-social-sdk/callouts/public-client.mdx'; +import SupportCallout from '/snippets/discord-social-sdk/callouts/support.mdx'; ## Overview @@ -26,19 +23,19 @@ Before you begin, make sure you have: ### Bot Token Authentication For server-to-server communication: -``` +```bash curl -X GET https://discord.com/api/v10/users/@me \ -H "Authorization: Bot YOUR_BOT_TOKEN" ``` -:::info + Always prefix your bot token with `Bot ` in the Authorization header! -::: + ### Bearer Token Authentication For authenticated user actions: -``` +```bash curl -X GET https://discord.com/api/v10/users/@me \ -H "Authorization: Bearer USER_ACCESS_TOKEN" ``` @@ -122,17 +119,21 @@ with openapi_client.ApiClient(configuration) as api_client: Now that you've set up Rich Presence, you might want to explore: - - +import {UserStatusIcon} from '/snippets/icons/UserStatusIcon.jsx' +import {DoorEnterIcon} from '/snippets/icons/DoorEnterIcon.jsx' +import {InboxIcon} from '/snippets/icons/InboxIcon.jsx' + + + }> Allow players to invite friends to join their game session or party. - + }> Bring players together in a shared lobby with invites, text chat, and voice comms. - + }> Best practices for Rich Presence UI/UX. - + @@ -143,4 +144,4 @@ Now that you've set up Rich Presence, you might want to explore: | Date | Changes | |----------------|-----------------| -| March 17, 2025 | Initial release | +| March 17, 2025 | Initial Release | diff --git a/docs/discord-social-sdk/overview.mdx b/discord/developers/docs/discord-social-sdk/overview.mdx similarity index 57% rename from docs/discord-social-sdk/overview.mdx rename to discord/developers/docs/discord-social-sdk/overview.mdx index bf148279b2..25fd562f84 100644 --- a/docs/discord-social-sdk/overview.mdx +++ b/discord/developers/docs/discord-social-sdk/overview.mdx @@ -1,11 +1,10 @@ --- -sidebar_label: Overview +title: Discord Social SDK +sidebarTitle: Overview +description: Learn about the Discord Social SDK for integrating Discord's social features. --- -[Home](/docs/intro) > [Discord Social SDK](/docs/discord-social-sdk/overview) > Overview -# Discord Social SDK - -![Discord Social SDK](images/social-sdk/overview/social_sdk_header.webp) +![Discord Social SDK](/images/social-sdk/overview/social_sdk_header.png) The Discord Social SDK allows you to integrate social features directly into your game. Build engaging, social experiences where players can connect, communicate, and play together, all while staying immersed in your game. @@ -13,14 +12,17 @@ Start integrating the SDK into your game with our getting started guides, design ## Integrate Social Features in Your Game - - +import {GameControllerIcon} from '/snippets/icons/GameControllerIcon.jsx' +import {CompassIcon} from '/snippets/icons/CompassIcon.jsx' + + + }> Learn how the SDK works and explore its key features. - + }> Follow our step-by-step guides to add the SDK to your game engine. - + ## Dive Deeper into the Discord Social SDK @@ -32,17 +34,21 @@ Start integrating the SDK into your game with our getting started guides, design referrerpolicy="strict-origin-when-cross-origin" allowfullscreen> - - +import {WrenchIcon} from '/snippets/icons/WrenchIcon.jsx' +import {PaintPaletteIcon} from '/snippets/icons/PaintPaletteIcon.jsx' +import {BrowserIcon} from '/snippets/icons/BrowserIcon.jsx' + + + }> Dive into feature guides for **account linking, friends lists, game invites, and voice chat**. - + }> Learn how to design your game's UI to integrate social features. - + }> Explore the SDK's API reference documentation. - + @@ -52,9 +58,9 @@ Start integrating the SDK into your game with our getting started guides, design Discord Social SDK features for text and voice communication are available but capped with rate limits. For more information about current rate limits for communication features, -please see [Communication Features: Rate Limits](/docs/discord-social-sdk/core-concepts/communication-features#rate-limits). +please see [Communication Features: Rate Limits](/developers/docs/discord-social-sdk/core-concepts/communication-features#rate-limits). -For more information on how to access these features, please see [Core Concepts: Communication Features](/docs/discord-social-sdk/core-concepts/communication-features). +For more information on how to access these features, please see [Core Concepts: Communication Features](/developers/docs/discord-social-sdk/core-concepts/communication-features). --- diff --git a/docs/discord-social-sdk/partials/callouts/console-access.mdx b/discord/developers/docs/discord-social-sdk/partials/callouts/console-access.mdx similarity index 94% rename from docs/discord-social-sdk/partials/callouts/console-access.mdx rename to discord/developers/docs/discord-social-sdk/partials/callouts/console-access.mdx index 7ab12301b2..8f746f80df 100644 --- a/docs/discord-social-sdk/partials/callouts/console-access.mdx +++ b/discord/developers/docs/discord-social-sdk/partials/callouts/console-access.mdx @@ -1,3 +1,3 @@ -:::info + To use the Discord Social SDK in your console games, you will need to request middleware approval and be an approved developer for the target console. Check out [this article](https://support-dev.discord.com/hc/en-us/articles/30209074764183) to learn more. -::: + diff --git a/docs/discord-social-sdk/partials/callouts/oauth-comms-scopes.mdx b/discord/developers/docs/discord-social-sdk/partials/callouts/oauth-comms-scopes.mdx similarity index 68% rename from docs/discord-social-sdk/partials/callouts/oauth-comms-scopes.mdx rename to discord/developers/docs/discord-social-sdk/partials/callouts/oauth-comms-scopes.mdx index e8d003ea33..1e20bb44ca 100644 --- a/docs/discord-social-sdk/partials/callouts/oauth-comms-scopes.mdx +++ b/discord/developers/docs/discord-social-sdk/partials/callouts/oauth-comms-scopes.mdx @@ -1,7 +1,7 @@ -:::warn + To utilize this communication feature, you must enable [`Client::GetDefaultCommunicationScopes`] in your OAuth Scope configuration. -See the [OAuth Scopes Core Concepts Guide](/docs/discord-social-sdk/core-concepts/oauth2-scopes) for more details. -::: +See the [OAuth Scopes Core Concepts Guide](/developers/docs/discord-social-sdk/core-concepts/oauth2-scopes) for more details. + {/* Autogenerated Reference Links */} [`Client::GetDefaultCommunicationScopes`]: https://discord.com/developers/docs/social-sdk/classdiscordpp_1_1Client.html#a71499da752fbdc2d4326ae0fd36c0dd1 \ No newline at end of file diff --git a/docs/discord-social-sdk/partials/callouts/public-client.mdx b/discord/developers/docs/discord-social-sdk/partials/callouts/public-client.mdx similarity index 55% rename from docs/discord-social-sdk/partials/callouts/public-client.mdx rename to discord/developers/docs/discord-social-sdk/partials/callouts/public-client.mdx index 60b5c2c979..96fe5d6caf 100644 --- a/docs/discord-social-sdk/partials/callouts/public-client.mdx +++ b/discord/developers/docs/discord-social-sdk/partials/callouts/public-client.mdx @@ -1,3 +1,3 @@ -:::warn -This method requires enabling **Public Client** for your app. Most games will not want to ship with this enabled. [Learn more](/docs/discord-social-sdk/core-concepts/oauth2-scopes#oauth2-client-types) -::: \ No newline at end of file + +This method requires enabling **Public Client** for your app. Most games will not want to ship with this enabled. [Learn more](/developers/docs/discord-social-sdk/core-concepts/oauth2-scopes#oauth2-client-types) + \ No newline at end of file diff --git a/discord/developers/docs/discord-social-sdk/partials/callouts/rate-limit.mdx b/discord/developers/docs/discord-social-sdk/partials/callouts/rate-limit.mdx new file mode 100644 index 0000000000..d62d7bb73a --- /dev/null +++ b/discord/developers/docs/discord-social-sdk/partials/callouts/rate-limit.mdx @@ -0,0 +1,5 @@ + +This feature is currently available with rate limits. +To remove the rate limits for your game, please follow +[Communication Features: Applying for Rate Limit Removal](/developers/docs/discord-social-sdk/core-concepts/communication-features#applying-for-rate-limit-removal). + \ No newline at end of file diff --git a/docs/discord-social-sdk/partials/callouts/sony.mdx b/discord/developers/docs/discord-social-sdk/partials/callouts/sony.mdx similarity index 95% rename from docs/discord-social-sdk/partials/callouts/sony.mdx rename to discord/developers/docs/discord-social-sdk/partials/callouts/sony.mdx index a55b177bc8..7ed72c4255 100644 --- a/docs/discord-social-sdk/partials/callouts/sony.mdx +++ b/discord/developers/docs/discord-social-sdk/partials/callouts/sony.mdx @@ -1,8 +1,8 @@ -:::warn + Exception: Prohibited Off-Platform Interactions by Sony
For integrations experienced on Sony Platforms (e.g. PlayStation 5)…

1. **Do not allow access to Account Linking** entry points.
2. **Do not allow access to Linked Channels**.
3. **Limit messaging and Invites to other players currently playing** the game.
4. **Do not display off-platform presence and logos** (including Discord). -::: \ No newline at end of file +
\ No newline at end of file diff --git a/docs/discord-social-sdk/partials/callouts/support.mdx b/discord/developers/docs/discord-social-sdk/partials/callouts/support.mdx similarity index 100% rename from docs/discord-social-sdk/partials/callouts/support.mdx rename to discord/developers/docs/discord-social-sdk/partials/callouts/support.mdx diff --git a/discord/developers/docs/discord-social-sdk/social-sdk-reference.mdx b/discord/developers/docs/discord-social-sdk/social-sdk-reference.mdx new file mode 100644 index 0000000000..97c3ec7974 --- /dev/null +++ b/discord/developers/docs/discord-social-sdk/social-sdk-reference.mdx @@ -0,0 +1,6 @@ +--- +title: Social SDK Reference +icon: "arrow-up-right-from-square" +url: https://discord.com/developers/docs/social-sdk/index.html +description: Complete API reference for the Discord Social SDK. +--- diff --git a/docs/discovery/best-practices.md b/discord/developers/docs/discovery/best-practices.mdx similarity index 91% rename from docs/discovery/best-practices.md rename to discord/developers/docs/discovery/best-practices.mdx index 5e14be8edb..acaeac14c6 100644 --- a/docs/discovery/best-practices.md +++ b/discord/developers/docs/discovery/best-practices.mdx @@ -1,14 +1,14 @@ --- -sidebar_label: Best Practices +title: Discovery Best Practices +sidebarTitle: Best Practices +description: Tips and best practices for optimizing your app's discovery. --- -# Discovery Best Practices - So you’ve made an app on Discord and are ready to opt in to discovery on the App Directory! Or maybe you have already listed your app but aren’t seeing as much traction to it as you’d like? Whatever stage you’re at, this guide has some tips and tricks from your friendly Discord Staff members to help boost performance of your App Directory Product Page. -:::info -This guide references settings and information you can set up and modify within your [app's settings](https://discord.com/developers/applications). If you don't have an app yet, you can follow the [Getting Started guide](/docs/quick-start/getting-started). -::: + +This guide references settings and information you can set up and modify within your [app's settings](https://discord.com/developers/applications). If you don't have an app yet, you can follow the [Getting Started guide](/developers/docs/quick-start/getting-started). + ## The Elevator Pitch @@ -16,9 +16,9 @@ This guide references settings and information you can set up and modify within App descriptions should convey the value of your app and what it does. Make your app descriptions punchy and to the point - letting folks know what your app does in simple terms while also exciting the potential user to add the app and start using it. -:::info + Be sure to spell check and review your grammar before posting your descriptions. Your app has the potential to be seen by millions of people! -::: + There are a few places where you can define different descriptions of your app within your [app's settings](https://discord.com/developers/applications). @@ -26,7 +26,7 @@ There are a few places where you can define different descriptions of your app w On the **General Information** tab, there is a general **Description** field (max of 400 characters) that appears within your bot user's profile. When a new user clicks on your app within Discord, they'll see this description. -![App description on the General Information tab](images/bp-productpage-app-description.webp) +![App description on the General Information tab](/images/discovery/app-description.png) #### App Summary @@ -34,11 +34,11 @@ On the **App Directory** tab, the **Summary** field is a short description (max When writing your app's Summary, think about how to grab the user's attention and quickly convey the value of your app. Consider the following description: -![Poorly-written app Summary on the App Directory tab](images/bp-productpage-summary-bad.webp) +![Poorly-written app Summary on the App Directory tab](/images/discovery/summary-bad.png) While this could be true, it doesn’t really tell folks how the app makes servers better or more fun. The best descriptions start with an attention grabbing sentence that describes a problem a user might want to solve: -![Well-written app Summary on the App Directory tab](images/bp-productpage-summary-good.webp) +![Well-written app Summary on the App Directory tab](/images/discovery/summary-good.png) #### App Expanded Description @@ -70,7 +70,7 @@ After adding some images, make a quick screen recording to demonstrate your app Think of up to five words that describe your app and add them as tags (see image below for an example). Consider what categories your app would fit under or keywords users would type into the search bar when looking for apps to add to their servers. -![App tags which help categorize apps and make them more searchable](images/bp-productpage-tags.webp) +![App tags which help categorize apps and make them more searchable](/images/discovery/tags.png) ## Support Your Users @@ -78,9 +78,9 @@ Think of up to five words that describe your app and add them as tags (see image Your app’s support server is a paramount part of your App Product Page. It’s important to ensure your app has a dedicated server and channel for communication between your app’s users and its developers and maintainers. -:::info + If your support server isn't [discoverable](https://support.discord.com/hc/en-us/articles/360030843331-Enabling-Server-Discovery), be sure to include an invite link in the "links" section of your App Directory Product Page. -::: + Some ways you can successfully use your support server includes: diff --git a/docs/discovery/enabling-discovery.mdx b/discord/developers/docs/discovery/enabling-discovery.mdx similarity index 80% rename from docs/discovery/enabling-discovery.mdx rename to discord/developers/docs/discovery/enabling-discovery.mdx index 9681525a67..7cba0ecdfa 100644 --- a/docs/discovery/enabling-discovery.mdx +++ b/discord/developers/docs/discovery/enabling-discovery.mdx @@ -1,15 +1,19 @@ +--- +title: Enabling Discovery +description: Step-by-step guide to verify your app and enable discovery. +--- -# Enabling Discovery +import {BookCheckIcon} from '/snippets/icons/BookCheckIcon.jsx' Are you ready for your app to be discovered by new users and server admins? -Enabling **Discovery** for your app will make it available in the [App Directory](/docs/discovery/overview#app-directory) and [App Launcher](/docs/discovery/overview#app-launcher) for users to search for and install. +Enabling **Discovery** for your app will make it available in the [App Directory](/developers/docs/discovery/overview#app-directory) and [App Launcher](/developers/docs/discovery/overview#app-launcher) for users to search for and install. ## Step 1: Verify Your App To enable **Discovery** for your app, we require your team owner to complete identity and application verification. -**App Verification** also allows you to add [monetization features](/docs/monetization/overview) to your app, such as in-app purchases and subscriptions. +**App Verification** also allows you to add [monetization features](/developers/docs/monetization/overview) to your app, such as in-app purchases and subscriptions. To see the list of requirements for **App Verification**: @@ -34,9 +38,9 @@ To opt into **Discovery**: For more information on **Discovery**, check out our [Help Center article](https://support-dev.discord.com/hc/en-us/articles/21204493235991-How-Can-Users-Discover-and-Play-My-Activity). -:::info + Once you enable **Discovery**, it may take up to 24 hours for your app to appear in the App Directory and App Launcher. -::: + ### Search for your App in Discord To check if your app is discoverable, search for it in the App Directory or App Launcher. @@ -50,8 +54,8 @@ To check if your app is discoverable, search for it in the App Directory or App ## Next Steps Now that you've enabled **Discovery** for your app, you can start customizing your app's appearance in the App Directory and App Launcher. - - + + } iconType="solid"> Check out our guide on how to make your app stand out. - \ No newline at end of file + \ No newline at end of file diff --git a/docs/discovery/overview.mdx b/discord/developers/docs/discovery/overview.mdx similarity index 69% rename from docs/discovery/overview.mdx rename to discord/developers/docs/discovery/overview.mdx index bb4206513e..6f1f92e611 100644 --- a/docs/discovery/overview.mdx +++ b/discord/developers/docs/discovery/overview.mdx @@ -1,14 +1,14 @@ --- -sidebar_label: Overview +title: Discovery on Discord +sidebarTitle: Overview +description: Learn how to make your Discord app discoverable through the App Directory. --- -# Discovery on Discord - Learn how to make your app discoverable on Discord through various surfaces and best practices to drive more users to discover it. ## Discovery Surfaces -Once you've [enabled discovery for your app](/docs/discovery/enabling-discovery), users can find your app in Discord through the App Directory and the App Launcher. +Once you've [enabled discovery for your app](/developers/docs/discovery/enabling-discovery), users can find your app in Discord through the App Directory and the App Launcher. ### App Directory @@ -17,7 +17,7 @@ The App Directory is a central hub where users can discover new apps. They can s - **Search**: Users can search for your app by name and install it. - **App Directory Product Page**: Share information about your app, including descriptions, images, videos, and links. -![Your Discord App Profile](images/discovery-app-directory-product-page.webp) +![Your Discord App Profile](/images/discovery/directory-product-page.png) ### App Launcher @@ -26,7 +26,7 @@ The App Launcher lets users discover new apps through collections and search fro - **Search**: Your app will be available to search and install. - **Collections**: Includes Recent Apps, Installed Apps, Currated Apps, Partner Apps, and Promoted Apps. -![App Launcher in Discord](images/discovery-app-launcher.webp) +![App Launcher in Discord](/images/discovery/app-launcher.png) #### App Launcher Collections can include: - **Recent Apps**: Apps you've recently used or installed will appear at the top of the App Launcher @@ -51,12 +51,12 @@ Once your app is discoverable, there are several ways users may find it through Create shareable links to your app's profile page, store page, or specific items. Share these links in Discord, emails, or on your website. -![A shared embed link in Discord for the Sandscape app](images/discovery-sharing-links.webp) +![A shared embed link in Discord for the Sandscape app](/images/discovery/sharing-links.png) ### Rich Presence -Use [Rich Presence](/docs/rich-presence/overview) to show what users are doing in your app, driving more users to discover it. +Use [Rich Presence](/developers/docs/rich-presence/overview) to show what users are doing in your app, driving more users to discover it. -![Examples of Rich Presence data on Discord user profiles](images/rich-presence-examples.png) +![Examples of Rich Presence data on Discord user profiles](/images/rich-presence/examples.png) --- @@ -64,11 +64,14 @@ Use [Rich Presence](/docs/rich-presence/overview) to show what users are doing i Ready to enable discovery for your app? - - +import {GlobeEarthIcon} from '/snippets/icons/GlobeEarthIcon.jsx' +import {BookCheckIcon} from '/snippets/icons/BookCheckIcon.jsx' + + + }> Enable discovery for your app to make it available in the App Directory and App Launcher. - + }> Learn how to make your app stand out and drive more users to discover it. - \ No newline at end of file + \ No newline at end of file diff --git a/discord/developers/docs/events/gateway-events.mdx b/discord/developers/docs/events/gateway-events.mdx new file mode 100644 index 0000000000..3b95890b6f --- /dev/null +++ b/discord/developers/docs/events/gateway-events.mdx @@ -0,0 +1,1585 @@ +--- +title: Gateway Events +description: Complete reference for all Gateway events. +--- + +import {ManualAnchor} from '/snippets/manualanchor.jsx' + +Gateway connections are WebSockets, meaning they're bidirectional and either side of the WebSocket can send events to the other. The following events are split up into two types: + +- **Send events** are Gateway events sent by an app to Discord (like when identifying with the Gateway) +- **Receive events** are Gateway events that are sent by Discord to an app. These events typically represent something happening inside of a server where an app is installed, like a channel being updated. + +All Gateway events are encapsulated in a [Gateway event payload](/developers/docs/events/gateway-events#payload-structure). + +For more information about interacting with the Gateway, you can reference the [Gateway documentation](/developers/docs/events/gateway). + + +Not all Gateway event fields are documented. You should assume that undocumented fields are not supported for apps, and their format and data may change at any time. + + +### Event Names + +In practice, event names are UPPER-CASED with under_scores joining each word in the name. For instance, [Channel Create](/developers/docs/events/gateway-events#channel-create) would be `CHANNEL_CREATE` and [Voice State Update](/developers/docs/events/gateway-events#voice-state-update) would be `VOICE_STATE_UPDATE`. + +For readability, event names in the following documentation are typically left in Title Case. + +### Payload Structure + +Gateway event payloads have a common structure, but the contents of the associated data (`d`) varies between the different events. + +| Field | Type | Description | +|-------|-------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| op | integer | [Gateway opcode](/developers/docs/topics/opcodes-and-status-codes#gateway-gateway-opcodes), which indicates the payload type | +| d | ?mixed (any JSON value) | Event data | +| s | ?integer \* | Sequence number of event used for [resuming sessions](/developers/docs/events/gateway#resuming) and [heartbeating](/developers/docs/events/gateway#sending-heartbeats) | +| t | ?string \* | Event name | + +\* `s` and `t` are `null` when `op` is not `0` ([Gateway Dispatch opcode](/developers/docs/topics/opcodes-and-status-codes#gateway-gateway-opcodes)). + + +###### Example Gateway Event Payload + +```json +{ + "op": 0, + "d": {}, + "s": 42, + "t": "GATEWAY_EVENT_NAME" +} +``` + +## Send Events + +Send events are Gateway events encapsulated in an [event payload](/developers/docs/events/gateway-events#payload-structure), and are sent by an app to Discord through a Gateway connection. + + +Previously, Gateway send events were labeled as commands + + +| Name | Description | +|-----------------------------------------------------------------------------------------------|-----------------------------------------------------------| +| [Identify](/developers/docs/events/gateway-events#identify) | Triggers the initial handshake with the gateway | +| [Resume](/developers/docs/events/gateway-events#resume) | Resumes a dropped gateway connection | +| [Heartbeat](/developers/docs/events/gateway-events#heartbeat) | Maintains an active gateway connection | +| [Request Guild Members](/developers/docs/events/gateway-events#request-guild-members) | Requests members for a guild | +| [Request Soundboard Sounds](/developers/docs/events/gateway-events#request-soundboard-sounds) | Requests soundboard sounds in a set of guilds | +| [Update Voice State](/developers/docs/events/gateway-events#update-voice-state) | Joins, moves, or disconnects the app from a voice channel | +| [Update Presence](/developers/docs/events/gateway-events#update-presence) | Updates an app's presence | + +#### Identify + +Used to trigger the initial handshake with the gateway. + +Details about identifying is in the [Gateway documentation](/developers/docs/events/gateway#identifying). + + +###### Identify Structure + +| Field | Type | Description | Default | +|------------------|----------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------|---------| +| token | string | Authentication token | - | +| properties | object | [Connection properties](/developers/docs/events/gateway-events#identify-identify-connection-properties) | - | +| compress? | boolean | Whether this connection supports compression of packets | false | +| large_threshold? | integer | Value between 50 and 250, total number of members where the gateway will stop sending offline members in the guild member list | 50 | +| shard? | array of two integers (shard_id, num_shards) | Used for [Guild Sharding](/developers/docs/events/gateway#sharding) | - | +| presence? | [update presence](/developers/docs/events/gateway-events#update-presence) object | Presence structure for initial presence information | - | +| intents | integer | [Gateway Intents](/developers/docs/events/gateway#gateway-intents) you wish to receive | - | + + +###### Identify Connection Properties + +| Field | Type | Description | +|---------|--------|-----------------------| +| os | string | Your operating system | +| browser | string | Your library name | +| device | string | Your library name | + + +These fields originally were $ prefixed (i.e: `$browser`) but [this syntax is deprecated](/developers/docs/change-log#updated-connection-property-field-names). While they currently still work, it is recommended to move to non-prefixed fields. + + + +###### Example Identify + +```json +{ + "op": 2, + "d": { + "token": "my_token", + "properties": { + "os": "linux", + "browser": "disco", + "device": "disco" + }, + "compress": true, + "large_threshold": 250, + "shard": [0, 1], + "presence": { + "activities": [{ + "name": "Cards Against Humanity", + "type": 0 + }], + "status": "dnd", + "since": 91879201, + "afk": false + }, + // This intent represents 1 << 0 for GUILDS, 1 << 1 for GUILD_MEMBERS, and 1 << 2 for GUILD_BANS + // This connection will only receive the events defined in those three intents + "intents": 7 + } +} +``` + +#### Resume + +Used to replay missed events when a disconnected client resumes. + +Details about resuming are in the [Gateway documentation](/developers/docs/events/gateway#resuming). + + +###### Resume Structure + +| Field | Type | Description | +|------------|---------|-------------------------------| +| token | string | Session token | +| session_id | string | Session ID | +| seq | integer | Last sequence number received | + + +###### Example Resume + +```json +{ + "op": 6, + "d": { + "token": "randomstring", + "session_id": "evenmorerandomstring", + "seq": 1337 + } +} +``` + +#### Heartbeat + +Used to maintain an active gateway connection. Must be sent every `heartbeat_interval` milliseconds after the [Opcode 10 Hello](/developers/docs/events/gateway-events#hello) payload is received. The inner `d` key is the last sequence number—`s`—received by the client. If you have not yet received one, send `null`. + +Details about heartbeats are in the [Gateway documentation](/developers/docs/events/gateway#sending-heartbeats). + + +###### Example Heartbeat + +```json +{ + "op": 1, + "d": 251 +} +``` + +#### Request Guild Members + +Used to request all members for a guild or a list of guilds. When initially connecting, if you don't have the `GUILD_PRESENCES` [Gateway Intent](/developers/docs/events/gateway#gateway-intents), or if the guild is over 75k members, it will only send members who are in voice, plus the member for you (the connecting user). Otherwise, if a guild has over `large_threshold` members (value in the [Gateway Identify](/developers/docs/events/gateway-events#identify)), it will only send members who are online, have a role, have a nickname, or are in a voice channel, and if it has under `large_threshold` members, it will send all members. If a client wishes to receive additional members, they need to explicitly request them via this operation. The server will send [Guild Members Chunk](/developers/docs/events/gateway-events#guild-members-chunk) events in response with up to 1000 members per chunk until all members that match the request have been sent. + +Due to our privacy and infrastructural concerns with this feature, there are some limitations that apply: + +- `GUILD_PRESENCES` intent is required to set `presences = true`. Otherwise, it will always be false +- `GUILD_MEMBERS` intent is required to request the entire member list—`(query=‘’, limit=0<=n)` +- You will be limited to requesting 1 `guild_id` per request +- Requesting a prefix (`query` parameter) will return a maximum of 100 members +- Requesting `user_ids` will continue to be limited to returning 100 members + + +We are introducing a new rate limit to the Request Guild Members opcode. See [Introducing Rate Limit When Requesting All Guild Members](/developers/docs/change-log#introducing-rate-limit-when-requesting-all-guild-members) for more information and timeline on this new rate limit. + + + +###### Request Guild Members Structure + +| Field | Type | Description | Required | +|------------|----------------------------------|---------------------------------------------------------------------------------------------------------------------------------------|----------------------------| +| guild_id | snowflake | ID of the guild to get members for | true | +| query? | string | string that username starts with, or an empty string to return all members | one of query or user_ids | +| limit | integer | maximum number of members to send matching the `query`; a limit of `0` can be used with an empty string `query` to return all members | true when specifying query | +| presences? | boolean | used to specify if we want the presences of the matched members | false | +| user_ids? | snowflake or array of snowflakes | used to specify which users you wish to fetch | one of query or user_ids | +| nonce? | string | nonce to identify the [Guild Members Chunk](/developers/docs/events/gateway-events#guild-members-chunk) response | false | + + +Nonce can only be up to 32 bytes. If you send an invalid nonce it will be ignored and the reply member_chunk(s) will not have a nonce set. + + + +###### Example Request Guild Members + +```json +{ + "op": 8, + "d": { + "guild_id": "41771983444115456", + "query": "", + "limit": 0 + } +} +``` + +#### Request Soundboard Sounds + +Used to request soundboard sounds for a list of guilds. The server will send [Soundboard Sounds](/developers/docs/events/gateway-events#soundboard-sounds) events for each guild in response. + + +###### Request Soundboard Sounds Structure + +| Field | Type | Description | +|-----------|---------------------|------------------------------------------------| +| guild_ids | array of snowflakes | IDs of the guilds to get soundboard sounds for | + + +###### Example Request Soundboard Sounds + +```json +{ + "op": 31, + "d": { + "guild_ids": ["613425648685547541", "81384788765712384"] + } +} +``` + +#### Update Voice State + +Sent when a client wants to join, move, or disconnect from a voice channel. + + +###### Gateway Voice State Update Structure + +| Field | Type | Description | +|------------|------------|----------------------------------------------------------------------| +| guild_id | snowflake | ID of the guild | +| channel_id | ?snowflake | ID of the voice channel client wants to join (null if disconnecting) | +| self_mute | boolean | Whether the client is muted | +| self_deaf | boolean | Whether the client deafened | + + +###### Example Gateway Voice State Update + +```json +{ + "op": 4, + "d": { + "guild_id": "41771983423143937", + "channel_id": "127121515262115840", + "self_mute": false, + "self_deaf": false + } +} +``` + +#### Update Presence + +Sent by the client to indicate a presence or status update. + + +###### Gateway Presence Update Structure + +| Field | Type | Description | +|------------|-------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------| +| since | ?integer | Unix time (in milliseconds) of when the client went idle, or null if the client is not idle | +| activities | array of [activity](/developers/docs/events/gateway-events#activity-object) objects | User's activities | +| status | string | User's new [status](/developers/docs/events/gateway-events#update-presence-status-types) | +| afk | boolean | Whether or not the client is afk | + + +###### Status Types + +| Status | Description | +|-----------|--------------------------------| +| online | Online | +| dnd | Do Not Disturb | +| idle | AFK | +| invisible | Invisible and shown as offline | +| offline | Offline | + + +###### Example Gateway Presence Update + +```json +{ + "op": 3, + "d": { + "since": 91879201, + "activities": [{ + "name": "Save the Oxford Comma", + "type": 0 + }], + "status": "online", + "afk": false + } +} +``` + +## Receive Events + +Receive events are Gateway events encapsulated in an [event payload](/developers/docs/events/gateway-events#payload-structure), and are sent by Discord to an app through a Gateway connection. Receive events correspond to events that happen in a Discord server where the app is installed. + +| Name | Description | +|-------------------------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| [Hello](/developers/docs/events/gateway-events#hello) | Defines the heartbeat interval | +| [Ready](/developers/docs/events/gateway-events#ready) | Contains the initial state information | +| [Resumed](/developers/docs/events/gateway-events#resumed) | Response to [Resume](/developers/docs/events/gateway-events#resume) | +| [Reconnect](/developers/docs/events/gateway-events#reconnect) | Server is going away, client should reconnect to gateway and resume | +| [Rate Limited](/developers/docs/events/gateway-events#rate-limited) | Application was rate limited for a gateway opcode | +| [Invalid Session](/developers/docs/events/gateway-events#invalid-session) | Failure response to [Identify](/developers/docs/events/gateway-events#identify) or [Resume](/developers/docs/events/gateway-events#resume) or invalid active session | +| [Application Command Permissions Update](/developers/docs/events/gateway-events#application-command-permissions-update) | Application command permission was updated | +| [Auto Moderation Rule Create](/developers/docs/events/gateway-events#auto-moderation-rule-create) | Auto Moderation rule was created | +| [Auto Moderation Rule Update](/developers/docs/events/gateway-events#auto-moderation-rule-update) | Auto Moderation rule was updated | +| [Auto Moderation Rule Delete](/developers/docs/events/gateway-events#auto-moderation-rule-delete) | Auto Moderation rule was deleted | +| [Auto Moderation Action Execution](/developers/docs/events/gateway-events#auto-moderation-action-execution) | Auto Moderation rule was triggered and an action was executed (e.g. a message was blocked) | +| [Channel Create](/developers/docs/events/gateway-events#channel-create) | New guild channel created | +| [Channel Update](/developers/docs/events/gateway-events#channel-update) | Channel was updated | +| [Channel Delete](/developers/docs/events/gateway-events#channel-delete) | Channel was deleted | +| [Channel Pins Update](/developers/docs/events/gateway-events#channel-pins-update) | Message was pinned or unpinned | +| [Thread Create](/developers/docs/events/gateway-events#thread-create) | Thread created, also sent when being added to a private thread | +| [Thread Update](/developers/docs/events/gateway-events#thread-update) | Thread was updated | +| [Thread Delete](/developers/docs/events/gateway-events#thread-delete) | Thread was deleted | +| [Thread List Sync](/developers/docs/events/gateway-events#thread-list-sync) | Sent when gaining access to a channel, contains all active threads in that channel | +| [Thread Member Update](/developers/docs/events/gateway-events#thread-member-update) | [Thread member](/developers/docs/resources/channel#thread-member-object) for the current user was updated | +| [Thread Members Update](/developers/docs/events/gateway-events#thread-members-update) | Some user(s) were added to or removed from a thread | +| [Entitlement Create](/developers/docs/events/gateway-events#entitlement-create) | Entitlement was created | +| [Entitlement Update](/developers/docs/events/gateway-events#entitlement-update) | Entitlement was updated or renewed | +| [Entitlement Delete](/developers/docs/events/gateway-events#entitlement-delete) | Entitlement was deleted | +| [Guild Create](/developers/docs/events/gateway-events#guild-create) | Lazy-load for unavailable guild, guild became available, or user joined a new guild | +| [Guild Update](/developers/docs/events/gateway-events#guild-update) | Guild was updated | +| [Guild Delete](/developers/docs/events/gateway-events#guild-delete) | Guild became unavailable, or user left/was removed from a guild | +| [Guild Audit Log Entry Create](/developers/docs/events/gateway-events#guild-audit-log-entry-create) | A guild audit log entry was created | +| [Guild Ban Add](/developers/docs/events/gateway-events#guild-ban-add) | User was banned from a guild | +| [Guild Ban Remove](/developers/docs/events/gateway-events#guild-ban-remove) | User was unbanned from a guild | +| [Guild Emojis Update](/developers/docs/events/gateway-events#guild-emojis-update) | Guild emojis were updated | +| [Guild Stickers Update](/developers/docs/events/gateway-events#guild-stickers-update) | Guild stickers were updated | +| [Guild Integrations Update](/developers/docs/events/gateway-events#guild-integrations-update) | Guild integration was updated | +| [Guild Member Add](/developers/docs/events/gateway-events#guild-member-add) | New user joined a guild | +| [Guild Member Remove](/developers/docs/events/gateway-events#guild-member-remove) | User was removed from a guild | +| [Guild Member Update](/developers/docs/events/gateway-events#guild-member-update) | Guild member was updated | +| [Guild Members Chunk](/developers/docs/events/gateway-events#guild-members-chunk) | Response to [Request Guild Members](/developers/docs/events/gateway-events#request-guild-members) | +| [Guild Role Create](/developers/docs/events/gateway-events#guild-role-create) | Guild role was created | +| [Guild Role Update](/developers/docs/events/gateway-events#guild-role-update) | Guild role was updated | +| [Guild Role Delete](/developers/docs/events/gateway-events#guild-role-delete) | Guild role was deleted | +| [Guild Scheduled Event Create](/developers/docs/events/gateway-events#guild-scheduled-event-create) | Guild scheduled event was created | +| [Guild Scheduled Event Update](/developers/docs/events/gateway-events#guild-scheduled-event-update) | Guild scheduled event was updated | +| [Guild Scheduled Event Delete](/developers/docs/events/gateway-events#guild-scheduled-event-delete) | Guild scheduled event was deleted | +| [Guild Scheduled Event User Add](/developers/docs/events/gateway-events#guild-scheduled-event-user-add) | User subscribed to a guild scheduled event | +| [Guild Scheduled Event User Remove](/developers/docs/events/gateway-events#guild-scheduled-event-user-remove) | User unsubscribed from a guild scheduled event | +| [Guild Soundboard Sound Create](/developers/docs/events/gateway-events#guild-soundboard-sound-create) | Guild soundboard sound was created | +| [Guild Soundboard Sound Update](/developers/docs/events/gateway-events#guild-soundboard-sound-update) | Guild soundboard sound was updated | +| [Guild Soundboard Sound Delete](/developers/docs/events/gateway-events#guild-soundboard-sound-delete) | Guild soundboard sound was deleted | +| [Guild Soundboard Sounds Update](/developers/docs/events/gateway-events#guild-soundboard-sounds-update) | Guild soundboard sounds were updated | +| [Soundboard Sounds](/developers/docs/events/gateway-events#soundboard-sounds) | Response to [Request Soundboard Sounds](/developers/docs/events/gateway-events#request-soundboard-sounds) | +| [Integration Create](/developers/docs/events/gateway-events#integration-create) | Guild integration was created | +| [Integration Update](/developers/docs/events/gateway-events#integration-update) | Guild integration was updated | +| [Integration Delete](/developers/docs/events/gateway-events#integration-delete) | Guild integration was deleted | +| [Interaction Create](/developers/docs/events/gateway-events#interaction-create) | User used an interaction, such as an [Application Command](/developers/docs/interactions/application-commands) | +| [Invite Create](/developers/docs/events/gateway-events#invite-create) | Invite to a channel was created | +| [Invite Delete](/developers/docs/events/gateway-events#invite-delete) | Invite to a channel was deleted | +| [Message Create](/developers/docs/events/gateway-events#message-create) | Message was created | +| [Message Update](/developers/docs/events/gateway-events#message-update) | Message was edited | +| [Message Delete](/developers/docs/events/gateway-events#message-delete) | Message was deleted | +| [Message Delete Bulk](/developers/docs/events/gateway-events#message-delete-bulk) | Multiple messages were deleted at once | +| [Message Reaction Add](/developers/docs/events/gateway-events#message-reaction-add) | User reacted to a message | +| [Message Reaction Remove](/developers/docs/events/gateway-events#message-reaction-remove) | User removed a reaction from a message | +| [Message Reaction Remove All](/developers/docs/events/gateway-events#message-reaction-remove-all) | All reactions were explicitly removed from a message | +| [Message Reaction Remove Emoji](/developers/docs/events/gateway-events#message-reaction-remove-emoji) | All reactions for a given emoji were explicitly removed from a message | +| [Presence Update](/developers/docs/events/gateway-events#presence-update) | User was updated | +| [Stage Instance Create](/developers/docs/events/gateway-events#stage-instance-create) | Stage instance was created | +| [Stage Instance Update](/developers/docs/events/gateway-events#stage-instance-update) | Stage instance was updated | +| [Stage Instance Delete](/developers/docs/events/gateway-events#stage-instance-delete) | Stage instance was deleted or closed | +| [Subscription Create](/developers/docs/events/gateway-events#subscription-create) | Premium App Subscription was created | +| [Subscription Update](/developers/docs/events/gateway-events#subscription-update) | Premium App Subscription was updated | +| [Subscription Delete](/developers/docs/events/gateway-events#subscription-delete) | Premium App Subscription was deleted | +| [Typing Start](/developers/docs/events/gateway-events#typing-start) | User started typing in a channel | +| [User Update](/developers/docs/events/gateway-events#user-update) | Properties about the user changed | +| [Voice Channel Effect Send](/developers/docs/events/gateway-events#voice-channel-effect-send) | Someone sent an effect in a voice channel the current user is connected to | +| [Voice State Update](/developers/docs/events/gateway-events#voice-state-update) | Someone joined, left, or moved a voice channel | +| [Voice Server Update](/developers/docs/events/gateway-events#voice-server-update) | Guild's voice server was updated | +| [Webhooks Update](/developers/docs/events/gateway-events#webhooks-update) | Guild channel webhook was created, update, or deleted | +| [Message Poll Vote Add](/developers/docs/events/gateway-events#message-poll-vote-add) | User voted on a poll | +| [Message Poll Vote Remove](/developers/docs/events/gateway-events#message-poll-vote-remove) | User removed a vote on a poll | + +#### Hello + +Sent on connection to the websocket. Defines the heartbeat interval that an app should heartbeat to. + + +###### Hello Structure + +| Field | Type | Description | +|--------------------|---------|---------------------------------------------------------| +| heartbeat_interval | integer | Interval (in milliseconds) an app should heartbeat with | + + +###### Example Hello + +```json +{ + "op": 10, + "d": { + "heartbeat_interval": 45000 + } +} +``` + +#### Ready + +The ready event is dispatched when a client has completed the initial handshake with the gateway (for new sessions). The ready event can be the largest and most complex event the gateway will send, as it contains all the state required for a client to begin interacting with the rest of the platform. + +`guilds` are the guilds of which your bot is a member. They start out as unavailable when you connect to the gateway. As they become available, your bot will be notified via [Guild Create](/developers/docs/events/gateway-events#guild-create) events. + + +###### Ready Event Fields + +| Field | Type | Description | +|--------------------|-------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------| +| v | integer | [API version](/developers/docs/reference#api-versioning-api-versions) | +| user | [user](/developers/docs/resources/user#user-object) object | Information about the user including email | +| guilds | array of [Unavailable Guild](/developers/docs/resources/guild#unavailable-guild-object) objects | Guilds the user is in | +| session_id | string | Used for resuming connections | +| resume_gateway_url | string | Gateway URL for resuming connections | +| shard? | array of two integers (shard_id, num_shards) | [Shard information](/developers/docs/events/gateway#sharding) associated with this session, if sent when identifying | +| application | partial [application object](/developers/docs/resources/application#application-object) | Contains `id` and `flags` | + +#### Resumed + +The resumed event is dispatched when a client has sent a [resume payload](/developers/docs/events/gateway-events#resume) to the gateway (for resuming existing sessions). + +#### Reconnect + +The reconnect event is dispatched when a client should reconnect to the gateway (and resume their existing session, if they have one). This can occur at any point in the gateway connection lifecycle, even before/in place of receiving a [Hello](/developers/docs/events/gateway-events#hello) event. A few seconds after the reconnect event is dispatched, the connection may be closed by the server. + + +###### Example Gateway Reconnect + +```json +{ + "op": 7, + "d": null +} +``` + +#### Invalid Session + +Sent to indicate one of at least three different situations: + +- the gateway could not initialize a session after receiving an [Opcode 2 Identify](/developers/docs/events/gateway-events#identify) +- the gateway could not resume a previous session after receiving an [Opcode 6 Resume](/developers/docs/events/gateway-events#resume) +- the gateway has invalidated an active session and is requesting client action + +The inner `d` key is a boolean that indicates whether the session may be resumable. See [Connecting](/developers/docs/events/gateway#connecting) and [Resuming](/developers/docs/events/gateway#resuming) for more information. + + +###### Example Gateway Invalid Session + +```json +{ + "op": 9, + "d": false +} +``` + +### Application Commands + +#### Application Command Permissions Update + +`APPLICATION_COMMAND_PERMISSIONS_UPDATE` event, sent when an application command's permissions are updated. The inner payload is an [application command permissions](/developers/docs/interactions/application-commands#application-command-permissions-object-guild-application-command-permissions-structure) object. + +### Auto Moderation + +All [Auto Moderation](/developers/docs/resources/auto-moderation) related events are only sent to bot users which have the `MANAGE_GUILD` permission. + +#### Auto Moderation Rule Create + +Sent when a rule is created. The inner payload is an [auto moderation rule](/developers/docs/resources/auto-moderation#auto-moderation-rule-object) object. + +#### Auto Moderation Rule Update + +Sent when a rule is updated. The inner payload is an [auto moderation rule](/developers/docs/resources/auto-moderation#auto-moderation-rule-object) object. + +#### Auto Moderation Rule Delete + +Sent when a rule is deleted. The inner payload is an [auto moderation rule](/developers/docs/resources/auto-moderation#auto-moderation-rule-object) object. + +#### Auto Moderation Action Execution + +Sent when a rule is triggered and an action is executed (e.g. when a message is blocked). + + +###### Auto Moderation Action Execution Event Fields + +| Field | Type | Description | +|--------------------------|-----------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------| +| guild_id | snowflake | ID of the guild in which action was executed | +| action | [auto moderation action](/developers/docs/resources/auto-moderation#auto-moderation-action-object) object | Action which was executed | +| rule_id | snowflake | ID of the rule which action belongs to | +| rule_trigger_type | [trigger_type](/developers/docs/resources/auto-moderation#auto-moderation-rule-object-trigger-types) | Trigger type of rule which was triggered | +| user_id | snowflake | ID of the user which generated the content which triggered the rule | +| channel_id? | snowflake | ID of the channel in which user content was posted | +| message_id? | snowflake | ID of any user message which content belongs to * | +| alert_system_message_id? | snowflake | ID of any system auto moderation messages posted as a result of this action ** | +| content *** | string | User-generated text content | +| matched_keyword | ?string | Word or phrase configured in the rule that triggered the rule | +| matched_content *** | ?string | Substring in content that triggered the rule | + +\* `message_id` will not exist if message was blocked by [Auto Moderation](/developers/docs/resources/auto-moderation) or content was not part of any message + +\*\* `alert_system_message_id` will not exist if this event does not correspond to an action with type `SEND_ALERT_MESSAGE` + +\*\*\* `MESSAGE_CONTENT` (`1 << 15`) [gateway intent](/developers/docs/events/gateway#gateway-intents) is required to receive the `content` and `matched_content` fields + +### Channels + +#### Channel Create + +Sent when a new guild channel is created, relevant to the current user. The inner payload is a [channel](/developers/docs/resources/channel#channel-object) object. + +#### Channel Update + +Sent when a channel is updated. The inner payload is a [channel](/developers/docs/resources/channel#channel-object) object. This is not sent when the field `last_message_id` is altered. To keep track of the last_message_id changes, you must listen for [Message Create](/developers/docs/events/gateway-events#message-create) events (or [Thread Create](/developers/docs/events/gateway-events#thread-create) events for `GUILD_FORUM` and `GUILD_MEDIA` channels). + +This event may reference roles or guild members that no longer exist in the guild. + +#### Channel Delete + +Sent when a channel relevant to the current user is deleted. The inner payload is a [channel](/developers/docs/resources/channel#channel-object) object. + +#### Thread Create + +Sent when a thread is created, relevant to the current user, or when the current user is added to a thread. The inner payload is a [channel](/developers/docs/resources/channel#channel-object) object. + +- When a thread is created, includes an additional `newly_created` boolean field. +- When being added to an existing private thread, includes a [thread member](/developers/docs/resources/channel#thread-member-object) object. + +#### Thread Update + +Sent when a thread is updated. The inner payload is a [channel](/developers/docs/resources/channel#channel-object) object. This is not sent when the field `last_message_id` is altered. To keep track of the last_message_id changes, you must listen for [Message Create](/developers/docs/events/gateway-events#message-create) events. + +#### Thread Delete + +Sent when a thread relevant to the current user is deleted. The inner payload is a subset of the [channel](/developers/docs/resources/channel#channel-object) object, containing just the `id`, `guild_id`, `parent_id`, and `type` fields. + +#### Thread List Sync + +Sent when the current user _gains_ access to a channel. + + +###### Thread List Sync Event Fields + +| Field | Type | Description | +|--------------|-------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| guild_id | snowflake | ID of the guild | +| channel_ids? | array of snowflakes | Parent channel IDs whose threads are being synced. If omitted, then threads were synced for the entire guild. This array may contain channel_ids that have no active threads as well, so you know to clear that data. | +| threads | array of [channel](/developers/docs/resources/channel#channel-object) objects | All active threads in the given channels that the current user can access | +| members | array of [thread member](/developers/docs/resources/channel#thread-member-object) objects | All thread member objects from the synced threads for the current user, indicating which threads the current user has been added to | + +#### Thread Member Update + +Sent when the [thread member](/developers/docs/resources/channel#thread-member-object) object for the current user is updated. The inner payload is a [thread member](/developers/docs/resources/channel#thread-member-object) object with an extra `guild_id` field. This event is documented for completeness, but unlikely to be used by most bots. For bots, this event largely is just a signal that you are a member of the thread. See the [threads docs](/developers/docs/topics/threads) for more details. + + +###### Thread Member Update Event Extra Fields + +| Field | Type | Description | +|----------|-----------|-----------------| +| guild_id | snowflake | ID of the guild | + + +#### Thread Members Update + +Sent when anyone is added to or removed from a thread. If the current user does not have the `GUILD_MEMBERS` [Gateway Intent](/developers/docs/events/gateway#gateway-intents), then this event will only be sent if the current user was added to or removed from the thread. + + +###### Thread Members Update Event Fields + +| Field | Type | Description | +|---------------------|-------------------------------------------------------------------------------------------|-----------------------------------------------------------| +| id | snowflake | ID of the thread | +| guild_id | snowflake | ID of the guild | +| member_count | integer | Approximate number of members in the thread, capped at 50 | +| added_members?\* | array of [thread member](/developers/docs/resources/channel#thread-member-object) objects | Users who were added to the thread | +| removed_member_ids? | array of snowflakes | ID of the users who were removed from the thread | + +\* In this gateway event, the thread member objects will also include the [guild member](/developers/docs/resources/guild#guild-member-object) and nullable [presence](/developers/docs/events/gateway-events#presence) objects for each added thread member. + +#### Channel Pins Update + +Sent when a message is pinned or unpinned in a text channel. This is not sent when a pinned message is deleted. + + +###### Channel Pins Update Event Fields + +| Field | Type | Description | +|---------------------|--------------------|---------------------------------------------------------| +| guild_id? | snowflake | ID of the guild | +| channel_id | snowflake | ID of the channel | +| last_pin_timestamp? | ?ISO8601 timestamp | Time at which the most recent pinned message was pinned | + +### Entitlements + +#### Entitlement Create + + +Note: The`ENTITLEMENT_CREATE` event behavior changed on October 1, 2024. Please see the [Change Log and Entitlement Migration Guide](/developers/docs/change-log#premium-apps-entitlement-migration-and-new-subscription-api) for more information on what changed. + + +Sent when an entitlement is created. The inner payload is an [entitlement](/developers/docs/resources/entitlement#entitlement-object) object. + +#### Entitlement Update + + +Note: The`ENTITLEMENT_UPDATE` event behavior changed on October 1, 2024. Please see the [Change Log and Entitlement Migration Guide](/developers/docs/change-log#premium-apps-entitlement-migration-and-new-subscription-api) for more information on what changed. + + +Sent when an entitlement is updated. The inner payload is an [entitlement](/developers/docs/resources/entitlement#entitlement-object) object. + +For subscription entitlements, this event is triggered only when a user's subscription ends, providing an `ends_at` timestamp that indicates the end of the entitlement. + +#### Entitlement Delete + +Sent when an entitlement is deleted. The inner payload is an [entitlement](/developers/docs/resources/entitlement#entitlement-object) object. + +Entitlement deletions are infrequent, and occur when: + +- Discord issues a refund for a subscription +- Discord removes an entitlement from a user via internal tooling +- Discord deletes an app-managed entitlement they created via the API + +Entitlements are _not_ deleted when they expire. + +### Guilds + +#### Guild Create + +This event can be sent in three different scenarios: + +1. When a user is initially connecting, to lazily load and backfill information for all unavailable guilds sent in the [Ready](/developers/docs/events/gateway-events#ready) event. Guilds that are unavailable due to an outage will send a [Guild Delete](/developers/docs/events/gateway-events#guild-delete) event. +2. When a Guild becomes available again to the client. +3. When the current user joins a new Guild. + + +During an outage, the guild object in scenarios 1 and 3 may be marked as unavailable. + + +The inner payload can be: + +- An available Guild: a [guild](/developers/docs/resources/guild#guild-object) object with extra fields, as noted below. +- An unavailable Guild: an [unavailable guild](/developers/docs/resources/guild#unavailable-guild-object) object. + + +###### Guild Create Extra Fields + +| Field | Type | Description | +|------------------------|-------------------------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------| +| joined_at | ISO8601 timestamp | When this guild was joined at | +| large | boolean | `true` if this is considered a large guild | +| unavailable? | boolean | `true` if this guild is unavailable due to an outage | +| member_count | integer | Total number of members in this guild | +| voice_states | array of partial [voice state](/developers/docs/resources/voice#voice-state-object) objects | States of members currently in voice channels; lacks the `guild_id` key | +| members | array of [guild member](/developers/docs/resources/guild#guild-member-object) objects | Users in the guild | +| channels | array of [channel](/developers/docs/resources/channel#channel-object) objects | Channels in the guild | +| threads | array of [channel](/developers/docs/resources/channel#channel-object) objects | All active threads in the guild that current user has permission to view | +| presences | array of partial [presence update](/developers/docs/events/gateway-events#presence-update) objects | Presences of the members in the guild, will only include non-offline members if the size is greater than `large threshold` | +| stage_instances | array of [stage instance](/developers/docs/resources/stage-instance#stage-instance-object) objects | Stage instances in the guild | +| guild_scheduled_events | array of [guild scheduled event](/developers/docs/resources/guild-scheduled-event#guild-scheduled-event-object) objects | Scheduled events in the guild | +| soundboard_sounds | array of [soundboard sound](/developers/docs/resources/soundboard#soundboard-sound-object) objects | Soundboard sounds in the guild | + + +If your bot does not have the `GUILD_PRESENCES` [Gateway Intent](/developers/docs/events/gateway#gateway-intents), or if the guild has over 75k members, members and presences returned in this event will only contain your bot and users in voice channels. + + +#### Guild Update + +Sent when a guild is updated. The inner payload is a [guild](/developers/docs/resources/guild#guild-object) object. + +#### Guild Delete + +Sent when a guild becomes or was already unavailable due to an outage, or when the user leaves or is removed from a guild. The inner payload is an [unavailable guild](/developers/docs/resources/guild#unavailable-guild-object) object. If the `unavailable` field is not set, the user was removed from the guild. + +#### Guild Audit Log Entry Create + +Sent when a guild audit log entry is created. The inner payload is an [Audit Log Entry](/developers/docs/resources/audit-log#audit-log-entry-object) object with an extra `guild_id` key. This event is only sent to bots with the `VIEW_AUDIT_LOG` permission. + + +###### Guild Audit Log Entry Create Event Extra Fields + +| Field | Type | Description | +|----------|-----------|-----------------| +| guild_id | snowflake | ID of the guild | + +#### Guild Ban Add + +Sent when a user is banned from a guild. + + +###### Guild Ban Add Event Fields + +| Field | Type | Description | +|----------|--------------------------------------------------------------|---------------------| +| guild_id | snowflake | ID of the guild | +| user | a [user](/developers/docs/resources/user#user-object) object | User who was banned | + +#### Guild Ban Remove + +Sent when a user is unbanned from a guild. + + +###### Guild Ban Remove Event Fields + +| Field | Type | Description | +|----------|--------------------------------------------------------------|-----------------------| +| guild_id | snowflake | ID of the guild | +| user | a [user](/developers/docs/resources/user#user-object) object | User who was unbanned | + +#### Guild Emojis Update + +Sent when a guild's emojis have been updated. + + +###### Guild Emojis Update Event Fields + +| Field | Type | Description | +|----------|-----------|------------------------------------------------------------------| +| guild_id | snowflake | ID of the guild | +| emojis | array | Array of [emojis](/developers/docs/resources/emoji#emoji-object) | + +#### Guild Stickers Update + +Sent when a guild's stickers have been updated. + + +###### Guild Stickers Update Event Fields + +| Field | Type | Description | +|----------|-----------|------------------------------------------------------------------------| +| guild_id | snowflake | ID of the guild | +| stickers | array | Array of [stickers](/developers/docs/resources/sticker#sticker-object) | + +#### Guild Integrations Update + +Sent when a guild integration is updated. + + +###### Guild Integrations Update Event Fields + +| Field | Type | Description | +|----------|-----------|-------------------------------------------------| +| guild_id | snowflake | ID of the guild whose integrations were updated | + +#### Guild Member Add + + +If using [Gateway Intents](/developers/docs/events/gateway#gateway-intents), the `GUILD_MEMBERS` intent will be required to receive this event. + + +Sent when a new user joins a guild. The inner payload is a [guild member](/developers/docs/resources/guild#guild-member-object) object with an extra `guild_id` key: + + +###### Guild Member Add Extra Fields + +| Field | Type | Description | +|----------|-----------|-----------------| +| guild_id | snowflake | ID of the guild | + +#### Guild Member Remove + + +If using [Gateway Intents](/developers/docs/events/gateway#gateway-intents), the `GUILD_MEMBERS` intent will be required to receive this event. + + +Sent when a user is removed from a guild (leave/kick/ban). + + +###### Guild Member Remove Event Fields + +| Field | Type | Description | +|----------|--------------------------------------------------------------|----------------------| +| guild_id | snowflake | ID of the guild | +| user | a [user](/developers/docs/resources/user#user-object) object | User who was removed | + +#### Guild Member Update + + +If using [Gateway Intents](/developers/docs/events/gateway#gateway-intents), the `GUILD_MEMBERS` intent will be required to receive this event. + + +Sent when a guild member is updated. This will also fire when the user object of a guild member changes. + + +###### Guild Member Update Event Fields + +| Field | Type | Description | +|-------------------------------|------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| guild_id | snowflake | ID of the guild | +| roles | array of snowflakes | User role ids | +| user | a [user](/developers/docs/resources/user#user-object) object | User | +| nick? | ?string | Nickname of the user in the guild | +| avatar | ?string | Member's [guild avatar hash](/developers/docs/reference#image-formatting) | +| banner | ?string | Member's [guild banner hash](/developers/docs/reference#image-formatting) | +| joined_at | ?ISO8601 timestamp | When the user joined the guild | +| premium_since? | ?ISO8601 timestamp | When the user starting [boosting](https://support.discord.com/hc/en-us/articles/360028038352-Server-Boosting-) the guild | +| deaf? | boolean | Whether the user is deafened in voice channels | +| mute? | boolean | Whether the user is muted in voice channels | +| pending? | boolean | Whether the user has not yet passed the guild's [Membership Screening](/developers/docs/resources/guild#membership-screening-object) requirements | +| communication_disabled_until? | ?ISO8601 timestamp | When the user's [timeout](https://support.discord.com/hc/en-us/articles/4413305239191-Time-Out-FAQ) will expire and the user will be able to communicate in the guild again, null or a time in the past if the user is not timed out | +| avatar_decoration_data? | ?[avatar decoration data](/developers/docs/resources/user#avatar-decoration-data-object) | Data for the member's guild avatar decoration | + +#### Guild Members Chunk + +Sent in response to [Guild Request Members](/developers/docs/events/gateway-events#request-guild-members). +You can use the `chunk_index` and `chunk_count` to calculate how many chunks are left for your request. + + +###### Guild Members Chunk Event Fields + +| Field | Type | Description | +|-------------|---------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------| +| guild_id | snowflake | ID of the guild | +| members | array of [guild member](/developers/docs/resources/guild#guild-member-object) objects | Set of guild members | +| chunk_index | integer | Chunk index in the expected chunks for this response (`0 <= chunk_index < chunk_count`) | +| chunk_count | integer | Total number of expected chunks for this response | +| not_found? | array | When passing an invalid ID to `REQUEST_GUILD_MEMBERS`, it will be returned here | +| presences? | array of [presence](/developers/docs/events/gateway-events#presence) objects | When passing `true` to `REQUEST_GUILD_MEMBERS`, presences of the returned members will be here | +| nonce? | string | Nonce used in the [Guild Members Request](/developers/docs/events/gateway-events#request-guild-members) | + +#### Guild Role Create + +Sent when a guild role is created. + + +###### Guild Role Create Event Fields + +| Field | Type | Description | +|----------|------------------------------------------------------------------|-----------------------| +| guild_id | snowflake | ID of the guild | +| role | a [role](/developers/docs/topics/permissions#role-object) object | Role that was created | + +#### Guild Role Update + +Sent when a guild role is updated. + + +###### Guild Role Update Event Fields + +| Field | Type | Description | +|----------|------------------------------------------------------------------|-----------------------| +| guild_id | snowflake | ID of the guild | +| role | a [role](/developers/docs/topics/permissions#role-object) object | Role that was updated | + +#### Guild Role Delete + +Sent when a guild role is deleted. + + +###### Guild Role Delete Event Fields + +| Field | Type | Description | +|----------|-----------|-----------------| +| guild_id | snowflake | ID of the guild | +| role_id | snowflake | ID of the role | + +#### Guild Scheduled Event Create + +Sent when a guild scheduled event is created. The inner payload is a [guild scheduled event](/developers/docs/resources/guild-scheduled-event#guild-scheduled-event-object) object. + +#### Guild Scheduled Event Update + +Sent when a guild scheduled event is updated. The inner payload is a [guild scheduled event](/developers/docs/resources/guild-scheduled-event#guild-scheduled-event-object) object. + +#### Guild Scheduled Event Delete + +Sent when a guild scheduled event is deleted. The inner payload is a [guild scheduled event](/developers/docs/resources/guild-scheduled-event#guild-scheduled-event-object) object. + +#### Guild Scheduled Event User Add + +Sent when a user has subscribed to a guild scheduled event. + + +###### Guild Scheduled Event User Add Event Fields + +| Field | Type | Description | +|--------------------------|-----------|---------------------------------| +| guild_scheduled_event_id | snowflake | ID of the guild scheduled event | +| user_id | snowflake | ID of the user | +| guild_id | snowflake | ID of the guild | + +#### Guild Scheduled Event User Remove + +Sent when a user has unsubscribed from a guild scheduled event. + + +###### Guild Scheduled Event User Remove Event Fields + +| Field | Type | Description | +|--------------------------|-----------|---------------------------------| +| guild_scheduled_event_id | snowflake | ID of the guild scheduled event | +| user_id | snowflake | ID of the user | +| guild_id | snowflake | ID of the guild | + +#### Guild Soundboard Sound Create + +Sent when a guild soundboard sound is created. The inner payload is a [soundboard sound](/developers/docs/resources/soundboard#soundboard-sound-object) object. + +#### Guild Soundboard Sound Update + +Sent when a guild soundboard sound is updated. The inner payload is a [soundboard sound](/developers/docs/resources/soundboard#soundboard-sound-object) object. + +#### Guild Soundboard Sound Delete + +Sent when a guild soundboard sound is deleted. + + +###### Guild Soundboard Sound Delete Event Fields + +| Field | Type | Description | +|----------|-----------|----------------------------------| +| sound_id | snowflake | ID of the sound that was deleted | +| guild_id | snowflake | ID of the guild the sound was in | + +#### Guild Soundboard Sounds Update + +Sent when multiple guild soundboard sounds are updated. + + +###### Guild Soundboard Sounds Update Event Fields + +| Field | Type | Description | +|-------------------|----------------------------------------------------------------------------------------------------|-------------------------------| +| soundboard_sounds | array of [soundboard sound](/developers/docs/resources/soundboard#soundboard-sound-object) objects | The guild's soundboard sounds | +| guild_id | snowflake | ID of the guild | + +#### Soundboard Sounds + +Includes a guild's list of soundboard sounds. Sent in response to [Request Soundboard Sounds](/developers/docs/events/gateway-events#request-soundboard-sounds). + + +###### Soundboard Sounds Event Fields + +| Field | Type | Description | +|-------------------|----------------------------------------------------------------------------------------------------|-------------------------------| +| soundboard_sounds | array of [soundboard sound](/developers/docs/resources/soundboard#soundboard-sound-object) objects | The guild's soundboard sounds | +| guild_id | snowflake | ID of the guild | + +### Integrations + +#### Integration Create + +Sent when an integration is created. The inner payload is an [integration](/developers/docs/resources/guild#integration-object) object with `user` omitted and an additional `guild_id` key: + + +###### Integration Create Event Additional Fields + +| Field | Type | Description | +|----------|-----------|-----------------| +| guild_id | snowflake | ID of the guild | + +#### Integration Update + +Sent when an integration is updated. The inner payload is an [integration](/developers/docs/resources/guild#integration-object) object with `user` omitted and an additional `guild_id` key: + + +###### Integration Update Event Additional Fields + +| Field | Type | Description | +|----------|-----------|-----------------| +| guild_id | snowflake | ID of the guild | + +#### Integration Delete + +Sent when an integration is deleted. + + +###### Integration Delete Event Fields + +| Field | Type | Description | +|-----------------|-----------|---------------------------------------------------------------| +| id | snowflake | Integration ID | +| guild_id | snowflake | ID of the guild | +| application_id? | snowflake | ID of the bot/OAuth2 application for this discord integration | + +### Invites + +All [Invite](/developers/docs/resources/invite) related events are only sent to bot users with the `MANAGE_CHANNELS` permission on the channel. + +#### Invite Create + +Sent when a new invite to a channel is created. + + +###### Invite Create Event Fields + +| Field | Type | Description | +|---------------------|-----------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------| +| channel_id | snowflake | Channel the invite is for | +| code | string | Unique invite [code](/developers/docs/resources/invite#invite-object) | +| created_at | ISO8601 timestamp | Time at which the invite was created | +| guild_id? | snowflake | Guild of the invite | +| inviter? | [user](/developers/docs/resources/user#user-object) object | User that created the invite | +| max_age | integer | How long the invite is valid for (in seconds) | +| max_uses | integer | Maximum number of times the invite can be used | +| target_type? | integer | [Type of target](/developers/docs/resources/invite#invite-object-invite-target-types) for this voice channel invite | +| target_user? | [user](/developers/docs/resources/user#user-object) object | User whose stream to display for this voice channel stream invite | +| target_application? | partial [application](/developers/docs/resources/application#application-object) object | Embedded application to open for this voice channel embedded application invite | +| temporary | boolean | Whether or not the invite is temporary (invited users will be kicked on disconnect unless they're assigned a role) | +| uses | integer | How many times the invite has been used (always will be 0) | +| expires_at | ?ISO8601 timestamp | the expiration date of this invite | + +#### Invite Delete + +Sent when an invite is deleted. + + +###### Invite Delete Event Fields + +| Field | Type | Description | +|------------|-----------|-----------------------------------------------------------------------| +| channel_id | snowflake | Channel of the invite | +| guild_id? | snowflake | Guild of the invite | +| code | string | Unique invite [code](/developers/docs/resources/invite#invite-object) | + +### Messages + + +Unlike persistent messages, ephemeral messages are sent directly to the user and the bot who sent the message rather than through the guild channel. Because of this, ephemeral messages are tied to the [`DIRECT_MESSAGES` intent](/developers/docs/events/gateway#list-of-intents), and the message object won't include `guild_id` or `member`. + + +#### Message Create + +Sent when a message is created. The inner payload is a [message](/developers/docs/resources/message#message-object) object with the following extra fields: + + +###### Message Create Extra Fields + +| Field | Type | Description | +|-----------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------| +| guild_id? | snowflake | ID of the guild the message was sent in - unless it is an ephemeral message | +| member? | partial [guild member](/developers/docs/resources/guild#guild-member-object) object | Member properties for this message's author. Missing for ephemeral messages and messages from webhooks | +| mentions | array of [user](/developers/docs/resources/user#user-object) objects, optionally with an additional partial [member](/developers/docs/resources/guild#guild-member-object) field | Users specifically mentioned in the message | + +#### Message Update + +Sent when a message is updated. The inner payload is a [message](/developers/docs/resources/message#message-object) object with the same extra fields as [MESSAGE_CREATE](/developers/docs/events/gateway-events#message-create). + + +The value for `tts` will always be false in message updates. + + +#### Message Delete + +Sent when a message is deleted. + + +###### Message Delete Event Fields + +| Field | Type | Description | +|------------|-----------|-------------------| +| id | snowflake | ID of the message | +| channel_id | snowflake | ID of the channel | +| guild_id? | snowflake | ID of the guild | + +#### Message Delete Bulk + +Sent when multiple messages are deleted at once. + + +###### Message Delete Bulk Event Fields + +| Field | Type | Description | +|------------|---------------------|---------------------| +| ids | array of snowflakes | IDs of the messages | +| channel_id | snowflake | ID of the channel | +| guild_id? | snowflake | ID of the guild | + +#### Message Reaction Add + +Sent when a user adds a reaction to a message. + + +###### Message Reaction Add Event Fields + +| Field | Type | Description | +|--------------------|-------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------| +| user_id | snowflake | ID of the user | +| channel_id | snowflake | ID of the channel | +| message_id | snowflake | ID of the message | +| guild_id? | snowflake | ID of the guild | +| member? | [member](/developers/docs/resources/guild#guild-member-object) object | Member who reacted if this happened in a guild | +| emoji | a partial [emoji](/developers/docs/resources/emoji#emoji-object) object | Emoji used to react - [example](/developers/docs/resources/emoji#emoji-object-standard-emoji-example) | +| message_author_id? | snowflake | ID of the user who authored the message which was reacted to | +| burst | boolean | true if this is a super-reaction | +| burst_colors? | array of strings | Colors used for super-reaction animation in "#rrggbb" format | +| type | integer | The [type of reaction](/developers/docs/resources/message#get-reactions-reaction-types) | + +#### Message Reaction Remove + +Sent when a user removes a reaction from a message. + + +###### Message Reaction Remove Event Fields + +| Field | Type | Description | +|------------|-------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------| +| user_id | snowflake | ID of the user | +| channel_id | snowflake | ID of the channel | +| message_id | snowflake | ID of the message | +| guild_id? | snowflake | ID of the guild | +| emoji | a partial [emoji](/developers/docs/resources/emoji#emoji-object) object | Emoji used to react - [example](/developers/docs/resources/emoji#emoji-object-standard-emoji-example) | +| burst | boolean | true if this was a super-reaction | +| type | integer | The [type of reaction](/developers/docs/resources/message#get-reactions-reaction-types) | + +#### Message Reaction Remove All + +Sent when a user explicitly removes all reactions from a message. + + +###### Message Reaction Remove All Event Fields + +| Field | Type | Description | +|------------|-----------|-------------------| +| channel_id | snowflake | ID of the channel | +| message_id | snowflake | ID of the message | +| guild_id? | snowflake | ID of the guild | + +#### Message Reaction Remove Emoji + +Sent when a bot removes all instances of a given emoji from the reactions of a message. + + +###### Message Reaction Remove Emoji Event Fields + +| Field | Type | Description | +|------------|-----------------------------------------------------------------------|------------------------| +| channel_id | snowflake | ID of the channel | +| guild_id? | snowflake | ID of the guild | +| message_id | snowflake | ID of the message | +| emoji | [partial emoji object](/developers/docs/resources/emoji#emoji-object) | Emoji that was removed | + +### Presence + +#### Presence Update + + +If you are using [Gateway Intents](/developers/docs/events/gateway#gateway-intents), you _must_ specify the `GUILD_PRESENCES` intent in order to receive Presence Update events + + +A user's presence is their current state on a guild. This event is sent when a user's presence or info, such as name or avatar, is updated. + + +The user object within this event can be partial, the only field which must be sent is the `id` field, everything else is optional. Along with this limitation, no fields are required, and the types of the fields are **not** validated. Your client should expect any combination of fields and types within this event. + + + +###### Presence Update Event Fields + +| Field | Type | Description | +|---------------|-------------------------------------------------------------------------------------|----------------------------------------------| +| user | [user](/developers/docs/resources/user#user-object) object | User whose presence is being updated | +| guild_id | snowflake | ID of the guild | +| status | string | Either "idle", "dnd", "online", or "offline" | +| activities | array of [activity](/developers/docs/events/gateway-events#activity-object) objects | User's current activities | +| client_status | [client_status](/developers/docs/events/gateway-events#client-status-object) object | User's platform-dependent status | + +#### Client Status Object + +Active sessions are indicated with an "online", "idle", or "dnd" string per platform. If a user is offline or invisible, the corresponding field is not present. + +| Field | Type | Description | +|----------|--------|-----------------------------------------------------------------------------------| +| desktop? | string | User's status set for an active desktop (Windows, Linux, Mac) application session | +| mobile? | string | User's status set for an active mobile (iOS, Android) application session | +| web? | string | User's status set for an active web (browser, bot user) application session | + +#### Activity Object + + +###### Activity Structure + +| Field | Type | Description | +|----------------------|-------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| name | string | Activity's name | +| type | integer | [Activity type](/developers/docs/events/gateway-events#activity-object-activity-types) | +| url? | ?string | Stream URL, is validated when type is 1 | +| created_at | integer | Unix timestamp (in milliseconds) of when the activity was added to the user's session | +| timestamps? | [timestamps](/developers/docs/events/gateway-events#activity-object-activity-timestamps) object | Unix timestamps for start and/or end of the game | +| application_id? | snowflake | Application ID for the game | +| status_display_type? | ?integer | [Status display type](/developers/docs/events/gateway-events#activity-object-status-display-types); controls which field is displayed in the user's status text in the member list | +| details? | ?string | What the player is currently doing | +| details_url? | ?string | URL that is linked when clicking on the details text | +| state? | ?string | User's current party status, or text used for a custom status | +| state_url? | ?string | URL that is linked when clicking on the state text | +| emoji? | ?[emoji](/developers/docs/events/gateway-events#activity-object-activity-emoji) object | Emoji used for a custom status | +| party? | [party](/developers/docs/events/gateway-events#activity-object-activity-party) object | Information for the current party of the player | +| assets? | [assets](/developers/docs/events/gateway-events#activity-object-activity-assets) object | Images for the presence and their hover texts | +| secrets? | [secrets](/developers/docs/events/gateway-events#activity-object-activity-secrets) object | Secrets for Rich Presence joining and spectating | +| instance? | boolean | Whether or not the activity is an instanced game session | +| flags? | integer | [Activity flags](/developers/docs/events/gateway-events#activity-object-activity-flags) `OR`d together, describes what the payload includes | +| buttons? | array of [buttons](/developers/docs/events/gateway-events#activity-object-activity-buttons) | Custom buttons shown in the Rich Presence (max 2) | + + +Bot users are only able to set `name`, `state`, `type`, and `url`. + + + +###### Activity Types + +| ID | Name | Format | Example | +|----|-----------|-----------------------|--------------------------------------| +| 0 | Playing | Playing `{name}` | "Playing Rocket League" | +| 1 | Streaming | Streaming `{details}` | "Streaming Rocket League" | +| 2 | Listening | Listening to `{name}` | "Listening to Spotify" | +| 3 | Watching | Watching `{name}` | "Watching YouTube Together" | +| 4 | Custom | `{emoji}` `{state}` | ":smiley: I am cool" | +| 5 | Competing | Competing in `{name}` | "Competing in Arena World Champions" | + + +The streaming type currently only supports Twitch and YouTube. Only `https://twitch.tv/` and `https://youtube.com/` urls will work. + + + +###### Status Display Types + +| ID | Name | Example | +|----|---------|----------------------------------------| +| 0 | Name | "Listening to Spotify" | +| 1 | State | "Listening to Rick Astley" | +| 2 | Details | "Listening to Never Gonna Give You Up" | + + +This applies to all activity types. "Listening" was used to serve as a consistent example of what the different fields might be used for. + + + +###### Activity Timestamps + +| Field | Type | Description | +|--------|---------|----------------------------------------------------------| +| start? | integer | Unix time (in milliseconds) of when the activity started | +| end? | integer | Unix time (in milliseconds) of when the activity ends | + + +For Listening and Watching activities, you can include both start and end timestamps to display a time bar. + + + +###### Activity Emoji + +| Field | Type | Description | +|-----------|-----------|-------------------------------| +| name | string | Name of the emoji | +| id? | snowflake | ID of the emoji | +| animated? | boolean | Whether the emoji is animated | + + +###### Activity Party + +| Field | Type | Description | +|-------|------------------------------------------------|---------------------------------------------------| +| id? | string | ID of the party | +| size? | array of two integers (current_size, max_size) | Used to show the party's current and maximum size | + + +###### Activity Assets + +| Field | Type | Description | +|---------------------|--------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| large_image? | string | See [Activity Asset Image](/developers/docs/events/gateway-events#activity-object-activity-asset-image) | +| large_text? | string | Text displayed when hovering over the large image of the activity | +| large_url? | string | URL that is opened when clicking on the large image | +| small_image? | string | See [Activity Asset Image](/developers/docs/events/gateway-events#activity-object-activity-asset-image) | +| small_text? | string | Text displayed when hovering over the small image of the activity | +| small_url? | string | URL that is opened when clicking on the small image | +| invite_cover_image? | string | See [Activity Asset Image](/developers/docs/events/gateway-events#activity-object-activity-asset-image). Displayed as a banner on a [Game Invite](/developers/docs/discord-social-sdk/development-guides/managing-game-invites). | + + +###### Activity Asset Image + +Activity asset images are arbitrary strings which usually contain snowflake IDs or prefixed image IDs. Treat data within this field carefully, as it is user-specifiable and not sanitized. + +To use an external image via media proxy, specify the URL as the field's value when sending. You will only receive the `mp:` prefix via the gateway. + +| Type | Format | Image URL | +|-------------------|--------------------------|---------------------------------------------------------------------------------------| +| Application Asset | `{application_asset_id}` | See [Application Asset Image Formatting](/developers/docs/reference#image-formatting) | +| Media Proxy Image | `mp:{image_id}` | `https://media.discordapp.net/{image_id}` | + + +###### Activity Secrets + +| Field | Type | Description | +|-----------|--------|---------------------------------------| +| join? | string | Secret for joining a party | +| spectate? | string | Secret for spectating a game | +| match? | string | Secret for a specific instanced match | + + +###### Activity Flags + +| Name | Value | +|-----------------------------|----------| +| INSTANCE | `1 << 0` | +| JOIN | `1 << 1` | +| SPECTATE | `1 << 2` | +| JOIN_REQUEST | `1 << 3` | +| SYNC | `1 << 4` | +| PLAY | `1 << 5` | +| PARTY_PRIVACY_FRIENDS | `1 << 6` | +| PARTY_PRIVACY_VOICE_CHANNEL | `1 << 7` | +| EMBEDDED | `1 << 8` | + + +###### Activity Buttons + +When received over the gateway, the `buttons` field is an array of strings, which are the button labels. Bots cannot access a user's activity button URLs. When sending, the `buttons` field must be an array of the below object: + +| Field | Type | Description | +|-------|--------|--------------------------------------------------------| +| label | string | Text shown on the button (1-32 characters) | +| url | string | URL opened when clicking the button (1-512 characters) | + + +###### Example Activity + +```json +{ + "details": "24H RL Stream for Charity", + "state": "Rocket League", + "name": "Twitch", + "type": 1, + "url": "https://www.twitch.tv/discord" +} +``` + + +###### Example Activity with Rich Presence + +```json +{ + "name": "Rocket League", + "type": 0, + "application_id": "379286085710381999", + "state": "In a Match", + "details": "Ranked Duos: 2-1", + "timestamps": { + "start": 15112000660000 + }, + "party": { + "id": "9dd6594e-81b3-49f6-a6b5-a679e6a060d3", + "size": [2, 2] + }, + "assets": { + "large_image": "351371005538729000", + "large_text": "DFH Stadium", + "small_image": "351371005538729111", + "small_text": "Silver III" + }, + "secrets": { + "join": "025ed05c71f639de8bfaa0d679d7c94b2fdce12f", + "spectate": "e7eb30d2ee025ed05c71ea495f770b76454ee4e0", + "match": "4b2fdce12f639de8bfa7e3591b71a0d679d7c93f" + } +} +``` + + +Clients may only update their game status 5 times per 20 seconds. + + +#### Typing Start + +Sent when a user starts typing in a channel. + + +###### Typing Start Event Fields + +| Field | Type | Description | +|------------|-----------------------------------------------------------------------|--------------------------------------------------------| +| channel_id | snowflake | ID of the channel | +| guild_id? | snowflake | ID of the guild | +| user_id | snowflake | ID of the user | +| timestamp | integer | Unix time (in seconds) of when the user started typing | +| member? | [member](/developers/docs/resources/guild#guild-member-object) object | Member who started typing if this happened in a guild | + +#### User Update + +Sent when properties about the current bot's user change. Inner payload is a [user](/developers/docs/resources/user#user-object) object. + +### Voice + +#### Voice Channel Effect Send + +Sent when someone sends an effect, such as an emoji reaction or a soundboard sound, in a voice channel the current user is connected to. + + +###### Voice Channel Effect Send Event Fields + +| Field | Type | Description | +|-----------------|----------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------| +| channel_id | snowflake | ID of the channel the effect was sent in | +| guild_id | snowflake | ID of the guild the effect was sent in | +| user_id | snowflake | ID of the user who sent the effect | +| emoji? | ?[emoji](/developers/docs/resources/emoji#emoji-object) object | The emoji sent, for emoji reaction and soundboard effects | +| animation_type? | ?integer | The [type of emoji animation](/developers/docs/events/gateway-events#voice-channel-effect-send-animation-types), for emoji reaction and soundboard effects | +| animation_id? | integer | The ID of the emoji animation, for emoji reaction and soundboard effects | +| sound_id? | snowflake or integer | The ID of the soundboard sound, for soundboard effects | +| sound_volume? | double | The volume of the soundboard sound, from 0 to 1, for soundboard effects | + + +###### Animation Types + +| Type | Value | Description | +|---------|-------|---------------------------------------------| +| PREMIUM | 0 | A fun animation, sent by a Nitro subscriber | +| BASIC | 1 | The standard animation | + +#### Voice State Update + +Sent when someone joins/leaves/moves voice channels. Inner payload is a [voice state](/developers/docs/resources/voice#voice-state-object) object. + +#### Voice Server Update + +Sent when a guild's voice server is updated. This is sent when initially connecting to voice, and when the current voice instance fails over to a new server. + + +A null endpoint means that the voice server allocated has gone away and is trying to be reallocated. You should attempt to disconnect from the currently connected voice server, and not attempt to reconnect until a new voice server is allocated. + + + +###### Voice Server Update Event Fields + +| Field | Type | Description | +|----------|-----------|---------------------------------------| +| token | string | Voice connection token | +| guild_id | snowflake | Guild this voice server update is for | +| endpoint | ?string | Voice server host | + + +###### Example Voice Server Update Payload + +```json +{ + "token": "my_token", + "guild_id": "41771983423143937", + "endpoint": "sweetwater-12345.discord.media:2048" +} +``` + +### Webhooks + +#### Webhooks Update + +Sent when a guild channel's webhook is created, updated, or deleted. + + +###### Webhooks Update Event Fields + +| Field | Type | Description | +|------------|-----------|-------------------| +| guild_id | snowflake | ID of the guild | +| channel_id | snowflake | ID of the channel | + +### Interactions + +#### Interaction Create + +Sent when a user uses an [Application Command](/developers/docs/interactions/application-commands) or [Message Component](/developers/docs/components/reference#component-object). Inner payload is an [Interaction](/developers/docs/interactions/receiving-and-responding#interaction-object-interaction-structure). + +### Stage Instances + +#### Stage Instance Create + +Sent when a [Stage instance](/developers/docs/resources/stage-instance) is created (i.e. the Stage is now "live"). Inner payload is a [Stage instance](/developers/docs/resources/stage-instance#stage-instance-object) + +#### Stage Instance Update + +Sent when a [Stage instance](/developers/docs/resources/stage-instance) has been updated. Inner payload is a [Stage instance](/developers/docs/resources/stage-instance#stage-instance-object) + +#### Stage Instance Delete + +Sent when a [Stage instance](/developers/docs/resources/stage-instance) has been deleted (i.e. the Stage has been closed). Inner payload is a [Stage instance](/developers/docs/resources/stage-instance#stage-instance-object) + +### Subscriptions + +#### Subscription Create + + +Subscription status should not be used to grant perks. Use [entitlements](/developers/docs/resources/entitlement#entitlement-object) as an indication of whether a user should have access to a specific SKU. See our guide on [Implementing App Subscriptions](/developers/docs/monetization/implementing-app-subscriptions) for more information. + + +Sent when a [Subscription](/developers/docs/resources/subscription) for a Premium App is created. Inner payload is a [Subscription](/developers/docs/resources/subscription#subscription-object). + +A Subscription's `status` can be either **inactive** or **active** when this event is received. You will receive subsequent `SUBSCRIPTION_UPDATE` events if the `status` is updated to **active**. As a best practice, you should not grant any perks to users until the entitlements are created. + +#### Subscription Update + +Sent when a [Subscription](/developers/docs/resources/subscription) for a Premium App has been updated. Inner payload is a [Subscription](/developers/docs/resources/subscription#subscription-object) object. + +#### Subscription Delete + +Sent when a [Subscription](/developers/docs/resources/subscription) for a Premium App has been deleted. Inner payload is a [Subscription](/developers/docs/resources/subscription#subscription-object) object. + +### Polls + +#### Message Poll Vote Add + +Sent when a user votes on a poll. If the poll allows multiple selection, one event will be sent per answer. + + +###### Message Poll Vote Add Fields + +| Field | Type | Description | +|------------|-----------|-------------------| +| user_id | snowflake | ID of the user | +| channel_id | snowflake | ID of the channel | +| message_id | snowflake | ID of the message | +| guild_id? | snowflake | ID of the guild | +| answer_id | integer | ID of the answer | + +#### Message Poll Vote Remove + +Sent when a user removes their vote on a poll. If the poll allows for multiple selections, one event will be sent per answer. + + +###### Message Poll Vote Remove Fields + +| Field | Type | Description | +|------------|-----------|-------------------| +| user_id | snowflake | ID of the user | +| channel_id | snowflake | ID of the channel | +| message_id | snowflake | ID of the message | +| guild_id? | snowflake | ID of the guild | +| answer_id | integer | ID of the answer | + +### Rate Limits + +#### Rate Limited + +Sent when an app encounters a gateway rate limit for an event, such as [Request Guild Members](/developers/docs/events/gateway-events#request-guild-members). + + +See changelog for [Introducing Rate Limit When Requesting All Guild Members](/developers/docs/change-log#introducing-rate-limit-when-requesting-all-guild-members) for more information and timeline on this new rate limit. + + +###### Rate Limited Fields + +| Field | Type | Description | +|-------------|--------------------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------| +| opcode | integer | [Gateway opcode](/developers/docs/topics/opcodes-and-status-codes#gateway-gateway-opcodes) of the event that was rate limited | +| retry_after | float | The number of seconds to wait before submitting another request | +| meta | [Rate Limit Metadata for Opcode](/developers/docs/events/gateway-events#rate-limited-rate-limit-metadata-for-opcode-structure) | Metadata for the event that was rate limited | + +###### Rate Limit Metadata for Opcode Structure + +| Opcode | Type | +|--------|----------------------------------------------------------------------------------------------------------------------------------------------------| +| 8 | [Request Guild Member Rate Limit Metadata](/developers/docs/events/gateway-events#rate-limited-request-guild-member-rate-limit-metadata-structure) | + +###### Request Guild Member Rate Limit Metadata Structure + +| Field | Type | Description | +|----------|-----------|------------------------------------------------------------------------------------------------------------------| +| guild_id | snowflake | ID of the guild to get members for | +| nonce? | string | nonce to identify the [Guild Members Chunk](/developers/docs/events/gateway-events#guild-members-chunk) response | diff --git a/docs/events/gateway.mdx b/discord/developers/docs/events/gateway.mdx similarity index 56% rename from docs/events/gateway.mdx rename to discord/developers/docs/events/gateway.mdx index dfc338ae66..878ae8e803 100644 --- a/docs/events/gateway.mdx +++ b/discord/developers/docs/events/gateway.mdx @@ -1,25 +1,30 @@ --- -sidebar_label: Using Gateway +title: Gateway +sidebarTitle: Using Gateway +description: Learn how to establish and maintain Gateway API connections with Discord. --- -# Gateway +import {ManualAnchor} from '/snippets/manualanchor.jsx' + +import {Route} from '/snippets/route.jsx' The Gateway API lets apps open secure WebSocket connections with Discord to receive events about actions that take place in a server/guild, like when a channel is updated or a role is created. There are a few cases where apps will *also* use Gateway connections to update or request resources, like when updating voice state. -:::info -In *most* cases, performing REST operations on Discord resources can be done using the [HTTP API](/docs/reference#http-api) rather than the Gateway API. -::: + +In *most* cases, performing REST operations on Discord resources can be done using the [HTTP API](/developers/docs/reference#http-api) rather than the Gateway API. + -The Gateway is Discord's form of real-time communication used by clients (including apps), so there are nuances and data passed that simply isn't relevant to apps. Interacting with the Gateway can be tricky, but there are [community-built libraries](/docs/developer-tools/community-resources#libraries) with built-in support that simplify the most complicated bits and pieces. If you're planning on writing a custom implementation, be sure to read the following documentation in its entirety so you understand the sacred secrets of the Gateway (or at least those that matter for apps). +The Gateway is Discord's form of real-time communication used by clients (including apps), so there are nuances and data passed that simply isn't relevant to apps. Interacting with the Gateway can be tricky, but there are [community-built libraries](/developers/docs/developer-tools/community-resources#libraries) with built-in support that simplify the most complicated bits and pieces. If you're planning on writing a custom implementation, be sure to read the following documentation in its entirety so you understand the sacred secrets of the Gateway (or at least those that matter for apps). ## Gateway Events -Gateway events are [payloads](/docs/events/gateway-events#payload-structure) sent over a [Gateway connection](/docs/events/gateway#connections)—either from an app to Discord, or from Discord to an app. An app typically [*sends* events](/docs/events/gateway#sending-events) when connecting and managing its connection to the Gateway, and [*receives* events](/docs/events/gateway#receiving-events) when listening to actions taking place in a server. +Gateway events are [payloads](/developers/docs/events/gateway-events#payload-structure) sent over a [Gateway connection](/developers/docs/events/gateway#connections)—either from an app to Discord, or from Discord to an app. An app typically [*sends* events](/developers/docs/events/gateway#sending-events) when connecting and managing its connection to the Gateway, and [*receives* events](/developers/docs/events/gateway#receiving-events) when listening to actions taking place in a server. -All Gateway events are encapsulated in a [Gateway event payload](/docs/events/gateway-events#payload-structure). +All Gateway events are encapsulated in a [Gateway event payload](/developers/docs/events/gateway-events#payload-structure). -A full list of Gateway events and their details are in the [Gateway events documentation](/docs/events/gateway-events). +A full list of Gateway events and their details are in the [Gateway events documentation](/developers/docs/events/gateway-events). + ###### Example Gateway Event ```json @@ -31,41 +36,41 @@ A full list of Gateway events and their details are in the [Gateway events docum } ``` -Details about Gateway event payloads are in the [Gateway events documentation](/docs/events/gateway-events#payload-structure). +Details about Gateway event payloads are in the [Gateway events documentation](/developers/docs/events/gateway-events#payload-structure). ### Sending Events -When sending a Gateway event (like when [performing an initial handshake](/docs/events/gateway-events#identify) or [updating presence](/docs/events/gateway-events#update-presence)), your app must send an [event payload object](/docs/events/gateway-events#payload-structure) with a valid opcode (`op`) and inner data object (`d`). +When sending a Gateway event (like when [performing an initial handshake](/developers/docs/events/gateway-events#identify) or [updating presence](/developers/docs/events/gateway-events#update-presence)), your app must send an [event payload object](/developers/docs/events/gateway-events#payload-structure) with a valid opcode (`op`) and inner data object (`d`). -:::info -Specific rate limits are applied when sending events, which you can read about in the [Rate Limiting](/docs/events/gateway#rate-limiting) section. -::: + +Specific rate limits are applied when sending events, which you can read about in the [Rate Limiting](/developers/docs/events/gateway#rate-limiting) section. + Event payloads sent over a Gateway connection: -1. Must be serialized in [plain-text JSON or binary ETF](/docs/events/gateway#encoding-and-compression). -2. Must not exceed 4096 bytes. If an event payload *does* exceed 4096 bytes, the connection will be closed with a [`4002` close event code](/docs/topics/opcodes-and-status-codes#gateway-gateway-close-event-codes). +1. Must be serialized in [plain-text JSON or binary ETF](/developers/docs/events/gateway#encoding-and-compression). +2. Must not exceed 4096 bytes. If an event payload *does* exceed 4096 bytes, the connection will be closed with a [`4002` close event code](/developers/docs/topics/opcodes-and-status-codes#gateway-gateway-close-event-codes). -All events that your app can send via a connection are in [Gateway event documentation](/docs/events/gateway-events#send-events). +All events that your app can send via a connection are in [Gateway event documentation](/developers/docs/events/gateway-events#send-events). ### Receiving Events -Receiving a Gateway event from Discord (like when [a reaction is added to a message](/docs/events/gateway-events#message-reaction-add)) is much more common (and slightly more complex) than sending them. +Receiving a Gateway event from Discord (like when [a reaction is added to a message](/developers/docs/events/gateway-events#message-reaction-add)) is much more common (and slightly more complex) than sending them. -While some events are sent to your app automatically, most events require your app to define intents when [Identifying](/docs/events/gateway#identifying). Intents are bitwise values that can be ORed (`|`) to indicate which events (or groups of events) you want Discord to send your app. A list of intents and their corresponding events are listed in the [intents section](/docs/events/gateway#gateway-intents). +While some events are sent to your app automatically, most events require your app to define intents when [Identifying](/developers/docs/events/gateway#identifying). Intents are bitwise values that can be ORed (`|`) to indicate which events (or groups of events) you want Discord to send your app. A list of intents and their corresponding events are listed in the [intents section](/developers/docs/events/gateway#gateway-intents). -When receiving events, you can also configure *how* events will be sent to your app, like the [encoding and compression](/docs/events/gateway#encoding-and-compression), or whether [sharding should be enabled](/docs/events/gateway#sharding)). +When receiving events, you can also configure *how* events will be sent to your app, like the [encoding and compression](/developers/docs/events/gateway#encoding-and-compression), or whether [sharding should be enabled](/developers/docs/events/gateway#sharding)). -All events that your app can receive via a connection are in the [Gateway event documentation](/docs/events/gateway-events#receive-events). +All events that your app can receive via a connection are in the [Gateway event documentation](/developers/docs/events/gateway-events#receive-events). #### Dispatch Events -[Dispatch (opcode `0`)](/docs/topics/opcodes-and-status-codes#gateway-gateway-opcodes) events are the most common type of event your app will receive. *Most* Gateway events which represent actions taking place in a guild will be sent to your app as Dispatch events. +[Dispatch (opcode `0`)](/developers/docs/topics/opcodes-and-status-codes#gateway-gateway-opcodes) events are the most common type of event your app will receive. *Most* Gateway events which represent actions taking place in a guild will be sent to your app as Dispatch events. When your app is parsing a Dispatch event: -- The `t` field can be used to determine which [Gateway event](/docs/events/gateway-events#receive-events) the payload represents the data you can expect in the `d` field. -- The `s` field represents the sequence number of the event, which is the relative order in which it occurred. You need to cache the most recent non-null `s` value for heartbeats, and to pass when [Resuming](/docs/events/gateway#resuming) a connection. +- The `t` field can be used to determine which [Gateway event](/developers/docs/events/gateway-events#receive-events) the payload represents the data you can expect in the `d` field. +- The `s` field represents the sequence number of the event, which is the relative order in which it occurred. You need to cache the most recent non-null `s` value for heartbeats, and to pass when [Resuming](/developers/docs/events/gateway#resuming) a connection. ## Connections @@ -73,54 +78,56 @@ Gateway connections are persistent WebSockets which introduce more complexity th ### Connection Lifecycle -:::info + There are nuances that aren't included in the overview below. More details about each step and event can be found in the individual sections below. -::: + At a high-level, Gateway connections consist of the following cycle: -![Flowchart with an overview of Gateway connection lifecycle](images/gateway-lifecycle.svg) +![Flowchart with an overview of Gateway connection lifecycle](/images/events/gateway-lifecycle.svg) -1. App establishes a connection with the Gateway after fetching and caching a WSS URL using the [Get Gateway](/docs/events/gateway#get-gateway) or [Get Gateway Bot](/docs/events/gateway#get-gateway-bot) endpoint. -2. Discord sends the app a [Hello (opcode `10`)](/docs/events/gateway#hello-event) event containing a heartbeat interval in milliseconds. **Read the section on [Connecting](/docs/events/gateway#connecting)** -3. Start the Heartbeat interval. App must send a [Heartbeat (opcode `1`)](/docs/events/gateway-events#heartbeat) event, then continue to send them every heartbeat interval until the connection is closed. **Read the section on [Sending Heartbeats](/docs/events/gateway#sending-heartbeats)** - - Discord will respond to each Heartbeat event with a [Heartbeat ACK (opcode `11`)](/docs/events/gateway#sending-heartbeats) event to confirm it was received. If an app doesn't receive a Heartbeat ACK, it should close the connection and reconnect. - - Discord may send the app a [Heartbeat (opcode `1`)](/docs/events/gateway-events#heartbeat) event, in which case the app should send a Heartbeat event immediately. -4. App sends an [Identify (opcode `2`)](/docs/events/gateway-events#identify) event to perform the initial handshake with the Gateway. **Read the section on [Identifying](/docs/events/gateway#identifying)** -5. Discord sends the app a [Ready (opcode `0`)](/docs/events/gateway-events#ready) event which indicates the handshake was successful and the connection is established. The Ready event contains a `resume_gateway_url` that the app should keep track of to determine the WebSocket URL an app should use to Resume. **Read the section on [the Ready event](/docs/events/gateway#ready-event)** -6. The connection may be dropped for a variety of reasons at any time. Whether the app can [Resume](/docs/events/gateway#resuming) the connection or whether it must re-identify is determined by a variety of factors like the [opcode](/docs/topics/opcodes-and-status-codes#gateway-gateway-opcodes) and [close code](/docs/topics/opcodes-and-status-codes#gateway-gateway-close-event-codes) that it receives. **Read the section on [Disconnecting](/docs/events/gateway#disconnecting)** -7. If an app **can** resume/reconnect, it should open a new connection using `resume_gateway_url` with the same version and encoding, then send a [Resume (opcode `6`)](/docs/events/gateway-events#resume) event. If an app **cannot** resume/reconnect, it should open a new connection using the cached URL from step #1, then repeat the whole Gateway cycle. *Yipee!* **Read the section on [Resuming](/docs/events/gateway#resuming)** +1. App establishes a connection with the Gateway after fetching and caching a WSS URL using the [Get Gateway](/developers/docs/events/gateway#get-gateway) or [Get Gateway Bot](/developers/docs/events/gateway#get-gateway-bot) endpoint. +2. Discord sends the app a [Hello (opcode `10`)](/developers/docs/events/gateway#hello-event) event containing a heartbeat interval in milliseconds. **Read the section on [Connecting](/developers/docs/events/gateway#connecting)** +3. Start the Heartbeat interval. App must send a [Heartbeat (opcode `1`)](/developers/docs/events/gateway-events#heartbeat) event, then continue to send them every heartbeat interval until the connection is closed. **Read the section on [Sending Heartbeats](/developers/docs/events/gateway#sending-heartbeats)** + - Discord will respond to each Heartbeat event with a [Heartbeat ACK (opcode `11`)](/developers/docs/events/gateway#sending-heartbeats) event to confirm it was received. If an app doesn't receive a Heartbeat ACK, it should close the connection and reconnect. + - Discord may send the app a [Heartbeat (opcode `1`)](/developers/docs/events/gateway-events#heartbeat) event, in which case the app should send a Heartbeat event immediately. +4. App sends an [Identify (opcode `2`)](/developers/docs/events/gateway-events#identify) event to perform the initial handshake with the Gateway. **Read the section on [Identifying](/developers/docs/events/gateway#identifying)** +5. Discord sends the app a [Ready (opcode `0`)](/developers/docs/events/gateway-events#ready) event which indicates the handshake was successful and the connection is established. The Ready event contains a `resume_gateway_url` that the app should keep track of to determine the WebSocket URL an app should use to Resume. **Read the section on [the Ready event](/developers/docs/events/gateway#ready-event)** +6. The connection may be dropped for a variety of reasons at any time. Whether the app can [Resume](/developers/docs/events/gateway#resuming) the connection or whether it must re-identify is determined by a variety of factors like the [opcode](/developers/docs/topics/opcodes-and-status-codes#gateway-gateway-opcodes) and [close code](/developers/docs/topics/opcodes-and-status-codes#gateway-gateway-close-event-codes) that it receives. **Read the section on [Disconnecting](/developers/docs/events/gateway#disconnecting)** +7. If an app **can** resume/reconnect, it should open a new connection using `resume_gateway_url` with the same version and encoding, then send a [Resume (opcode `6`)](/developers/docs/events/gateway-events#resume) event. If an app **cannot** resume/reconnect, it should open a new connection using the cached URL from step #1, then repeat the whole Gateway cycle. *Yipee!* **Read the section on [Resuming](/developers/docs/events/gateway#resuming)** ### Connecting -Before your app can establish a connection to the Gateway, it should call the [Get Gateway](/docs/events/gateway#get-gateway) or the [Get Gateway Bot](/docs/events/gateway#get-gateway-bot) endpoint. Either endpoint will return a payload with a `url` field whose value is the WSS URL you can use to open a WebSocket connection. In addition to the URL, [Get Gateway Bot](/docs/events/gateway#get-gateway-bot) contains additional information about the recommended number of shards and the session start limits for your app. +Before your app can establish a connection to the Gateway, it should call the [Get Gateway](/developers/docs/events/gateway#get-gateway) or the [Get Gateway Bot](/developers/docs/events/gateway#get-gateway-bot) endpoint. Either endpoint will return a payload with a `url` field whose value is the WSS URL you can use to open a WebSocket connection. In addition to the URL, [Get Gateway Bot](/developers/docs/events/gateway#get-gateway-bot) contains additional information about the recommended number of shards and the session start limits for your app. -When initially calling either [Get Gateway](/docs/events/gateway#get-gateway) or [Get Gateway Bot](/docs/events/gateway#get-gateway-bot), you should cache the value of the `url` field and use that when re-connecting to the Gateway. +When initially calling either [Get Gateway](/developers/docs/events/gateway#get-gateway) or [Get Gateway Bot](/developers/docs/events/gateway#get-gateway-bot), you should cache the value of the `url` field and use that when re-connecting to the Gateway. -When connecting to the URL, it's a good idea to explicitly pass the API version and [encoding](/docs/events/gateway#encoding-and-compression) as query parameters. You can also optionally include whether Discord should [compress](/docs/events/gateway#encoding-and-compression) data that it sends your app. +When connecting to the URL, it's a good idea to explicitly pass the API version and [encoding](/developers/docs/events/gateway#encoding-and-compression) as query parameters. You can also optionally include whether Discord should [compress](/developers/docs/events/gateway#encoding-and-compression) data that it sends your app. -:::info + `wss://gateway.discord.gg/?v=10&encoding=json` is an example of a WSS URL an app may use to connect to the Gateway. -::: + -:::warn + For security reasons, the Gateway cannot be accessed directly from a Cloudflare Worker. Attempts will result in a 401 Unauthorized status code. -::: + + ###### Gateway URL Query String Params -| Field | Type | Description | Accepted Values | -|-----------|---------|-----------------------------------------------------------------------------------------------------|------------------------------------------------------------| -| v | integer | [API Version](/docs/reference#api-versioning) to use | [API version](/docs/reference#api-versioning-api-versions) | -| encoding | string | The [encoding](/docs/events/gateway#encoding-and-compression) of received gateway packets | `json` or `etf` | -| compress? | string | The optional [transport compression](/docs/events/gateway#transport-compression) of gateway packets | `zlib-stream` or `zstd-stream` | +| Field | Type | Description | Accepted Values | +|-----------|---------|----------------------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------| +| v | integer | [API Version](/developers/docs/reference#api-versioning) to use | [API version](/developers/docs/reference#api-versioning-api-versions) | +| encoding | string | The [encoding](/developers/docs/events/gateway#encoding-and-compression) of received gateway packets | `json` or `etf` | +| compress? | string | The optional [transport compression](/developers/docs/events/gateway#transport-compression) of gateway packets | `zlib-stream` or `zstd-stream` | #### Hello Event -Once connected to the Gateway, your app will receive a [Hello (opcode `10`)](/docs/events/gateway#hello-event) event that contains your connection's heartbeat interval (`heartbeat_interval`). +Once connected to the Gateway, your app will receive a [Hello (opcode `10`)](/developers/docs/events/gateway#hello-event) event that contains your connection's heartbeat interval (`heartbeat_interval`). -The heartbeat interval indicates a length of time in milliseconds that you should use to determine how often your app needs to send a Heartbeat event in order to maintain the active connection. Heartbeating is detailed in the [Sending Heartbeats](/docs/events/gateway#sending-heartbeats) section. +The heartbeat interval indicates a length of time in milliseconds that you should use to determine how often your app needs to send a Heartbeat event in order to maintain the active connection. Heartbeating is detailed in the [Sending Heartbeats](/developers/docs/events/gateway#sending-heartbeats) section. + ###### Example Hello Event ```json @@ -138,20 +145,21 @@ Heartbeats are pings used to let Discord know that your app is still actively us #### Heartbeat Interval -When your app opens a Gateway connection, it will receive a [Hello (opcode `10`)](/docs/events/gateway#hello-event) event which includes a `heartbeat_interval` field that has a value representing a length of time in milliseconds. +When your app opens a Gateway connection, it will receive a [Hello (opcode `10`)](/developers/docs/events/gateway#hello-event) event which includes a `heartbeat_interval` field that has a value representing a length of time in milliseconds. -Upon receiving the Hello event, your app should wait `heartbeat_interval * jitter` where `jitter` is any random value between 0 and 1, then send its first [Heartbeat (opcode `1`)](/docs/events/gateway-events#heartbeat) event. From that point until the connection is closed, your app must continually send Discord a heartbeat every `heartbeat_interval` milliseconds. If your app fails to send a heartbeat event in time, your connection will be closed and you will be forced to [Resume](/docs/events/gateway#resuming). +Upon receiving the Hello event, your app should wait `heartbeat_interval * jitter` where `jitter` is any random value between 0 and 1, then send its first [Heartbeat (opcode `1`)](/developers/docs/events/gateway-events#heartbeat) event. From that point until the connection is closed, your app must continually send Discord a heartbeat every `heartbeat_interval` milliseconds. If your app fails to send a heartbeat event in time, your connection will be closed and you will be forced to [Resume](/developers/docs/events/gateway#resuming). -When sending a heartbeat, your app will need to include the last sequence number your app received in the `d` field. The sequence number is sent to your app in the [event payload](/docs/events/gateway-events#payload-structure) in the `s` field. If your app hasn't received any events yet, you can just pass `null` in the `d` field. +When sending a heartbeat, your app will need to include the last sequence number your app received in the `d` field. The sequence number is sent to your app in the [event payload](/developers/docs/events/gateway-events#payload-structure) in the `s` field. If your app hasn't received any events yet, you can just pass `null` in the `d` field. -:::info + In the first heartbeat, `jitter` is an offset value between 0 and `heartbeat_interval` that is meant to prevent too many clients (both desktop and apps) from reconnecting their sessions at the exact same time (which could cause an influx of traffic). -::: + You *can* send heartbeats before the `heartbeat_interval` elapses, but you should avoid doing so unless necessary. There is already tolerance in the `heartbeat_interval` that will cover network latency, so you don't need to account for it in your implementation. -When you send a Heartbeat event, Discord will respond with a [Heartbeat ACK (opcode `11`)](/docs/events/gateway#heartbeat-interval-example-heartbeat-ack) event, which is an acknowledgement that the heartbeat was received: +When you send a Heartbeat event, Discord will respond with a [Heartbeat ACK (opcode `11`)](/developers/docs/events/gateway#heartbeat-interval-example-heartbeat-ack) event, which is an acknowledgement that the heartbeat was received: + ###### Example Heartbeat ACK ```json @@ -160,35 +168,36 @@ When you send a Heartbeat event, Discord will respond with a [Heartbeat ACK (opc } ``` -:::info + In the event of a service outage where you stay connected to the Gateway, you should continue to send heartbeats and receive heartbeat ACKs. The Gateway will eventually respond and issue a session once it's able to. -::: + -If a client does not receive a heartbeat ACK between its attempts at sending heartbeats, this may be due to a failed or "zombied" connection. The client should immediately terminate the connection with any close code besides `1000` or `1001`, then reconnect and attempt to [Resume](/docs/events/gateway#resuming). +If a client does not receive a heartbeat ACK between its attempts at sending heartbeats, this may be due to a failed or "zombied" connection. The client should immediately terminate the connection with any close code besides `1000` or `1001`, then reconnect and attempt to [Resume](/developers/docs/events/gateway#resuming). #### Heartbeat Requests -In addition to the Heartbeat interval, Discord may request additional heartbeats from your app by sending a [Heartbeat (opcode `1`)](/docs/events/gateway-events#heartbeat) event. Upon receiving the event, your app should immediately send back another Heartbeat event without waiting the remainder of the current interval. +In addition to the Heartbeat interval, Discord may request additional heartbeats from your app by sending a [Heartbeat (opcode `1`)](/developers/docs/events/gateway-events#heartbeat) event. Upon receiving the event, your app should immediately send back another Heartbeat event without waiting the remainder of the current interval. -Just like with the interval, Discord will respond with an [Heartbeat ACK (opcode `11`)](/docs/events/gateway#heartbeat-interval-example-heartbeat-ack) event. +Just like with the interval, Discord will respond with an [Heartbeat ACK (opcode `11`)](/developers/docs/events/gateway#heartbeat-interval-example-heartbeat-ack) event. ### Identifying -After the connection is open and your app is sending heartbeats, you should send an [Identify (opcode `2`)](/docs/events/gateway-events#identify) event. The Identify event is an initial handshake with the Gateway that's required before your app can begin sending or receiving most Gateway events. +After the connection is open and your app is sending heartbeats, you should send an [Identify (opcode `2`)](/developers/docs/events/gateway-events#identify) event. The Identify event is an initial handshake with the Gateway that's required before your app can begin sending or receiving most Gateway events. -Apps are limited by maximum concurrency (`max_concurrency` in the [session start limit object](/docs/events/gateway#session-start-limit-object)) when identifying. If your app exceeds this limit, Discord will respond with a [Invalid Session (opcode `9`)](/docs/events/gateway-events#invalid-session) event. +Apps are limited by maximum concurrency (`max_concurrency` in the [session start limit object](/developers/docs/events/gateway#session-start-limit-object)) when identifying. If your app exceeds this limit, Discord will respond with a [Invalid Session (opcode `9`)](/developers/docs/events/gateway-events#invalid-session) event. -After your app sends a valid Identify payload, Discord will respond with a [Ready](/docs/events/gateway-events#ready) event which indicates that your app is in a successfully-connected state with the Gateway. The Ready event is sent as a standard [Dispatch (opcode `0`)](/docs/topics/opcodes-and-status-codes#gateway-gateway-opcodes). +After your app sends a valid Identify payload, Discord will respond with a [Ready](/developers/docs/events/gateway-events#ready) event which indicates that your app is in a successfully-connected state with the Gateway. The Ready event is sent as a standard [Dispatch (opcode `0`)](/developers/docs/topics/opcodes-and-status-codes#gateway-gateway-opcodes). -:::warn + Clients are limited to 1000 `IDENTIFY` calls to the websocket in a 24-hour period. This limit is global and across all shards, but does not include `RESUME` calls. Upon hitting this limit, all active sessions for the app will be terminated, the bot token will be reset, and the owner will receive an email notification. It's up to the owner to update their application with the new token. -::: + + ###### Example Identify Payload Below is a minimal `IDENTIFY` payload. `IDENTIFY` supports additional fields for other session properties like payload compression and an initial presence state. -See the [Identify Structure](/docs/events/gateway-events#identify-identify-structure) for details about the event. +See the [Identify Structure](/developers/docs/events/gateway-events#identify-identify-structure) for details about the event. ```json { @@ -207,13 +216,13 @@ See the [Identify Structure](/docs/events/gateway-events#identify-identify-struc #### Ready event -As mentioned above, the [Ready](/docs/events/gateway-events#ready) event is sent to your app after it sends a valid Identify payload. The Ready event includes state, like the guilds your app is in, that it needs to start interacting with the rest of the platform. +As mentioned above, the [Ready](/developers/docs/events/gateway-events#ready) event is sent to your app after it sends a valid Identify payload. The Ready event includes state, like the guilds your app is in, that it needs to start interacting with the rest of the platform. -The Ready event also includes fields that you'll need to cache in order to eventually [Resume](/docs/events/gateway#resuming) your connection after disconnects. Two fields in particular are important to call out: -- `resume_gateway_url` is a WebSocket URL that your app should use when it Resumes after a disconnect. The `resume_gateway_url` should be used instead of the URL [used when connecting](/docs/events/gateway#connecting). +The Ready event also includes fields that you'll need to cache in order to eventually [Resume](/developers/docs/events/gateway#resuming) your connection after disconnects. Two fields in particular are important to call out: +- `resume_gateway_url` is a WebSocket URL that your app should use when it Resumes after a disconnect. The `resume_gateway_url` should be used instead of the URL [used when connecting](/developers/docs/events/gateway#connecting). - `session_id` is the ID for the Gateway session for the new connection. It's required to know which stream of events were associated with your disconnection connection. -Full details about the Ready event is in the [Gateway events documentation](/docs/events/gateway-events). +Full details about the Ready event is in the [Gateway events documentation](/developers/docs/events/gateway-events). ### Disconnecting @@ -221,20 +230,20 @@ Gateway disconnects happen for a variety of reasons, and may be initiated by Dis #### Handling a Disconnect -Due to Discord's architecture, disconnects are a semi-regular event and should be expected and handled. When your app encounters a disconnect, it will typically be sent a [close code](/docs/topics/opcodes-and-status-codes#gateway-gateway-close-event-codes) which can be used to determine whether you can reconnect and [Resume](/docs/events/gateway#resuming) the session, or whether you have to start over and re-Identify. +Due to Discord's architecture, disconnects are a semi-regular event and should be expected and handled. When your app encounters a disconnect, it will typically be sent a [close code](/developers/docs/topics/opcodes-and-status-codes#gateway-gateway-close-event-codes) which can be used to determine whether you can reconnect and [Resume](/developers/docs/events/gateway#resuming) the session, or whether you have to start over and re-Identify. After you determine whether or not your app can reconnect, you will do one of the following: -- If you determine that your app *can* reconnect and resume the previous session, then you should reconnect using the `resume_gateway_url` and `session_id` from the [Ready](/docs/events/gateway-events#ready) event. Details about when and how to resume can be found in the [Resuming](/docs/events/gateway#resuming) section. -- If you *cannot* reconnect **or the reconnect fails**, you should open a new connection using the URL from the initial call to [Get Gateway](/docs/events/gateway#get-gateway) or [Get Gateway Bot](/docs/events/gateway#get-gateway-bot). In the case you cannot reconnect, you'll have to re-identify after opening a new connection. +- If you determine that your app *can* reconnect and resume the previous session, then you should reconnect using the `resume_gateway_url` and `session_id` from the [Ready](/developers/docs/events/gateway-events#ready) event. Details about when and how to resume can be found in the [Resuming](/developers/docs/events/gateway#resuming) section. +- If you *cannot* reconnect **or the reconnect fails**, you should open a new connection using the URL from the initial call to [Get Gateway](/developers/docs/events/gateway#get-gateway) or [Get Gateway Bot](/developers/docs/events/gateway#get-gateway-bot). In the case you cannot reconnect, you'll have to re-identify after opening a new connection. -A full list of the close codes can be found in the [Response Codes](/docs/topics/opcodes-and-status-codes#gateway-gateway-close-event-codes) documentation. +A full list of the close codes can be found in the [Response Codes](/developers/docs/topics/opcodes-and-status-codes#gateway-gateway-close-event-codes) documentation. #### Initiating a Disconnect When you close the connection to the gateway with close code `1000` or `1001`, your session will be invalidated and your bot will appear offline. -If you simply close the TCP connection or use a different close code, the session will remain active and timeout after a few minutes. This can be useful when you're [Resuming](/docs/events/gateway#resuming) the previous session. +If you simply close the TCP connection or use a different close code, the session will remain active and timeout after a few minutes. This can be useful when you're [Resuming](/developers/docs/events/gateway#resuming) the previous session. ### Resuming @@ -242,29 +251,30 @@ When your app is disconnected, Discord has a process for reconnecting and resumi There are a handful of scenarios when your app should attempt to resume: -1. It receives a [Reconnect (opcode `7`)](/docs/events/gateway-events#reconnect) event -2. It's disconnected with a close code that indicates it can reconnect. A list of close codes is in the [Opcodes and Status Codes](/docs/topics/opcodes-and-status-codes#gateway-gateway-close-event-codes) documentation. +1. It receives a [Reconnect (opcode `7`)](/developers/docs/events/gateway-events#reconnect) event +2. It's disconnected with a close code that indicates it can reconnect. A list of close codes is in the [Opcodes and Status Codes](/developers/docs/topics/opcodes-and-status-codes#gateway-gateway-close-event-codes) documentation. 3. It's disconnected but doesn't receive *any* close code. -4. It receives an [Invalid Session (opcode `9`)](/docs/events/gateway-events#invalid-session) event with the `d` field set to `true`. This is an unlikely scenario, but it is possible. +4. It receives an [Invalid Session (opcode `9`)](/developers/docs/events/gateway-events#invalid-session) event with the `d` field set to `true`. This is an unlikely scenario, but it is possible. #### Preparing to Resume -Before your app can send a [Resume (opcode `6`)](/docs/events/gateway-events#resume) event, it will need three values: the `session_id` and the `resume_gateway_url` from the [Ready](/docs/events/gateway#ready-event) event, and the sequence number (`s`) from the last Dispatch (opcode `0`) event it received before the disconnect. +Before your app can send a [Resume (opcode `6`)](/developers/docs/events/gateway-events#resume) event, it will need three values: the `session_id` and the `resume_gateway_url` from the [Ready](/developers/docs/events/gateway#ready-event) event, and the sequence number (`s`) from the last Dispatch (opcode `0`) event it received before the disconnect. -After the connection is closed, your app should open a new connection using `resume_gateway_url` rather than the URL used to initially connect, with the same query parameters from the initial [Connection](/docs/events/gateway#connecting). If your app doesn't use the `resume_gateway_url` when reconnecting, it will experience disconnects at a higher rate than normal. +After the connection is closed, your app should open a new connection using `resume_gateway_url` rather than the URL used to initially connect, with the same query parameters from the initial [Connection](/developers/docs/events/gateway#connecting). If your app doesn't use the `resume_gateway_url` when reconnecting, it will experience disconnects at a higher rate than normal. -Once the new connection is opened, your app should send a [Gateway Resume](/docs/events/gateway-events#resume) event using the `session_id` and sequence number mentioned above. When sending the event, `session_id` will have the same field name, but the last sequence number will be passed as `seq` in the data object (`d`). +Once the new connection is opened, your app should send a [Gateway Resume](/developers/docs/events/gateway-events#resume) event using the `session_id` and sequence number mentioned above. When sending the event, `session_id` will have the same field name, but the last sequence number will be passed as `seq` in the data object (`d`). When Resuming, you do not need to send an Identify event after opening the connection. -If successful, the Gateway will send the missed events in order, finishing with a [Resumed](/docs/events/gateway-events#resumed) event to signal event replay has finished and that all subsequent events will be new. +If successful, the Gateway will send the missed events in order, finishing with a [Resumed](/developers/docs/events/gateway-events#resumed) event to signal event replay has finished and that all subsequent events will be new. -:::info + When resuming with the `resume_gateway_url` you need to provide the same version and encoding as the initial connection. -::: + -It's possible your app won't reconnect in time to Resume, in which case it will receive an [Invalid Session (opcode `9`)](/docs/events/gateway-events#invalid-session) event. If the `d` field is set to `false` (which is most of the time), your app should disconnect. After disconnect, your app should create a new connection with your cached URL from the [Get Gateway](/docs/events/gateway#get-gateway) or the [Get Gateway Bot](/docs/events/gateway#get-gateway-bot) endpoint, then send an [Identify (opcode `2`)](/docs/events/gateway-events#identify) event. +It's possible your app won't reconnect in time to Resume, in which case it will receive an [Invalid Session (opcode `9`)](/developers/docs/events/gateway-events#invalid-session) event. If the `d` field is set to `false` (which is most of the time), your app should disconnect. After disconnect, your app should create a new connection with your cached URL from the [Get Gateway](/developers/docs/events/gateway#get-gateway) or the [Get Gateway Bot](/developers/docs/events/gateway#get-gateway-bot) endpoint, then send an [Identify (opcode `2`)](/developers/docs/events/gateway-events#identify) event. + ###### Example Gateway Resume Event ```json @@ -282,24 +292,24 @@ It's possible your app won't reconnect in time to Resume, in which case it will Maintaining a stateful application can be difficult when it comes to the amount of data your app is expected to process over a Gateway connection, especially at scale. Gateway intents are a system to help you lower the computational burden. -Intents are bitwise values passed in the `intents` parameter when [Identifying](/docs/events/gateway#identifying) which correlate to a set of related events. For example, the event sent when a guild is created (`GUILD_CREATE`) and when a channel is updated (`CHANNEL_UPDATE`) both require the same `GUILDS (1 << 0)` intent (as listed in the table below). If you do not specify an intent when identifying, you will not receive *any* of the Gateway events associated with that intent. +Intents are bitwise values passed in the `intents` parameter when [Identifying](/developers/docs/events/gateway#identifying) which correlate to a set of related events. For example, the event sent when a guild is created (`GUILD_CREATE`) and when a channel is updated (`CHANNEL_UPDATE`) both require the same `GUILDS (1 << 0)` intent (as listed in the table below). If you do not specify an intent when identifying, you will not receive *any* of the Gateway events associated with that intent. -:::info + Intents are optionally supported on the v6 gateway but required as of v8 -::: + Two types of intents exist: - **Standard intents** can be passed by default. You don't need any additional permissions or configurations. -- [**Privileged intents**](/docs/events/gateway#privileged-intents) require you to toggle the intent for your app in your app's settings within the Developer Portal before passing said intent. For verified apps (required for apps in 100+ guilds), the intent must also be approved after the verification process to use the intent. More information about privileged intents can be found [in the section below](/docs/events/gateway#privileged-intents). +- [**Privileged intents**](/developers/docs/events/gateway#privileged-intents) require you to toggle the intent for your app in your app's settings within the Developer Portal before passing said intent. For verified apps (required for apps in 100+ guilds), the intent must also be approved after the verification process to use the intent. More information about privileged intents can be found [in the section below](/developers/docs/events/gateway#privileged-intents). -The connection with your app will be closed if it passes invalid intents ([`4013` close code](/docs/topics/opcodes-and-status-codes#gateway-gateway-close-event-codes)), or a privileged intent that hasn't been configured or approved for your app ([`4014` close code](/docs/topics/opcodes-and-status-codes#gateway-gateway-close-event-codes)). +The connection with your app will be closed if it passes invalid intents ([`4013` close code](/developers/docs/topics/opcodes-and-status-codes#gateway-gateway-close-event-codes)), or a privileged intent that hasn't been configured or approved for your app ([`4014` close code](/developers/docs/topics/opcodes-and-status-codes#gateway-gateway-close-event-codes)). ### List of Intents Below is a list of all intents and the Gateway events associated with them. Any events *not* listed means it's not associated with an intent and will always be sent to your app. -All events, including those that aren't associated with an intent, are in the [Gateway events](/docs/events/gateway-events) documentation. +All events, including those that aren't associated with an intent, are in the [Gateway events](/developers/docs/events/gateway-events) documentation. ``` GUILDS (1 << 0) @@ -418,19 +428,19 @@ DIRECT_MESSAGE_POLLS (1 << 25) - MESSAGE_POLL_VOTE_REMOVE ``` -\* [Thread Members Update](/docs/events/gateway-events#thread-members-update) contains different data depending on which intents are used. +\* [Thread Members Update](/developers/docs/events/gateway-events#thread-members-update) contains different data depending on which intents are used. \*\* Events under the `GUILD_PRESENCES` and `GUILD_MEMBERS` intents are turned **off by default on all API versions**. If you are using **API v6**, you will receive those events if you are authorized to receive them and have enabled the intents in the Developer Portal. You do not need to use intents on API v6 to receive these events; you just need to enable the flags. If you are using **API v8** or above, intents are mandatory and must be specified when identifying. -\*\*\* `MESSAGE_CONTENT` does not represent individual events, but rather affects what data is present for events that could contain message content fields. More information is in the [message content intent](/docs/events/gateway#message-content-intent) section. +\*\*\* `MESSAGE_CONTENT` does not represent individual events, but rather affects what data is present for events that could contain message content fields. More information is in the [message content intent](/developers/docs/events/gateway#message-content-intent) section. ### Caveats -[Guild Member Update](/docs/events/gateway-events#guild-member-update) is sent for current-user updates regardless of whether the `GUILD_MEMBERS` intent is set. +[Guild Member Update](/developers/docs/events/gateway-events#guild-member-update) is sent for current-user updates regardless of whether the `GUILD_MEMBERS` intent is set. -[Guild Create](/docs/events/gateway-events#guild-create) and [Request Guild Members](/docs/events/gateway-events#request-guild-members) are uniquely affected by intents. See these sections for more information. +[Guild Create](/developers/docs/events/gateway-events#guild-create) and [Request Guild Members](/developers/docs/events/gateway-events#request-guild-members) are uniquely affected by intents. See these sections for more information. -[Thread Members Update](/docs/events/gateway-events#thread-members-update) by default only includes if the current user was added to or removed from a thread. To receive these updates for other users, request the `GUILD_MEMBERS` [Gateway Intent](/docs/events/gateway#gateway-intents). +[Thread Members Update](/developers/docs/events/gateway-events#thread-members-update) by default only includes if the current user was added to or removed from a thread. To receive these updates for other users, request the `GUILD_MEMBERS` [Gateway Intent](/developers/docs/events/gateway#gateway-intents). ### Privileged Intents @@ -438,17 +448,17 @@ Some intents are defined as "privileged" due to the sensitive nature of the data - `GUILD_PRESENCES` - `GUILD_MEMBERS` -- [`MESSAGE_CONTENT`](/docs/events/gateway#message-content-intent) +- [`MESSAGE_CONTENT`](/developers/docs/events/gateway#message-content-intent) Apps that qualify for verification **must** be approved for the privileged intent(s) before they can use them. After your app is verified, you can request privileged intents within the app's settings within the Developer Portal. Before you specify privileged intents in your `IDENTIFY` payload, you must enable the privileged intents your app requires. [Verified apps](https://support-dev.discord.com/hc/en-us/articles/23926564536471-How-Do-I-Get-My-App-Verified) can only use privileged intents *after* they've been approved for them. -:::info + Unverified apps can use privileged intents without approval, but still must enable them in their app's settings. If the app's verification status changes, it will then have to apply for the privileged intent(s). -::: + -In addition to the gateway restrictions described here, Discord's REST API is also affected by Privileged Intents. For example, to use the [List Guild Members](/docs/resources/guild#list-guild-members) endpoint, you must have the `GUILD_MEMBERS` intent enabled for your application. This behavior is independent of whether the intent is set during `IDENTIFY`. +In addition to the gateway restrictions described here, Discord's REST API is also affected by Privileged Intents. For example, to use the [List Guild Members](/developers/docs/resources/guild#list-guild-members) endpoint, you must have the `GUILD_MEMBERS` intent enabled for your application. This behavior is independent of whether the intent is set during `IDENTIFY`. #### Enabling Privileged Intents @@ -458,17 +468,17 @@ If your app qualifies for [verification](https://support-dev.discord.com/hc/en-u #### Gateway Restrictions -Privileged intents affect which Gateway events your app is permitted to receive. When using **API v8** and above, all intents (privileged and not) must be specified in the `intents` parameter when Identifying. If you pass a privileged intent in the `intents` parameter without configuring it in your app's settings, or being approved for it during verification, your Gateway connection will be closed with a ([`4014` close code](/docs/topics/opcodes-and-status-codes#gateway-gateway-close-event-codes)). +Privileged intents affect which Gateway events your app is permitted to receive. When using **API v8** and above, all intents (privileged and not) must be specified in the `intents` parameter when Identifying. If you pass a privileged intent in the `intents` parameter without configuring it in your app's settings, or being approved for it during verification, your Gateway connection will be closed with a ([`4014` close code](/developers/docs/topics/opcodes-and-status-codes#gateway-gateway-close-event-codes)). -:::info + For **API v6**, you will receive events associated with the privileged intents your app has configured and is authorized to receive *without* passing those intents into the `intents` parameter when Identifying. -::: + Events associated with the `GUILD_PRESENCES` and `GUILD_MEMBERS` intents are turned off by default regardless of the API version. #### HTTP Restrictions -In addition to Gateway restrictions, privileged intents also affect the [HTTP API](/docs/reference#http-api) endpoints your app is permitted to call, and the data it can receive. For example, to use the [List Guild Members](/docs/resources/guild#list-guild-members) endpoint, your app must enable the `GUILD_MEMBERS` intent (and be approved for it if eligible for verification). +In addition to Gateway restrictions, privileged intents also affect the [HTTP API](/developers/docs/reference#http-api) endpoints your app is permitted to call, and the data it can receive. For example, to use the [List Guild Members](/developers/docs/resources/guild#list-guild-members) endpoint, your app must enable the `GUILD_MEMBERS` intent (and be approved for it if eligible for verification). HTTP API restrictions are independent of Gateway restrictions, and are unaffected by which intents your app passes in the `intents` parameter when Identifying. @@ -476,51 +486,51 @@ HTTP API restrictions are independent of Gateway restrictions, and are unaffecte `MESSAGE_CONTENT (1 << 15)` is a unique privileged intent that isn't directly associated with any Gateway events. Instead, access to `MESSAGE_CONTENT` permits your app to receive message content data across the APIs. -Any fields affected by the message content intent are noted in the relevant documentation. For example, the `content`, `embeds`, `attachments`, `components`, and `poll` fields in [message objects](/docs/resources/message#message-object) all contain message content and therefore require the intent. +Any fields affected by the message content intent are noted in the relevant documentation. For example, the `content`, `embeds`, `attachments`, `components`, and `poll` fields in [message objects](/developers/docs/resources/message#message-object) all contain message content and therefore require the intent. -:::info + Like other privileged intents, `MESSAGE_CONTENT` must be approved for your app. After your app is verified, you can apply for the intent from your app's settings within the Developer Portal. You can read more about the message content intent review policy [in the Help Center](https://support-dev.discord.com/hc/en-us/articles/5324827539479). -::: + Apps **without** the intent will receive empty values in fields that contain user-inputted content with a few exceptions: - Content in messages that an app sends - Content in DMs with the app -- Content in which the app is [mentioned](/docs/reference#message-formatting-formats) -- Content of the message a [message context menu command](/docs/interactions/application-commands#message-commands) is used on +- Content in which the app is [mentioned](/developers/docs/reference#message-formatting-formats) +- Content of the message a [message context menu command](/developers/docs/interactions/application-commands#message-commands) is used on ## Rate Limiting -:::info -This section refers to Gateway rate limits, not [HTTP API rate limits](/docs/topics/rate-limits) -::: + +This section refers to Gateway rate limits, not [HTTP API rate limits](/developers/docs/topics/rate-limits) + -Apps can send 120 [gateway events](/docs/events/gateway-events) per [connection](/docs/events/gateway#connections) every 60 seconds, meaning an average of 2 commands per second. Apps that surpass the limit are immediately disconnected from the Gateway. Similar to other rate limits, repeat offenders will have their API access revoked. +Apps can send 120 [gateway events](/developers/docs/events/gateway-events) per [connection](/developers/docs/events/gateway#connections) every 60 seconds, meaning an average of 2 commands per second. Apps that surpass the limit are immediately disconnected from the Gateway. Similar to other rate limits, repeat offenders will have their API access revoked. -Apps also have a limit for [concurrent](/docs/events/gateway#session-start-limit-object) [Identify](/docs/events/gateway#identifying) requests allowed per 5 seconds. If you hit this limit, the Gateway will respond with an [Invalid Session (opcode `9`)](/docs/events/gateway-events#invalid-session). +Apps also have a limit for [concurrent](/developers/docs/events/gateway#session-start-limit-object) [Identify](/developers/docs/events/gateway#identifying) requests allowed per 5 seconds. If you hit this limit, the Gateway will respond with an [Invalid Session (opcode `9`)](/developers/docs/events/gateway-events#invalid-session). ## Encoding and Compression -When [establishing a connection](/docs/events/gateway#connecting) to the Gateway, apps can use the `encoding` parameter to choose whether to communicate with Discord using a plain-text JSON or binary [ETF](https://erlang.org/doc/apps/erts/erl_ext_dist.html) encoding. You can pick whichever encoding type you're more comfortable with, but both have their own quirks. If you aren't sure which encoding to use, JSON is generally recommended. +When [establishing a connection](/developers/docs/events/gateway#connecting) to the Gateway, apps can use the `encoding` parameter to choose whether to communicate with Discord using a plain-text JSON or binary [ETF](https://erlang.org/doc/apps/erts/erl_ext_dist.html) encoding. You can pick whichever encoding type you're more comfortable with, but both have their own quirks. If you aren't sure which encoding to use, JSON is generally recommended. -Apps can also optionally enable compression to receive zlib-compressed or zstd-compressed packets. [Payload compression](/docs/events/gateway#payload-compression) can only be enabled when using a JSON encoding, but [transport compression](/docs/events/gateway#transport-compression) can be used regardless of encoding type. +Apps can also optionally enable compression to receive zlib-compressed or zstd-compressed packets. [Payload compression](/developers/docs/events/gateway#payload-compression) can only be enabled when using a JSON encoding, but [transport compression](/developers/docs/events/gateway#transport-compression) can be used regardless of encoding type. ### Using JSON Encoding -When using the plain-text JSON encoding, apps have the option to enable [payload compression](/docs/events/gateway#payload-compression). +When using the plain-text JSON encoding, apps have the option to enable [payload compression](/developers/docs/events/gateway#payload-compression). #### Payload Compression -:::warn -If an app is using payload compression, it cannot use [transport compression](/docs/events/gateway#transport-compression). -::: + +If an app is using payload compression, it cannot use [transport compression](/developers/docs/events/gateway#transport-compression). + Payload compression enables optional per-packet compression for *some* events when Discord is sending events over the connection. -Payload compression uses the zlib format (see [RFC1950 2.2](https://tools.ietf.org/html/rfc1950#section-2.2)) when sending payloads. To enable payload compression, your app can set `compress` to `true` when sending an [Identify (opcode `2`)](/docs/events/gateway-events#identify) event. Note that even when payload compression is enabled, not all payloads will be compressed. +Payload compression uses the zlib format (see [RFC1950 2.2](https://tools.ietf.org/html/rfc1950#section-2.2)) when sending payloads. To enable payload compression, your app can set `compress` to `true` when sending an [Identify (opcode `2`)](/developers/docs/events/gateway-events#identify) event. Note that even when payload compression is enabled, not all payloads will be compressed. When payload compression is enabled, your app (or library) _must_ detect and decompress these payloads to plain-text JSON before attempting to parse them. If you are using payload compression, the gateway does not implement a shared compression context between events sent. -Payload compression will be disabled if you use [transport compression](/docs/events/gateway#transport-compression). +Payload compression will be disabled if you use [transport compression](/developers/docs/events/gateway#transport-compression). ### Using ETF Encoding @@ -528,7 +538,7 @@ When using ETF (External Term Format) encoding, there are some specific behavior - Snowflake IDs are transmitted as 64-bit integers or strings. - Your app can't send compressed messages to the server. -- When sending payloads, you must use string keys. Using atom keys will result in a [`4002`](/docs/topics/opcodes-and-status-codes#gateway-gateway-close-event-codes) decode error. +- When sending payloads, you must use string keys. Using atom keys will result in a [`4002`](/developers/docs/topics/opcodes-and-status-codes#gateway-gateway-close-event-codes) decode error. See [erlpack](https://github.com/discord/erlpack) for an ETF implementation example. @@ -542,6 +552,7 @@ When zlib transport compression is enabled, your app needs to process received d When processing transport-compressed data, you should push received data to a buffer until you receive the 4-byte `Z_SYNC_FLUSH` suffix (`00 00 ff ff`). After you receive the `Z_SYNC_FLUSH` suffix, you can then decompress the buffer. + ###### Transport Compression Example ```python @@ -579,36 +590,37 @@ When processing data, each websocket message corresponds to a single gateway mes ## Tracking State -Most of a client's state is provided during the initial [Ready](/docs/events/gateway#ready-event) event and in the [Guild Create](/docs/events/gateway-events#guild-create) events that follow. +Most of a client's state is provided during the initial [Ready](/developers/docs/events/gateway#ready-event) event and in the [Guild Create](/developers/docs/events/gateway-events#guild-create) events that follow. As resources continue to be created, updated, and deleted, Gateway events are sent to notify the app of these changes and to provide associated data. To avoid excessive API calls, apps should cache as many relevant resource states as possible, and update them as new events are received. -:::info -For larger apps, client state can grow to be very large. Therefore, we recommend only storing data in memory that are *needed* for the app to operate. In some cases, there isn't a need to cache member information (like roles or permissions) since some events like [MESSAGE_CREATE](/docs/events/gateway-events#message-create) have the full member object included. -::: + +For larger apps, client state can grow to be very large. Therefore, we recommend only storing data in memory that are *needed* for the app to operate. In some cases, there isn't a need to cache member information (like roles or permissions) since some events like [MESSAGE_CREATE](/developers/docs/events/gateway-events#message-create) have the full member object included. + -An example of state tracking can be considered in the case of an app that wants to track member status: when initially connecting to the Gateway, the app will receive information about the online status of guild members (whether they're online, idle, dnd, or offline). To keep the state updated, the app will track and parse [Presence Update](/docs/events/gateway-events#presence-update) events as they're received, then update the cached member objects accordingly. +An example of state tracking can be considered in the case of an app that wants to track member status: when initially connecting to the Gateway, the app will receive information about the online status of guild members (whether they're online, idle, dnd, or offline). To keep the state updated, the app will track and parse [Presence Update](/developers/docs/events/gateway-events#presence-update) events as they're received, then update the cached member objects accordingly. ## Guild Availability -When connecting to the gateway as a bot user, guilds that the bot is a part of will start out as unavailable. Don't fret! The gateway will automatically attempt to reconnect on your behalf. As guilds become available to you, you will receive [Guild Create](/docs/events/gateway-events#guild-create) events. +When connecting to the gateway as a bot user, guilds that the bot is a part of will start out as unavailable. Don't fret! The gateway will automatically attempt to reconnect on your behalf. As guilds become available to you, you will receive [Guild Create](/developers/docs/events/gateway-events#guild-create) events. ## Sharding As apps grow and are added to an increasing number of guilds, some developers may find it necessary to divide portions of their app's operations across multiple processes. As such, the Gateway implements a method of user-controlled guild sharding which allows apps to split events across a number of Gateway connections. Guild sharding is entirely controlled by an app, and requires no state-sharing between separate connections to operate. While all apps *can* enable sharding, it's not necessary for apps in a smaller number of guilds. -:::warn -Each shard can only support a maximum of 2500 guilds, and apps that are in 2500+ guilds *must* enable sharding. -::: + +Each shard can only support a maximum of 2500 guilds, and apps that are in 2500+ guilds *must* enable sharding. + -To enable sharding on a connection, the app should send the `shard` array in the [Identify](/docs/events/gateway-events#identify) payload. The first item in this array should be the zero-based integer value of the current shard, while the second represents the total number of shards. +To enable sharding on a connection, the app should send the `shard` array in the [Identify](/developers/docs/events/gateway-events#identify) payload. The first item in this array should be the zero-based integer value of the current shard, while the second represents the total number of shards. -:::info -The [Get Gateway Bot](/docs/events/gateway#get-gateway-bot) endpoint provides a recommended number of shards for your app in the `shards` field -::: + +The [Get Gateway Bot](/developers/docs/events/gateway#get-gateway-bot) endpoint provides a recommended number of shards for your app in the `shards` field + To calculate which events will be sent to which shard, the following formula can be used: + ###### Sharding Formula ```python @@ -617,15 +629,16 @@ shard_id = (guild_id >> 22) % num_shards As an example, if you wanted to split the connection between three shards, you'd use the following values for `shard` for each connection: `[0, 3]`, `[1, 3]`, and `[2, 3]`. -:::info + Gateway events that do not contain a `guild_id` will only be sent to the first shard (`shard_id: 0`). This includes Direct Message (DM), subscription and entitlement events. -::: + Note that `num_shards` does not relate to (or limit) the total number of potential sessions. It is only used for *routing* traffic. As such, sessions do not have to be identified in an evenly-distributed manner when sharding. You can establish multiple sessions with the same `[shard_id, num_shards]`, or sessions with different `num_shards` values. This allows you to create sessions that will handle more or less traffic for more fine-tuned load balancing, or to orchestrate "zero-downtime" scaling/updating by handing off traffic to a new deployment of sessions with a higher or lower `num_shards` count that are prepared in parallel. + ###### Max Concurrency -If you have multiple shards, you may start them concurrently based on the [`max_concurrency`](/docs/events/gateway#session-start-limit-object) value returned to you on session start. Which shards you can start concurrently are assigned based on a key for each shard. The rate limit key for a given shard can be computed with +If you have multiple shards, you may start them concurrently based on the [`max_concurrency`](/developers/docs/events/gateway#session-start-limit-object) value returned to you on session start. Which shards you can start concurrently are assigned based on a key for each shard. The rate limit key for a given shard can be computed with ``` rate_limit_key = shard_id % max_concurrency @@ -697,19 +710,20 @@ If your bot is in more than 150,000 guilds, there are some additional considerat The number of shards you run must be a multiple of the shard number provided when reaching out to you. If you attempt to start your bot with an invalid number of shards, your Gateway connection will close with a `4010` Invalid Shard close code. -The [Get Gateway Bot endpoint](/docs/events/gateway#get-gateway-bot) will always return the correct amount of shards, so if you're already using this endpoint to determine your number of shards, you shouldn't require any changes. +The [Get Gateway Bot endpoint](/developers/docs/events/gateway#get-gateway-bot) will always return the correct amount of shards, so if you're already using this endpoint to determine your number of shards, you shouldn't require any changes. -The session start limit for these bots will also be increased from 1000 to `max(2000, (guild_count / 1000) * 5)` per day. You also receive an increased `max_concurrency`, the number of [shards you can concurrently start](/docs/events/gateway#session-start-limit-object). +The session start limit for these bots will also be increased from 1000 to `max(2000, (guild_count / 1000) * 5)` per day. You also receive an increased `max_concurrency`, the number of [shards you can concurrently start](/developers/docs/events/gateway#session-start-limit-object). ## Get Gateway /gateway -:::info + This endpoint does not require authentication. -::: + -Returns an object with a valid WSS URL which the app can use when [Connecting](/docs/events/gateway#connecting) to the Gateway. Apps should cache this value and only call this endpoint to retrieve a new URL when they are unable to properly establish a connection using the cached one. +Returns an object with a valid WSS URL which the app can use when [Connecting](/developers/docs/events/gateway#connecting) to the Gateway. Apps should cache this value and only call this endpoint to retrieve a new URL when they are unable to properly establish a connection using the cached one. + ###### Example Response ```json @@ -721,20 +735,22 @@ Returns an object with a valid WSS URL which the app can use when [Connecting](/ ## Get Gateway Bot /gateway/bot -:::warn + This endpoint requires authentication using a valid bot token. -::: + -Returns an object based on the information in [Get Gateway](/docs/events/gateway#get-gateway), plus additional metadata that can help during the operation of large or [sharded](/docs/events/gateway#sharding) bots. Unlike the [Get Gateway](/docs/events/gateway#get-gateway), this route should not be cached for extended periods of time as the value is not guaranteed to be the same per-call, and changes as the bot joins/leaves guilds. +Returns an object based on the information in [Get Gateway](/developers/docs/events/gateway#get-gateway), plus additional metadata that can help during the operation of large or [sharded](/developers/docs/events/gateway#sharding) bots. Unlike the [Get Gateway](/developers/docs/events/gateway#get-gateway), this route should not be cached for extended periods of time as the value is not guaranteed to be the same per-call, and changes as the bot joins/leaves guilds. + ###### JSON Response -| Field | Type | Description | -|---------------------|-------------------------------------------------------------------------------|--------------------------------------------------------------------------------------| -| url | string | WSS URL that can be used for connecting to the Gateway | -| shards | integer | Recommended number of [shards](/docs/events/gateway#sharding) to use when connecting | -| session_start_limit | [session_start_limit](/docs/events/gateway#session-start-limit-object) object | Information on the current session start limit | +| Field | Type | Description | +|---------------------|------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------| +| url | string | WSS URL that can be used for connecting to the Gateway | +| shards | integer | Recommended number of [shards](/developers/docs/events/gateway#sharding) to use when connecting | +| session_start_limit | [session_start_limit](/developers/docs/events/gateway#session-start-limit-object) object | Information on the current session start limit | + ###### Example Response ```json @@ -752,6 +768,7 @@ Returns an object based on the information in [Get Gateway](/docs/events/gateway ## Session Start Limit Object + ###### Session Start Limit Structure | Field | Type | Description | diff --git a/discord/developers/docs/events/overview.mdx b/discord/developers/docs/events/overview.mdx new file mode 100644 index 0000000000..42e12e880e --- /dev/null +++ b/discord/developers/docs/events/overview.mdx @@ -0,0 +1,53 @@ +--- +title: Overview of Events +sidebarTitle: Overview +description: Learn about the different ways apps can receive events from Discord. +--- + +Apps can listen to events happening in Discord to stay up-to-date with changes and updates to servers, users, and even your app. The following sections cover basic information about the different transport methods that can be used to receive events, and link out to relevant documentation. + +## Receiving Events + +There are many event types that can be accessed using different transport methods: +- **[Gateway events](/developers/docs/events/overview#using-gateway)** are sent over a WebSocket connection between your app and Discord, and is the primary way to receive and send events. **Most events are only available via Gateway connections.** +- **[Webhook events](/developers/docs/events/overview#using-webhooks)** are sent to your app's Webhook Event URL over HTTP. +- **[SDK events](/developers/docs/events/overview#using-the-embedded-app-sdk)** are sent to your app when using the Embedded App SDK. + +Read details about each way to receive events in the sections below. + +### Using Gateway + +Gateway events are the primary way apps can listen and send events. Most events related to resources in Discord, like updates to channels, guilds, roles, and messages, are only available over [Gateway](/developers/docs/events/gateway). + +Gateway events are sent over a WebSocket-based [Gateway connection](/developers/docs/events/gateway#connections) between Discord and your app. To receive Gateway events, your app must open and maintain a persistent Gateway connection which you can read details about in the [Gateway documentation](/developers/docs/events/gateway#connections). To make receiving Gateway events simpler, we suggest using a [developer library](/developers/docs/developer-tools/community-resources#libraries) which helps setup, maintain, and handle common pitfalls with Gateway connections (like [rate limits](/developers/docs/events/gateway#rate-limiting)). + +Details about receiving events using the Gateway API is in the [Gateway documentation](/developers/docs/events/gateway#receiving-events), and the full list of available Gateway events is in the [Gateway Events documentation](/developers/docs/events/gateway-events). + +### Using Webhooks + +Webhook events let you receive a small number of events over HTTP. While many events aren't supported over HTTP, some events like [Application Authorized](/developers/docs/events/webhook-events#application-authorized) (sent when your app is installed to a user or server) aren't available using other transport methods like Gateway. + +Find the [list of webhook events](/developers/docs/events/webhook-events#event-types) and details about subscribing and handling them in the [Webhook Events documentation](/developers/docs/events/webhook-events). + + +### Using the Embedded App SDK + +When developing [Activities](/developers/docs/activities/overview), you can listen to a collection of [SDK events](/developers/docs/developer-tools/embedded-app-sdk#sdk-events), like updates to a user's voice status or screen orientation. To listen to SDK events, you can call [`subscribe()`](/developers/docs/developer-tools/embedded-app-sdk#subscribe) with the SDK event name. + +Details about listening to events using the Embedded App SDK is in the [Embedded App SDK documentation](/developers/docs/developer-tools/embedded-app-sdk). + +## Next Steps + + + + Gateway is the primary apps receive events on Discord. Read details about using the Gateway and receiving Gateway Events. + + + Read details about receiving and responding a small number of HTTP-based Webhook Events. + + + Read details about subscribing and receiving events specific to your Activity using the Embedded App SDK. + + + + diff --git a/docs/events/webhook-events.mdx b/discord/developers/docs/events/webhook-events.mdx similarity index 55% rename from docs/events/webhook-events.mdx rename to discord/developers/docs/events/webhook-events.mdx index 0bab602f5f..182a9f8f51 100644 --- a/docs/events/webhook-events.mdx +++ b/discord/developers/docs/events/webhook-events.mdx @@ -1,26 +1,27 @@ --- -sidebar_label: Webhook Events +title: Webhook Events +description: Learn how to receive Discord events over HTTP using webhooks. --- -# Webhook Events +import {ManualAnchor} from '/snippets/manualanchor.jsx' -Webhook events are one-way events sent to your app over HTTP to notify you when an event occured. Unlike events that are [sent over Gateway connections](/docs/events/gateway), events sent over webhooks are not realtime or guaranteed to be in order. +Webhook events are one-way events sent to your app over HTTP to notify you when an event occurred. Unlike events that are [sent over Gateway connections](/developers/docs/events/gateway), events sent over webhooks are not realtime or guaranteed to be in order. -While [incoming webhooks](/docs/resources/webhook) are triggered by an external service, webhook events (i.e. outgoing webhooks) are triggered by events happening in Discord. This means your app will need to set up a public URL where you can receive HTTP events, which is detailed in the [preparing for events](/docs/events/webhook-events#preparing-for-events) section. +While [incoming webhooks](/developers/docs/resources/webhook) are triggered by an external service, webhook events (i.e. outgoing webhooks) are triggered by events happening in Discord. This means your app will need to set up a public URL where you can receive HTTP events, which is detailed in the [preparing for events](/developers/docs/events/webhook-events#preparing-for-events) section. ## Subscribing to Events To configure webhook events, you'll need to configure your URL and select the events you want your app to receive. -:::info -The steps below walk through subscribing using the developer portal. If you prefer to use the API, you can call [Edit Current Application](/docs/resources/application#edit-current-application). -::: + +The steps below walk through subscribing using the developer portal. If you prefer to use the API, you can call [Edit Current Application](/developers/docs/resources/application#edit-current-application). + In your [app's settings](https://discord.com/developers/applications), navigate to the **Webhooks** page from the left-hand sidebar then complete the following: -1. Under **Endpoint**, add a public URL that is set up to receive and acknowledge webhook events. Details about setting up a Webhook Events URL is in the [preparing for events](/docs/events/webhook-events#preparing-for-events) section. +1. Under **Endpoint**, add a public URL that is set up to receive and acknowledge webhook events. Details about setting up a Webhook Events URL is in the [preparing for events](/developers/docs/events/webhook-events#preparing-for-events) section. 2. Enable Events by clicking the toggle in the **Events** section. -3. Select the [webhook events](/docs/events/webhook-events#event-types) you want your app to receive. +3. Select the [webhook events](/developers/docs/events/webhook-events#event-types) you want your app to receive. 4. Click **Save Changes**. If your URL is successfully verified, your app should begin receiving the events you selected. @@ -31,7 +32,7 @@ To receive webhook events, you'll need to configure your app's **Webhook Event U ### Configuring a Webhook Events URL -A **Webhook Events URL** is a public endpoint for your app where Discord can send your app HTTP-based events. If your app is using [Gateway events](/docs/events/gateway), you don't need to configure a Webhook Events URL. +A **Webhook Events URL** is a public endpoint for your app where Discord can send your app HTTP-based events. If your app is using [Gateway events](/developers/docs/events/gateway), you don't need to configure a Webhook Events URL. #### Setting Up an Endpoint @@ -42,15 +43,16 @@ Before you can add a Webhook Events URL to your app, your endpoint must be prepa If either of these are not complete, your Webhook Events URL will not be validated. Details on acknowledging PING events and validating security-related headers are below. + ###### Acknowledging PING requests When adding your Webhook Events URL, Discord will send a `POST` request with a `PING` payload with a `type: 0` to your endpoint. Your app is expected to acknowledge the request by returning a `204` response with an empty body. -:::info -You must provide a valid `Content-Type` when responding to `PING`s. See [here](/docs/reference#http-api) for further information. -::: + +You must provide a valid `Content-Type` when responding to `PING`s. See [here](/developers/docs/reference#http-api) for further information. + - + To properly acknowledge a `PING` payload, return a `204` response with no body: ```py @@ -59,8 +61,9 @@ def my_command(): if request.json["type"] == 0: return Response(status=204) ``` - + + ###### Validating Security Request Headers To receive events via HTTP, there are some security steps you **must** take before your app is eligible to receive requests. @@ -70,11 +73,11 @@ Each webhook is sent with the following headers: - `X-Signature-Ed25519` as a signature - `X-Signature-Timestamp` as a timestamp -Using your favorite security library, you **must validate the request each time you receive an event**. If the signature fails validation, your app should respond with a `401` error code. Code examples of validating security headers is in the [Interactions documentation](/docs/interactions/overview#setting-up-an-endpoint-validating-security-request-headers). +Using your favorite security library, you **must validate the request each time you receive an event**. If the signature fails validation, your app should respond with a `401` error code. Code examples of validating security headers is in the [Interactions documentation](/developers/docs/interactions/overview#setting-up-an-endpoint-validating-security-request-headers). In addition to ensuring your app validates security-related request headers at the time of saving your endpoint, Discord will also perform automated, routine security checks against your endpoint, including purposefully sending you invalid signatures. If you fail the validation, we will remove your Webhook Events URL and alert you via email and System DM. -We recommend checking out our [Community Resources](/docs/developer-tools/community-resources) and the libraries found there. +We recommend checking out our [Community Resources](/developers/docs/developer-tools/community-resources) and the libraries found there. #### Adding an Webhook Events Endpoint URL @@ -82,7 +85,7 @@ After you have a public endpoint to use as your app's Event Webhooks URL, you ca On the **Webhooks** page, look for the **Endpoint URL** field. Paste your public URL that is set up to acknowledge `PING` messages and correctly handles security-related signature headers. -After you configure your Webhook Events URL, you can [enable and subscribe to events](/docs/events/webhook-events#subscribing-to-events) on the same page. +After you configure your Webhook Events URL, you can [enable and subscribe to events](/developers/docs/events/webhook-events#subscribing-to-events) on the same page. ## Responding to Events @@ -99,66 +102,67 @@ Webhook events are wrapped in an outer payload, with an inner `event` object. Structure of the outer webhook payload -| Field | Type | Description | -|----------------|--------------------------------------------------------------------|----------------------------------------------------------------| -| version | integer | Version scheme for the webhook event. Currently always `1` | -| application_id | snowflake | ID of your app | -| type | [webhook type](/docs/events/webhook-events#webhook-types) | Type of webhook, either `0` for PING or `1` for webhook events | -| event? | [event body](/docs/events/webhook-events#event-body-object) object | Event data payload | +| Field | Type | Description | +|----------------|-------------------------------------------------------------------------------|----------------------------------------------------------------| +| version | integer | Version scheme for the webhook event. Currently always `1` | +| application_id | snowflake | ID of your app | +| type | [webhook type](/developers/docs/events/webhook-events#webhook-types) | Type of webhook, either `0` for PING or `1` for webhook events | +| event? | [event body](/developers/docs/events/webhook-events#event-body-object) object | Event data payload | #### Webhook Types -| Type | Value | Description | -|-------|-------|---------------------------------------------------------------------------------------------------------| -| PING | `0` | PING event sent to verify your Webhook Event URL is active | -| Event | `1` | Webhook event (details for event in [event body](/docs/events/webhook-events#event-body-object) object) | +| Type | Value | Description | +|-------|-------|--------------------------------------------------------------------------------------------------------------------| +| PING | `0` | PING event sent to verify your Webhook Event URL is active | +| Event | `1` | Webhook event (details for event in [event body](/developers/docs/events/webhook-events#event-body-object) object) | #### Event Body Object The event body contains high-level data about the event, like the type and time it was triggered. -The inner `data` object contains information specific to the [event type](/docs/events/webhook-events#event-types). +The inner `data` object contains information specific to the [event type](/developers/docs/events/webhook-events#event-types). -| Field | Type | Description | -|-----------|--------|----------------------------------------------------------------------------------------------------| -| type | string | [Event type](/docs/events/webhook-events#event-types) | -| timestamp | string | Timestamp of when the event occurred in [ISO8601 format](/docs/reference#iso8601-datetime) | -| data? | object | Data for the event. The shape depends on the [event type](/docs/events/webhook-events#event-types) | +| Field | Type | Description | +|-----------|--------|---------------------------------------------------------------------------------------------------------------| +| type | string | [Event type](/developers/docs/events/webhook-events#event-types) | +| timestamp | string | Timestamp of when the event occurred in [ISO8601 format](/developers/docs/reference#iso8601-datetime) | +| data? | object | Data for the event. The shape depends on the [event type](/developers/docs/events/webhook-events#event-types) | ## Event Types The table below includes the different webhook event types your app can subscribe to. -The "Value" column corresponds to the event's `type` field value in the [event body object](/docs/events/webhook-events#event-body-object). - -| Name | Value | Description | -|--------------------------------------------------------------------------------------|------------------------------|---------------------------------------------------------------------------| -| [Application Authorized](/docs/events/webhook-events#application-authorized) | `APPLICATION_AUTHORIZED` | Sent when an app was authorized by a user to a server or their account | -| [Application Deauthorized](/docs/events/webhook-events#application-deauthorized) | `APPLICATION_DEAUTHORIZED` | Sent when an app was deauthorized by a user | -| [Entitlement Create](/docs/events/webhook-events#entitlement-create) | `ENTITLEMENT_CREATE` | Entitlement was created | -| [Quest User Enrollment](/docs/events/webhook-events#quest-user-enrollment) | `QUEST_USER_ENROLLMENT` | User was added to a Quest (currently unavailable) | -| [Lobby Message Create](/docs/events/webhook-events#lobby-message-create) | `LOBBY_MESSAGE_CREATE` | Sent when a message is created in a lobby | -| [Lobby Message Update](/docs/events/webhook-events#lobby-message-update) | `LOBBY_MESSAGE_UPDATE` | Sent when a message is updated in a lobby | -| [Lobby Message Delete](/docs/events/webhook-events#lobby-message-delete) | `LOBBY_MESSAGE_DELETE` | Sent when a message is deleted from a lobby | -| [Game Direct Message Create](/docs/events/webhook-events#game-direct-message-create) | `GAME_DIRECT_MESSAGE_CREATE` | Sent when a direct message is created during an active Social SDK session | -| [Game Direct Message Update](/docs/events/webhook-events#game-direct-message-update) | `GAME_DIRECT_MESSAGE_UPDATE` | Sent when a direct message is updated during an active Social SDK session | -| [Game Direct Message Delete](/docs/events/webhook-events#game-direct-message-delete) | `GAME_DIRECT_MESSAGE_DELETE` | Sent when a direct message is deleted during an active Social SDK session | +The "Value" column corresponds to the event's `type` field value in the [event body object](/developers/docs/events/webhook-events#event-body-object). + +| Name | Value | Description | +|-------------------------------------------------------------------------------------------------|------------------------------|---------------------------------------------------------------------------| +| [Application Authorized](/developers/docs/events/webhook-events#application-authorized) | `APPLICATION_AUTHORIZED` | Sent when an app was authorized by a user to a server or their account | +| [Application Deauthorized](/developers/docs/events/webhook-events#application-deauthorized) | `APPLICATION_DEAUTHORIZED` | Sent when an app was deauthorized by a user | +| [Entitlement Create](/developers/docs/events/webhook-events#entitlement-create) | `ENTITLEMENT_CREATE` | Entitlement was created | +| [Quest User Enrollment](/developers/docs/events/webhook-events#quest-user-enrollment) | `QUEST_USER_ENROLLMENT` | User was added to a Quest (currently unavailable) | +| [Lobby Message Create](/developers/docs/events/webhook-events#lobby-message-create) | `LOBBY_MESSAGE_CREATE` | Sent when a message is created in a lobby | +| [Lobby Message Update](/developers/docs/events/webhook-events#lobby-message-update) | `LOBBY_MESSAGE_UPDATE` | Sent when a message is updated in a lobby | +| [Lobby Message Delete](/developers/docs/events/webhook-events#lobby-message-delete) | `LOBBY_MESSAGE_DELETE` | Sent when a message is deleted from a lobby | +| [Game Direct Message Create](/developers/docs/events/webhook-events#game-direct-message-create) | `GAME_DIRECT_MESSAGE_CREATE` | Sent when a direct message is created during an active Social SDK session | +| [Game Direct Message Update](/developers/docs/events/webhook-events#game-direct-message-update) | `GAME_DIRECT_MESSAGE_UPDATE` | Sent when a direct message is updated during an active Social SDK session | +| [Game Direct Message Delete](/developers/docs/events/webhook-events#game-direct-message-delete) | `GAME_DIRECT_MESSAGE_DELETE` | Sent when a direct message is deleted during an active Social SDK session | #### Application Authorized `APPLICATION_AUTHORIZED` is sent when the app is added to a server or user account. + ###### Application Authorized Structure -| Field | Type | Description | -|-------------------|--------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| -| integration_type? | integer | [Installation context](/docs/resources/application#application-object-application-integration-types) for the authorization. Either guild (`0`) if installed to a server or user (`1`) if installed to a user's account | -| user | [user object](/docs/resources/user#user-object-user-structure) | User who authorized the app | -| scopes | array of strings | List of [scopes](/docs/topics/oauth2#shared-resources-oauth2-scopes) the user authorized | -| guild? | [guild object](/docs/resources/guild#guild-object-guild-structure) | Server which app was authorized for (when integration type is `0`) | - +| Field | Type | Description | +|-------------------|-------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| integration_type? | integer | [Installation context](/developers/docs/resources/application#application-object-application-integration-types) for the authorization. Either guild (`0`) if installed to a server or user (`1`) if installed to a user's account | +| user | [user object](/developers/docs/resources/user#user-object-user-structure) | User who authorized the app | +| scopes | array of strings | List of [scopes](/developers/docs/topics/oauth2#shared-resources-oauth2-scopes) the user authorized | +| guild? | [guild object](/developers/docs/resources/guild#guild-object-guild-structure) | Server which app was authorized for (when integration type is `0`) | + ###### Application Authorized Example ```json @@ -186,12 +190,14 @@ The "Value" column corresponds to the event's `type` field value in the [event b `APPLICATION_DEAUTHORIZED` is sent when the app is deauthorized by a user. + ###### Application Deauthorized Structure -| Field | Type | Description | -|-------|----------------------------------------------------------------|-------------------------------| -| user | [user object](/docs/resources/user#user-object-user-structure) | User who deauthorized the app | +| Field | Type | Description | +|-------|---------------------------------------------------------------------------|-------------------------------| +| user | [user object](/developers/docs/resources/user#user-object-user-structure) | User who deauthorized the app | + ###### Application Deauthorized Example ```json @@ -213,12 +219,14 @@ The "Value" column corresponds to the event's `type` field value in the [event b #### Entitlement Create -`ENTITLEMENT_CREATE` is sent when an [entitlement](/docs/resources/entitlement) is created when a user purchases or is otherwise granted one of your app's SKUs. Refer to the [Monetization documentation](/docs/monetization/overview) for details. +`ENTITLEMENT_CREATE` is sent when an [entitlement](/developers/docs/resources/entitlement) is created when a user purchases or is otherwise granted one of your app's SKUs. Refer to the [Monetization documentation](/developers/docs/monetization/overview) for details. + ###### Entitlement Create Structure -The inner payload is an [entitlement](/docs/resources/entitlement#entitlement-object) object. +The inner payload is an [entitlement](/developers/docs/resources/entitlement#entitlement-object) object. + ###### Entitlement Create Example ```json @@ -246,9 +254,9 @@ The inner payload is an [entitlement](/docs/resources/entitlement#entitlement-ob #### Quest User Enrollment -:::warn + This event cannot be received by apps at this time. It's documented because it appears on the Webhooks settings page. -::: + `QUEST_USER_ENROLLMENT` is sent when a user is added to a Quest on Discord. @@ -258,7 +266,7 @@ This event cannot be received by apps at this time. It's documented because it a ###### Lobby Message Create Structure -The inner payload is a [lobby message object](/docs/events/webhook-events#lobby-message-object). +The inner payload is a [lobby message object](/developers/docs/events/webhook-events#lobby-message-object). ###### Lobby Message Create Example @@ -292,7 +300,7 @@ The inner payload is a [lobby message object](/docs/events/webhook-events#lobby- ###### Lobby Message Update Structure -The inner payload is a [lobby message object](/docs/events/webhook-events#lobby-message-object) with additional fields for message updates. +The inner payload is a [lobby message object](/developers/docs/events/webhook-events#lobby-message-object) with additional fields for message updates. ###### Lobby Message Update Example @@ -356,7 +364,7 @@ The inner payload is a [lobby message object](/docs/events/webhook-events#lobby- ###### Game Direct Message Create Structure -The inner payload is a [message object](/docs/events/webhook-events#message-object) or [passthrough message object](/docs/events/webhook-events#passthrough-message-object). +The inner payload is a [message object](/developers/docs/events/webhook-events#message-object) or [passthrough message object](/developers/docs/events/webhook-events#passthrough-message-object). ###### Game Direct Message Create Example @@ -390,7 +398,7 @@ The inner payload is a [message object](/docs/events/webhook-events#message-obje ###### Game Direct Message Update Structure -The inner payload is a [message object](/docs/events/webhook-events#message-object) or [passthrough message object](/docs/events/webhook-events#passthrough-message-object). +The inner payload is a [message object](/developers/docs/events/webhook-events#message-object) or [passthrough message object](/developers/docs/events/webhook-events#passthrough-message-object). ###### Game Direct Message Update Example @@ -421,7 +429,7 @@ The inner payload is a [message object](/docs/events/webhook-events#message-obje ###### Game Direct Message Delete Structure -The inner payload is a [message object](/docs/events/webhook-events#message-object) or [passthrough message object](/docs/events/webhook-events#passthrough-message-object). +The inner payload is a [message object](/developers/docs/events/webhook-events#message-object) or [passthrough message object](/developers/docs/events/webhook-events#passthrough-message-object). ###### Game Direct Message Delete Example @@ -454,40 +462,40 @@ The inner payload is a [message object](/docs/events/webhook-events#message-obje Discord Social SDK utilizes specialized message objects for lobby and direct message events that occur during active game sessions. These objects extend or modify the standard Discord message structure to support communication features. -- [Lobby messages](/docs/events/webhook-events#lobby-message-object) include lobby-specific fields like `lobby_id` -- [Standard Discord messages](/docs/events/webhook-events#message-object) in SDK contexts may include additional fields -- [Passthrough messages](/docs/events/webhook-events#passthrough-message-object) are used for communication between provisional accounts +- [Lobby messages](/developers/docs/events/webhook-events#lobby-message-object) include lobby-specific fields like `lobby_id` +- [Standard Discord messages](/developers/docs/events/webhook-events#message-object) in SDK contexts may include additional fields +- [Passthrough messages](/developers/docs/events/webhook-events#passthrough-message-object) are used for communication between provisional accounts These objects are used in the webhook events `LOBBY_MESSAGE_*` and `GAME_DIRECT_MESSAGE_*` depending on the messaging context. ### Lobby Message Object -Represents a message sent in a lobby or [Linked Channel](/docs/discord-social-sdk/development-guides/linked-channels). +Represents a message sent in a lobby or [Linked Channel](/developers/docs/discord-social-sdk/development-guides/linked-channels). ###### Lobby Message Structure -| Field | Type | Description | -|-----------------|----------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------| -| id | snowflake | ID of the message | -| type | integer | [Type of message](/docs/resources/message#message-object-message-types) | -| content | string | Contents of the message | -| lobby_id | snowflake | ID of the lobby where the message was sent | -| channel_id | snowflake | ID of the channel the message was sent in | -| author | [user object](/docs/resources/user#user-object-user-structure) | Author of the message | -| metadata? | object | Additional metadata for the message (key-value pairs) | -| flags | integer | [Message flags](/docs/resources/message#message-object-message-flags) combined as a [bitfield](https://en.wikipedia.org/wiki/Bit_field) | -| application_id? | snowflake | ID of the application (only present during active Social SDK sessions) | +| Field | Type | Description | +|-----------------|---------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------| +| id | snowflake | ID of the message | +| type | integer | [Type of message](/developers/docs/resources/message#message-object-message-types) | +| content | string | Contents of the message | +| lobby_id | snowflake | ID of the lobby where the message was sent | +| channel_id | snowflake | ID of the channel the message was sent in | +| author | [user object](/developers/docs/resources/user#user-object-user-structure) | Author of the message | +| metadata? | object | Additional metadata for the message (key-value pairs) | +| flags | integer | [Message flags](/developers/docs/resources/message#message-object-message-flags) combined as a [bitfield](https://en.wikipedia.org/wiki/Bit_field) | +| application_id? | snowflake | ID of the application (only present during active Social SDK sessions) | ### Message Object -Standard [Message Object](/docs/resources/message#messages-resource) with additional fields. +Standard [Message Object](/developers/docs/resources/message#message-object) with additional fields. ###### Additional Fields -| Field | Type | Description | -|-----------|----------------------------------------------------------|-----------------------------------------------------------------------------------------| -| lobby_id? | snowflake | ID of the lobby where the message was created (only present in Linked Channel messages) | -| channel | [channel object](/docs/resources/channel#channel-object) | Channel object with recipient information | +| Field | Type | Description | +|-----------|---------------------------------------------------------------------|-----------------------------------------------------------------------------------------| +| lobby_id? | snowflake | ID of the lobby where the message was created (only present in Linked Channel messages) | +| channel | [channel object](/developers/docs/resources/channel#channel-object) | Channel object with recipient information | ### Passthrough Message Object @@ -495,18 +503,18 @@ Represents a message between provisional users that exists only in-game. ###### Passthrough Message Structure -| Field | Type | Description | -|----------------|----------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------| -| id | snowflake | ID of the message | -| type | integer | [Type of message](/docs/resources/message#message-object-message-types) | -| content | string | Contents of the message | -| channel_id | snowflake | ID of the channel the message was sent in | -| recipient_id | snowflake | ID of the message recipient | -| author | [user object](/docs/resources/user#user-object-user-structure) | Author of the message | -| flags | integer | [Message flags](/docs/resources/message#message-object-message-flags) combined as a [bitfield](https://en.wikipedia.org/wiki/Bit_field) | -| application_id | snowflake | ID of the application that created the message | -| channel | [channel object](/docs/resources/channel#channel-object) | Channel object with recipient information | - -:::info +| Field | Type | Description | +|----------------|---------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------| +| id | snowflake | ID of the message | +| type | integer | [Type of message](/developers/docs/resources/message#message-object-message-types) | +| content | string | Contents of the message | +| channel_id | snowflake | ID of the channel the message was sent in | +| recipient_id | snowflake | ID of the message recipient | +| author | [user object](/developers/docs/resources/user#user-object-user-structure) | Author of the message | +| flags | integer | [Message flags](/developers/docs/resources/message#message-object-message-flags) combined as a [bitfield](https://en.wikipedia.org/wiki/Bit_field) | +| application_id | snowflake | ID of the application that created the message | +| channel | [channel object](/developers/docs/resources/channel#channel-object) | Channel object with recipient information | + + When both users in a direct message are provisional accounts, messages become "passthrough messages" that are only visible in-game and use this specialized structure. -::: + diff --git a/docs/interactions/application-commands.mdx b/discord/developers/docs/interactions/application-commands.mdx similarity index 57% rename from docs/interactions/application-commands.mdx rename to discord/developers/docs/interactions/application-commands.mdx index e5cd526878..869eeaf513 100644 --- a/docs/interactions/application-commands.mdx +++ b/discord/developers/docs/interactions/application-commands.mdx @@ -1,115 +1,128 @@ -# Application Commands +--- +title: Application Commands +description: Complete guide to creating slash commands, user commands, and message commands. +--- + +import {ManualAnchor} from '/snippets/manualanchor.jsx' +import {Route} from '/snippets/route.jsx' Application commands are native ways to interact with apps in the Discord client. There are 3 types of commands accessible in different interfaces: the chat input, a message's context menu (top-right menu or right-clicking in a message), and a user's context menu (right-clicking on a user). -![Client interfaces showing the different types of application commands](images/command-types.webp) +![Client interfaces showing the different types of application commands](/images/command-types.png) ## Application Command Object + ###### Application Command Naming `CHAT_INPUT` command names and command option names must match the following regex `^[-_'\p{L}\p{N}\p{sc=Deva}\p{sc=Thai}]{1,32}$` with the unicode flag set. If there is a lowercase variant of any letters used, you must use those. Characters with no lowercase variants and/or uncased letters are still allowed. `USER` and `MESSAGE` commands may be mixed case and can include spaces. + ###### Application Command Structure -| Field | Type | Description | Valid Types | -|----------------------------|--------------------------------------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---------------------| -| id | snowflake | Unique ID of command | all | -| type? | one of [command types](/docs/interactions/application-commands#application-command-object-application-command-types) | [Type of command](/docs/interactions/application-commands#application-command-object-application-command-types), defaults to `1` | all | -| application_id | snowflake | ID of the parent application | all | -| guild_id? | snowflake | Guild ID of the command, if not global | all | -| name | string | [Name of command](/docs/interactions/application-commands#application-command-object-application-command-naming), 1-32 characters | all | -| name_localizations? | ?dictionary with keys in [available locales](/docs/reference#locales) | Localization dictionary for `name` field. Values follow the same restrictions as `name` | all | -| description | string | Description for `CHAT_INPUT` commands, 1-100 characters. Empty string for `USER` and `MESSAGE` commands | all | -| description_localizations? | ?dictionary with keys in [available locales](/docs/reference#locales) | Localization dictionary for `description` field. Values follow the same restrictions as `description` | all | -| options? \* | array of [command options](/docs/interactions/application-commands#application-command-object-application-command-option-structure) | Parameters for the command, max of 25 | CHAT_INPUT | -| default_member_permissions | ?string | Set of [permissions](/docs/topics/permissions) represented as a bit set | all | -| dm_permission? | boolean | **Deprecated (use `contexts` instead)**; Indicates whether the command is available in DMs with the app, only for globally-scoped commands. By default, commands are visible. | all | -| default_permission? | ?boolean | Not recommended for use as field will soon be deprecated. Indicates whether the command is enabled by default when the app is added to a guild, defaults to `true` | all | -| nsfw? | boolean | Indicates whether the command is [age-restricted](/docs/interactions/application-commands#agerestricted-commands), defaults to `false` | all | -| integration_types? | list of [integration types](/docs/resources/application#application-object-application-integration-types) | [Installation contexts](/docs/resources/application#installation-context) where the command is available, only for globally-scoped commands. Defaults to your app's [configured contexts](/docs/resources/application#setting-supported-installation-contexts) | all | -| contexts? | ?list of [interaction context types](/docs/interactions/receiving-and-responding#interaction-object-interaction-context-types) | [Interaction context(s)](/docs/interactions/receiving-and-responding#interaction-object-interaction-context-types) where the command can be used, only for globally-scoped commands. | all | -| version | snowflake | Autoincrementing version identifier updated during substantial record changes | all | -| handler? | one of [command handler types](/docs/interactions/application-commands#application-command-object-entry-point-command-handler-types) | Determines whether the interaction is handled by the app's interactions handler or by Discord | PRIMARY_ENTRY_POINT | +| Field | Type | Description | Valid Types | +|----------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---------------------| +| id | snowflake | Unique ID of command | all | +| type? | one of [command types](/developers/docs/interactions/application-commands#application-command-object-application-command-types) | [Type of command](/developers/docs/interactions/application-commands#application-command-object-application-command-types), defaults to `1` | all | +| application_id | snowflake | ID of the parent application | all | +| guild_id? | snowflake | Guild ID of the command, if not global | all | +| name | string | [Name of command](/developers/docs/interactions/application-commands#application-command-object-application-command-naming), 1-32 characters | all | +| name_localizations? | ?dictionary with keys in [available locales](/developers/docs/reference#locales) | Localization dictionary for `name` field. Values follow the same restrictions as `name` | all | +| description | string | Description for `CHAT_INPUT` commands, 1-100 characters. Empty string for `USER` and `MESSAGE` commands | all | +| description_localizations? | ?dictionary with keys in [available locales](/developers/docs/reference#locales) | Localization dictionary for `description` field. Values follow the same restrictions as `description` | all | +| options? \* | array of [command options](/developers/docs/interactions/application-commands#application-command-object-application-command-option-structure) | Parameters for the command, max of 25 | CHAT_INPUT | +| default_member_permissions | ?string | Set of [permissions](/developers/docs/topics/permissions) represented as a bit set | all | +| dm_permission? | boolean | **Deprecated (use `contexts` instead)**; Indicates whether the command is available in DMs with the app, only for globally-scoped commands. By default, commands are visible. | all | +| default_permission? | ?boolean | Not recommended for use as field will soon be deprecated. Indicates whether the command is enabled by default when the app is added to a guild, defaults to `true` | all | +| nsfw? | boolean | Indicates whether the command is [age-restricted](/developers/docs/interactions/application-commands#agerestricted-commands), defaults to `false` | all | +| integration_types? | list of [integration types](/developers/docs/resources/application#application-object-application-integration-types) | [Installation contexts](/developers/docs/resources/application#installation-context) where the command is available, only for globally-scoped commands. Defaults to your app's [configured contexts](/developers/docs/resources/application#setting-supported-installation-contexts) | all | +| contexts? | ?list of [interaction context types](/developers/docs/interactions/receiving-and-responding#interaction-object-interaction-context-types) | [Interaction context(s)](/developers/docs/interactions/receiving-and-responding#interaction-object-interaction-context-types) where the command can be used, only for globally-scoped commands. | all | +| version | snowflake | Autoincrementing version identifier updated during substantial record changes | all | +| handler? | one of [command handler types](/developers/docs/interactions/application-commands#application-command-object-entry-point-command-handler-types) | Determines whether the interaction is handled by the app's interactions handler or by Discord | PRIMARY_ENTRY_POINT | \* `options` can only be set for application commands of type `CHAT_INPUT`. \* `handler` can only be set for application commands of type `PRIMARY_ENTRY_POINT` for applications with the `EMBEDDED` flag (i.e. applications that have an Activity). -:::danger + `default_permission` will soon be deprecated. You can instead set `default_member_permissions` to `"0"` to disable the command for everyone except admins by default, and/or use `contexts` to disable globally-scoped commands inside of DMs with your app -::: + + ###### Application Command Types -| Name | Type | Description | -|---------------------|------|-------------------------------------------------------------------------------------------------------------| -| CHAT_INPUT | 1 | Slash commands; a text-based command that shows up when a user types `/` | -| USER | 2 | A UI-based command that shows up when you right click or tap on a user | -| MESSAGE | 3 | A UI-based command that shows up when you right click or tap on a message | -| PRIMARY_ENTRY_POINT | 4 | A UI-based command that represents the primary way to invoke an app's [Activity](/docs/activities/overview) | +| Name | Type | Description | +|---------------------|------|------------------------------------------------------------------------------------------------------------------------| +| CHAT_INPUT | 1 | Slash commands; a text-based command that shows up when a user types `/` | +| USER | 2 | A UI-based command that shows up when you right click or tap on a user | +| MESSAGE | 3 | A UI-based command that shows up when you right click or tap on a message | +| PRIMARY_ENTRY_POINT | 4 | A UI-based command that represents the primary way to invoke an app's [Activity](/developers/docs/activities/overview) | + ###### Application Command Option Structure -:::warn + Required `options` must be listed before optional options -::: - -| Field | Type | Description | Valid Option Types | -|----------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------|-----------------------------------------------| -| type | one of [application command option type](/docs/interactions/application-commands#application-command-object-application-command-option-type) | Type of option | all | -| name \* | string | [1-32 character name](/docs/interactions/application-commands#application-command-object-application-command-naming) | all | -| name_localizations? | ?dictionary with keys in [available locales](/docs/reference#locales) | Localization dictionary for the `name` field. Values follow the same restrictions as `name` | all | -| description | string | 1-100 character description | all | -| description_localizations? | ?dictionary with keys in [available locales](/docs/reference#locales) | Localization dictionary for the `description` field. Values follow the same restrictions as `description` | all | -| required? | boolean | Whether the parameter is required or optional, default `false` | all but `SUB_COMMAND` and `SUB_COMMAND_GROUP` | -| choices? | array of [application command option choice](/docs/interactions/application-commands#application-command-object-application-command-option-choice-structure) | Choices for the user to pick from, max 25 | `STRING`, `INTEGER`, `NUMBER` | -| options? | array of [application command option](/docs/interactions/application-commands#application-command-object-application-command-option-structure) | If the option is a subcommand or subcommand group type, these nested options will be the parameters or subcommands respectively; up to 25 | `SUB_COMMAND` , `SUB_COMMAND_GROUP` | -| channel_types? | array of [channel types](/docs/resources/channel#channel-object-channel-types) | The channels shown will be restricted to these types | `CHANNEL` | -| min_value? | integer for `INTEGER` options, double for `NUMBER` options | The minimum value permitted | `INTEGER` , `NUMBER` | -| max_value? | integer for `INTEGER` options, double for `NUMBER` options | The maximum value permitted | `INTEGER` , `NUMBER` | -| min_length? | integer | The minimum allowed length (minimum of `0`, maximum of `6000`) | `STRING` | -| max_length? | integer | The maximum allowed length (minimum of `1`, maximum of `6000`) | `STRING` | -| autocomplete? \*\* | boolean | If autocomplete interactions are enabled for this option | `STRING`, `INTEGER`, `NUMBER` | - -\* `name` must be unique within an array of [application command options](/docs/interactions/application-commands#application-command-object-application-command-option-structure). + + +| Field | Type | Description | Valid Option Types | +|----------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------|-----------------------------------------------| +| type | one of [application command option type](/developers/docs/interactions/application-commands#application-command-object-application-command-option-type) | Type of option | all | +| name \* | string | [1-32 character name](/developers/docs/interactions/application-commands#application-command-object-application-command-naming) | all | +| name_localizations? | ?dictionary with keys in [available locales](/developers/docs/reference#locales) | Localization dictionary for the `name` field. Values follow the same restrictions as `name` | all | +| description | string | 1-100 character description | all | +| description_localizations? | ?dictionary with keys in [available locales](/developers/docs/reference#locales) | Localization dictionary for the `description` field. Values follow the same restrictions as `description` | all | +| required? | boolean | Whether the parameter is required or optional, default `false` | all but `SUB_COMMAND` and `SUB_COMMAND_GROUP` | +| choices? | array of [application command option choice](/developers/docs/interactions/application-commands#application-command-object-application-command-option-choice-structure) | Choices for the user to pick from, max 25 | `STRING`, `INTEGER`, `NUMBER` | +| options? | array of [application command option](/developers/docs/interactions/application-commands#application-command-object-application-command-option-structure) | If the option is a subcommand or subcommand group type, these nested options will be the parameters or subcommands respectively; up to 25 | `SUB_COMMAND` , `SUB_COMMAND_GROUP` | +| channel_types? | array of [channel types](/developers/docs/resources/channel#channel-object-channel-types) | The channels shown will be restricted to these types | `CHANNEL` | +| min_value? | integer for `INTEGER` options, double for `NUMBER` options | The minimum value permitted | `INTEGER` , `NUMBER` | +| max_value? | integer for `INTEGER` options, double for `NUMBER` options | The maximum value permitted | `INTEGER` , `NUMBER` | +| min_length? | integer | The minimum allowed length (minimum of `0`, maximum of `6000`) | `STRING` | +| max_length? | integer | The maximum allowed length (minimum of `1`, maximum of `6000`) | `STRING` | +| autocomplete? \*\* | boolean | If autocomplete interactions are enabled for this option | `STRING`, `INTEGER`, `NUMBER` | + +\* `name` must be unique within an array of [application command options](/developers/docs/interactions/application-commands#application-command-object-application-command-option-structure). \*\* `autocomplete` may not be set to true if `choices` are present. -:::info + Options using `autocomplete` are not confined to only use choices given by the application. -::: + + ###### Application Command Option Type -| Name | Value | Note | -|-------------------|-------|----------------------------------------------------------------| -| SUB_COMMAND | 1 | | -| SUB_COMMAND_GROUP | 2 | | -| STRING | 3 | | -| INTEGER | 4 | Any integer between -2^53+1 and 2^53-1 | -| BOOLEAN | 5 | | -| USER | 6 | | -| CHANNEL | 7 | Includes all channel types + categories | -| ROLE | 8 | | -| MENTIONABLE | 9 | Includes users and roles | -| NUMBER | 10 | Any double between -2^53 and 2^53 | -| ATTACHMENT | 11 | [attachment](/docs/resources/message#attachment-object) object | - +| Name | Value | Note | +|-------------------|-------|---------------------------------------------------------------------------| +| SUB_COMMAND | 1 | | +| SUB_COMMAND_GROUP | 2 | | +| STRING | 3 | | +| INTEGER | 4 | Any integer between -2^53+1 and 2^53-1 | +| BOOLEAN | 5 | | +| USER | 6 | | +| CHANNEL | 7 | Includes all channel types + categories | +| ROLE | 8 | | +| MENTIONABLE | 9 | Includes users and roles | +| NUMBER | 10 | Any double between -2^53 and 2^53 | +| ATTACHMENT | 11 | [attachment](/developers/docs/resources/message#attachment-object) object | + + ###### Application Command Option Choice Structure -:::info + If you specify `choices` for an option, they are the **only** valid values for a user to pick -::: + -| Field | Type | Description | -|---------------------|-----------------------------------------------------------------------|---------------------------------------------------------------------------------------------| -| name | string | 1-100 character choice name | -| name_localizations? | ?dictionary with keys in [available locales](/docs/reference#locales) | Localization dictionary for the `name` field. Values follow the same restrictions as `name` | -| value | string, integer, or double \* | Value for the choice, up to 100 characters if string | +| Field | Type | Description | +|---------------------|----------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------| +| name | string | 1-100 character choice name | +| name_localizations? | ?dictionary with keys in [available locales](/developers/docs/reference#locales) | Localization dictionary for the `name` field. Values follow the same restrictions as `name` | +| value | string, integer, or double \* | Value for the choice, up to 100 characters if string | -\* Type of `value` depends on the [option type](/docs/interactions/application-commands#application-command-object-application-command-option-type) that the choice belongs to. +\* Type of `value` depends on the [option type](/developers/docs/interactions/application-commands#application-command-object-application-command-option-type) that the choice belongs to. + ###### Entry Point Command Handler Types | Name | Value | Note | @@ -117,11 +130,11 @@ If you specify `choices` for an option, they are the **only** valid values for a | APP_HANDLER | 1 | The app handles the interaction using an interaction token | | DISCORD_LAUNCH_ACTIVITY | 2 | Discord handles the interaction by launching an Activity and sending a follow-up message without coordinating with the app | -Details about Entry Point command handler types are in the [Entry Point handlers](/docs/interactions/application-commands#entry-point-handlers) section. +Details about Entry Point command handler types are in the [Entry Point handlers](/developers/docs/interactions/application-commands#entry-point-handlers) section. ## Authorizing Your Application -Application commands do not depend on a bot user in the guild; they use the [interactions](/docs/interactions/receiving-and-responding) model. To create commands in a guild, your app must be authorized with the `applications.commands` scope which can be used independently, but is also automatically included with the `bot` scope. +Application commands do not depend on a bot user in the guild; they use the [interactions](/developers/docs/interactions/receiving-and-responding) model. To create commands in a guild, your app must be authorized with the `applications.commands` scope which can be used independently, but is also automatically included with the `bot` scope. When requesting this scope, we "shortcut" the OAuth2 flow similar to adding a bot. You don't need to complete the flow, exchange for a token, or any of that. @@ -130,9 +143,9 @@ If your application does not require a bot user in the guild for its commands to ## Registering a Command -:::info + Commands can only be registered via HTTP endpoint. -::: + Commands can be scoped either globally or to a specific guild. Global commands are available for every guild that adds your app. An individual app's global commands are also available in DMs if that app has a bot that shares a mutual guild with the user. @@ -157,9 +170,9 @@ An app can have the following number of commands: For all command types except `PRIMARY_ENTRY_POINT`, you can have the same amount of guild-specific commands per guild. -:::danger + There is a global rate limit of 200 application command creates per day, per guild -::: + ### Making a Global Command @@ -263,48 +276,48 @@ Commands can be deleted and updated by making `DELETE` and `PATCH` calls to the Because commands have unique names within a type and scope, we treat `POST` requests for new commands as upserts. That means **making a new command with an already-used name for your application will update the existing command**. -Detailed documentation about application command endpoints and their parameters are [in the endpoints section](/docs/interactions/application-commands#endpoints). +Detailed documentation about application command endpoints and their parameters are [in the endpoints section](/developers/docs/interactions/application-commands#endpoints). ## Contexts -Commands have two sets of contexts on the [application command object](/docs/interactions/application-commands#application-command-object) that let you to configure when and where it can be used: -- `integration_types` defines the **[installation contexts](/docs/interactions/application-commands#installation-context)** that a command supports -- `contexts` defines the **[interaction contexts](/docs/interactions/application-commands#interaction-contexts)** where a command can be used +Commands have two sets of contexts on the [application command object](/developers/docs/interactions/application-commands#application-command-object) that let you to configure when and where it can be used: +- `integration_types` defines the **[installation contexts](/developers/docs/interactions/application-commands#installation-context)** that a command supports +- `contexts` defines the **[interaction contexts](/developers/docs/interactions/application-commands#interaction-contexts)** where a command can be used Details for both types of command contexts are in the sections below. -:::info -Contexts are distinct from, and do not affect, any [command permissions](/docs/interactions/application-commands#permissions) for apps installed to a server. -::: + +Contexts are distinct from, and do not affect, any [command permissions](/developers/docs/interactions/application-commands#permissions) for apps installed to a server. + ### Installation Context -The [installation context](/docs/resources/application#installation-context) is where your app was installed—to a server, a user, or both. If your app supports both installation contexts, there may be cases where you want some of your app's commands to only be available for one or the other. For example, maybe your app has a `/profile` command that is only relevant when it's installed to a user. +The [installation context](/developers/docs/resources/application#installation-context) is where your app was installed—to a server, a user, or both. If your app supports both installation contexts, there may be cases where you want some of your app's commands to only be available for one or the other. For example, maybe your app has a `/profile` command that is only relevant when it's installed to a user. -A command's supported installation context(s) can be set using the [`integration_types` field](/docs/interactions/application-commands#application-command-object-application-command-structure) when creating or updating a command as long as any included contexts are already [supported on the application-level](/docs/resources/application#setting-supported-installation-contexts). +A command's supported installation context(s) can be set using the [`integration_types` field](/developers/docs/interactions/application-commands#application-command-object-application-command-structure) when creating or updating a command as long as any included contexts are already [supported on the application-level](/developers/docs/resources/application#setting-supported-installation-contexts). -A command's value for `integration_types` may affect which [interaction contexts](/docs/interactions/application-commands#interaction-contexts) a command is visible in. +A command's value for `integration_types` may affect which [interaction contexts](/developers/docs/interactions/application-commands#interaction-contexts) a command is visible in. ### Interaction Contexts -The interaction contexts for a command determines where in the Discord client it can be used, and can be configured by setting the [`contexts` field](/docs/interactions/application-commands#application-command-object-application-command-structure) when creating or updating a command. +The interaction contexts for a command determines where in the Discord client it can be used, and can be configured by setting the [`contexts` field](/developers/docs/interactions/application-commands#application-command-object-application-command-structure) when creating or updating a command. -There are three [interaction context types](/docs/interactions/receiving-and-responding#interaction-object-interaction-context-types) that correspond to different surfaces: `GUILD` (`0`), `BOT_DM` (`1`), and `PRIVATE_CHANNEL` (`2`). However, the `PRIVATE_CHANNEL` interaction context is only meaningful for commands installed to a user (when the command's `integration_types` includes `USER_INSTALL`). +There are three [interaction context types](/developers/docs/interactions/receiving-and-responding#interaction-object-interaction-context-types) that correspond to different surfaces: `GUILD` (`0`), `BOT_DM` (`1`), and `PRIVATE_CHANNEL` (`2`). However, the `PRIVATE_CHANNEL` interaction context is only meaningful for commands installed to a user (when the command's `integration_types` includes `USER_INSTALL`). ## Permissions Application command permissions allow your app to enable or disable commands for up to 100 users, roles, and channels within a guild. Command permissions can also be updated by users in the client if they have the necessary permissions. -:::warn -Command permissions can only be updated using a [Bearer token](/docs/topics/oauth2#client-credentials-grant). Authenticating with a bot token will result in an error. -::: + +Command permissions can only be updated using a [Bearer token](/developers/docs/topics/oauth2#client-credentials-grant). Authenticating with a bot token will result in an error. + -A command's current permissions can be retrieved using the [`GET /applications/{application.id}/guilds/{guild.id}/commands/{command.id}/permissions`](/docs/interactions/application-commands#get-application-command-permissions) endpoint. The response will include an array called `permissions` with associated IDs and permission types. +A command's current permissions can be retrieved using the [`GET /applications/{application.id}/guilds/{guild.id}/commands/{command.id}/permissions`](/developers/docs/interactions/application-commands#get-application-command-permissions) endpoint. The response will include an array called `permissions` with associated IDs and permission types. -Command permissions can be updated with the [`PUT /applications/{application.id}/guilds/{guild.id}/commands/{command.id}/permissions`](/docs/interactions/application-commands#edit-application-command-permissions) endpoint. To call the endpoint, apps must use a Bearer token that's authorized with the [`applications.commands.permissions.update`](/docs/topics/oauth2#shared-resources-oauth2-scopes) scope from a user with sufficient permissions. For their permissions to be considered sufficient, all of the following must be true for **the authenticating user** (not your app or bot user): -- Has [permission to Manage Guild and Manage Roles](/docs/topics/permissions) in the guild where the command is being edited +Command permissions can be updated with the [`PUT /applications/{application.id}/guilds/{guild.id}/commands/{command.id}/permissions`](/developers/docs/interactions/application-commands#edit-application-command-permissions) endpoint. To call the endpoint, apps must use a Bearer token that's authorized with the [`applications.commands.permissions.update`](/developers/docs/topics/oauth2#shared-resources-oauth2-scopes) scope from a user with sufficient permissions. For their permissions to be considered sufficient, all of the following must be true for **the authenticating user** (not your app or bot user): +- Has [permission to Manage Guild and Manage Roles](/developers/docs/topics/permissions) in the guild where the command is being edited - Has the ability to run the command being edited -- Has permission to manage the resources that will be affected (roles, users, and/or channels depending on the [permission types](/docs/interactions/application-commands#application-command-permissions-object-application-command-permission-type)) +- Has permission to manage the resources that will be affected (roles, users, and/or channels depending on the [permission types](/developers/docs/interactions/application-commands#application-command-permissions-object-application-command-permission-type)) ### Syncing and Unsyncing Permissions @@ -314,28 +327,30 @@ When the permissions for a specific command are unsynced, meaning it doesn't ali ### Application Command Permissions Object + ###### Guild Application Command Permissions Structure Returned when fetching the permissions for an app's command(s) in a guild. -| Field | Type | Description | -|----------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------|------------------------------------------------------| -| id | snowflake | ID of the command or the application ID | -| application_id | snowflake | ID of the application the command belongs to | -| guild_id | snowflake | ID of the guild | -| permissions | array of [application command permissions](/docs/interactions/application-commands#application-command-permissions-object-application-command-permissions-structure) | Permissions for the command in the guild, max of 100 | +| Field | Type | Description | +|----------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|------------------------------------------------------| +| id | snowflake | ID of the command or the application ID | +| application_id | snowflake | ID of the application the command belongs to | +| guild_id | snowflake | ID of the guild | +| permissions | array of [application command permissions](/developers/docs/interactions/application-commands#application-command-permissions-object-application-command-permissions-structure) | Permissions for the command in the guild, max of 100 | When the `id` field is the application ID instead of a command ID, the permissions apply to all commands that do not contain explicit overwrites. + ###### Application Command Permissions Structure Application command permissions allow you to enable or disable commands for specific users, roles, or channels within a guild. -| Field | Type | Description | -|------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| -| id | snowflake | ID of the role, user, or channel. It can also be a [permission constant](/docs/interactions/application-commands#application-command-permissions-object-application-command-permissions-constants) | -| type | [application command permission type](/docs/interactions/application-commands#application-command-permissions-object-application-command-permission-type) | role (`1`), user (`2`), or channel (`3`) | -| permission | boolean | `true` to allow, `false`, to disallow | +| Field | Type | Description | +|------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| id | snowflake | ID of the role, user, or channel. It can also be a [permission constant](/developers/docs/interactions/application-commands#application-command-permissions-object-application-command-permissions-constants) | +| type | [application command permission type](/developers/docs/interactions/application-commands#application-command-permissions-object-application-command-permission-type) | role (`1`), user (`2`), or channel (`3`) | +| permission | boolean | `true` to allow, `false`, to disallow | ###### Application Command Permissions Constants @@ -346,6 +361,7 @@ The following constants can be used in the `id` field for command permissions pa | `@everyone` | `guild_id` | snowflake | All members in a guild | | All Channels | `guild_id - 1` | snowflake | All channels in a guild | + ###### Application Command Permission Type | Name | Value | @@ -354,22 +370,24 @@ The following constants can be used in the `id` field for command permissions pa | USER | 2 | | CHANNEL | 3 | -To allow for fine-tuned access to commands, application command permissions are supported for guild and global commands of all types. Guild members and apps with the [necessary permissions](/docs/interactions/application-commands#permissions) can allow or deny specific users and roles from using a command, or toggle commands for entire channels. +To allow for fine-tuned access to commands, application command permissions are supported for guild and global commands of all types. Guild members and apps with the [necessary permissions](/developers/docs/interactions/application-commands#permissions) can allow or deny specific users and roles from using a command, or toggle commands for entire channels. -Similar to how threads [inherit user and role permissions from the parent channel](/docs/topics/threads#permissions), any command permissions for a channel will apply to the threads it contains. +Similar to how threads [inherit user and role permissions from the parent channel](/developers/docs/topics/threads#permissions), any command permissions for a channel will apply to the threads it contains. -:::info + If you don't have permission to use a command, it will not show up in the command picker. Members with the Administrator permission can use all commands. -::: + + ###### Using Default Permissions Default permissions can be added to a command during creation using the `default_member_permissions` and `context` fields. Adding default permissions doesn't require any Bearer token since it's configured during command creation and isn't targeting specific roles, users, or channels. -The `default_member_permissions` field can be used when creating a command to set the permissions a user must have to use it. The value for `default_member_permissions` is a bitwise OR-ed set of [permissions](/docs/topics/permissions#permissions-bitwise-permission-flags), serialized as a string. Setting it to `"0"` will prohibit anyone in a guild from using the command unless a specific overwrite is configured or the user has admin permissions. +The `default_member_permissions` field can be used when creating a command to set the permissions a user must have to use it. The value for `default_member_permissions` is a bitwise OR-ed set of [permissions](/developers/docs/topics/permissions#permissions-bitwise-permission-flags), serialized as a string. Setting it to `"0"` will prohibit anyone in a guild from using the command unless a specific overwrite is configured or the user has admin permissions. -You can also include `BOT_DM` (`1`) in `contexts` when setting a global command's [interaction contexts](/docs/interactions/application-commands#interaction-contexts) to control whether it can be run in DMs with your app. Guild commands don't support the `BOT_DM` interaction context. +You can also include `BOT_DM` (`1`) in `contexts` when setting a global command's [interaction contexts](/developers/docs/interactions/application-commands#interaction-contexts) to control whether it can be run in DMs with your app. Guild commands don't support the `BOT_DM` interaction context. + ###### Example of editing permissions As an example, the following command would not be usable by anyone except admins in any guilds by default: @@ -425,11 +443,12 @@ Slash commands—the `CHAT_INPUT` type—are a type of application command. They Slash commands can also have groups and subcommands to further organize commands. More on those later. -:::warn -Slash commands can have a maximum of 8000 characters for combined name, description, and value properties for each command, its options (including subcommands and groups), and choices. When [localization fields](/docs/interactions/application-commands#localization) are present, only the longest localization for each field (including the default value) is counted towards the size limit. -::: + +Slash commands can have a maximum of 8000 characters for combined name, description, and value properties for each command, its options (including subcommands and groups), and choices. When [localization fields](/developers/docs/interactions/application-commands#localization) are present, only the longest localization for each field (including the default value) is counted towards the size limit. + + ###### Example Slash Command ```json @@ -470,9 +489,10 @@ Slash commands can have a maximum of 8000 characters for combined name, descript When someone uses a slash command, your application will receive an interaction: + ###### Example Interaction - + ```json { @@ -515,13 +535,13 @@ When someone uses a slash command, your application will receive an interaction: } ``` - + ## Subcommands and Subcommand Groups -:::warn + Currently, subcommands and subcommand groups all appear at the top level in the command explorer. This may change in the future to include them as nested autocomplete options. -::: + For those developers looking to make more organized and complex groups of commands, look no further than subcommands and groups. @@ -531,9 +551,9 @@ For those developers looking to make more organized and complex groups of comman These are not enforced rules. You are free to use subcommands and groups however you'd like; it's just how we think about them. -:::danger + Using subcommands or subcommand groups will make your base command unusable. You can't send the base `/permissions` command as a valid command if you also have `/permissions add | remove` as subcommands or subcommand groups -::: + We support nesting one level deep within a group, meaning your top level command can contain subcommand groups, and those groups can contain subcommands. **That is the only kind of nesting supported.** Here's some visual examples: @@ -620,7 +640,7 @@ We'll start by defining the top-level information for `/permissions`: } ``` -![A command with no arguments. It says /permissions](images/command.webp) +![A command with no arguments. It says /permissions](/images/command.png) Now we have a command named `permissions`. We want this command to be able to affect users and roles. Rather than making two separate commands, we can use subcommand groups. We want to use subcommand groups here because we are grouping commands on a similar resource: `user` or `role`. @@ -690,7 +710,7 @@ Now that we've effectively made `user` and `role` "folders", we want to be able } ``` -![A command with grouped subcommands. It says /permissions user get](images/command-with-groups-subcommands.webp) +![A command with grouped subcommands. It says /permissions user get](/images/command-with-groups-subcommands.png) Now, we need some arguments! If we chose `user`, we need to be able to pick a user; if we chose `role`, we need to be able to pick a role. We also want to be able to pick between guild-level permissions and channel-specific permissions. For that, we can use optional arguments: @@ -795,20 +815,21 @@ Now, we need some arguments! If we chose `user`, we need to be able to pick a us And, done! The JSON looks a bit complicated, but what we've ended up with is a single command that can be scoped to multiple actions, and then further scoped to a particular resource, and then even _further_ scope with optional arguments. Here's what it looks like all put together. -![A command with grouped subcommands and parameters. It says /permissions user get with arguments for a user and a channel.](images/command-with-groups-subcommands-parameters.webp) +![A command with grouped subcommands and parameters. It says /permissions user get with arguments for a user and a channel.](/images/command-with-groups-subcommands-parameters.png) ## User Commands User commands are application commands that appear on the context menu (right click or tap) of users. They're a great way to surface quick actions for your app that target users. They don't take any arguments, and will return the user on whom you clicked or tapped in the interaction response. -:::warn + A user must have permission to send text messages in the channel they invoke a user command in. If they don't have this permission, they will receive a 'Permission Denied' error from the interaction. -::: + -:::danger + The `description` field is not allowed when creating user commands. However, to avoid breaking changes to data models, `description` will be an **empty string** (instead of `null`) when fetching commands. -::: + + ###### Example User Command ```json @@ -818,13 +839,14 @@ The `description` field is not allowed when creating user commands. However, to } ``` -![An example user command. The context menu has an Apps section open to a High Five command](images/user-command.webp) +![An example user command. The context menu has an Apps section open to a High Five command](/images/user-command.png) When someone uses a user command, your application will receive an interaction: + ###### Example Interaction - + ```json { @@ -890,17 +912,18 @@ When someone uses a user command, your application will receive an interaction: } ``` - + ## Message Commands Message commands are application commands that appear on the context menu (right click or tap) of messages. They're a great way to surface quick actions for your app that target messages. They don't take any arguments, and will return the message on whom you clicked or tapped in the interaction response. -:::danger + The `description` field is not allowed when creating message commands. However, to avoid breaking changes to data models, `description` will be an **empty string** (instead of `null`) when fetching commands. -::: + + ###### Example Message Command ```json @@ -910,13 +933,14 @@ The `description` field is not allowed when creating message commands. However, } ``` -![An example message command. The context menu has an Apps section open to a Bookmark command](images/message-command.webp) +![An example message command. The context menu has an Apps section open to a Bookmark command](/images/message-command.png) When someone uses a message command, your application will receive an interaction: + ###### Example Interaction - + ```json { @@ -986,15 +1010,16 @@ When someone uses a message command, your application will receive an interactio } ``` - + ## Entry Point Commands -An Entry Point command serves as the primary way for users to open an app's [Activity](/docs/activities/overview) from the [App Launcher](https://support.discord.com/hc/articles/21334461140375-Using-Apps-on-Discord#h_01HRQSA6C8TRHS722P1H3HW1TV). +An Entry Point command serves as the primary way for users to open an app's [Activity](/developers/docs/activities/overview) from the [App Launcher](https://support.discord.com/hc/articles/21334461140375-Using-Apps-on-Discord#h_01HRQSA6C8TRHS722P1H3HW1TV). -For the Entry Point command to be visible to users, an app must have [Activities](/docs/activities/overview) enabled. -![Entry Point command in App Launcher](images/command-entry-point.webp) +For the Entry Point command to be visible to users, an app must have [Activities](/developers/docs/activities/overview) enabled. +![Entry Point command in App Launcher](/images/command-entry-point.png) + ###### Example Entry Point Command ```json @@ -1008,16 +1033,16 @@ For the Entry Point command to be visible to users, an app must have [Activities ### Entry Point handlers -When a user invokes an app's Entry Point command, the value of [`handler`](/docs/interactions/application-commands#application-command-object-application-command-structure) will determine how the interaction is handled: +When a user invokes an app's Entry Point command, the value of [`handler`](/developers/docs/interactions/application-commands#application-command-object-application-command-structure) will determine how the interaction is handled: -- For `APP_HANDLER` (`1`), the app is responsible for [responding to the interaction](/docs/interactions/receiving-and-responding#responding-to-an-interaction). It can respond by launching the app's associated Activity using the `LAUNCH_ACTIVITY` (type `12`) [interaction callback type](/docs/interactions/receiving-and-responding##interaction-response-object-interaction-callback-type), or take another action (like sending a follow-up message in channel). +- For `APP_HANDLER` (`1`), the app is responsible for [responding to the interaction](/developers/docs/interactions/receiving-and-responding#responding-to-an-interaction). It can respond by launching the app's associated Activity using the `LAUNCH_ACTIVITY` (type `12`) [interaction callback type](/developers/docs/interactions/receiving-and-responding##interaction-response-object-interaction-callback-type), or take another action (like sending a follow-up message in channel). - For `DISCORD_LAUNCH_ACTIVITY` (`2`), Discord will handle the interaction automatically by launching the associated Activity and sending a message to the channel where it was launched. ### Default Entry Point command -When you enable Activities, an Entry Point command (named "Launch") is automatically created for your app with `DISCORD_LAUNCH_ACTIVITY` (`2`) set as the [Entry Point handler](/docs/interactions/application-commands#entry-point-handlers). You can retrieve details for the automatically-created command, like its ID, by calling the [Get Global Application Commands](/docs/interactions/application-commands##get-global-application-commands) endpoint and looking for the "Launch" command. +When you enable Activities, an Entry Point command (named "Launch") is automatically created for your app with `DISCORD_LAUNCH_ACTIVITY` (`2`) set as the [Entry Point handler](/developers/docs/interactions/application-commands#entry-point-handlers). You can retrieve details for the automatically-created command, like its ID, by calling the [Get Global Application Commands](/developers/docs/interactions/application-commands##get-global-application-commands) endpoint and looking for the "Launch" command. -Details about updating or replacing the default Entry Point command is in the [Setting Up an Entry Point Command guide](/docs/activities/development-guides/user-actions#setting-up-an-entry-point-command). +Details about updating or replacing the default Entry Point command is in the [Setting Up an Entry Point Command guide](/developers/docs/activities/development-guides/user-actions#setting-up-an-entry-point-command). ## Autocomplete @@ -1025,9 +1050,9 @@ Autocomplete interactions allow your application to dynamically return option su An autocomplete interaction **can return partial data** for option values. Your application will receive partial data for any existing user input, as long as that input passes client-side validation. For example, you may receive partial strings, but not invalid numbers. The option the user is currently typing will be sent with a `focused: true` boolean field and options the user has already filled will also be sent but without the `focused` field. This is a special case where options that are otherwise required might not be present, due to the user not having filled them yet. -:::warn + This validation is **client-side only**. -::: + ```json { @@ -1053,7 +1078,7 @@ This validation is **client-side only**. Application commands can be localized, which will cause them to use localized names and descriptions depending on the client's selected language. This is entirely optional. Localization is available for names and descriptions of commands, subcommands, and options, as well as the names of choices, by submitting the appropriate `name_localizations` and `description_localizations` fields when creating or updating the application command. -Application commands may be partially localized - not all [available locales](/docs/reference#locales) are required, nor do different fields within a command need to support the same set of locales. If a locale is not present in a localizations dictionary for a field, users in that locale will see the default value for that field. It's not necessary to fill out all locales with the default value. Any localized values that are identical to the default will be ignored. +Application commands may be partially localized - not all [available locales](/developers/docs/reference#locales) are required, nor do different fields within a command need to support the same set of locales. If a locale is not present in a localizations dictionary for a field, users in that locale will see the default value for that field. It's not necessary to fill out all locales with the default value. Any localized values that are identical to the default will be ignored. Localized option names are subject to an additional constraint, which is that they must be distinct from all other default option names of that command, as well as all other option names within that locale on that command. @@ -1093,9 +1118,9 @@ An application command furnished with localizations might look like this: For application commands, there are built-in fallbacks in case a user's locale isn't present in the localizations. If the fallback locale is also missing, it will use the default. -:::warn + You should make sure to include your default value in its proper locale key, otherwise it may use a fallback value unexpectedly. For example, if your default value is `en-US`, but you don't specify the `en-US` value in your localizations, users with `en-US` selected will see the `en-GB` value if it's specified. For example, if you have a command with the default name "color", and your localizations specify only the `en-GB` value as "colour", users in the `en-US` locale will see "colour" because the `en-US` key is missing. -::: + | Locale | Fallback | |--------|----------| @@ -1134,11 +1159,11 @@ Locale is determined by looking at the `X-Discord-Locale` header, then the `Acce ## Age-Restricted Commands -A command that contains age-restricted content should have the [`nsfw` field](/docs/interactions/application-commands#application-command-object-application-command-structure) set to `true` upon creation or update. Marking a command as age-restricted will limit who can see and access the command, and from which channels. +A command that contains age-restricted content should have the [`nsfw` field](/developers/docs/interactions/application-commands#application-command-object-application-command-structure) set to `true` upon creation or update. Marking a command as age-restricted will limit who can see and access the command, and from which channels. -:::warn + Apps with [discovery enabled](https://support-dev.discord.com/hc/en-us/articles/9489299950487) (which is required to appear in the App Directory) cannot contain any age-restricted commands or content. -::: + ### Using Age-Restricted Commands @@ -1150,230 +1175,237 @@ Details about accessing and using age-restricted commands is in [the Help Center ### Endpoints -:::info -For authorization, all endpoints take either a [bot token](/docs/reference#authentication) or [client credentials token](/docs/topics/oauth2#client-credentials-grant) for your application -::: + +For authorization, all endpoints take either a [bot token](/developers/docs/reference#authentication) or [client credentials token](/developers/docs/topics/oauth2#client-credentials-grant) for your application + ## Get Global Application Commands -/applications/[\{application.id\}](/docs/resources/application#application-object)/commands +/applications/[\{application.id\}](/developers/docs/resources/application#application-object)/commands -:::warn -The objects returned by this endpoint may be augmented with [additional fields if localization is active](/docs/interactions/application-commands#retrieving-localized-commands). -::: + +The objects returned by this endpoint may be augmented with [additional fields if localization is active](/developers/docs/interactions/application-commands#retrieving-localized-commands). + -Fetch all of the global commands for your application. Returns an array of [application command](/docs/interactions/application-commands#application-command-object) objects. +Fetch all of the global commands for your application. Returns an array of [application command](/developers/docs/interactions/application-commands#application-command-object) objects. + ###### Query String Params -| Field | Type | Description | -|---------------------|--------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| -| with_localizations? | [boolean](/docs/reference#boolean-query-strings) | Whether to include full localization dictionaries (`name_localizations` and `description_localizations`) in the returned objects, instead of the `name_localized` and `description_localized` fields. Default `false`. | +| Field | Type | Description | +|---------------------|-------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| with_localizations? | [boolean](/developers/docs/reference#boolean-query-strings) | Whether to include full localization dictionaries (`name_localizations` and `description_localizations`) in the returned objects, instead of the `name_localized` and `description_localized` fields. Default `false`. | ## Create Global Application Command -/applications/[\{application.id\}](/docs/resources/application#application-object)/commands +/applications/[\{application.id\}](/developers/docs/resources/application#application-object)/commands -:::warn + Creating a command with the same name as an existing command for your application will overwrite the old command. -::: + -Create a new global command. Returns `201` if a command with the same name does not already exist, or a `200` if it does (in which case the previous command will be overwritten). Both responses include an [application command](/docs/interactions/application-commands#application-command-object) object. +Create a new global command. Returns `201` if a command with the same name does not already exist, or a `200` if it does (in which case the previous command will be overwritten). Both responses include an [application command](/developers/docs/interactions/application-commands#application-command-object) object. + ###### JSON Params -| Field | Type | Description | -|-----------------------------|------------------------------------------------------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| -| name | string | [Name of command](/docs/interactions/application-commands#application-command-object-application-command-naming), 1-32 characters | -| name_localizations? | ?dictionary with keys in [available locales](/docs/reference#locales) | Localization dictionary for the `name` field. Values follow the same restrictions as `name` | -| description? | string | 1-100 character description for `CHAT_INPUT` commands | -| description_localizations? | ?dictionary with keys in [available locales](/docs/reference#locales) | Localization dictionary for the `description` field. Values follow the same restrictions as `description` | -| options? | array of [application command option](/docs/interactions/application-commands#application-command-object-application-command-option-structure) | the parameters for the command, max of 25 | -| default_member_permissions? | ?string | Set of [permissions](/docs/topics/permissions) represented as a bit set | -| dm_permission? | ?boolean | **Deprecated (use `contexts` instead)**; Indicates whether the command is available in DMs with the app, only for globally-scoped commands. By default, commands are visible. | -| default_permission? | boolean | Replaced by `default_member_permissions` and will be deprecated in the future. Indicates whether the command is enabled by default when the app is added to a guild. Defaults to `true` | -| integration_types? | list of [integration types](/docs/resources/application#application-object-application-integration-types) | [Installation context(s)](/docs/resources/application#installation-context) where the command is available | -| contexts? | list of [interaction context types](/docs/interactions/receiving-and-responding#interaction-object-interaction-context-types) | [Interaction context(s)](/docs/interactions/receiving-and-responding#interaction-object-interaction-context-types) where the command can be used | -| type? | one of [application command type](/docs/interactions/application-commands#application-command-object-application-command-types) | Type of command, defaults `1` if not set | -| nsfw? | boolean | Indicates whether the command is [age-restricted](/docs/interactions/application-commands#agerestricted-commands) | +| Field | Type | Description | +|-----------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| name | string | [Name of command](/developers/docs/interactions/application-commands#application-command-object-application-command-naming), 1-32 characters | +| name_localizations? | ?dictionary with keys in [available locales](/developers/docs/reference#locales) | Localization dictionary for the `name` field. Values follow the same restrictions as `name` | +| description? | string | 1-100 character description for `CHAT_INPUT` commands | +| description_localizations? | ?dictionary with keys in [available locales](/developers/docs/reference#locales) | Localization dictionary for the `description` field. Values follow the same restrictions as `description` | +| options? | array of [application command option](/developers/docs/interactions/application-commands#application-command-object-application-command-option-structure) | the parameters for the command, max of 25 | +| default_member_permissions? | ?string | Set of [permissions](/developers/docs/topics/permissions) represented as a bit set | +| dm_permission? | ?boolean | **Deprecated (use `contexts` instead)**; Indicates whether the command is available in DMs with the app, only for globally-scoped commands. By default, commands are visible. | +| default_permission? | boolean | Replaced by `default_member_permissions` and will be deprecated in the future. Indicates whether the command is enabled by default when the app is added to a guild. Defaults to `true` | +| integration_types? | list of [integration types](/developers/docs/resources/application#application-object-application-integration-types) | [Installation context(s)](/developers/docs/resources/application#installation-context) where the command is available | +| contexts? | list of [interaction context types](/developers/docs/interactions/receiving-and-responding#interaction-object-interaction-context-types) | [Interaction context(s)](/developers/docs/interactions/receiving-and-responding#interaction-object-interaction-context-types) where the command can be used | +| type? | one of [application command type](/developers/docs/interactions/application-commands#application-command-object-application-command-types) | Type of command, defaults `1` if not set | +| nsfw? | boolean | Indicates whether the command is [age-restricted](/developers/docs/interactions/application-commands#agerestricted-commands) | ## Get Global Application Command -/applications/[\{application.id\}](/docs/resources/application#application-object)/commands/[\{command.id\}](/docs/interactions/application-commands#application-command-object) +/applications/[\{application.id\}](/developers/docs/resources/application#application-object)/commands/[\{command.id\}](/developers/docs/interactions/application-commands#application-command-object) -Fetch a global command for your application. Returns an [application command](/docs/interactions/application-commands#application-command-object) object. +Fetch a global command for your application. Returns an [application command](/developers/docs/interactions/application-commands#application-command-object) object. ## Edit Global Application Command -/applications/[\{application.id\}](/docs/resources/application#application-object)/commands/[\{command.id\}](/docs/interactions/application-commands#application-command-object) +/applications/[\{application.id\}](/developers/docs/resources/application#application-object)/commands/[\{command.id\}](/developers/docs/interactions/application-commands#application-command-object) -:::info + All parameters for this endpoint are optional. -::: + -Edit a global command. Returns `200` and an [application command](/docs/interactions/application-commands#application-command-object) object. All fields are optional, but any fields provided will entirely overwrite the existing values of those fields. +Edit a global command. Returns `200` and an [application command](/developers/docs/interactions/application-commands#application-command-object) object. All fields are optional, but any fields provided will entirely overwrite the existing values of those fields. + ###### JSON Params -| Field | Type | Description | -|-----------------------------|------------------------------------------------------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| -| name? | string | [Name of command](/docs/interactions/application-commands#application-command-object-application-command-naming), 1-32 characters | -| name_localizations? | ?dictionary with keys in [available locales](/docs/reference#locales) | Localization dictionary for the `name` field. Values follow the same restrictions as `name` | -| description? | string | 1-100 character description | -| description_localizations? | ?dictionary with keys in [available locales](/docs/reference#locales) | Localization dictionary for the `description` field. Values follow the same restrictions as `description` | -| options? | array of [application command option](/docs/interactions/application-commands#application-command-object-application-command-option-structure) | the parameters for the command | -| default_member_permissions? | ?string | Set of [permissions](/docs/topics/permissions) represented as a bit set | -| dm_permission? | ?boolean | **Deprecated (use `contexts` instead)**; Indicates whether the command is available in DMs with the app, only for globally-scoped commands. By default, commands are visible. | -| default_permission? | boolean | Replaced by `default_member_permissions` and will be deprecated in the future. Indicates whether the command is enabled by default when the app is added to a guild. Defaults to `true` | -| integration_types? | list of [integration types](/docs/resources/application#application-object-application-integration-types) | [Installation context(s)](/docs/resources/application#installation-context) where the command is available | -| contexts? | list of [interaction context types](/docs/interactions/receiving-and-responding#interaction-object-interaction-context-types) | [Interaction context(s)](/docs/interactions/receiving-and-responding#interaction-object-interaction-context-types) where the command can be used | -| nsfw? | boolean | Indicates whether the command is [age-restricted](/docs/interactions/application-commands#agerestricted-commands) | +| Field | Type | Description | +|-----------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| name? | string | [Name of command](/developers/docs/interactions/application-commands#application-command-object-application-command-naming), 1-32 characters | +| name_localizations? | ?dictionary with keys in [available locales](/developers/docs/reference#locales) | Localization dictionary for the `name` field. Values follow the same restrictions as `name` | +| description? | string | 1-100 character description | +| description_localizations? | ?dictionary with keys in [available locales](/developers/docs/reference#locales) | Localization dictionary for the `description` field. Values follow the same restrictions as `description` | +| options? | array of [application command option](/developers/docs/interactions/application-commands#application-command-object-application-command-option-structure) | the parameters for the command | +| default_member_permissions? | ?string | Set of [permissions](/developers/docs/topics/permissions) represented as a bit set | +| dm_permission? | ?boolean | **Deprecated (use `contexts` instead)**; Indicates whether the command is available in DMs with the app, only for globally-scoped commands. By default, commands are visible. | +| default_permission? | boolean | Replaced by `default_member_permissions` and will be deprecated in the future. Indicates whether the command is enabled by default when the app is added to a guild. Defaults to `true` | +| integration_types? | list of [integration types](/developers/docs/resources/application#application-object-application-integration-types) | [Installation context(s)](/developers/docs/resources/application#installation-context) where the command is available | +| contexts? | list of [interaction context types](/developers/docs/interactions/receiving-and-responding#interaction-object-interaction-context-types) | [Interaction context(s)](/developers/docs/interactions/receiving-and-responding#interaction-object-interaction-context-types) where the command can be used | +| nsfw? | boolean | Indicates whether the command is [age-restricted](/developers/docs/interactions/application-commands#agerestricted-commands) | ## Delete Global Application Command -/applications/[\{application.id\}](/docs/resources/application#application-object)/commands/[\{command.id\}](/docs/interactions/application-commands#application-command-object) +/applications/[\{application.id\}](/developers/docs/resources/application#application-object)/commands/[\{command.id\}](/developers/docs/interactions/application-commands#application-command-object) Deletes a global command. Returns `204 No Content` on success. ## Bulk Overwrite Global Application Commands -/applications/[\{application.id\}](/docs/resources/application#application-object)/commands +/applications/[\{application.id\}](/developers/docs/resources/application#application-object)/commands -Takes a list of application commands, overwriting the existing global command list for this application. Returns `200` and a list of [application command](/docs/interactions/application-commands#application-command-object) objects. Commands that do not already exist will count toward daily application command create limits. +Takes a list of application commands, overwriting the existing global command list for this application. Returns `200` and a list of [application command](/developers/docs/interactions/application-commands#application-command-object) objects. Commands that do not already exist will count toward daily application command create limits. -:::danger + This will overwrite **all** types of application commands: slash commands, user commands, and message commands. -::: + ## Get Guild Application Commands -/applications/[\{application.id\}](/docs/resources/application#application-object)/guilds/[\{guild.id\}](/docs/resources/guild#guild-object)/commands +/applications/[\{application.id\}](/developers/docs/resources/application#application-object)/guilds/[\{guild.id\}](/developers/docs/resources/guild#guild-object)/commands -:::warn -The objects returned by this endpoint may be augmented with [additional fields if localization is active](/docs/interactions/application-commands#retrieving-localized-commands). -::: + +The objects returned by this endpoint may be augmented with [additional fields if localization is active](/developers/docs/interactions/application-commands#retrieving-localized-commands). + -Fetch all of the guild commands for your application for a specific guild. Returns an array of [application command](/docs/interactions/application-commands#application-command-object) objects. +Fetch all of the guild commands for your application for a specific guild. Returns an array of [application command](/developers/docs/interactions/application-commands#application-command-object) objects. + ###### Query String Params -| Field | Type | Description | -|---------------------|--------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| -| with_localizations? | [boolean](/docs/reference#boolean-query-strings) | Whether to include full localization dictionaries (`name_localizations` and `description_localizations`) in the returned objects, instead of the `name_localized` and `description_localized` fields. Default `false`. | +| Field | Type | Description | +|---------------------|-------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| with_localizations? | [boolean](/developers/docs/reference#boolean-query-strings) | Whether to include full localization dictionaries (`name_localizations` and `description_localizations`) in the returned objects, instead of the `name_localized` and `description_localized` fields. Default `false`. | ## Create Guild Application Command -/applications/[\{application.id\}](/docs/resources/application#application-object)/guilds/[\{guild.id\}](/docs/resources/guild#guild-object)/commands +/applications/[\{application.id\}](/developers/docs/resources/application#application-object)/guilds/[\{guild.id\}](/developers/docs/resources/guild#guild-object)/commands -:::danger + Creating a command with the same name as an existing command for your application will overwrite the old command. -::: + -Create a new guild command. New guild commands will be available in the guild immediately. Returns `201` if a command with the same name does not already exist, or a `200` if it does (in which case the previous command will be overwritten). Both responses include an [application command](/docs/interactions/application-commands#application-command-object) object. +Create a new guild command. New guild commands will be available in the guild immediately. Returns `201` if a command with the same name does not already exist, or a `200` if it does (in which case the previous command will be overwritten). Both responses include an [application command](/developers/docs/interactions/application-commands#application-command-object) object. + ###### JSON Params -| Field | Type | Description | -|-----------------------------|------------------------------------------------------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| -| name | string | [Name of command](/docs/interactions/application-commands#application-command-object-application-command-naming), 1-32 characters | -| name_localizations? | ?dictionary with keys in [available locales](/docs/reference#locales) | Localization dictionary for the `name` field. Values follow the same restrictions as `name` | -| description? | string | 1-100 character description for `CHAT_INPUT` commands | -| description_localizations? | ?dictionary with keys in [available locales](/docs/reference#locales) | Localization dictionary for the `description` field. Values follow the same restrictions as `description` | -| options? | array of [application command option](/docs/interactions/application-commands#application-command-object-application-command-option-structure) | Parameters for the command, max of 25 | -| default_member_permissions? | ?string | Set of [permissions](/docs/topics/permissions) represented as a bit set | -| default_permission? | boolean | Replaced by `default_member_permissions` and will be deprecated in the future. Indicates whether the command is enabled by default when the app is added to a guild. Defaults to `true` | -| type? | one of [application command type](/docs/interactions/application-commands#application-command-object-application-command-types) | Type of command, defaults `1` if not set | -| nsfw? | boolean | Indicates whether the command is [age-restricted](/docs/interactions/application-commands#agerestricted-commands) | +| Field | Type | Description | +|-----------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| name | string | [Name of command](/developers/docs/interactions/application-commands#application-command-object-application-command-naming), 1-32 characters | +| name_localizations? | ?dictionary with keys in [available locales](/developers/docs/reference#locales) | Localization dictionary for the `name` field. Values follow the same restrictions as `name` | +| description? | string | 1-100 character description for `CHAT_INPUT` commands | +| description_localizations? | ?dictionary with keys in [available locales](/developers/docs/reference#locales) | Localization dictionary for the `description` field. Values follow the same restrictions as `description` | +| options? | array of [application command option](/developers/docs/interactions/application-commands#application-command-object-application-command-option-structure) | Parameters for the command, max of 25 | +| default_member_permissions? | ?string | Set of [permissions](/developers/docs/topics/permissions) represented as a bit set | +| default_permission? | boolean | Replaced by `default_member_permissions` and will be deprecated in the future. Indicates whether the command is enabled by default when the app is added to a guild. Defaults to `true` | +| type? | one of [application command type](/developers/docs/interactions/application-commands#application-command-object-application-command-types) | Type of command, defaults `1` if not set | +| nsfw? | boolean | Indicates whether the command is [age-restricted](/developers/docs/interactions/application-commands#agerestricted-commands) | ## Get Guild Application Command -/applications/[\{application.id\}](/docs/resources/application#application-object)/guilds/[\{guild.id\}](/docs/resources/guild#guild-object)/commands/[\{command.id\}](/docs/interactions/application-commands#application-command-object) +/applications/[\{application.id\}](/developers/docs/resources/application#application-object)/guilds/[\{guild.id\}](/developers/docs/resources/guild#guild-object)/commands/[\{command.id\}](/developers/docs/interactions/application-commands#application-command-object) -Fetch a guild command for your application. Returns an [application command](/docs/interactions/application-commands#application-command-object) object. +Fetch a guild command for your application. Returns an [application command](/developers/docs/interactions/application-commands#application-command-object) object. ## Edit Guild Application Command -/applications/[\{application.id\}](/docs/resources/application#application-object)/guilds/[\{guild.id\}](/docs/resources/guild#guild-object)/commands/[\{command.id\}](/docs/interactions/application-commands#application-command-object) +/applications/[\{application.id\}](/developers/docs/resources/application#application-object)/guilds/[\{guild.id\}](/developers/docs/resources/guild#guild-object)/commands/[\{command.id\}](/developers/docs/interactions/application-commands#application-command-object) -:::info + All parameters for this endpoint are optional. -::: + -Edit a guild command. Updates for guild commands will be available immediately. Returns `200` and an [application command](/docs/interactions/application-commands#application-command-object) object. All fields are optional, but any fields provided will entirely overwrite the existing values of those fields. +Edit a guild command. Updates for guild commands will be available immediately. Returns `200` and an [application command](/developers/docs/interactions/application-commands#application-command-object) object. All fields are optional, but any fields provided will entirely overwrite the existing values of those fields. + ###### JSON Params -| Field | Type | Description | -|-----------------------------|------------------------------------------------------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| -| name? | string | [Name of command](/docs/interactions/application-commands#application-command-object-application-command-naming), 1-32 characters | -| name_localizations? | ?dictionary with keys in [available locales](/docs/reference#locales) | Localization dictionary for the `name` field. Values follow the same restrictions as `name` | -| description? | string | 1-100 character description | -| description_localizations? | ?dictionary with keys in [available locales](/docs/reference#locales) | Localization dictionary for the `description` field. Values follow the same restrictions as `description` | -| options? | array of [application command option](/docs/interactions/application-commands#application-command-object-application-command-option-structure) | Parameters for the command, max of 25 | -| default_member_permissions? | ?string | Set of [permissions](/docs/topics/permissions) represented as a bit set | -| default_permission? | boolean | Replaced by `default_member_permissions` and will be deprecated in the future. Indicates whether the command is enabled by default when the app is added to a guild. Defaults to `true` | -| nsfw? | boolean | Indicates whether the command is [age-restricted](/docs/interactions/application-commands#agerestricted-commands) | +| Field | Type | Description | +|-----------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| name? | string | [Name of command](/developers/docs/interactions/application-commands#application-command-object-application-command-naming), 1-32 characters | +| name_localizations? | ?dictionary with keys in [available locales](/developers/docs/reference#locales) | Localization dictionary for the `name` field. Values follow the same restrictions as `name` | +| description? | string | 1-100 character description | +| description_localizations? | ?dictionary with keys in [available locales](/developers/docs/reference#locales) | Localization dictionary for the `description` field. Values follow the same restrictions as `description` | +| options? | array of [application command option](/developers/docs/interactions/application-commands#application-command-object-application-command-option-structure) | Parameters for the command, max of 25 | +| default_member_permissions? | ?string | Set of [permissions](/developers/docs/topics/permissions) represented as a bit set | +| default_permission? | boolean | Replaced by `default_member_permissions` and will be deprecated in the future. Indicates whether the command is enabled by default when the app is added to a guild. Defaults to `true` | +| nsfw? | boolean | Indicates whether the command is [age-restricted](/developers/docs/interactions/application-commands#agerestricted-commands) | ## Delete Guild Application Command -/applications/[\{application.id\}](/docs/resources/application#application-object)/guilds/[\{guild.id\}](/docs/resources/guild#guild-object)/commands/[\{command.id\}](/docs/interactions/application-commands#application-command-object) +/applications/[\{application.id\}](/developers/docs/resources/application#application-object)/guilds/[\{guild.id\}](/developers/docs/resources/guild#guild-object)/commands/[\{command.id\}](/developers/docs/interactions/application-commands#application-command-object) Delete a guild command. Returns `204 No Content` on success. ## Bulk Overwrite Guild Application Commands -/applications/[\{application.id\}](/docs/resources/application#application-object)/guilds/[\{guild.id\}](/docs/resources/guild#guild-object)/commands +/applications/[\{application.id\}](/developers/docs/resources/application#application-object)/guilds/[\{guild.id\}](/developers/docs/resources/guild#guild-object)/commands -Takes a list of application commands, overwriting the existing command list for this application for the targeted guild. Returns `200` and a list of [application command](/docs/interactions/application-commands#application-command-object) objects. +Takes a list of application commands, overwriting the existing command list for this application for the targeted guild. Returns `200` and a list of [application command](/developers/docs/interactions/application-commands#application-command-object) objects. -:::danger + This will overwrite **all** types of application commands: slash commands, user commands, and message commands. -::: + + ###### JSON Params -| Field | Type | Description | -|-----------------------------|------------------------------------------------------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| -| id? | snowflake | ID of the command, if known | -| name | string | [Name of command](/docs/interactions/application-commands#application-command-object-application-command-naming), 1-32 characters | -| name_localizations? | ?dictionary with keys in [available locales](/docs/reference#locales) | Localization dictionary for the `name` field. Values follow the same restrictions as `name` | -| description | string | 1-100 character description | -| description_localizations? | ?dictionary with keys in [available locales](/docs/reference#locales) | Localization dictionary for the `description` field. Values follow the same restrictions as `description` | -| options? | array of [application command option](/docs/interactions/application-commands#application-command-object-application-command-option-structure) | Parameters for the command | -| default_member_permissions? | ?string | Set of [permissions](/docs/topics/permissions) represented as a bit set | -| dm_permission? | ?boolean | **Deprecated (use `contexts` instead)**; Indicates whether the command is available in DMs with the app, only for globally-scoped commands. By default, commands are visible. | -| default_permission? | boolean | Replaced by `default_member_permissions` and will be deprecated in the future. Indicates whether the command is enabled by default when the app is added to a guild. Defaults to `true` | -| integration_types | list of [integration types](/docs/resources/application#application-object-application-integration-types) | [Installation context(s)](/docs/resources/application#installation-context) where the command is available, defaults to `GUILD_INSTALL` (`[0]`) | -| contexts | list of [interaction context types](/docs/interactions/receiving-and-responding#interaction-object-interaction-context-types) | [Interaction context(s)](/docs/interactions/receiving-and-responding#interaction-object-interaction-context-types) where the command can be used, defaults to all contexts `[0,1,2]` | -| type? | one of [application command type](/docs/interactions/application-commands#application-command-object-application-command-types) | Type of command, defaults `1` if not set | -| nsfw? | boolean | Indicates whether the command is [age-restricted](/docs/interactions/application-commands#agerestricted-commands) | +| Field | Type | Description | +|-----------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| id? | snowflake | ID of the command, if known | +| name | string | [Name of command](/developers/docs/interactions/application-commands#application-command-object-application-command-naming), 1-32 characters | +| name_localizations? | ?dictionary with keys in [available locales](/developers/docs/reference#locales) | Localization dictionary for the `name` field. Values follow the same restrictions as `name` | +| description | string | 1-100 character description | +| description_localizations? | ?dictionary with keys in [available locales](/developers/docs/reference#locales) | Localization dictionary for the `description` field. Values follow the same restrictions as `description` | +| options? | array of [application command option](/developers/docs/interactions/application-commands#application-command-object-application-command-option-structure) | Parameters for the command | +| default_member_permissions? | ?string | Set of [permissions](/developers/docs/topics/permissions) represented as a bit set | +| dm_permission? | ?boolean | **Deprecated (use `contexts` instead)**; Indicates whether the command is available in DMs with the app, only for globally-scoped commands. By default, commands are visible. | +| default_permission? | boolean | Replaced by `default_member_permissions` and will be deprecated in the future. Indicates whether the command is enabled by default when the app is added to a guild. Defaults to `true` | +| integration_types | list of [integration types](/developers/docs/resources/application#application-object-application-integration-types) | [Installation context(s)](/developers/docs/resources/application#installation-context) where the command is available, defaults to `GUILD_INSTALL` (`[0]`) | +| contexts | list of [interaction context types](/developers/docs/interactions/receiving-and-responding#interaction-object-interaction-context-types) | [Interaction context(s)](/developers/docs/interactions/receiving-and-responding#interaction-object-interaction-context-types) where the command can be used, defaults to all contexts `[0,1,2]` | +| type? | one of [application command type](/developers/docs/interactions/application-commands#application-command-object-application-command-types) | Type of command, defaults `1` if not set | ## Get Guild Application Command Permissions -/applications/[\{application.id\}](/docs/resources/application#application-object)/guilds/[\{guild.id\}](/docs/resources/guild#guild-object)/commands/permissions +/applications/[\{application.id\}](/developers/docs/resources/application#application-object)/guilds/[\{guild.id\}](/developers/docs/resources/guild#guild-object)/commands/permissions -Fetches permissions for all commands for your application in a guild. Returns an array of [guild application command permissions](/docs/interactions/application-commands#application-command-permissions-object-guild-application-command-permissions-structure) objects. +Fetches permissions for all commands for your application in a guild. Returns an array of [guild application command permissions](/developers/docs/interactions/application-commands#application-command-permissions-object-guild-application-command-permissions-structure) objects. ## Get Application Command Permissions -/applications/[\{application.id\}](/docs/resources/application#application-object)/guilds/[\{guild.id\}](/docs/resources/guild#guild-object)/commands/[\{command.id\}](/docs/interactions/application-commands#application-command-object)/permissions +/applications/[\{application.id\}](/developers/docs/resources/application#application-object)/guilds/[\{guild.id\}](/developers/docs/resources/guild#guild-object)/commands/[\{command.id\}](/developers/docs/interactions/application-commands#application-command-object)/permissions -Fetches permissions for a specific command for your application in a guild. Returns a [guild application command permissions](/docs/interactions/application-commands#application-command-permissions-object-guild-application-command-permissions-structure) object. +Fetches permissions for a specific command for your application in a guild. Returns a [guild application command permissions](/developers/docs/interactions/application-commands#application-command-permissions-object-guild-application-command-permissions-structure) object. ## Edit Application Command Permissions -/applications/[\{application.id\}](/docs/resources/application#application-object)/guilds/[\{guild.id\}](/docs/resources/guild#guild-object)/commands/[\{command.id\}](/docs/interactions/application-commands#application-command-object)/permissions +/applications/[\{application.id\}](/developers/docs/resources/application#application-object)/guilds/[\{guild.id\}](/developers/docs/resources/guild#guild-object)/commands/[\{command.id\}](/developers/docs/interactions/application-commands#application-command-object)/permissions -:::warn + This endpoint will overwrite existing permissions for the command in that guild -::: + -Edits command permissions for a specific command for your application in a guild and returns a [guild application command permissions](/docs/interactions/application-commands#application-command-permissions-object-guild-application-command-permissions-structure) object. Fires an [Application Command Permissions Update](/docs/events/gateway-events#application-command-permissions-update) Gateway event. +Edits command permissions for a specific command for your application in a guild and returns a [guild application command permissions](/developers/docs/interactions/application-commands#application-command-permissions-object-guild-application-command-permissions-structure) object. Fires an [Application Command Permissions Update](/developers/docs/events/gateway-events#application-command-permissions-update) Gateway event. You can add up to 100 permission overwrites for a command. -:::info -This endpoint requires authentication with a Bearer token that has permission to manage the guild and its roles. For more information, read above about [application command permissions](/docs/interactions/application-commands#permissions). -::: + +This endpoint requires authentication with a Bearer token that has permission to manage the guild and its roles. For more information, read above about [application command permissions](/developers/docs/interactions/application-commands#permissions). + -:::warn + Deleting or renaming a command will permanently delete all permissions for the command -::: + + ###### JSON Params -| Field | Type | Description | -|-------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------|------------------------------------------| -| permissions | array of [application command permissions](/docs/interactions/application-commands#application-command-permissions-object-application-command-permissions-structure) | Permissions for the command in the guild | +| Field | Type | Description | +|-------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|------------------------------------------| +| permissions | array of [application command permissions](/developers/docs/interactions/application-commands#application-command-permissions-object-application-command-permissions-structure) | Permissions for the command in the guild | ## Batch Edit Application Command Permissions -/applications/[\{application.id\}](/docs/resources/application#application-object)/guilds/[\{guild.id\}](/docs/resources/guild#guild-object)/commands/permissions +/applications/[\{application.id\}](/developers/docs/resources/application#application-object)/guilds/[\{guild.id\}](/developers/docs/resources/guild#guild-object)/commands/permissions -:::danger -This endpoint has been disabled with [updates to command permissions (Permissions v2)](/docs/change-log#updated-command-permissions). Instead, you can [edit each application command permissions](/docs/interactions/application-commands#edit-application-command-permissions) (though you should be careful to handle any potential [rate limits](/docs/topics/rate-limits)). -::: + +This endpoint has been disabled with [updates to command permissions (Permissions v2)](/developers/docs/change-log#updated-command-permissions). Instead, you can [edit each application command permissions](/developers/docs/interactions/application-commands#edit-application-command-permissions) (though you should be careful to handle any potential [rate limits](/developers/docs/topics/rate-limits)). + diff --git a/docs/interactions/overview.mdx b/discord/developers/docs/interactions/overview.mdx similarity index 61% rename from docs/interactions/overview.mdx rename to discord/developers/docs/interactions/overview.mdx index 8aa2bf8b47..62df0b5523 100644 --- a/docs/interactions/overview.mdx +++ b/discord/developers/docs/interactions/overview.mdx @@ -1,12 +1,12 @@ --- -sidebar_label: Overview +title: Overview of Interactions +sidebarTitle: Overview +description: Learn about Discord's interactive features including commands and message components. --- -# Overview of Interactions +Interactive features like commands and message components allows users to invoke an app natively within Discord. When a user engages with one of your app's interactive features, your app will receive an [interaction](/developers/docs/interactions/receiving-and-responding#interaction-object). -Interactive features like commands and message components allows users to invoke an app natively within Discord. When a user engages with one of your app's interactive features, your app will receive an [interaction](/docs/interactions/receiving-and-responding#interaction-object). - -This overview includes an overview of the main types of interactions, and steps for you to prepare your app to use and receive interactions. Reference documentation and details about handling interactions are in [Receiving and Responding](/docs/interactions/receiving-and-responding). +This overview includes an overview of the main types of interactions, and steps for you to prepare your app to use and receive interactions. Reference documentation and details about handling interactions are in [Receiving and Responding](/developers/docs/interactions/receiving-and-responding). --- @@ -16,42 +16,42 @@ There are different types of interactions in your app's toolbelt that can pick a ### Commands -**[Application commands](/docs/interactions/application-commands)** provide users a native way to invoke an app in Discord. They often map to an app's core features or functionality. +**[Application commands](/developers/docs/interactions/application-commands)** provide users a native way to invoke an app in Discord. They often map to an app's core features or functionality. -![Command launcher in the Desktop client](images/overview-command-desktop.webp) +![Command launcher in the Desktop client](/images/overview-command-desktop.png) When an app creates a command it can choose the command's type, which determines where it appears in the Discord client and the metadata the app will receive when the command is invoked. There are three types for application commands: - **Slash commands** are the most common type of command and are accessed by typing `/` in the chat input, or by opening the command picker. - **Message commands** are commands related to a message or a message's content. They're accessed by clicking on the context menu (the three dots) at the top-right of a message (or right clicking on a message), then navigating to the "Apps" section. - **User commands** are commands that related to a user in Discord. They're accessed by right clicking on a user profile, then navigating to the "Apps" section. -- **Entry Point commands** are commands used as the primary way to launch [Activities](/docs/activities/overview) from the App Launcher. +- **Entry Point commands** are commands used as the primary way to launch [Activities](/developers/docs/activities/overview) from the App Launcher. -Details about creating commands and handling command interactions are in the [Application Commands](/docs/interactions/application-commands) documentation. +Details about creating commands and handling command interactions are in the [Application Commands](/developers/docs/interactions/application-commands) documentation. ### Message Components -**[Message components](/docs/components/reference)** are interactive elements that can be included in the content of a message that your app sends in Discord. +**[Message components](/developers/docs/components/reference)** are interactive elements that can be included in the content of a message that your app sends in Discord. -![Button message components in a message](images/overview-components.webp) +![Button message components in a message](/images/overview-components.png) The main interactive components that apps can send in messages include: -- [Buttons](/docs/components/reference#button) are clickable components that can be customized with different styles, texts, and emoji. -- [Static select menus](/docs/components/reference#string-select) are components that a user can open to see a list of developer-defined select options with custom labels and descriptions. -- [Auto-populated select menus](/docs/components/reference#string-select) are a set of four different select components that are populated with contextual Discord resources, like a list of users or channels in a server. +- [Buttons](/developers/docs/components/reference#button) are clickable components that can be customized with different styles, texts, and emoji. +- [Static select menus](/developers/docs/components/reference#string-select) are components that a user can open to see a list of developer-defined select options with custom labels and descriptions. +- [Auto-populated select menus](/developers/docs/components/reference#string-select) are a set of four different select components that are populated with contextual Discord resources, like a list of users or channels in a server. -A list of all message components and details on sending and receiving component interactions is in the [Message Components](/docs/components/reference) documentation. +A list of all message components and details on sending and receiving component interactions is in the [Message Components](/developers/docs/components/reference) documentation. ### Modals -**[Modals](/docs/interactions/receiving-and-responding#interaction-response-object-modal)** are single-user pop-up interfaces that allow apps to collect form-like data. Modals can only be opened in response to a user invoking one of your app's commands or message components. +**[Modals](/developers/docs/interactions/receiving-and-responding#interaction-response-object-modal)** are single-user pop-up interfaces that allow apps to collect form-like data. Modals can only be opened in response to a user invoking one of your app's commands or message components. -![Modals in the Discord client](images/overview-modals.webp) +![Modals in the Discord client](/images/overview-modals.png) -The components that modals can contain are found in the [component reference](/docs/components/reference). The data received after a modal is submitted can be found in [each component's interaction response structure](/docs/interactions/receiving-and-responding#interaction-response-object-modal). +The only interactive component that modals can contain are [text inputs](/developers/docs/components/reference#text-input), which allow users to fill out single-or-multi line form inputs. -Details about creating and using modals is in the [Receiving and Responding](/docs/interactions/receiving-and-responding#interaction-response-object-modal) documentation. +Details about creating and using modals is in the [Receiving and Responding](/developers/docs/interactions/receiving-and-responding#interaction-response-object-modal) documentation. --- @@ -61,11 +61,11 @@ When a user interacts with your app, you have the option for your app to receive - WebSocket-based Gateway connection - HTTP via outgoing webhooks -By default your app will receive interactions via a Gateway connection, but you can opt-in to HTTP-based interactions by adding a **Interactions Endpoint URL** to your app's settings. Technical details about handling interactions is in the [Receiving and Responding](/docs/interactions/receiving-and-responding) documentation. +By default your app will receive interactions via a Gateway connection, but you can opt-in to HTTP-based interactions by adding a **Interactions Endpoint URL** to your app's settings. Technical details about handling interactions is in the [Receiving and Responding](/developers/docs/interactions/receiving-and-responding) documentation. ### Configuring an Interactions Endpoint URL -A **Interactions Endpoint URL** is a public endpoint for your app where Discord can send your app HTTP-based interactions. If your app is using [Gateway](/docs/events/gateway)-based interactions, you don't need to configure an Interactions Endpoint URL. +A **Interactions Endpoint URL** is a public endpoint for your app where Discord can send your app HTTP-based interactions. If your app is using [Gateway](/developers/docs/events/gateway)-based interactions, you don't need to configure an Interactions Endpoint URL. #### Setting Up an Endpoint @@ -76,15 +76,15 @@ Before you can add your Interactions Endpoint URL to your app, your endpoint mus If either of these are not complete, your Interactions Endpoint URL will not be validated. Details on acknowledging PING requests and validating security-related headers are in the sections below. -###### Acknowledging PING requests +#### Acknowledging PING requests -When adding your Interactions Endpoint URL, Discord will send a `POST` request with a `PING` payload with a `type: 1` to your endpoint. Your app is expected to acknowledge the request by returning a `200` response with a `PONG` payload (which has the same `type: 1`). Details about interaction responses are in the [Receiving and Responding documentation](/docs/interactions/receiving-and-responding). +When adding your Interactions Endpoint URL, Discord will send a `POST` request with a `PING` payload with a `type: 1` to your endpoint. Your app is expected to acknowledge the request by returning a `200` response with a `PONG` payload (which has the same `type: 1`). Details about interaction responses are in the [Receiving and Responding documentation](/developers/docs/interactions/receiving-and-responding). -:::info -You must provide a valid `Content-Type` when responding to `PING`s. See [here](/docs/reference#http-api) for further information. -::: + +You must provide a valid `Content-Type` when responding to `PING`s. See [here](/developers/docs/reference#http-api) for further information. + - + To properly acknowledge a `PING` payload, return a `200` response with a payload of `type: 1`: ```py @@ -95,8 +95,9 @@ def my_command(): "type": 1 }) ``` - + + ###### Validating Security Request Headers The internet is a scary place, especially for people hosting public, unauthenticated endpoints. To receive interactions via HTTP, there are some security steps you **must** take before your app is eligible to receive requests. @@ -106,9 +107,9 @@ Each interaction is sent with the following headers: - `X-Signature-Ed25519` as a signature - `X-Signature-Timestamp` as a timestamp -Using your favorite security library, you **must validate the request each time you receive an [interaction](/docs/interactions/receiving-and-responding#interaction-object)**. If the signature fails validation, your app should respond with a `401` error code. +Using your favorite security library, you **must validate the request each time you receive an [interaction](/developers/docs/interactions/receiving-and-responding#interaction-object)**. If the signature fails validation, your app should respond with a `401` error code. - + Below are some code examples that show how to validate the headers sent in interactions requests. **JavaScript** @@ -154,11 +155,11 @@ try: except BadSignatureError: abort(401, 'invalid request signature') ``` - + In addition to ensuring your app validates security-related request headers at the time of saving your endpoint, Discord will also perform automated, routine security checks against your endpoint, including purposefully sending you invalid signatures. If you fail the validation, we will remove your interactions URL and alert you via email and System DM. -We highly recommend checking out our [Community Resources](/docs/developer-tools/community-resources#interactions) and the libraries found there. They not only provide typing for Interactions data models, but also include decorators for API frameworks like Flask and Express to make validation easy. +We highly recommend checking out our [Community Resources](/developers/docs/developer-tools/community-resources#interactions) and the libraries found there. They not only provide typing for Interactions data models, but also include decorators for API frameworks like Flask and Express to make validation easy. #### Adding an Interactions Endpoint URL @@ -170,4 +171,4 @@ On the **General Overview** page, look for the **Interactive Endpoint URL** fiel ## Handling Interactions -Once your app is prepared for interactions, you can explore the [Receiving and Responding](/docs/interactions/receiving-and-responding) documentation which goes into the technical details of handling interactions requests in your app. +Once your app is prepared for interactions, you can explore the [Receiving and Responding](/developers/docs/interactions/receiving-and-responding) documentation which goes into the technical details of handling interactions requests in your app. diff --git a/discord/developers/docs/interactions/receiving-and-responding.mdx b/discord/developers/docs/interactions/receiving-and-responding.mdx new file mode 100644 index 0000000000..16a076bbc7 --- /dev/null +++ b/discord/developers/docs/interactions/receiving-and-responding.mdx @@ -0,0 +1,489 @@ +--- +title: Interactions +sidebarTitle: Receiving and Responding +description: Learn how to receive and respond to user interactions. +--- + +import {ManualAnchor} from '/snippets/manualanchor.jsx' +import {Route} from '/snippets/route.jsx' + +An **[Interaction](/developers/docs/interactions/receiving-and-responding#interaction-object)** is the message that your application receives when a user uses an application command or a message component. + +For [Slash Commands](/developers/docs/interactions/application-commands#slash-commands), it includes the values that the user submitted. + +For [User Commands](/developers/docs/interactions/application-commands#user-commands) and [Message Commands](/developers/docs/interactions/application-commands#message-commands), it includes the resolved user or message on which the action was taken. + +For [Message Components](/developers/docs/components/reference) it includes identifying information about the component that was used. It will also include some metadata about how the interaction was triggered: the `guild_id`, `channel`, `member` and other fields. You can find all the values in our data models below. + +### Interaction Object + + +###### Interaction Structure + +| Field | Type | Description | +|--------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| id | snowflake | ID of the interaction | +| application_id | snowflake | ID of the application this interaction is for | +| type | [interaction type](/developers/docs/interactions/receiving-and-responding#interaction-object-interaction-type) | Type of interaction | +| data?\* | [interaction data](/developers/docs/interactions/receiving-and-responding#interaction-object-interaction-data) | Interaction data payload | +| guild? | [partial guild](/developers/docs/resources/guild#guild-object) object | Guild that the interaction was sent from | +| guild_id? | snowflake | Guild that the interaction was sent from | +| channel? | [partial channel](/developers/docs/resources/channel#channel-object) object | Channel that the interaction was sent from | +| channel_id? | snowflake | Channel that the interaction was sent from | +| member?\*\* | [guild member](/developers/docs/resources/guild#guild-member-object) object | Guild member data for the invoking user, including permissions | +| user? | [user](/developers/docs/resources/user#user-object) object | User object for the invoking user, if invoked in a DM | +| token | string | Continuation token for responding to the interaction | +| version | integer | Read-only property, always `1` | +| message? | [message](/developers/docs/resources/message#message-object) object | For components or modals triggered by components, the message they were attached to | +| app_permissions\*\*\* | string | Bitwise set of permissions the app has in the source location of the interaction | +| locale?\*\*\*\* | string | Selected [language](/developers/docs/reference#locales) of the invoking user | +| guild_locale? | string | [Guild's preferred locale](/developers/docs/resources/guild#guild-object), if invoked in a guild | +| entitlements | array of [entitlement](/developers/docs/resources/entitlement#entitlement-object) objects | For [monetized apps](/developers/docs/monetization/overview), any entitlements for the invoking user, representing access to premium [SKUs](/developers/docs/resources/sku) | +| authorizing_integration_owners | dictionary with keys of [application integration types](/developers/docs/resources/application#application-object-application-integration-types) | Mapping of installation contexts that the interaction was authorized for to related user or guild IDs. See [Authorizing Integration Owners Object](/developers/docs/interactions/receiving-and-responding#interaction-object-authorizing-integration-owners-object) for details | +| context? | [interaction context type](/developers/docs/interactions/receiving-and-responding#interaction-object-interaction-context-types) | Context where the interaction was triggered from | +| attachment_size_limit | integer | Attachment size limit in bytes | + +\* This is always present on application command, message component, and modal submit interaction types. It is optional for future-proofing against new interaction types + +\*\* `member` is sent when the interaction is invoked in a guild, and `user` is sent when invoked in a DM + +\*\*\* `app_permissions` includes `ATTACH_FILES | EMBED_LINKS | MENTION_EVERYONE` permissions for (G)DMs with other users, and additionally includes `USE_EXTERNAL_EMOJIS` for DMs with the app's bot user + +\*\*\*\* This is available on all interaction types except PING + + +###### Interaction Type + +| Name | Value | +|----------------------------------|-------| +| PING | 1 | +| APPLICATION_COMMAND | 2 | +| MESSAGE_COMPONENT | 3 | +| APPLICATION_COMMAND_AUTOCOMPLETE | 4 | +| MODAL_SUBMIT | 5 | + + +###### Interaction Context Types + +Context in Discord where an interaction can be used, or where it was triggered from. Details about using interaction contexts for application commands is in the [commands context documentation](/developers/docs/interactions/application-commands#interaction-contexts). + +| Name | Type | Description | +|-----------------|------|--------------------------------------------------------------------------------| +| GUILD | 0 | Interaction can be used within servers | +| BOT_DM | 1 | Interaction can be used within DMs with the app's bot user | +| PRIVATE_CHANNEL | 2 | Interaction can be used within Group DMs and DMs other than the app's bot user | + + +###### Authorizing Integration Owners Object + +The `authorizing_integration_owners` field includes details about the authorizing user or server for the installation(s) relevant to the interaction. For apps installed to a user, it can be used to tell the difference between the authorizing user and the user that triggered an interaction (like a message component). + +A key will only be present if the following are true: +- The app has been authorized to the [installation context](/developers/docs/resources/application#application-object-application-integration-types) corresponding to the key (`GUILD_INSTALL` or `USER_INSTALL`) +- The interaction is supported in the source [interaction context](/developers/docs/interactions/receiving-and-responding#interaction-object-interaction-context-types) (`GUILD`, `BOT_DM`, or `PRIVATE_CHANNEL`) for the installation context corresponding to the key +- And for command invocations, the command must be supported in the installation context (using [`integration_types`](/developers/docs/interactions/application-commands#contexts)) + +The values in `authorizing_integration_owners` depend on the key— + +- If the key is `GUILD_INSTALL` (`"0"`), the value depends on the source of the interaction: + - The value will be the guild ID if the interaction is triggered from a server + - The value will be `"0"` if the interaction is triggered from a DM with the app's bot user +- If the key is `USER_INSTALL` (`"1"`), the value will be the ID of the authorizing user + + +###### Interaction Data + +While the `data` field is guaranteed to be present for all [interaction types](/developers/docs/interactions/receiving-and-responding#interaction-object-interaction-type) besides `PING`, its structure will vary. The following tables detail the inner `data` payload for each interaction type. + +| Interaction Type | Interaction Data | +|----------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------| +| PING (`1`) | N / A | +| APPLICATION_COMMAND (`2`) | [Application Command Data Structure](/developers/docs/interactions/receiving-and-responding#interaction-object-application-command-data-structure) | +| MESSAGE_COMPONENT (`3`) | [Message Component Data Structure](/developers/docs/interactions/receiving-and-responding#interaction-object-message-component-data-structure) | +| APPLICATION_COMMAND_AUTOCOMPLETE (`4`) | [Application Command Data Structure](/developers/docs/interactions/receiving-and-responding#interaction-object-application-command-data-structure) | +| MODAL_SUBMIT (`5`) | [Modal Submit Data Structure](/developers/docs/interactions/receiving-and-responding#interaction-object-modal-submit-data-structure) | + + +###### Application Command Data Structure + + +Sent in `APPLICATION_COMMAND` and `APPLICATION_COMMAND_AUTOCOMPLETE` interactions. + + +| Field | Type | Description | +|------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| id | snowflake | [`ID`](/developers/docs/interactions/application-commands#application-command-object-application-command-structure) of the invoked command | +| name | string | [`name`](/developers/docs/interactions/application-commands#application-command-object-application-command-structure) of the invoked command | +| type | integer | [`type`](/developers/docs/interactions/application-commands#application-command-object-application-command-structure) of the invoked command | +| resolved? | [resolved data](/developers/docs/interactions/receiving-and-responding#interaction-object-resolved-data-structure) | Converted users + roles + channels + attachments | +| options?\* | array of [application command interaction data option](/developers/docs/interactions/receiving-and-responding#interaction-object-application-command-interaction-data-option-structure) | Params + values from the user | +| guild_id? | snowflake | ID of the guild the command is registered to | +| target_id? | snowflake | ID of the user or message targeted by a [user](/developers/docs/interactions/application-commands#user-commands) or [message](/developers/docs/interactions/application-commands#message-commands) command | + +\* This [can be partial](/developers/docs/interactions/application-commands#autocomplete) when in response to `APPLICATION_COMMAND_AUTOCOMPLETE` + + +###### Message Component Data Structure + +| Field | Type | Description | +|----------------|--------------------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------| +| custom_id | string | [`custom_id`](/developers/docs/components/reference#anatomy-of-a-component-custom-id) of the component | +| component_type | integer | [type](/developers/docs/components/reference#component-object-component-types) of the component | +| values?\* | array of [select option values](/developers/docs/components/reference#string-select-select-option-structure) | Values the user selected in a [select menu](/developers/docs/components/reference#string-select) component | +| resolved? | [resolved data](/developers/docs/interactions/receiving-and-responding#interaction-object-resolved-data-structure) | Resolved entities from selected options | + +\* This is always present for select menu components + + +###### Modal Submit Data Structure + +| Field | Type | Description | +|------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------|-----------------------------------------| +| custom_id | string | The custom ID provided for the modal | +| components | array of [component interaction response](/developers/docs/interactions/receiving-and-responding#interaction-object-component-interaction-response-structures) | Values submitted by the user | +| resolved? | [resolved data](/developers/docs/interactions/receiving-and-responding#interaction-object-resolved-data-structure) | Resolved entities from selected options | + + +###### Component Interaction Response Structures + +| Component | +|----------------------------------------------------------------------------------------------------------------------------------| +| [String Select](/developers/docs/components/reference#string-select-string-select-interaction-response-structure) | +| [Text Input](/developers/docs/components/reference#text-input-text-input-interaction-response-structure) | +| [User Select](/developers/docs/components/reference#user-select-user-select-interaction-response-structure) | +| [Role Select](/developers/docs/components/reference#role-select-role-select-interaction-response-structure) | +| [Mentionable Select](/developers/docs/components/reference#mentionable-select-mentionable-select-interaction-response-structure) | +| [Channel Select](/developers/docs/components/reference#channel-select-channel-select-interaction-response-structure) | +| [Text Display](/developers/docs/components/reference#text-display-text-display-interaction-response-structure) | +| [Label](/developers/docs/components/reference#label-label-interaction-response-structure) | +| [File Upload](/developers/docs/components/reference#file-upload-file-upload-interaction-response-structure) | + + +###### Resolved Data Structure + + +If data for a Member is included, data for its corresponding User will also be included. + + +| Field | Type | Description | +|---------------|-----------------------------------------------------------------------------------------------------|---------------------------------| +| users? | Map of Snowflakes to [user](/developers/docs/resources/user#user-object) objects | IDs and User objects | +| members?\* | Map of Snowflakes to [partial member](/developers/docs/resources/guild#guild-member-object) objects | IDs and partial Member objects | +| roles? | Map of Snowflakes to [role](/developers/docs/topics/permissions#role-object) objects | IDs and Role objects | +| channels?\*\* | Map of Snowflakes to [partial channel](/developers/docs/resources/channel#channel-object) objects | IDs and partial Channel objects | +| messages? | Map of Snowflakes to [partial messages](/developers/docs/resources/message#message-object) objects | IDs and partial Message objects | +| attachments? | Map of Snowflakes to [attachment](/developers/docs/resources/message#attachment-object) objects | IDs and attachment objects | + +\* Partial `Member` objects are missing `user`, `deaf` and `mute` fields + +\*\* Partial `Channel` objects only have `id`, `name`, `type`, `permissions`, `last_message_id`, `last_pin_timestamp`, `nsfw`, `parent_id`, `guild_id`, `flags`, `rate_limit_per_user`, `topic` and `position` fields. Threads will also have the `thread_metadata` field. + + +###### Application Command Interaction Data Option Structure + +All options have names, and an option can either be a parameter and input value--in which case `value` will be set--or it can denote a subcommand or group--in which case it will contain a top-level key and another array of `options`. + +`value` and `options` are mutually exclusive. + +| Field | Type | Description | +|----------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------| +| name | string | Name of the parameter | +| type | integer | Value of [application command option type](/developers/docs/interactions/application-commands#application-command-object-application-command-option-type) | +| value? | string, integer, double, or boolean | Value of the option resulting from user input | +| options? | array of [application command interaction data option](/developers/docs/interactions/receiving-and-responding#interaction-object-application-command-interaction-data-option-structure) | Present if this option is a group or subcommand | +| focused? | boolean | `true` if this option is the currently focused option for autocomplete | + +### Message Interaction Object + +This is sent on the [message object](/developers/docs/resources/message#message-object) when the message is a response to an Interaction without an existing message. + + +This means responses to [Message Components](/developers/docs/components/reference) do not include this property, instead including a [message reference](/developers/docs/resources/message#message-reference-structure) object as components _always_ exist on preexisting messages. + + + +###### Message Interaction Structure + +| Field | Type | Description | +|---------|----------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| id | snowflake | ID of the interaction | +| type | [interaction type](/developers/docs/interactions/receiving-and-responding#interaction-object-interaction-type) | Type of interaction | +| name | string | Name of the [application command](/developers/docs/interactions/application-commands#application-command-object-application-command-structure), including subcommands and subcommand groups | +| user | [user object](/developers/docs/resources/user#user-object) | User who invoked the interaction | +| member? | [partial member](/developers/docs/resources/guild#guild-member-object) object | Member who invoked the interaction in the guild | + +## Receiving an Interaction + +When a user interacts with your app, your app will receive an **[Interaction](/developers/docs/interactions/receiving-and-responding#interaction-object)**. Your app can receive an interaction in one of two ways: + +- Via [Interaction Create](/developers/docs/events/gateway-events#interaction-create) gateway event +- Via outgoing webhook + +These two methods are **mutually exclusive**; you can _only_ receive Interactions one of the two ways. The `INTERACTION_CREATE` [Gateway Event](/developers/docs/events/gateway-events#interaction-create) may be handled by connected clients, while the webhook method detailed below does not require a connected client. + +If you want to receive interactions via HTTP-based outgoing webhooks, you must configure an Interactions Endpoint URL for your app. You can read about preparing and adding an Interactions Endpoint URL to your app in the [Preparing for Interactions](/developers/docs/interactions/overview#preparing-for-interactions) section in Interactions Overview. + +### Interaction Metadata + +An [Interaction](/developers/docs/interactions/receiving-and-responding#interaction-object) includes metadata to aid your application in handling it as well as `data` specific to the interaction type. You can find samples for each interaction type on their respective pages: + +- [Slash Commands](/developers/docs/interactions/application-commands#slash-commands-example-interaction) +- [User Commands](/developers/docs/interactions/application-commands#user-commands-example-interaction) +- [Message Commands](/developers/docs/interactions/application-commands#message-commands-example-interaction) +- [Message Components](/developers/docs/components/using-message-components) +- [Modal Components](/developers/docs/components/using-modal-components) + +An explanation of all the fields can be found in our [data models](/developers/docs/interactions/receiving-and-responding#interaction-object). + +Now that you've gotten the data from the user, it's time to respond to them. + +## Responding to an Interaction + +Interactions--both receiving and responding--are webhooks under the hood. So responding to an Interaction is just like sending a webhook request! + + +Interaction responses have the same header requirements as normal HTTP API requests. See [here](/developers/docs/reference#http-api) for further information. + + +There are a number of ways you can respond to an interaction: + +### Interaction Response Object + + +###### Interaction Response Structure + +| Field | Type | Description | +|-------|-----------------------------------------------------------------------------------------------------------------------------------------------------|------------------------------| +| type | [interaction callback type](/developers/docs/interactions/receiving-and-responding#interaction-response-object-interaction-callback-type) | Type of response | +| data? | [interaction callback data](/developers/docs/interactions/receiving-and-responding#interaction-response-object-interaction-callback-data-structure) | An optional response message | + + +###### Interaction Callback Type + +| Name | Value | Description | +|-----------------------------------------|-------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| PONG | 1 | ACK a `Ping` | +| CHANNEL_MESSAGE_WITH_SOURCE | 4 | Respond to an interaction with a message | +| DEFERRED_CHANNEL_MESSAGE_WITH_SOURCE | 5 | ACK an interaction and edit a response later, the user sees a loading state | +| DEFERRED_UPDATE_MESSAGE\* | 6 | For components, ACK an interaction and edit the original message later; the user does not see a loading state | +| UPDATE_MESSAGE\* | 7 | For components, edit the message the component was attached to | +| APPLICATION_COMMAND_AUTOCOMPLETE_RESULT | 8 | Respond to an autocomplete interaction with suggested choices | +| MODAL\*\* | 9 | Respond to an interaction with a popup modal | +| PREMIUM_REQUIRED | 10 | [**Deprecated**](/developers/docs/change-log#premium-apps-new-premium-button-style-deep-linking-url-schemes); respond to an interaction with an upgrade button, only available for apps with [monetization](/developers/docs/monetization/overview) enabled | +| LAUNCH_ACTIVITY | 12 | Launch the Activity associated with the app. Only available for apps with [Activities](/developers/docs/activities/overview) enabled | + +\* Only valid for [component-based](/developers/docs/components/reference) interactions + +\*\* Not available for `MODAL_SUBMIT` and `PING` interactions. + + +###### Interaction Callback Data Structure + + +###### Messages + +Not all message fields are currently supported. + + +| Field | Type | Description | +|-------------------|---------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| tts? | boolean | Whether the response is TTS | +| content? | string | Message content | +| embeds? | array of [embeds](/developers/docs/resources/message#embed-object) | Supports up to 10 embeds | +| allowed_mentions? | [allowed mentions](/developers/docs/resources/message#allowed-mentions-object) | [Allowed mentions](/developers/docs/resources/message#allowed-mentions-object) object | +| flags? \* | integer | [Message flags](/developers/docs/resources/message#message-object-message-flags) combined as a [bitfield](https://en.wikipedia.org/wiki/Bit_field) (only `SUPPRESS_EMBEDS`, `EPHEMERAL`, `IS_COMPONENTS_V2`, `IS_VOICE_MESSAGE`, and `SUPPRESS_NOTIFICATIONS` can be set) | +| components? | array of [components](/developers/docs/components/reference#component-object) | Message components | +| attachments? \*\* | array of partial [attachment](/developers/docs/resources/message#attachment-object) objects | Attachment objects with filename and description | +| poll? | [poll](/developers/docs/resources/poll#poll-create-request-object) request object | Details about the poll | + +\* If you create a callback with the [type](/developers/docs/interactions/receiving-and-responding#interaction-response-object-interaction-callback-type) `DEFERRED_CHANNEL_MESSAGE_WITH_SOURCE` the only valid [message flag](/developers/docs/resources/message#message-object-message-flags) you may use is `EPHEMERAL`. If you'd like to create a component based message with `IS_COMPONENTS_V2` you must do that with the [edit original response](/developers/docs/interactions/receiving-and-responding#edit-original-interaction-response) endpoint, not this one. + +\*\* See [Uploading Files](/developers/docs/reference#uploading-files) for details. + + +###### Autocomplete + +| Field | Type | Description | +|---------|-----------------------------------------------------------------------------------------------------------------------------------------------|------------------------------------------| +| choices | array of [choices](/developers/docs/interactions/application-commands#application-command-object-application-command-option-choice-structure) | autocomplete choices (max of 25 choices) | + + +###### Modal + +| Field | Type | Description | +|------------|-------------------------------------------------------------------------------|----------------------------------------------------------------| +| custom_id | string | Developer-defined identifier for the modal, max 100 characters | +| title | string | Title of the popup modal, max 45 characters | +| components | array of [components](/developers/docs/components/reference#component-object) | Between 1 and 5 (inclusive) components that make up the modal | + + +If your application responds with user data, you should use [`allowed_mentions`](/developers/docs/resources/message#allowed-mentions-object) to filter which mentions in the content actually ping. + + +## Interaction Callback + +When responding to an interaction received, you can make a `POST` request to `/interactions///callback`. `interaction_id` is the unique id of that individual Interaction from the received payload. `interaction_token` is the unique token for that interaction from the received payload. + +If you are receiving Interactions over the gateway, you **have to respond via HTTP**. Responses to Interactions **are not sent as commands over the gateway**. + +**If you send this request for an interaction received over HTTP, respond to the original HTTP request with a 202 and no body.** + +```py +import requests + +url = "https://discord.com/api/v10/interactions///callback" + +json = { + "type": 4, + "data": { + "content": "Congrats on sending your command!" + } +} +r = requests.post(url, json=json) +``` + + +Interaction `tokens` are valid for **15 minutes** and can be used to send followup messages but you **must send an initial response within 3 seconds of receiving the event**. If the 3 second deadline is exceeded, the token will be invalidated. + + + + If you receive interactions over HTTP, your server can also respond to the received `POST` request. You'll want to respond with a `200` status code (if everything went well), as well as specifying a `type` and `data`, which is an [Interaction Response](/developers/docs/interactions/receiving-and-responding#interaction-response-object) object: + + ```py + @app.route('/', methods=['POST']) + def my_command(): + if request.json["type"] == 1: + return jsonify({ + "type": 1 + }) + + else: + return jsonify({ + "type": 4, + "data": { + "tts": False, + "content": "Congrats on sending your command!", + "embeds": [], + "allowed_mentions": { "parse": [] } + } + }) + ``` + + + +###### Interaction Callback Response Object + +| Field | Type | Description | +|-------------|-------------------------------------------------------------------------------------------------------------------------------------------------|------------------------------------------------------------------| +| interaction | [interaction callback object](/developers/docs/interactions/receiving-and-responding#interaction-callback-interaction-callback-object) | The interaction object associated with the interaction response. | +| resource? | [interaction resource object](/developers/docs/interactions/receiving-and-responding#interaction-callback-interaction-callback-resource-object) | The resource that was created by the interaction response. | + + +###### Interaction Callback Object + +| Field | Type | Description | +|-----------------------------|-----------|----------------------------------------------------------------------------------------------------------------| +| id | snowflake | ID of the interaction | +| type | integer | [Interaction type](/developers/docs/interactions/receiving-and-responding#interaction-object-interaction-type) | +| activity_instance_id? | string | Instance ID of the Activity if one was launched or joined | +| response_message_id? | snowflake | ID of the message that was created by the interaction | +| response_message_loading? | boolean | Whether the message is in a loading state | +| response_message_ephemeral? | boolean | Whether the response message is ephemeral | + + +###### Interaction Callback Resource Object + +| Field | Type | Description | +|----------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------| +| type | integer | [Interaction callback type](/developers/docs/interactions/receiving-and-responding#interaction-response-object-interaction-callback-type) | +| activity_instance?\* | [Activity instance resource](/developers/docs/interactions/receiving-and-responding#interaction-callback-interaction-callback-activity-instance-resource) | Represents the Activity launched by this interaction. | +| message?\*\* | [message object](/developers/docs/resources/message#message-object) | Message created by the interaction. | + +\* Only present if type is `LAUNCH_ACTIVITY`. + +\*\* Only present if type is either `CHANNEL_MESSAGE_WITH_SOURCE` or `UPDATE_MESSAGE`. + + +###### Interaction Callback Activity Instance Resource + +| Field | Type | Description | +|-------|--------|------------------------------------------------------------| +| id | string | Instance ID of the Activity if one was launched or joined. | + + +## Followup Messages + +Sometimes, you want to send followup messages to a user after responding to an interaction. Or, you may want to edit your original response. Whether you receive Interactions over the gateway or by outgoing webhook, you can use the following endpoints to edit your initial response or send followup messages: + +- [`PATCH /webhooks///messages/@original`](/developers/docs/interactions/receiving-and-responding#edit-original-interaction-response) to edit your initial response to an Interaction +- [`DELETE /webhooks///messages/@original`](/developers/docs/interactions/receiving-and-responding#delete-original-interaction-response) to delete your initial response to an Interaction +- [`POST /webhooks//`](/developers/docs/interactions/receiving-and-responding#create-followup-message) to send a new followup message +- [`PATCH /webhooks///messages/`](/developers/docs/interactions/receiving-and-responding#edit-followup-message) to edit a message sent with that `token` + + +Interactions webhooks share the same rate limit properties as normal webhooks. + + +Interaction tokens are valid for **15 minutes**, meaning you can respond to an interaction within that amount of time. + +### Endpoints + + +The endpoints below are not bound to the application's [Global Rate Limit](/developers/docs/topics/rate-limits#global-rate-limit). + + +## Create Interaction Response +/interactions/[\{interaction.id\}](/developers/docs/interactions/receiving-and-responding#interaction-object)/[\{interaction.token\}](/developers/docs/interactions/receiving-and-responding#interaction-object)/callback + +Create a response to an Interaction. Body is an [interaction response](/developers/docs/interactions/receiving-and-responding#interaction-response-object). Returns `204` unless `with_response` is set to `true` which returns `200` with the body as [interaction callback response](/developers/docs/interactions/receiving-and-responding#interaction-callback-interaction-callback-response-object). + +This endpoint also supports file attachments similar to the webhook endpoints. Refer to [Uploading Files](/developers/docs/reference#uploading-files) for details on uploading files and `multipart/form-data` requests. + + +###### Query String Params + +| Field | Type | Description | +|----------------|-------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| with_response? | [boolean](/developers/docs/reference#boolean-query-strings) | Whether to include an [interaction callback object](/developers/docs/interactions/receiving-and-responding#interaction-callback-interaction-callback-response-object) as the response | + + +## Get Original Interaction Response +/webhooks/[\{application.id\}](/developers/docs/resources/application#application-object)/[\{interaction.token\}](/developers/docs/interactions/receiving-and-responding#interaction-object)/messages/@original + +Returns the initial Interaction response. Functions the same as [Get Webhook Message](/developers/docs/resources/webhook#get-webhook-message). + +## Edit Original Interaction Response +/webhooks/[\{application.id\}](/developers/docs/resources/application#application-object)/[\{interaction.token\}](/developers/docs/interactions/receiving-and-responding#interaction-object)/messages/@original + +Edits the initial Interaction response. Functions the same as [Edit Webhook Message](/developers/docs/resources/webhook#edit-webhook-message). + +## Delete Original Interaction Response +/webhooks/[\{application.id\}](/developers/docs/resources/application#application-object)/[\{interaction.token\}](/developers/docs/interactions/receiving-and-responding#interaction-object)/messages/@original + +Deletes the initial Interaction response. Returns `204 No Content` on success. + +## Create Followup Message +/webhooks/[\{application.id\}](/developers/docs/resources/application#application-object)/[\{interaction.token\}](/developers/docs/interactions/receiving-and-responding#interaction-object) + + +Apps are limited to 5 followup messages per interaction if it was initiated from a user-installed app and isn't installed in the server (meaning the [authorizing integration owners object](/developers/docs/interactions/receiving-and-responding#interaction-object-authorizing-integration-owners-object) only contains `USER_INSTALL`) + + +Create a followup message for an Interaction. Functions the same as [Execute Webhook](/developers/docs/resources/webhook#execute-webhook), but `wait` is always true. The `thread_id`, `avatar_url`, and `username` parameters are not supported when using this endpoint for interaction followups. You can use the `EPHEMERAL` [message flag](/developers/docs/resources/message#message-object-message-flags) `1 << 6` (64) to send a message that only the user can see. You can also use the `IS_COMPONENTS_V2` [message flag](/developers/docs/resources/message#message-object-message-flags) `1 << 15` (32768) to send a [component](/developers/docs/components/reference)-based message. + +When using this endpoint directly after responding to an interaction with `DEFERRED_CHANNEL_MESSAGE_WITH_SOURCE`, this endpoint will function as [Edit Original Interaction Response](/developers/docs/interactions/receiving-and-responding#edit-original-interaction-response) for backwards compatibility. In this case, no new message will be created, and the loading message will be edited instead. The ephemeral flag will be ignored, and the value you provided in the initial defer response will be preserved, as an existing message's ephemeral state cannot be changed. This behavior is deprecated, and you should use the [Edit Original Interaction Response](/developers/docs/interactions/receiving-and-responding#edit-original-interaction-response) endpoint in this case instead. + +## Get Followup Message +/webhooks/[\{application.id\}](/developers/docs/resources/application#application-object)/[\{interaction.token\}](/developers/docs/interactions/receiving-and-responding#interaction-object)/messages/[\{message.id\}](/developers/docs/resources/message#message-object) + +Returns a followup message for an Interaction. Functions the same as [Get Webhook Message](/developers/docs/resources/webhook#get-webhook-message). + +## Edit Followup Message +/webhooks/[\{application.id\}](/developers/docs/resources/application#application-object)/[\{interaction.token\}](/developers/docs/interactions/receiving-and-responding#interaction-object)/messages/[\{message.id\}](/developers/docs/resources/message#message-object) + +Edits a followup message for an Interaction. Functions the same as [Edit Webhook Message](/developers/docs/resources/webhook#edit-webhook-message). + +## Delete Followup Message +/webhooks/[\{application.id\}](/developers/docs/resources/application#application-object)/[\{interaction.token\}](/developers/docs/interactions/receiving-and-responding#interaction-object)/messages/[\{message.id\}](/developers/docs/resources/message#message-object) + +Deletes a followup message for an Interaction. Returns `204 No Content` on success. diff --git a/discord/developers/docs/intro.mdx b/discord/developers/docs/intro.mdx new file mode 100644 index 0000000000..5b363fdea1 --- /dev/null +++ b/discord/developers/docs/intro.mdx @@ -0,0 +1,192 @@ +--- +title: "" +sidebarTitle: "Intro" +mode: "wide" +--- + +import {RobotIcon} from '/snippets/icons/RobotIcon.jsx' +import {WrenchIcon} from '/snippets/icons/WrenchIcon.jsx' +import {SlashBoxIcon} from '/snippets/icons/SlashBoxIcon.jsx' +import {ActivitiesIcon} from '/snippets/icons/ActivitiesIcon.jsx' +import {GameControllerIcon} from '/snippets/icons/GameControllerIcon.jsx' +import {PaintPaletteIcon} from '/snippets/icons/PaintPaletteIcon.jsx' +import {ClydeIcon} from '/snippets/icons/ClydeIcon.jsx' +import {BugIcon} from '/snippets/icons/BugIcon.jsx' +import {CircleQuestionIcon} from '/snippets/icons/CircleQuestionIcon.jsx' + +
+
+
+
+

Build Where the World Plays

+

Create social games, experiences, and integrations for millions of users on Discord

+
+
+ Discord Developers +
+
+
+ +## Build with Discord + +Discord provides a platform for building social experiences, whether you're +creating apps within Discord or integrating Discord's features into your game. + + + } + iconType="solid" + horizontal + > + Develop apps, bots, and integrations to enhance the Discord experience. + + + } + iconType="solid" + horizontal + > + Build multiplayer games and social experiences that run directly in Discord. + + + } + iconType="solid" + horizontal + > + Add rich social features into your game across desktop, mobile, and console. + + + +## Extend Discord with Custom Integrations + +Enhance the Discord experience with custom apps, commands, and integrations. + + + } + href="/developers/docs/quick-start/overview-of-apps" + horizontal + > + Learn the fundamentals of building Discord apps and commands. + + } + href="/developers/docs/quick-start/getting-started" + horizontal + > + Create a bot user that plays 'rock, paper, scissors' with users. + + } + href="/developers/docs/interactions/overview#message-components" + horizontal + > + Create custom commands and interactions for your app. + + + +## Build Multiplayer Games and Social Experiences + +Use the Embedded App SDK to create real-time games and social experiences that users can launch directly inside Discord. + + + } + href="/developers/docs/activities/overview" + horizontal + > + Discover how activities work in Discord. + + + } + href="/developers/docs/activities/building-an-activity" + horizontal + > + Build and test an Activity using the Embedded App SDK. + + } + href="/developers/docs/activities/design-patterns" + horizontal + > + Best practices for multiplayer, game design, and player experience. + + + +## Bring Social Features to Your Game + +Enable rich presence, voice chat, and more to create a seamless social experience for your players and grow your game. + + + } + href="/developers/docs/discord-social-sdk/overview" + horizontal + > + Explore rich presence, relationships, voice chat, and more. + + } + href="/developers/docs/discord-social-sdk/getting-started" + horizontal + > + Start here for a step-by-step guide to adding social features to your game. + + } + href="/developers/docs/discord-social-sdk/design-guidelines" + horizontal + > + Best practices for integrating Discord Social SDK features into your game. + + + +## Find Support + +Connect with the developer community, report issues, and stay updated with API changes. + +
+ + + } + horizontal + > + Get support, API announcements, and participate in developer events. + + } + horizontal + > + Report issues with the Discord API and SDKs. + + } + horizontal + > + Find articles, FAQs, and reach out to Discord's developer support team. + + +
diff --git a/docs/monetization/enabling-monetization.mdx b/discord/developers/docs/monetization/enabling-monetization.mdx similarity index 72% rename from docs/monetization/enabling-monetization.mdx rename to discord/developers/docs/monetization/enabling-monetization.mdx index 3642f70fee..0c3beed021 100644 --- a/docs/monetization/enabling-monetization.mdx +++ b/discord/developers/docs/monetization/enabling-monetization.mdx @@ -1,4 +1,7 @@ -# Enabling Monetization +--- +title: Enabling Monetization +description: Step-by-step guide to meet eligibility requirements and enable monetization. +--- Before you can add monetization to your app, you must ensure that your app and team meet the eligibility criteria. @@ -11,13 +14,13 @@ Before you can add monetization to your app, you must ensure that your app and t 5. Implement monetization in your app 6. Start offering your premium features -Once these are complete, you can [create SKUs](/docs/monetization/managing-skus#creating-a-sku) to represent your premium offerings and [add support for your premium offering](/docs/monetization/enabling-monetization#step-5-implement-monetization-in-your-app) in your app. +Once these are complete, you can [create SKUs](/developers/docs/monetization/managing-skus#creating-a-sku) to represent your premium offerings and [add support for your premium offering](/developers/docs/monetization/enabling-monetization#step-5-implement-monetization-in-your-app) in your app. ## Step 1. Set Up Your Developer Team and App Before monetization can be enabled, you will need: -- A [team](/docs/topics/teams) in the developer portal. If you don't have one, you can [create one on the Teams page](https://discord.com/developers/teams) +- A [team](/developers/docs/topics/teams) in the developer portal. If you don't have one, you can [create one on the Teams page](https://discord.com/developers/teams) - A [verified app](https://support-dev.discord.com/hc/en-us/articles/23926564536471-How-Do-I-Get-My-App-Verified) that is _owned by that team_ - Your app and team must be eligible for monetization. See the Eligibility Checklist below for details. @@ -25,7 +28,7 @@ Before monetization can be enabled, you will need: Before you can start creating SKUs and offering payments in your app, your app and team must be eligible for monetization. When a team owner enables monetization, they'll be taken through a series of steps and checks to ensure the following criteria are met: - + - App must be verified - App belongs to a developer team - Team owner must be at least 18 years old @@ -38,7 +41,7 @@ Before you can start creating SKUs and offering payments in your app, your app a - App must not contain any harmful or bad language in the name, description, commands, or role connection metadata. - Payouts must be set up with a valid payment method - Agreement to the [Monetization Terms](https://support.discord.com/hc/articles/5330075836311) and [Discord Developer Policy](https://support-dev.discord.com/hc/en-us/articles/8563934450327-Discord-Developer-Policy). - + ## Step 3. Set Up Team Payouts @@ -57,30 +60,32 @@ Let's set up Team Payouts so you can get paid! Discord processes all payouts thr #### If You are Based Outside of the United States, European Union, or United Kingdom -:::info + Premium Apps is not currently available outside of these regions. These features will be made available to more regions soon. -::: + For more information, read the [Premium Apps Payouts](https://support-dev.discord.com/hc/articles/17299902720919) Help Center article. ## Step 4: Create Your Premium Offering -You are now ready to start setting up your SKUs and offering premium features in your app. Check out our guide on [Managing your Premium Offerings](/docs/monetization/managing-skus#creating-a-sku) to create one-time purchases and subscriptions for your app. +You are now ready to start setting up your SKUs and offering premium features in your app. Check out our guide on [Managing your Premium Offerings](/developers/docs/monetization/managing-skus#creating-a-sku) to create one-time purchases and subscriptions for your app. ## Step 5: Implement Monetization in your App Now that you've set up your app for monetization, you can start adding code to support your premium features. We have guides for the following monetization strategies: - - +import {ShopIcon} from '/snippets/icons/ShopIcon.jsx' + + + }> Learn how to start and manage recurring subscriptions within your app. - + }> Learn how to implement one-time purchases in your app. - + ## Step 6: Start Offering Your Premium Features Congratulations! You've successfully set up your app for monetization. Now you can start earning money from your app and providing premium features to your users. -You can now [link to your Store](/docs/monetization/managing-skus#linking-to-your-store) page, [link to a specific SKU](/docs/monetization/managing-skus#linking-to-a-specific-sku), or [include a premium styled button in Message Components](/docs/monetization/managing-skus#responding-with-a-premium-button) to allow your users to make purchases. +You can now [link to your Store](/developers/docs/monetization/managing-skus#linking-to-your-store) page, [link to a specific SKU](/developers/docs/monetization/managing-skus#linking-to-a-specific-sku), or [include a premium styled button in Message Components](/developers/docs/monetization/managing-skus#responding-with-a-premium-button) to allow your users to make purchases. diff --git a/docs/monetization/implementing-app-subscriptions.mdx b/discord/developers/docs/monetization/implementing-app-subscriptions.mdx similarity index 68% rename from docs/monetization/implementing-app-subscriptions.mdx rename to discord/developers/docs/monetization/implementing-app-subscriptions.mdx index 9d908702fd..e8fa7f939a 100644 --- a/docs/monetization/implementing-app-subscriptions.mdx +++ b/discord/developers/docs/monetization/implementing-app-subscriptions.mdx @@ -1,9 +1,12 @@ -# Implementing App Subscriptions +--- +title: Implementing App Subscriptions +description: Learn how to implement recurring user and guild subscriptions for premium functionality. +--- Charge users for premium app functionality with a recurring user or guild subscription. -- Before you can add an app subscription to your app, you must [Enable Monetization](/docs/monetization/enabling-monetization) for your app. -- Once you've confirmed eligibility for your app and team, you will be able to set up a [SKU](/docs/resources/sku) (stock-keeping unit) to represent your subscription. +- Before you can add an app subscription to your app, you must [Enable Monetization](/developers/docs/monetization/enabling-monetization) for your app. +- Once you've confirmed eligibility for your app and team, you will be able to set up a [SKU](/developers/docs/resources/sku) (stock-keeping unit) to represent your subscription. --- @@ -18,7 +21,7 @@ When creating subscriptions, you will need to choose between user or guild subsc ## How App Subscriptions Work -- When a user purchases your subscription SKU, Discord creates an [Entitlement](/docs/resources/entitlement) for the user (or guild) and that specific Subscription [SKU](/docs/resources/sku). +- When a user purchases your subscription SKU, Discord creates an [Entitlement](/developers/docs/resources/entitlement) for the user (or guild) and that specific Subscription [SKU](/developers/docs/resources/sku). - You will receive an `ENTITLEMENT_CREATE` event via the Gateway. - This entitlement will be available via the `LIST Entitlements` API endpoint. - This entitlement will be available on `Interaction Payloads` initiated from the entitled user or users in a guild (for guild subscriptions). @@ -31,9 +34,9 @@ When creating subscriptions, you will need to choose between user or guild subsc Because entitlements are granted indefinitely and don't update on renewal or cancellation, you can use subscription events to track the lifecycle of a subscription. -:::info + This is not a complete list of when events may occur. You should use the presence of an entitlement to determine if a user has access to your premium features. The Subscription API and related events are intended for reporting and lifecycle management purposes and **should not be used as the source of truth of whether a user has access to your premium features**. -::: + | Event Name | Subscription Behavior | Updated Fields | |-----------------------|--------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------| @@ -49,35 +52,35 @@ This is not a complete list of when events may occur. You should use the presenc ## Working with Entitlements -When a user purchases a subscription, an entitlement is created. [Entitlements](/docs/resources/entitlement) represent the user's access to your app's premium features. +When a user purchases a subscription, an entitlement is created. [Entitlements](/developers/docs/resources/entitlement) represent the user's access to your app's premium features. -Depending on your app's features, you can use a combination of [Gateway events](/docs/events/gateway-events#entitlements), the [Entitlement HTTP API](/docs/resources/entitlement), and [interaction payloads](/docs/interactions/receiving-and-responding) to keep track of user and guild entitlements and grant features to users who are subscribed to your app. +Depending on your app's features, you can use a combination of [Gateway events](/developers/docs/events/gateway-events#entitlements), the [Entitlement HTTP API](/developers/docs/resources/entitlement), and [interaction payloads](/developers/docs/interactions/receiving-and-responding) to keep track of user and guild entitlements and grant features to users who are subscribed to your app. ### Accessing Entitlements with Gateway Events -When users make a purchase in your app, Discord will emit [Entitlement Gateway events](/docs/events/gateway-events#entitlements). +When users make a purchase in your app, Discord will emit [Entitlement Gateway events](/developers/docs/events/gateway-events#entitlements). For subscription SKUs, you will receive the following entitlement events: -| Event | Description | -|----------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------| -| `ENTITLEMENT_CREATE` | When a user is granted an entitlement to your app's subscription SKU | -| `ENTITLEMENT_UPDATE` | When an entitlement to a subscription SKU ends | -| `ENTITLEMENT_DELETE` | When Discord refunds a subscription, removes an entitlement, or when a developer [deletes a Test Entitlement](/docs/resources/entitlement#delete-test-entitlement) | +| Event | Description | +|----------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| `ENTITLEMENT_CREATE` | When a user is granted an entitlement to your app's subscription SKU | +| `ENTITLEMENT_UPDATE` | When an entitlement to a subscription SKU ends | +| `ENTITLEMENT_DELETE` | When Discord refunds a subscription, removes an entitlement, or when a developer [deletes a Test Entitlement](/developers/docs/resources/entitlement#delete-test-entitlement) | ### Accessing Entitlements with the HTTP API -For apps requiring background processing or not solely reliant on interactions, keeping track of entitlements is essential. You can utilize the [List Entitlements](/docs/resources/entitlement#list-entitlements) endpoint to list active and expired entitlements. Your app can filter entitlements by a specific user or guild by using the `?user_id=XYZ` or `?guild_id=XYZ` query params. +For apps requiring background processing or not solely reliant on interactions, keeping track of entitlements is essential. You can utilize the [List Entitlements](/developers/docs/resources/entitlement#list-entitlements) endpoint to list active and expired entitlements. Your app can filter entitlements by a specific user or guild by using the `?user_id=XYZ` or `?guild_id=XYZ` query params. For example, you might keep track of our entitlements in a database and check if a user still has access to a specific SKU before performing a cron job or other task. ### Accessing Entitlements on Interaction Payloads -Entitlements are also available on the `Interaction Payload` when a user interacts with your app. You can find the entitlements on the `entitlements` field of the `Interaction Payload` when [receiving and responding to interactions](/docs/interactions/receiving-and-responding). You can use this field to determine if the user or guild is subscribed to your app. +Entitlements are also available on the `Interaction Payload` when a user interacts with your app. You can find the entitlements on the `entitlements` field of the `Interaction Payload` when [receiving and responding to interactions](/developers/docs/interactions/receiving-and-responding). You can use this field to determine if the user or guild is subscribed to your app. ### Accessing Entitlements with the Embedded App SDK -When using the [Embedded App SDK](/docs/developer-tools/embedded-app-sdk) to build an [Activity](/docs/activities/overview), you can also [access a user's entitlements](/docs/developer-tools/embedded-app-sdk#getentitlements). Check out the [Implementing In-App Purchases for Activities](/docs/monetization/implementing-iap-for-activities) guide to learn more about monetization with the Embedded App SDK. +When using the [Embedded App SDK](/developers/docs/developer-tools/embedded-app-sdk) to build an [Activity](/developers/docs/activities/overview), you can also [access a user's entitlements](/developers/docs/developer-tools/embedded-app-sdk#getentitlements). Check out the [Implementing In-App Purchases for Activities](/developers/docs/monetization/implementing-iap-for-activities) guide to learn more about monetization with the Embedded App SDK. --- @@ -85,23 +88,23 @@ When using the [Embedded App SDK](/docs/developer-tools/embedded-app-sdk) to bui ### Responding with a Premium Button -[Responding with a premium button](/docs/monetization/managing-skus#responding-with-a-premium-button) gives you the ability to prompt users to subscribe to your app when they attempt to use a premium feature without a subscription. +[Responding with a premium button](/developers/docs/monetization/managing-skus#responding-with-a-premium-button) gives you the ability to prompt users to subscribe to your app when they attempt to use a premium feature without a subscription. -You can do this by sending a message with a [button](/docs/components/reference#button) with a [premium style](/docs/components/reference#button-button-styles) and a `sku_id` that allows the user to upgrade to your premium offering. +You can do this by sending a message with a [button](/developers/docs/components/reference#button) with a [premium style](/developers/docs/components/reference#button-button-styles) and a `sku_id` that allows the user to upgrade to your premium offering. ### Starting a Purchase from an Activity -If you are using the [Embedded App SDK](/docs/developer-tools/embedded-app-sdk) to build an [Activity](/docs/activities/overview), you can also launch the purchase flow for a specific SKU using the SDK. Check out the [Implementing In-App Purchases for Activities](/docs/monetization/implementing-iap-for-activities) guide to learn more about monetization with the Embedded App SDK. +If you are using the [Embedded App SDK](/developers/docs/developer-tools/embedded-app-sdk) to build an [Activity](/developers/docs/activities/overview), you can also launch the purchase flow for a specific SKU using the SDK. Check out the [Implementing In-App Purchases for Activities](/developers/docs/monetization/implementing-iap-for-activities) guide to learn more about monetization with the Embedded App SDK. ### Purchasing from the Store Page -Users can start, upgrade, or downgrade their subscription from your app's [Store](/docs/monetization/managing-skus#viewing-your-store-page) page. You can link directly to your Store page using our [Application Directory Store URL scheme](/docs/monetization/managing-skus#linking-to-your-store). +Users can start, upgrade, or downgrade their subscription from your app's [Store](/developers/docs/monetization/managing-skus#viewing-your-store-page) page. You can link directly to your Store page using our [Application Directory Store URL scheme](/developers/docs/monetization/managing-skus#linking-to-your-store). --- ## Supporting Subscriptions -To support subscriptions in your app, you need to [create a subscription SKU](/docs/monetization/managing-skus#creating-a-sku) and handle the following scenarios: +To support subscriptions in your app, you need to [create a subscription SKU](/developers/docs/monetization/managing-skus#creating-a-sku) and handle the following scenarios: ### Starting a new subscription @@ -146,9 +149,9 @@ When a user resumes their subscription, you will receive the following events: ## Supporting Upgrades and Downgrades -If you offer multiple subscription tiers in your app, users can upgrade or downgrade their subscription at any time from your [Store page](/docs/monetization/managing-skus#viewing-your-store-page) or their App Subscription settings. +If you offer multiple subscription tiers in your app, users can upgrade or downgrade their subscription at any time from your [Store page](/developers/docs/monetization/managing-skus#viewing-your-store-page) or their App Subscription settings. -To create multiple subscription tiers, you will need to [create multiple subscription SKUs](/docs/monetization/managing-skus#creating-a-sku) and support the following scenarios in your app: +To create multiple subscription tiers, you will need to [create multiple subscription SKUs](/developers/docs/monetization/managing-skus#creating-a-sku) and support the following scenarios in your app: ### Upgrading an existing subscription @@ -185,15 +188,15 @@ Once the user's current subscription expires on `subscription.current_period_end ## Using the Subscription API -:::info -When implementing monetization, [Entitlements](/docs/resources/entitlement) should be considered the source of truth for a user's access to a specific SKU. The Subscription API is intended for reporting and lifecycle management purposes that happen outside the flow of a user's interaction with your app. -::: + +When implementing monetization, [Entitlements](/developers/docs/resources/entitlement) should be considered the source of truth for a user's access to a specific SKU. The Subscription API is intended for reporting and lifecycle management purposes that happen outside the flow of a user's interaction with your app. + -You can use the [Subscription API](/docs/resources/subscription) to check on the status of your app subscriptions. This API allows you to list subscriptions by user for reporting purposes and to check on the status of subscriptions without having to access entitlements directly. +You can use the [Subscription API](/developers/docs/resources/subscription) to check on the status of your app subscriptions. This API allows you to list subscriptions by user for reporting purposes and to check on the status of subscriptions without having to access entitlements directly. -- [List SKU Subscriptions](/docs/resources/subscription#list-sku-subscriptions): List all subscriptions for a specific SKU in your app. -- [Get SKU Subscription](/docs/resources/subscription#get-sku-subscription): Get a specific subscription in your app. -- [Subscription Gateway events](/docs/events/gateway-events#subscriptions): Discord will emit gateway events when a subscription is created, updated, and very rarely, deleted. +- [List SKU Subscriptions](/developers/docs/resources/subscription#list-sku-subscriptions): List all subscriptions for a specific SKU in your app. +- [Get SKU Subscription](/developers/docs/resources/subscription#get-sku-subscription): Get a specific subscription in your app. +- [Subscription Gateway events](/developers/docs/events/gateway-events#subscriptions): Discord will emit gateway events when a subscription is created, updated, and very rarely, deleted. --- @@ -201,20 +204,20 @@ You can use the [Subscription API](/docs/resources/subscription) to check on the ### Using Test Entitlements -You can test your implementation by [creating](/docs/resources/entitlement#create-test-entitlement) and [deleting](/docs/resources/entitlement#delete-test-entitlement) test entitlements. These entitlements will allow you to test your premium offering in both a subscribed and unsubscribed state as a user or guild. +You can test your implementation by [creating](/developers/docs/resources/entitlement#create-test-entitlement) and [deleting](/developers/docs/resources/entitlement#delete-test-entitlement) test entitlements. These entitlements will allow you to test your premium offering in both a subscribed and unsubscribed state as a user or guild. -This method will not let you test out the full payment flow in Discord but will allow you to test your app's behavior when a user is subscribed or unsubscribed. See [Using Live Entitlements](/docs/monetization/implementing-app-subscriptions#using-live-entitlements) if you'd like to see the full payment flow. +This method will not let you test out the full payment flow in Discord but will allow you to test your app's behavior when a user is subscribed or unsubscribed. See [Using Live Entitlements](/developers/docs/monetization/implementing-app-subscriptions#using-live-entitlements) if you'd like to see the full payment flow. -:::info + Test Entitlements do not have a `starts_at` or `ends_at` field as they are valid until they are deleted. -::: + ### Using Live Entitlements -If you'd like to test the full payment flow for your app, you can do so by interacting with your Store page or a [premium styled button](/docs/monetization/implementing-app-subscriptions#prompting-users-to-subscribe). Any team members associated with your app will automatically see a 100% discount on the price of the subscription, allowing you to purchase without the use of live payment method. +If you'd like to test the full payment flow for your app, you can do so by interacting with your Store page or a [premium styled button](/developers/docs/monetization/implementing-app-subscriptions#prompting-users-to-subscribe). Any team members associated with your app will automatically see a 100% discount on the price of the subscription, allowing you to purchase without the use of live payment method. -After checkout, you will have a live subscription. This subscription will renew until canceled and can be used in testing subscription renewals in your app. If you cancel this subscription, it will remain an active entitlement until the end of the subscription billing period, represented by the `period_ends_at` field on the [Subscription](/docs/resources/subscription#subscription-object). +After checkout, you will have a live subscription. This subscription will renew until canceled and can be used in testing subscription renewals in your app. If you cancel this subscription, it will remain an active entitlement until the end of the subscription billing period, represented by the `period_ends_at` field on the [Subscription](/developers/docs/resources/subscription#subscription-object). -:::info -You can only delete entitlements created using the [create entitlement](/docs/resources/entitlement#create-test-entitlement) endpoint. If you need to toggle access to your premium features during your development process, it is best to use Test Entitlements. -::: \ No newline at end of file + +You can only delete entitlements created using the [create entitlement](/developers/docs/resources/entitlement#create-test-entitlement) endpoint. If you need to toggle access to your premium features during your development process, it is best to use Test Entitlements. + \ No newline at end of file diff --git a/docs/monetization/implementing-iap-for-activities.mdx b/discord/developers/docs/monetization/implementing-iap-for-activities.mdx similarity index 62% rename from docs/monetization/implementing-iap-for-activities.mdx rename to discord/developers/docs/monetization/implementing-iap-for-activities.mdx index db21e74c52..be8e6f5c0d 100644 --- a/docs/monetization/implementing-iap-for-activities.mdx +++ b/discord/developers/docs/monetization/implementing-iap-for-activities.mdx @@ -1,12 +1,12 @@ --- -sidebar_label: Implementing IAP for Activities +title: Implementing In-App Purchases for Activities +sidebarTitle: Implementing IAP for Activities +description: Step-by-step guide to add monetization to Discord Activities. --- -# Implementing In-App Purchases for Activities +In-App Purchases (IAP) for [Activities](/developers/docs/activities/overview) allows developers to easily monetize their Activity by allowing users to buy premium subscriptions or items natively in Discord. This guide will walk you through the process of implementing monetization using the [Embedded App SDK](/developers/docs/developer-tools/embedded-app-sdk). -In-App Purchases (IAP) for [Activities](/docs/activities/overview) allows developers to easily monetize their Activity by allowing users to buy premium subscriptions or items natively in Discord. This guide will walk you through the process of implementing monetization using the [Embedded App SDK](/docs/developer-tools/embedded-app-sdk). - -Before you can add premium products with the Embedded App SDK in an Activity, you must [Enable Monetization](/docs/monetization/enabling-monetization) for your app. +Before you can add premium products with the Embedded App SDK in an Activity, you must [Enable Monetization](/developers/docs/monetization/enabling-monetization) for your app. --- @@ -18,7 +18,7 @@ Before implementing monetization in your app, it's important to understand the f - **Entitlements**: Represent the user's access to your premium products. - **Subscriptions**: Represent an ongoing agreement for a user to pay for an entitlement on a recurring basis until canceled. -You can learn more about these concepts in the [Monetization Overview](/docs/monetization/overview). +You can learn more about these concepts in the [Monetization Overview](/developers/docs/monetization/overview). --- @@ -26,7 +26,7 @@ You can learn more about these concepts in the [Monetization Overview](/docs/mon SKUs represent the premium products you offer in your app. Before you can start implementing monetization in your app, you will need to create a SKU for each premium product. -To learn more about creating and managing SKUs and the different types of SKUs you can create, see the [Managing SKUs](/docs/monetization/managing-skus) guide. +To learn more about creating and managing SKUs and the different types of SKUs you can create, see the [Managing SKUs](/developers/docs/monetization/managing-skus) guide. ### Publishing SKUs for Activities @@ -34,12 +34,12 @@ When publishing SKUs, you can choose to publish them to your **Store and the API #### Published to Store and the API -- Your SKUs will be visible to users in the Discord client in your [app's store](/docs/monetization/managing-skus#viewing-your-store-page) or your Activity's custom storefront. +- Your SKUs will be visible to users in the Discord client in your [app's store](/developers/docs/monetization/managing-skus#viewing-your-store-page) or your Activity's custom storefront. - Your users will be able to purchase them directly from the Discord client without having your Activity open so you should handle the purchase flow accordingly. #### Published to API Only -- Your SKUs will **not** be visible to users in your [app's store](/docs/monetization/managing-skus#viewing-your-store-page), and users will only be able to purchase them through your Activity's custom storefront. +- Your SKUs will **not** be visible to users in your [app's store](/developers/docs/monetization/managing-skus#viewing-your-store-page), and users will only be able to purchase them through your Activity's custom storefront. Next, we'll cover how to create and render your own custom storefront in your Activity. @@ -52,9 +52,9 @@ Once you have created your SKUs, you will need to build and render your own cust ### Listing SKUs -To fetch the list of products for displaying in your Activity, you can call the [`getSkus()`](/docs/developer-tools/embedded-app-sdk#getskus) command from the [Embedded App SDK](/docs/developer-tools/embedded-app-sdk). +To fetch the list of products for displaying in your Activity, you can call the [`getSkus()`](/developers/docs/developer-tools/embedded-app-sdk#getskus) command from the [Embedded App SDK](/developers/docs/developer-tools/embedded-app-sdk). -You can also fetch SKUs using the [HTTP API](/docs/resources/sku#list-skus). +You can also fetch SKUs using the [HTTP API](/developers/docs/resources/sku#list-skus). ### Mapping SKUs to Your Premium Perks @@ -81,31 +81,31 @@ console.log(`The price is ${displayPrice}!`); ## Working with Entitlements -When a user purchases a SKU, an entitlement is created. [Entitlements](/docs/resources/entitlement) represent the user's access to your premium product. +When a user purchases a SKU, an entitlement is created. [Entitlements](/developers/docs/resources/entitlement) represent the user's access to your premium product. -Depending on your app's features, you can use a combination of the [Embedded App SDK events](/docs/developer-tools/embedded-app-sdk#getentitlements), [Gateway events](/docs/events/gateway-events#entitlements), the [Entitlement HTTP API](/docs/resources/entitlement), and [interaction payloads](/docs/interactions/receiving-and-responding) to keep track of entitlements to users who have purchased items in your app. +Depending on your app's features, you can use a combination of the [Embedded App SDK events](/developers/docs/developer-tools/embedded-app-sdk#getentitlements), [Gateway events](/developers/docs/events/gateway-events#entitlements), the [Entitlement HTTP API](/developers/docs/resources/entitlement), and [interaction payloads](/developers/docs/interactions/receiving-and-responding) to keep track of entitlements to users who have purchased items in your app. ### Fetching Entitlements with the Embedded App SDK -Use the [`getEntitlements()`](/docs/developer-tools/embedded-app-sdk#getentitlements) SDK command to fetch a list of entitlements for a user. This command will return a list of entitlement objects that represent the user's access to your premium products. +Use the [`getEntitlements()`](/developers/docs/developer-tools/embedded-app-sdk#getentitlements) SDK command to fetch a list of entitlements for a user. This command will return a list of entitlement objects that represent the user's access to your premium products. ### Handling Subscription Entitlements -When a user purchases a subscription SKU, an entitlement is created. For more information on handling subscription entitlements, see the [Implementing App Subscriptions](/docs/monetization/implementing-app-subscriptions) guide. +When a user purchases a subscription SKU, an entitlement is created. For more information on handling subscription entitlements, see the [Implementing App Subscriptions](/developers/docs/monetization/implementing-app-subscriptions) guide. ### Handling One-Time Purchase Entitlements -When a user purchases a one-time purchase SKU, an entitlement is created. For more information on handling one-time purchase entitlements, see the [Implementing One-Time Purchases](/docs/monetization/implementing-one-time-purchases) guide. +When a user purchases a one-time purchase SKU, an entitlement is created. For more information on handling one-time purchase entitlements, see the [Implementing One-Time Purchases](/developers/docs/monetization/implementing-one-time-purchases) guide. #### One-Time Purchases: Consumable and Durable Items It is common in Activities to have consumable or one-time-use items, such as a single-use potion or power-up. -When a user purchases a consumable SKU, an entitlement is created. This entitlement will be marked as `consumed: false`. Your application should process the item purchase and [consume the entitlement](/docs/resources/entitlement#consume-an-entitlement) as soon as possible to grant the user the perks associated with the item. +When a user purchases a consumable SKU, an entitlement is created. This entitlement will be marked as `consumed: false`. Your application should process the item purchase and [consume the entitlement](/developers/docs/resources/entitlement#consume-an-entitlement) as soon as possible to grant the user the perks associated with the item. If you want to offer an item that grants perks for an unlimited amount of time, you should use a durable SKU instead of a consumable SKU. -Learn more about consumable and durable items in the [Implementing One-Time Purchases](/docs/monetization/implementing-one-time-purchases) guide. +Learn more about consumable and durable items in the [Implementing One-Time Purchases](/developers/docs/monetization/implementing-one-time-purchases) guide. --- @@ -113,9 +113,9 @@ Learn more about consumable and durable items in the [Implementing One-Time Purc After displaying your SKUs in your custom storefront, you will need to initiate a purchase when a user selects a SKU to purchase. -To initiate a purchase in your activity, use the Embedded App SDK to call the [`startPurchase()`](/docs/developer-tools/embedded-app-sdk#startpurchase) command with the selected SKU `id`. This command will open the purchase flow modal in the Discord client, allowing users to purchase that SKU. +To initiate a purchase in your activity, use the Embedded App SDK to call the [`startPurchase()`](/developers/docs/developer-tools/embedded-app-sdk#startpurchase) command with the selected SKU `id`. This command will open the purchase flow modal in the Discord client, allowing users to purchase that SKU. -Learn more about the [`startPurchase()`](/docs/developer-tools/embedded-app-sdk#startpurchase) command in the [Embedded App SDK Reference](/docs/developer-tools/embedded-app-sdk). +Learn more about the [`startPurchase()`](/developers/docs/developer-tools/embedded-app-sdk#startpurchase) command in the [Embedded App SDK Reference](/developers/docs/developer-tools/embedded-app-sdk). To know when it has been completed, you can subscribe to `ENTITLEMENT_CREATE` events. @@ -123,7 +123,7 @@ To know when it has been completed, you can subscribe to `ENTITLEMENT_CREATE` ev Once a user has completed a purchase, Discord will emit an `ENTITLEMENT_CREATE` event. You can subscribe to this event using the Embedded App SDK to know when a user has successfully purchased a SKU and is granted an entitlement. -You can subscribe to the `ENTITLEMENT_CREATE` event using the [`subscribe()`](/docs/developer-tools/embedded-app-sdk#subscribe) method in the Embedded App SDK. +You can subscribe to the `ENTITLEMENT_CREATE` event using the [`subscribe()`](/developers/docs/developer-tools/embedded-app-sdk#subscribe) method in the Embedded App SDK. Here's an example of how to subscribe to the `ENTITLEMENT_CREATE` event: @@ -138,7 +138,7 @@ const handleEntitlementCreate = () => { discordSdk.subscribe('ENTITLEMENT_CREATE', handleEntitlementCreate); ``` -You can also subscribe to the `ENTITLEMENT_CREATE` event using the [Gateway API](/docs/events/gateway-events#entitlements) to receive the event in your app's backend or use the [List Entitlements](/docs/resources/entitlement#list-entitlements) HTTP API endpoint to fetch a user's entitlements. +You can also subscribe to the `ENTITLEMENT_CREATE` event using the [Gateway API](/developers/docs/events/gateway-events#entitlements) to receive the event in your app's backend or use the [List Entitlements](/developers/docs/resources/entitlement#list-entitlements) HTTP API endpoint to fetch a user's entitlements. --- @@ -146,9 +146,9 @@ You can also subscribe to the `ENTITLEMENT_CREATE` event using the [Gateway API] When working with SKUs and Entitlements in an Activity, it's crucial to ensure the security and integrity of your application's data. Here are some things to keep in mind: -Developers should ensure the accuracy of data obtained via [Embedded App SDK](/docs/developer-tools/embedded-app-sdk) commands and events. A malicious actor could potentially establish their own RPC connection and interact with your application client, posing as Discord. While this might not be an issue for most SDK commands and events, it becomes critical when dealing with perks offered through In-App purchases. +Developers should ensure the accuracy of data obtained via [Embedded App SDK](/developers/docs/developer-tools/embedded-app-sdk) commands and events. A malicious actor could potentially establish their own RPC connection and interact with your application client, posing as Discord. While this might not be an issue for most SDK commands and events, it becomes critical when dealing with perks offered through In-App purchases. -If your application relies solely on SDK data to determine a user's entitlements, a malicious actor could exploit this to gain access to premium products, features, or advantages without paying. This is particularly relevant for commands like [`getEntitlements()`](/docs/developer-tools/embedded-app-sdk#getentitlements). +If your application relies solely on SDK data to determine a user's entitlements, a malicious actor could exploit this to gain access to premium products, features, or advantages without paying. This is particularly relevant for commands like [`getEntitlements()`](/developers/docs/developer-tools/embedded-app-sdk#getentitlements). ### Use the Discord HTTP API for Verification @@ -165,7 +165,7 @@ In summary, use the principle of "Trust (the SDK), but Verify (via the API)" to ## Testing Your In-App Purchases -To test your In-App Purchases in your Activity, you will need to follow testing guidelines for both types of SKUs: [One-Time Purchases](/docs/monetization/implementing-one-time-purchases#testing-your-onetime-purchase-implementation) and [Subscriptions](/docs/monetization/implementing-app-subscriptions#testing-your-app-subscription-implementation). +To test your In-App Purchases in your Activity, you will need to follow testing guidelines for both types of SKUs: [One-Time Purchases](/developers/docs/monetization/implementing-one-time-purchases#testing-your-onetime-purchase-implementation) and [Subscriptions](/developers/docs/monetization/implementing-app-subscriptions#testing-your-app-subscription-implementation). After you've tested your In-App Purchase flows, verify that your application has correctly granted the user the premium perks associated with the SKUs that were purchased during testing. @@ -175,10 +175,10 @@ After you've tested your In-App Purchase flows, verify that your application has Check out our example implementation of In-App Purchase in our [SDK Playground Example Application](https://github.com/discord/embedded-app-sdk-examples/tree/main/sdk-playground). -The example implementation includes client-side and server-side code. It also follows the [security considerations](/docs/monetization/implementing-iap-for-activities#data-security-considerations) you should make when working with SKUs and entitlements. +The example implementation includes client-side and server-side code. It also follows the [security considerations](/developers/docs/monetization/implementing-iap-for-activities#data-security-considerations) you should make when working with SKUs and entitlements. - - + + This reference example implements the commands and events available to you within the Embedded App SDK, including In-App Purchases. - + diff --git a/docs/monetization/implementing-one-time-purchases.md b/discord/developers/docs/monetization/implementing-one-time-purchases.mdx similarity index 57% rename from docs/monetization/implementing-one-time-purchases.md rename to discord/developers/docs/monetization/implementing-one-time-purchases.mdx index c051061267..198a2e9fcc 100644 --- a/docs/monetization/implementing-one-time-purchases.md +++ b/discord/developers/docs/monetization/implementing-one-time-purchases.mdx @@ -1,9 +1,11 @@ -# Implementing One-Time Purchases - +--- +title: Implementing One-Time Purchases +description: Guide to implementing durable and consumable one-time purchases. +--- One-time purchases enable you to charge your users for premium functionality with in-app items. -- Before you can add one-time purchases to your app, you must [Enable Monetization](/docs/monetization/enabling-monetization) for your app. -- Once you've confirmed eligibility for your app and team, you will be able to set up a [SKU](/docs/resources/sku) (stock-keeping unit) to represent your one-time purchases. +- Before you can add one-time purchases to your app, you must [Enable Monetization](/developers/docs/monetization/enabling-monetization) for your app. +- Once you've confirmed eligibility for your app and team, you will be able to set up a [SKU](/developers/docs/resources/sku) (stock-keeping unit) to represent your one-time purchases. --- @@ -19,43 +21,43 @@ When creating items for one-time purchase, you can choose between durable and co ## How One-Time Purchases Work #### For Durable SKUs -- When a user purchases your durable SKU, Discord creates an [Entitlement](/docs/resources/entitlement) for the purchasing user and that specific [SKU](/docs/resources/sku). +- When a user purchases your durable SKU, Discord creates an [Entitlement](/developers/docs/resources/entitlement) for the purchasing user and that specific [SKU](/developers/docs/resources/sku). - You will receive an `ENTITLEMENT_CREATE` event via the Gateway. - This entitlement is now available via the `LIST Entitlements` API endpoint. - This entitlement will be available on `Interaction Payloads` initiated from the entitled user. #### For Consumable SKUs -- When a user purchases your consumable SKU, Discord creates an [Entitlement](/docs/resources/entitlement) for the purchasing user and that specific SKU. +- When a user purchases your consumable SKU, Discord creates an [Entitlement](/developers/docs/resources/entitlement) for the purchasing user and that specific SKU. - You will receive an `ENTITLEMENT_CREATE` event via the Gateway. - This entitlement is now available via the `LIST Entitlements` API endpoint. - This entitlement will be available on `Interaction Payloads` initiated from the entitled user or users in a guild (for guild subscriptions). -- Users cannot repurchase this SKU until you consume the entitlement using the [Consume Entitlement API](/docs/resources/entitlement#consume-an-entitlement) endpoint. - - In [Test Mode](/docs/monetization/implementing-one-time-purchases#using-application-test-mode), repeated purchases are permitted without consumption for developer convenience. +- Users cannot repurchase this SKU until you consume the entitlement using the [Consume Entitlement API](/developers/docs/resources/entitlement#consume-an-entitlement) endpoint. + - In [Test Mode](/developers/docs/monetization/implementing-one-time-purchases#using-application-test-mode), repeated purchases are permitted without consumption for developer convenience. - When you receive an `ENTITLEMENT_CREATE` event for a consumable SKU, you should process the item purchase in your app and consume the entitlement as soon as possible. --- ## Working with Entitlements -When a user purchases a one-time purchase SKU, an entitlement is created. [Entitlements](/docs/resources/entitlement) represent the user's access to your consumable or durable item. +When a user purchases a one-time purchase SKU, an entitlement is created. [Entitlements](/developers/docs/resources/entitlement) represent the user's access to your consumable or durable item. -Depending on your app's features, you can use a combination of [Gateway events](/docs/events/gateway-events#entitlements), the [Entitlement HTTP API](/docs/resources/entitlement), and [interaction payloads](/docs/interactions/receiving-and-responding) to keep track of entitlements to users who have purchased items in your app. +Depending on your app's features, you can use a combination of [Gateway events](/developers/docs/events/gateway-events#entitlements), the [Entitlement HTTP API](/developers/docs/resources/entitlement), and [interaction payloads](/developers/docs/interactions/receiving-and-responding) to keep track of entitlements to users who have purchased items in your app. ### Accessing Entitlements with Gateway Events -When a user purchases a SKU, Discord will emit an [`ENTITLEMENT_CREATE`](/docs/events/gateway-events#entitlements) event. This event will contain the entitlement object that represents the user's access to the SKU. You can use this event to keep track of the user's entitlements in near-time. For One-Time Purchases, you may also receive an `ENTITLEMENT_DELETE` event if the user's entitlement is revoked. +When a user purchases a SKU, Discord will emit an [`ENTITLEMENT_CREATE`](/developers/docs/events/gateway-events#entitlements) event. This event will contain the entitlement object that represents the user's access to the SKU. You can use this event to keep track of the user's entitlements in near-time. For One-Time Purchases, you may also receive an `ENTITLEMENT_DELETE` event if the user's entitlement is revoked. ### Accessing Entitlements with the HTTP API -Entitlements are available via the [List Entitlements](/docs/resources/entitlement#list-entitlements) endpoint. You can filter entitlements by a specific user or set of SKUs by using the `?user_id=XYZ` or `?sku_ids=XYZ` query parameters. +Entitlements are available via the [List Entitlements](/developers/docs/resources/entitlement#list-entitlements) endpoint. You can filter entitlements by a specific user or set of SKUs by using the `?user_id=XYZ` or `?sku_ids=XYZ` query parameters. ### Accessing Entitlements on Interaction Payloads -Entitlements are also available on the `Interaction Payload` when a user interacts with your app. You can find the entitlements on the `entitlements` field of the `Interaction Payload` when [receiving and responding to interactions](/docs/interactions/receiving-and-responding). +Entitlements are also available on the `Interaction Payload` when a user interacts with your app. You can find the entitlements on the `entitlements` field of the `Interaction Payload` when [receiving and responding to interactions](/developers/docs/interactions/receiving-and-responding). ### Accessing Entitlements with the Embedded App SDK -When using the [Embedded App SDK](/docs/developer-tools/embedded-app-sdk) to build an [Activity](/docs/activities/overview), you can also [access a user's entitlements](/docs/developer-tools/embedded-app-sdk#getentitlements). Check out the [Implementing In-App Purchases for Activities](/docs/monetization/implementing-iap-for-activities) guide to learn more about monetization with the Embedded App SDK. +When using the [Embedded App SDK](/developers/docs/developer-tools/embedded-app-sdk) to build an [Activity](/developers/docs/activities/overview), you can also [access a user's entitlements](/developers/docs/developer-tools/embedded-app-sdk#getentitlements). Check out the [Implementing In-App Purchases for Activities](/developers/docs/monetization/implementing-iap-for-activities) guide to learn more about monetization with the Embedded App SDK. Depending on your app's needs, you can use a combination of these methods to keep track of user entitlements. @@ -70,7 +72,7 @@ When implementing one-time purchases, you should consider the following: When offering durable items, users will have access to the SKU indefinitely. Durable items can't be consumed, so you don't need to worry about the user losing access to the item except in the case of a refund. ### For Consumable One-Time Purchases -When offering consumable items, users can only have one unconsumed entitlement at a time. To handle consumable items in your app or game, you should process and store the consumable item in your app and then make a call to the [Consume Entitlement](/docs/resources/entitlement#consume-an-entitlement) endpoint so that the user can purchase more of this item in the future. +When offering consumable items, users can only have one unconsumed entitlement at a time. To handle consumable items in your app or game, you should process and store the consumable item in your app and then make a call to the [Consume Entitlement](/developers/docs/resources/entitlement#consume-an-entitlement) endpoint so that the user can purchase more of this item in the future. Consuming the entitlement will update the entitlement to return a true value in the entitlement's `consumed` field. You will need to think through how your app keeps track of consumable items to decide on the best strategy for when to consume these entitlements and store the state of the consumable item and quantity in your app. @@ -80,29 +82,29 @@ Consuming the entitlement will update the entitlement to return a true value in ### Responding with a Premium Button -[Responding with a premium button](/docs/monetization/managing-skus#responding-with-a-premium-button) gives you the ability to prompt users to subscribe to your app when they attempt to use a premium feature without a subscription. +[Responding with a premium button](/developers/docs/monetization/managing-skus#responding-with-a-premium-button) gives you the ability to prompt users to subscribe to your app when they attempt to use a premium feature without a subscription. -You can do this by sending a message with a [button](/docs/components/reference#button) with a [premium style](/docs/components/reference#button-button-styles) and a `sku_id` that allows the user to upgrade to your premium offering. +You can do this by sending a message with a [button](/developers/docs/components/reference#button) with a [premium style](/developers/docs/components/reference#button-button-styles) and a `sku_id` that allows the user to upgrade to your premium offering. ### Starting a Purchase from an Activity -If you are using the [Embedded App SDK](/docs/developer-tools/embedded-app-sdk) to build an [Activity](/docs/activities/overview), you can also launch the purchase flow for a specific SKU using the SDK. Check out the [Implementing In-App Purchases for Activities](/docs/monetization/implementing-iap-for-activities) guide to learn more about monetization with the Embedded App SDK. +If you are using the [Embedded App SDK](/developers/docs/developer-tools/embedded-app-sdk) to build an [Activity](/developers/docs/activities/overview), you can also launch the purchase flow for a specific SKU using the SDK. Check out the [Implementing In-App Purchases for Activities](/developers/docs/monetization/implementing-iap-for-activities) guide to learn more about monetization with the Embedded App SDK. --- ## Testing Your One-Time Purchase Implementation -:::warn + The method of testing purchases for One-Time Purchases differs from the method for App Subscriptions. **Do NOT use Test Entitlements for One-Time Purchases.** -::: + ### Using Application Test Mode While in Application Test Mode, you can freely make "purchases" of One-Time Purchase SKUs tied to your application. That means you can test buying your consumable and durable items by going through the In-App Purchase flow without any credit card charges. -:::info + You still need to have a valid payment method on file to "purchase" SKUs in Application Test Mode. It just won't be charged at checkout. -::: + To enable it, first, make sure you have a payment method on file in `User Settings -> Billing` and then: @@ -118,7 +120,7 @@ You can now navigate to your Store page and purchase your one-time purchase item The entitlements tied to items purchased in Application Test Mode can be identified by entitlements with a `type` value of 4 to represent `TEST_MODE_PURCHASE`. -:::warn + The "Go To SKU" button does not currently work. To purchase your SKU in test mode, go to your Store page. -::: + diff --git a/docs/monetization/managing-skus.mdx b/discord/developers/docs/monetization/managing-skus.mdx similarity index 80% rename from docs/monetization/managing-skus.mdx rename to discord/developers/docs/monetization/managing-skus.mdx index d42d9bceea..f44500295b 100644 --- a/docs/monetization/managing-skus.mdx +++ b/discord/developers/docs/monetization/managing-skus.mdx @@ -1,8 +1,11 @@ -# Managing SKUs +--- +title: Managing SKUs +description: Learn how to create and manage SKUs that represent your app's premium offerings. +--- The premium items and subscriptions you offer in your app are represented by SKUs. **SKU** stands for Stock Keeping Unit and is a unique identifier for your premium offerings. -[SKUs](/docs/resources/sku) are the building blocks of your premium offerings and you can manage them in the Developer Portal. +[SKUs](/developers/docs/resources/sku) are the building blocks of your premium offerings and you can manage them in the Developer Portal. --- @@ -23,9 +26,9 @@ Once you select the SKU type, enter a name for your SKU to continue. You can create multiple subscription tiers to offer different benefits at different price points. Each tier can have its own set of benefits and price and is represented by unique SKUs. -To support upgrading and downgrading between subscription tiers, see our guide on [Implementing App Subscriptions](/docs/monetization/implementing-app-subscriptions#supporting-upgrades-and-downgrades). +To support upgrading and downgrading between subscription tiers, see our guide on [Implementing App Subscriptions](/developers/docs/monetization/implementing-app-subscriptions#supporting-upgrades-and-downgrades). -![Supporting multiple subscription tiers](images/multisub.webp) +![Supporting multiple subscription tiers](/images/monetization/multisub.png) ### SKU Limitations @@ -34,9 +37,9 @@ There are some limitations to the number of SKUs you can create: - You can offer either user subscription SKUs or guild subscription SKUs, but not both simultaneously. - SKU prices must be selected from the list of available prices. -:::info + If you need more SKUs than the 50 limit, consider creating a consumable in-app currency SKU that can be used to purchase items that are tracked in your app. -::: + --- @@ -55,7 +58,7 @@ Your list of benefits will displayed on your app's Store page, the App Directory - A name, max 80 characters - A description, max 160 characters -![Example of SKU benefits](images/sku-benefits.webp) +![Example of SKU benefits](/images/monetization/sku-benefits.png) ### Pricing Your SKUs @@ -63,32 +66,32 @@ When setting the price for your SKU, you can select from a list of predefined pr Subscription SKUs are automatically charged each month unless canceled. Changing the price of this SKU will only change it for new subscribers. Existing subscribers will continue to be charged the existing price. - + To set an icon using a standard Unicode emoji, enter the emoji in the `Unicode Emoji or Custom Emoji Name` field. -:::info + Using an emoji keyboard can make it easier to pick an icon to display alongside your SKU benefit. MacOS: `control + command + space bar` Windows: `Windows + .` -::: + -![Set a unicode emoji](images/sku-unicode.webp) - +![Set a unicode emoji](/images/sku-unicode.webp) + - + To use a custom emoji, set a value for both fields: - Name of your custom emoji - ID of the custom emoji -:::info + You can find the ID of the emoji in the Discord app by escaping the emoji in a message with a backslash character `\`. For example, `\:uwu:` will render with the name and ID of the emoji. -::: + -![Set a custom emoji](images/sku-custom.webp) - +![Set a custom emoji](/images/sku-custom.webp) + --- @@ -116,9 +119,9 @@ You can only make API calls or use the Embedded App SDK to grant entitlements fo ### Unpublishing a SKU -:::warn + **Danger:** Unpublishing a SKU can affect your users' existing subscriptions and entitlements -::: + Unpublishing a SKU removes it from the Store and the API, making it unavailable for purchase. @@ -130,11 +133,11 @@ Unpublishing a SKU has the following effects: ### Deleting a SKU -:::warn + **Danger:** Deleting a SKU can affect your users' existing subscriptions and entitlements -::: + -Deletes a SKU in the UI and makes it unavailable for publishing. Deleted SKUs are still listed when calling [List SKUs](/docs/resources/sku#list-skus) in the API. +Deletes a SKU in the UI and makes it unavailable for publishing. Deleted SKUs are still listed when calling [List SKUs](/developers/docs/resources/sku#list-skus) in the API. Deleting a SKU has the following effects: - For subscription SKUs, users and guilds will be immediately unsubscribed from the SKU. Their entitlement will still be valid until the end of the billing period. @@ -155,14 +158,16 @@ When you change the price of a user or guild subscription SKU, it will only affe After you've published your SKUs, you are ready to start implementing your premium features in your app. See our guides to get started. - - +import {ShopIcon} from '/snippets/icons/ShopIcon.jsx' + + + }> Learn how to start and manage recurring subscriptions within your app. - + }> Learn how to implement one-time purchases in your app. - + --- @@ -170,18 +175,18 @@ After you've published your SKUs, you are ready to start implementing your premi Users can access an app's Store page from the Bot User's profile in a server. This allows users to view an available subscription and one-time purchases, select a subscription to view its perks, benefits, and details, and make a purchase directly from an app's Store page. -:::info + Only subscriptions and items that have been published to the Store will be visible to users on the Store page. -::: + #### Accessing your Store page from a Bot User's Profile -![Accessing the store as a user](images/botuser-profile.webp) +![Accessing the store as a user](/images/monetization/botuser-profile.png) #### Subscriptions in Your Store page -![Subscriptions in your Store View](images/multisub.webp) +![Subscriptions in your Store View](/images/monetization/multisub.png) #### Items in Your Store page -![Items in your Store View](images/premium-items.webp) +![Items in your Store View](/images/monetization/premium-items.png) --- @@ -194,7 +199,7 @@ You can link directly to a specific SKU using our Application Directory Store UR - When used in chat, it will render as a rich embed that allows users to launch a modal to view either the SKU details or checkout flow - When used as a direct URL in a browser, it will take the user to your product in the Application Directory on web -![Embed for direct link to SKU](images/sku_embed.webp) +![Embed for direct link to SKU](/images/monetization/sku_embed.png) --- @@ -207,13 +212,13 @@ You can link directly to your Store page using our Application Directory Store U - When used in chat, it will render as a rich embed that allows users to launch a modal to your Store page - When used as a direct URL in a browser, it will take the user to your Store page in the Application Directory on web -![Embed for direct link to Store](images/store_embed.webp) +![Embed for direct link to Store](/images/monetization/store_embed.png) --- ## Responding with a Premium Button -You can prompt users to purchase item or subscription SKUs using a [button](/docs/components/reference#button) with a [premium style](/docs/components/reference#button-button-styles) and a `sku_id`. You can use this premium button style anywhere you would use message components, such as in a command response. +You can prompt users to purchase item or subscription SKUs using a [button](/developers/docs/components/reference#button) with a [premium style](/developers/docs/components/reference#button-button-styles) and a `sku_id`. You can use this premium button style anywhere you would use message components, such as in a command response. ```javascript return new JsonResponse({ @@ -234,4 +239,4 @@ return new JsonResponse({ }); ``` -![A premium button](images/premium-button.webp) \ No newline at end of file +![A premium button](/images/monetization/premium-button.png) diff --git a/docs/monetization/overview.mdx b/discord/developers/docs/monetization/overview.mdx similarity index 60% rename from docs/monetization/overview.mdx rename to discord/developers/docs/monetization/overview.mdx index 4b756f9ed2..4caa928d09 100644 --- a/docs/monetization/overview.mdx +++ b/discord/developers/docs/monetization/overview.mdx @@ -1,18 +1,18 @@ --- -sidebar_label: Overview +title: Monetizing Your Discord App +sidebarTitle: Overview +description: Learn how to add premium features to your Discord app with subscriptions and purchases. --- -# Monetizing Your Discord App - -![Monetizing Your Discord App](images/monetization-overview.webp) +![Monetizing Your Discord App](/images/monetization/overview.png) ### Offer native payment and checkout in your app using our Monetization APIs. Premium Apps lets you prompt customers to start subscriptions or purchase one-time items with our easy-to-use checkout and payment process. Discord notifies your app of the user's purchase, allowing you to grant access to your premium features. -- Sell monthly recurring [subscriptions](/docs/monetization/implementing-app-subscriptions) for your app's premium functionality within Discord -- Sell [one-time purchases](/docs/monetization/implementing-one-time-purchases) for both durable and consumable items or functionality within your app -- Highlight your app's premium benefits on the App Directory and on your own [Store](/docs/monetization/managing-skus#viewing-your-store-page) page +- Sell monthly recurring [subscriptions](/developers/docs/monetization/implementing-app-subscriptions) for your app's premium functionality within Discord +- Sell [one-time purchases](/developers/docs/monetization/implementing-one-time-purchases) for both durable and consumable items or functionality within your app +- Highlight your app's premium benefits on the App Directory and on your own [Store](/developers/docs/monetization/managing-skus#viewing-your-store-page) page - Offer native product tie-ins and upsells on the App Directory, app profiles, and in-chat - With secure transactions & fraud detection, your customers can securely pay for purchases without leaving Discord @@ -22,9 +22,9 @@ Premium Apps lets you prompt customers to start subscriptions or purchase one-ti To integrate a premium feature into your application, there are three primary components of our Monetization API: -- [SKUs](/docs/resources/sku) represent specific items or subscription options your app offers. Each SKU is a unique offering. -- [Entitlements](/docs/resources/entitlement) indicate whether a user has access to a specific premium offering or SKU. -- [Subscriptions](/docs/resources/subscription) represent an ongoing agreement where a user commits to paying for an entitlement on a recurring basis until canceled. +- [SKUs](/developers/docs/resources/sku) represent specific items or subscription options your app offers. Each SKU is a unique offering. +- [Entitlements](/developers/docs/resources/entitlement) indicate whether a user has access to a specific premium offering or SKU. +- [Subscriptions](/developers/docs/resources/subscription) represent an ongoing agreement where a user commits to paying for an entitlement on a recurring basis until canceled. ### Types of SKUs @@ -49,4 +49,4 @@ A subscription SKU represents a recurring purchase that a user can subscribe to Ready to start monetizing your app? -Follow our full guide for [Enabling Monetization](/docs/monetization/enabling-monetization) and implementing premium features in your app. \ No newline at end of file +Follow our full guide for [Enabling Monetization](/developers/docs/monetization/enabling-monetization) and implementing premium features in your app. \ No newline at end of file diff --git a/discord/developers/docs/policies/developer-policy.mdx b/discord/developers/docs/policies/developer-policy.mdx new file mode 100644 index 0000000000..f552b4fbc1 --- /dev/null +++ b/discord/developers/docs/policies/developer-policy.mdx @@ -0,0 +1,5 @@ +--- +title: Developer Policy +icon: "arrow-up-right-from-square" +url: https://support-dev.discord.com/hc/en-us/articles/8563934450327-Discord-Developer-Policy +--- diff --git a/discord/developers/docs/policies/developer-terms-of-service.mdx b/discord/developers/docs/policies/developer-terms-of-service.mdx new file mode 100644 index 0000000000..b78ba27182 --- /dev/null +++ b/discord/developers/docs/policies/developer-terms-of-service.mdx @@ -0,0 +1,5 @@ +--- +title: Developer Terms of Service +icon: "arrow-up-right-from-square" +url: https://support-dev.discord.com/hc/en-us/articles/8562894815383-Discord-Developer-Terms-of-Service +--- diff --git a/docs/quick-start/getting-started.mdx b/discord/developers/docs/quick-start/getting-started.mdx similarity index 72% rename from docs/quick-start/getting-started.mdx rename to discord/developers/docs/quick-start/getting-started.mdx index 117c82f6e0..5a5937435c 100644 --- a/docs/quick-start/getting-started.mdx +++ b/discord/developers/docs/quick-start/getting-started.mdx @@ -1,21 +1,22 @@ --- -sidebar_label: Getting Started +title: Building your first Discord app +sidebarTitle: Getting Started +description: Step-by-step tutorial for building your first Discord app. --- +import {LinkButton} from '/snippets/linkbutton.jsx' -# Building your first Discord app +[Discord apps](/developers/docs/quick-start/overview-of-apps) let you customize and extend Discord using a collection of APIs and interactive features. This guide will walk you through building your first Discord app using JavaScript and by the end you'll have an app that uses slash commands, sends messages, and responds to component interactions. -[Discord apps](/docs/quick-start/overview-of-apps) let you customize and extend Discord using a collection of APIs and interactive features. This guide will walk you through building your first Discord app using JavaScript and by the end you'll have an app that uses slash commands, sends messages, and responds to component interactions. - -:::info -If you're interested in building a game or social experience in an iframe, you can follow the tutorial for [building an Activity](/docs/activities/building-an-activity) -::: + +If you're interested in building a game or social experience in an iframe, you can follow the tutorial for [building an Activity](/developers/docs/activities/building-an-activity) + We'll be building a Discord app that lets users play rock-paper-scissors (with 7 choices instead of 3). This guide is beginner-focused, but it assumes a basic understanding of [JavaScript](https://developer.mozilla.org/en-US/docs/Learn/Getting_started_with_the_web/JavaScript_basics). - + Here's what the finished app will look like: -![Demo of example app](images/getting-started-demo.gif) +![Demo of example app](/images/getting-started-demo.gif) To make the user flow a bit more explicit: @@ -24,14 +25,14 @@ To make the user flow a bit more explicit: 3. User B presses the **Accept** button 4. User B is sent an ephemeral message where they select their object of choice 5. The result of the game is posted back into the original channel for all to see - + - + - **[GitHub repository](https://github.com/discord/discord-example-app)** where the code from this guide lives along with some additional feature-specific code examples. - **[discord-interactions](https://github.com/discord/discord-interactions-js)**, a library that provides types and helper functions for Discord apps. - **[Express](https://expressjs.com)**, a popular JavaScript web framework we'll use to create a server where Discord can send us requests. - **[ngrok](https://ngrok.com/)**, a tool that lets us tunnel our local server to a public URL where Discord can send requests. - + --- @@ -39,21 +40,21 @@ To make the user flow a bit more explicit: Before we get started, you'll need to set up your local environment and get the project code from the [sample app repository](https://github.com/discord/discord-example-app). -:::info + We'll be developing our app locally with a little help from [ngrok](https://ngrok.com/), but you can use your preferred development environment. -::: + If you don't have [NodeJS](https://nodejs.org/en/download/) installed, install that first. After NodeJS is installed, open your command line and clone the project code: -``` +```bash git clone https://github.com/discord/discord-example-app.git ``` Then navigate to the directory and install the project's dependencies: -``` +```bash # navigate to directory cd discord-example-app @@ -62,14 +63,14 @@ npm install ``` - + ``` ├── examples -> short, feature-specific sample apps -│ ├── app.js -> finished app.js code -│ ├── button.js -│ ├── command.js -│ ├── modal.js -│ ├── selectMenu.js +├──── app.js -> finished app.js code +├──── button.js +├──── command.js +├──── modal.js +├──── selectMenu.js ├── .env -> your credentials and IDs ├── app.js -> main entrypoint for app ├── commands.js -> slash command payloads + helpers @@ -79,7 +80,7 @@ npm install ├── README.md └── .gitignore ``` - + With that out of the way, open your new project in the code editor of your choice, and we'll move ahead to setting up your Discord app. @@ -87,7 +88,7 @@ With that out of the way, open your new project in the code editor of your choic First, you'll need to create an app in the developer portal if you don't have one already: - +Create App Enter a name for your app, then press **Create**. @@ -97,9 +98,9 @@ After you create your app, you'll land on the **General Information** page of th We'll need to set up and fetch a few sensitive values for your app, like its token and ID. -:::warn + Your token is used to authorize API requests and carry your app's permissions, so they are *highly* sensitive. Make sure to never share your token or check it into any kind of version control. -::: + Back in your project folder, rename the `.env.sample` file to `.env`. This is where we'll store all of your app's credentials. @@ -109,48 +110,48 @@ We'll need three values from your app's settings for your `.env` file: - Back on the **General Information** page, copy the value for **Public Key**, which is used to ensure HTTP requests are coming from Discord. In `.env`, replace `` with the value you copied. - On the **Bot** page under **Token**, click "Reset Token" to generate a new bot token. In `.env`, replace `` with your new token. -:::warn + You won't be able to view your token again unless you regenerate it, so make sure to keep it somewhere safe (like in a password manager). -::: + Now that you have the credentials you need, lets configure your bot user and installation settings. ### Configuring your bot -Newly-created apps have a bot user enabled by default. Bot users allow your app to appear and behave similarly to other server members when it's [installed to a server](/docs/quick-start/overview-of-apps#where-are-apps-installed). +Newly-created apps have a bot user enabled by default. Bot users allow your app to appear and behave similarly to other server members when it's [installed to a server](/developers/docs/quick-start/overview-of-apps#where-are-apps-installed). -On the left hand sidebar in your app's settings, there's a **Bot** page (where we fetched the token from). On this page, you can also configure settings like its [privileged intents](/docs/events/gateway#privileged-intents) or whether it can be installed by other users. +On the left hand sidebar in your app's settings, there's a **Bot** page (where we fetched the token from). On this page, you can also configure settings like its [privileged intents](/developers/docs/events/gateway#privileged-intents) or whether it can be installed by other users. - -Intents determine which events Discord will send your app when you're creating a [Gateway API connection](/docs/events/gateway). For example, if you want your app to perform an action when users add a reaction to a message, you can pass the `GUILD_MESSAGE_REACTIONS` (`1 << 10`) intent. + +Intents determine which events Discord will send your app when you're creating a [Gateway API connection](/developers/docs/events/gateway). For example, if you want your app to perform an action when users add a reaction to a message, you can pass the `GUILD_MESSAGE_REACTIONS` (`1 << 10`) intent. -Some intents are [privileged](/docs/events/gateway#privileged-intents), meaning they allow your app to access data that may be considered sensitive (like the contents of messages). Privileged intents can be toggled on the **Bot** page in your app's settings, but they must be approved before you [verify your app](https://support-dev.discord.com/hc/en-us/articles/23926564536471-How-Do-I-Get-My-App-Verified). Standard, non-privileged intents don't require any additional permissions or configurations. +Some intents are [privileged](/developers/docs/events/gateway#privileged-intents), meaning they allow your app to access data that may be considered sensitive (like the contents of messages). Privileged intents can be toggled on the **Bot** page in your app's settings, but they must be approved before you [verify your app](https://support-dev.discord.com/hc/en-us/articles/23926564536471-How-Do-I-Get-My-App-Verified). Standard, non-privileged intents don't require any additional permissions or configurations. -More information about intents and a full list of available intents (along with their associated events) is in the [Gateway documentation](/docs/events/gateway#gateway-intents). - +More information about intents and a full list of available intents (along with their associated events) is in the [Gateway documentation](/developers/docs/events/gateway#gateway-intents). + For now, we don't need to configure anything additional here, but you may need to in the future depending on your app's use case. Let's go ahead and get our app ready for installation. ### Choosing installation contexts -Now we'll select where your app can be installed in Discord, which is determined by the [installation contexts](/docs/resources/application#installation-context) that your app supports. +Now we'll select where your app can be installed in Discord, which is determined by the [installation contexts](/developers/docs/resources/application#installation-context) that your app supports. - + **Installation contexts** determine where your app can be installed: to servers, to users, or both. Apps can choose which installation contexts they support within the app's settings. -- Apps installed in a **[server context](/docs/resources/application#server-context)** (server-installed apps) must be authorized by a server member with the `MANAGE_GUILD` permission, and are visible to all members of the server. -- Apps installed in a **[user context](/docs/resources/application#user-context)** (user-installed apps) are visible only to the authorizing user, and therefore don't require any server-specific permissions. Apps installed to a user context are visible across all of the user's servers, DMs, and GDMs—however, they're limited to using commands. - +- Apps installed in a **[server context](/developers/docs/resources/application#server-context)** (server-installed apps) must be authorized by a server member with the `MANAGE_GUILD` permission, and are visible to all members of the server. +- Apps installed in a **[user context](/developers/docs/resources/application#user-context)** (user-installed apps) are visible only to the authorizing user, and therefore don't require any server-specific permissions. Apps installed to a user context are visible across all of the user's servers, DMs, and GDMs—however, they're limited to using commands. + Click on **Installation** in the left sidebar, then under **Installation Contexts** make sure both "User Install" and "Guild Install" are selected. -:::info -Some apps may only want to support one installation context—for example, a moderation app may only support a server context. However, by default, we recommend supporting both installation contexts. For detailed information about supporting user-installed apps, you can read the [user-installable app tutorial](/docs/tutorials/developing-a-user-installable-app). -::: + +Some apps may only want to support one installation context—for example, a moderation app may only support a server context. However, by default, we recommend supporting both installation contexts. For detailed information about supporting user-installed apps, you can read the [user-installable app tutorial](/developers/docs/tutorials/developing-a-user-installable-app). + ### Setting up an install link -[Install links](/docs/resources/application#install-links) provide an easy way for users to install your app in Discord. We'll set up the default [Discord Provided Link](/docs/resources/application#discord-provided-link), but you can read more about the different type of install links in the [Application documentation](/docs/resources/application#types-of-install-links). +[Install links](/developers/docs/resources/application#install-links) provide an easy way for users to install your app in Discord. We'll set up the default [Discord Provided Link](/developers/docs/resources/application#discord-provided-link), but you can read more about the different type of install links in the [Application documentation](/developers/docs/resources/application#types-of-install-links). On the **Installation** page, go to the **Install Link** section and select "Discord Provided Link" if it's not already selected. @@ -160,30 +161,30 @@ When Discorded Provided Link is selected, a new **Default Install Settings** sec Apps need approval from installing users to perform actions in Discord (like creating a slash command or fetching a list of server members). Let's add scopes and permissions before installing the app. - + When creating an app, scopes and permissions determine what your app can do and access in Discord. -- [OAuth2 Scopes](/docs/topics/oauth2#shared-resources-oauth2-scopes) determine what data access and actions your app can take, granted on behalf of an installing or authenticating user. -- [Permissions](/docs/topics/permissions#permission-overwrites) are the granular permissions for your bot user, the same as other users in Discord have. They can be approved by the installing user or later updated within server settings or with [permission overwrites](/docs/topics/permissions#permission-overwrites). Since apps installed to a user context can only respond to commands, these permissions are only relevant to apps installed to a server. - +- [OAuth2 Scopes](/developers/docs/topics/oauth2#shared-resources-oauth2-scopes) determine what data access and actions your app can take, granted on behalf of an installing or authenticating user. +- [Permissions](/developers/docs/topics/permissions#permission-overwrites) are the granular permissions for your bot user, the same as other users in Discord have. They can be approved by the installing user or later updated within server settings or with [permission overwrites](/developers/docs/topics/permissions#permission-overwrites). Since apps installed to a user context can only respond to commands, these permissions are only relevant to apps installed to a server. + On the **Installation** page in the **Default Install Settings** section: - For **User Install**, add the `applications.commands` scope - For **Guild Install**, add the `applications.commands` scope and `bot` scope. When you select `bot`, a new **Permissions** menu will appear to select the bot user's permissions. Select any permissions that you may want for your app—for now, I'll just select `Send Messages`. -![Default Install Settings](images/getting-started-default-install.webp) +![Default Install Settings](/images/getting-started-default-install.png) -See a list of all [OAuth2 scopes](/docs/topics/oauth2#shared-resources-oauth2-scopes), or read more on [permissions](/docs/topics/permissions) in the documentation. +See a list of all [OAuth2 scopes](/developers/docs/topics/oauth2#shared-resources-oauth2-scopes), or read more on [permissions](/developers/docs/topics/permissions) in the documentation. ### Installing your app -:::info + When developing apps, you should build and test on your user account (for user-installable apps) and in a server that isn't actively used by others (for server-installable apps). If you don't have your own server already, you can [create one for free](https://support.discord.com/hc/en-us/articles/204849977-How-do-I-create-a-server-). -::: + Once you add scopes, copy the URL from the **Install Link** section from before. -Since our app is supporting both installation contexts, we'll install your new app to both a test server and your user account so that we can test in both [installation contexts](/docs/resources/application#installation-context). +Since our app is supporting both installation contexts, we'll install your new app to both a test server and your user account so that we can test in both [installation contexts](/developers/docs/resources/application#installation-context). ###### Install to server @@ -203,19 +204,19 @@ Follow the installation prompt to install your app to your user account. Once it With your app configured and installed to your test server and account, let's take a look at the code. -:::info -To make development a bit simpler, the app uses [discord-interactions](https://github.com/discord/discord-interactions-js), which provides types and helper functions. If you prefer to use other languages or libraries, check out the [Community Resources](/docs/developer-tools/community-resources) documentation. -::: + +To make development a bit simpler, the app uses [discord-interactions](https://github.com/discord/discord-interactions-js), which provides types and helper functions. If you prefer to use other languages or libraries, check out the [Community Resources](/developers/docs/developer-tools/community-resources) documentation. + ### Installing slash commands -:::info + To install slash commands, the app is using [`node-fetch`](https://github.com/node-fetch/node-fetch). You can see the implementation for the installation in `utils.js` within the `DiscordRequest()` function. -::: + -The project contains a `register` script you can use to install the commands in `ALL_COMMANDS`, which is defined at the bottom of `commands.js`. It installs the commands as global commands by calling the HTTP API's [`PUT /applications//commands`](/docs/interactions/application-commands#bulk-overwrite-global-application-commands) endpoint. +The project contains a `register` script you can use to install the commands in `ALL_COMMANDS`, which is defined at the bottom of `commands.js`. It installs the commands as global commands by calling the HTTP API's [`PUT /applications//commands`](/developers/docs/interactions/application-commands#bulk-overwrite-global-application-commands) endpoint. -If you want to customize your commands or add additional ones, you can reference the command structure in the [commands documentation](/docs/interactions/application-commands#application-command-object-application-command-structure). +If you want to customize your commands or add additional ones, you can reference the command structure in the [commands documentation](/developers/docs/interactions/application-commands#application-command-object-application-command-structure). In your terminal within the project folder, run the following command: @@ -225,12 +226,12 @@ npm run register If you navigate back to your server, you should see the slash commands appear. But if you try to run them, nothing will happen since your app isn't receiving or handling any requests from Discord. - -Apps have access to [APIs](/docs/quick-start/overview-of-apps#what-apis-can-apps-use) that you can mix-and-match to build apps: + +Apps have access to [APIs](/developers/docs/quick-start/overview-of-apps#what-apis-can-apps-use) that you can mix-and-match to build apps: -- **[HTTP API](/docs/reference#http-api)** is a REST-like API for general operations like sending and updating data in Discord, or fetching data about a resource. -- **[Gateway API](/docs/reference#gateway-websocket-api)** is a WebSocket-based API that is helpful for maintaining state or listening to events happening in a Discord server. We won't be using it in this guide, but more information about how to create a Gateway connection and the different events you can listen to are in the [Gateway documentation](/docs/events/gateway). - +- **[HTTP API](/developers/docs/reference#http-api)** is a REST-like API for general operations like sending and updating data in Discord, or fetching data about a resource. +- **[Gateway API](/developers/docs/reference#gateway-websocket-api)** is a WebSocket-based API that is helpful for maintaining state or listening to events happening in a Discord server. We won't be using it in this guide, but more information about how to create a Gateway connection and the different events you can listen to are in the [Gateway documentation](/developers/docs/events/gateway). + --- @@ -248,11 +249,11 @@ First, go to your project's folder and run the following to start your app: npm run start ``` -There should be output indicating your app is running on port `3000`. Behind the scenes, our app is ready to handle interactions from Discord, which includes verifying security request headers and responding to `PING` requests. We're skipping over a lot of the details in this tutorial, but details about preparing apps for interactions is in the [Interactions Overview](/docs/interactions/overview#preparing-for-interactions) documentation. +There should be output indicating your app is running on port `3000`. Behind the scenes, our app is ready to handle interactions from Discord, which includes verifying security request headers and responding to `PING` requests. We're skipping over a lot of the details in this tutorial, but details about preparing apps for interactions is in the [Interactions Overview](/developers/docs/interactions/overview#preparing-for-interactions) documentation. -:::info + By default, the server will listen to requests sent to port 3000, but if you want to change the port, you can specify a `PORT` variable in your `.env` file. -::: + Next, we'll start our ngrok tunnel. If you don't have ngrok installed locally, you can install it by following the instructions on the [ngrok download page](https://ngrok.com/download). @@ -280,19 +281,19 @@ We'll use **Forwarding** URL as the publicly-accessible URL where Discord will s Go to your [app's settings](https://discord.com/developers/applications) and on the **General Information** page under **Interaction Endpoint URL**, paste your new ngrok forwarding URL and append `/interactions`. -![Interactions Endpoint URL](images/getting-started-interactions-endpoint.webp) +![Interactions Endpoint URL](/images/getting-started-interactions-endpoint.png) Click **Save Changes** and ensure your endpoint is successfully verified. -:::info + If you have troubles verifying your endpoint, make sure both ngrok and your app are running on the same port, and that you've copied the ngrok URL correctly -::: + The verification is handled automatically by the sample app in two ways: - It uses the `PUBLIC_KEY` and [discord-interactions package](https://github.com/discord/discord-interactions-js#usage) with a wrapper function (imported from `utils.js`) that makes it conform to [Express's `verify` interface](http://expressjs.com/en/5x/api.html#express.json). This is run on every incoming request to your app. - It responds to incoming `PING` requests. -You can learn more about preparing your app to receive interactions in [the interactions documentation](/docs/interactions/overview#preparing-for-interactions). +You can learn more about preparing your app to receive interactions in [the interactions documentation](/developers/docs/interactions/overview#preparing-for-interactions). ### Handling slash command requests @@ -318,11 +319,11 @@ if (name === 'test') { } ``` -The code above is responding to the interaction with a message in the channel, DM, or Group DM it originated from. You can see all available response types, like responding with a modal, [in the documentation](/docs/interactions/receiving-and-responding#interaction-response-object-interaction-callback-type). +The code above is responding to the interaction with a message in the channel, DM, or Group DM it originated from. You can see all available response types, like responding with a modal, [in the documentation](/developers/docs/interactions/receiving-and-responding#interaction-response-object-interaction-callback-type). -:::info + `InteractionResponseType.CHANNEL_MESSAGE_WITH_SOURCE` is a constant [exported from `discord-interactions`](https://github.com/discord/discord-interactions-js/blob/main/src/index.ts#L33) -::: + Go to your server and make sure your app's `/test` slash command works. When you trigger it, your app should send a message that contains “hello world” followed by a random emoji. @@ -338,13 +339,13 @@ The `/challenge` command will be how our rock-paper-scissors-style game is initi The `/challenge` command, called `CHALLENGE_COMMAND` in `commands.js`, has an array of `options`. In our app, the options are objects representing different things that a user can select while playing rock-paper-scissors, generated using keys of `RPSChoices` in `game.js`. -You can read more about command options and their structure [in the documentation](/docs/interactions/application-commands#application-command-object-application-command-option-structure). +You can read more about command options and their structure [in the documentation](/developers/docs/interactions/application-commands#application-command-object-application-command-option-structure). -:::info + While this guide won't touch much on the `game.js` file, feel free to poke around and change commands or the options in the commands. -::: + - + To handle the `/challenge` command, add the following code after the `if name === “test”` if block: @@ -392,30 +393,30 @@ if (name === 'challenge' && id) { } ``` -:::info + If you aren't sure where to paste the code, you can see the full code in `examples/app.js`. -::: + The above code is doing a few things: 1. Parses the request body to get the ID of the user who triggered the slash command (`userId`), and the option (object choice) they selected (`objectName`). If the interaction is run in a server (`context === 0`), the user ID will be nested in the `member` object. If it's in a DM or Group DM, it will be in the `user` object. 2. Adds a new game to the `activeGames` object using the interaction ID. The active game records the `userId` and `objectName`. 3. Sends a message back to the channel with a button with a `custom_id` of `accept_button_`. -:::warn + The sample code uses an object as in-memory storage, but for production apps you should use a database. -::: + -When sending a message with [message components](/docs/components/reference), the individual payloads are appended to a `components` array. Actionable components (like buttons) need to be inside of an [action row](/docs/components/reference#action-row), which you can see in the code sample. +When sending a message with [message components](/developers/docs/components/reference), the individual payloads are appended to a `components` array. Actionable components (like buttons) need to be inside of an [action row](/developers/docs/components/reference#action-row), which you can see in the code sample. Note the unique `custom_id` sent with message components, in this case `accept_button_` with the active game's ID appended to it. A `custom_id` can be used to handle requests that Discord sends you when someone interacts with the component, which you'll see in a moment. Now when you run the `/challenge` command and pick an option, your app will send a message with an **Accept** button. Let's add code to handle the button press. - + - + -When users interact with a message component, Discord will send a request with an [interaction type](/docs/interactions/receiving-and-responding#interaction-object-interaction-type) of `3` (or the `MESSAGE_COMPONENT` value when using `discord-interactions`). +When users interact with a message component, Discord will send a request with an [interaction type](/developers/docs/interactions/receiving-and-responding#interaction-object-interaction-type) of `3` (or the `MESSAGE_COMPONENT` value when using `discord-interactions`). To set up a handler for the button, we'll check the `type` of interaction, followed by matching the `custom_id`. @@ -468,14 +469,14 @@ if (type === InteractionType.MESSAGE_COMPONENT) { The above code: 1. Checks for a `custom_id` that matches what we originally sent (in this case, it starts with `accept_button_`). The custom ID also has the active game ID appended, so we store that in `gameID`. -2. [Deletes the original message](/docs/interactions/receiving-and-responding#delete-original-interaction-response) calling a webhook using `node-fetch` and passing the unique interaction `token` in the request body. This is done to clean up the channel, and so other users can't click the button. -3. Responds to the request by sending a message that contains a select menu with the object choices for the game. The payload should look fairly similar to the previous one, with the exception of the `options` array and `flags: 64`, [which indicates that the message is ephemeral](/docs/interactions/receiving-and-responding#create-followup-message). +2. [Deletes the original message](/developers/docs/interactions/receiving-and-responding#delete-original-interaction-response) calling a webhook using `node-fetch` and passing the unique interaction `token` in the request body. This is done to clean up the channel, and so other users can't click the button. +3. Responds to the request by sending a message that contains a select menu with the object choices for the game. The payload should look fairly similar to the previous one, with the exception of the `options` array and `flags: 64`, [which indicates that the message is ephemeral](/developers/docs/interactions/receiving-and-responding#create-followup-message). -The `options` array is populated using the `getShuffledOptions()` method in `game.js`, which manipulates the `RPSChoices` values to conform to the shape of [string select options](/docs/components/reference#string-select-select-option-structure). +The `options` array is populated using the `getShuffledOptions()` method in `game.js`, which manipulates the `RPSChoices` values to conform to the shape of [string select options](/developers/docs/components/reference#string-select-select-option-structure). - + - + The last thing to add is code to handle select menu interactions, and to send the result of the game to channel. @@ -585,11 +586,11 @@ Similar to earlier code, the code above is getting the user ID and their object That information, along with the original user's ID and selection from the `activeGames` object, are passed to the `getResult()` function. `getResult()` determines the winner, then builds a readable string to send back to the channel. -We're also calling another webhook, this time to [update the follow-up ephemeral message](/docs/interactions/receiving-and-responding#edit-followup-message) since it can't be deleted. +We're also calling another webhook, this time to [update the follow-up ephemeral message](/developers/docs/interactions/receiving-and-responding#edit-followup-message) since it can't be deleted. Finally, the results are sent in the channel using the `CHANNEL_MESSAGE_WITH_SOURCE` interaction response type. - + ....and that's it 🎊 Go ahead and test your app and make sure everything works. @@ -601,17 +602,22 @@ Congrats on building your first Discord app! 🤖 Hopefully you learned a bit about Discord apps, how to configure them, and how to make them interactive. From here, you can continue building out your app or explore what else is possible. - - +import {AppsIcon} from '/snippets/icons/AppsIcon.jsx' +import {WrenchIcon} from '/snippets/icons/WrenchIcon.jsx' +import {UserIcon} from '/snippets/icons/UserIcon.jsx' +import {GlobeEarthIcon} from '/snippets/icons/GlobeEarthIcon.jsx' + + + }> Explore the platform features and APIs you have access to when building an app on Discord - + }> Explore 1st party and community-built libraries and tools to speed up and simplify your development - + }> Tutorial on building and handling interactions for apps installed to a user - + }> Join our community to ask questions about the API, attend events hosted by the Discord platform team, and interact with other devs - + diff --git a/discord/developers/docs/quick-start/overview-of-apps.mdx b/discord/developers/docs/quick-start/overview-of-apps.mdx new file mode 100644 index 0000000000..0e23536759 --- /dev/null +++ b/discord/developers/docs/quick-start/overview-of-apps.mdx @@ -0,0 +1,103 @@ +--- +title: Overview of Discord Apps +description: Build Discord apps to customize, extend, and enhance Discord for millions of users. +sidebarTitle: Overview of Apps +--- + +import {ManualAnchor} from '/snippets/manualanchor.jsx' + + + +On this page we'll answer the questions: + +* [What can apps do?](/developers/docs/quick-start/overview-of-apps#what-can-apps-do) +* [Where are apps installed?](/developers/docs/quick-start/overview-of-apps#where-are-apps-installed) +* [What APIs can apps use?](/developers/docs/quick-start/overview-of-apps#what-apis-can-apps-use) + + +## What can apps do? + +You will discover the full possibility of apps as you explore the documentation and start building, but for now let's take a glance at some features you can build and integrate as you're developing your app. + +### Send and manage messages + +Messages are a core part of Discord, and that's true for apps too. Apps can send messages in a few ways—they can call the [Create Message endpoint](/developers/docs/resources/message#create-message), create and execute [webhooks](/developers/docs/resources/webhook), or respond with a message when responding to an [interaction](/developers/docs/interactions/overview). Apps can also manage messages if they have the proper permissions, which is covered more in the [Message documentation](/developers/docs/resources/message). + +### Interact with users + +Apps can use [interactions](/developers/docs/interactions/overview) to create more engaging and intuitive experiences for users. When sending messages, apps can send interactive components like [buttons](/developers/docs/components/reference#button) and [select menus](/developers/docs/components/reference#string-select) in the `components` field. Apps can also open form-like modals or launch an Activity [in response to interactions](/developers/docs/interactions/receiving-and-responding#interaction-response-object-modal). + +### Build embedded games and experiences + +Using the [Embedded App SDK](/developers/docs/developer-tools/embedded-app-sdk), apps can create [Activities](/developers/docs/activities/overview) which are cross-platform interactive games and social experiences in Discord. They run in iframes in Discord, where people who play games are already hanging out. + +### Customize servers + +With the right API endpoints and proper [permissions](/developers/docs/topics/permissions), apps can customize the experience of using and moderating servers by accessing and customizing all sorts of resources core to Discord—including [users](/developers/docs/resources/user), [channels](/developers/docs/resources/channel), and [AutoMod](/developers/docs/resources/auto-moderation) to name a few. Explore the **Resources** documentation category to learn about the different Discord resources and how apps can use them. + +### Update user metadata and presence + +Apps can update a Discord's user metadata with data from a party game or app in a few ways. Apps can also update a user's profile with actionable data from a game or app by integrating [Rich Presence](/developers/docs/rich-presence/overview). Apps can also use [role connection metadata](/developers/docs/resources/application-role-connection-metadata) to associate third-party metadata (like stats or account type) with Discord users, which server admins can use to set up roles based on. You can explore more in the [configuring metadata for linked roles](/developers/docs/tutorials/configuring-app-metadata-for-linked-roles) tutorial. + +### Add premium features + +[App subscriptions](/developers/docs/monetization/implementing-app-subscriptions) let apps charge users and/or servers for premium functionality on a recurring basis natively within Discord. You can read more about eligibility and adding monetization features to your app in the [Monetization](/developers/docs/monetization/overview) documentation. + +### ...and more + +This developer documentation is full of nooks and crannies with all sorts of features to explore. Discover the possibilities by exploring more of the docs, or by [building your own app](https://discord.com/developers/applications). + + + +## Where are apps installed? + +Discord apps can be installed in two different contexts: + +1. Apps installed **to a server** (called a [guild](/developers/docs/resources/guild) throughout the API) by a user with the Manage Server ([`MANAGE_GUILD`](/developers/docs/topics/permissions#permissions-bitwise-permission-flags)) permission. Apps installed to a server can only be used within that server and DMs with the app's bot user, and are visible to all server members. +2. Apps installed **to a user account**. Apps installed to a user are visible only to that user, across all of their servers, DMs, and Group DMs by default. + +The installation contexts that an app supports can be limited by the developer when [setting up the app](/developers/docs/resources/application#setting-supported-installation-contexts). Details about installation contexts are in the [Application resource documentation](/developers/docs/resources/application#installation-context). + + +## What APIs can apps use? + +There are a handful of different APIs that you can pick and choose from based on your app's functionality and which Discord features you want to access. Below is a quick overview of the main APIs on the Discord developer platform, but you can read more details and information about API usage in the [API reference](/developers/docs/reference). + +### HTTP API + +The **HTTP API** is a REST API that lets you interact and modify core Discord resources like [channels](/developers/docs/resources/channel), [servers (or guilds)](/developers/docs/resources/guild), [users](/developers/docs/resources/user), and [messages](/developers/docs/resources/message#message-object). + +Use the HTTP API to: +- Retrieve information about a resource +- Create, update, or delete a resource + +Read details about using the HTTP API in the [API reference](/developers/docs/reference#http-api). + +### Gateway API + +The **Gateway API** lets you receive event data over a WebSocket anytime an [event](/developers/docs/events/gateway-events) occurs in a server where your app is installed. + +Use the Gateway API to: +- Receive events happening in Discord + +Read details about using the Gateway API in the [API reference](/developers/docs/reference#gateway-websocket-api). + +## Start Building + +Well, would you look at the time? With the basics out of the way, it's time to start building your Discord app! You can explore the reset of the documentation, go to your [Apps](https://discord.com/developers/applications), or explore the beginner resources below. + +import {AppsIcon} from '/snippets/icons/AppsIcon.jsx' +import {ActivitiesIcon} from '/snippets/icons/ActivitiesIcon.jsx' +import {WrenchIcon} from '/snippets/icons/WrenchIcon.jsx' + + + } iconType="solid" horizontal > + Tutorial to develop your first Discord app with interactive components + + } iconType="solid" horizontal > + Tutorial to develop an Activity using the Embedded App SDK + + } iconType="solid" horizontal > + Explore community-built library and tools to speed up and simplify development + + diff --git a/docs/reference.mdx b/discord/developers/docs/reference.mdx similarity index 61% rename from docs/reference.mdx rename to discord/developers/docs/reference.mdx index ba45347ba3..5bc17292ae 100644 --- a/docs/reference.mdx +++ b/discord/developers/docs/reference.mdx @@ -1,39 +1,45 @@ -# API Reference +--- +title: API Reference +description: "The Discord API is a REST API that allows you to interact with Discord data from your own applications. It's the primary way to interact with Discord from your own code." +sidebarTitle: API Reference +--- -Discord's API is based around two core layers, a HTTPS/REST API for general operations, and persistent secure WebSocket based connection for sending and subscribing to real-time events. The most common use case of the Discord API will be providing a service, or access to a platform through the [OAuth2](https://oauth.net/2/) API. +import {ManualAnchor} from '/snippets/manualanchor.jsx' +import {Snowflake} from '/snippets/snowflake.jsx' -###### Base URL +**Base URL** -``` +```bash https://discord.com/api ``` ## API Versioning -:::danger -Some API and Gateway versions are now non-functioning, and are labeled as discontinued in the table below for posterity. Trying to use these versions will fail and return 400 Bad Request. -::: + + Some API and Gateway versions are now non-functioning, and are labeled as discontinued in the table below for posterity. Trying to use these versions will fail and return 400 Bad Request. + -Discord exposes different versions of our API[.](https://c.tenor.com/BuZl66EegkgAAAAC/westworld-dolores.gif) You should specify which version to use by including it in the request path like `https://discord.com/api/v{version_number}`. Omitting the version number from the route will route requests to the current default version (marked below). You can find the change log for the newest API version [here](/docs/change-log). +Discord exposes different versions of our API[.](https://c.tenor.com/BuZl66EegkgAAAAC/westworld-dolores.gif) You should specify which version to use by including it in the request path like `https://discord.com/api/v{version_number}`. Omitting the version number from the route will route requests to the current default version (marked below). You can find the change log for the newest API version [here](/developers/docs/change-log). -###### API Versions + +**API Versions** -| Version | Status | Default | -|---------|--------------|---------| -| 10 | Available | | -| 9 | Available | | -| 8 | Deprecated | | -| 7 | Deprecated | | -| 6 | Deprecated | ✓ | -| 5 | Discontinued | | -| 4 | Discontinued | | -| 3 | Discontinued | | +| Version | Status | Default | +|---------|--------------|----------------------------------------| +| 10 | Available | | +| 9 | Available | | +| 8 | Deprecated | | +| 7 | Deprecated | | +| 6 | Deprecated | | +| 5 | Discontinued | | +| 4 | Discontinued | | +| 3 | Discontinued | | ## Error Messages Starting in API v8, we've improved error formatting in form error responses. The response will tell you which JSON key contains the error, the error code, and a human readable error message. We will be frequently adding new error messages, so a complete list of errors is not feasible and would be almost instantly out of date. Here are some examples instead: -###### Array Error +**Array Error** ```json { @@ -64,7 +70,7 @@ Starting in API v8, we've improved error formatting in form error responses. The } ``` -###### Object Error +**Object Error** ```json { @@ -83,7 +89,7 @@ Starting in API v8, we've improved error formatting in form error responses. The } ``` -###### Request Error +**Request Error** ```json { @@ -104,20 +110,20 @@ Starting in API v8, we've improved error formatting in form error responses. The Authenticating with the Discord API can be done in one of two ways: -1. Using a bot token found on the **Bot** page within your app's settings. For more information on bots see [bots vs user accounts](/docs/topics/oauth2#bot-vs-user-accounts). -2. Using an OAuth2 bearer token gained through the [OAuth2 API](/docs/topics/oauth2#oauth2). +1. Using a bot token found on the Bot page within your app's settings. For more information on bots see [bots vs user accounts](/developers/docs/topics/oauth2#bot-vs-user-accounts). +2. Using an OAuth2 bearer token gained through the [OAuth2 API](/developers/docs/topics/oauth2). For all authentication types, authentication is performed with the `Authorization` HTTP header in the format `Authorization: TOKEN_TYPE TOKEN`. -###### Example Bot Token Authorization Header +**Example Bot Token Authorization Header** -``` +```bash Authorization: Bot MTk4NjIyNDgzNDcxOTI1MjQ4.Cl2FMQ.ZnCjm1XVW7vRze4b7Cq4se7kKWs ``` -###### Example Bearer Token Authorization Header +**Example Bearer Token Authorization Header** -``` +```bash Authorization: Bearer CZhtkLDpNYXgPH9Ml6shqh2OwykChw ``` @@ -127,16 +133,16 @@ All HTTP-layer services and protocols (e.g. HTTP, WebSocket) within the Discord ## Snowflakes -Discord utilizes Twitter's [snowflake](https://github.com/twitter-archive/snowflake/tree/snowflake-2010) format for uniquely identifiable descriptors (IDs). These IDs are guaranteed to be unique across all of Discord, except in some unique scenarios in which child objects share their parent's ID. Because Snowflake IDs are up to 64 bits in size (e.g. a uint64), they are always returned as strings in the HTTP API to prevent integer overflows in some languages. See [Gateway ETF/JSON](/docs/events/gateway#encoding-and-compression) for more information regarding Gateway encoding. +Discord utilizes Twitter's [snowflake](https://github.com/twitter-archive/snowflake/tree/snowflake-2010) format for uniquely identifiable descriptors (IDs). These IDs are guaranteed to be unique across all of Discord, except in some unique scenarios in which child objects share their parent's ID. Because Snowflake IDs are up to 64 bits in size (e.g. a uint64), they are always returned as strings in the HTTP API to prevent integer overflows in some languages. See [Gateway ETF/JSON](/developers/docs/events/gateway#encoding-and-compression) for more information regarding Gateway encoding. -###### Snowflake ID Broken Down in Binary +**Snowflake ID Broken Down in Binary** ``` 111111111111111111111111111111111111111111 11111 11111 111111111111 64 22 17 12 0 ``` -###### Snowflake ID Format Structure (Left to Right) +**Snowflake ID Format Structure (Left to Right)** | Field | Bits | Number of bits | Description | Retrieval | |---------------------|----------|----------------|------------------------------------------------------------------------------|-------------------------------------| @@ -145,19 +151,21 @@ Discord utilizes Twitter's [snowflake](https://github.com/twitter-archive/snowfl | Internal process ID | 16 to 12 | 5 bits | | `(snowflake & 0x1F000) >> 12` | | Increment | 11 to 0 | 12 bits | For every ID that is generated on that process, this number is incremented | `snowflake & 0xFFF` | + ### Convert Snowflake to DateTime + ### Snowflake IDs in Pagination We typically use snowflake IDs in many of our API routes for pagination. The standardized pagination paradigm we utilize is one in which you can specify IDs `before` and `after` in combination with `limit` to retrieve a desired page of results. You will want to refer to the specific endpoint documentation for details. It is useful to note that snowflake IDs are just numbers with a timestamp, so when dealing with pagination where you want results from the beginning of time (in Discord Epoch, but `0` works here too) or before/after a specific time you can generate a snowflake ID for that time. -###### Generating a snowflake ID from a Timestamp Example +**Generating a snowflake ID from a Timestamp Example** -``` +```bash (timestamp_ms - DISCORD_EPOCH) << 22 ``` @@ -167,7 +175,7 @@ There are some cases in which our API and Gateway may return IDs in an unexpecte However, there are cases in which passing something to our API will instead return IDs serialized as an integer; this is the case when you send our API or Gateway a value in an `id` field that is not `bigint` size. For example, when requesting `GUILD_MEMBERS_CHUNK` from our gateway: -```javascript +```bash // Send { op: 8, @@ -190,7 +198,7 @@ However, there are cases in which passing something to our API will instead retu } ``` -You can see in this case that the sent `user_id` is not a `bigint`; therefore, when it is serialized back to JSON by Discord, it is not transformed into a string. **This will never happen with IDs that come from Discord.** But, this can happen if you send malformed data in your requests. +You can see in this case that the sent `user_id` is not a `bigint`; therefore, when it is serialized back to JSON by Discord, it is not transformed into a string. This will never happen with IDs that come from Discord. But, this can happen if you send malformed data in your requests. ## ISO8601 Date/Time @@ -198,23 +206,22 @@ Discord utilizes the [ISO8601 format](https://www.loc.gov/standards/datetime/iso ## Nullable and Optional Resource Fields -Resource fields that may contain a `null` value have types that are prefixed with a question mark. -Resource fields that are optional have names that are suffixed with a question mark. +Resource fields that may contain a `null` value have types that are prefixed with a question mark. Resource fields that are optional have names that are suffixed with a question mark. -###### Example Nullable and Optional Fields +**Example Nullable and Optional Fields** -| Field | Type | -|------------------------------|---------| -| optional_field? | string | -| nullable_field | ?string | -| optional_and_nullable_field? | ?string | +| Field | Type | +|---------------------------------|---------| +| optional\_field? | string | +| nullable\_field | ?string | +| optional\_and\_nullable\_field? | ?string | ## Consistency -Discord operates at a scale where true consistency is impossible. Because of this, lots of operations in our API and in-between our services are [eventually consistent](https://en.wikipedia.org/wiki/Eventual_consistency). Due to this, client actions can never be serialized and may be executed in _any_ order (if executed at all). Along with these constraints, events in Discord may: +Discord operates at a scale where true consistency is impossible. Because of this, lots of operations in our API and in-between our services are [eventually consistent](https://en.wikipedia.org/wiki/Eventual_consistency). Due to this, client actions can never be serialized and may be executed in any order (if executed at all). Along with these constraints, events in Discord may: - Never be sent to a client -- Be sent _exactly_ one time to the client +- Be sent exactly one time to the client - Be sent up to N times per client Clients should operate on events and results from the API in as much of an idempotent behavior as possible. @@ -225,17 +232,17 @@ Clients should operate on events and results from the API in as much of an idemp Clients using the HTTP API must provide a valid [User Agent](https://www.rfc-editor.org/rfc/rfc9110.html#section-10.1.5) which specifies information about the client library and version in the following format: -###### User Agent Example +**User Agent Example** -``` +```bash User-Agent: DiscordBot ($url, $versionNumber) ``` -Clients may append more information and metadata to the _end_ of this string as they wish. +Clients may append more information and metadata to the end of this string as they wish. -:::warn -Client requests that do not have a valid User Agent specified may be blocked and return a [Cloudflare error](https://support.cloudflare.com/hc/en-us/articles/360029779472-Troubleshooting-Cloudflare-1XXX-errors). -::: + + Client requests that do not have a valid User Agent specified may be blocked and return a [Cloudflare error](https://support.cloudflare.com/hc/en-us/articles/360029779472-Troubleshooting-Cloudflare-1XXX-errors). + ### Content Type @@ -243,7 +250,7 @@ Clients using the HTTP API must provide a valid `Content-Type` header, either `a ### Rate Limiting -The HTTP API implements a process for limiting and preventing excessive requests in accordance with [RFC 6585](https://tools.ietf.org/html/rfc6585#section-4). API users that regularly hit and ignore rate limits will have their API keys revoked, and be blocked from the platform. For more information on rate limiting of requests, please see the [Rate Limits](/docs/topics/rate-limits#rate-limits) section. +The HTTP API implements a process for limiting and preventing excessive requests in accordance with [RFC 6585](https://tools.ietf.org/html/rfc6585#section-4). API users that regularly hit and ignore rate limits will have their API keys revoked, and be blocked from the platform. For more information on rate limiting of requests, please see the [Rate Limits](/developers/docs/topics/rate-limits) section. ### Boolean Query Strings @@ -251,41 +258,38 @@ Certain endpoints in the API are documented to accept booleans for their query s ## Gateway (WebSocket) API -Discord's Gateway API is used for maintaining persistent, stateful websocket connections between your client and our servers. These connections are used for sending and receiving real-time events your client can use to track and update local state. The Gateway API uses secure websocket connections as specified in [RFC 6455](https://tools.ietf.org/html/rfc6455). For information on opening Gateway connections, please see the [Gateway API](/docs/events/gateway#connections) section. +Discord's Gateway API is used for maintaining persistent, stateful websocket connections between your client and our servers. These connections are used for sending and receiving real-time events your client can use to track and update local state. The Gateway API uses secure websocket connections as specified in [RFC 6455](https://tools.ietf.org/html/rfc6455). For information on opening Gateway connections, please see the [Gateway API](/developers/docs/events/gateway#connections) section. ## Message Formatting Discord utilizes a subset of markdown for rendering message content on its clients, while also adding some custom functionality to enable things like mentioning users and channels. This functionality uses the following formats: -###### Formats - -| Type | Structure | Example | -|--------------------------------|-----------------------|---------------------------------| -| User | `<@USER_ID>` | `<@80351110224678912>` | -| User \* | `<@!USER_ID>` | `<@!80351110224678912>` | -| Channel | `<#CHANNEL_ID>` | `<#103735883630395392>` | -| Role | `<@&ROLE_ID>` | `<@&165511591545143296>` | -| Slash Command \*\* | `` | `` | -| Standard Emoji | Unicode Characters | 🦶 | -| Custom Emoji | `<:NAME:ID>` | `<:mmLol:216154654256398347>` | -| Custom Emoji (Animated) | `` | `` | -| Unix Timestamp \*\*\* | `` | `` | -| Unix Timestamp (Styled) \*\*\* | `` | `` | -| Guild Navigation | `` | `` | -| Email \*\*\*\* | `` | `` | -| Phone Number \*\*\*\* | `<+PHONE_NUMBER>` | `<+1 (555) 123 4567>` | - -Using the markdown for either users, roles, or channels will usually mention the target(s) accordingly, but this can be suppressed using the [`allowed_mentions`](/docs/resources/message#message-object) parameter (when creating a message). Standard emoji are currently rendered using [Twemoji](https://github.com/jdecked/twemoji) for Desktop/Android and Apple's native emoji on iOS. + +**Formats** -\* User mentions with an exclamation mark are deprecated and should be handled like any other user mention. +| Type | Structure | Example | +|-------------------------|-----------------------|---------------------------------| +| User | `<@USER_ID>` | `<@80351110224678912>` | +| User \* | `<@!USER_ID>` | `<@!80351110224678912>` | +| Channel | `<#CHANNEL_ID>` | `<#103735883630395392>` | +| Role | `<@&ROLE_ID>` | `<@&165511591545143296>` | +| Slash Command \*\* | `` | `` | +| Standard Emoji | Unicode Characters | 🦶 | +| Custom Emoji | `<:NAME:ID>` | `<:mmLol:216154654256398347>` | +| Custom Emoji (Animated) | `` | `` | +| Unix Timestamp | `` | `` | +| Unix Timestamp (Styled) | `` | `` | +| Guild Navigation | `` | `` | -\*\* Subcommands and subcommand groups can also be mentioned by using respectively `` and ``. +Using the markdown for either users, roles, or channels will usually mention the target(s) accordingly, but this can be suppressed using the `allowed_mentions` parameter when creating a message. Standard emoji are currently rendered using [Twemoji](https://github.com/jdecked/twemoji) for Desktop/Android and Apple's native emoji on iOS. + +Timestamps are expressed in seconds and display the given timestamp in the user's timezone and locale. -\*\*\* Timestamps are expressed in seconds and display the given timestamp in the user's timezone and locale. +\* User mentions with an exclamation mark are deprecated and should be handled like any other user mention. -\*\*\*\* Email and phone number markdown uses `mailto:` and `tel:` URI schemes respectively that can optionally be prefixed (e.g. ``). Email markdown supports headers, values must be [URL Encoded](https://en.wikipedia.org/wiki/Percent-encoding) (e.g. ``). +\*\* Subcommands and subcommand groups can also be mentioned by using respectively `` and ``. -###### Timestamp Styles +**Timestamp Styles** | Style | Example Output | Description | |-------|----------------------------------|-------------------------| @@ -299,31 +303,32 @@ Using the markdown for either users, roles, or channels will usually mention the | S | 20/04/2021, 16:20:30 | Short Date, Medium Time | | R | 2 months ago | Relative Time | -\* Default style used when no style is specified. +\*default -###### Guild Navigation Types +**Guild Navigation Types** Guild navigation types link to the corresponding resource in the current server. -| Type | Description | -|----------------------|-------------------------------------------------------------------------------------------------------| -| customize | _Customize_ tab with the server's [onboarding prompts](/docs/resources/guild#guild-onboarding-object) | -| browse | _Browse Channels_ tab | -| guide | [Server Guide](https://support.discord.com/hc/en-us/articles/13497665141655) | -| linked-roles | [Linked Roles](https://support.discord.com/hc/en-us/articles/10388356626711) | -| linked-roles:ROLE_ID | _Linked Role_ connection | +| Type | Description | +|--------------|----------------------------------------------------------------------------------------------------------------| +| customize | Customize tab with the server's [onboarding prompts](/developers/docs/resources/guild#guild-onboarding-object) | +| browse | Browse Channels tab | +| guide | [Server Guide](https://support.discord.com/hc/en-us/articles/13497665141655) | +| linked-roles | [Linked Roles](https://support.discord.com/hc/en-us/articles/10388356626711) | +| linked-roles | Linked Role connection | ## Image Formatting -###### Image Base Url +**Image Base Url** -``` +```bash https://cdn.discordapp.com/ ``` -Discord uses ids and hashes to render images in the client. These hashes can be retrieved through various API requests, like [Get User](/docs/resources/user#get-user). Below are the formats, size limitations, and CDN endpoints for images in Discord. The returned format can be changed by changing the [extension name](/docs/reference#image-formatting-image-formats) at the end of the URL. The returned size can be changed by appending a querystring of `?size=desired_size` to the URL. Image size can be any power of two between 16 and 4096. +Discord uses ids and hashes to render images in the client. These hashes can be retrieved through various API requests, like [Get User](/developers/docs/resources/user#get-user). Below are the formats, size limitations, and CDN endpoints for images in Discord. The returned format can be changed by changing the [extension name](/developers/docs/reference#image-formatting-image-formats) at the end of the URL. The returned size can be changed by appending a querystring of `?size=desired_size` to the URL. Image size can be any power of two between 16 and 4096. -###### Image Formats + + **Image Formats** | Name | Extension | |--------|-------------| @@ -331,49 +336,48 @@ Discord uses ids and hashes to render images in the client. These hashes can be | PNG | .png | | WebP | .webp | | GIF | .gif | -| AVIF | .avif | | Lottie | .json | -###### CDN Endpoints - -| Type | Path | Supports | -|-----------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|----------------------------| -| Custom Emoji | emojis/[emoji_id](/docs/resources/emoji#emoji-object).png \*\*\*\*\* | PNG, JPEG, WebP, GIF, AVIF | -| Guild Icon | icons/[guild_id](/docs/resources/guild#guild-object)/[guild_icon](/docs/resources/guild#guild-object).png \* | PNG, JPEG, WebP, GIF | -| Guild Splash | splashes/[guild_id](/docs/resources/guild#guild-object)/[guild_splash](/docs/resources/guild#guild-object).png | PNG, JPEG, WebP | -| Guild Discovery Splash | discovery-splashes/[guild_id](/docs/resources/guild#guild-object)/[guild_discovery_splash](/docs/resources/guild#guild-object).png | PNG, JPEG, WebP | -| Guild Banner | banners/[guild_id](/docs/resources/guild#guild-object)/[guild_banner](/docs/resources/guild#guild-object).png \* | PNG, JPEG, WebP, GIF | -| User Banner | banners/[user_id](/docs/resources/user#user-object)/[user_banner](/docs/resources/user#user-object).png \* | PNG, JPEG, WebP, GIF | -| Default User Avatar | embed/avatars/[index](/docs/resources/user#user-object).png \*\* \*\*\* | PNG | -| User Avatar | avatars/[user_id](/docs/resources/user#user-object)/[user_avatar](/docs/resources/user#user-object).png \* | PNG, JPEG, WebP, GIF | -| Guild Member Avatar | guilds/[guild_id](/docs/resources/guild#guild-object)/users/[user_id](/docs/resources/user#user-object)/avatars/[member_avatar](/docs/resources/guild#guild-member-object).png \* | PNG, JPEG, WebP, GIF | -| Avatar Decoration | avatar-decoration-presets/[avatar_decoration_data_asset](/docs/resources/user#avatar-decoration-data-object).png | PNG | -| Application Icon | app-icons/[application_id](/docs/resources/application#application-object)/[icon](/docs/resources/application#application-object).png | PNG, JPEG, WebP | -| Application Cover | app-icons/[application_id](/docs/resources/application#application-object)/[cover_image](/docs/resources/application#application-object).png | PNG, JPEG, WebP | -| Application Asset | app-assets/[application_id](/docs/resources/application#application-object)/[asset_id](/docs/events/gateway-events#activity-object-activity-assets).png | PNG, JPEG, WebP | -| Achievement Icon | app-assets/[application_id](/docs/resources/application#application-object)/achievements/[achievement_id](https://github.com/discord/discord-api-docs/blob/legacy-gamesdk/docs/game_sdk/Achievements.md#user-achievement-struct)/icons/[icon_hash](https://github.com/discord/discord-api-docs/blob/legacy-gamesdk/docs/game_sdk/Achievements.md#user-achievement-struct).png | PNG, JPEG, WebP | -| Store Page Asset | app-assets/[application_id](/docs/resources/application#application-object)/store/asset_id | PNG, JPEG, WebP | -| Sticker Pack Banner | app-assets/710982414301790216/store/[sticker_pack_banner_asset_id](/docs/resources/sticker#sticker-pack-object).png | PNG, JPEG, WebP | -| Team Icon | team-icons/[team_id](/docs/topics/teams#data-models-team-object)/[team_icon](/docs/topics/teams#data-models-team-object).png | PNG, JPEG, WebP | -| Sticker | stickers/[sticker_id](/docs/resources/sticker#sticker-object).png \*\*\* \*\*\*\* | PNG, Lottie, GIF | -| Role Icon | role-icons/[role_id](/docs/topics/permissions#role-object)/[role_icon](/docs/topics/permissions#role-object).png | PNG, JPEG, WebP | -| Guild Scheduled Event Cover | guild-events/[scheduled_event_id](/docs/resources/guild-scheduled-event#guild-scheduled-event-object)/[scheduled_event_cover_image](/docs/resources/guild-scheduled-event#guild-scheduled-event-object).png | PNG, JPEG, WebP | -| Guild Member Banner | guilds/[guild_id](/docs/resources/guild#guild-object)/users/[user_id](/docs/resources/user#user-object)/banners/[member_banner](/docs/resources/guild#guild-member-object).png \* | PNG, JPEG, WebP, GIF | -| Guild Tag Badge | guild-tag-badges/[guild_id](/docs/resources/guild#guild-object)/[badge_hash](/docs/resources/user#user-object-user-primary-guild).png | PNG, JPEG, WebP | - -\* In the case of endpoints that support GIFs, the hash will begin with `a_` if it is available in GIF format. These images can also be retrieved as animated WebP using the `?animated=true` querystring parameter. (example: `a_1269e74af4df7417b13759eae50c83dc`) - -\*\* In the case of the Default User Avatar endpoint, the value for `index` depends on whether the user is [migrated to the new username system](/docs/change-log#unique-usernames-on-discord). For users on the new username system, `index` will be `(user_id >> 22) % 6`. For users on the *legacy* username system, `index` will be `discriminator % 5`. + +**CDN Endpoints** + +| Type | Path | Supports | +|-----------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|----------------------| +| Custom Emoji | emojis/[emoji\_id](/developers/docs/resources/emoji#emoji-object).png | PNG, JPEG, WebP, GIF | +| Guild Icon | icons/[guild\_id](/developers/docs/resources/guild#guild-object)/[guild\_icon](/developers/docs/resources/guild#guild-object).png \* | PNG, JPEG, WebP, GIF | +| Guild Splash | splashes/[guild\_id](/developers/docs/resources/guild#guild-object)/[guild\_splash](/developers/docs/resources/guild#guild-object).png | PNG, JPEG, WebP | +| Guild Discovery Splash | discovery-splashes/[guild\_id](/developers/docs/resources/guild#guild-object)/[guild\_discovery\_splash](/developers/docs/resources/guild#guild-object).png | PNG, JPEG, WebP | +| Guild Banner | banners/[guild\_id](/developers/docs/resources/guild#guild-object)/[guild\_banner](/developers/docs/resources/guild#guild-object).png \* | PNG, JPEG, WebP, GIF | +| User Banner | banners/[user\_id](/developers/docs/resources/user#user-object)/[user\_banner](/developers/docs/resources/user#user-object).png \* | PNG, JPEG, WebP, GIF | +| Default User Avatar | embed/avatars/[index](/developers/docs/resources/user#user-object).png \*\* \*\*\* | PNG | +| User Avatar | avatars/[user\_id](/developers/docs/resources/user#user-object)/[user\_avatar](/developers/docs/resources/user#user-object).png \* | PNG, JPEG, WebP, GIF | +| Guild Member Avatar | guilds/[guild\_id](/developers/docs/resources/guild#guild-object)/users/[user\_id](/developers/docs/resources/user#user-object)/avatars/[member\_avatar](/developers/docs/resources/guild#guild-member-object).png \* | PNG, JPEG, WebP, GIF | +| Avatar Decoration | avatar-decoration-presets/[avatar\_decoration\_data\_asset](/developers/docs/resources/user#avatar-decoration-data-object).png | PNG | +| Application Icon | app-icons/[application\_id](/developers/docs/resources/application#application-object)/[icon](/developers/docs/resources/application#application-object).png | PNG, JPEG, WebP | +| Application Cover | app-icons/[application\_id](/developers/docs/resources/application#application-object)/[cover\_image](/developers/docs/resources/application#application-object).png | PNG, JPEG, WebP | +| Application Asset | app-assets/[application\_id](/developers/docs/resources/application#application-object)/[asset\_id](/developers/docs/events/gateway-events#activity-object-activity-assets).png | PNG, JPEG, WebP | +| Achievement Icon | app-assets/[application\_id](/developers/docs/resources/application#application-object)/achievements/[achievement\_id](https://github.com/discord/discord-api-docs/blob/legacy-gamesdk/developers/docs/game_sdk/Achievements.md#user-achievement-struct)/icons/[icon\_hash](https://github.com/discord/discord-api-docs/blob/legacy-gamesdk/developers/docs/game_sdk/Achievements.md#user-achievement-struct).png | PNG, JPEG, WebP | +| Store Page Asset | app-assets/[application\_id](/developers/docs/resources/application#application-object)/store/asset\_id | PNG, JPEG, WebP | +| Sticker Pack Banner | app-assets/710982414301790216/store/[sticker\_pack\_banner\_asset\_id](/developers/docs/resources/sticker#sticker-pack-object).png | PNG, JPEG, WebP | +| Team Icon | team-icons/[team\_id](/developers/docs/topics/teams#data-models-team-object)/[team\_icon](/developers/docs/topics/teams#data-models-team-object).png | PNG, JPEG, WebP | +| Sticker | stickers/[sticker\_id](/developers/docs/resources/sticker#sticker-object).png \*\*\* \*\*\*\* | PNG, Lottie, GIF | +| Role Icon | role-icons/[role\_id](/developers/docs/topics/permissions#role-object)/[role\_icon](/developers/docs/topics/permissions#role-object).png | PNG, JPEG, WebP | +| Guild Scheduled Event Cover | guild-events/[scheduled\_event\_id](/developers/docs/resources/guild-scheduled-event#guild-scheduled-event-object)/[scheduled\_event\_cover\_image](/developers/docs/resources/guild-scheduled-event#guild-scheduled-event-object).png | PNG, JPEG, WebP | +| Guild Member Banner | guilds/[guild\_id](/developers/docs/resources/guild#guild-object)/users/[user\_id](/developers/docs/resources/user#user-object)/banners/[member\_banner](/developers/docs/resources/guild#guild-member-object).png \* | PNG, JPEG, WebP, GIF | + +\* In the case of endpoints that support GIFs, the hash will begin with `a_` if it is available in GIF format. (example: `a_1269e74af4df7417b13759eae50c83dc`) + +\*\* In the case of the Default User Avatar endpoint, the value for `index` depends on whether the user is [migrated to the new username system](/developers/docs/change-log#unique-usernames-on-discord). For users on the new username system, `index` will be `(user_id >> 22) % 6`. For users on the legacy username system, `index` will be `discriminator % 5`. \*\*\* In the case of the Default User Avatar and Sticker endpoints, the size of images returned is constant with the "size" querystring parameter being ignored. -\*\*\*\* In the case of the Sticker endpoint, the sticker will be available as PNG if its [`format_type`](/docs/resources/sticker#sticker-object) is `PNG` or `APNG`, GIF if its `format_type` is `GIF`, and as [Lottie](https://airbnb.io/lottie/#/) if its `format_type` is `LOTTIE`. +\*\*\*\* In the case of the Sticker endpoint, the sticker will be available as PNG if its [`format_type`](/developers/docs/resources/sticker#sticker-object) is `PNG` or `APNG`, GIF if its `format_type` is `GIF`, and as [Lottie](https://airbnb.io/lottie/#/) if its `format_type` is `LOTTIE`. -\*\*\*\*\* For Custom Emoji, we highly recommend requesting emojis as WebP for maximum performance and compatibility. Emojis can be uploaded as JPEG, PNG, GIF, WebP, and AVIF formats. WebP and AVIF formats must be requested as WebP since they don't convert well to other formats. The Discord client uses WebP for all emojis displayed in-app. See the [Emoji Resource](/docs/resources/emoji) page for more details. +\*\*\*\*\* For Custom Emoji, we highly recommend requesting emojis as WebP for maximum performance and compatibility. Emojis can be uploaded as JPEG, PNG, GIF, WebP, and AVIF formats. WebP and AVIF formats must be requested as WebP since they don't convert well to other formats. The Discord client uses WebP for all emojis displayed in-app. See the [Emoji Resource](/developers/docs/resources/emoji) page for more details. -:::info + Sticker GIFs do not use the CDN base url, and can be accessed at `https://media.discordapp.net/stickers/.gif`. -::: + ## Image Data @@ -385,13 +389,13 @@ data:image/jpeg;base64,BASE64_ENCODED_JPEG_IMAGE_DATA Ensure you use the proper content type (`image/jpeg`, `image/png`, `image/gif`) that matches the image data being provided. -### Signed Attachment CDN URLs +### **Signed Attachment CDN URLs** -Attachments uploaded to Discord's CDN (like user and bot-uploaded images) have signed URLs with a preset expiry time. Discord automatically refreshes attachment CDN URLs that appear within the client, so when your app receives a payload with a signed URL (like when you [fetch a message](/docs/resources/message#get-channel-message)), it will be valid. +Attachments uploaded to Discord's CDN (like user and bot-uploaded images) have signed URLs with a preset expiry time. Discord automatically refreshes attachment CDN URLs that appear within the client, so when your app receives a payload with a signed URL (like when you [fetch a message](/developers/docs/resources/message#get-channel-message)), it will be valid. -When passing CDN URLs into API fields, like [`url` in an embed image object](/docs/resources/message#embed-object-embed-image-structure) and [`avatar_url` for webhooks](/docs/resources/webhook#execute-webhook-jsonform-params), your app can pass the CDN URL without any parameters as the value and Discord will automatically render and refresh the URL. +When passing CDN URLs into API fields, like [`url` in an embed image object](/developers/docs/resources/message#embed-object-embed-image-structure) and [`avatar_url` for webhooks](/developers/docs/resources/webhook#execute-webhook-jsonform-params), your app can pass the CDN URL without any parameters as the value and Discord will automatically render and refresh the URL. -The [standard CDN endpoints](/docs/reference#image-formatting-cdn-endpoints) listed above are not signed, so they will not expire. +The [standard CDN endpoints](/developers/docs/reference#image-formatting-cdn-endpoints) listed above are not signed, so they will not expire. ###### Example Attachment CDN URL @@ -409,27 +413,27 @@ https://cdn.discordapp.com/attachments/1012345678900020080/1234567891233211234/m ## Uploading Files -:::info -The file upload size limit applies to each file in a request. The default limit is `10 MiB` for all users, but may be higher for users depending on their [Nitro](https://support.discord.com/hc/en-us/articles/115000435108-What-are-Nitro-Nitro-Basic) status or by the server's [Boost Tier](https://support.discord.com/hc/en-us/articles/360028038352-Server-Boosting-FAQ-#h_419c3bd5-addd-4989-b7cf-c7957ef92583). The `attachment_size_limit` value provided [when working with interactions](/docs/interactions/receiving-and-responding#interaction-object-interaction-structure) is calculated as the maximum of these values. -::: + +The file upload size limit applies to each file in a request. The default limit is `10 MiB` for all users, but may be higher for users depending on their [Nitro](https://support.discord.com/hc/en-us/articles/115000435108-What-are-Nitro-Nitro-Basic) status or by the server's [Boost Tier](https://support.discord.com/hc/en-us/articles/360028038352-Server-Boosting-FAQ-#h_419c3bd5-addd-4989-b7cf-c7957ef92583). The `attachment_size_limit` value provided [when working with interactions](/developers/docs/interactions/receiving-and-responding#interaction-object-interaction-structure) is calculated as the maximum of these values. + Some endpoints support file attachments, indicated by the `files[n]` parameter. To add file(s), the standard `application/json` body must be replaced by a `multipart/form-data` body. The JSON message body can optionally be provided using the `payload_json` parameter. -All `files[n]` parameters must include a valid `Content-Disposition` subpart header with a `filename` and unique `name` parameter. Each file parameter must be uniquely named in the format `files[n]` such as `files[0]`, `files[1]`, or `files[42]`. The suffixed index `n` is the *snowflake placeholder* that can be used in the `attachments` field, which can be passed to the `payload_json` parameter (or [Callback Data Payloads](/docs/interactions/receiving-and-responding#interaction-response-object-interaction-callback-data-structure)). +All `files[n]` parameters must include a valid `Content-Disposition` subpart header with a `filename` and unique `name` parameter. Each file parameter must be uniquely named in the format `files[n]` such as `files[0]`, `files[1]`, or `files[42]`. The suffixed index `n` is the snowflake placeholder that can be used in the `attachments` field, which can be passed to the `payload_json` parameter (or [Callback Data Payloads](/developers/docs/interactions/receiving-and-responding#interaction-response-object-interaction-callback-data-structure)). -Images can also be referenced in embeds using the `attachment://filename` URL. The `filename` for these URLs must be ASCII alphanumeric with underscores, dashes, or dots. An example payload is provided below. +Images can also be referenced in embeds using the `attachment://filename` URL. An example payload is provided below. ### Editing Message Attachments The `attachments` JSON parameter includes all files that will be appended to the message, including new files and their respective snowflake placeholders (referenced above). When making a `PATCH` request, only files listed in the `attachments` parameter will be appended to the message. Any previously-added files that aren't included will be removed. -###### Example Request Bodies (multipart/form-data) +**Example Request Bodies (multipart/form-data)** Note that these examples are small sections of an HTTP request to demonstrate behavior of this endpoint - client libraries will set their own form boundaries (`boundary` is just an example). For more information, refer to the [multipart/form-data spec](https://tools.ietf.org/html/rfc7578#section-4). -This example demonstrates usage of the endpoint *without* `payload_json`. +This example demonstrates usage of the endpoint without `payload_json`. -``` +```bash --boundary Content-Disposition: form-data; name="content" @@ -441,9 +445,9 @@ true --boundary-- ``` -This example demonstrates usage of the endpoint *with* `payload_json` and all content fields (`content`, `embeds`, `files[n]`) set. +This example demonstrates usage of the endpoint with `payload_json` and all content fields (`content`, `embeds`, `files[n]`) set. -``` +```bash --boundary Content-Disposition: form-data; name="payload_json" Content-Type: application/json @@ -486,19 +490,19 @@ Content-Type: image/gif --boundary-- ``` -###### Using Attachments within Embeds +**Using Attachments within Embeds** You can upload attachments when creating a message and use those attachments within your embed. To do this, you will want to upload files as part of your `multipart/form-data` body. Make sure that you're uploading files which contain a filename, as you will need to reference it in your payload. -:::warn -Only `.jpg`, `.jpeg`, `.png`, `.webp`, and `.gif` may be used at this time. Other file types are not supported. -::: + + Only `.jpg`, `.jpeg`, `.png`, `.webp`, and `.gif` may be used at this time. Other file types are not supported. + Within an embed object, you can set an image to use an attachment as its URL with the attachment scheme syntax: `attachment://filename.png` For example: -```json +```bash { "embeds": [{ "image": { diff --git a/docs/resources/application-role-connection-metadata.mdx b/discord/developers/docs/resources/application-role-connection-metadata.mdx similarity index 58% rename from docs/resources/application-role-connection-metadata.mdx rename to discord/developers/docs/resources/application-role-connection-metadata.mdx index 9ca88f9806..4b38be6151 100644 --- a/docs/resources/application-role-connection-metadata.mdx +++ b/discord/developers/docs/resources/application-role-connection-metadata.mdx @@ -1,26 +1,35 @@ -# Application Role Connection Metadata +--- +title: Application Role Connection Metadata +description: Complete reference for application role connection metadata objects. +--- -A representation of role connection metadata for an [application](/docs/resources/application). +import {ManualAnchor} from '/snippets/manualanchor.jsx' -When a guild has added a bot and that bot has configured its [`role_connections_verification_url`](/docs/resources/application#application-object) (in the developer portal), the application will render as a potential verification method in the guild's role verification configuration. +import {Route} from '/snippets/route.jsx' + +A representation of role connection metadata for an [application](/developers/docs/resources/application). + +When a guild has added a bot and that bot has configured its [`role_connections_verification_url`](/developers/docs/resources/application#application-object) (in the developer portal), the application will render as a potential verification method in the guild's role verification configuration. If an application has configured role connection metadata, its metadata will appear in the role verification configuration when the application has been added as a verification method to the role. -When a user connects their account using the bot's [`role_connections_verification_url`](/docs/resources/application#application-object), the bot will [update a user's role connection with metadata](/docs/resources/user#update-current-user-application-role-connection) using the OAuth2 `role_connections.write` scope. +When a user connects their account using the bot's [`role_connections_verification_url`](/developers/docs/resources/application#application-object), the bot will [update a user's role connection with metadata](/developers/docs/resources/user#update-current-user-application-role-connection) using the OAuth2 `role_connections.write` scope. ### Application Role Connection Metadata Object + ###### Application Role Connection Metadata Structure -| Field | Type | Description | -|----------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------| -| type | [ApplicationRoleConnectionMetadataType](/docs/resources/application-role-connection-metadata#application-role-connection-metadata-object-application-role-connection-metadata-type) | type of metadata value | -| key | string | dictionary key for the metadata field (must be `a-z`, `0-9`, or `_` characters; 1-50 characters) | -| name | string | name of the metadata field (1-100 characters) | -| name_localizations? | dictionary with keys in [available locales](/docs/reference#locales) | translations of the name | -| description | string | description of the metadata field (1-200 characters) | -| description_localizations? | dictionary with keys in [available locales](/docs/reference#locales) | translations of the description | +| Field | Type | Description | +|----------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------| +| type | [ApplicationRoleConnectionMetadataType](/developers/docs/resources/application-role-connection-metadata#application-role-connection-metadata-object-application-role-connection-metadata-type) | type of metadata value | +| key | string | dictionary key for the metadata field (must be `a-z`, `0-9`, or `_` characters; 1-50 characters) | +| name | string | name of the metadata field (1-100 characters) | +| name_localizations? | dictionary with keys in [available locales](/developers/docs/reference#locales) | translations of the name | +| description | string | description of the metadata field (1-200 characters) | +| description_localizations? | dictionary with keys in [available locales](/developers/docs/reference#locales) | translations of the description | + ###### Application Role Connection Metadata Type | Type | Value | Description | @@ -34,20 +43,20 @@ When a user connects their account using the bot's [`role_connections_verificati | BOOLEAN_EQUAL | 7 | the metadata value (`integer`) is equal to the guild's configured value (`integer`; `1`) | | BOOLEAN_NOT_EQUAL | 8 | the metadata value (`integer`) is not equal to the guild's configured value (`integer`; `1`) | -:::info + Each metadata type offers a comparison operation that allows guilds to configure role requirements based on metadata values stored by the bot. Bots specify a `metadata value` for each user and guilds specify the required `guild's configured value` within the guild role settings. -::: + ## Get Application Role Connection Metadata Records -/applications/[\{application.id\}](/docs/resources/application#application-object)/role-connections/metadata +/applications/[\{application.id\}](/developers/docs/resources/application#application-object)/role-connections/metadata -Returns a list of [application role connection metadata](/docs/resources/application-role-connection-metadata#application-role-connection-metadata-object) objects for the given application. +Returns a list of [application role connection metadata](/developers/docs/resources/application-role-connection-metadata#application-role-connection-metadata-object) objects for the given application. ## Update Application Role Connection Metadata Records -/applications/[\{application.id\}](/docs/resources/application#application-object)/role-connections/metadata +/applications/[\{application.id\}](/developers/docs/resources/application#application-object)/role-connections/metadata -Updates and returns a list of [application role connection metadata](/docs/resources/application-role-connection-metadata#application-role-connection-metadata-object) objects for the given application. +Updates and returns a list of [application role connection metadata](/developers/docs/resources/application-role-connection-metadata#application-role-connection-metadata-object) objects for the given application. -:::info + An application can have a maximum of 5 metadata records. -::: + diff --git a/docs/resources/application.mdx b/discord/developers/docs/resources/application.mdx similarity index 52% rename from docs/resources/application.mdx rename to discord/developers/docs/resources/application.mdx index 4183331011..84e7d25803 100644 --- a/docs/resources/application.mdx +++ b/discord/developers/docs/resources/application.mdx @@ -1,50 +1,55 @@ --- -sidebar_label: Application +title: Application Resource +sidebarTitle: Application +description: Reference for Discord application objects and management endpoints. --- -# Application Resource +import {ManualAnchor} from '/snippets/manualanchor.jsx' +import {Route} from '/snippets/route.jsx' -[Applications](/docs/quick-start/overview-of-apps) (or "apps") are containers for developer platform features, and can be installed to Discord servers and/or user accounts. +[Applications](/developers/docs/quick-start/overview-of-apps) (or "apps") are containers for developer platform features, and can be installed to Discord servers and/or user accounts. ### Application Object + ###### Application Structure -| Field | Type | Description | -|---------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| -| id | snowflake | ID of the app | -| name | string | Name of the app | -| icon | ?string | [Icon hash](/docs/reference#image-formatting) of the app | -| description | string | Description of the app | -| rpc_origins? | array of strings | List of RPC origin URLs, if RPC is enabled | -| bot_public | boolean | When `false`, only the app owner can add the app to guilds | -| bot_require_code_grant | boolean | When `true`, the app's bot will only join upon completion of the full OAuth2 code grant flow | -| bot? | partial [user](/docs/resources/user#user-object) object | Partial user object for the bot user associated with the app | -| terms_of_service_url? | string | URL of the app's Terms of Service | -| privacy_policy_url? | string | URL of the app's Privacy Policy | -| owner? | partial [user](/docs/resources/user#user-object) object | Partial user object for the owner of the app | -| verify_key | string | Hex encoded key for verification in interactions and the GameSDK's [GetTicket](https://github.com/discord/discord-api-docs/blob/legacy-gamesdk/docs/game_sdk/Applications.md#getticket) | -| team | ?[team](/docs/topics/teams#data-models-team-object) object | If the app belongs to a team, this will be a list of the members of that team | -| guild_id? | snowflake | Guild associated with the app. For example, a developer support server. | -| guild? | partial [guild](/docs/resources/guild#guild-object) object | Partial object of the associated guild | -| primary_sku_id? | snowflake | If this app is a game sold on Discord, this field will be the id of the "Game SKU" that is created, if exists | -| slug? | string | If this app is a game sold on Discord, this field will be the URL slug that links to the store page | -| cover_image? | string | App's default rich presence invite [cover image hash](/docs/reference#image-formatting) | -| flags? | integer | App's public [flags](/docs/resources/application#application-object-application-flags) | -| approximate_guild_count? | integer | Approximate count of guilds the app has been added to | -| approximate_user_install_count? | integer | Approximate count of users that have installed the app (authorized with `application.commands` as a scope) | -| approximate_user_authorization_count? | integer | Approximate count of users that have OAuth2 authorizations for the app | -| redirect_uris? | array of strings | Array of redirect URIs for the app | -| interactions_endpoint_url? | ?string | [Interactions endpoint URL](/docs/interactions/receiving-and-responding#receiving-an-interaction) for the app | -| role_connections_verification_url? | ?string | Role connection verification URL for the app | -| event_webhooks_url? | ?string | [Event webhooks URL](/docs/events/webhook-events#preparing-for-events) for the app to receive webhook events | -| event_webhooks_status | [application event webhook status](/docs/resources/application#application-object-application-event-webhook-status) | If [webhook events](/docs/events/webhook-events) are enabled for the app. `1` (default) means disabled, `2` means enabled, and `3` means disabled by Discord | -| event_webhooks_types? | array of strings | List of [Webhook event types](/docs/events/webhook-events#event-types) the app subscribes to | -| tags? | array of strings | List of tags describing the content and functionality of the app. Max of 5 tags. | -| install_params? | [install params](/docs/resources/application#install-params-object) object | Settings for the app's default in-app authorization link, if enabled | -| integration_types_config? | dictionary with keys of [application integration types](/docs/resources/application#application-object-application-integration-types) | Default scopes and permissions for each supported installation context. Value for each key is an [integration type configuration object](/docs/resources/application#application-object-application-integration-type-configuration-object) | -| custom_install_url? | string | Default custom authorization URL for the app, if enabled | - +| Field | Type | Description | +|---------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| id | snowflake | ID of the app | +| name | string | Name of the app | +| icon | ?string | [Icon hash](/developers/docs/reference#image-formatting) of the app | +| description | string | Description of the app | +| rpc_origins? | array of strings | List of RPC origin URLs, if RPC is enabled | +| bot_public | boolean | When `false`, only the app owner can add the app to guilds | +| bot_require_code_grant | boolean | When `true`, the app's bot will only join upon completion of the full OAuth2 code grant flow | +| bot? | partial [user](/developers/docs/resources/user#user-object) object | Partial user object for the bot user associated with the app | +| terms_of_service_url? | string | URL of the app's Terms of Service | +| privacy_policy_url? | string | URL of the app's Privacy Policy | +| owner? | partial [user](/developers/docs/resources/user#user-object) object | Partial user object for the owner of the app | +| verify_key | string | Hex encoded key for verification in interactions and the GameSDK's [GetTicket](https://github.com/discord/discord-api-docs/blob/legacy-gamesdk/developers/docs/game_sdk/Applications.md#getticket) | +| team | ?[team](/developers/docs/topics/teams#data-models-team-object) object | If the app belongs to a team, this will be a list of the members of that team | +| guild_id? | snowflake | Guild associated with the app. For example, a developer support server. | +| guild? | partial [guild](/developers/docs/resources/guild#guild-object) object | Partial object of the associated guild | +| primary_sku_id? | snowflake | If this app is a game sold on Discord, this field will be the id of the "Game SKU" that is created, if exists | +| slug? | string | If this app is a game sold on Discord, this field will be the URL slug that links to the store page | +| cover_image? | string | App's default rich presence invite [cover image hash](/developers/docs/reference#image-formatting) | +| flags? | integer | App's public [flags](/developers/docs/resources/application#application-object-application-flags) | +| approximate_guild_count? | integer | Approximate count of guilds the app has been added to | +| approximate_user_install_count? | integer | Approximate count of users that have installed the app (authorized with `application.commands` as a scope) | +| approximate_user_authorization_count? | integer | Approximate count of users that have OAuth2 authorizations for the app | +| redirect_uris? | array of strings | Array of redirect URIs for the app | +| interactions_endpoint_url? | ?string | [Interactions endpoint URL](/developers/docs/interactions/receiving-and-responding#receiving-an-interaction) for the app | +| role_connections_verification_url? | ?string | Role connection verification URL for the app | +| event_webhooks_url? | ?string | [Event webhooks URL](/developers/docs/events/webhook-events#preparing-for-events) for the app to receive webhook events | +| event_webhooks_status | [application event webhook status](/developers/docs/resources/application#application-object-application-event-webhook-status) | If [webhook events](/developers/docs/events/webhook-events) are enabled for the app. `1` (default) means disabled, `2` means enabled, and `3` means disabled by Discord | +| event_webhooks_types? | array of strings | List of [Webhook event types](/developers/docs/events/webhook-events#event-types) the app subscribes to | +| tags? | array of strings | List of tags describing the content and functionality of the app. Max of 5 tags. | +| install_params? | [install params](/developers/docs/resources/application#install-params-object) object | Settings for the app's default in-app authorization link, if enabled | +| integration_types_config? | dictionary with keys of [application integration types](/developers/docs/resources/application#application-object-application-integration-types) | Default scopes and permissions for each supported installation context. Value for each key is an [integration type configuration object](/developers/docs/resources/application#application-object-application-integration-type-configuration-object) | +| custom_install_url? | string | Default custom authorization URL for the app, if enabled | + + ###### Example Application Object ```json @@ -110,21 +115,23 @@ sidebar_label: Application } ``` + ###### Application Integration Types -Where an app can be installed, also called its supported [installation contexts](/docs/resources/application#installation-context). +Where an app can be installed, also called its supported [installation contexts](/developers/docs/resources/application#installation-context). | Type | ID | Description | |-----------------|----|-------------------------------| | `GUILD_INSTALL` | 0 | App is installable to servers | | `USER_INSTALL` | 1 | App is installable to users | + ###### Application Integration Type Configuration Object +| Field | Type | Description | +|------------------------|---------------------------------------------------------------------------------------|----------------------------------------------------------------------------------| +| oauth2_install_params? | [install params object](/developers/docs/resources/application#install-params-object) | Install params for each installation context's default in-app authorization link | -| Field | Type | Description | -|------------------------|----------------------------------------------------------------------------|----------------------------------------------------------------------------------| -| oauth2_install_params? | [install params object](/docs/resources/application#install-params-object) | Install params for each installation context's default in-app authorization link | - + ###### Application Event Webhook Status Status indicating whether event webhooks are enabled or disabled for an application. @@ -135,29 +142,31 @@ Status indicating whether event webhooks are enabled or disabled for an applicat | `ENABLED` | `2` | Webhook events are enabled by developer | | `DISABLED_BY_DISCORD` | `3` | Webhook events are disabled by Discord, usually due to inactivity | + ###### Application Flags -| Value | Name | Description | -|-----------|-----------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| -| `1 << 6` | APPLICATION_AUTO_MODERATION_RULE_CREATE_BADGE | Indicates if an app uses the [Auto Moderation API](/docs/resources/auto-moderation) | -| `1 << 12` | GATEWAY_PRESENCE | Intent required for bots in **100 or more servers** to receive [`presence_update` events](/docs/events/gateway-events#presence-update) | -| `1 << 13` | GATEWAY_PRESENCE_LIMITED | Intent required for bots in under 100 servers to receive [`presence_update` events](/docs/events/gateway-events#presence-update), found on the **Bot** page in your app's settings | -| `1 << 14` | GATEWAY_GUILD_MEMBERS | Intent required for bots in **100 or more servers** to receive member-related events like `guild_member_add`. See the list of member-related events [under `GUILD_MEMBERS`](/docs/events/gateway#list-of-intents) | -| `1 << 15` | GATEWAY_GUILD_MEMBERS_LIMITED | Intent required for bots in under 100 servers to receive member-related events like `guild_member_add`, found on the **Bot** page in your app's settings. See the list of member-related events [under `GUILD_MEMBERS`](/docs/events/gateway#list-of-intents) | -| `1 << 16` | VERIFICATION_PENDING_GUILD_LIMIT | Indicates unusual growth of an app that prevents verification | -| `1 << 17` | EMBEDDED | Indicates if an app is embedded within the Discord client (currently unavailable publicly) | -| `1 << 18` | GATEWAY_MESSAGE_CONTENT | Intent required for bots in **100 or more servers** to receive [message content](https://support-dev.discord.com/hc/en-us/articles/4404772028055) | -| `1 << 19` | GATEWAY_MESSAGE_CONTENT_LIMITED | Intent required for bots in under 100 servers to receive [message content](https://support-dev.discord.com/hc/en-us/articles/4404772028055), found on the **Bot** page in your app's settings | -| `1 << 23` | APPLICATION_COMMAND_BADGE | Indicates if an app has registered global [application commands](/docs/interactions/application-commands) | +| Value | Name | Description | +|-----------|-----------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| `1 << 6` | APPLICATION_AUTO_MODERATION_RULE_CREATE_BADGE | Indicates if an app uses the [Auto Moderation API](/developers/docs/resources/auto-moderation) | +| `1 << 12` | GATEWAY_PRESENCE | Intent required for bots in **100 or more servers** to receive [`presence_update` events](/developers/docs/events/gateway-events#presence-update) | +| `1 << 13` | GATEWAY_PRESENCE_LIMITED | Intent required for bots in under 100 servers to receive [`presence_update` events](/developers/docs/events/gateway-events#presence-update), found on the **Bot** page in your app's settings | +| `1 << 14` | GATEWAY_GUILD_MEMBERS | Intent required for bots in **100 or more servers** to receive member-related events like `guild_member_add`. See the list of member-related events [under `GUILD_MEMBERS`](/developers/docs/events/gateway#list-of-intents) | +| `1 << 15` | GATEWAY_GUILD_MEMBERS_LIMITED | Intent required for bots in under 100 servers to receive member-related events like `guild_member_add`, found on the **Bot** page in your app's settings. See the list of member-related events [under `GUILD_MEMBERS`](/developers/docs/events/gateway#list-of-intents) | +| `1 << 16` | VERIFICATION_PENDING_GUILD_LIMIT | Indicates unusual growth of an app that prevents verification | +| `1 << 17` | EMBEDDED | Indicates if an app is embedded within the Discord client (currently unavailable publicly) | +| `1 << 18` | GATEWAY_MESSAGE_CONTENT | Intent required for bots in **100 or more servers** to receive [message content](https://support-dev.discord.com/hc/en-us/articles/4404772028055) | +| `1 << 19` | GATEWAY_MESSAGE_CONTENT_LIMITED | Intent required for bots in under 100 servers to receive [message content](https://support-dev.discord.com/hc/en-us/articles/4404772028055), found on the **Bot** page in your app's settings | +| `1 << 23` | APPLICATION_COMMAND_BADGE | Indicates if an app has registered global [application commands](/developers/docs/interactions/application-commands) | ### Install Params Object + ###### Install Params Structure -| Field | Type | Description | -|-------------|------------------|--------------------------------------------------------------------------------------------------------| -| scopes | array of strings | [Scopes](/docs/topics/oauth2#shared-resources-oauth2-scopes) to add the application to the server with | -| permissions | string | [Permissions](/docs/topics/permissions) to request for the bot role | +| Field | Type | Description | +|-------------|------------------|-------------------------------------------------------------------------------------------------------------------| +| scopes | array of strings | [Scopes](/developers/docs/topics/oauth2#shared-resources-oauth2-scopes) to add the application to the server with | +| permissions | string | [Permissions](/developers/docs/topics/permissions) to request for the bot role | ## Installation Context @@ -167,15 +176,15 @@ The installation context affects how your app can be seen and used within Discor #### Server Context -Apps installed in a server context (server-installed apps) must be authorized by a server member with the [`MANAGE_GUILD`](/docs/topics/permissions#permissions-bitwise-permission-flags) permission. Server-installed apps are *visible* to all members of the server, but other factors (like [command permissions](/docs/interactions/application-commands#permissions)) determine where and when specific members can interact with the app. +Apps installed in a server context (server-installed apps) must be authorized by a server member with the [`MANAGE_GUILD`](/developers/docs/topics/permissions#permissions-bitwise-permission-flags) permission. Server-installed apps are *visible* to all members of the server, but other factors (like [command permissions](/developers/docs/interactions/application-commands#permissions)) determine where and when specific members can interact with the app. -During installation, server-installed apps are authorized with a specific set of [OAuth2 scopes](/docs/topics/oauth2#shared-resources-oauth2-scopes) and [bot user permissions](/docs/topics/permissions) that determine what resources and data the app can access in that server. +During installation, server-installed apps are authorized with a specific set of [OAuth2 scopes](/developers/docs/topics/oauth2#shared-resources-oauth2-scopes) and [bot user permissions](/developers/docs/topics/permissions) that determine what resources and data the app can access in that server. #### User Context Apps installed in a user context (user-installed apps) are visible *only* to the authorizing user, and therefore don't require any server-specific permissions. -Apps that support the user installation context are visible across all of an authorizing user's servers, DMs, and GDMs, but are forced to respect the user's permissions in the surface where the app is being used. For example, if a user invokes a command for a user-installed app from a server's channel where they don't have permission to send messages, the app won't be able to [respond to an interaction](/docs/interactions/receiving-and-responding#interaction-response-object-interaction-callback-type) with a non-ephemeral message. Details about how the installation context of a command affects interactions is in the [interaction context](/docs/interactions/application-commands#interaction-contexts) documentation. +Apps that support the user installation context are visible across all of an authorizing user's servers, DMs, and GDMs, but are forced to respect the user's permissions in the surface where the app is being used. For example, if a user invokes a command for a user-installed app from a server's channel where they don't have permission to send messages, the app won't be able to [respond to an interaction](/developers/docs/interactions/receiving-and-responding#interaction-response-object-interaction-callback-type) with a non-ephemeral message. Details about how the installation context of a command affects interactions is in the [interaction context](/developers/docs/interactions/application-commands#interaction-contexts) documentation. ### Setting Supported Installation Contexts @@ -183,9 +192,9 @@ By default, newly-created apps only support installation to guilds. You can update which installation contexts your app supports in your [app's settings](https://discord.com/developers/applications). On the **Installation** page under the **Installation Contexts** section, you can select the installation contexts your app supports. -:::info -If you update your app to support a new installation context, you will need to update your existing [commands](/docs/interactions/application-commands#contexts) if you want them to be supported in the new context. Details are in the [Application Command](/docs/interactions/application-commands#contexts) documentation. -::: + +If you update your app to support a new installation context, you will need to update your existing [commands](/developers/docs/interactions/application-commands#contexts) if you want them to be supported in the new context. Details are in the [Application Command](/developers/docs/interactions/application-commands#contexts) documentation. + ## Install Links @@ -195,13 +204,13 @@ Install links provide an easy way for users to install your app in Discord. If y There are three options when configuring an install link for your app: "Discord Provided Link", "Custom URL", and "None". If you don't configure an install link (by selecting "None"), the "Add App" button will not appear for your app, and your app will not be eligible for the App Directory. -:::info -Note that install links are distinct from OAuth2 flows like the [authorization code grant](/docs/topics/oauth2#authorization-code-grant), which may additionally be required if you need to request user-specific [scopes](/docs/topics/oauth2#shared-resources-oauth2-scopes) like `identify` or `role_connections.write`. -::: + +Note that install links are distinct from OAuth2 flows like the [authorization code grant](/developers/docs/topics/oauth2#authorization-code-grant), which may additionally be required if you need to request user-specific [scopes](/developers/docs/topics/oauth2#shared-resources-oauth2-scopes) like `identify` or `role_connections.write`. + #### Discord Provided Link -The default Discord Provided Link is a short link that guides users through the installation flow with your app's [configured installation contexts](/docs/resources/application#setting-supported-installation-contexts). If your app has both **User Install** and **Guild Install** enabled, the user can choose which way to install your app. +The default Discord Provided Link is a short link that guides users through the installation flow with your app's [configured installation contexts](/developers/docs/resources/application#setting-supported-installation-contexts). If your app has both **User Install** and **Guild Install** enabled, the user can choose which way to install your app. Discord Provided Links don't have scopes or bot user permissions defined in the URL. For example: @@ -211,15 +220,15 @@ https://discord.com/oauth2/authorize?client_id=1234567895647001626 Instead, these links will prompt the user for the scopes and bot user permissions configured in your Default Install Settings. -:::info + Discord Provided Links are limited to the `application.commands` and `bot` scopes -::: + #### Custom URL A Custom URL is an alternative to the Discord Provided Link that gives you more control of where users are directed when they click "Add App" on your app's profile or App Directory page. -A Custom URL doesn't have strict limitations, but is commonly an [OAuth2 `/authorize` URL](/docs/topics/oauth2#shared-resources-oauth2-urls) that has defined scopes, permissions, and an installation context (`integration_type`). +A Custom URL doesn't have strict limitations, but is commonly an [OAuth2 `/authorize` URL](/developers/docs/topics/oauth2#shared-resources-oauth2-urls) that has defined scopes, permissions, and an installation context (`integration_type`). ### Configuring an Install Link and Default Install Settings @@ -230,44 +239,46 @@ The Default Install Settings will appear on the **Installation** page when you h ## Get Current Application /applications/@me -Returns the [application](/docs/resources/application#application-object) object associated with the requesting bot user. +Returns the [application](/developers/docs/resources/application#application-object) object associated with the requesting bot user. ## Edit Current Application /applications/@me -Edit properties of the app associated with the requesting bot user. Only properties that are passed will be updated. Returns the updated [application](/docs/resources/application#application-object) object on success. +Edit properties of the app associated with the requesting bot user. Only properties that are passed will be updated. Returns the updated [application](/developers/docs/resources/application#application-object) object on success. -:::info + All parameters to this endpoint are optional -::: + + ###### JSON Params -| Field | Type | Description | -|-----------------------------------|---------------------------------------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| -| custom_install_url | string | Default custom authorization URL for the app, if enabled | -| description | string | Description of the app | -| role_connections_verification_url | string | Role connection verification URL for the app | -| install_params | [install params](/docs/resources/application#install-params-object) object | Settings for the app's default in-app authorization link, if enabled | -| integration_types_config | dictionary with keys of [application integration types](/docs/resources/application#application-object-application-integration-types) | Default scopes and permissions for each supported installation context. Value for each key is an [integration type configuration object](/docs/resources/application#application-object-application-integration-type-configuration-object) | -| flags \* | integer | App's public [flags](/docs/resources/application#application-object-application-flags) | -| icon | ?[image data](/docs/reference#image-data) | Icon for the app | -| cover_image | ?[image data](/docs/reference#image-data) | Default rich presence invite cover image for the app | -| interactions_endpoint_url \*\* | string | [Interactions endpoint URL](/docs/interactions/receiving-and-responding#receiving-an-interaction) for the app | -| tags | array of strings | List of tags describing the content and functionality of the app (max of 20 characters per tag). Max of 5 tags. | -| event_webhooks_url | string | [Event webhooks URL](/docs/events/webhook-events#preparing-for-events) for the app to receive webhook events | -| event_webhooks_status | [application event webhook status](/docs/resources/application#application-object-application-event-webhook-status) | If [webhook events](/docs/events/webhook-events) are enabled for the app. `1` to disable, and `2` to enable | -| event_webhooks_types | array of strings | List of [Webhook event types](/docs/events/webhook-events#event-types) to subscribe to | +| Field | Type | Description | +|-----------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| custom_install_url | string | Default custom authorization URL for the app, if enabled | +| description | string | Description of the app | +| role_connections_verification_url | string | Role connection verification URL for the app | +| install_params | [install params](/developers/docs/resources/application#install-params-object) object | Settings for the app's default in-app authorization link, if enabled | +| integration_types_config | dictionary with keys of [application integration types](/developers/docs/resources/application#application-object-application-integration-types) | Default scopes and permissions for each supported installation context. Value for each key is an [integration type configuration object](/developers/docs/resources/application#application-object-application-integration-type-configuration-object) | +| flags \* | integer | App's public [flags](/developers/docs/resources/application#application-object-application-flags) | +| icon | ?[image data](/developers/docs/reference#image-data) | Icon for the app | +| cover_image | ?[image data](/developers/docs/reference#image-data) | Default rich presence invite cover image for the app | +| interactions_endpoint_url \*\* | string | [Interactions endpoint URL](/developers/docs/interactions/receiving-and-responding#receiving-an-interaction) for the app | +| tags | array of strings | List of tags describing the content and functionality of the app (max of 20 characters per tag). Max of 5 tags. | +| event_webhooks_url | string | [Event webhooks URL](/developers/docs/events/webhook-events#preparing-for-events) for the app to receive webhook events | +| event_webhooks_status | [application event webhook status](/developers/docs/resources/application#application-object-application-event-webhook-status) | If [webhook events](/developers/docs/events/webhook-events) are enabled for the app. `1` to disable, and `2` to enable | +| event_webhooks_types | array of strings | List of [Webhook event types](/developers/docs/events/webhook-events#event-types) to subscribe to | \* Only limited intent flags (`GATEWAY_PRESENCE_LIMITED`, `GATEWAY_GUILD_MEMBERS_LIMITED`, and `GATEWAY_MESSAGE_CONTENT_LIMITED`) can be updated via the API. -\*\* To update an Interactions endpoint URL via the API, the URL must be valid according to the [Receiving an Interaction](/docs/interactions/receiving-and-responding#receiving-an-interaction) documentation. +\*\* To update an Interactions endpoint URL via the API, the URL must be valid according to the [Receiving an Interaction](/developers/docs/interactions/receiving-and-responding#receiving-an-interaction) documentation. ## Get Application Activity Instance -/applications/[\{application.id\}](/docs/resources/application#application-object)/activity-instances/[\{instance_id\}](/docs/resources/application#get-application-activity-instance-activity-instance-object) +/applications/[\{application.id\}](/developers/docs/resources/application#application-object)/activity-instances/[\{instance_id\}](/developers/docs/resources/application#get-application-activity-instance-activity-instance-object) -Returns a serialized activity instance, if it exists. Useful for [preventing unwanted activity sessions](/docs/activities/development-guides/multiplayer-experience#preventing-unwanted-activity-sessions). +Returns a serialized activity instance, if it exists. Useful for [preventing unwanted activity sessions](/developers/docs/activities/development-guides/multiplayer-experience#preventing-unwanted-activity-sessions). + ###### Example Activity Instance ```json @@ -285,28 +296,30 @@ Returns a serialized activity instance, if it exists. Useful for [preventing unw } ``` + ###### Activity Instance Object -| Field | Type | Description | -|----------------|-------------------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------| -| application_id | snowflake | [Application](/docs/resources/application#application-object) ID | -| instance_id | string | Activity [Instance](/docs/activities/development-guides/multiplayer-experience#activity-instance-management) ID | -| launch_id | snowflake | Unique identifier for the launch | -| location | [Activity Location](/docs/resources/application#get-application-activity-instance-activity-location-object) | Location the instance is running in | -| users | array of snowflakes, [user](/docs/resources/user#user-object) IDs | IDs of the Users currently connected to the instance | - +| Field | Type | Description | +|----------------|------------------------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------| +| application_id | snowflake | [Application](/developers/docs/resources/application#application-object) ID | +| instance_id | string | Activity [Instance](/developers/docs/activities/development-guides/multiplayer-experience#activity-instance-management) ID | +| launch_id | snowflake | Unique identifier for the launch | +| location | [Activity Location](/developers/docs/resources/application#get-application-activity-instance-activity-location-object) | Location the instance is running in | +| users | array of snowflakes, [user](/developers/docs/resources/user#user-object) IDs | IDs of the Users currently connected to the instance | + ###### Activity Location Object The Activity Location is an object that describes the location in which an activity instance is running. -| Field | Type | Description | -|------------|--------------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------| -| id | string | Unique identifier for the location | -| kind | [Activity Location Kind Enum](/docs/resources/application#get-application-activity-instance-activity-location-kind-enum) | Enum describing kind of location | -| channel_id | snowflake | ID of the [Channel](/docs/resources/channel#channel-object) | -| guild_id? | ?snowflake | ID of the [Guild](/docs/resources/guild#guild-object) | +| Field | Type | Description | +|------------|-------------------------------------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------| +| id | string | Unique identifier for the location | +| kind | [Activity Location Kind Enum](/developers/docs/resources/application#get-application-activity-instance-activity-location-kind-enum) | Enum describing kind of location | +| channel_id | snowflake | ID of the [Channel](/developers/docs/resources/channel#channel-object) | +| guild_id? | ?snowflake | ID of the [Guild](/developers/docs/resources/guild#guild-object) | + ###### Activity Location Kind Enum | Enum | Description | diff --git a/docs/resources/audit-log.mdx b/discord/developers/docs/resources/audit-log.mdx similarity index 64% rename from docs/resources/audit-log.mdx rename to discord/developers/docs/resources/audit-log.mdx index c111cd472c..7659f71f6e 100644 --- a/docs/resources/audit-log.mdx +++ b/discord/developers/docs/resources/audit-log.mdx @@ -1,32 +1,36 @@ --- -sidebar_label: Audit Log +title: Audit Logs Resource +sidebarTitle: Audit Log +description: Reference for Discord audit log objects and endpoints. --- -# Audit Logs Resource +import {ManualAnchor} from '/snippets/manualanchor.jsx' -## Audit Logs +import {Route} from '/snippets/route.jsx' -When an administrative action is performed in a guild, an entry is added to its audit log. Viewing audit logs requires the `VIEW_AUDIT_LOG` permission and can be fetched by apps using the [`GET /guilds/{guild.id}/audit-logs` endpoint](/docs/resources/audit-log#get-guild-audit-log), or seen by users in the guild's **Server Settings**. All audit log entries are stored for 45 days. +When an administrative action is performed in a guild, an entry is added to its audit log. Viewing audit logs requires the `VIEW_AUDIT_LOG` permission and can be fetched by apps using the [`GET /guilds/{guild.id}/audit-logs` endpoint](/developers/docs/resources/audit-log#get-guild-audit-log), or seen by users in the guild's **Server Settings**. All audit log entries are stored for 45 days. -When an app is performing an eligible action using the APIs, it can pass an `X-Audit-Log-Reason` header to indicate why the action was taken. More information is in the [audit log entry](/docs/resources/audit-log#audit-log-entry-object) section. +When an app is performing an eligible action using the APIs, it can pass an `X-Audit-Log-Reason` header to indicate why the action was taken. More information is in the [audit log entry](/developers/docs/resources/audit-log#audit-log-entry-object) section. ### Audit Log Object + ###### Audit Log Structure -| Field | Type | Description | -|------------------------|--------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------| -| application_commands | array of [application commands](/docs/interactions/application-commands#application-command-object) objects | List of application commands referenced in the audit log | -| audit_log_entries | array of [audit log entry](/docs/resources/audit-log#audit-log-entry-object) objects | List of audit log entries, sorted from most to least recent | -| auto_moderation_rules | array of [auto moderation rule](/docs/resources/auto-moderation#auto-moderation-rule-object) objects | List of auto moderation rules referenced in the audit log | -| guild_scheduled_events | array of [guild scheduled event](/docs/resources/guild-scheduled-event#guild-scheduled-event-object) objects | List of guild scheduled events referenced in the audit log | -| integrations | array of partial [integration](/docs/resources/guild#integration-object) objects | List of partial integration objects | -| threads | array of thread-specific [channel](/docs/resources/channel#channel-object) objects | List of threads referenced in the audit log\* | -| users | array of [user](/docs/resources/user#user-object) objects | List of users referenced in the audit log | -| webhooks | array of [webhook](/docs/resources/webhook#webhook-object) objects | List of webhooks referenced in the audit log | +| Field | Type | Description | +|------------------------|-------------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------| +| application_commands | array of [application commands](/developers/docs/interactions/application-commands#application-command-object) objects | List of application commands referenced in the audit log | +| audit_log_entries | array of [audit log entry](/developers/docs/resources/audit-log#audit-log-entry-object) objects | List of audit log entries, sorted from most to least recent | +| auto_moderation_rules | array of [auto moderation rule](/developers/docs/resources/auto-moderation#auto-moderation-rule-object) objects | List of auto moderation rules referenced in the audit log | +| guild_scheduled_events | array of [guild scheduled event](/developers/docs/resources/guild-scheduled-event#guild-scheduled-event-object) objects | List of guild scheduled events referenced in the audit log | +| integrations | array of partial [integration](/developers/docs/resources/guild#integration-object) objects | List of partial integration objects | +| threads | array of thread-specific [channel](/developers/docs/resources/channel#channel-object) objects | List of threads referenced in the audit log\* | +| users | array of [user](/developers/docs/resources/user#user-object) objects | List of users referenced in the audit log | +| webhooks | array of [webhook](/developers/docs/resources/webhook#webhook-object) objects | List of webhooks referenced in the audit log | \* Threads referenced in `THREAD_CREATE` and `THREAD_UPDATE` events are included in the threads map since archived threads might not be kept in memory by clients. + ###### Example Partial Integration Object ```json @@ -44,113 +48,116 @@ When an app is performing an eligible action using the APIs, it can pass an `X-A ### Audit Log Entry Object -Each audit log entry represents a single administrative action (or [event](/docs/resources/audit-log#audit-log-entry-object-audit-log-events)), indicated by `action_type`. Most entries contain one to many changes in the `changes` array that affected an entity in Discord—whether that's a user, channel, guild, emoji, or something else. +Each audit log entry represents a single administrative action (or [event](/developers/docs/resources/audit-log#audit-log-entry-object-audit-log-events)), indicated by `action_type`. Most entries contain one to many changes in the `changes` array that affected an entity in Discord—whether that's a user, channel, guild, emoji, or something else. -The information (and structure) of an entry's changes will be different depending on its type. For example, in `MEMBER_ROLE_UPDATE` events there is only one change: a member is either added or removed from a specific role. However, in `CHANNEL_CREATE` events there are many changes, including (but not limited to) the channel's name, type, and permission overwrites added. More details are in the [change object](/docs/resources/audit-log#audit-log-change-object) section. +The information (and structure) of an entry's changes will be different depending on its type. For example, in `MEMBER_ROLE_UPDATE` events there is only one change: a member is either added or removed from a specific role. However, in `CHANNEL_CREATE` events there are many changes, including (but not limited to) the channel's name, type, and permission overwrites added. More details are in the [change object](/developers/docs/resources/audit-log#audit-log-change-object) section. Apps can specify why an administrative action is being taken by passing an `X-Audit-Log-Reason` request header, which will be stored as the audit log entry's `reason` field. The `X-Audit-Log-Reason` header supports 1-512 URL-encoded UTF-8 characters. Reasons are visible to users in the client and to apps when fetching audit log entries with the API. + ###### Audit Log Entry Structure -| Field | Type | Description | -|-------------|---------------------------------------------------------------------------------------------------------|-------------------------------------------------------| -| target_id | ?string | ID of the affected entity (webhook, user, role, etc.) | -| changes? | array of [audit log change](/docs/resources/audit-log#audit-log-change-object) objects | Changes made to the target_id | -| user_id | ?snowflake | User or app that made the changes | -| id | snowflake | ID of the entry | -| action_type | [audit log event](/docs/resources/audit-log#audit-log-entry-object-audit-log-events) | Type of action that occurred | -| options? | [optional audit entry info](/docs/resources/audit-log#audit-log-entry-object-optional-audit-entry-info) | Additional info for certain event types | -| reason? | string | Reason for the change (1-512 characters) | - -:::warn -For `APPLICATION_COMMAND_PERMISSION_UPDATE` events, the `target_id` is the command ID or the app ID since the `changes` array represents the entire `permissions` property on the [guild permissions](/docs/interactions/application-commands#application-command-permissions-object-guild-application-command-permissions-structure) object. -::: - +| Field | Type | Description | +|-------------|--------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------| +| target_id | ?string | ID of the affected entity (webhook, user, role, etc.) | +| changes? | array of [audit log change](/developers/docs/resources/audit-log#audit-log-change-object) objects | Changes made to the target_id | +| user_id | ?snowflake | User or app that made the changes | +| id | snowflake | ID of the entry | +| action_type | [audit log event](/developers/docs/resources/audit-log#audit-log-entry-object-audit-log-events) | Type of action that occurred | +| options? | [optional audit entry info](/developers/docs/resources/audit-log#audit-log-entry-object-optional-audit-entry-info) | Additional info for certain event types | +| reason? | string | Reason for the change (1-512 characters) | + + +For `APPLICATION_COMMAND_PERMISSION_UPDATE` events, the `target_id` is the command ID or the app ID since the `changes` array represents the entire `permissions` property on the [guild permissions](/developers/docs/interactions/application-commands#application-command-permissions-object-guild-application-command-permissions-structure) object. + + + ###### Audit Log Events The table below lists audit log events and values (the `action_type` field) that your app may receive. The **Object Changed** column notes which object's values may be included in the entry. Though there are exceptions, possible keys in the `changes` array typically correspond to the object's fields. The descriptions and types for those fields can be found in the linked documentation for the object. -If no object is noted, there won't be a `changes` array in the entry, though other fields like the `target_id` still exist and many have fields in the [`options` object](/docs/resources/audit-log#audit-log-entry-object-optional-audit-entry-info). +If no object is noted, there won't be a `changes` array in the entry, though other fields like the `target_id` still exist and many have fields in the [`options` object](/developers/docs/resources/audit-log#audit-log-entry-object-optional-audit-entry-info). -:::info + You should assume that your app may run into any field for the changed object, though none are guaranteed to be present. In most cases only a subset of the object's fields will be in the `changes` array. -::: - -| Event | Value | Description | Object Changed | -|---------------------------------------------|-------|-----------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------| -| GUILD_UPDATE | 1 | Server settings were updated | [Guild](/docs/resources/guild#guild-object) | -| CHANNEL_CREATE | 10 | Channel was created | [Channel](/docs/resources/channel#channel-object) | -| CHANNEL_UPDATE | 11 | Channel settings were updated | [Channel](/docs/resources/channel#channel-object) | -| CHANNEL_DELETE | 12 | Channel was deleted | [Channel](/docs/resources/channel#channel-object) | -| CHANNEL_OVERWRITE_CREATE | 13 | Permission overwrite was added to a channel | [Channel Overwrite](/docs/resources/channel#overwrite-object) | -| CHANNEL_OVERWRITE_UPDATE | 14 | Permission overwrite was updated for a channel | [Channel Overwrite](/docs/resources/channel#overwrite-object) | -| CHANNEL_OVERWRITE_DELETE | 15 | Permission overwrite was deleted from a channel | [Channel Overwrite](/docs/resources/channel#overwrite-object) | -| MEMBER_KICK | 20 | Member was removed from server | | -| MEMBER_PRUNE | 21 | Members were pruned from server | | -| MEMBER_BAN_ADD | 22 | Member was banned from server | | -| MEMBER_BAN_REMOVE | 23 | Server ban was lifted for a member | | -| MEMBER_UPDATE | 24 | Member was updated in server | [Member](/docs/resources/guild#guild-member-object) | -| MEMBER_ROLE_UPDATE | 25 | Member was added or removed from a role | [Partial Role](/docs/topics/permissions#role-object)\* | -| MEMBER_MOVE | 26 | Member was moved to a different voice channel | | -| MEMBER_DISCONNECT | 27 | Member was disconnected from a voice channel | | -| BOT_ADD | 28 | Bot user was added to server | | -| ROLE_CREATE | 30 | Role was created | [Role](/docs/topics/permissions#role-object) | -| ROLE_UPDATE | 31 | Role was edited | [Role](/docs/topics/permissions#role-object) | -| ROLE_DELETE | 32 | Role was deleted | [Role](/docs/topics/permissions#role-object) | -| INVITE_CREATE | 40 | Server invite was created | [Invite](/docs/resources/invite#invite-object) and [Invite Metadata](/docs/resources/invite#invite-metadata-object)* | -| INVITE_UPDATE | 41 | Server invite was updated | [Invite](/docs/resources/invite#invite-object) and [Invite Metadata](/docs/resources/invite#invite-metadata-object)* | -| INVITE_DELETE | 42 | Server invite was deleted | [Invite](/docs/resources/invite#invite-object) and [Invite Metadata](/docs/resources/invite#invite-metadata-object)* | -| WEBHOOK_CREATE | 50 | Webhook was created | [Webhook](/docs/resources/webhook#webhook-object)\* | -| WEBHOOK_UPDATE | 51 | Webhook properties or channel were updated | [Webhook](/docs/resources/webhook#webhook-object)\* | -| WEBHOOK_DELETE | 52 | Webhook was deleted | [Webhook](/docs/resources/webhook#webhook-object)\* | -| EMOJI_CREATE | 60 | Emoji was created | [Emoji](/docs/resources/emoji#emoji-object) | -| EMOJI_UPDATE | 61 | Emoji name was updated | [Emoji](/docs/resources/emoji#emoji-object) | -| EMOJI_DELETE | 62 | Emoji was deleted | [Emoji](/docs/resources/emoji#emoji-object) | -| MESSAGE_DELETE | 72 | Single message was deleted | | -| MESSAGE_BULK_DELETE | 73 | Multiple messages were deleted | | -| MESSAGE_PIN | 74 | Message was pinned to a channel | | -| MESSAGE_UNPIN | 75 | Message was unpinned from a channel | | -| INTEGRATION_CREATE | 80 | App was added to server | [Integration](/docs/resources/guild#integration-object) | -| INTEGRATION_UPDATE | 81 | App was updated (as an example, its scopes were updated) | [Integration](/docs/resources/guild#integration-object) | -| INTEGRATION_DELETE | 82 | App was removed from server | [Integration](/docs/resources/guild#integration-object) | -| STAGE_INSTANCE_CREATE | 83 | Stage instance was created (stage channel becomes live) | [Stage Instance](/docs/resources/stage-instance#stage-instance-object) | -| STAGE_INSTANCE_UPDATE | 84 | Stage instance details were updated | [Stage Instance](/docs/resources/stage-instance#stage-instance-object) | -| STAGE_INSTANCE_DELETE | 85 | Stage instance was deleted (stage channel no longer live) | [Stage Instance](/docs/resources/stage-instance#stage-instance-object) | -| STICKER_CREATE | 90 | Sticker was created | [Sticker](/docs/resources/sticker#sticker-object) | -| STICKER_UPDATE | 91 | Sticker details were updated | [Sticker](/docs/resources/sticker#sticker-object) | -| STICKER_DELETE | 92 | Sticker was deleted | [Sticker](/docs/resources/sticker#sticker-object) | -| GUILD_SCHEDULED_EVENT_CREATE | 100 | Event was created | [Guild Scheduled Event](/docs/resources/guild-scheduled-event#guild-scheduled-event-object) | -| GUILD_SCHEDULED_EVENT_UPDATE | 101 | Event was updated | [Guild Scheduled Event](/docs/resources/guild-scheduled-event#guild-scheduled-event-object) | -| GUILD_SCHEDULED_EVENT_DELETE | 102 | Event was cancelled | [Guild Scheduled Event](/docs/resources/guild-scheduled-event#guild-scheduled-event-object) | -| THREAD_CREATE | 110 | Thread was created in a channel | [Thread](/docs/resources/channel#thread-metadata-object) | -| THREAD_UPDATE | 111 | Thread was updated | [Thread](/docs/resources/channel#thread-metadata-object) | -| THREAD_DELETE | 112 | Thread was deleted | [Thread](/docs/resources/channel#thread-metadata-object) | -| APPLICATION_COMMAND_PERMISSION_UPDATE | 121 | Permissions were updated for a command | [Command Permission](/docs/interactions/application-commands#application-command-permissions-object-application-command-permissions-structure)\* | -| SOUNDBOARD_SOUND_CREATE | 130 | Soundboard sound was created | [Soundboard Sound](/docs/resources/soundboard#soundboard-sound-object) | -| SOUNDBOARD_SOUND_UPDATE | 131 | Soundboard sound was updated | [Soundboard Sound](/docs/resources/soundboard#soundboard-sound-object) | -| SOUNDBOARD_SOUND_DELETE | 132 | Soundboard sound was deleted | [Soundboard Sound](/docs/resources/soundboard#soundboard-sound-object) | -| AUTO_MODERATION_RULE_CREATE | 140 | Auto Moderation rule was created | [Auto Moderation Rule](/docs/resources/auto-moderation#auto-moderation-rule-object) | -| AUTO_MODERATION_RULE_UPDATE | 141 | Auto Moderation rule was updated | [Auto Moderation Rule](/docs/resources/auto-moderation#auto-moderation-rule-object) | -| AUTO_MODERATION_RULE_DELETE | 142 | Auto Moderation rule was deleted | [Auto Moderation Rule](/docs/resources/auto-moderation#auto-moderation-rule-object) | -| AUTO_MODERATION_BLOCK_MESSAGE | 143 | Message was blocked by Auto Moderation | | -| AUTO_MODERATION_FLAG_TO_CHANNEL | 144 | Message was flagged by Auto Moderation | | -| AUTO_MODERATION_USER_COMMUNICATION_DISABLED | 145 | Member was timed out by Auto Moderation | | -| AUTO_MODERATION_QUARANTINE_USER | 146 | Member was quarantined by Auto Moderation | | -| CREATOR_MONETIZATION_REQUEST_CREATED | 150 | Creator monetization request was created | | -| CREATOR_MONETIZATION_TERMS_ACCEPTED | 151 | Creator monetization terms were accepted | | -| ONBOARDING_PROMPT_CREATE | 163 | Guild Onboarding Question was created | [Onboarding Prompt Structure](/docs/resources/guild#guild-onboarding-object-onboarding-prompt-structure) | -| ONBOARDING_PROMPT_UPDATE | 164 | Guild Onboarding Question was updated | [Onboarding Prompt Structure](/docs/resources/guild#guild-onboarding-object-onboarding-prompt-structure) | -| ONBOARDING_PROMPT_DELETE | 165 | Guild Onboarding Question was deleted | [Onboarding Prompt Structure](/docs/resources/guild#guild-onboarding-object-onboarding-prompt-structure) | -| ONBOARDING_CREATE | 166 | Guild Onboarding was created | [Guild Onboarding](/docs/resources/guild#guild-onboarding-object) | -| ONBOARDING_UPDATE | 167 | Guild Onboarding was updated | [Guild Onboarding](/docs/resources/guild#guild-onboarding-object) | -| HOME_SETTINGS_CREATE | 190 | Guild Server Guide was created | | -| HOME_SETTINGS_UPDATE | 191 | Guild Server Guide was updated | | - - -\* Object has exception(s) to available keys. See the [exceptions](/docs/resources/audit-log#audit-log-change-object-audit-log-change-exceptions) section below for details. - + + +| Event | Value | Description | Object Changed | +|---------------------------------------------|-------|-----------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------| +| GUILD_UPDATE | 1 | Server settings were updated | [Guild](/developers/docs/resources/guild#guild-object) | +| CHANNEL_CREATE | 10 | Channel was created | [Channel](/developers/docs/resources/channel#channel-object) | +| CHANNEL_UPDATE | 11 | Channel settings were updated | [Channel](/developers/docs/resources/channel#channel-object) | +| CHANNEL_DELETE | 12 | Channel was deleted | [Channel](/developers/docs/resources/channel#channel-object) | +| CHANNEL_OVERWRITE_CREATE | 13 | Permission overwrite was added to a channel | [Channel Overwrite](/developers/docs/resources/channel#overwrite-object) | +| CHANNEL_OVERWRITE_UPDATE | 14 | Permission overwrite was updated for a channel | [Channel Overwrite](/developers/docs/resources/channel#overwrite-object) | +| CHANNEL_OVERWRITE_DELETE | 15 | Permission overwrite was deleted from a channel | [Channel Overwrite](/developers/docs/resources/channel#overwrite-object) | +| MEMBER_KICK | 20 | Member was removed from server | | +| MEMBER_PRUNE | 21 | Members were pruned from server | | +| MEMBER_BAN_ADD | 22 | Member was banned from server | | +| MEMBER_BAN_REMOVE | 23 | Server ban was lifted for a member | | +| MEMBER_UPDATE | 24 | Member was updated in server | [Member](/developers/docs/resources/guild#guild-member-object) | +| MEMBER_ROLE_UPDATE | 25 | Member was added or removed from a role | [Partial Role](/developers/docs/topics/permissions#role-object)\* | +| MEMBER_MOVE | 26 | Member was moved to a different voice channel | | +| MEMBER_DISCONNECT | 27 | Member was disconnected from a voice channel | | +| BOT_ADD | 28 | Bot user was added to server | | +| ROLE_CREATE | 30 | Role was created | [Role](/developers/docs/topics/permissions#role-object) | +| ROLE_UPDATE | 31 | Role was edited | [Role](/developers/docs/topics/permissions#role-object) | +| ROLE_DELETE | 32 | Role was deleted | [Role](/developers/docs/topics/permissions#role-object) | +| INVITE_CREATE | 40 | Server invite was created | [Invite](/developers/docs/resources/invite#invite-object) and [Invite Metadata](/developers/docs/resources/invite#invite-metadata-object)* | +| INVITE_UPDATE | 41 | Server invite was updated | [Invite](/developers/docs/resources/invite#invite-object) and [Invite Metadata](/developers/docs/resources/invite#invite-metadata-object)* | +| INVITE_DELETE | 42 | Server invite was deleted | [Invite](/developers/docs/resources/invite#invite-object) and [Invite Metadata](/developers/docs/resources/invite#invite-metadata-object)* | +| WEBHOOK_CREATE | 50 | Webhook was created | [Webhook](/developers/docs/resources/webhook#webhook-object)\* | +| WEBHOOK_UPDATE | 51 | Webhook properties or channel were updated | [Webhook](/developers/docs/resources/webhook#webhook-object)\* | +| WEBHOOK_DELETE | 52 | Webhook was deleted | [Webhook](/developers/docs/resources/webhook#webhook-object)\* | +| EMOJI_CREATE | 60 | Emoji was created | [Emoji](/developers/docs/resources/emoji#emoji-object) | +| EMOJI_UPDATE | 61 | Emoji name was updated | [Emoji](/developers/docs/resources/emoji#emoji-object) | +| EMOJI_DELETE | 62 | Emoji was deleted | [Emoji](/developers/docs/resources/emoji#emoji-object) | +| MESSAGE_DELETE | 72 | Single message was deleted | | +| MESSAGE_BULK_DELETE | 73 | Multiple messages were deleted | | +| MESSAGE_PIN | 74 | Message was pinned to a channel | | +| MESSAGE_UNPIN | 75 | Message was unpinned from a channel | | +| INTEGRATION_CREATE | 80 | App was added to server | [Integration](/developers/docs/resources/guild#integration-object) | +| INTEGRATION_UPDATE | 81 | App was updated (as an example, its scopes were updated) | [Integration](/developers/docs/resources/guild#integration-object) | +| INTEGRATION_DELETE | 82 | App was removed from server | [Integration](/developers/docs/resources/guild#integration-object) | +| STAGE_INSTANCE_CREATE | 83 | Stage instance was created (stage channel becomes live) | [Stage Instance](/developers/docs/resources/stage-instance#stage-instance-object) | +| STAGE_INSTANCE_UPDATE | 84 | Stage instance details were updated | [Stage Instance](/developers/docs/resources/stage-instance#stage-instance-object) | +| STAGE_INSTANCE_DELETE | 85 | Stage instance was deleted (stage channel no longer live) | [Stage Instance](/developers/docs/resources/stage-instance#stage-instance-object) | +| STICKER_CREATE | 90 | Sticker was created | [Sticker](/developers/docs/resources/sticker#sticker-object) | +| STICKER_UPDATE | 91 | Sticker details were updated | [Sticker](/developers/docs/resources/sticker#sticker-object) | +| STICKER_DELETE | 92 | Sticker was deleted | [Sticker](/developers/docs/resources/sticker#sticker-object) | +| GUILD_SCHEDULED_EVENT_CREATE | 100 | Event was created | [Guild Scheduled Event](/developers/docs/resources/guild-scheduled-event#guild-scheduled-event-object) | +| GUILD_SCHEDULED_EVENT_UPDATE | 101 | Event was updated | [Guild Scheduled Event](/developers/docs/resources/guild-scheduled-event#guild-scheduled-event-object) | +| GUILD_SCHEDULED_EVENT_DELETE | 102 | Event was cancelled | [Guild Scheduled Event](/developers/docs/resources/guild-scheduled-event#guild-scheduled-event-object) | +| THREAD_CREATE | 110 | Thread was created in a channel | [Thread](/developers/docs/resources/channel#thread-metadata-object) | +| THREAD_UPDATE | 111 | Thread was updated | [Thread](/developers/docs/resources/channel#thread-metadata-object) | +| THREAD_DELETE | 112 | Thread was deleted | [Thread](/developers/docs/resources/channel#thread-metadata-object) | +| APPLICATION_COMMAND_PERMISSION_UPDATE | 121 | Permissions were updated for a command | [Command Permission](/developers/docs/interactions/application-commands#application-command-permissions-object-application-command-permissions-structure)\* | +| SOUNDBOARD_SOUND_CREATE | 130 | Soundboard sound was created | [Soundboard Sound](/developers/docs/resources/soundboard#soundboard-sound-object) | +| SOUNDBOARD_SOUND_UPDATE | 131 | Soundboard sound was updated | [Soundboard Sound](/developers/docs/resources/soundboard#soundboard-sound-object) | +| SOUNDBOARD_SOUND_DELETE | 132 | Soundboard sound was deleted | [Soundboard Sound](/developers/docs/resources/soundboard#soundboard-sound-object) | +| AUTO_MODERATION_RULE_CREATE | 140 | Auto Moderation rule was created | [Auto Moderation Rule](/developers/docs/resources/auto-moderation#auto-moderation-rule-object) | +| AUTO_MODERATION_RULE_UPDATE | 141 | Auto Moderation rule was updated | [Auto Moderation Rule](/developers/docs/resources/auto-moderation#auto-moderation-rule-object) | +| AUTO_MODERATION_RULE_DELETE | 142 | Auto Moderation rule was deleted | [Auto Moderation Rule](/developers/docs/resources/auto-moderation#auto-moderation-rule-object) | +| AUTO_MODERATION_BLOCK_MESSAGE | 143 | Message was blocked by Auto Moderation | | +| AUTO_MODERATION_FLAG_TO_CHANNEL | 144 | Message was flagged by Auto Moderation | | +| AUTO_MODERATION_USER_COMMUNICATION_DISABLED | 145 | Member was timed out by Auto Moderation | | +| AUTO_MODERATION_QUARANTINE_USER | 146 | Member was quarantined by Auto Moderation | | +| CREATOR_MONETIZATION_REQUEST_CREATED | 150 | Creator monetization request was created | | +| CREATOR_MONETIZATION_TERMS_ACCEPTED | 151 | Creator monetization terms were accepted | | +| ONBOARDING_PROMPT_CREATE | 163 | Guild Onboarding Question was created | [Onboarding Prompt Structure](/developers/docs/resources/guild#guild-onboarding-object-onboarding-prompt-structure) | +| ONBOARDING_PROMPT_UPDATE | 164 | Guild Onboarding Question was updated | [Onboarding Prompt Structure](/developers/docs/resources/guild#guild-onboarding-object-onboarding-prompt-structure) | +| ONBOARDING_PROMPT_DELETE | 165 | Guild Onboarding Question was deleted | [Onboarding Prompt Structure](/developers/docs/resources/guild#guild-onboarding-object-onboarding-prompt-structure) | +| ONBOARDING_CREATE | 166 | Guild Onboarding was created | [Guild Onboarding](/developers/docs/resources/guild#guild-onboarding-object) | +| ONBOARDING_UPDATE | 167 | Guild Onboarding was updated | [Guild Onboarding](/developers/docs/resources/guild#guild-onboarding-object) | +| HOME_SETTINGS_CREATE | 190 | Guild Server Guide was created | | +| HOME_SETTINGS_UPDATE | 191 | Guild Server Guide was updated | | + + +\* Object has exception(s) to available keys. See the [exceptions](/developers/docs/resources/audit-log#audit-log-change-object-audit-log-change-exceptions) section below for details. + + ###### Optional Audit Entry Info | Field | Type | Description | Event Types | @@ -170,49 +177,52 @@ You should assume that your app may run into any field for the changed object, t ### Audit Log Change Object -Many audit log events include a `changes` array in their [entry object](/docs/resources/audit-log#audit-log-entry-object-audit-log-entry-structure). The [structure for the individual changes](/docs/resources/audit-log#audit-log-change-object-audit-log-change-structure) varies based on the event type and its changed objects, so apps shouldn't depend on a single pattern of handling audit log events. +Many audit log events include a `changes` array in their [entry object](/developers/docs/resources/audit-log#audit-log-entry-object-audit-log-entry-structure). The [structure for the individual changes](/developers/docs/resources/audit-log#audit-log-change-object-audit-log-change-structure) varies based on the event type and its changed objects, so apps shouldn't depend on a single pattern of handling audit log events. + ###### Audit Log Change Structure -Some events don't follow the same pattern as other audit log events. Details about these exceptions are explained in [the next section](/docs/resources/audit-log#audit-log-change-object-audit-log-change-exceptions). +Some events don't follow the same pattern as other audit log events. Details about these exceptions are explained in [the next section](/developers/docs/resources/audit-log#audit-log-change-object-audit-log-change-exceptions). -:::info + If `new_value` is not present in the change object while `old_value` is, it indicates that the property has been reset or set to `null`. If `old_value` isn't included, it indicated that the property was previously `null`. -::: + -| Field | Type | Description | -|------------|-------------------------------------|------------------------------------------------------------------------------------------------------------------------------------| -| new_value? | mixed (matches object field's type) | New value of the key | -| old_value? | mixed (matches object field's type) | Old value of the key | -| key | string | Name of the changed entity, with a few [exceptions](/docs/resources/audit-log#audit-log-change-object-audit-log-change-exceptions) | +| Field | Type | Description | +|------------|-------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------| +| new_value? | mixed (matches object field's type) | New value of the key | +| old_value? | mixed (matches object field's type) | Old value of the key | +| key | string | Name of the changed entity, with a few [exceptions](/developers/docs/resources/audit-log#audit-log-change-object-audit-log-change-exceptions) | + ###### Audit Log Change Exceptions For most objects, the change keys may be any field on the changed object. The following table details the exceptions to this pattern. -| Object Changed | Change Key Exceptions | Change Object Exceptions | -|------------------------------------------------------------------------------------------------------------------------------------------------|----------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| -| [Command Permission](/docs/interactions/application-commands#application-command-permissions-object-application-command-permissions-structure) | snowflake as key | The `changes` array contains objects with a `key` field representing the entity whose command was affected (role, channel, or user ID), a previous permissions object (with an `old_value` key), and an updated permissions object (with a `new_value` key) | -| [Invite](/docs/resources/invite#invite-object) and [Invite Metadata](/docs/resources/invite#invite-metadata-object) | Additional `channel_id` key (instead of object's `channel.id`) | | -| [Partial Role](/docs/topics/permissions#role-object) | `$add` and `$remove` as keys | `new_value` is an array of objects that contain the role `id` and `name` | -| [Webhook](/docs/resources/webhook#webhook-object) | `avatar_hash` key (instead of `avatar`) | | +| Object Changed | Change Key Exceptions | Change Object Exceptions | +|-----------------------------------------------------------------------------------------------------------------------------------------------------------|----------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| [Command Permission](/developers/docs/interactions/application-commands#application-command-permissions-object-application-command-permissions-structure) | snowflake as key | The `changes` array contains objects with a `key` field representing the entity whose command was affected (role, channel, or user ID), a previous permissions object (with an `old_value` key), and an updated permissions object (with a `new_value` key) | +| [Invite](/developers/docs/resources/invite#invite-object) and [Invite Metadata](/developers/docs/resources/invite#invite-metadata-object) | Additional `channel_id` key (instead of object's `channel.id`) | | +| [Partial Role](/developers/docs/topics/permissions#role-object) | `$add` and `$remove` as keys | `new_value` is an array of objects that contain the role `id` and `name` | +| [Webhook](/developers/docs/resources/webhook#webhook-object) | `avatar_hash` key (instead of `avatar`) | | ## Get Guild Audit Log -/guilds/[\{guild.id\}](/docs/resources/guild#guild-object)/audit-logs +/guilds/[\{guild.id\}](/developers/docs/resources/guild#guild-object)/audit-logs -Returns an [audit log](/docs/resources/audit-log#audit-log-object) object for the guild. Requires the [`VIEW_AUDIT_LOG`](/docs/topics/permissions#permissions-bitwise-permission-flags) permission. +Returns an [audit log](/developers/docs/resources/audit-log#audit-log-object) object for the guild. Requires the [`VIEW_AUDIT_LOG`](/developers/docs/topics/permissions#permissions-bitwise-permission-flags) permission. The returned list of audit log entries is ordered based on whether you use `before` or `after`. When using `before`, the list is ordered by the audit log entry ID **descending** (newer entries first). If `after` is used, the list is reversed and appears in **ascending** order (older entries first). Omitting both `before` and `after` defaults to `before` the current timestamp and will show the most recent entries in descending order by ID, the opposite can be achieved using `after=0` (showing oldest entries). + ###### Query String Params The following parameters can be used to filter which and how many audit log entries are returned. -| Field | Type | Description | -|--------------|-----------|-------------------------------------------------------------------------------------------------------------| -| user_id? | snowflake | Entries from a specific user ID | -| action_type? | integer | Entries for a specific [audit log event](/docs/resources/audit-log#audit-log-entry-object-audit-log-events) | -| before? | snowflake | Entries with ID less than a specific audit log entry ID | -| after? | snowflake | Entries with ID greater than a specific audit log entry ID | -| limit? | integer | Maximum number of entries (between 1-100) to return, defaults to 50 | +| Field | Type | Description | +|--------------|-----------|------------------------------------------------------------------------------------------------------------------------| +| user_id? | snowflake | Entries from a specific user ID | +| action_type? | integer | Entries for a specific [audit log event](/developers/docs/resources/audit-log#audit-log-entry-object-audit-log-events) | +| before? | snowflake | Entries with ID less than a specific audit log entry ID | +| after? | snowflake | Entries with ID greater than a specific audit log entry ID | +| limit? | integer | Maximum number of entries (between 1-100) to return, defaults to 50 | diff --git a/discord/developers/docs/resources/auto-moderation.mdx b/discord/developers/docs/resources/auto-moderation.mdx new file mode 100644 index 0000000000..91297f5d06 --- /dev/null +++ b/discord/developers/docs/resources/auto-moderation.mdx @@ -0,0 +1,312 @@ +--- +title: Auto Moderation +description: Reference for Discord's Auto Moderation system and endpoints. +--- + +import {ManualAnchor} from '/snippets/manualanchor.jsx' +import {Route} from '/snippets/route.jsx' + +Auto Moderation is a feature which allows each [guild](/developers/docs/resources/guild) to set up rules that trigger based on some criteria. For example, a rule can trigger whenever a message contains a specific keyword. + +Rules can be configured to automatically execute actions whenever they trigger. For example, if a user tries to send a message which contains a certain keyword, a rule can trigger and block the message before it is sent. + +### Auto Moderation Rule Object + + +###### Auto Moderation Rule Structure + +| Field | Type | Description | +|------------------|-----------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------| +| id | snowflake | the id of this rule | +| guild_id | snowflake | the id of the guild which this rule belongs to | +| name | string | the rule name | +| creator_id | snowflake | the user which first created this rule | +| event_type | integer | the rule [event type](/developers/docs/resources/auto-moderation#auto-moderation-rule-object-event-types) | +| trigger_type | integer | the rule [trigger type](/developers/docs/resources/auto-moderation#auto-moderation-rule-object-trigger-types) | +| trigger_metadata | object | the rule [trigger metadata](/developers/docs/resources/auto-moderation#auto-moderation-rule-object-trigger-metadata) | +| actions | array of [action](/developers/docs/resources/auto-moderation#auto-moderation-action-object) objects | the actions which will execute when the rule is triggered | +| enabled | boolean | whether the rule is enabled | +| exempt_roles | array of snowflakes | the role ids that should not be affected by the rule (Maximum of 20) | +| exempt_channels | array of snowflakes | the channel ids that should not be affected by the rule (Maximum of 50) | + + +###### Example Auto Moderation Rule + +```json +{ + "id": "969707018069872670", + "guild_id": "613425648685547541", + "name": "Keyword Filter 1", + "creator_id": "423457898095789043", + "trigger_type": 1, + "event_type": 1, + "actions": [ + { + "type": 1, + "metadata": { "custom_message": "Please keep financial discussions limited to the #finance channel" } + }, + { + "type": 2, + "metadata": { "channel_id": "123456789123456789" } + }, + { + "type": 3, + "metadata": { "duration_seconds": 60 } + } + ], + "trigger_metadata": { + "keyword_filter": ["cat*", "*dog", "*ana*", "i like c++"], + "regex_patterns": ["(b|c)at", "^(?:[0-9]{1,3}\\.){3}[0-9]{1,3}$"] + }, + "enabled": true, + "exempt_roles": ["323456789123456789", "423456789123456789"], + "exempt_channels": ["523456789123456789"] +} +``` + + +###### Trigger Types +Characterizes the type of content which can trigger the rule. + +| Trigger Type | Value | Description | Max per Guild | +|----------------|-------|-----------------------------------------------------------------------------|---------------| +| KEYWORD | 1 | check if content contains words from a user defined list of keywords | 6 | +| SPAM | 3 | check if content represents generic spam | 1 | +| KEYWORD_PRESET | 4 | check if content contains words from internal pre-defined wordsets | 1 | +| MENTION_SPAM | 5 | check if content contains more unique mentions than allowed | 1 | +| MEMBER_PROFILE | 6 | check if member profile contains words from a user defined list of keywords | 1 | + + +###### Trigger Metadata + +Additional data used to determine whether a rule should be triggered. Different fields are relevant based on the +value of [trigger_type](/developers/docs/resources/auto-moderation#auto-moderation-rule-object-trigger-types). + +| Field | Type | Associated Trigger Types | Description | +|---------------------------------|------------------------------------------------------------------------------------------------------------------------------|-----------------------------------------|-----------------------------------------------------------------------------------| +| keyword_filter | array of strings * | KEYWORD, MEMBER_PROFILE | substrings which will be searched for in content (Maximum of 1000) | +| regex_patterns | array of strings ** | KEYWORD, MEMBER_PROFILE | regular expression patterns which will be matched against content (Maximum of 10) | +| presets | array of [keyword preset types](/developers/docs/resources/auto-moderation#auto-moderation-rule-object-keyword-preset-types) | KEYWORD_PRESET | the internally pre-defined wordsets which will be searched for in content | +| allow_list | array of strings *** | KEYWORD, KEYWORD_PRESET, MEMBER_PROFILE | substrings which should not trigger the rule (Maximum of 100 or 1000) | +| mention_total_limit | integer | MENTION_SPAM | total number of unique role and user mentions allowed per message (Maximum of 50) | +| mention_raid_protection_enabled | boolean | MENTION_SPAM | whether to automatically detect mention raids | + +\* A keyword can be a phrase which contains multiple words. [Wildcard symbols](/developers/docs/resources/auto-moderation#auto-moderation-rule-object-keyword-matching-strategies) can be used to customize how each keyword will be matched. Each keyword must be 60 characters or less. + +\** Only Rust flavored regex is currently supported, which can be tested in online editors such as [Rustexp](https://rustexp.lpil.uk/). Each regex pattern must be 260 characters or less. + +\*** Each `allow_list` keyword can be a phrase which contains multiple words. [Wildcard symbols](/developers/docs/resources/auto-moderation#auto-moderation-rule-object-keyword-matching-strategies) can be used to customize how each keyword will be matched. Rules with `KEYWORD` [trigger_type](/developers/docs/resources/auto-moderation#auto-moderation-rule-object-trigger-types) accept a maximum of 100 keywords. Rules with `KEYWORD_PRESET` [trigger_type](/developers/docs/resources/auto-moderation#auto-moderation-rule-object-trigger-types) accept a maximum of 1000 keywords. + + +###### Trigger Metadata Field Limits + +| Field | Trigger Types | MAX ARRAY LENGTH | MAX CHARACTERS PER STRING | +|----------------|-------------------------|------------------|---------------------------| +| keyword_filter | KEYWORD, MEMBER_PROFILE | 1000 | 60 | +| regex_patterns | KEYWORD, MEMBER_PROFILE | 10 | 260 | +| allow_list | KEYWORD, MEMBER_PROFILE | 100 | 60 | +| allow_list | KEYWORD_PRESET | 1000 | 60 | + + + +###### Keyword Preset Types + +| Preset Type | Value | Description | +|----------------|-------|--------------------------------------------------------------| +| PROFANITY | 1 | words that may be considered forms of swearing or cursing | +| SEXUAL_CONTENT | 2 | words that refer to sexually explicit behavior or activity | +| SLURS | 3 | personal insults or words that may be considered hate speech | + + + +###### Event Types + +Indicates in what event context a rule should be checked. + +| Event Type | Value | Description | +|---------------|-------|-----------------------------------------------------| +| MESSAGE_SEND | 1 | when a member sends or edits a message in the guild | +| MEMBER_UPDATE | 2 | when a member edits their profile | + + + +###### Keyword Matching Strategies + +Use the wildcard symbol (`*`) at the beginning or end of a keyword to define how it should be matched. All keywords are case insensitive. + +**Prefix** - word must start with the keyword + +| Keyword | Matches | +|-----------|---------------------------------------| +| cat\* | **cat**ch, **Cat**apult, **CAt**tLE | +| tra\* | **tra**in, **tra**de, **TRA**ditional | +| the mat\* | **the mat**rix | + + +**Suffix** - word must end with the keyword + +| Keyword | Matches | +|-----------|-------------------------------------| +| \*cat | wild**cat**, copy**Cat** | +| \*tra | ex**tra**, ul**tra**, orches**TRA** | +| \*the mat | brea**the mat** | + + +**Anywhere** - keyword can appear anywhere in the content + +| Keyword | Matches | +|-------------|-----------------------------| +| \*cat\* | lo**cat**ion, edu**Cat**ion | +| \*tra\* | abs**tra**cted, ou**tra**ge | +| \*the mat\* | brea**the mat**ter | + + +**Whole Word** - keyword is a full word or phrase and must be surrounded by whitespace + +| Keyword | Matches | +|---------|-------------| +| cat | **cat** | +| train | **train** | +| the mat | **the mat** | + + +### Auto Moderation Action Object + +An action which will execute whenever a rule is triggered. + + +###### Auto Moderation Action Structure + +| Field | Type | Description | +|-------------|-------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------| +| type | [action type](/developers/docs/resources/auto-moderation#auto-moderation-action-object-action-types) | the type of action | +| metadata? * | [action metadata](/developers/docs/resources/auto-moderation#auto-moderation-action-object-action-metadata) | additional metadata needed during execution for this specific action type | + +\* Can be omitted based on `type`. See the `Associated Action Types` column in [action metadata](/developers/docs/resources/auto-moderation#auto-moderation-action-object-action-metadata) to understand which `type` values require `metadata` to be set. + + +###### Action Types + +| Action Type | Value | Description | +|--------------------------|-------|------------------------------------------------------------------------------------------------------------------------------------------------------------| +| BLOCK_MESSAGE | 1 | blocks a member's message and prevents it from being posted. A custom explanation can be specified and shown to members whenever their message is blocked. | +| SEND_ALERT_MESSAGE | 2 | logs user content to a specified channel | +| TIMEOUT | 3 | timeout user for a specified duration * | +| BLOCK_MEMBER_INTERACTION | 4 | prevents a member from using text, voice, or other interactions | + +\* A `TIMEOUT` action can only be set up for `KEYWORD` and `MENTION_SPAM` rules. The `MODERATE_MEMBERS` permission is required to use the `TIMEOUT` action type. + + + +###### Action Metadata + +Additional data used when an action is executed. Different fields are relevant based on the +value of [action type](/developers/docs/resources/auto-moderation#auto-moderation-action-object-action-types). + +| Field | Type | Associated Action Types | Description | Constraints | +|------------------|-----------|-------------------------|----------------------------------------------------------------------------------------|--------------------------------------| +| channel_id | snowflake | SEND_ALERT_MESSAGE | channel to which user content should be logged | existing channel | +| duration_seconds | integer | TIMEOUT | timeout duration in seconds | maximum of 2419200 seconds (4 weeks) | +| custom_message? | string | BLOCK_MESSAGE | additional explanation that will be shown to members whenever their message is blocked | maximum of 150 characters | + + +### Auto Moderation Permission Requirements + +Users are required to have the `MANAGE_GUILD` permission to access all Auto Moderation resources. +Some [action types](/developers/docs/resources/auto-moderation#auto-moderation-action-object-action-types) require additional permissions, e.g. the `TIMEOUT` action type requires an additional `MODERATE_MEMBERS` permission. + +## List Auto Moderation Rules for Guild +/guilds/[\{guild.id\}](/developers/docs/resources/guild#guild-object)/auto-moderation/rules + +Get a list of all rules currently configured for the guild. Returns a list of [auto moderation rule](/developers/docs/resources/auto-moderation#auto-moderation-rule-object) objects for the given guild. + + +This endpoint requires the `MANAGE_GUILD` [permission](/developers/docs/resources/auto-moderation#auto-moderation-permission-requirements). + + +## Get Auto Moderation Rule +/guilds/[\{guild.id\}](/developers/docs/resources/guild#guild-object)/auto-moderation/rules/[\{auto_moderation_rule.id\}](/developers/docs/resources/auto-moderation#auto-moderation-rule-object) + +Get a single rule. Returns an [auto moderation rule](/developers/docs/resources/auto-moderation#auto-moderation-rule-object) object. + + +This endpoint requires the `MANAGE_GUILD` [permission](/developers/docs/resources/auto-moderation#auto-moderation-permission-requirements). + + +## Create Auto Moderation Rule +/guilds/[\{guild.id\}](/developers/docs/resources/guild#guild-object)/auto-moderation/rules + +Create a new rule. Returns an [auto moderation rule](/developers/docs/resources/auto-moderation#auto-moderation-rule-object) on success. Fires an [Auto Moderation Rule Create](/developers/docs/events/gateway-events#auto-moderation-rule-create) Gateway event. + + +This endpoint requires the `MANAGE_GUILD` [permission](/developers/docs/resources/auto-moderation#auto-moderation-permission-requirements). + + + +This endpoint supports the `X-Audit-Log-Reason` header. + + + +###### JSON Params + +| Field | Type | Description | +|---------------------|-----------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------| +| name | string | the rule name | +| event_type | integer | the [event type](/developers/docs/resources/auto-moderation#auto-moderation-rule-object-event-types) | +| trigger_type | integer | the [trigger type](/developers/docs/resources/auto-moderation#auto-moderation-rule-object-trigger-types) | +| trigger_metadata? * | object | the [trigger metadata](/developers/docs/resources/auto-moderation#auto-moderation-rule-object-trigger-metadata) | +| actions | array of [action](/developers/docs/resources/auto-moderation#auto-moderation-action-object) objects | the actions which will execute when the rule is triggered | +| enabled? | boolean | whether the rule is enabled (False by default) | +| exempt_roles? | array of snowflakes | the role ids that should not be affected by the rule (Maximum of 20) | + +\* Can be omitted based on `trigger_type`. See the `Associated Trigger Types` column in [trigger metadata](/developers/docs/resources/auto-moderation#auto-moderation-rule-object-trigger-metadata) to understand which `trigger_type` values require `trigger_metadata` to be set. + + +See [Trigger Types](/developers/docs/resources/auto-moderation#auto-moderation-rule-object-trigger-types) for limits on how many rules of each trigger type can be created per guild. + + + +## Modify Auto Moderation Rule +/guilds/[\{guild.id\}](/developers/docs/resources/guild#guild-object)/auto-moderation/rules/[\{auto_moderation_rule.id\}](/developers/docs/resources/auto-moderation#auto-moderation-rule-object) + +Modify an existing rule. Returns an [auto moderation rule](/developers/docs/resources/auto-moderation#auto-moderation-rule-object) on success. Fires an [Auto Moderation Rule Update](/developers/docs/events/gateway-events#auto-moderation-rule-update) Gateway event. + + +Requires `MANAGE_GUILD` [permissions](/developers/docs/resources/auto-moderation#auto-moderation-permission-requirements). + + + +All parameters for this endpoint are optional. + + + +This endpoint supports the `X-Audit-Log-Reason` header. + + + +###### JSON Params + +| Field | Type | Description | +|---------------------|-----------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------| +| name | string | the rule name | +| event_type | integer | the [event type](/developers/docs/resources/auto-moderation#auto-moderation-rule-object-event-types) | +| trigger_metadata? * | object | the [trigger metadata](/developers/docs/resources/auto-moderation#auto-moderation-rule-object-trigger-metadata) | +| actions | array of [action](/developers/docs/resources/auto-moderation#auto-moderation-action-object) objects | the actions which will execute when the rule is triggered | +| enabled | boolean | whether the rule is enabled | +| exempt_roles | array of snowflakes | the role ids that should not be affected by the rule (Maximum of 20) | +| exempt_channels | array of snowflakes | the channel ids that should not be affected by the rule (Maximum of 50) | + +\* Can be omitted based on `trigger_type`. See the `Associated Trigger Types` column in [trigger metadata](/developers/docs/resources/auto-moderation#auto-moderation-rule-object-trigger-metadata) to understand which `trigger_type` values require `trigger_metadata` to be set. + +## Delete Auto Moderation Rule +/guilds/[\{guild.id\}](/developers/docs/resources/guild#guild-object)/auto-moderation/rules/[\{auto_moderation_rule.id\}](/developers/docs/resources/auto-moderation#auto-moderation-rule-object) + +Delete a rule. Returns a `204` on success. Fires an [Auto Moderation Rule Delete](/developers/docs/events/gateway-events#auto-moderation-rule-delete) Gateway event. + + +This endpoint requires the `MANAGE_GUILD` [permission](/developers/docs/resources/auto-moderation#auto-moderation-permission-requirements). + + + +This endpoint supports the `X-Audit-Log-Reason` header. + diff --git a/docs/resources/channel.mdx b/discord/developers/docs/resources/channel.mdx similarity index 51% rename from docs/resources/channel.mdx rename to discord/developers/docs/resources/channel.mdx index 3c24375367..c7b05b14fe 100644 --- a/docs/resources/channel.mdx +++ b/discord/developers/docs/resources/channel.mdx @@ -1,62 +1,68 @@ --- -sidebar_label: Channel +title: Channel Resource +sidebarTitle: Channel +description: Reference for Discord channel objects and management endpoints. --- -# Channels Resource +import {ManualAnchor} from '/snippets/manualanchor.jsx' + +import {Route} from '/snippets/route.jsx' ### Channel Object Represents a guild or DM channel within Discord. + ###### Channel Structure -| Field | Type | Description | -|-------------------------------------|-----------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| -| id | snowflake | the id of this channel | -| type | integer | the [type of channel](/docs/resources/channel#channel-object-channel-types) | -| guild_id? | snowflake | the id of the guild (may be missing for some channel objects received over gateway guild dispatches) | -| position? | integer | sorting position of the channel (channels with the same position are sorted by id) | -| permission_overwrites? | array of [overwrite](/docs/resources/channel#overwrite-object) objects | explicit permission overwrites for members and roles | -| name? | ?string | the name of the channel (1-100 characters) | -| topic? | ?string | the channel topic (0-4096 characters for `GUILD_FORUM` and `GUILD_MEDIA` channels, 0-1024 characters for all others) | -| nsfw? | boolean | whether the channel is nsfw | -| last_message_id? | ?snowflake | the id of the last message sent in this channel (or thread for `GUILD_FORUM` or `GUILD_MEDIA` channels) (may not point to an existing or valid message or thread) | -| bitrate? | integer | the bitrate (in bits) of the voice channel | -| user_limit? | integer | the user limit of the voice channel | -| rate_limit_per_user?\* | integer | amount of seconds a user has to wait before sending another message (0-21600); bots, as well as users with the permission `manage_messages` or `manage_channel`, are unaffected | -| recipients? | array of [user](/docs/resources/user#user-object) objects | the recipients of the DM | -| icon? | ?string | icon hash of the group DM | -| owner_id? | snowflake | id of the creator of the group DM or thread | -| application_id? | snowflake | application id of the group DM creator if it is bot-created | -| managed? | boolean | for group DM channels: whether the channel is managed by an application via the `gdm.join` OAuth2 scope | -| parent_id? | ?snowflake | for guild channels: id of the parent category for a channel (each parent category can contain up to 50 channels), for threads: id of the text channel this thread was created | -| last_pin_timestamp? | ?ISO8601 timestamp | when the last pinned message was pinned. This may be `null` in events such as `GUILD_CREATE` when a message is not pinned. | -| rtc_region? | ?string | [voice region](/docs/resources/voice#voice-region-object) id for the voice channel, automatic when set to null | -| video_quality_mode? | integer | the camera [video quality mode](/docs/resources/channel#channel-object-video-quality-modes) of the voice channel, 1 when not present | -| message_count?\*\* | integer | number of messages (not including the initial message or deleted messages) in a thread. | -| member_count? | integer | an approximate count of users in a thread, stops counting at 50 | -| thread_metadata? | a [thread metadata](/docs/resources/channel#thread-metadata-object) object | thread-specific fields not needed by other channels | -| member? | a [thread member](/docs/resources/channel#thread-member-object) object | thread member object for the current user, if they have joined the thread, only included on certain API endpoints | -| default_auto_archive_duration? | integer | default duration, copied onto newly created threads, in minutes, threads will stop showing in the channel list after the specified period of inactivity, can be set to: 60, 1440, 4320, 10080 | -| permissions? | string | computed permissions for the invoking user in the channel, including overwrites, only included when part of the `resolved` data received on an interaction. This does not include [implicit permissions](/docs/topics/permissions#implicit-permissions), which may need to be checked separately | -| flags? | integer | [channel flags](/docs/resources/channel#channel-object-channel-flags) combined as a [bitfield](https://en.wikipedia.org/wiki/Bit_field) | -| total_message_sent? | integer | number of messages ever sent in a thread, it's similar to `message_count` on message creation, but will not decrement the number when a message is deleted | -| available_tags? | array of [tag](/docs/resources/channel#forum-tag-object) objects | the set of tags that can be used in a `GUILD_FORUM` or a `GUILD_MEDIA` channel | -| applied_tags? | array of snowflakes | the IDs of the set of tags that have been applied to a thread in a `GUILD_FORUM` or a `GUILD_MEDIA` channel | -| default_reaction_emoji? | ?[default reaction](/docs/resources/channel#default-reaction-object) object | the emoji to show in the add reaction button on a thread in a `GUILD_FORUM` or a `GUILD_MEDIA` channel | -| default_thread_rate_limit_per_user? | integer | the initial `rate_limit_per_user` to set on newly created threads in a channel. this field is copied to the thread at creation time and does not live update. | -| default_sort_order? | ?integer | the [default sort order type](/docs/resources/channel#channel-object-sort-order-types) used to order posts in `GUILD_FORUM` and `GUILD_MEDIA` channels. Defaults to `null`, which indicates a preferred sort order hasn't been set by a channel admin | -| default_forum_layout? | integer | the [default forum layout view](/docs/resources/channel#channel-object-forum-layout-types) used to display posts in `GUILD_FORUM` channels. Defaults to `0`, which indicates a layout view has not been set by a channel admin | +| Field | Type | Description | +|-------------------------------------|----------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| id | snowflake | the id of this channel | +| type | integer | the [type of channel](/developers/docs/resources/channel#channel-object-channel-types) | +| guild_id? | snowflake | the id of the guild (may be missing for some channel objects received over gateway guild dispatches) | +| position? | integer | sorting position of the channel (channels with the same position are sorted by id) | +| permission_overwrites? | array of [overwrite](/developers/docs/resources/channel#overwrite-object) objects | explicit permission overwrites for members and roles | +| name? | ?string | the name of the channel (1-100 characters) | +| topic? | ?string | the channel topic (0-4096 characters for `GUILD_FORUM` and `GUILD_MEDIA` channels, 0-1024 characters for all others) | +| nsfw? | boolean | whether the channel is nsfw | +| last_message_id? | ?snowflake | the id of the last message sent in this channel (or thread for `GUILD_FORUM` or `GUILD_MEDIA` channels) (may not point to an existing or valid message or thread) | +| bitrate? | integer | the bitrate (in bits) of the voice channel | +| user_limit? | integer | the user limit of the voice channel | +| rate_limit_per_user?\* | integer | amount of seconds a user has to wait before sending another message (0-21600); bots, as well as users with the permission `manage_messages` or `manage_channel`, are unaffected | +| recipients? | array of [user](/developers/docs/resources/user#user-object) objects | the recipients of the DM | +| icon? | ?string | icon hash of the group DM | +| owner_id? | snowflake | id of the creator of the group DM or thread | +| application_id? | snowflake | application id of the group DM creator if it is bot-created | +| managed? | boolean | for group DM channels: whether the channel is managed by an application via the `gdm.join` OAuth2 scope | +| parent_id? | ?snowflake | for guild channels: id of the parent category for a channel (each parent category can contain up to 50 channels), for threads: id of the text channel this thread was created | +| last_pin_timestamp? | ?ISO8601 timestamp | when the last pinned message was pinned. This may be `null` in events such as `GUILD_CREATE` when a message is not pinned. | +| rtc_region? | ?string | [voice region](/developers/docs/resources/voice#voice-region-object) id for the voice channel, automatic when set to null | +| video_quality_mode? | integer | the camera [video quality mode](/developers/docs/resources/channel#channel-object-video-quality-modes) of the voice channel, 1 when not present | +| message_count?\*\* | integer | number of messages (not including the initial message or deleted messages) in a thread. | +| member_count? | integer | an approximate count of users in a thread, stops counting at 50 | +| thread_metadata? | a [thread metadata](/developers/docs/resources/channel#thread-metadata-object) object | thread-specific fields not needed by other channels | +| member? | a [thread member](/developers/docs/resources/channel#thread-member-object) object | thread member object for the current user, if they have joined the thread, only included on certain API endpoints | +| default_auto_archive_duration? | integer | default duration, copied onto newly created threads, in minutes, threads will stop showing in the channel list after the specified period of inactivity, can be set to: 60, 1440, 4320, 10080 | +| permissions? | string | computed permissions for the invoking user in the channel, including overwrites, only included when part of the `resolved` data received on an interaction. This does not include [implicit permissions](/developers/docs/topics/permissions#implicit-permissions), which may need to be checked separately | +| flags? | integer | [channel flags](/developers/docs/resources/channel#channel-object-channel-flags) combined as a [bitfield](https://en.wikipedia.org/wiki/Bit_field) | +| total_message_sent? | integer | number of messages ever sent in a thread, it's similar to `message_count` on message creation, but will not decrement the number when a message is deleted | +| available_tags? | array of [tag](/developers/docs/resources/channel#forum-tag-object) objects | the set of tags that can be used in a `GUILD_FORUM` or a `GUILD_MEDIA` channel | +| applied_tags? | array of snowflakes | the IDs of the set of tags that have been applied to a thread in a `GUILD_FORUM` or a `GUILD_MEDIA` channel | +| default_reaction_emoji? | ?[default reaction](/developers/docs/resources/channel#default-reaction-object) object | the emoji to show in the add reaction button on a thread in a `GUILD_FORUM` or a `GUILD_MEDIA` channel | +| default_thread_rate_limit_per_user? | integer | the initial `rate_limit_per_user` to set on newly created threads in a channel. this field is copied to the thread at creation time and does not live update. | +| default_sort_order? | ?integer | the [default sort order type](/developers/docs/resources/channel#channel-object-sort-order-types) used to order posts in `GUILD_FORUM` and `GUILD_MEDIA` channels. Defaults to `null`, which indicates a preferred sort order hasn't been set by a channel admin | +| default_forum_layout? | integer | the [default forum layout view](/developers/docs/resources/channel#channel-object-forum-layout-types) used to display posts in `GUILD_FORUM` channels. Defaults to `0`, which indicates a layout view has not been set by a channel admin | \* `rate_limit_per_user` also applies to thread creation. Users can send one message and create one thread during each `rate_limit_per_user` interval. \*\* For threads created before July 1, 2022, the message count is inaccurate when it's greater than 50. + ###### Channel Types -:::warn + Type 10, 11 and 12 are only available in API v9 and above. -::: + | Type | ID | Description | |---------------------|----|------------------------------------------------------------------------------------------------------------------------------------------------------------| @@ -76,6 +82,7 @@ Type 10, 11 and 12 are only available in API v9 and above. \* The `GUILD_MEDIA` channel type is still in active development. Avoid implementing any features that are not documented here, since they are subject to change without notice! + ###### Video Quality Modes | Mode | Value | Description | @@ -83,6 +90,7 @@ Type 10, 11 and 12 are only available in API v9 and above. | AUTO | 1 | Discord chooses the quality for optimal performance | | FULL | 2 | 720p | + ###### Channel Flags | Flag | Value | Description | @@ -91,6 +99,7 @@ Type 10, 11 and 12 are only available in API v9 and above. | REQUIRE_TAG | `1 << 4` | whether a tag is required to be specified when creating a thread in a `GUILD_FORUM` or a `GUILD_MEDIA` channel. Tags are specified in the `applied_tags` field. | | HIDE_MEDIA_DOWNLOAD_OPTIONS | `1 << 15` | when set hides the embedded media download options. Available only for media channels | + ###### Sort Order Types | Flag | Value | Description | @@ -98,6 +107,7 @@ Type 10, 11 and 12 are only available in API v9 and above. | LATEST_ACTIVITY | 0 | Sort forum posts by activity | | CREATION_DATE | 1 | Sort forum posts by creation time (from most recent to oldest) | + ###### Forum Layout Types | Flag | Value | Description | @@ -106,6 +116,7 @@ Type 10, 11 and 12 are only available in API v9 and above. | LIST_VIEW | 1 | Display posts as a list | | GALLERY_VIEW | 2 | Display posts as a collection of tiles | + ###### Example Guild Text Channel ```json @@ -125,6 +136,7 @@ Type 10, 11 and 12 are only available in API v9 and above. } ``` + ###### Example Guild Announcement Channel Bots can post or publish messages in this type of channel if they have the proper permissions. @@ -145,6 +157,7 @@ Bots can post or publish messages in this type of channel if they have the prope } ``` + ###### Example Guild Voice Channel ```json @@ -165,6 +178,7 @@ Bots can post or publish messages in this type of channel if they have the prope } ``` + ###### Example DM Channel ```json @@ -183,6 +197,7 @@ Bots can post or publish messages in this type of channel if they have the prope } ``` + ###### Example Group DM Channel ```json @@ -210,6 +225,7 @@ Bots can post or publish messages in this type of channel if they have the prope } ``` + ###### Example Channel Category ```json @@ -225,17 +241,18 @@ Bots can post or publish messages in this type of channel if they have the prope } ``` + ###### Example Thread Channel -[Threads](/docs/topics/threads) can be either `archived` or `active`. Archived threads are generally immutable. To send a message or add a reaction, a thread must first be unarchived. The API will helpfully automatically unarchive a thread when sending a message in that thread. +[Threads](/developers/docs/topics/threads) can be either `archived` or `active`. Archived threads are generally immutable. To send a message or add a reaction, a thread must first be unarchived. The API will helpfully automatically unarchive a thread when sending a message in that thread. -Unlike with channels, the API will only sync updates to users about threads the current user can view. When receiving a [guild create](/docs/events/gateway-events#guild-create) payload, the API will only include active threads the current user can view. Threads inside of private channels are completely private to the members of that private channel. As such, when _gaining_ access to a channel the API sends a [thread list sync](/docs/events/gateway-events#thread-list-sync), which includes all active threads in that channel. +Unlike with channels, the API will only sync updates to users about threads the current user can view. When receiving a [guild create](/developers/docs/events/gateway-events#guild-create) payload, the API will only include active threads the current user can view. Threads inside of private channels are completely private to the members of that private channel. As such, when _gaining_ access to a channel the API sends a [thread list sync](/developers/docs/events/gateway-events#thread-list-sync), which includes all active threads in that channel. Threads also track membership. Users must be added to a thread before sending messages in them. The API will helpfully automatically add users to a thread when sending a message in that thread. Guilds have limits on the number of active threads and members per thread. Once these are reached additional threads cannot be created or unarchived, and users cannot be added. Threads do not count against the per-guild channel limit. -The [threads](/docs/topics/threads) topic has some more information. +The [threads](/developers/docs/topics/threads) topic has some more information. ```json { @@ -261,6 +278,7 @@ The [threads](/docs/topics/threads) topic has some more information. ### Followed Channel Object + ###### Followed Channel Structure | Field | Type | Description | @@ -270,8 +288,9 @@ The [threads](/docs/topics/threads) topic has some more information. ### Overwrite Object -See [permissions](/docs/topics/permissions#permissions) for more information about the `allow` and `deny` fields. +See [permissions](/developers/docs/topics/permissions) for more information about the `allow` and `deny` fields. + ###### Overwrite Structure | Field | Type | Description | @@ -285,6 +304,7 @@ See [permissions](/docs/topics/permissions#permissions) for more information abo The thread metadata object contains a number of thread-specific channel fields that are not needed by other channel types. + ###### Thread Metadata Structure | Field | Type | Description | @@ -300,24 +320,26 @@ The thread metadata object contains a number of thread-specific channel fields t A thread member object contains information about a user that has joined a thread. + ###### Thread Member Structure -| Field | Type | Description | -|-----------------|------------------------------------------------------------------|-----------------------------------------------------------------| -| id? \* | snowflake | ID of the thread | -| user_id? \* | snowflake | ID of the user | -| join_timestamp | ISO8601 timestamp | Time the user last joined the thread | -| flags | integer | Any user-thread settings, currently only used for notifications | -| member? \* \*\* | [guild member](/docs/resources/guild#guild-member-object) object | Additional information about the user | +| Field | Type | Description | +|-----------------|-----------------------------------------------------------------------------|-----------------------------------------------------------------| +| id? \* | snowflake | ID of the thread | +| user_id? \* | snowflake | ID of the user | +| join_timestamp | ISO8601 timestamp | Time the user last joined the thread | +| flags | integer | Any user-thread settings, currently only used for notifications | +| member? \* \*\* | [guild member](/developers/docs/resources/guild#guild-member-object) object | Additional information about the user | -\* These fields are omitted on the member sent within each thread in the [GUILD_CREATE](/docs/events/gateway-events#guild-create) event. +\* These fields are omitted on the member sent within each thread in the [GUILD_CREATE](/developers/docs/events/gateway-events#guild-create) event. -\*\* The `member` field is only present when `with_member` is set to `true` when calling [List Thread Members](/docs/resources/channel#list-thread-members) or [Get Thread Member](/docs/resources/channel#get-thread-member). +\*\* The `member` field is only present when `with_member` is set to `true` when calling [List Thread Members](/developers/docs/resources/channel#list-thread-members) or [Get Thread Member](/developers/docs/resources/channel#get-thread-member). ### Default Reaction Object An object that specifies the emoji to use as the default way to react to a forum post. Exactly one of `emoji_id` and `emoji_name` must be set. + ###### Default Reaction Structure | Field | Type | Description | @@ -329,11 +351,12 @@ An object that specifies the emoji to use as the default way to react to a forum An object that represents a tag that is able to be applied to a thread in a `GUILD_FORUM` or `GUILD_MEDIA` channel. + ###### Forum Tag Structure -:::info + When updating a `GUILD_FORUM` or a `GUILD_MEDIA` channel, tag objects in `available_tags` only require the `name` field. -::: + | Field | Type | Description | |------------|------------|----------------------------------------------------------------------------------------------------------------| @@ -346,105 +369,109 @@ When updating a `GUILD_FORUM` or a `GUILD_MEDIA` channel, tag objects in `availa \* At most one of `emoji_id` and `emoji_name` may be set to a non-null value. ## Get Channel -/channels/[\{channel.id\}](/docs/resources/channel#channel-object) +/channels/[\{channel.id\}](/developers/docs/resources/channel#channel-object) -Get a channel by ID. Returns a [channel](/docs/resources/channel#channel-object) object. If the channel is a thread, a [thread member](/docs/resources/channel#thread-member-object) object is included in the returned result. +Get a channel by ID. Returns a [channel](/developers/docs/resources/channel#channel-object) object. If the channel is a thread, a [thread member](/developers/docs/resources/channel#thread-member-object) object is included in the returned result. ## Modify Channel -/channels/[\{channel.id\}](/docs/resources/channel#channel-object) +/channels/[\{channel.id\}](/developers/docs/resources/channel#channel-object) -Update a channel's settings. Returns a [channel](/docs/resources/channel#channel-object) on success, and a 400 BAD REQUEST on invalid parameters. +Update a channel's settings. Returns a [channel](/developers/docs/resources/channel#channel-object) on success, and a 400 BAD REQUEST on invalid parameters. -:::info + All parameters to this endpoint are optional -::: + -:::info + This endpoint supports the `X-Audit-Log-Reason` header. -::: + + ###### JSON Params (Group DM) -Fires a [Channel Update](/docs/events/gateway-events#channel-update) Gateway event. +Fires a [Channel Update](/developers/docs/events/gateway-events#channel-update) Gateway event. | Field | Type | Description | |-------|--------|------------------------------| | name | string | 1-100 character channel name | | icon | binary | base64 encoded icon | + ###### JSON Params (Guild channel) -Requires the `MANAGE_CHANNELS` permission for the guild. Fires a [Channel Update](/docs/events/gateway-events#channel-update) Gateway event. If modifying a category, individual [Channel Update](/docs/events/gateway-events#channel-update) events will fire for each child channel that also changes. If modifying permission overwrites, the `MANAGE_ROLES` permission is required. Only permissions your bot has in the guild or parent channel (if applicable) can be allowed/denied (unless your bot has a `MANAGE_ROLES` overwrite in the channel). - -| Field | Type | Description | Channel Type | -|------------------------------------|---------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|------------------------------------------------| -| name | string | 1-100 character channel name | All | -| type | integer | the [type of channel](/docs/resources/channel#channel-object-channel-types); only conversion between text and announcement is supported and only in guilds with the "NEWS" feature | Text, Announcement | -| position | ?integer | the position of the channel in the left-hand listing (channels with the same position are sorted by id) | All | -| topic | ?string | 0-1024 character channel topic (0-4096 characters for `GUILD_FORUM` and `GUILD_MEDIA` channels) | Text, Announcement, Forum, Media | -| nsfw | ?boolean | whether the channel is nsfw | Text, Voice, Announcement, Stage, Forum, Media | -| rate_limit_per_user | ?integer | amount of seconds a user has to wait before sending another message (0-21600); bots, as well as users with the permission `manage_messages` or `manage_channel`, are unaffected | Text, Voice, Stage, Forum, Media | -| bitrate\* | ?integer | the bitrate (in bits) of the voice or stage channel; min 8000 | Voice, Stage | -| user_limit | ?integer | the user limit of the voice or stage channel, max 99 for voice channels and 10,000 for stage channels (0 refers to no limit) | Voice, Stage | -| permission_overwrites\*\* | ?array of partial [overwrite](/docs/resources/channel#overwrite-object) objects | channel or category-specific permissions | All | -| parent_id | ?snowflake | id of the new parent category for a channel | Text, Voice, Announcement, Stage, Forum, Media | -| rtc_region | ?string | channel [voice region](/docs/resources/voice#voice-region-object) id, automatic when set to null | Voice, Stage | -| video_quality_mode | ?integer | the camera [video quality mode](/docs/resources/channel#channel-object-video-quality-modes) of the voice channel | Voice, Stage | -| default_auto_archive_duration | ?integer | the default duration that the clients use (not the API) for newly created threads in the channel, in minutes, to automatically archive the thread after recent activity | Text, Announcement, Forum, Media | -| flags | integer | [channel flags](/docs/resources/channel#channel-object-channel-flags) combined as a [bitfield](https://en.wikipedia.org/wiki/Bit_field). Currently only `REQUIRE_TAG` (`1 << 4`) is supported by `GUILD_FORUM` and `GUILD_MEDIA` channels. `HIDE_MEDIA_DOWNLOAD_OPTIONS` (`1 << 15`) is supported only by `GUILD_MEDIA` channels | Forum, Media | -| available_tags | array of [tag](/docs/resources/channel#forum-tag-object) objects | the set of tags that can be used in a `GUILD_FORUM` or a `GUILD_MEDIA` channel; limited to 20 | Forum, Media | -| default_reaction_emoji | ?[default reaction](/docs/resources/channel#default-reaction-object) object | the emoji to show in the add reaction button on a thread in a `GUILD_FORUM` or a `GUILD_MEDIA` channel | Forum, Media | -| default_thread_rate_limit_per_user | integer | the initial `rate_limit_per_user` to set on newly created threads in a channel. this field is copied to the thread at creation time and does not live update. | Text, Forum, Media | -| default_sort_order | ?integer | the [default sort order type](/docs/resources/channel#channel-object-sort-order-types) used to order posts in `GUILD_FORUM` and `GUILD_MEDIA` channels | Forum, Media | -| default_forum_layout | integer | the [default forum layout type](/docs/resources/channel#channel-object-forum-layout-types) used to display posts in `GUILD_FORUM` channels | Forum | - -\* For voice channels, normal servers can set bitrate up to 96000, servers with Boost level 1 can set up to 128000, servers with Boost level 2 can set up to 256000, and servers with Boost level 3 or the `VIP_REGIONS` [guild feature](/docs/resources/guild#guild-object-guild-features) can set up to 384000. For stage channels, bitrate can be set up to 64000. +Requires the `MANAGE_CHANNELS` permission for the guild. Fires a [Channel Update](/developers/docs/events/gateway-events#channel-update) Gateway event. If modifying a category, individual [Channel Update](/developers/docs/events/gateway-events#channel-update) events will fire for each child channel that also changes. If modifying permission overwrites, the `MANAGE_ROLES` permission is required. Only permissions your bot has in the guild or parent channel (if applicable) can be allowed/denied (unless your bot has a `MANAGE_ROLES` overwrite in the channel). + +| Field | Type | Description | Channel Type | +|------------------------------------|--------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|------------------------------------------------| +| name | string | 1-100 character channel name | All | +| type | integer | the [type of channel](/developers/docs/resources/channel#channel-object-channel-types); only conversion between text and announcement is supported and only in guilds with the "NEWS" feature | Text, Announcement | +| position | ?integer | the position of the channel in the left-hand listing (channels with the same position are sorted by id) | All | +| topic | ?string | 0-1024 character channel topic (0-4096 characters for `GUILD_FORUM` and `GUILD_MEDIA` channels) | Text, Announcement, Forum, Media | +| nsfw | ?boolean | whether the channel is nsfw | Text, Voice, Announcement, Stage, Forum, Media | +| rate_limit_per_user | ?integer | amount of seconds a user has to wait before sending another message (0-21600); bots, as well as users with the permission `manage_messages` or `manage_channel`, are unaffected | Text, Voice, Stage, Forum, Media | +| bitrate\* | ?integer | the bitrate (in bits) of the voice or stage channel; min 8000 | Voice, Stage | +| user_limit | ?integer | the user limit of the voice or stage channel, max 99 for voice channels and 10,000 for stage channels (0 refers to no limit) | Voice, Stage | +| permission_overwrites\*\* | ?array of partial [overwrite](/developers/docs/resources/channel#overwrite-object) objects | channel or category-specific permissions | All | +| parent_id | ?snowflake | id of the new parent category for a channel | Text, Voice, Announcement, Stage, Forum, Media | +| rtc_region | ?string | channel [voice region](/developers/docs/resources/voice#voice-region-object) id, automatic when set to null | Voice, Stage | +| video_quality_mode | ?integer | the camera [video quality mode](/developers/docs/resources/channel#channel-object-video-quality-modes) of the voice channel | Voice, Stage | +| default_auto_archive_duration | ?integer | the default duration that the clients use (not the API) for newly created threads in the channel, in minutes, to automatically archive the thread after recent activity | Text, Announcement, Forum, Media | +| flags | integer | [channel flags](/developers/docs/resources/channel#channel-object-channel-flags) combined as a [bitfield](https://en.wikipedia.org/wiki/Bit_field). Currently only `REQUIRE_TAG` (`1 << 4`) is supported by `GUILD_FORUM` and `GUILD_MEDIA` channels. `HIDE_MEDIA_DOWNLOAD_OPTIONS` (`1 << 15`) is supported only by `GUILD_MEDIA` channels | Forum, Media | +| available_tags | array of [tag](/developers/docs/resources/channel#forum-tag-object) objects | the set of tags that can be used in a `GUILD_FORUM` or a `GUILD_MEDIA` channel; limited to 20 | Forum, Media | +| default_reaction_emoji | ?[default reaction](/developers/docs/resources/channel#default-reaction-object) object | the emoji to show in the add reaction button on a thread in a `GUILD_FORUM` or a `GUILD_MEDIA` channel | Forum, Media | +| default_thread_rate_limit_per_user | integer | the initial `rate_limit_per_user` to set on newly created threads in a channel. this field is copied to the thread at creation time and does not live update. | Text, Forum, Media | +| default_sort_order | ?integer | the [default sort order type](/developers/docs/resources/channel#channel-object-sort-order-types) used to order posts in `GUILD_FORUM` and `GUILD_MEDIA` channels | Forum, Media | +| default_forum_layout | integer | the [default forum layout type](/developers/docs/resources/channel#channel-object-forum-layout-types) used to display posts in `GUILD_FORUM` channels | Forum | + +\* For voice channels, normal servers can set bitrate up to 96000, servers with Boost level 1 can set up to 128000, servers with Boost level 2 can set up to 256000, and servers with Boost level 3 or the `VIP_REGIONS` [guild feature](/developers/docs/resources/guild#guild-object-guild-features) can set up to 384000. For stage channels, bitrate can be set up to 64000. \*\* In each overwrite object, the `allow` and `deny` keys can be omitted or set to `null`, which both default to `"0"`. + ###### JSON Params (Thread) When setting `archived` to `false`, when `locked` is also `false`, only the `SEND_MESSAGES` permission is required. -Otherwise, requires the `MANAGE_THREADS` permission. Fires a [Thread Update](/docs/events/gateway-events#thread-update) Gateway event. Requires the thread to have `archived` set to `false` or be set to `false` in the request. +Otherwise, requires the `MANAGE_THREADS` permission. Fires a [Thread Update](/developers/docs/events/gateway-events#thread-update) Gateway event. Requires the thread to have `archived` set to `false` or be set to `false` in the request. -| Field | Type | Description | -|-----------------------|---------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| -| name | string | 1-100 character channel name | -| archived | boolean | whether the thread is archived | -| auto_archive_duration | integer | the thread will stop showing in the channel list after `auto_archive_duration` minutes of inactivity, can be set to: 60, 1440, 4320, 10080 | -| locked | boolean | whether the thread is locked; when a thread is locked, only users with MANAGE_THREADS can unarchive it | -| invitable | boolean | whether non-moderators can add other non-moderators to a thread; only available on private threads | -| rate_limit_per_user | ?integer | amount of seconds a user has to wait before sending another message (0-21600); bots, as well as users with the permission `manage_messages`, `manage_thread`, or `manage_channel`, are unaffected | -| flags? | integer | [channel flags](/docs/resources/channel#channel-object-channel-flags) combined as a [bitfield](https://en.wikipedia.org/wiki/Bit_field); `PINNED` can only be set for threads in forum and media channels | -| applied_tags? | array of snowflakes | the IDs of the set of tags that have been applied to a thread in a `GUILD_FORUM` or a `GUILD_MEDIA` channel; limited to 5 | +| Field | Type | Description | +|-----------------------|---------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| name | string | 1-100 character channel name | +| archived | boolean | whether the thread is archived | +| auto_archive_duration | integer | the thread will stop showing in the channel list after `auto_archive_duration` minutes of inactivity, can be set to: 60, 1440, 4320, 10080 | +| locked | boolean | whether the thread is locked; when a thread is locked, only users with MANAGE_THREADS can unarchive it | +| invitable | boolean | whether non-moderators can add other non-moderators to a thread; only available on private threads | +| rate_limit_per_user | ?integer | amount of seconds a user has to wait before sending another message (0-21600); bots, as well as users with the permission `manage_messages`, `manage_thread`, or `manage_channel`, are unaffected | +| flags? | integer | [channel flags](/developers/docs/resources/channel#channel-object-channel-flags) combined as a [bitfield](https://en.wikipedia.org/wiki/Bit_field); `PINNED` can only be set for threads in forum and media channels | +| applied_tags? | array of snowflakes | the IDs of the set of tags that have been applied to a thread in a `GUILD_FORUM` or a `GUILD_MEDIA` channel; limited to 5 | ## Delete/Close Channel -/channels/[\{channel.id\}](/docs/resources/channel#channel-object) +/channels/[\{channel.id\}](/developers/docs/resources/channel#channel-object) -Delete a channel, or close a private message. Requires the `MANAGE_CHANNELS` permission for the guild, or `MANAGE_THREADS` if the channel is a thread. Deleting a category does not delete its child channels; they will have their `parent_id` removed and a [Channel Update](/docs/events/gateway-events#channel-update) Gateway event will fire for each of them. Returns a [channel](/docs/resources/channel#channel-object) object on success. Fires a [Channel Delete](/docs/events/gateway-events#channel-delete) Gateway event (or [Thread Delete](/docs/events/gateway-events#thread-delete) if the channel was a thread). +Delete a channel, or close a private message. Requires the `MANAGE_CHANNELS` permission for the guild, or `MANAGE_THREADS` if the channel is a thread. Deleting a category does not delete its child channels; they will have their `parent_id` removed and a [Channel Update](/developers/docs/events/gateway-events#channel-update) Gateway event will fire for each of them. Returns a [channel](/developers/docs/resources/channel#channel-object) object on success. Fires a [Channel Delete](/developers/docs/events/gateway-events#channel-delete) Gateway event (or [Thread Delete](/developers/docs/events/gateway-events#thread-delete) if the channel was a thread). -:::warn + Deleting a guild channel cannot be undone. Use this with caution, as it is impossible to undo this action when performed on a guild channel. In contrast, when used with a private message, it is possible to undo the action by opening a private message with the recipient again. -::: + -:::info + For Community guilds, the Rules or Guidelines channel and the Community Updates channel cannot be deleted. -::: + -:::info + This endpoint supports the `X-Audit-Log-Reason` header. -::: + ## Edit Channel Permissions -/channels/[\{channel.id\}](/docs/resources/channel#channel-object)/permissions/[\{overwrite.id\}](/docs/resources/channel#overwrite-object) +/channels/[\{channel.id\}](/developers/docs/resources/channel#channel-object)/permissions/[\{overwrite.id\}](/developers/docs/resources/channel#overwrite-object) -Edit the channel permission overwrites for a user or role in a channel. Only usable for guild channels. Requires the `MANAGE_ROLES` permission. Only permissions your bot has in the guild or parent channel (if applicable) can be allowed/denied (unless your bot has a `MANAGE_ROLES` overwrite in the channel). Returns a 204 empty response on success. Fires a [Channel Update](/docs/events/gateway-events#channel-update) Gateway event. For more information about permissions, see [permissions](/docs/topics/permissions#permissions). +Edit the channel permission overwrites for a user or role in a channel. Only usable for guild channels. Requires the `MANAGE_ROLES` permission. Only permissions your bot has in the guild or parent channel (if applicable) can be allowed/denied (unless your bot has a `MANAGE_ROLES` overwrite in the channel). Returns a 204 empty response on success. Fires a [Channel Update](/developers/docs/events/gateway-events#channel-update) Gateway event. For more information about permissions, see [permissions](/developers/docs/topics/permissions). -:::info + This endpoint supports the `X-Audit-Log-Reason` header. -::: + + ###### JSON Params | Field | Type | Description | @@ -454,19 +481,20 @@ This endpoint supports the `X-Audit-Log-Reason` header. | type | integer | 0 for a role or 1 for a member | ## Get Channel Invites -/channels/[\{channel.id\}](/docs/resources/channel#channel-object)/invites +/channels/[\{channel.id\}](/developers/docs/resources/channel#channel-object)/invites -Returns a list of [invite](/docs/resources/invite#invite-object) objects (with [invite metadata](/docs/resources/invite#invite-metadata-object)) for the channel. Only usable for guild channels. Requires the `MANAGE_CHANNELS` permission. +Returns a list of [invite](/developers/docs/resources/invite#invite-object) objects (with [invite metadata](/developers/docs/resources/invite#invite-metadata-object)) for the channel. Only usable for guild channels. Requires the `MANAGE_CHANNELS` permission. ## Create Channel Invite -/channels/[\{channel.id\}](/docs/resources/channel#channel-object)/invites +/channels/[\{channel.id\}](/developers/docs/resources/channel#channel-object)/invites -Create a new [invite](/docs/resources/invite#invite-object) object for the channel. Only usable for guild channels. Requires the `CREATE_INSTANT_INVITE` permission. All JSON parameters for this route are optional, however the request body is not. If you are not sending any fields, you still have to send an empty JSON object (`{}`). Returns an [invite](/docs/resources/invite#invite-object) object. Fires an [Invite Create](/docs/events/gateway-events#invite-create) Gateway event. +Create a new [invite](/developers/docs/resources/invite#invite-object) object for the channel. Only usable for guild channels. Requires the `CREATE_INSTANT_INVITE` permission. All JSON parameters for this route are optional, however the request body is not. If you are not sending any fields, you still have to send an empty JSON object (`{}`). Returns an [invite](/developers/docs/resources/invite#invite-object) object. Fires an [Invite Create](/developers/docs/events/gateway-events#invite-create) Gateway event. -:::info + This endpoint supports the `X-Audit-Log-Reason` header. -::: + + ###### JSON Params | Field | Type | Description | Default | @@ -475,28 +503,29 @@ This endpoint supports the `X-Audit-Log-Reason` header. | max_uses | integer | max number of uses or 0 for unlimited. between 0 and 100 | 0 | | temporary | boolean | whether this invite only grants temporary membership | false | | unique | boolean | if true, don't try to reuse a similar invite (useful for creating many unique one time use invites) | false | -| target_type | integer | the [type of target](/docs/resources/invite#invite-object-invite-target-types) for this voice channel invite | | +| target_type | integer | the [type of target](/developers/docs/resources/invite#invite-object-invite-target-types) for this voice channel invite | | | target_user_id | snowflake | the id of the user whose stream to display for this invite, required if `target_type` is 1, the user must be streaming in the channel | | | target_application_id | snowflake | the id of the embedded application to open for this invite, required if `target_type` is 2, the application must have the `EMBEDDED` flag | | ## Delete Channel Permission -/channels/[\{channel.id\}](/docs/resources/channel#channel-object)/permissions/[\{overwrite.id\}](/docs/resources/channel#overwrite-object) +/channels/[\{channel.id\}](/developers/docs/resources/channel#channel-object)/permissions/[\{overwrite.id\}](/developers/docs/resources/channel#overwrite-object) -Delete a channel permission overwrite for a user or role in a channel. Only usable for guild channels. Requires the `MANAGE_ROLES` permission. Returns a 204 empty response on success. Fires a [Channel Update](/docs/events/gateway-events#channel-update) Gateway event. For more information about permissions, see [permissions](/docs/topics/permissions#permissions) +Delete a channel permission overwrite for a user or role in a channel. Only usable for guild channels. Requires the `MANAGE_ROLES` permission. Returns a 204 empty response on success. Fires a [Channel Update](/developers/docs/events/gateway-events#channel-update) Gateway event. For more information about permissions, see [permissions](/developers/docs/topics/permissions) -:::info + This endpoint supports the `X-Audit-Log-Reason` header. -::: + ## Follow Announcement Channel -/channels/[\{channel.id\}](/docs/resources/channel#channel-object)/followers +/channels/[\{channel.id\}](/developers/docs/resources/channel#channel-object)/followers -Follow an Announcement Channel to send messages to a target channel. Requires the `MANAGE_WEBHOOKS` permission in the target channel. Returns a [followed channel](/docs/resources/channel#followed-channel-object) object. Fires a [Webhooks Update](/docs/events/gateway-events#webhooks-update) Gateway event for the target channel. +Follow an Announcement Channel to send messages to a target channel. Requires the `MANAGE_WEBHOOKS` permission in the target channel. Returns a [followed channel](/developers/docs/resources/channel#followed-channel-object) object. Fires a [Webhooks Update](/developers/docs/events/gateway-events#webhooks-update) Gateway event for the target channel. -:::info + This endpoint supports the `X-Audit-Log-Reason` header. -::: + + ###### JSON Params | Field | Type | Description | @@ -504,17 +533,18 @@ This endpoint supports the `X-Audit-Log-Reason` header. | webhook_channel_id | snowflake | id of target channel | ## Trigger Typing Indicator -/channels/[\{channel.id\}](/docs/resources/channel#channel-object)/typing +/channels/[\{channel.id\}](/developers/docs/resources/channel#channel-object)/typing -Post a typing indicator for the specified channel, which expires after 10 seconds. Returns a 204 empty response on success. Fires a [Typing Start](/docs/events/gateway-events#typing-start) Gateway event. +Post a typing indicator for the specified channel, which expires after 10 seconds. Returns a 204 empty response on success. Fires a [Typing Start](/developers/docs/events/gateway-events#typing-start) Gateway event. Generally bots should **not** use this route. However, if a bot is responding to a command and expects the computation to take a few seconds, this endpoint may be called to let the user know that the bot is processing their message. ## Group DM Add Recipient -/channels/[\{channel.id\}](/docs/resources/channel#channel-object)/recipients/[\{user.id\}](/docs/resources/user#user-object) +/channels/[\{channel.id\}](/developers/docs/resources/channel#channel-object)/recipients/[\{user.id\}](/developers/docs/resources/user#user-object) Adds a recipient to a Group DM using their access token. + ###### JSON Params | Field | Type | Description | @@ -523,21 +553,22 @@ Adds a recipient to a Group DM using their access token. | nick | string | nickname of the user being added | ## Group DM Remove Recipient -/channels/[\{channel.id\}](/docs/resources/channel#channel-object)/recipients/[\{user.id\}](/docs/resources/user#user-object) +/channels/[\{channel.id\}](/developers/docs/resources/channel#channel-object)/recipients/[\{user.id\}](/developers/docs/resources/user#user-object) Removes a recipient from a Group DM. ## Start Thread from Message -/channels/[\{channel.id\}](/docs/resources/channel#channel-object)/messages/[\{message.id\}](/docs/resources/message#message-object)/threads +/channels/[\{channel.id\}](/developers/docs/resources/channel#channel-object)/messages/[\{message.id\}](/developers/docs/resources/message#message-object)/threads -Creates a new thread from an existing message. Returns a [channel](/docs/resources/channel#channel-object) on success, and a 400 BAD REQUEST on invalid parameters. Fires a [Thread Create](/docs/events/gateway-events#thread-create) and a [Message Update](/docs/events/gateway-events#message-update) Gateway event. +Creates a new thread from an existing message. Returns a [channel](/developers/docs/resources/channel#channel-object) on success, and a 400 BAD REQUEST on invalid parameters. Fires a [Thread Create](/developers/docs/events/gateway-events#thread-create) and a [Message Update](/developers/docs/events/gateway-events#message-update) Gateway event. -When called on a `GUILD_TEXT` channel, creates a `PUBLIC_THREAD`. When called on a `GUILD_ANNOUNCEMENT` channel, creates a `ANNOUNCEMENT_THREAD`. Does not work on a [`GUILD_FORUM`](/docs/resources/channel#start-thread-in-forum-or-media-channel) or a `GUILD_MEDIA` channel. The id of the created thread will be the same as the id of the source message, and as such a message can only have a single thread created from it. +When called on a `GUILD_TEXT` channel, creates a `PUBLIC_THREAD`. When called on a `GUILD_ANNOUNCEMENT` channel, creates a `ANNOUNCEMENT_THREAD`. Does not work on a [`GUILD_FORUM`](/developers/docs/resources/channel#start-thread-in-forum-or-media-channel) or a `GUILD_MEDIA` channel. The id of the created thread will be the same as the id of the source message, and as such a message can only have a single thread created from it. -:::info + This endpoint supports the `X-Audit-Log-Reason` header. -::: + + ###### JSON Params | Field | Type | Description | @@ -547,140 +578,145 @@ This endpoint supports the `X-Audit-Log-Reason` header. | rate_limit_per_user? | ?integer | amount of seconds a user has to wait before sending another message (0-21600) | ## Start Thread without Message -/channels/[\{channel.id\}](/docs/resources/channel#channel-object)/threads +/channels/[\{channel.id\}](/developers/docs/resources/channel#channel-object)/threads -Creates a new thread that is not connected to an existing message. Returns a [channel](/docs/resources/channel#channel-object) on success, and a 400 BAD REQUEST on invalid parameters. Fires a [Thread Create](/docs/events/gateway-events#thread-create) Gateway event. +Creates a new thread that is not connected to an existing message. Returns a [channel](/developers/docs/resources/channel#channel-object) on success, and a 400 BAD REQUEST on invalid parameters. Fires a [Thread Create](/developers/docs/events/gateway-events#thread-create) Gateway event. -:::info + This endpoint supports the `X-Audit-Log-Reason` header. -::: + + ###### JSON Params | Field | Type | Description | |------------------------|----------|--------------------------------------------------------------------------------------------------------------------------------------------| | name | string | 1-100 character channel name | | auto_archive_duration? | integer | the thread will stop showing in the channel list after `auto_archive_duration` minutes of inactivity, can be set to: 60, 1440, 4320, 10080 | -| type?\* | integer | the [type of thread](/docs/resources/channel#channel-object-channel-types) to create | +| type?\* | integer | the [type of thread](/developers/docs/resources/channel#channel-object-channel-types) to create | | invitable? | boolean | whether non-moderators can add other non-moderators to a thread; only available when creating a private thread | | rate_limit_per_user? | ?integer | amount of seconds a user has to wait before sending another message (0-21600) | \* `type` currently defaults to `PRIVATE_THREAD` in order to match the behavior when thread documentation was first published. In a future API version this will be changed to be a required field, with no default. ## Start Thread in Forum or Media Channel -/channels/[\{channel.id\}](/docs/resources/channel#channel-object)/threads +/channels/[\{channel.id\}](/developers/docs/resources/channel#channel-object)/threads -Creates a new thread in a forum or a media channel, and sends a message within the created thread. Returns a [channel](/docs/resources/channel#channel-object), with a nested [message](/docs/resources/message#message-object) object, on success, and a 400 BAD REQUEST on invalid parameters. Fires a [Thread Create](/docs/events/gateway-events#thread-create) and [Message Create](/docs/events/gateway-events#message-create) Gateway event. +Creates a new thread in a forum or a media channel, and sends a message within the created thread. Returns a [channel](/developers/docs/resources/channel#channel-object), with a nested [message](/developers/docs/resources/message#message-object) object, on success, and a 400 BAD REQUEST on invalid parameters. Fires a [Thread Create](/developers/docs/events/gateway-events#thread-create) and [Message Create](/developers/docs/events/gateway-events#message-create) Gateway event. - The type of the created thread is `PUBLIC_THREAD`. -- See [message formatting](/docs/reference#message-formatting) for more information on how to properly format messages. +- See [message formatting](/developers/docs/reference#message-formatting) for more information on how to properly format messages. - The current user must have the `SEND_MESSAGES` permission (`CREATE_PUBLIC_THREADS` is ignored). - The maximum request size when sending a message is **25 MiB**. - For the embed object, you can set every field except `type` (it will be `rich` regardless of if you try to set it), `provider`, `video`, and any `height`, `width`, or `proxy_url` values for images. -- Examples for file uploads are available in [Uploading Files](/docs/reference#uploading-files). -- Files must be attached using a `multipart/form-data` body as described in [Uploading Files](/docs/reference#uploading-files). +- Examples for file uploads are available in [Uploading Files](/developers/docs/reference#uploading-files). +- Files must be attached using a `multipart/form-data` body as described in [Uploading Files](/developers/docs/reference#uploading-files). - Note that when sending a message, you must provide a value for at **least one of** `content`, `embeds`, `sticker_ids`, `components`, or `files[n]`. -:::warn + Discord may strip certain characters from message content, like invalid unicode characters or characters which cause unexpected message formatting. If you are passing user-generated strings into message content, consider sanitizing the data to prevent unexpected behavior and using `allowed_mentions` to prevent unexpected mentions. -::: + -:::info + This endpoint supports the `X-Audit-Log-Reason` header. -::: + + ###### JSON/Form Params -| Field | Type | Description | -|--------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------| -| name | string | 1-100 character channel name | -| auto_archive_duration?\* | integer | duration in minutes to automatically archive the thread after recent activity, can be set to: 60, 1440, 4320, 10080 | -| rate_limit_per_user? | ?integer | amount of seconds a user has to wait before sending another message (0-21600) | -| message | a [forum thread message params](/docs/resources/channel#start-thread-in-forum-or-media-channel-forum-and-media-thread-message-params-object) object | contents of the first message in the forum/media thread | -| applied_tags? | array of snowflakes | the IDs of the set of tags that have been applied to a thread in a `GUILD_FORUM` or a `GUILD_MEDIA` channel | -| files[n]?\* | file contents | Contents of the file being sent. See [Uploading Files](/docs/reference#uploading-files) | -| payload_json? | string | JSON-encoded body of non-file params, only for `multipart/form-data` requests. See [Uploading Files](/docs/reference#uploading-files) | - - +| Field | Type | Description | +|--------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------| +| name | string | 1-100 character channel name | +| auto_archive_duration?\* | integer | duration in minutes to automatically archive the thread after recent activity, can be set to: 60, 1440, 4320, 10080 | +| rate_limit_per_user? | ?integer | amount of seconds a user has to wait before sending another message (0-21600) | +| message | a [forum thread message params](/developers/docs/resources/channel#start-thread-in-forum-or-media-channel-forum-and-media-thread-message-params-object) object | contents of the first message in the forum/media thread | +| applied_tags? | array of snowflakes | the IDs of the set of tags that have been applied to a thread in a `GUILD_FORUM` or a `GUILD_MEDIA` channel | +| files[n]?\* | file contents | Contents of the file being sent. See [Uploading Files](/developers/docs/reference#uploading-files) | +| payload_json? | string | JSON-encoded body of non-file params, only for `multipart/form-data` requests. See [Uploading Files](/developers/docs/reference#uploading-files) | + + ###### Forum and Media Thread Message Params Object -:::info + When sending a message, apps must provide a value for **at least one of** `content`, `embeds`, `sticker_ids`, `components`, or `files[n]`. -::: - -| Field | Type | Description | -|-------------------|-----------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| -| content?\* | string | Message contents (up to 2000 characters) | -| embeds?\* | array of [embed](/docs/resources/message#embed-object) objects | Up to 10 `rich` embeds (up to 6000 characters) | -| allowed_mentions? | [allowed mention object](/docs/resources/message#allowed-mentions-object) | Allowed mentions for the message | -| components?\* | array of [message component](/docs/components/reference#component-object) objects | Components to include with the message | -| sticker_ids?\* | array of snowflakes | IDs of up to 3 [stickers](/docs/resources/sticker#sticker-object) in the server to send in the message | -| attachments? | array of partial [attachment](/docs/resources/message#attachment-object) objects | Attachment objects with `filename` and `description`. See [Uploading Files](/docs/reference#uploading-files) | -| flags? | integer | [Message flags](/docs/resources/message#message-object-message-flags) combined as a [bitfield](https://en.wikipedia.org/wiki/Bit_field) (only `SUPPRESS_EMBEDS` and `SUPPRESS_NOTIFICATIONS` can be set) | + + +| Field | Type | Description | +|-------------------|----------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| content?\* | string | Message contents (up to 2000 characters) | +| embeds?\* | array of [embed](/developers/docs/resources/message#embed-object) objects | Up to 10 `rich` embeds (up to 6000 characters) | +| allowed_mentions? | [allowed mention object](/developers/docs/resources/message#allowed-mentions-object) | Allowed mentions for the message | +| components?\* | array of [message component](/developers/docs/components/reference#component-object) objects | Components to include with the message | +| sticker_ids?\* | array of snowflakes | IDs of up to 3 [stickers](/developers/docs/resources/sticker#sticker-object) in the server to send in the message | +| attachments? | array of partial [attachment](/developers/docs/resources/message#attachment-object) objects | Attachment objects with `filename` and `description`. See [Uploading Files](/developers/docs/reference#uploading-files) | +| flags? | integer | [Message flags](/developers/docs/resources/message#message-object-message-flags) combined as a [bitfield](https://en.wikipedia.org/wiki/Bit_field) (only `SUPPRESS_EMBEDS` and `SUPPRESS_NOTIFICATIONS` can be set) | \* At least one of `content`, `embeds`, `sticker_ids`, `components`, or `files[n]` is required. ## Join Thread -/channels/[\{channel.id\}](/docs/resources/channel#channel-object)/thread-members/@me +/channels/[\{channel.id\}](/developers/docs/resources/channel#channel-object)/thread-members/@me -Adds the current user to a thread. Also requires the thread is not archived. Returns a 204 empty response on success. Fires a [Thread Members Update](/docs/events/gateway-events#thread-members-update) and a [Thread Create](/docs/events/gateway-events#thread-create) Gateway event. +Adds the current user to a thread. Also requires the thread is not archived. Returns a 204 empty response on success. Fires a [Thread Members Update](/developers/docs/events/gateway-events#thread-members-update) and a [Thread Create](/developers/docs/events/gateway-events#thread-create) Gateway event. ## Add Thread Member -/channels/[\{channel.id\}](/docs/resources/channel#channel-object)/thread-members/[\{user.id\}](/docs/resources/user#user-object) +/channels/[\{channel.id\}](/developers/docs/resources/channel#channel-object)/thread-members/[\{user.id\}](/developers/docs/resources/user#user-object) -Adds another member to a thread. Requires the ability to send messages in the thread. Also requires the thread is not archived. Returns a 204 empty response if the member is successfully added or was already a member of the thread. Fires a [Thread Members Update](/docs/events/gateway-events#thread-members-update) Gateway event. +Adds another member to a thread. Requires the ability to send messages in the thread. Also requires the thread is not archived. Returns a 204 empty response if the member is successfully added or was already a member of the thread. Fires a [Thread Members Update](/developers/docs/events/gateway-events#thread-members-update) Gateway event. ## Leave Thread -/channels/[\{channel.id\}](/docs/resources/channel#channel-object)/thread-members/@me +/channels/[\{channel.id\}](/developers/docs/resources/channel#channel-object)/thread-members/@me -Removes the current user from a thread. Also requires the thread is not archived. Returns a 204 empty response on success. Fires a [Thread Members Update](/docs/events/gateway-events#thread-members-update) Gateway event. +Removes the current user from a thread. Also requires the thread is not archived. Returns a 204 empty response on success. Fires a [Thread Members Update](/developers/docs/events/gateway-events#thread-members-update) Gateway event. ## Remove Thread Member -/channels/[\{channel.id\}](/docs/resources/channel#channel-object)/thread-members/[\{user.id\}](/docs/resources/user#user-object) +/channels/[\{channel.id\}](/developers/docs/resources/channel#channel-object)/thread-members/[\{user.id\}](/developers/docs/resources/user#user-object) -Removes another member from a thread. Requires the `MANAGE_THREADS` permission, or the creator of the thread if it is a `PRIVATE_THREAD`. Also requires the thread is not archived. Returns a 204 empty response on success. Fires a [Thread Members Update](/docs/events/gateway-events#thread-members-update) Gateway event. +Removes another member from a thread. Requires the `MANAGE_THREADS` permission, or the creator of the thread if it is a `PRIVATE_THREAD`. Also requires the thread is not archived. Returns a 204 empty response on success. Fires a [Thread Members Update](/developers/docs/events/gateway-events#thread-members-update) Gateway event. ## Get Thread Member -/channels/[\{channel.id\}](/docs/resources/channel#channel-object)/thread-members/[\{user.id\}](/docs/resources/user#user-object) +/channels/[\{channel.id\}](/developers/docs/resources/channel#channel-object)/thread-members/[\{user.id\}](/developers/docs/resources/user#user-object) -Returns a [thread member](/docs/resources/channel#thread-member-object) object for the specified user if they are a member of the thread, returns a 404 response otherwise. +Returns a [thread member](/developers/docs/resources/channel#thread-member-object) object for the specified user if they are a member of the thread, returns a 404 response otherwise. -When `with_member` is set to `true`, the thread member object will include a `member` field containing a [guild member](/docs/resources/guild#guild-member-object) object. +When `with_member` is set to `true`, the thread member object will include a `member` field containing a [guild member](/developers/docs/resources/guild#guild-member-object) object. + ###### Query String Params -| Field | Type | Description | -|--------------|--------------------------------------------------|-------------------------------------------------------------------------------------------------------------| -| with_member? | [boolean](/docs/reference#boolean-query-strings) | Whether to include a [guild member](/docs/resources/guild#guild-member-object) object for the thread member | +| Field | Type | Description | +|--------------|-------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------| +| with_member? | [boolean](/developers/docs/reference#boolean-query-strings) | Whether to include a [guild member](/developers/docs/resources/guild#guild-member-object) object for the thread member | ## List Thread Members -/channels/[\{channel.id\}](/docs/resources/channel#channel-object)/thread-members +/channels/[\{channel.id\}](/developers/docs/resources/channel#channel-object)/thread-members -:::warn -Starting in API v11, this endpoint will always return paginated results. Paginated results can be enabled before API v11 by setting `with_member` to `true`. Read [the changelog](/docs/change-log#thread-member-details-and-pagination) for details. -::: + +Starting in API v11, this endpoint will always return paginated results. Paginated results can be enabled before API v11 by setting `with_member` to `true`. Read [the changelog](/developers/docs/change-log#thread-member-details-and-pagination) for details. + -Returns array of [thread members](/docs/resources/channel#thread-member-object) objects that are members of the thread. +Returns array of [thread members](/developers/docs/resources/channel#thread-member-object) objects that are members of the thread. -When `with_member` is set to `true`, the results will be paginated and each thread member object will include a `member` field containing a [guild member](/docs/resources/guild#guild-member-object) object. +When `with_member` is set to `true`, the results will be paginated and each thread member object will include a `member` field containing a [guild member](/developers/docs/resources/guild#guild-member-object) object. -:::warn -This endpoint is restricted according to whether the `GUILD_MEMBERS` [Privileged Intent](/docs/events/gateway#privileged-intents) is enabled for your application. -::: + +This endpoint is restricted according to whether the `GUILD_MEMBERS` [Privileged Intent](/developers/docs/events/gateway#privileged-intents) is enabled for your application. + + ###### Query String Params -| Field | Type | Description | -|--------------|--------------------------------------------------|--------------------------------------------------------------------------------------------------------------| -| with_member? | [boolean](/docs/reference#boolean-query-strings) | Whether to include a [guild member](/docs/resources/guild#guild-member-object) object for each thread member | -| after? | snowflake | Get thread members after this user ID | -| limit? | integer | Max number of thread members to return (1-100). Defaults to 100. | +| Field | Type | Description | +|--------------|-------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------| +| with_member? | [boolean](/developers/docs/reference#boolean-query-strings) | Whether to include a [guild member](/developers/docs/resources/guild#guild-member-object) object for each thread member | +| after? | snowflake | Get thread members after this user ID | +| limit? | integer | Max number of thread members to return (1-100). Defaults to 100. | ## List Public Archived Threads -/channels/[\{channel.id\}](/docs/resources/channel#channel-object)/threads/archived/public +/channels/[\{channel.id\}](/developers/docs/resources/channel#channel-object)/threads/archived/public -Returns archived threads in the channel that are public. When called on a `GUILD_TEXT` channel, returns threads of [type](/docs/resources/channel#channel-object-channel-types) `PUBLIC_THREAD`. When called on a `GUILD_ANNOUNCEMENT` channel returns threads of [type](/docs/resources/channel#channel-object-channel-types) `ANNOUNCEMENT_THREAD`. Threads are ordered by `archive_timestamp`, in descending order. Requires the `READ_MESSAGE_HISTORY` permission. +Returns archived threads in the channel that are public. When called on a `GUILD_TEXT` channel, returns threads of [type](/developers/docs/resources/channel#channel-object-channel-types) `PUBLIC_THREAD`. When called on a `GUILD_ANNOUNCEMENT` channel returns threads of [type](/developers/docs/resources/channel#channel-object-channel-types) `ANNOUNCEMENT_THREAD`. Threads are ordered by `archive_timestamp`, in descending order. Requires the `READ_MESSAGE_HISTORY` permission. + ###### Query String Params | Field | Type | Description | @@ -688,19 +724,21 @@ Returns archived threads in the channel that are public. When called on a `GUILD | before? | ISO8601 timestamp | returns threads archived before this timestamp | | limit? | integer | optional maximum number of threads to return | + ###### Response Body -| Field | Type | Description | -|----------|---------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------| -| threads | array of [channel](/docs/resources/channel#channel-object) objects | the public, archived threads | -| members | array of [thread members](/docs/resources/channel#thread-member-object) objects | a thread member object for each returned thread the current user has joined | -| has_more | boolean | whether there are potentially additional threads that could be returned on a subsequent call | +| Field | Type | Description | +|----------|--------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------| +| threads | array of [channel](/developers/docs/resources/channel#channel-object) objects | the public, archived threads | +| members | array of [thread members](/developers/docs/resources/channel#thread-member-object) objects | a thread member object for each returned thread the current user has joined | +| has_more | boolean | whether there are potentially additional threads that could be returned on a subsequent call | ## List Private Archived Threads -/channels/[\{channel.id\}](/docs/resources/channel#channel-object)/threads/archived/private +/channels/[\{channel.id\}](/developers/docs/resources/channel#channel-object)/threads/archived/private -Returns archived threads in the channel that are of [type](/docs/resources/channel#channel-object-channel-types) `PRIVATE_THREAD`. Threads are ordered by `archive_timestamp`, in descending order. Requires both the `READ_MESSAGE_HISTORY` and `MANAGE_THREADS` permissions. +Returns archived threads in the channel that are of [type](/developers/docs/resources/channel#channel-object-channel-types) `PRIVATE_THREAD`. Threads are ordered by `archive_timestamp`, in descending order. Requires both the `READ_MESSAGE_HISTORY` and `MANAGE_THREADS` permissions. + ###### Query String Params | Field | Type | Description | @@ -708,19 +746,21 @@ Returns archived threads in the channel that are of [type](/docs/resources/chann | before? | ISO8601 timestamp | returns threads archived before this timestamp | | limit? | integer | optional maximum number of threads to return | + ###### Response Body -| Field | Type | Description | -|----------|---------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------| -| threads | array of [channel](/docs/resources/channel#channel-object) objects | the private, archived threads | -| members | array of [thread members](/docs/resources/channel#thread-member-object) objects | a thread member object for each returned thread the current user has joined | -| has_more | boolean | whether there are potentially additional threads that could be returned on a subsequent call | +| Field | Type | Description | +|----------|--------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------| +| threads | array of [channel](/developers/docs/resources/channel#channel-object) objects | the private, archived threads | +| members | array of [thread members](/developers/docs/resources/channel#thread-member-object) objects | a thread member object for each returned thread the current user has joined | +| has_more | boolean | whether there are potentially additional threads that could be returned on a subsequent call | ## List Joined Private Archived Threads -/channels/[\{channel.id\}](/docs/resources/channel#channel-object)/users/@me/threads/archived/private +/channels/[\{channel.id\}](/developers/docs/resources/channel#channel-object)/users/@me/threads/archived/private -Returns archived threads in the channel that are of [type](/docs/resources/channel#channel-object-channel-types) `PRIVATE_THREAD`, and the user has joined. Threads are ordered by their `id`, in descending order. Requires the `READ_MESSAGE_HISTORY` permission. +Returns archived threads in the channel that are of [type](/developers/docs/resources/channel#channel-object-channel-types) `PRIVATE_THREAD`, and the user has joined. Threads are ordered by their `id`, in descending order. Requires the `READ_MESSAGE_HISTORY` permission. + ###### Query String Params | Field | Type | Description | @@ -728,10 +768,11 @@ Returns archived threads in the channel that are of [type](/docs/resources/chann | before? | snowflake | returns threads before this id | | limit? | integer | optional maximum number of threads to return | + ###### Response Body -| Field | Type | Description | -|----------|---------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------| -| threads | array of [channel](/docs/resources/channel#channel-object) objects | the private, archived threads the current user has joined | -| members | array of [thread members](/docs/resources/channel#thread-member-object) objects | a thread member object for each returned thread the current user has joined | -| has_more | boolean | whether there are potentially additional threads that could be returned on a subsequent call | +| Field | Type | Description | +|----------|--------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------| +| threads | array of [channel](/developers/docs/resources/channel#channel-object) objects | the private, archived threads the current user has joined | +| members | array of [thread members](/developers/docs/resources/channel#thread-member-object) objects | a thread member object for each returned thread the current user has joined | +| has_more | boolean | whether there are potentially additional threads that could be returned on a subsequent call | diff --git a/discord/developers/docs/resources/emoji.mdx b/discord/developers/docs/resources/emoji.mdx new file mode 100644 index 0000000000..379bc124e9 --- /dev/null +++ b/discord/developers/docs/resources/emoji.mdx @@ -0,0 +1,244 @@ +--- +title: Emoji Resource +sidebarTitle: Emoji +description: Reference for Discord emoji objects and management endpoints. +--- + +import {ManualAnchor} from '/snippets/manualanchor.jsx' +import {Route} from '/snippets/route.jsx' + + +Routes for controlling emojis do not follow the normal rate limit conventions. These routes are specifically limited on a per-guild basis to prevent abuse. This means that the quota returned by our APIs may be inaccurate, and you may encounter 429s. + + +### Emoji Object + + +###### Emoji Structure + +| Field | Type | Description | +|-----------------|-----------------------------------------------------------------------------|---------------------------------------------------------------------------| +| id | ?snowflake | [emoji id](/developers/docs/reference#image-formatting) | +| name | ?string (can be null only in reaction emoji objects) | emoji name | +| roles? | array of [role](/developers/docs/topics/permissions#role-object) object ids | roles allowed to use this emoji | +| user? | [user](/developers/docs/resources/user#user-object) object | user that created this emoji | +| require_colons? | boolean | whether this emoji must be wrapped in colons | +| managed? | boolean | whether this emoji is managed | +| animated? | boolean | whether this emoji is animated | +| available? | boolean | whether this emoji can be used, may be false due to loss of Server Boosts | + + +###### Premium Emoji + +Roles with the `integration_id` tag being the guild's guild_subscription integration are considered subscription roles. +An emoji cannot have both subscription roles and non-subscription roles. +Emojis with subscription roles are considered premium emoji, and count toward a separate limit of 25. +Emojis cannot be converted between normal and premium after creation. + + +###### Emoji Formats + +Emoji can be uploaded as JPEG, PNG, GIF, WebP, and AVIF formats. All emoji (regardless of original format) can be served as WebP. We highly recommend that developers use the `.webp` extension when fetching emoji so they're rendered as WebP for maximum performance and compatibility. The Discord client uses WebP for all emoji displayed in-app. + +Still WebP emoji can be requested using the `.webp` file extension. For animated WebP emoji, use the `.webp` extension with the `?animated=true` query parameter. + + +###### Application-Owned Emoji + +An application can own up to 2000 emojis that can only be used by that app. +App emojis can be managed using the API with a bot token, or using the app's settings in the portal. +The `USE_EXTERNAL_EMOJIS` permission is not required to use app emojis. +The `user` field of an app emoji object represents the team member that uploaded the emoji from the app's settings, or the bot user if uploaded using the API. + + +###### Emoji Example + +```json +{ + "id": "41771983429993937", + "name": "LUL", + "roles": ["41771983429993000", "41771983429993111"], + "user": { + "username": "Luigi", + "discriminator": "0002", + "id": "96008815106887111", + "avatar": "5500909a3274e1812beb4e8de6631111", + "public_flags": 131328 + }, + "require_colons": true, + "managed": false, + "animated": false +} +``` + + +###### Standard Emoji Example + +```json +{ + "id": null, + "name": "🔥" +} +``` + + +###### Custom Emoji Examples + + +In `MESSAGE_REACTION_ADD`, `MESSAGE_REACTION_REMOVE` and `MESSAGE_REACTION_REMOVE_EMOJI` gateway events `animated` will be returned for animated emoji. + + + +In `MESSAGE_REACTION_ADD` and `MESSAGE_REACTION_REMOVE` gateway events `name` may be `null` when custom emoji data is not available (for example, if it was deleted from the guild). + + +```json +{ + "id": "41771983429993937", + "name": "LUL", + "animated": true +} +``` + +```json +{ + "id": "41771983429993937", + "name": null +} +``` + +## List Guild Emojis +/guilds/[\{guild.id\}](/developers/docs/resources/guild#guild-object)/emojis + +Returns a list of [emoji](/developers/docs/resources/emoji#emoji-object) objects for the given guild. Includes `user` fields if the bot has the `CREATE_GUILD_EXPRESSIONS` or `MANAGE_GUILD_EXPRESSIONS` permission. + +## Get Guild Emoji +/guilds/[\{guild.id\}](/developers/docs/resources/guild#guild-object)/emojis/[\{emoji.id\}](/developers/docs/resources/emoji#emoji-object) + +Returns an [emoji](/developers/docs/resources/emoji#emoji-object) object for the given guild and emoji IDs. Includes the `user` field if the bot has the `MANAGE_GUILD_EXPRESSIONS` permission, or if the bot created the emoji and has the the `CREATE_GUILD_EXPRESSIONS` permission. + +## Create Guild Emoji +/guilds/[\{guild.id\}](/developers/docs/resources/guild#guild-object)/emojis + +Create a new emoji for the guild. Requires the `CREATE_GUILD_EXPRESSIONS` permission. Returns the new [emoji](/developers/docs/resources/emoji#emoji-object) object on success. Fires a [Guild Emojis Update](/developers/docs/events/gateway-events#guild-emojis-update) Gateway event. + + +Emojis and animated emojis have a maximum file size of 256 KiB. Attempting to upload an emoji larger than this limit will fail and return 400 Bad Request and an error message, but not a [JSON status code](/developers/docs/topics/opcodes-and-status-codes#json). + + + +We highly recommend that developers use the `.webp` extension when fetching emoji so they're rendered as WebP for maximum performance and compatibility. See the [Emoji Formats](/developers/docs/resources/emoji#emoji-object-emoji-formats) section above for more details. + + + +This endpoint supports the `X-Audit-Log-Reason` header. + + + +###### JSON Params + +| Field | Type | Description | +|-------|-----------------------------------------------------|---------------------------------| +| name | string | name of the emoji | +| image | [image data](/developers/docs/reference#image-data) | the 128x128 emoji image | +| roles | array of snowflakes | roles allowed to use this emoji | + +## Modify Guild Emoji +/guilds/[\{guild.id\}](/developers/docs/resources/guild#guild-object)/emojis/[\{emoji.id\}](/developers/docs/resources/emoji#emoji-object) + +Modify the given emoji. For emojis created by the current user, requires either the `CREATE_GUILD_EXPRESSIONS` or `MANAGE_GUILD_EXPRESSIONS` permission. For other emojis, requires the `MANAGE_GUILD_EXPRESSIONS` permission. Returns the updated [emoji](/developers/docs/resources/emoji#emoji-object) object on success. Fires a [Guild Emojis Update](/developers/docs/events/gateway-events#guild-emojis-update) Gateway event. + + +All parameters to this endpoint are optional. + + + +This endpoint supports the `X-Audit-Log-Reason` header. + + + +###### JSON Params + +| Field | Type | Description | +|-------|----------------------|---------------------------------| +| name | string | name of the emoji | +| roles | ?array of snowflakes | roles allowed to use this emoji | + +## Delete Guild Emoji +/guilds/[\{guild.id\}](/developers/docs/resources/guild#guild-object)/emojis/[\{emoji.id\}](/developers/docs/resources/emoji#emoji-object) + +Delete the given emoji. For emojis created by the current user, requires either the `CREATE_GUILD_EXPRESSIONS` or `MANAGE_GUILD_EXPRESSIONS` permission. For other emojis, requires the `MANAGE_GUILD_EXPRESSIONS` permission. Returns `204 No Content` on success. Fires a [Guild Emojis Update](/developers/docs/events/gateway-events#guild-emojis-update) Gateway event. + + +This endpoint supports the `X-Audit-Log-Reason` header. + + +## List Application Emojis +/applications/[\{application.id\}](/developers/docs/resources/application#application-object)/emojis + +Returns an object containing a list of [emoji](/developers/docs/resources/emoji#emoji-object) objects for the given application under the `items` key. Includes a `user` object for the team member that uploaded the emoji from the app's settings, or for the bot user if uploaded using the API. + +```json +{ + "items": [ + { + "id": "41771983429993937", + "name": "LUL", + "roles": [], + "user": { + "username": "Luigi", + "discriminator": "0002", + "id": "96008815106887111", + "avatar": "5500909a3274e1812beb4e8de6631111", + "public_flags": 131328 + }, + "require_colons": true, + "managed": false, + "animated": false + } + ] +} +``` + +## Get Application Emoji +/applications/[\{application.id\}](/developers/docs/resources/application#application-object)/emojis/[\{emoji.id\}](/developers/docs/resources/emoji#emoji-object) + +Returns an [emoji](/developers/docs/resources/emoji#emoji-object) object for the given application and emoji IDs. Includes the `user` field. + +## Create Application Emoji +/applications/[\{application.id\}](/developers/docs/resources/application#application-object)/emojis + +Create a new emoji for the application. Returns the new [emoji](/developers/docs/resources/emoji#emoji-object) object on success. + + +Emojis and animated emojis have a maximum file size of 256 KiB. Attempting to upload an emoji larger than this limit will fail and return 400 Bad Request and an error message, but not a [JSON status code](/developers/docs/topics/opcodes-and-status-codes#json). + + + +We highly recommend that developers use the `.webp` extension when fetching emoji so they're rendered as WebP for maximum performance and compatibility. See the [Emoji Formats](/developers/docs/resources/emoji#emoji-object-emoji-formats) section above for more details. + + + +###### JSON Params + +| Field | Type | Description | +|-------|-----------------------------------------------------|-------------------------| +| name | string | name of the emoji | +| image | [image data](/developers/docs/reference#image-data) | the 128x128 emoji image | + +## Modify Application Emoji +/applications/[\{application.id\}](/developers/docs/resources/application#application-object)/emojis/[\{emoji.id\}](/developers/docs/resources/emoji#emoji-object) + +Modify the given emoji. Returns the updated [emoji](/developers/docs/resources/emoji#emoji-object) object on success. + + +###### JSON Params + +| Field | Type | Description | +|-------|--------|-------------------| +| name | string | name of the emoji | + +## Delete Application Emoji +/applications/[\{application.id\}](/developers/docs/resources/application#application-object)/emojis/[\{emoji.id\}](/developers/docs/resources/emoji#emoji-object) + +Delete the given emoji. Returns `204 No Content` on success. diff --git a/docs/resources/entitlement.mdx b/discord/developers/docs/resources/entitlement.mdx similarity index 66% rename from docs/resources/entitlement.mdx rename to discord/developers/docs/resources/entitlement.mdx index fffd4e62d4..8688f56b43 100644 --- a/docs/resources/entitlement.mdx +++ b/discord/developers/docs/resources/entitlement.mdx @@ -1,30 +1,35 @@ --- -sidebar_label: Entitlement +title: Entitlement Resource +sidebarTitle: Entitlement +description: Reference for Discord entitlement objects that represent user access to premium features. --- -# Entitlements Resource +import {ManualAnchor} from '/snippets/manualanchor.jsx' +import {Route} from '/snippets/route.jsx' Entitlements in Discord represent that a user or guild has access to a premium offering in your application. -Refer to the [Monetization Overview](/docs/monetization/overview) for more information on how to use Entitlements in your app. +Refer to the [Monetization Overview](/developers/docs/monetization/overview) for more information on how to use Entitlements in your app. ### Entitlement Object + ###### Entitlement Structure -| Field | Type | Description | -|----------------|--------------------|-----------------------------------------------------------------------------------------| -| id | snowflake | ID of the entitlement | -| sku_id | snowflake | ID of the SKU | -| application_id | snowflake | ID of the parent application | -| user_id? | snowflake | ID of the user that is granted access to the entitlement's sku | -| type | integer | [Type of entitlement](/docs/resources/entitlement#entitlement-object-entitlement-types) | -| deleted | boolean | Entitlement was deleted | -| starts_at | ?ISO8601 timestamp | Start date at which the entitlement is valid. | -| ends_at | ?ISO8601 timestamp | Date at which the entitlement is no longer valid. | -| guild_id? | snowflake | ID of the guild that is granted access to the entitlement's sku | -| consumed? | boolean | For consumable items, whether or not the entitlement has been consumed | - +| Field | Type | Description | +|----------------|--------------------|----------------------------------------------------------------------------------------------------| +| id | snowflake | ID of the entitlement | +| sku_id | snowflake | ID of the SKU | +| application_id | snowflake | ID of the parent application | +| user_id? | snowflake | ID of the user that is granted access to the entitlement's sku | +| type | integer | [Type of entitlement](/developers/docs/resources/entitlement#entitlement-object-entitlement-types) | +| deleted | boolean | Entitlement was deleted | +| starts_at | ?ISO8601 timestamp | Start date at which the entitlement is valid. | +| ends_at | ?ISO8601 timestamp | Date at which the entitlement is no longer valid. | +| guild_id? | snowflake | ID of the guild that is granted access to the entitlement's sku | +| consumed? | boolean | For consumable items, whether or not the entitlement has been consumed | + + ###### Entitlement Example ```json @@ -45,6 +50,7 @@ Refer to the [Monetization Overview](/docs/monetization/overview) for more infor } ``` + ###### Entitlement Types | Type | Value | Description | @@ -59,22 +65,23 @@ Refer to the [Monetization Overview](/docs/monetization/overview) for more infor | APPLICATION_SUBSCRIPTION | 8 | Entitlement was purchased as an app subscription | ## List Entitlements -/applications/[\{application.id\}](/docs/resources/application#application-object)/entitlements +/applications/[\{application.id\}](/developers/docs/resources/application#application-object)/entitlements Returns all entitlements for a given app, active and expired. + ###### Query String Params -| param | type | description | -|------------------|--------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------| -| user_id? | snowflake | User ID to look up entitlements for | -| sku_ids? | comma-delimited set of snowflakes | Optional list of SKU IDs to check entitlements for | -| before? | snowflake | Retrieve entitlements before this entitlement ID | -| after? | snowflake | Retrieve entitlements after this entitlement ID | -| limit? | integer | Number of entitlements to return, 1-100, default 100 | -| guild_id? | snowflake | Guild ID to look up entitlements for | -| exclude_ended? | [boolean](/docs/reference#boolean-query-strings) | Whether or not ended entitlements should be omitted. Defaults to false, ended entitlements are included by default. | -| exclude_deleted? | [boolean](/docs/reference#boolean-query-strings) | Whether or not deleted entitlements should be omitted. Defaults to true, deleted entitlements are not included by default. | +| param | type | description | +|------------------|-------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------| +| user_id? | snowflake | User ID to look up entitlements for | +| sku_ids? | comma-delimited set of snowflakes | Optional list of SKU IDs to check entitlements for | +| before? | snowflake | Retrieve entitlements before this entitlement ID | +| after? | snowflake | Retrieve entitlements after this entitlement ID | +| limit? | integer | Number of entitlements to return, 1-100, default 100 | +| guild_id? | snowflake | Guild ID to look up entitlements for | +| exclude_ended? | [boolean](/developers/docs/reference#boolean-query-strings) | Whether or not ended entitlements should be omitted. Defaults to false, ended entitlements are included by default. | +| exclude_deleted? | [boolean](/developers/docs/reference#boolean-query-strings) | Whether or not deleted entitlements should be omitted. Defaults to true, deleted entitlements are not included by default. | ```json [ @@ -97,7 +104,7 @@ Returns all entitlements for a given app, active and expired. ``` ## Get Entitlement -/applications/[\{application.id\}](/docs/resources/application#application-object)/entitlements/[\{entitlement.id\}](/docs/resources/entitlement#entitlement-object) +/applications/[\{application.id\}](/developers/docs/resources/application#application-object)/entitlements/[\{entitlement.id\}](/developers/docs/resources/entitlement#entitlement-object) Returns an entitlement. @@ -120,14 +127,14 @@ Returns an entitlement. ``` ## Consume an Entitlement -/applications/[\{application.id\}](/docs/resources/application#application-object)/entitlements/[\{entitlement.id\}](/docs/resources/entitlement#entitlement-object)/consume +/applications/[\{application.id\}](/developers/docs/resources/application#application-object)/entitlements/[\{entitlement.id\}](/developers/docs/resources/entitlement#entitlement-object)/consume -For One-Time Purchase consumable SKUs, marks a given entitlement for the user as consumed. The entitlement will have `consumed: true` when using [List Entitlements](/docs/resources/entitlement#list-entitlements). +For One-Time Purchase consumable SKUs, marks a given entitlement for the user as consumed. The entitlement will have `consumed: true` when using [List Entitlements](/developers/docs/resources/entitlement#list-entitlements). Returns a `204 No Content` on success. ## Create Test Entitlement -/applications/[\{application.id\}](/docs/resources/application#application-object)/entitlements +/applications/[\{application.id\}](/developers/docs/resources/application#application-object)/entitlements Creates a test entitlement to a given SKU for a given guild or user. Discord will act as though that user or guild has entitlement to your premium offering. @@ -135,6 +142,7 @@ This endpoint returns a partial entitlement object. It will **not** contain `sub After creating a test entitlement, you'll need to reload your Discord client. After doing so, you'll see that your server or user now has premium access. + ###### JSON Params | param | type | description | @@ -152,7 +160,7 @@ After creating a test entitlement, you'll need to reload your Discord client. Af ``` ## Delete Test Entitlement -/applications/[\{application.id\}](/docs/resources/application#application-object)/entitlements/[\{entitlement.id\}](/docs/resources/entitlement#entitlement-object) +/applications/[\{application.id\}](/developers/docs/resources/application#application-object)/entitlements/[\{entitlement.id\}](/developers/docs/resources/entitlement#entitlement-object) Deletes a currently-active test entitlement. Discord will act as though that user or guild _no longer has_ entitlement to your premium offering. diff --git a/docs/resources/guild-scheduled-event.mdx b/discord/developers/docs/resources/guild-scheduled-event.mdx similarity index 50% rename from docs/resources/guild-scheduled-event.mdx rename to discord/developers/docs/resources/guild-scheduled-event.mdx index 20a1f8612c..ca5dca476a 100644 --- a/docs/resources/guild-scheduled-event.mdx +++ b/discord/developers/docs/resources/guild-scheduled-event.mdx @@ -1,42 +1,52 @@ -# Guild Scheduled Event +--- +title: Guild Scheduled Event +sidebarTitle: Guild Scheduled Event +description: Reference for Discord scheduled event objects and management endpoints. +--- -A representation of a scheduled event in a [guild](/docs/resources/guild). +import {ManualAnchor} from '/snippets/manualanchor.jsx' +import {Route} from '/snippets/route.jsx' + +A representation of a scheduled event in a [guild](/developers/docs/resources/guild). ### Guild Scheduled Event Object + ###### Guild Scheduled Event Structure -| Field | Type | Description | -|-----------------------|--------------------------------------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| -| id | snowflake | the id of the scheduled event | -| guild_id | snowflake | the guild id which the scheduled event belongs to | -| channel_id ** | ?snowflake | the channel id in which the scheduled event will be hosted, or `null` if [scheduled entity type](/docs/resources/guild-scheduled-event#guild-scheduled-event-object-guild-scheduled-event-entity-types) is `EXTERNAL` | -| creator_id? * | ?snowflake | the id of the user that created the scheduled event * | -| name | string | the name of the scheduled event (1-100 characters) | -| description? | ?string | the description of the scheduled event (1-1000 characters) | -| scheduled_start_time | ISO8601 timestamp | the time the scheduled event will start | -| scheduled_end_time ** | ?ISO8601 timestamp | the time the scheduled event will end, required if entity_type is `EXTERNAL` | -| privacy_level | [privacy level](/docs/resources/guild-scheduled-event#guild-scheduled-event-object-guild-scheduled-event-privacy-level) | the privacy level of the scheduled event | -| status | [event status](/docs/resources/guild-scheduled-event#guild-scheduled-event-object-guild-scheduled-event-status) | the status of the scheduled event | -| entity_type | [scheduled entity type](/docs/resources/guild-scheduled-event#guild-scheduled-event-object-guild-scheduled-event-entity-types) | the type of the scheduled event | -| entity_id | ?snowflake | the id of an entity associated with a guild scheduled event | -| entity_metadata ** | ?[entity metadata](/docs/resources/guild-scheduled-event#guild-scheduled-event-object-guild-scheduled-event-entity-metadata) | additional metadata for the guild scheduled event | -| creator? | [user](/docs/resources/user#user-object) object | the user that created the scheduled event | -| user_count? | integer | the number of users subscribed to the scheduled event | -| image? | ?string | the [cover image hash](/docs/reference#image-formatting) of the scheduled event | -| recurrence_rule | ?[recurrence rule](/docs/resources/guild-scheduled-event#guild-scheduled-event-recurrence-rule-object) | the definition for how often this event should recur | +| Field | Type | Description | +|-----------------------|-------------------------------------------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| id | snowflake | the id of the scheduled event | +| guild_id | snowflake | the guild id which the scheduled event belongs to | +| channel_id ** | ?snowflake | the channel id in which the scheduled event will be hosted, or `null` if [scheduled entity type](/developers/docs/resources/guild-scheduled-event#guild-scheduled-event-object-guild-scheduled-event-entity-types) is `EXTERNAL` | +| creator_id? * | ?snowflake | the id of the user that created the scheduled event * | +| name | string | the name of the scheduled event (1-100 characters) | +| description? | ?string | the description of the scheduled event (1-1000 characters) | +| scheduled_start_time | ISO8601 timestamp | the time the scheduled event will start | +| scheduled_end_time ** | ?ISO8601 timestamp | the time the scheduled event will end, required if entity_type is `EXTERNAL` | +| privacy_level | [privacy level](/developers/docs/resources/guild-scheduled-event#guild-scheduled-event-object-guild-scheduled-event-privacy-level) | the privacy level of the scheduled event | +| status | [event status](/developers/docs/resources/guild-scheduled-event#guild-scheduled-event-object-guild-scheduled-event-status) | the status of the scheduled event | +| entity_type | [scheduled entity type](/developers/docs/resources/guild-scheduled-event#guild-scheduled-event-object-guild-scheduled-event-entity-types) | the type of the scheduled event | +| entity_id | ?snowflake | the id of an entity associated with a guild scheduled event | +| entity_metadata ** | ?[entity metadata](/developers/docs/resources/guild-scheduled-event#guild-scheduled-event-object-guild-scheduled-event-entity-metadata) | additional metadata for the guild scheduled event | +| creator? | [user](/developers/docs/resources/user#user-object) object | the user that created the scheduled event | +| user_count? | integer | the number of users subscribed to the scheduled event | +| image? | ?string | the [cover image hash](/developers/docs/reference#image-formatting) of the scheduled event | +| recurrence_rule | ?[recurrence rule](/developers/docs/resources/guild-scheduled-event#guild-scheduled-event-recurrence-rule-object) | the definition for how often this event should recur | \* `creator_id` will be null and `creator` will not be included for events created before October 25th, 2021, when the concept of `creator_id` was introduced and tracked. -\** See [field requirements by entity type](/docs/resources/guild-scheduled-event#guild-scheduled-event-object-field-requirements-by-entity-type) to understand the relationship between `entity_type` and the following fields: `channel_id`, `entity_metadata`, and `scheduled_end_time` +\** See [field requirements by entity type](/developers/docs/resources/guild-scheduled-event#guild-scheduled-event-object-field-requirements-by-entity-type) to understand the relationship between `entity_type` and the following fields: `channel_id`, `entity_metadata`, and `scheduled_end_time` + ###### Guild Scheduled Event Privacy Level | Level | Value | Description | |------------|-------|---------------------------------------------------------| | GUILD_ONLY | 2 | the scheduled event is only accessible to guild members | + ###### Guild Scheduled Event Entity Types | Type | Value | @@ -45,6 +55,7 @@ A representation of a scheduled event in a [guild](/docs/resources/guild). | VOICE | 2 | | EXTERNAL | 3 | + ###### Field Requirements By Entity Type The following table shows field requirements based on current entity type. @@ -64,6 +75,7 @@ The following table shows field requirements based on current entity type. \* `entity_metadata` with a non-null `location` must be provided + ###### Guild Scheduled Event Status | Type | Value | @@ -75,6 +87,7 @@ The following table shows field requirements based on current entity type. \* Once `status` is set to `COMPLETED` or `CANCELED`, the `status` can no longer be updated + ###### Valid Guild Scheduled Event Status Transitions SCHEDULED --> ACTIVE @@ -84,61 +97,65 @@ ACTIVE --------> COMPLETED SCHEDULED --> CANCELED + ###### Guild Scheduled Event Entity Metadata | Field | Type | Description | |-------------|--------|------------------------------------------| | location? * | string | location of the event (1-100 characters) | -\* [required](/docs/resources/guild-scheduled-event#guild-scheduled-event-object-guild-scheduled-event-entity-metadata) for events with `'entity_type': EXTERNAL` +\* [required](/developers/docs/resources/guild-scheduled-event#guild-scheduled-event-object-guild-scheduled-event-entity-metadata) for events with `'entity_type': EXTERNAL` ### Guild Scheduled Event User Object + ###### Guild Scheduled Event User Structure - -| Field | Type | Description | -|--------------------------|-----------------------------------------------------------|-----------------------------------------------------------------------------------| -| guild_scheduled_event_id | snowflake | the scheduled event id which the user subscribed to | -| user | [user](/docs/resources/user#user-object) | user which subscribed to an event | -| member? | [guild member](/docs/resources/guild#guild-member-object) | guild member data for this user for the guild which this event belongs to, if any | +| Field | Type | Description | +|--------------------------|----------------------------------------------------------------------|-----------------------------------------------------------------------------------| +| guild_scheduled_event_id | snowflake | the scheduled event id which the user subscribed to | +| user | [user](/developers/docs/resources/user#user-object) | user which subscribed to an event | +| member? | [guild member](/developers/docs/resources/guild#guild-member-object) | guild member data for this user for the guild which this event belongs to, if any | ### Guild Scheduled Event Recurrence Rule Object Discord's recurrence rule is a subset of the behaviors [defined in the iCalendar RFC](https://datatracker.ietf.org/doc/html/rfc5545) and implemented by [python's dateutil rrule](https://dateutil.readthedocs.io/en/stable/rrule.html) -:::warn + There are currently many limitations to this system. Please see "System limitations" below -::: + + ###### Guild Scheduled Event Recurrence Rule Structure - -| Field | Type | Description | -|-------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------| -| start | ISO8601 timestamp | Starting time of the recurrence interval | -| end \[1\] | ?ISO8601 timestamp | Ending time of the recurrence interval | -| frequency | [recurrence rule - frequency](/docs/resources/guild-scheduled-event#guild-scheduled-event-recurrence-rule-object-guild-scheduled-event-recurrence-rule-frequency) object | How often the event occurs | -| interval | int | The spacing between the events, defined by `frequency`. For example, `frequency` of `WEEKLY` and an `interval` of `2` would be "every-other week" | -| by_weekday | ?array of [recurrence rule - weekday](/docs/resources/guild-scheduled-event#guild-scheduled-event-recurrence-rule-object-guild-scheduled-event-recurrence-rule-weekday) | Set of specific days within a week for the event to recur on | -| by_n_weekday | ?array of [recurrence rule - n_weekday](/docs/resources/guild-scheduled-event#guild-scheduled-event-recurrence-rule-object-guild-scheduled-event-recurrence-rule-nweekday-structure) objects | List of specific days within a specific week (1-5) to recur on | -| by_month | ?array of [recurrence rule - month](/docs/resources/guild-scheduled-event#guild-scheduled-event-recurrence-rule-object-guild-scheduled-event-recurrence-rule-month) | Set of specific months to recur on | -| by_month_day | ?array of int | Set of specific dates within a month to recur on | -| by_year_day \[1\] | ?array of int | Set of days within a year to recur on (1-364) | -| count \[1\] | ?int | The total amount of times that the event is allowed to recur before stopping | +| Field | Type | Description | +|-------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------| +| start | ISO8601 timestamp | Starting time of the recurrence interval | +| end \[1\] | ?ISO8601 timestamp | Ending time of the recurrence interval | +| frequency | [recurrence rule - frequency](/developers/docs/resources/guild-scheduled-event#guild-scheduled-event-recurrence-rule-object-guild-scheduled-event-recurrence-rule-frequency) object | How often the event occurs | +| interval | int | The spacing between the events, defined by `frequency`. For example, `frequency` of `WEEKLY` and an `interval` of `2` would be "every-other week" | +| by_weekday | ?array of [recurrence rule - weekday](/developers/docs/resources/guild-scheduled-event#guild-scheduled-event-recurrence-rule-object-guild-scheduled-event-recurrence-rule-weekday) | Set of specific days within a week for the event to recur on | +| by_n_weekday | ?array of [recurrence rule - n_weekday](/developers/docs/resources/guild-scheduled-event#guild-scheduled-event-recurrence-rule-object-guild-scheduled-event-recurrence-rule-nweekday-structure) objects | List of specific days within a specific week (1-5) to recur on | +| by_month | ?array of [recurrence rule - month](/developers/docs/resources/guild-scheduled-event#guild-scheduled-event-recurrence-rule-object-guild-scheduled-event-recurrence-rule-month) | Set of specific months to recur on | +| by_month_day | ?array of int | Set of specific dates within a month to recur on | +| by_year_day \[1\] | ?array of int | Set of days within a year to recur on (1-364) | +| count \[1\] | ?int | The total amount of times that the event is allowed to recur before stopping | \[1\] - Cannot be set externally currently. - + The current system limitations are present due to how reoccurring event data needs to be displayed in the client. In the future, we would like to open the system up to have fewer / none of these restrictions. + ###### The following fields cannot be set by the client / application - `count` - `end` - `by_year_day` + ###### The following combinations are mutually exclusive - `by_weekday` - `by_n_weekday` - `by_month` + `by_month_day` + ###### `by_weekday` - Only valid for daily and weekly events (`frequency` of `DAILY` (`0`) or `WEEKLY` (`1`)) - when used in a daily event (`frequency` is `DAILY` (`0`)) @@ -156,25 +173,28 @@ In the future, we would like to open the system up to have fewer / none of these - If you wish to have multiple days within a week have a recurring event, please use a `frequency` of `DAILY` - Also, see `interval` below for "every-other" week information + ###### `by_n_weekday` - Only valid for monthly events (`frequency` of `MONTHLY` (`1`)) - `by_n_weekday` array currently can only be a length of `1` - i.e: You can only select a single day within a month to have a recurring event on + ###### `by_month` and `by_month_day` - Only valid for annual event (`frequency` is `YEARLY` (`0`)) - both `by_month` and `by_month_day` must be provided - both `by_month` and `by_month_day` arrays must have a length of `1` - (i.e: You can only set a single date for annual events) + ###### `interval` can only be set to a value other than `1` when `frequency` is set to `WEEKLY` (`1`) - In this situation, interval can be set to `2` - This allowance enables "every-other week" events - Due to the limitations placed on `by_weekday` this means that if you wish to use "every-other week" functionality you can only do so for a single day. - + - + **Every weekday** ```js frequency = 3 // Frequency.DAILY @@ -213,8 +233,9 @@ interval = 1 by_month = [7] // [Month.JULY] by_month_day = [24] ``` - + + ###### Guild Scheduled Event Recurrence Rule - Frequency | Type | Value | @@ -224,6 +245,7 @@ by_month_day = [24] | WEEKLY | 2 | | DAILY | 3 | + ###### Guild Scheduled Event Recurrence Rule - Weekday | Type | Value | @@ -236,13 +258,15 @@ by_month_day = [24] | SATURDAY | 5 | | SUNDAY | 6 | + ###### Guild Scheduled Event Recurrence Rule - N_Weekday Structure | Field | Type | Description | |-------|------|-------------------------------| | n | int | The week to reoccur on. 1 - 5 | -| day | [recurrence rule - weekday](/docs/resources/guild-scheduled-event#guild-scheduled-event-recurrence-rule-object-guild-scheduled-event-recurrence-rule-weekday) | The day within the week to reoccur on | | guild member data for this user for the guild which this event belongs to, if any | +| day | [recurrence rule - weekday](/developers/docs/resources/guild-scheduled-event#guild-scheduled-event-recurrence-rule-object-guild-scheduled-event-recurrence-rule-weekday) | The day within the week to reoccur on | | guild member data for this user for the guild which this event belongs to, if any | + ###### Guild Scheduled Event Recurrence Rule - Month | Type | Value | @@ -261,43 +285,45 @@ by_month_day = [24] | DECEMBER | 12 | ## List Scheduled Events for Guild -/guilds/[\{guild.id\}](/docs/resources/guild#guild-object)/scheduled-events +/guilds/[\{guild.id\}](/developers/docs/resources/guild#guild-object)/scheduled-events -Returns a list of [guild scheduled event](/docs/resources/guild-scheduled-event#guild-scheduled-event-object) objects for the given guild. +Returns a list of [guild scheduled event](/developers/docs/resources/guild-scheduled-event#guild-scheduled-event-object) objects for the given guild. + ###### Query String Params -| Field | Type | Description | -|------------------|--------------------------------------------------|--------------------------------------------------| -| with_user_count? | [boolean](/docs/reference#boolean-query-strings) | include number of users subscribed to each event | +| Field | Type | Description | +|------------------|-------------------------------------------------------------|--------------------------------------------------| +| with_user_count? | [boolean](/developers/docs/reference#boolean-query-strings) | include number of users subscribed to each event | ## Create Guild Scheduled Event -/guilds/[\{guild.id\}](/docs/resources/guild#guild-object)/scheduled-events +/guilds/[\{guild.id\}](/developers/docs/resources/guild#guild-object)/scheduled-events -Create a guild scheduled event in the guild. Returns a [guild scheduled event](/docs/resources/guild-scheduled-event#guild-scheduled-event-object) object on success. Fires a [Guild Scheduled Event Create](/docs/events/gateway-events#guild-scheduled-event-create) Gateway event. +Create a guild scheduled event in the guild. Returns a [guild scheduled event](/developers/docs/resources/guild-scheduled-event#guild-scheduled-event-object) object on success. Fires a [Guild Scheduled Event Create](/developers/docs/events/gateway-events#guild-scheduled-event-create) Gateway event. -:::info + A guild can have a maximum of 100 events with `SCHEDULED` or `ACTIVE` status at any time. -::: + -:::info + This endpoint supports the `X-Audit-Log-Reason` header. -::: + + ###### JSON Params -| Field | Type | Description | -|------------------------|-----------------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------| -| channel_id? * | snowflake * | the channel id of the scheduled event. | -| entity_metadata? ** | [entity metadata](/docs/resources/guild-scheduled-event#guild-scheduled-event-object-guild-scheduled-event-entity-metadata) | the entity metadata of the scheduled event | -| name | string | the name of the scheduled event | -| privacy_level | [privacy level](/docs/resources/guild-scheduled-event#guild-scheduled-event-object-guild-scheduled-event-privacy-level) | the privacy level of the scheduled event | -| scheduled_start_time | ISO8601 timestamp | the time to schedule the scheduled event | -| scheduled_end_time? ** | ISO8601 timestamp | the time when the scheduled event is scheduled to end | -| description? | string | the description of the scheduled event | -| entity_type | [entity type](/docs/resources/guild-scheduled-event#guild-scheduled-event-object-guild-scheduled-event-entity-types) | the entity type of the scheduled event | -| image? | [image data](/docs/reference#image-data) | the cover image of the scheduled event | -| recurrence_rule? | [recurrence rule](/docs/resources/guild-scheduled-event#guild-scheduled-event-recurrence-rule-object) | the definition for how often this event should recur | +| Field | Type | Description | +|------------------------|----------------------------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------| +| channel_id? * | snowflake * | the channel id of the scheduled event. | +| entity_metadata? ** | [entity metadata](/developers/docs/resources/guild-scheduled-event#guild-scheduled-event-object-guild-scheduled-event-entity-metadata) | the entity metadata of the scheduled event | +| name | string | the name of the scheduled event | +| privacy_level | [privacy level](/developers/docs/resources/guild-scheduled-event#guild-scheduled-event-object-guild-scheduled-event-privacy-level) | the privacy level of the scheduled event | +| scheduled_start_time | ISO8601 timestamp | the time to schedule the scheduled event | +| scheduled_end_time? ** | ISO8601 timestamp | the time when the scheduled event is scheduled to end | +| description? | string | the description of the scheduled event | +| entity_type | [entity type](/developers/docs/resources/guild-scheduled-event#guild-scheduled-event-object-guild-scheduled-event-entity-types) | the entity type of the scheduled event | +| image? | [image data](/developers/docs/reference#image-data) | the cover image of the scheduled event | +| recurrence_rule? | [recurrence rule](/developers/docs/resources/guild-scheduled-event#guild-scheduled-event-recurrence-rule-object) | the definition for how often this event should recur | \* Optional for events with `'entity_type': EXTERNAL` @@ -305,78 +331,81 @@ This endpoint supports the `X-Audit-Log-Reason` header. \*\* Required for events with `'entity_type': EXTERNAL` ## Get Guild Scheduled Event -/guilds/[\{guild.id\}](/docs/resources/guild#guild-object)/scheduled-events/[\{guild_scheduled_event.id\}](/docs/resources/guild-scheduled-event#guild-scheduled-event-object) +/guilds/[\{guild.id\}](/developers/docs/resources/guild#guild-object)/scheduled-events/[\{guild_scheduled_event.id\}](/developers/docs/resources/guild-scheduled-event#guild-scheduled-event-object) -Get a guild scheduled event. Returns a [guild scheduled event](/docs/resources/guild-scheduled-event#guild-scheduled-event-object) object on success. +Get a guild scheduled event. Returns a [guild scheduled event](/developers/docs/resources/guild-scheduled-event#guild-scheduled-event-object) object on success. + ###### Query String Params -| Field | Type | Description | -|------------------|--------------------------------------------------|--------------------------------------------------| -| with_user_count? | [boolean](/docs/reference#boolean-query-strings) | include number of users subscribed to this event | +| Field | Type | Description | +|------------------|-------------------------------------------------------------|--------------------------------------------------| +| with_user_count? | [boolean](/developers/docs/reference#boolean-query-strings) | include number of users subscribed to this event | ## Modify Guild Scheduled Event -/guilds/[\{guild.id\}](/docs/resources/guild#guild-object)/scheduled-events/[\{guild_scheduled_event.id\}](/docs/resources/guild-scheduled-event#guild-scheduled-event-object) +/guilds/[\{guild.id\}](/developers/docs/resources/guild#guild-object)/scheduled-events/[\{guild_scheduled_event.id\}](/developers/docs/resources/guild-scheduled-event#guild-scheduled-event-object) -Modify a guild scheduled event. Returns the modified [guild scheduled event](/docs/resources/guild-scheduled-event#guild-scheduled-event-object) object on success. Fires a [Guild Scheduled Event Update](/docs/events/gateway-events#guild-scheduled-event-update) Gateway event. +Modify a guild scheduled event. Returns the modified [guild scheduled event](/developers/docs/resources/guild-scheduled-event#guild-scheduled-event-object) object on success. Fires a [Guild Scheduled Event Update](/developers/docs/events/gateway-events#guild-scheduled-event-update) Gateway event. -:::info -To start or end an event, use this endpoint to modify the event's [status](/docs/resources/guild-scheduled-event#guild-scheduled-event-object-guild-scheduled-event-status) field. -::: + +To start or end an event, use this endpoint to modify the event's [status](/developers/docs/resources/guild-scheduled-event#guild-scheduled-event-object-guild-scheduled-event-status) field. + -:::info + This endpoint supports the `X-Audit-Log-Reason` header. -::: + -:::info + This endpoint silently discards `entity_metadata` for non-`EXTERNAL` events. -::: + -:::info + All parameters to this endpoint are optional -::: + + ###### JSON Params -| Field | Type | Description | -|-----------------------|------------------------------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------| -| channel_id? * | ?snowflake | the channel id of the scheduled event, set to `null` if changing entity type to `EXTERNAL` | -| entity_metadata? | ?[entity metadata](/docs/resources/guild-scheduled-event#guild-scheduled-event-object-guild-scheduled-event-entity-metadata) | the entity metadata of the scheduled event | -| name? | string | the name of the scheduled event | -| privacy_level? | [privacy level](/docs/resources/guild-scheduled-event#guild-scheduled-event-object-guild-scheduled-event-privacy-level) | the privacy level of the scheduled event | -| scheduled_start_time? | ISO8601 timestamp | the time to schedule the scheduled event | -| scheduled_end_time? * | ISO8601 timestamp | the time when the scheduled event is scheduled to end | -| description? | ?string | the description of the scheduled event | -| entity_type? * | [event entity type](/docs/resources/guild-scheduled-event#guild-scheduled-event-object-guild-scheduled-event-entity-types) | the entity type of the scheduled event | -| status? | [event status](/docs/resources/guild-scheduled-event#guild-scheduled-event-object-guild-scheduled-event-status) | the status of the scheduled event | -| image? | [image data](/docs/reference#image-data) | the cover image of the scheduled event | -| recurrence_rule? | ?[recurrence rule](/docs/resources/guild-scheduled-event#guild-scheduled-event-recurrence-rule-object) | the definition for how often this event should recur | +| Field | Type | Description | +|-----------------------|-----------------------------------------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------| +| channel_id? * | ?snowflake | the channel id of the scheduled event, set to `null` if changing entity type to `EXTERNAL` | +| entity_metadata? | ?[entity metadata](/developers/docs/resources/guild-scheduled-event#guild-scheduled-event-object-guild-scheduled-event-entity-metadata) | the entity metadata of the scheduled event | +| name? | string | the name of the scheduled event | +| privacy_level? | [privacy level](/developers/docs/resources/guild-scheduled-event#guild-scheduled-event-object-guild-scheduled-event-privacy-level) | the privacy level of the scheduled event | +| scheduled_start_time? | ISO8601 timestamp | the time to schedule the scheduled event | +| scheduled_end_time? * | ISO8601 timestamp | the time when the scheduled event is scheduled to end | +| description? | ?string | the description of the scheduled event | +| entity_type? * | [event entity type](/developers/docs/resources/guild-scheduled-event#guild-scheduled-event-object-guild-scheduled-event-entity-types) | the entity type of the scheduled event | +| status? | [event status](/developers/docs/resources/guild-scheduled-event#guild-scheduled-event-object-guild-scheduled-event-status) | the status of the scheduled event | +| image? | [image data](/developers/docs/reference#image-data) | the cover image of the scheduled event | +| recurrence_rule? | ?[recurrence rule](/developers/docs/resources/guild-scheduled-event#guild-scheduled-event-recurrence-rule-object) | the definition for how often this event should recur | \* If updating `entity_type` to `EXTERNAL`: -- `channel_id` is required and [must be set to null](/docs/resources/guild-scheduled-event#guild-scheduled-event-object-field-requirements-by-entity-type) +- `channel_id` is required and [must be set to null](/developers/docs/resources/guild-scheduled-event#guild-scheduled-event-object-field-requirements-by-entity-type) - `entity_metadata` with a `location` field must be provided - `scheduled_end_time` must be provided ## Delete Guild Scheduled Event -/guilds/[\{guild.id\}](/docs/resources/guild#guild-object)/scheduled-events/[\{guild_scheduled_event.id\}](/docs/resources/guild-scheduled-event#guild-scheduled-event-object) +/guilds/[\{guild.id\}](/developers/docs/resources/guild#guild-object)/scheduled-events/[\{guild_scheduled_event.id\}](/developers/docs/resources/guild-scheduled-event#guild-scheduled-event-object) -Delete a guild scheduled event. Returns a `204` on success. Fires a [Guild Scheduled Event Delete](/docs/events/gateway-events#guild-scheduled-event-delete) Gateway event. +Delete a guild scheduled event. Returns a `204` on success. Fires a [Guild Scheduled Event Delete](/developers/docs/events/gateway-events#guild-scheduled-event-delete) Gateway event. ## Get Guild Scheduled Event Users -/guilds/[\{guild.id\}](/docs/resources/guild#guild-object)/scheduled-events/[\{guild_scheduled_event.id\}](/docs/resources/guild-scheduled-event#guild-scheduled-event-object)/users +/guilds/[\{guild.id\}](/developers/docs/resources/guild#guild-object)/scheduled-events/[\{guild_scheduled_event.id\}](/developers/docs/resources/guild-scheduled-event#guild-scheduled-event-object)/users -Get a list of guild scheduled event users subscribed to a guild scheduled event. Returns a list of [guild scheduled event user](/docs/resources/guild-scheduled-event#guild-scheduled-event-user-object) objects on success. Guild member data, if it exists, is included if the `with_member` query parameter is set. +Get a list of guild scheduled event users subscribed to a guild scheduled event. Returns a list of [guild scheduled event user](/developers/docs/resources/guild-scheduled-event#guild-scheduled-event-user-object) objects on success. Guild member data, if it exists, is included if the `with_member` query parameter is set. + ###### Query String Params -| Field | Type | Description | Default | -|--------------|--------------------------------------------------|-----------------------------------------------|---------| -| limit? | number | number of users to return (up to maximum 100) | 100 | -| with_member? | [boolean](/docs/reference#boolean-query-strings) | include guild member data if it exists | false | -| before? * | snowflake | consider only users before given user id | null | -| after? * | snowflake | consider only users after given user id | null | +| Field | Type | Description | Default | +|--------------|-------------------------------------------------------------|-----------------------------------------------|---------| +| limit? | number | number of users to return (up to maximum 100) | 100 | +| with_member? | [boolean](/developers/docs/reference#boolean-query-strings) | include guild member data if it exists | false | +| before? * | snowflake | consider only users before given user id | null | +| after? * | snowflake | consider only users after given user id | null | \* Provide a user id to `before` and `after` for pagination. Users will always be returned in ascending order by `user_id`. If both `before` and `after` are provided, only `before` is respected. Fetching users in-between `before` and `after` is not supported. @@ -409,9 +438,9 @@ Any event with `'status': SCHEDULED` after a certain time interval (on the order NOTE: `entity_type` is expressed by name rather than value for readability -:::info + A user must be a member of the guild in order to access events for that guild unless the guild is lurkable. If a guild is lurkable, events in that guild may be visible to lurkers depending on the event type and the permissions of any channels associated with the event. -::: + ### Permissions for events with entity_type: STAGE_INSTANCE diff --git a/discord/developers/docs/resources/guild-template.mdx b/discord/developers/docs/resources/guild-template.mdx new file mode 100644 index 0000000000..d58954c91f --- /dev/null +++ b/discord/developers/docs/resources/guild-template.mdx @@ -0,0 +1,151 @@ +--- +title: Guild Template Resource +sidebarTitle: Guild Template +description: Reference for Discord Guilt Template objects and management endpoints. +--- + +import {ManualAnchor} from '/snippets/manualanchor.jsx' +import {Route} from '/snippets/route.jsx' + +### Guild Template Object + +Represents a code that when used, creates a guild based on a snapshot of an existing guild. + + +###### Guild Template Structure + +| Field | Type | Description | +|-------------------------|-----------------------------------------------------------------------|----------------------------------------------------------------------------------| +| code | string | the template code (unique ID) | +| name | string | template name | +| description | ?string | the description for the template | +| usage_count | integer | number of times this template has been used | +| creator_id | snowflake | the ID of the user who created the template | +| creator | [user](/developers/docs/resources/user#user-object) object | the user who created the template | +| created_at | ISO8601 timestamp | when this template was created | +| updated_at | ISO8601 timestamp | when this template was last synced to the source guild | +| source_guild_id | snowflake | the ID of the guild this template is based on | +| serialized_source_guild | partial [guild](/developers/docs/resources/guild#guild-object) object | the guild snapshot this template contains; placeholder IDs are given as integers | +| is_dirty | ?boolean | whether the template has unsynced changes | + + +###### Example Guild Template Object + +```json +{ + "code": "hgM48av5Q69A", + "name": "Friends & Family", + "description": "", + "usage_count": 49605, + "creator_id": "132837293881950208", + "creator": { + "id": "132837293881950208", + "username": "hoges", + "avatar": "79b0d9f8c340f2d43e1f78b09f175b62", + "discriminator": "0001", + "public_flags": 129 + }, + "created_at": "2020-04-02T21:10:38+00:00", + "updated_at": "2020-05-01T17:57:38+00:00", + "source_guild_id": "678070694164299796", + "serialized_source_guild": { + "name": "Friends & Family", + "description": null, + "region": "us-west", + "verification_level": 0, + "default_message_notifications": 0, + "explicit_content_filter": 0, + "preferred_locale": "en-US", + "afk_timeout": 300, + "roles": [ + { + "id": 0, + "name": "@everyone", + "permissions": 104324689, + "color": 0, + "hoist": false, + "mentionable": false + } + ], + "channels": [ + { + "name": "Text Channels", + "position": 1, + "topic": null, + "bitrate": 64000, + "user_limit": 0, + "nsfw": false, + "rate_limit_per_user": 0, + "parent_id": null, + "permission_overwrites": [], + "id": 1, + "type": 4 + }, + { + "name": "general", + "position": 1, + "topic": null, + "bitrate": 64000, + "user_limit": 0, + "nsfw": false, + "rate_limit_per_user": 0, + "parent_id": 1, + "permission_overwrites": [], + "id": 2, + "type": 0 + } + ], + "afk_channel_id": null, + "system_channel_id": 2, + "system_channel_flags": 0, + "icon_hash": null + }, + "is_dirty": null +} +``` + +## Get Guild Template +/guilds/templates/[\{template.code\}](/developers/docs/resources/guild-template#guild-template-object) + +Returns a [guild template](/developers/docs/resources/guild-template#guild-template-object) object for the given code. + +## Get Guild Templates +/guilds/[\{guild.id\}](/developers/docs/resources/guild#guild-object)/templates + +Returns an array of [guild template](/developers/docs/resources/guild-template#guild-template-object) objects. Requires the `MANAGE_GUILD` permission. + +## Create Guild Template +/guilds/[\{guild.id\}](/developers/docs/resources/guild#guild-object)/templates + +Creates a template for the guild. Requires the `MANAGE_GUILD` permission. Returns the created [guild template](/developers/docs/resources/guild-template#guild-template-object) object on success. + + +###### JSON Params + +| Field | Type | Description | +|--------------|---------|-------------------------------------------------| +| name | string | name of the template (1-100 characters) | +| description? | ?string | description for the template (0-120 characters) | + +## Sync Guild Template +/guilds/[\{guild.id\}](/developers/docs/resources/guild#guild-object)/templates/[\{template.code\}](/developers/docs/resources/guild-template#guild-template-object) + +Syncs the template to the guild's current state. Requires the `MANAGE_GUILD` permission. Returns the [guild template](/developers/docs/resources/guild-template#guild-template-object) object on success. + +## Modify Guild Template +/guilds/[\{guild.id\}](/developers/docs/resources/guild#guild-object)/templates/[\{template.code\}](/developers/docs/resources/guild-template#guild-template-object) + +Modifies the template's metadata. Requires the `MANAGE_GUILD` permission. Returns the [guild template](/developers/docs/resources/guild-template#guild-template-object) object on success. + + +###### JSON Params + +| Field | Type | Description | +|--------------|---------|-------------------------------------------------| +| name? | string | name of the template (1-100 characters) | +| description? | ?string | description for the template (0-120 characters) | + +## Delete Guild Template +/guilds/[\{guild.id\}](/developers/docs/resources/guild#guild-object)/templates/[\{template.code\}](/developers/docs/resources/guild-template#guild-template-object) + +Deletes the template. Requires the `MANAGE_GUILD` permission. Returns the deleted [guild template](/developers/docs/resources/guild-template#guild-template-object) object on success. diff --git a/docs/resources/guild.mdx b/discord/developers/docs/resources/guild.mdx similarity index 50% rename from docs/resources/guild.mdx rename to discord/developers/docs/resources/guild.mdx index 3effec4e51..d5cd0179b5 100644 --- a/docs/resources/guild.mdx +++ b/discord/developers/docs/resources/guild.mdx @@ -1,70 +1,76 @@ --- -sidebar_label: Guild +title: Guild Resource +sidebarTitle: Guild +description: Reference for Discord guild (server) objects and management endpoints. --- -# Guild Resource +import {ManualAnchor} from '/snippets/manualanchor.jsx' + +import {Route} from '/snippets/route.jsx' Guilds in Discord represent an isolated collection of users and channels, and are often referred to as "servers" in the UI. ### Guild Object + ###### Guild Structure -:::info -Fields specific to the `GUILD_CREATE` event are listed in the [Gateway Events documentation](/docs/events/gateway-events#guild-create). -::: - -| Field | Type | Description | -|--------------------------------|-------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| -| id | snowflake | guild id | -| name | string | guild name (2-100 characters, excluding trailing and leading whitespace) | -| icon | ?string | [icon hash](/docs/reference#image-formatting) | -| icon_hash? | ?string | [icon hash](/docs/reference#image-formatting), returned when in the template object | -| splash | ?string | [splash hash](/docs/reference#image-formatting) | -| discovery_splash | ?string | [discovery splash hash](/docs/reference#image-formatting); only present for guilds with the "DISCOVERABLE" feature | -| owner? \* | boolean | true if [the user](/docs/resources/user#get-current-user-guilds) is the owner of the guild | -| owner_id | snowflake | id of owner | -| permissions? \* | string | total permissions for [the user](/docs/resources/user#get-current-user-guilds) in the guild (excludes overwrites and [implicit permissions](/docs/topics/permissions#implicit-permissions)) | -| region? \*\* | ?string | [voice region](/docs/resources/voice#voice-region-object) id for the guild (deprecated) | -| afk_channel_id | ?snowflake | id of afk channel | -| afk_timeout | integer | afk timeout in seconds | -| widget_enabled? | boolean | true if the server widget is enabled | -| widget_channel_id? | ?snowflake | the channel id that the widget will generate an invite to, or `null` if set to no invite | -| verification_level | integer | [verification level](/docs/resources/guild#guild-object-verification-level) required for the guild | -| default_message_notifications | integer | default [message notifications level](/docs/resources/guild#guild-object-default-message-notification-level) | -| explicit_content_filter | integer | [explicit content filter level](/docs/resources/guild#guild-object-explicit-content-filter-level) | -| roles | array of [role](/docs/topics/permissions#role-object) objects | roles in the guild | -| emojis | array of [emoji](/docs/resources/emoji#emoji-object) objects | custom guild emojis | -| features | array of [guild feature](/docs/resources/guild#guild-object-guild-features) strings | enabled guild features | -| mfa_level | integer | required [MFA level](/docs/resources/guild#guild-object-mfa-level) for the guild | -| application_id | ?snowflake | application id of the guild creator if it is bot-created | -| system_channel_id | ?snowflake | the id of the channel where guild notices such as welcome messages and boost events are posted | -| system_channel_flags | integer | [system channel flags](/docs/resources/guild#guild-object-system-channel-flags) | -| rules_channel_id | ?snowflake | the id of the channel where Community guilds can display rules and/or guidelines | -| max_presences? | ?integer | the maximum number of presences for the guild (`null` is always returned, apart from the largest of guilds) | -| max_members? | integer | the maximum number of members for the guild | -| vanity_url_code | ?string | the vanity url code for the guild | -| description | ?string | the description of a guild | -| banner | ?string | [banner hash](/docs/reference#image-formatting) | -| premium_tier | integer | [premium tier](/docs/resources/guild#guild-object-premium-tier) (Server Boost level) | -| premium_subscription_count? | integer | the number of boosts this guild currently has | -| preferred_locale | string | the preferred [locale](/docs/reference#locales) of a Community guild; used in server discovery and notices from Discord, and sent in interactions; defaults to "en-US" | -| public_updates_channel_id | ?snowflake | the id of the channel where admins and moderators of Community guilds receive notices from Discord | -| max_video_channel_users? | integer | the maximum amount of users in a video channel | -| max_stage_video_channel_users? | integer | the maximum amount of users in a stage video channel | -| approximate_member_count? | integer | approximate number of members in this guild, returned from the `GET /guilds/` and `/users/@me/guilds` endpoints when `with_counts` is `true` | -| approximate_presence_count? | integer | approximate number of non-offline members in this guild, returned from the `GET /guilds/` and `/users/@me/guilds` endpoints when `with_counts` is `true` | -| welcome_screen? | [welcome screen](/docs/resources/guild#welcome-screen-object) object | the welcome screen of a Community guild, shown to new members, returned in an [Invite](/docs/resources/invite#invite-object)'s guild object | -| nsfw_level | integer | [guild NSFW level](/docs/resources/guild#guild-object-guild-nsfw-level) | -| stickers? | array of [sticker](/docs/resources/sticker#sticker-object) objects | custom guild stickers | -| premium_progress_bar_enabled | boolean | whether the guild has the boost progress bar enabled | -| safety_alerts_channel_id | ?snowflake | the id of the channel where admins and moderators of Community guilds receive safety alerts from Discord | -| incidents_data | ?[incidents data](/docs/resources/guild#incidents-data-object) object | the incidents data for this guild | - -\* These fields are only sent when using the [GET Current User Guilds](/docs/resources/user#get-current-user-guilds) endpoint and are relative to the requested user - -\*\* This field is deprecated and is replaced by [channel.rtc_region](/docs/resources/channel#channel-object-channel-structure) - + +Fields specific to the `GUILD_CREATE` event are listed in the [Gateway Events documentation](/developers/docs/events/gateway-events#guild-create). + + +| Field | Type | Description | +|--------------------------------|------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| id | snowflake | guild id | +| name | string | guild name (2-100 characters, excluding trailing and leading whitespace) | +| icon | ?string | [icon hash](/developers/docs/reference#image-formatting) | +| icon_hash? | ?string | [icon hash](/developers/docs/reference#image-formatting), returned when in the template object | +| splash | ?string | [splash hash](/developers/docs/reference#image-formatting) | +| discovery_splash | ?string | [discovery splash hash](/developers/docs/reference#image-formatting); only present for guilds with the "DISCOVERABLE" feature | +| owner? \* | boolean | true if [the user](/developers/docs/resources/user#get-current-user-guilds) is the owner of the guild | +| owner_id | snowflake | id of owner | +| permissions? \* | string | total permissions for [the user](/developers/docs/resources/user#get-current-user-guilds) in the guild (excludes overwrites and [implicit permissions](/developers/docs/topics/permissions#implicit-permissions)) | +| region? \*\* | ?string | [voice region](/developers/docs/resources/voice#voice-region-object) id for the guild (deprecated) | +| afk_channel_id | ?snowflake | id of afk channel | +| afk_timeout | integer | afk timeout in seconds | +| widget_enabled? | boolean | true if the server widget is enabled | +| widget_channel_id? | ?snowflake | the channel id that the widget will generate an invite to, or `null` if set to no invite | +| verification_level | integer | [verification level](/developers/docs/resources/guild#guild-object-verification-level) required for the guild | +| default_message_notifications | integer | default [message notifications level](/developers/docs/resources/guild#guild-object-default-message-notification-level) | +| explicit_content_filter | integer | [explicit content filter level](/developers/docs/resources/guild#guild-object-explicit-content-filter-level) | +| roles | array of [role](/developers/docs/topics/permissions#role-object) objects | roles in the guild | +| emojis | array of [emoji](/developers/docs/resources/emoji#emoji-object) objects | custom guild emojis | +| features | array of [guild feature](/developers/docs/resources/guild#guild-object-guild-features) strings | enabled guild features | +| mfa_level | integer | required [MFA level](/developers/docs/resources/guild#guild-object-mfa-level) for the guild | +| application_id | ?snowflake | application id of the guild creator if it is bot-created | +| system_channel_id | ?snowflake | the id of the channel where guild notices such as welcome messages and boost events are posted | +| system_channel_flags | integer | [system channel flags](/developers/docs/resources/guild#guild-object-system-channel-flags) | +| rules_channel_id | ?snowflake | the id of the channel where Community guilds can display rules and/or guidelines | +| max_presences? | ?integer | the maximum number of presences for the guild (`null` is always returned, apart from the largest of guilds) | +| max_members? | integer | the maximum number of members for the guild | +| vanity_url_code | ?string | the vanity url code for the guild | +| description | ?string | the description of a guild | +| banner | ?string | [banner hash](/developers/docs/reference#image-formatting) | +| premium_tier | integer | [premium tier](/developers/docs/resources/guild#guild-object-premium-tier) (Server Boost level) | +| premium_subscription_count? | integer | the number of boosts this guild currently has | +| preferred_locale | string | the preferred [locale](/developers/docs/reference#locales) of a Community guild; used in server discovery and notices from Discord, and sent in interactions; defaults to "en-US" | +| public_updates_channel_id | ?snowflake | the id of the channel where admins and moderators of Community guilds receive notices from Discord | +| max_video_channel_users? | integer | the maximum amount of users in a video channel | +| max_stage_video_channel_users? | integer | the maximum amount of users in a stage video channel | +| approximate_member_count? | integer | approximate number of members in this guild, returned from the `GET /guilds/` and `/users/@me/guilds` endpoints when `with_counts` is `true` | +| approximate_presence_count? | integer | approximate number of non-offline members in this guild, returned from the `GET /guilds/` and `/users/@me/guilds` endpoints when `with_counts` is `true` | +| welcome_screen? | [welcome screen](/developers/docs/resources/guild#welcome-screen-object) object | the welcome screen of a Community guild, shown to new members, returned in an [Invite](/developers/docs/resources/invite#invite-object)'s guild object | +| nsfw_level | integer | [guild NSFW level](/developers/docs/resources/guild#guild-object-guild-nsfw-level) | +| stickers? | array of [sticker](/developers/docs/resources/sticker#sticker-object) objects | custom guild stickers | +| premium_progress_bar_enabled | boolean | whether the guild has the boost progress bar enabled | +| safety_alerts_channel_id | ?snowflake | the id of the channel where admins and moderators of Community guilds receive safety alerts from Discord | +| incidents_data | ?[incidents data](/developers/docs/resources/guild#incidents-data-object) object | the incidents data for this guild | + +\* These fields are only sent when using the [GET Current User Guilds](/developers/docs/resources/user#get-current-user-guilds) endpoint and are relative to the requested user + +\*\* This field is deprecated and is replaced by [channel.rtc_region](/developers/docs/resources/channel#channel-object-channel-structure) + + ###### Default Message Notification Level | Key | Value | Description | @@ -72,6 +78,7 @@ Fields specific to the `GUILD_CREATE` event are listed in the [Gateway Events do | ALL_MESSAGES | 0 | members will receive notifications for all messages by default | | ONLY_MENTIONS | 1 | members will receive notifications only for messages that @mention them by default | + ###### Explicit Content Filter Level | Level | Integer | Description | @@ -80,6 +87,7 @@ Fields specific to the `GUILD_CREATE` event are listed in the [Gateway Events do | MEMBERS_WITHOUT_ROLES | 1 | media content sent by members without roles will be scanned | | ALL_MEMBERS | 2 | media content sent by all members will be scanned | + ###### MFA Level | Level | Integer | Description | @@ -87,6 +95,7 @@ Fields specific to the `GUILD_CREATE` event are listed in the [Gateway Events do | NONE | 0 | guild has no MFA/2FA requirement for moderation actions | | ELEVATED | 1 | guild has a 2FA requirement for moderation actions | + ###### Verification Level | Level | Integer | Description | @@ -97,6 +106,7 @@ Fields specific to the `GUILD_CREATE` event are listed in the [Gateway Events do | HIGH | 3 | must be a member of the server for longer than 10 minutes | | VERY_HIGH | 4 | must have a verified phone number | + ###### Guild NSFW Level | Level | Value | @@ -106,6 +116,7 @@ Fields specific to the `GUILD_CREATE` event are listed in the [Gateway Events do | SAFE | 2 | | AGE_RESTRICTED | 3 | + ###### Premium Tier | Level | Integer | Description | @@ -115,6 +126,7 @@ Fields specific to the `GUILD_CREATE` event are listed in the [Gateway Events do | TIER_2 | 2 | guild has unlocked Server Boost level 2 perks | | TIER_3 | 3 | guild has unlocked Server Boost level 3 perks | + ###### System Channel Flags | Flag | Value | Description | @@ -126,43 +138,45 @@ Fields specific to the `GUILD_CREATE` event are listed in the [Gateway Events do | SUPPRESS_ROLE_SUBSCRIPTION_PURCHASE_NOTIFICATIONS | `1 << 4` | Suppress role subscription purchase and renewal notifications | | SUPPRESS_ROLE_SUBSCRIPTION_PURCHASE_NOTIFICATION_REPLIES | `1 << 5` | Hide role subscription sticker reply buttons | + ###### Guild Features -| Feature | Description | -|-------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------| -| ANIMATED_BANNER | guild has access to set an animated guild banner image | -| ANIMATED_ICON | guild has access to set an animated guild icon | -| APPLICATION_COMMAND_PERMISSIONS_V2 | guild is using the [old permissions configuration behavior](/docs/change-log#upcoming-application-command-permission-changes) | -| AUTO_MODERATION | guild has set up auto moderation rules | -| BANNER | guild has access to set a guild banner image | -| COMMUNITY | guild can enable welcome screen, Membership Screening, stage channels and discovery, and receives community updates | -| CREATOR_MONETIZABLE_PROVISIONAL | guild has enabled monetization | -| CREATOR_STORE_PAGE | guild has enabled the role subscription promo page | -| DEVELOPER_SUPPORT_SERVER | guild has been set as a support server on the App Directory | -| DISCOVERABLE | guild is able to be discovered in the directory | -| FEATURABLE | guild is able to be featured in the directory | -| INVITES_DISABLED | guild has paused invites, preventing new users from joining | -| INVITE_SPLASH | guild has access to set an invite splash background | -| MEMBER_VERIFICATION_GATE_ENABLED | guild has enabled [Membership Screening](/docs/resources/guild#membership-screening-object) | -| MORE_SOUNDBOARD | guild has increased custom soundboard sound slots | -| MORE_STICKERS | guild has increased custom sticker slots | -| NEWS | guild has access to create announcement channels | -| PARTNERED | guild is partnered | -| PREVIEW_ENABLED | guild can be previewed before joining via Membership Screening or the directory | -| RAID_ALERTS_DISABLED | guild has disabled alerts for join raids in the configured safety alerts channel | -| ROLE_ICONS | guild is able to set role icons | -| ROLE_SUBSCRIPTIONS_AVAILABLE_FOR_PURCHASE | guild has role subscriptions that can be purchased | -| ROLE_SUBSCRIPTIONS_ENABLED | guild has enabled role subscriptions | -| SOUNDBOARD | guild has created soundboard sounds | -| TICKETED_EVENTS_ENABLED | guild has enabled ticketed events | -| VANITY_URL | guild has access to set a vanity URL | -| VERIFIED | guild is verified | -| VIP_REGIONS | guild has access to set 384kbps bitrate in voice (previously VIP voice servers) | -| WELCOME_SCREEN_ENABLED | guild has enabled the welcome screen | -| GUESTS_ENABLED | guild has access to guest invites | -| GUILD_TAGS | guild has access to set guild tags | -| ENHANCED_ROLE_COLORS | guild is able to set gradient colors to roles | - +| Feature | Description | +|-------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------| +| ANIMATED_BANNER | guild has access to set an animated guild banner image | +| ANIMATED_ICON | guild has access to set an animated guild icon | +| APPLICATION_COMMAND_PERMISSIONS_V2 | guild is using the [old permissions configuration behavior](/developers/docs/change-log#upcoming-application-command-permission-changes) | +| AUTO_MODERATION | guild has set up auto moderation rules | +| BANNER | guild has access to set a guild banner image | +| COMMUNITY | guild can enable welcome screen, Membership Screening, stage channels and discovery, and receives community updates | +| CREATOR_MONETIZABLE_PROVISIONAL | guild has enabled monetization | +| CREATOR_STORE_PAGE | guild has enabled the role subscription promo page | +| DEVELOPER_SUPPORT_SERVER | guild has been set as a support server on the App Directory | +| DISCOVERABLE | guild is able to be discovered in the directory | +| FEATURABLE | guild is able to be featured in the directory | +| INVITES_DISABLED | guild has paused invites, preventing new users from joining | +| INVITE_SPLASH | guild has access to set an invite splash background | +| MEMBER_VERIFICATION_GATE_ENABLED | guild has enabled [Membership Screening](/developers/docs/resources/guild#membership-screening-object) | +| MORE_SOUNDBOARD | guild has increased custom soundboard sound slots | +| MORE_STICKERS | guild has increased custom sticker slots | +| NEWS | guild has access to create announcement channels | +| PARTNERED | guild is partnered | +| PREVIEW_ENABLED | guild can be previewed before joining via Membership Screening or the directory | +| RAID_ALERTS_DISABLED | guild has disabled alerts for join raids in the configured safety alerts channel | +| ROLE_ICONS | guild is able to set role icons | +| ROLE_SUBSCRIPTIONS_AVAILABLE_FOR_PURCHASE | guild has role subscriptions that can be purchased | +| ROLE_SUBSCRIPTIONS_ENABLED | guild has enabled role subscriptions | +| SOUNDBOARD | guild has created soundboard sounds | +| TICKETED_EVENTS_ENABLED | guild has enabled ticketed events | +| VANITY_URL | guild has access to set a vanity URL | +| VERIFIED | guild is verified | +| VIP_REGIONS | guild has access to set 384kbps bitrate in voice (previously VIP voice servers) | +| WELCOME_SCREEN_ENABLED | guild has enabled the welcome screen | +| GUESTS_ENABLED | guild has access to guest invites | +| GUILD_TAGS | guild has access to set guild tags | +| ENHANCED_ROLE_COLORS | guild is able to set gradient colors to roles | + + ###### Mutable Guild Features | Features | Required Permissions | Effects | @@ -174,6 +188,7 @@ Fields specific to the `GUILD_CREATE` event are listed in the [Gateway Events do \* Server also must be passing all discovery requirements + ###### Example Guild ```json @@ -225,8 +240,9 @@ Fields specific to the `GUILD_CREATE` event are listed in the [Gateway Events do ### Unavailable Guild Object -A partial [guild](/docs/resources/guild#guild-object) object. Represents an Offline Guild, or a Guild whose information has not been provided through [Guild Create](/docs/events/gateway-events#guild-create) events during the Gateway connect. +A partial [guild](/developers/docs/resources/guild#guild-object) object. Represents an Offline Guild, or a Guild whose information has not been provided through [Guild Create](/developers/docs/events/gateway-events#guild-create) events during the Gateway connect. + ###### Example Unavailable Guild ```json @@ -238,22 +254,24 @@ A partial [guild](/docs/resources/guild#guild-object) object. Represents an Offl ### Guild Preview Object + ###### Guild Preview Structure -| Field | Type | Description | -|----------------------------|-------------------------------------------------------------------------------------|-----------------------------------------------------------| -| id | snowflake | guild id | -| name | string | guild name (2-100 characters) | -| icon | ?string | [icon hash](/docs/reference#image-formatting) | -| splash | ?string | [splash hash](/docs/reference#image-formatting) | -| discovery_splash | ?string | [discovery splash hash](/docs/reference#image-formatting) | -| emojis | array of [emoji](/docs/resources/emoji#emoji-object) objects | custom guild emojis | -| features | array of [guild feature](/docs/resources/guild#guild-object-guild-features) strings | enabled guild features | -| approximate_member_count | integer | approximate number of members in this guild | -| approximate_presence_count | integer | approximate number of online members in this guild | -| description | ?string | the description for the guild | -| stickers | array of [sticker](/docs/resources/sticker#sticker-object) objects | custom guild stickers | - +| Field | Type | Description | +|----------------------------|------------------------------------------------------------------------------------------------|----------------------------------------------------------------------| +| id | snowflake | guild id | +| name | string | guild name (2-100 characters) | +| icon | ?string | [icon hash](/developers/docs/reference#image-formatting) | +| splash | ?string | [splash hash](/developers/docs/reference#image-formatting) | +| discovery_splash | ?string | [discovery splash hash](/developers/docs/reference#image-formatting) | +| emojis | array of [emoji](/developers/docs/resources/emoji#emoji-object) objects | custom guild emojis | +| features | array of [guild feature](/developers/docs/resources/guild#guild-object-guild-features) strings | enabled guild features | +| approximate_member_count | integer | approximate number of members in this guild | +| approximate_presence_count | integer | approximate number of online members in this guild | +| description | ?string | the description for the guild | +| stickers | array of [sticker](/developers/docs/resources/sticker#sticker-object) objects | custom guild stickers | + + ###### Example Guild Preview ```json @@ -284,6 +302,7 @@ A partial [guild](/docs/resources/guild#guild-object) object. Represents an Offl ### Guild Widget Settings Object + ###### Guild Widget Settings Structure | Field | Type | Description | @@ -291,6 +310,7 @@ A partial [guild](/docs/resources/guild#guild-object) object. Represents an Offl | enabled | boolean | whether the widget is enabled | | channel_id | ?snowflake | the widget channel id | + ###### Example Guild Widget Settings ```json @@ -302,21 +322,23 @@ A partial [guild](/docs/resources/guild#guild-object) object. Represents an Offl ### Guild Widget Object + ###### Guild Widget Structure -| Field | Type | Description | -|----------------|----------------------------------------------------------------------------|----------------------------------------------------------------------| -| id | snowflake | guild id | -| name | string | guild name (2-100 characters) | -| instant_invite | ?string | instant invite for the guilds specified widget invite channel | -| channels | array of partial [channel](/docs/resources/channel#channel-object) objects | voice and stage channels which are accessible by @everyone | -| members | array of partial [user](/docs/resources/user#user-object) objects | special widget user objects that includes users presence (Limit 100) | -| presence_count | integer | number of online members in this guild | +| Field | Type | Description | +|----------------|---------------------------------------------------------------------------------------|----------------------------------------------------------------------| +| id | snowflake | guild id | +| name | string | guild name (2-100 characters) | +| instant_invite | ?string | instant invite for the guilds specified widget invite channel | +| channels | array of partial [channel](/developers/docs/resources/channel#channel-object) objects | voice and stage channels which are accessible by @everyone | +| members | array of partial [user](/developers/docs/resources/user#user-object) objects | special widget user objects that includes users presence (Limit 100) | +| presence_count | integer | number of online members in this guild | -:::warn + The fields `id`, `discriminator` and `avatar` are anonymized to prevent abuse. -::: + + ###### Example Guild Widget ```json @@ -352,37 +374,39 @@ The fields `id`, `discriminator` and `avatar` are anonymized to prevent abuse. ### Guild Member Object + ###### Guild Member Structure -| Field | Type | Description | -|-------------------------------|--------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| -| user? | [user](/docs/resources/user#user-object) object | the user this guild member represents | -| nick? | ?string | this user's guild nickname | -| avatar? | ?string | the member's [guild avatar hash](/docs/reference#image-formatting) | -| banner? | ?string | the member's [guild banner hash](/docs/reference#image-formatting) | -| roles | array of snowflakes | array of [role](/docs/topics/permissions#role-object) object ids | -| joined_at | ?ISO8601 timestamp | when the user joined the guild | -| premium_since? | ?ISO8601 timestamp | when the user started [boosting](https://support.discord.com/hc/en-us/articles/360028038352-Server-Boosting-) the guild | -| deaf | boolean | whether the user is deafened in voice channels | -| mute | boolean | whether the user is muted in voice channels | -| flags | integer | [guild member flags](/docs/resources/guild#guild-member-object-guild-member-flags) represented as a bit set, defaults to `0` | -| pending? | boolean | whether the user has not yet passed the guild's [Membership Screening](/docs/resources/guild#membership-screening-object) requirements | -| permissions? | string | total permissions of the member in the channel, including overwrites, returned when in the interaction object | -| communication_disabled_until? | ?ISO8601 timestamp | when the user's [timeout](https://support.discord.com/hc/en-us/articles/4413305239191-Time-Out-FAQ) will expire and the user will be able to communicate in the guild again, null or a time in the past if the user is not timed out | -| avatar_decoration_data? | ?[avatar decoration data](/docs/resources/user#avatar-decoration-data-object) object | data for the member's guild avatar decoration | - -:::info +| Field | Type | Description | +|-------------------------------|-------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| user? | [user](/developers/docs/resources/user#user-object) object | the user this guild member represents | +| nick? | ?string | this user's guild nickname | +| avatar? | ?string | the member's [guild avatar hash](/developers/docs/reference#image-formatting) | +| banner? | ?string | the member's [guild banner hash](/developers/docs/reference#image-formatting) | +| roles | array of snowflakes | array of [role](/developers/docs/topics/permissions#role-object) object ids | +| joined_at | ?ISO8601 timestamp | when the user joined the guild | +| premium_since? | ?ISO8601 timestamp | when the user started [boosting](https://support.discord.com/hc/en-us/articles/360028038352-Server-Boosting-) the guild | +| deaf | boolean | whether the user is deafened in voice channels | +| mute | boolean | whether the user is muted in voice channels | +| flags | integer | [guild member flags](/developers/docs/resources/guild#guild-member-object-guild-member-flags) represented as a bit set, defaults to `0` | +| pending? | boolean | whether the user has not yet passed the guild's [Membership Screening](/developers/docs/resources/guild#membership-screening-object) requirements | +| permissions? | string | total permissions of the member in the channel, including overwrites, returned when in the interaction object | +| communication_disabled_until? | ?ISO8601 timestamp | when the user's [timeout](https://support.discord.com/hc/en-us/articles/4413305239191-Time-Out-FAQ) will expire and the user will be able to communicate in the guild again, null or a time in the past if the user is not timed out | +| avatar_decoration_data? | ?[avatar decoration data](/developers/docs/resources/user#avatar-decoration-data-object) object | data for the member's guild avatar decoration | + + The field `user` won't be included in the member object attached to `MESSAGE_CREATE` and `MESSAGE_UPDATE` gateway events. -::: + -:::info + In `GUILD_` events, `pending` will always be included as true or false. In non `GUILD_` events which can only be triggered by non-`pending` users, `pending` will not be included. -::: + -:::info + Member objects retrieved from `VOICE_STATE_UPDATE` events will have `joined_at` set as `null` if the member was invited as a guest. -::: + + ###### Example Guild Member ```json @@ -398,6 +422,7 @@ Member objects retrieved from `VOICE_STATE_UPDATE` events will have `joined_at` } ``` + ###### Guild Member Flags | Flag | Value | Description | Editable | @@ -413,38 +438,40 @@ Member objects retrieved from `VOICE_STATE_UPDATE` events will have `joined_at` | DM_SETTINGS_UPSELL_ACKNOWLEDGED | `1 << 9` | Member has dismissed the DM settings upsell | false | | AUTOMOD_QUARANTINED_GUILD_TAG | `1 << 10` | Member's guild tag is blocked by AutoMod | false | -:::info + BYPASSES_VERIFICATION allows a member who does not meet verification requirements to participate in a server. -::: + ### Integration Object + ###### Integration Structure -| Field | Type | Description | -|-------------------------|------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------| -| id | snowflake | integration id | -| name | string | integration name | -| type | string | integration type (twitch, youtube, discord, or guild_subscription) | -| enabled | boolean | is this integration enabled | -| syncing? \* | boolean | is this integration syncing | -| role_id? \* | snowflake | id that this integration uses for "subscribers" | -| enable_emoticons? \* | boolean | whether emoticons should be synced for this integration (twitch only currently) | -| expire_behavior? \* | [integration expire behavior](/docs/resources/guild#integration-object-integration-expire-behaviors) | the behavior of expiring subscribers | -| expire_grace_period? \* | integer | the grace period (in days) before expiring subscribers | -| user? | [user](/docs/resources/user#user-object) object | user for this integration | -| account | [account](/docs/resources/guild#integration-account-object) object | integration account information | -| synced_at? \* | ISO8601 timestamp | when this integration was last synced | -| subscriber_count? \* | integer | how many subscribers this integration has | -| revoked? \* | boolean | has this integration been revoked | -| application? | [application](/docs/resources/guild#integration-application-object) object | The bot/OAuth2 application for discord integrations | -| scopes? | array of [OAuth2 scopes](/docs/topics/oauth2#shared-resources-oauth2-scopes) | the scopes the application has been authorized for | +| Field | Type | Description | +|-------------------------|-----------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------| +| id | snowflake | integration id | +| name | string | integration name | +| type | string | integration type (twitch, youtube, discord, or guild_subscription) | +| enabled | boolean | is this integration enabled | +| syncing? \* | boolean | is this integration syncing | +| role_id? \* | snowflake | id that this integration uses for "subscribers" | +| enable_emoticons? \* | boolean | whether emoticons should be synced for this integration (twitch only currently) | +| expire_behavior? \* | [integration expire behavior](/developers/docs/resources/guild#integration-object-integration-expire-behaviors) | the behavior of expiring subscribers | +| expire_grace_period? \* | integer | the grace period (in days) before expiring subscribers | +| user? | [user](/developers/docs/resources/user#user-object) object | user for this integration | +| account | [account](/developers/docs/resources/guild#integration-account-object) object | integration account information | +| synced_at? \* | ISO8601 timestamp | when this integration was last synced | +| subscriber_count? \* | integer | how many subscribers this integration has | +| revoked? \* | boolean | has this integration been revoked | +| application? | [application](/developers/docs/resources/guild#integration-application-object) object | The bot/OAuth2 application for discord integrations | +| scopes? | array of [OAuth2 scopes](/developers/docs/topics/oauth2#shared-resources-oauth2-scopes) | the scopes the application has been authorized for | \* These fields are not provided for discord bot integrations. -:::warn + Some older integrations may not have an attached user. -::: + + ###### Integration Expire Behaviors | Value | Name | @@ -454,6 +481,7 @@ Some older integrations may not have an attached user. ### Integration Account Object + ###### Integration Account Structure | Field | Type | Description | @@ -463,25 +491,27 @@ Some older integrations may not have an attached user. ### Integration Application Object + ###### Integration Application Structure -| Field | Type | Description | -|-------------|-------------------------------------------------|--------------------------------------------------------------| -| id | snowflake | the id of the app | -| name | string | the name of the app | -| icon | ?string | the [icon hash](/docs/reference#image-formatting) of the app | -| description | string | the description of the app | -| bot? | [user](/docs/resources/user#user-object) object | the bot associated with this application | +| Field | Type | Description | +|-------------|------------------------------------------------------------|-------------------------------------------------------------------------| +| id | snowflake | the id of the app | +| name | string | the name of the app | +| icon | ?string | the [icon hash](/developers/docs/reference#image-formatting) of the app | +| description | string | the description of the app | +| bot? | [user](/developers/docs/resources/user#user-object) object | the bot associated with this application | ### Ban Object ###### Ban Structure -| Field | Type | Description | -|--------|-------------------------------------------------|------------------------| -| reason | ?string | the reason for the ban | -| user | [user](/docs/resources/user#user-object) object | the banned user | +| Field | Type | Description | +|--------|------------------------------------------------------------|------------------------| +| reason | ?string | the reason for the ban | +| user | [user](/developers/docs/resources/user#user-object) object | the banned user | + ###### Example Ban ```json @@ -499,22 +529,25 @@ Some older integrations may not have an attached user. ### Welcome Screen Object + ###### Welcome Screen Structure -| Field | Type | Description | -|------------------|-------------------------------------------------------------------------------------------------------------------------|----------------------------------------------------| -| description | ?string | the server description shown in the welcome screen | -| welcome_channels | array of [welcome screen channel](/docs/resources/guild#welcome-screen-object-welcome-screen-channel-structure) objects | the channels shown in the welcome screen, up to 5 | +| Field | Type | Description | +|------------------|------------------------------------------------------------------------------------------------------------------------------------|----------------------------------------------------| +| description | ?string | the server description shown in the welcome screen | +| welcome_channels | array of [welcome screen channel](/developers/docs/resources/guild#welcome-screen-object-welcome-screen-channel-structure) objects | the channels shown in the welcome screen, up to 5 | + ###### Welcome Screen Channel Structure | Field | Type | Description | |-------------|------------|-------------------------------------------------------------------------------------------| | channel_id | snowflake | the channel's id | | description | string | the description shown for the channel | -| emoji_id | ?snowflake | the [emoji id](/docs/reference#image-formatting), if the emoji is custom | +| emoji_id | ?snowflake | the [emoji id](/developers/docs/reference#image-formatting), if the emoji is custom | | emoji_name | ?string | the emoji name if custom, the unicode character if standard, or `null` if no emoji is set | + ###### Example Welcome Screen ```json @@ -559,46 +592,50 @@ Some older integrations may not have an attached user. Represents the [onboarding](https://support.discord.com/hc/en-us/articles/11074987197975-Community-Onboarding-FAQ) flow for a guild. + ###### Guild Onboarding Structure -| Field | Type | Description | -|---------------------|-----------------------------------------------------------------------------------------------------------------|------------------------------------------------------------| -| guild_id | snowflake | ID of the guild this onboarding is part of | -| prompts | array of [onboarding prompt](/docs/resources/guild#guild-onboarding-object-onboarding-prompt-structure) objects | Prompts shown during onboarding and in customize community | -| default_channel_ids | array of snowflakes | Channel IDs that members get opted into automatically | -| enabled | boolean | Whether onboarding is enabled in the guild | -| mode | [onboarding mode](/docs/resources/guild#guild-onboarding-object-onboarding-mode) | Current mode of onboarding | +| Field | Type | Description | +|---------------------|----------------------------------------------------------------------------------------------------------------------------|------------------------------------------------------------| +| guild_id | snowflake | ID of the guild this onboarding is part of | +| prompts | array of [onboarding prompt](/developers/docs/resources/guild#guild-onboarding-object-onboarding-prompt-structure) objects | Prompts shown during onboarding and in customize community | +| default_channel_ids | array of snowflakes | Channel IDs that members get opted into automatically | +| enabled | boolean | Whether onboarding is enabled in the guild | +| mode | [onboarding mode](/developers/docs/resources/guild#guild-onboarding-object-onboarding-mode) | Current mode of onboarding | + ###### Onboarding Prompt Structure -| Field | Type | Description | -|---------------|---------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------| -| id | snowflake | ID of the prompt | -| type | [prompt type](/docs/resources/guild#guild-onboarding-object-prompt-types) | Type of prompt | -| options | array of [prompt option](/docs/resources/guild#guild-onboarding-object-prompt-option-structure) objects | Options available within the prompt | -| title | string | Title of the prompt | -| single_select | boolean | Indicates whether users are limited to selecting one option for the prompt | -| required | boolean | Indicates whether the prompt is required before a user completes the onboarding flow | -| in_onboarding | boolean | Indicates whether the prompt is present in the onboarding flow. If `false`, the prompt will only appear in the Channels & Roles tab | - +| Field | Type | Description | +|---------------|--------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------| +| id | snowflake | ID of the prompt | +| type | [prompt type](/developers/docs/resources/guild#guild-onboarding-object-prompt-types) | Type of prompt | +| options | array of [prompt option](/developers/docs/resources/guild#guild-onboarding-object-prompt-option-structure) objects | Options available within the prompt | +| title | string | Title of the prompt | +| single_select | boolean | Indicates whether users are limited to selecting one option for the prompt | +| required | boolean | Indicates whether the prompt is required before a user completes the onboarding flow | +| in_onboarding | boolean | Indicates whether the prompt is present in the onboarding flow. If `false`, the prompt will only appear in the Channels & Roles tab | + + ###### Prompt Option Structure -| Field | Type | Description | -|-----------------|----------------------------------------------------|-------------------------------------------------------------------| -| id | snowflake | ID of the prompt option | -| channel_ids | array of snowflakes | IDs for channels a member is added to when the option is selected | -| role_ids | array of snowflakes | IDs for roles assigned to a member when the option is selected | -| emoji? | [emoji](/docs/resources/emoji#emoji-object) object | Emoji of the option (see below) | -| emoji_id? | snowflake | Emoji ID of the option (see below) | -| emoji_name? | string | Emoji name of the option (see below) | -| emoji_animated? | boolean | Whether the emoji is animated (see below) | -| title | string | Title of the option | -| description | ?string | Description of the option | - -:::warn +| Field | Type | Description | +|-----------------|---------------------------------------------------------------|-------------------------------------------------------------------| +| id | snowflake | ID of the prompt option | +| channel_ids | array of snowflakes | IDs for channels a member is added to when the option is selected | +| role_ids | array of snowflakes | IDs for roles assigned to a member when the option is selected | +| emoji? | [emoji](/developers/docs/resources/emoji#emoji-object) object | Emoji of the option (see below) | +| emoji_id? | snowflake | Emoji ID of the option (see below) | +| emoji_name? | string | Emoji name of the option (see below) | +| emoji_animated? | boolean | Whether the emoji is animated (see below) | +| title | string | Title of the option | +| description | ?string | Description of the option | + + When creating or updating a prompt option, the `emoji_id`, `emoji_name`, and `emoji_animated` fields must be used instead of the emoji object. -::: + + ###### Onboarding Mode Defines the criteria used to satisfy Onboarding constraints that are required for enabling. @@ -608,6 +645,7 @@ Defines the criteria used to satisfy Onboarding constraints that are required fo | ONBOARDING_DEFAULT | 0 | Counts only Default Channels towards constraints | | ONBOARDING_ADVANCED | 1 | Counts Default Channels and Questions towards constraints | + ###### Prompt Types | Name | Value | @@ -615,6 +653,7 @@ Defines the criteria used to satisfy Onboarding constraints that are required fo | MULTIPLE_CHOICE | 0 | | DROPDOWN | 1 | + ###### Example Guild Onboarding ```json @@ -675,14 +714,15 @@ Defines the criteria used to satisfy Onboarding constraints that are required fo ### Membership Screening Object -In guilds with [Membership Screening](https://support.discord.com/hc/en-us/articles/1500000466882) enabled, when a member joins, [Guild Member Add](/docs/events/gateway-events#guild-member-add) will be emitted but they will initially be restricted from doing any actions in the guild, and `pending` will be true in the [member object](/docs/resources/guild#guild-member-object). When the member completes the screening, [Guild Member Update](/docs/events/gateway-events#guild-member-update) will be emitted and `pending` will be false. +In guilds with [Membership Screening](https://support.discord.com/hc/en-us/articles/1500000466882) enabled, when a member joins, [Guild Member Add](/developers/docs/events/gateway-events#guild-member-add) will be emitted but they will initially be restricted from doing any actions in the guild, and `pending` will be true in the [member object](/developers/docs/resources/guild#guild-member-object). When the member completes the screening, [Guild Member Update](/developers/docs/events/gateway-events#guild-member-update) will be emitted and `pending` will be false. -:::warn + We are making significant changes to the Membership Screening API specifically related to getting and editing the Membership Screening object. Long story short is that it can be improved. As such, we have removed those documentation. There will **not be** any changes to how pending members work, as outlined above. That behavior will stay the same. -::: + ### Incidents Data Object + ###### Incidents Data Structure | Field | Type | Description | @@ -692,6 +732,7 @@ We are making significant changes to the Membership Screening API specifically r | dm_spam_detected_at? | ?ISO8601 timestamp | when the dm spam was detected | | raid_detected_at? | ?ISO8601 timestamp | when the raid was detected | + ###### Example Incidents Data ```json @@ -702,16 +743,18 @@ We are making significant changes to the Membership Screening API specifically r ``` ## Get Guild -/guilds/[\{guild.id\}](/docs/resources/guild#guild-object) +/guilds/[\{guild.id\}](/developers/docs/resources/guild#guild-object) -Returns the [guild](/docs/resources/guild#guild-object) object for the given id. If `with_counts` is set to `true`, this endpoint will also return `approximate_member_count` and `approximate_presence_count` for the guild. +Returns the [guild](/developers/docs/resources/guild#guild-object) object for the given id. If `with_counts` is set to `true`, this endpoint will also return `approximate_member_count` and `approximate_presence_count` for the guild. + ###### Query String Params -| Field | Type | Description | Required | Default | -|--------------|--------------------------------------------------|-------------------------------------------------------------------------------|----------|---------| -| with_counts? | [boolean](/docs/reference#boolean-query-strings) | when `true`, will return approximate member and presence counts for the guild | false | false | +| Field | Type | Description | Required | Default | +|--------------|-------------------------------------------------------------|-------------------------------------------------------------------------------|----------|---------| +| with_counts? | [boolean](/developers/docs/reference#boolean-query-strings) | when `true`, will return approximate member and presence counts for the guild | false | false | + ###### Example Response ```json @@ -789,109 +832,112 @@ Returns the [guild](/docs/resources/guild#guild-object) object for the given id. ``` ## Get Guild Preview -/guilds/[\{guild.id\}](/docs/resources/guild#guild-object)/preview +/guilds/[\{guild.id\}](/developers/docs/resources/guild#guild-object)/preview -Returns the [guild preview](/docs/resources/guild#guild-preview-object) object for the given id. -If the user is not in the guild, then the guild must be [discoverable](/docs/resources/guild#guild-object-guild-features). +Returns the [guild preview](/developers/docs/resources/guild#guild-preview-object) object for the given id. +If the user is not in the guild, then the guild must be [discoverable](/developers/docs/resources/guild#guild-object-guild-features). ## Modify Guild -/guilds/[\{guild.id\}](/docs/resources/guild#guild-object) +/guilds/[\{guild.id\}](/developers/docs/resources/guild#guild-object) -Modify a guild's settings. Requires the `MANAGE_GUILD` permission. Returns the updated [guild](/docs/resources/guild#guild-object) object on success. Fires a [Guild Update](/docs/events/gateway-events#guild-update) Gateway event. +Modify a guild's settings. Requires the `MANAGE_GUILD` permission. Returns the updated [guild](/developers/docs/resources/guild#guild-object) object on success. Fires a [Guild Update](/developers/docs/events/gateway-events#guild-update) Gateway event. -:::info + All parameters to this endpoint are optional -::: + -:::info + This endpoint supports the `X-Audit-Log-Reason` header. -::: + -:::warn -Attempting to add or remove the `COMMUNITY` [guild feature](/docs/resources/guild#guild-object-guild-features) requires the `ADMINISTRATOR` permission. -::: + +Attempting to add or remove the `COMMUNITY` [guild feature](/developers/docs/resources/guild#guild-object-guild-features) requires the `ADMINISTRATOR` permission. + + ###### JSON Params -| Field | Type | Description | -|-------------------------------|-------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------| -| name | string | guild name | -| region | ?string | guild [voice region](/docs/resources/voice#voice-region-object) id (deprecated) | -| verification_level | ?integer | [verification level](/docs/resources/guild#guild-object-verification-level) | -| default_message_notifications | ?integer | default [message notification level](/docs/resources/guild#guild-object-default-message-notification-level) | -| explicit_content_filter | ?integer | [explicit content filter level](/docs/resources/guild#guild-object-explicit-content-filter-level) | -| afk_channel_id | ?snowflake | id for afk channel | -| afk_timeout | integer | afk timeout in seconds, can be set to: 60, 300, 900, 1800, 3600 | -| icon | ?[image data](/docs/reference#image-data) | base64 1024x1024 png/jpeg/gif image for the guild icon (can be animated gif when the server has the `ANIMATED_ICON` feature) | -| splash | ?[image data](/docs/reference#image-data) | base64 16:9 png/jpeg image for the guild splash (when the server has the `INVITE_SPLASH` feature) | -| discovery_splash | ?[image data](/docs/reference#image-data) | base64 16:9 png/jpeg image for the guild discovery splash (when the server has the `DISCOVERABLE` feature) | -| banner | ?[image data](/docs/reference#image-data) | base64 16:9 png/jpeg image for the guild banner (when the server has the `BANNER` feature; can be animated gif when the server has the `ANIMATED_BANNER` feature) | -| system_channel_id | ?snowflake | the id of the channel where guild notices such as welcome messages and boost events are posted | -| system_channel_flags | integer | [system channel flags](/docs/resources/guild#guild-object-system-channel-flags) | -| rules_channel_id | ?snowflake | the id of the channel where Community guilds display rules and/or guidelines | -| public_updates_channel_id | ?snowflake | the id of the channel where admins and moderators of Community guilds receive notices from Discord | -| preferred_locale | ?string | the preferred [locale](/docs/reference#locales) of a Community guild used in server discovery and notices from Discord; defaults to "en-US" | -| features | array of [guild feature](/docs/resources/guild#guild-object-guild-features) strings | enabled guild features | -| description | ?string | the description for the guild | -| premium_progress_bar_enabled | boolean | whether the guild's boost progress bar should be enabled | -| safety_alerts_channel_id | ?snowflake | the id of the channel where admins and moderators of Community guilds receive safety alerts from Discord | +| Field | Type | Description | +|-------------------------------|------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| name | string | guild name | +| region | ?string | guild [voice region](/developers/docs/resources/voice#voice-region-object) id (deprecated) | +| verification_level | ?integer | [verification level](/developers/docs/resources/guild#guild-object-verification-level) | +| default_message_notifications | ?integer | default [message notification level](/developers/docs/resources/guild#guild-object-default-message-notification-level) | +| explicit_content_filter | ?integer | [explicit content filter level](/developers/docs/resources/guild#guild-object-explicit-content-filter-level) | +| afk_channel_id | ?snowflake | id for afk channel | +| afk_timeout | integer | afk timeout in seconds, can be set to: 60, 300, 900, 1800, 3600 | +| icon | ?[image data](/developers/docs/reference#image-data) | base64 1024x1024 png/jpeg/gif image for the guild icon (can be animated gif when the server has the `ANIMATED_ICON` feature) | +| splash | ?[image data](/developers/docs/reference#image-data) | base64 16:9 png/jpeg image for the guild splash (when the server has the `INVITE_SPLASH` feature) | +| discovery_splash | ?[image data](/developers/docs/reference#image-data) | base64 16:9 png/jpeg image for the guild discovery splash (when the server has the `DISCOVERABLE` feature) | +| banner | ?[image data](/developers/docs/reference#image-data) | base64 16:9 png/jpeg image for the guild banner (when the server has the `BANNER` feature; can be animated gif when the server has the `ANIMATED_BANNER` feature) | +| system_channel_id | ?snowflake | the id of the channel where guild notices such as welcome messages and boost events are posted | +| system_channel_flags | integer | [system channel flags](/developers/docs/resources/guild#guild-object-system-channel-flags) | +| rules_channel_id | ?snowflake | the id of the channel where Community guilds display rules and/or guidelines | +| public_updates_channel_id | ?snowflake | the id of the channel where admins and moderators of Community guilds receive notices from Discord | +| preferred_locale | ?string | the preferred [locale](/developers/docs/reference#locales) of a Community guild used in server discovery and notices from Discord; defaults to "en-US" | +| features | array of [guild feature](/developers/docs/resources/guild#guild-object-guild-features) strings | enabled guild features | +| description | ?string | the description for the guild | +| premium_progress_bar_enabled | boolean | whether the guild's boost progress bar should be enabled | +| safety_alerts_channel_id | ?snowflake | the id of the channel where admins and moderators of Community guilds receive safety alerts from Discord | ## Get Guild Channels -/guilds/[\{guild.id\}](/docs/resources/guild#guild-object)/channels +/guilds/[\{guild.id\}](/developers/docs/resources/guild#guild-object)/channels -Returns a list of guild [channel](/docs/resources/channel#channel-object) objects. Does not include threads. +Returns a list of guild [channel](/developers/docs/resources/channel#channel-object) objects. Does not include threads. ## Create Guild Channel -/guilds/[\{guild.id\}](/docs/resources/guild#guild-object)/channels +/guilds/[\{guild.id\}](/developers/docs/resources/guild#guild-object)/channels -Create a new [channel](/docs/resources/channel#channel-object) object for the guild. Requires the `MANAGE_CHANNELS` permission. If setting permission overwrites, only permissions your bot has in the guild can be allowed/denied. Setting `MANAGE_ROLES` permission in channels is only possible for guild administrators. Returns the new [channel](/docs/resources/channel#channel-object) object on success. Fires a [Channel Create](/docs/events/gateway-events#channel-create) Gateway event. +Create a new [channel](/developers/docs/resources/channel#channel-object) object for the guild. Requires the `MANAGE_CHANNELS` permission. If setting permission overwrites, only permissions your bot has in the guild can be allowed/denied. Setting `MANAGE_ROLES` permission in channels is only possible for guild administrators. Returns the new [channel](/developers/docs/resources/channel#channel-object) object on success. Fires a [Channel Create](/developers/docs/events/gateway-events#channel-create) Gateway event. -:::info + All parameters to this endpoint are optional and nullable excluding `name` -::: + -:::info + This endpoint supports the `X-Audit-Log-Reason` header. -::: + + ###### JSON Params -| Field | Type | Description | Channel Type | -|------------------------------------|--------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|------------------------------------------------| -| name | string | channel name (1-100 characters) | All | -| type | integer | the [type of channel](/docs/resources/channel#channel-object-channel-types) | All | -| topic | string | channel topic (0-1024 characters) | Text, Announcement, Forum, Media | -| bitrate\* | integer | the bitrate (in bits) of the voice or stage channel; min 8000 | Voice, Stage | -| user_limit | integer | the user limit of the voice channel | Voice, Stage | -| rate_limit_per_user | integer | amount of seconds a user has to wait before sending another message (0-21600); bots, as well as users with the permission `manage_messages` or `manage_channel`, are unaffected | Text, Voice, Stage, Forum, Media | -| position | integer | sorting position of the channel (channels with the same position are sorted by id) | All | -| permission_overwrites\*\* | array of partial [overwrite](/docs/resources/channel#overwrite-object) objects | the channel's permission overwrites | All | -| parent_id | snowflake | id of the parent category for a channel | Text, Voice, Announcement, Stage, Forum, Media | -| nsfw | boolean | whether the channel is nsfw | Text, Voice, Announcement, Stage, Forum | -| rtc_region | string | channel [voice region](/docs/resources/voice#voice-region-object) id of the voice or stage channel, automatic when set to null | Voice, Stage | -| video_quality_mode | integer | the camera [video quality mode](/docs/resources/channel#channel-object-video-quality-modes) of the voice channel | Voice, Stage | -| default_auto_archive_duration | integer | the default duration that the clients use (not the API) for newly created threads in the channel, in minutes, to automatically archive the thread after recent activity | Text, Announcement, Forum, Media | -| default_reaction_emoji | [default reaction](/docs/resources/channel#default-reaction-object) object | emoji to show in the add reaction button on a thread in a `GUILD_FORUM` or a `GUILD_MEDIA` channel | Forum, Media | -| available_tags | array of [tag](/docs/resources/channel#forum-tag-object) objects | set of tags that can be used in a `GUILD_FORUM` or a `GUILD_MEDIA` channel | Forum, Media | -| default_sort_order | integer | the [default sort order type](/docs/resources/channel#channel-object-sort-order-types) used to order posts in `GUILD_FORUM` and `GUILD_MEDIA` channels | Forum, Media | -| default_forum_layout | integer | the [default forum layout view](/docs/resources/channel#channel-object-forum-layout-types) used to display posts in `GUILD_FORUM` channels | Forum | -| default_thread_rate_limit_per_user | integer | the initial `rate_limit_per_user` to set on newly created threads in a channel. this field is copied to the thread at creation time and does not live update. | Text, Announcement, Forum, Media | - -\* For voice channels, normal servers can set bitrate up to 96000, servers with Boost level 1 can set up to 128000, servers with Boost level 2 can set up to 256000, and servers with Boost level 3 or the `VIP_REGIONS` [guild feature](/docs/resources/guild#guild-object-guild-features) can set up to 384000. For stage channels, bitrate can be set up to 64000. +| Field | Type | Description | Channel Type | +|------------------------------------|-------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|------------------------------------------------| +| name | string | channel name (1-100 characters) | All | +| type | integer | the [type of channel](/developers/docs/resources/channel#channel-object-channel-types) | All | +| topic | string | channel topic (0-1024 characters) | Text, Announcement, Forum, Media | +| bitrate\* | integer | the bitrate (in bits) of the voice or stage channel; min 8000 | Voice, Stage | +| user_limit | integer | the user limit of the voice channel | Voice, Stage | +| rate_limit_per_user | integer | amount of seconds a user has to wait before sending another message (0-21600); bots, as well as users with the permission `manage_messages` or `manage_channel`, are unaffected | Text, Voice, Stage, Forum, Media | +| position | integer | sorting position of the channel (channels with the same position are sorted by id) | All | +| permission_overwrites\*\* | array of partial [overwrite](/developers/docs/resources/channel#overwrite-object) objects | the channel's permission overwrites | All | +| parent_id | snowflake | id of the parent category for a channel | Text, Voice, Announcement, Stage, Forum, Media | +| nsfw | boolean | whether the channel is nsfw | Text, Voice, Announcement, Stage, Forum | +| rtc_region | string | channel [voice region](/developers/docs/resources/voice#voice-region-object) id of the voice or stage channel, automatic when set to null | Voice, Stage | +| video_quality_mode | integer | the camera [video quality mode](/developers/docs/resources/channel#channel-object-video-quality-modes) of the voice channel | Voice, Stage | +| default_auto_archive_duration | integer | the default duration that the clients use (not the API) for newly created threads in the channel, in minutes, to automatically archive the thread after recent activity | Text, Announcement, Forum, Media | +| default_reaction_emoji | [default reaction](/developers/docs/resources/channel#default-reaction-object) object | emoji to show in the add reaction button on a thread in a `GUILD_FORUM` or a `GUILD_MEDIA` channel | Forum, Media | +| available_tags | array of [tag](/developers/docs/resources/channel#forum-tag-object) objects | set of tags that can be used in a `GUILD_FORUM` or a `GUILD_MEDIA` channel | Forum, Media | +| default_sort_order | integer | the [default sort order type](/developers/docs/resources/channel#channel-object-sort-order-types) used to order posts in `GUILD_FORUM` and `GUILD_MEDIA` channels | Forum, Media | +| default_forum_layout | integer | the [default forum layout view](/developers/docs/resources/channel#channel-object-forum-layout-types) used to display posts in `GUILD_FORUM` channels | Forum | +| default_thread_rate_limit_per_user | integer | the initial `rate_limit_per_user` to set on newly created threads in a channel. this field is copied to the thread at creation time and does not live update. | Text, Announcement, Forum, Media | + +\* For voice channels, normal servers can set bitrate up to 96000, servers with Boost level 1 can set up to 128000, servers with Boost level 2 can set up to 256000, and servers with Boost level 3 or the `VIP_REGIONS` [guild feature](/developers/docs/resources/guild#guild-object-guild-features) can set up to 384000. For stage channels, bitrate can be set up to 64000. \*\* In each overwrite object, the `allow` and `deny` keys can be omitted or set to `null`, which both default to `"0"`. ## Modify Guild Channel Positions -/guilds/[\{guild.id\}](/docs/resources/guild#guild-object)/channels +/guilds/[\{guild.id\}](/developers/docs/resources/guild#guild-object)/channels -Modify the positions of a set of [channel](/docs/resources/channel#channel-object) objects for the guild. Requires `MANAGE_CHANNELS` permission. Returns a 204 empty response on success. Fires multiple [Channel Update](/docs/events/gateway-events#channel-update) Gateway events. +Modify the positions of a set of [channel](/developers/docs/resources/channel#channel-object) objects for the guild. Requires `MANAGE_CHANNELS` permission. Returns a 204 empty response on success. Fires multiple [Channel Update](/developers/docs/events/gateway-events#channel-update) Gateway events. -:::info + Only channels to be modified are required. -::: + This endpoint takes a JSON array of parameters in the following format: + ###### JSON Params | Field | Type | Description | @@ -902,35 +948,37 @@ This endpoint takes a JSON array of parameters in the following format: | parent_id? | ?snowflake | the new parent ID for the channel that is moved | ## List Active Guild Threads -/guilds/[\{guild.id\}](/docs/resources/guild#guild-object)/threads/active +/guilds/[\{guild.id\}](/developers/docs/resources/guild#guild-object)/threads/active Returns all active threads in the guild, including public and private threads. Threads are ordered by their `id`, in descending order. + ###### Response Body -| Field | Type | Description | -|---------|---------------------------------------------------------------------------------|-----------------------------------------------------------------------------| -| threads | array of [channel](/docs/resources/channel#channel-object) objects | the active threads | -| members | array of [thread members](/docs/resources/channel#thread-member-object) objects | a thread member object for each returned thread the current user has joined | +| Field | Type | Description | +|---------|--------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------| +| threads | array of [channel](/developers/docs/resources/channel#channel-object) objects | the active threads | +| members | array of [thread members](/developers/docs/resources/channel#thread-member-object) objects | a thread member object for each returned thread the current user has joined | ## Get Guild Member -/guilds/[\{guild.id\}](/docs/resources/guild#guild-object)/members/[\{user.id\}](/docs/resources/user#user-object) +/guilds/[\{guild.id\}](/developers/docs/resources/guild#guild-object)/members/[\{user.id\}](/developers/docs/resources/user#user-object) -Returns a [guild member](/docs/resources/guild#guild-member-object) object for the specified user. +Returns a [guild member](/developers/docs/resources/guild#guild-member-object) object for the specified user. ## List Guild Members -/guilds/[\{guild.id\}](/docs/resources/guild#guild-object)/members +/guilds/[\{guild.id\}](/developers/docs/resources/guild#guild-object)/members -Returns a list of [guild member](/docs/resources/guild#guild-member-object) objects that are members of the guild. +Returns a list of [guild member](/developers/docs/resources/guild#guild-member-object) objects that are members of the guild. -:::warn -This endpoint is restricted according to whether the `GUILD_MEMBERS` [Privileged Intent](/docs/events/gateway#privileged-intents) is enabled for your application. -::: + +This endpoint is restricted according to whether the `GUILD_MEMBERS` [Privileged Intent](/developers/docs/events/gateway#privileged-intents) is enabled for your application. + -:::info + All parameters to this endpoint are optional -::: + + ###### Query String Params | Field | Type | Description | Default | @@ -939,14 +987,15 @@ All parameters to this endpoint are optional | after | snowflake | the highest user id in the previous page | 0 | ## Search Guild Members -/guilds/[\{guild.id\}](/docs/resources/guild#guild-object)/members/search +/guilds/[\{guild.id\}](/developers/docs/resources/guild#guild-object)/members/search -Returns a list of [guild member](/docs/resources/guild#guild-member-object) objects whose username or nickname starts with a provided string. +Returns a list of [guild member](/developers/docs/resources/guild#guild-member-object) objects whose username or nickname starts with a provided string. -:::info + All parameters to this endpoint except for `query` are optional -::: + + ###### Query String Params | Field | Type | Description | Default | @@ -955,20 +1004,21 @@ All parameters to this endpoint except for `query` are optional | limit | integer | max number of members to return (1-1000) | 1 | ## Add Guild Member -/guilds/[\{guild.id\}](/docs/resources/guild#guild-object)/members/[\{user.id\}](/docs/resources/user#user-object) +/guilds/[\{guild.id\}](/developers/docs/resources/guild#guild-object)/members/[\{user.id\}](/developers/docs/resources/user#user-object) -Adds a user to the guild, provided you have a valid oauth2 access token for the user with the `guilds.join` scope. Returns a 201 Created with the [guild member](/docs/resources/guild#guild-member-object) as the body, or 204 No Content if the user is already a member of the guild. Fires a [Guild Member Add](/docs/events/gateway-events#guild-member-add) Gateway event. +Adds a user to the guild, provided you have a valid oauth2 access token for the user with the `guilds.join` scope. Returns a 201 Created with the [guild member](/developers/docs/resources/guild#guild-member-object) as the body, or 204 No Content if the user is already a member of the guild. Fires a [Guild Member Add](/developers/docs/events/gateway-events#guild-member-add) Gateway event. -For guilds with [Membership Screening](/docs/resources/guild#membership-screening-object) enabled, this endpoint will default to adding new members as `pending` in the [guild member object](/docs/resources/guild#guild-member-object). Members that are `pending` will have to complete membership screening before they become full members that can talk. +For guilds with [Membership Screening](/developers/docs/resources/guild#membership-screening-object) enabled, this endpoint will default to adding new members as `pending` in the [guild member object](/developers/docs/resources/guild#guild-member-object). Members that are `pending` will have to complete membership screening before they become full members that can talk. -:::info + All parameters to this endpoint except for `access_token` are optional. -::: + -:::info + The Authorization header must be a Bot token (belonging to the same application used for authorization), and the bot must be a member of the guild with `CREATE_INSTANT_INVITE` permission. -::: + + ###### JSON Params | Field | Type | Description | Permission | @@ -981,18 +1031,19 @@ The Authorization header must be a Bot token (belonging to the same application ## Modify Guild Member -/guilds/[\{guild.id\}](/docs/resources/guild#guild-object)/members/[\{user.id\}](/docs/resources/user#user-object) +/guilds/[\{guild.id\}](/developers/docs/resources/guild#guild-object)/members/[\{user.id\}](/developers/docs/resources/user#user-object) -Modify attributes of a [guild member](/docs/resources/guild#guild-member-object). Returns a 200 OK with the [guild member](/docs/resources/guild#guild-member-object) as the body. Fires a [Guild Member Update](/docs/events/gateway-events#guild-member-update) Gateway event. If the `channel_id` is set to null, this will force the target user to be disconnected from voice. +Modify attributes of a [guild member](/developers/docs/resources/guild#guild-member-object). Returns a 200 OK with the [guild member](/developers/docs/resources/guild#guild-member-object) as the body. Fires a [Guild Member Update](/developers/docs/events/gateway-events#guild-member-update) Gateway event. If the `channel_id` is set to null, this will force the target user to be disconnected from voice. -:::info + All parameters to this endpoint are optional and nullable. When moving members to channels, the API user _must_ have permissions to both connect to the channel and have the `MOVE_MEMBERS` permission. -::: + -:::info + This endpoint supports the `X-Audit-Log-Reason` header. -::: + + ###### JSON Params | Field | Type | Description | Permission | @@ -1003,39 +1054,41 @@ This endpoint supports the `X-Audit-Log-Reason` header. | deaf | boolean | whether the user is deafened in voice channels. Will throw a 400 error if the user is not in a voice channel | DEAFEN_MEMBERS | | channel_id | snowflake | id of channel to move user to (if they are connected to voice) | MOVE_MEMBERS | | communication_disabled_until | ISO8601 timestamp | when the user's [timeout](https://support.discord.com/hc/en-us/articles/4413305239191-Time-Out-FAQ) will expire and the user will be able to communicate in the guild again (up to 28 days in the future), set to null to remove timeout. Will throw a 403 error if the user has the ADMINISTRATOR permission or is the owner of the guild | MODERATE_MEMBERS | -| flags | integer | [guild member flags](/docs/resources/guild#guild-member-object-guild-member-flags) | MANAGE_GUILD or MANAGE_ROLES or (MODERATE_MEMBERS and KICK_MEMBERS and BAN_MEMBERS) | +| flags | integer | [guild member flags](/developers/docs/resources/guild#guild-member-object-guild-member-flags) | MANAGE_GUILD or MANAGE_ROLES or (MODERATE_MEMBERS and KICK_MEMBERS and BAN_MEMBERS) | ## Modify Current Member -/guilds/[\{guild.id\}](/docs/resources/guild#guild-object)/members/@me +/guilds/[\{guild.id\}](/developers/docs/resources/guild#guild-object)/members/@me -Modifies the current member in a guild. Returns a 200 with the updated member object on success. Fires a [Guild Member Update](/docs/events/gateway-events#guild-member-update) Gateway event. +Modifies the current member in a guild. Returns a 200 with the updated member object on success. Fires a [Guild Member Update](/developers/docs/events/gateway-events#guild-member-update) Gateway event. -:::info + This endpoint supports the `X-Audit-Log-Reason` header. -::: + + ###### JSON Params -| Field | Type | Description | Permission | -|---------|---------|--------------------------------------------------------------------|-----------------| -| nick? | ?string | value to set user's nickname to | CHANGE_NICKNAME | -| banner? | ?string | [data URI base64 encoded](/docs/reference#image-data) banner image | | -| avatar? | ?string | [data URI base64 encoded](/docs/reference#image-data) avatar image | | -| bio? | ?string | guild member bio | | +| Field | Type | Description | Permission | +|---------|---------|-------------------------------------------------------------------------------|-----------------| +| nick? | ?string | value to set user's nickname to | CHANGE_NICKNAME | +| banner? | ?string | [data URI base64 encoded](/developers/docs/reference#image-data) banner image | | +| avatar? | ?string | [data URI base64 encoded](/developers/docs/reference#image-data) avatar image | | +| bio? | ?string | guild member bio | | ## Modify Current User Nick -/guilds/[\{guild.id\}](/docs/resources/guild#guild-object)/members/@me/nick +/guilds/[\{guild.id\}](/developers/docs/resources/guild#guild-object)/members/@me/nick -:::danger -Deprecated in favor of [Modify Current Member](/docs/resources/guild#modify-current-member). -::: + +Deprecated in favor of [Modify Current Member](/developers/docs/resources/guild#modify-current-member). + -Modifies the nickname of the current user in a guild. Returns a 200 with the nickname on success. Fires a [Guild Member Update](/docs/events/gateway-events#guild-member-update) Gateway event. +Modifies the nickname of the current user in a guild. Returns a 200 with the nickname on success. Fires a [Guild Member Update](/developers/docs/events/gateway-events#guild-member-update) Gateway event. -:::info + This endpoint supports the `X-Audit-Log-Reason` header. -::: + + ###### JSON Params | Field | Type | Description | Permission | @@ -1043,37 +1096,38 @@ This endpoint supports the `X-Audit-Log-Reason` header. | nick? | ?string | value to set user's nickname to | CHANGE_NICKNAME | ## Add Guild Member Role -/guilds/[\{guild.id\}](/docs/resources/guild#guild-object)/members/[\{user.id\}](/docs/resources/user#user-object)/roles/[\{role.id\}](/docs/topics/permissions#role-object) +/guilds/[\{guild.id\}](/developers/docs/resources/guild#guild-object)/members/[\{user.id\}](/developers/docs/resources/user#user-object)/roles/[\{role.id\}](/developers/docs/topics/permissions#role-object) -Adds a role to a [guild member](/docs/resources/guild#guild-member-object). Requires the `MANAGE_ROLES` permission. Returns a 204 empty response on success. Fires a [Guild Member Update](/docs/events/gateway-events#guild-member-update) Gateway event. +Adds a role to a [guild member](/developers/docs/resources/guild#guild-member-object). Requires the `MANAGE_ROLES` permission. Returns a 204 empty response on success. Fires a [Guild Member Update](/developers/docs/events/gateway-events#guild-member-update) Gateway event. -:::info + This endpoint supports the `X-Audit-Log-Reason` header. -::: + ## Remove Guild Member Role -/guilds/[\{guild.id\}](/docs/resources/guild#guild-object)/members/[\{user.id\}](/docs/resources/user#user-object)/roles/[\{role.id\}](/docs/topics/permissions#role-object) +/guilds/[\{guild.id\}](/developers/docs/resources/guild#guild-object)/members/[\{user.id\}](/developers/docs/resources/user#user-object)/roles/[\{role.id\}](/developers/docs/topics/permissions#role-object) -Removes a role from a [guild member](/docs/resources/guild#guild-member-object). Requires the `MANAGE_ROLES` permission. Returns a 204 empty response on success. Fires a [Guild Member Update](/docs/events/gateway-events#guild-member-update) Gateway event. +Removes a role from a [guild member](/developers/docs/resources/guild#guild-member-object). Requires the `MANAGE_ROLES` permission. Returns a 204 empty response on success. Fires a [Guild Member Update](/developers/docs/events/gateway-events#guild-member-update) Gateway event. -:::info + This endpoint supports the `X-Audit-Log-Reason` header. -::: + ## Remove Guild Member -/guilds/[\{guild.id\}](/docs/resources/guild#guild-object)/members/[\{user.id\}](/docs/resources/user#user-object) +/guilds/[\{guild.id\}](/developers/docs/resources/guild#guild-object)/members/[\{user.id\}](/developers/docs/resources/user#user-object) -Remove a member from a guild. Requires `KICK_MEMBERS` permission. Returns a 204 empty response on success. Fires a [Guild Member Remove](/docs/events/gateway-events#guild-member-remove) Gateway event. +Remove a member from a guild. Requires `KICK_MEMBERS` permission. Returns a 204 empty response on success. Fires a [Guild Member Remove](/developers/docs/events/gateway-events#guild-member-remove) Gateway event. -:::info + This endpoint supports the `X-Audit-Log-Reason` header. -::: + ## Get Guild Bans -/guilds/[\{guild.id\}](/docs/resources/guild#guild-object)/bans +/guilds/[\{guild.id\}](/developers/docs/resources/guild#guild-object)/bans -Returns a list of [ban](/docs/resources/guild#ban-object) objects for the users banned from this guild. Requires the `BAN_MEMBERS` permission. +Returns a list of [ban](/developers/docs/resources/guild#ban-object) objects for the users banned from this guild. Requires the `BAN_MEMBERS` permission. + ###### Query String Params | Field | Type | Description | Default | @@ -1085,19 +1139,20 @@ Returns a list of [ban](/docs/resources/guild#ban-object) objects for the users \* Provide a user id to `before` and `after` for pagination. Users will always be returned in ascending order by `user.id`. If both `before` and `after` are provided, only `before` is respected. ## Get Guild Ban -/guilds/[\{guild.id\}](/docs/resources/guild#guild-object)/bans/[\{user.id\}](/docs/resources/user#user-object) +/guilds/[\{guild.id\}](/developers/docs/resources/guild#guild-object)/bans/[\{user.id\}](/developers/docs/resources/user#user-object) -Returns a [ban](/docs/resources/guild#ban-object) object for the given user or a 404 not found if the ban cannot be found. Requires the `BAN_MEMBERS` permission. +Returns a [ban](/developers/docs/resources/guild#ban-object) object for the given user or a 404 not found if the ban cannot be found. Requires the `BAN_MEMBERS` permission. ## Create Guild Ban -/guilds/[\{guild.id\}](/docs/resources/guild#guild-object)/bans/[\{user.id\}](/docs/resources/user#user-object) +/guilds/[\{guild.id\}](/developers/docs/resources/guild#guild-object)/bans/[\{user.id\}](/developers/docs/resources/user#user-object) -Create a guild ban, and optionally delete previous messages sent by the banned user. Requires the `BAN_MEMBERS` permission. Returns a 204 empty response on success. Fires a [Guild Ban Add](/docs/events/gateway-events#guild-ban-add) Gateway event. +Create a guild ban, and optionally delete previous messages sent by the banned user. Requires the `BAN_MEMBERS` permission. Returns a 204 empty response on success. Fires a [Guild Ban Add](/developers/docs/events/gateway-events#guild-ban-add) Gateway event. -:::info + This endpoint supports the `X-Audit-Log-Reason` header. -::: + + ###### JSON Params | Field | Type | Description | Default | @@ -1106,23 +1161,24 @@ This endpoint supports the `X-Audit-Log-Reason` header. | delete_message_seconds? | integer | number of seconds to delete messages for, between 0 and 604800 (7 days) | 0 | ## Remove Guild Ban -/guilds/[\{guild.id\}](/docs/resources/guild#guild-object)/bans/[\{user.id\}](/docs/resources/user#user-object) +/guilds/[\{guild.id\}](/developers/docs/resources/guild#guild-object)/bans/[\{user.id\}](/developers/docs/resources/user#user-object) -Remove the ban for a user. Requires the `BAN_MEMBERS` permissions. Returns a 204 empty response on success. Fires a [Guild Ban Remove](/docs/events/gateway-events#guild-ban-remove) Gateway event. +Remove the ban for a user. Requires the `BAN_MEMBERS` permissions. Returns a 204 empty response on success. Fires a [Guild Ban Remove](/developers/docs/events/gateway-events#guild-ban-remove) Gateway event. -:::info + This endpoint supports the `X-Audit-Log-Reason` header. -::: + ## Bulk Guild Ban -/guilds/[\{guild.id\}](/docs/resources/guild#guild-object)/bulk-ban +/guilds/[\{guild.id\}](/developers/docs/resources/guild#guild-object)/bulk-ban Ban up to 200 users from a guild, and optionally delete previous messages sent by the banned users. Requires both the `BAN_MEMBERS` and `MANAGE_GUILD` permissions. Returns a 200 response on success, including the fields `banned_users` with the IDs of the banned users and `failed_users` with IDs that could not be banned or were already banned. -:::info + This endpoint supports the `X-Audit-Log-Reason` header. -::: + + ###### JSON Params | Field | Type | Description | Default | @@ -1130,6 +1186,7 @@ This endpoint supports the `X-Audit-Log-Reason` header. | user_ids | array of snowflakes | list of user ids to ban (max 200) | | | delete_message_seconds? | integer | number of seconds to delete messages for, between 0 and 604800 (7 days) | 0 | + ###### Bulk Ban Response On success, this endpoint returns a 200 success response with the following body. @@ -1139,55 +1196,57 @@ On success, this endpoint returns a 200 success response with the following body | banned_users | array of snowflakes | list of user ids, that were successfully banned | | failed_users | array of snowflakes | list of user ids, that were not banned | -:::info + If none of the users could be banned, an error response code `500000: Failed to ban users` is returned instead. -::: + ## Get Guild Roles -/guilds/[\{guild.id\}](/docs/resources/guild#guild-object)/roles +/guilds/[\{guild.id\}](/developers/docs/resources/guild#guild-object)/roles -Returns a list of [role](/docs/topics/permissions#role-object) objects for the guild. +Returns a list of [role](/developers/docs/topics/permissions#role-object) objects for the guild. ## Get Guild Role -/guilds/[\{guild.id\}](/docs/resources/guild#guild-object)/roles/[\{role.id\}](/docs/topics/permissions#role-object) +/guilds/[\{guild.id\}](/developers/docs/resources/guild#guild-object)/roles/[\{role.id\}](/developers/docs/topics/permissions#role-object) -Returns a [role](/docs/topics/permissions#role-object) object for the specified role. +Returns a [role](/developers/docs/topics/permissions#role-object) object for the specified role. ## Create Guild Role -/guilds/[\{guild.id\}](/docs/resources/guild#guild-object)/roles +/guilds/[\{guild.id\}](/developers/docs/resources/guild#guild-object)/roles -Create a new [role](/docs/topics/permissions#role-object) for the guild. Requires the `MANAGE_ROLES` permission. Returns the new [role](/docs/topics/permissions#role-object) object on success. Fires a [Guild Role Create](/docs/events/gateway-events#guild-role-create) Gateway event. All JSON params are optional. +Create a new [role](/developers/docs/topics/permissions#role-object) for the guild. Requires the `MANAGE_ROLES` permission. Returns the new [role](/developers/docs/topics/permissions#role-object) object on success. Fires a [Guild Role Create](/developers/docs/events/gateway-events#guild-role-create) Gateway event. All JSON params are optional. -:::info + This endpoint supports the `X-Audit-Log-Reason` header. -::: + + ###### JSON Params -| Field | Type | Description | Default | -|---------------|-------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------| -| name | string | name of the role, max 100 characters | "new role" | -| permissions | string | bitwise value of the enabled/disabled permissions | @everyone permissions in guild | -| color* | integer | **Deprecated** RGB color value | 0 | -| colors | [role colors](/docs/topics/permissions#role-object-role-colors-object) object | the role's colors | [default role colors object](/docs/topics/permissions#role-object-default-role-colors-object) | -| hoist | boolean | whether the role should be displayed separately in the sidebar | false | -| icon | ?[image data](/docs/reference#image-data) | the role's icon image (if the guild has the `ROLE_ICONS` feature) | null | -| unicode_emoji | ?string | the role's unicode emoji as a [standard emoji](/docs/reference#message-formatting) (if the guild has the `ROLE_ICONS` feature) | null | -| mentionable | boolean | whether the role should be mentionable | false | +| Field | Type | Description | Default | +|---------------|------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------| +| name | string | name of the role, max 100 characters | "new role" | +| permissions | string | bitwise value of the enabled/disabled permissions | @everyone permissions in guild | +| color* | integer | **Deprecated** RGB color value | 0 | +| colors | [role colors](/developers/docs/topics/permissions#role-object-role-colors-object) object | the role's colors | [default role colors object](/developers/docs/topics/permissions#role-object-default-role-colors-object) | +| hoist | boolean | whether the role should be displayed separately in the sidebar | false | +| icon | ?[image data](/developers/docs/reference#image-data) | the role's icon image (if the guild has the `ROLE_ICONS` feature) | null | +| unicode_emoji | ?string | the role's unicode emoji as a [standard emoji](/developers/docs/reference#message-formatting) (if the guild has the `ROLE_ICONS` feature) | null | +| mentionable | boolean | whether the role should be mentionable | false | \* `color` will still be returned by the API, but using the `colors` field is recommended when doing requests. ## Modify Guild Role Positions -/guilds/[\{guild.id\}](/docs/resources/guild#guild-object)/roles +/guilds/[\{guild.id\}](/developers/docs/resources/guild#guild-object)/roles -Modify the positions of a set of [role](/docs/topics/permissions#role-object) objects for the guild. Requires the `MANAGE_ROLES` permission. Returns a list of all of the guild's [role](/docs/topics/permissions#role-object) objects on success. Fires multiple [Guild Role Update](/docs/events/gateway-events#guild-role-update) Gateway events. +Modify the positions of a set of [role](/developers/docs/topics/permissions#role-object) objects for the guild. Requires the `MANAGE_ROLES` permission. Returns a list of all of the guild's [role](/developers/docs/topics/permissions#role-object) objects on success. Fires multiple [Guild Role Update](/developers/docs/events/gateway-events#guild-role-update) Gateway events. -:::info + This endpoint supports the `X-Audit-Log-Reason` header. -::: + This endpoint takes a JSON array of parameters in the following format: + ###### JSON Params | Field | Type | Description | @@ -1196,49 +1255,51 @@ This endpoint takes a JSON array of parameters in the following format: | position? | ?integer | sorting position of the role (roles with the same position are sorted by id) | ## Modify Guild Role -/guilds/[\{guild.id\}](/docs/resources/guild#guild-object)/roles/[\{role.id\}](/docs/topics/permissions#role-object) +/guilds/[\{guild.id\}](/developers/docs/resources/guild#guild-object)/roles/[\{role.id\}](/developers/docs/topics/permissions#role-object) -Modify a guild role. Requires the `MANAGE_ROLES` permission. Returns the updated [role](/docs/topics/permissions#role-object) on success. Fires a [Guild Role Update](/docs/events/gateway-events#guild-role-update) Gateway event. +Modify a guild role. Requires the `MANAGE_ROLES` permission. Returns the updated [role](/developers/docs/topics/permissions#role-object) on success. Fires a [Guild Role Update](/developers/docs/events/gateway-events#guild-role-update) Gateway event. -:::info + All parameters to this endpoint are optional and nullable. -::: + -:::info + This endpoint supports the `X-Audit-Log-Reason` header. -::: + + ###### JSON Params -| Field | Type | Description | -|---------------|-------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------| -| name | string | name of the role, max 100 characters | -| permissions | string | bitwise value of the enabled/disabled permissions | -| color* | integer | **Deprecated** RGB color value | -| colors | [role colors](/docs/topics/permissions#role-object-role-colors-object) object | the role's colors | -| hoist | boolean | whether the role should be displayed separately in the sidebar | -| icon | [image data](/docs/reference#image-data) | the role's icon image (if the guild has the `ROLE_ICONS` feature) | -| unicode_emoji | string | the role's unicode emoji as a [standard emoji](/docs/reference#message-formatting) (if the guild has the `ROLE_ICONS` feature) | -| mentionable | boolean | whether the role should be mentionable | +| Field | Type | Description | +|---------------|------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------| +| name | string | name of the role, max 100 characters | +| permissions | string | bitwise value of the enabled/disabled permissions | +| color* | integer | **Deprecated** RGB color value | +| colors | [role colors](/developers/docs/topics/permissions#role-object-role-colors-object) object | the role's colors | +| hoist | boolean | whether the role should be displayed separately in the sidebar | +| icon | [image data](/developers/docs/reference#image-data) | the role's icon image (if the guild has the `ROLE_ICONS` feature) | +| unicode_emoji | string | the role's unicode emoji as a [standard emoji](/developers/docs/reference#message-formatting) (if the guild has the `ROLE_ICONS` feature) | +| mentionable | boolean | whether the role should be mentionable | \* `color` will still be returned by the API, but using the `colors` field is recommended when doing requests. ## Delete Guild Role -/guilds/[\{guild.id\}](/docs/resources/guild#guild-object)/roles/[\{role.id\}](/docs/topics/permissions#role-object) +/guilds/[\{guild.id\}](/developers/docs/resources/guild#guild-object)/roles/[\{role.id\}](/developers/docs/topics/permissions#role-object) -Delete a guild role. Requires the `MANAGE_ROLES` permission. Returns a 204 empty response on success. Fires a [Guild Role Delete](/docs/events/gateway-events#guild-role-delete) Gateway event. +Delete a guild role. Requires the `MANAGE_ROLES` permission. Returns a 204 empty response on success. Fires a [Guild Role Delete](/developers/docs/events/gateway-events#guild-role-delete) Gateway event. -:::info + This endpoint supports the `X-Audit-Log-Reason` header. -::: + ## Get Guild Prune Count -/guilds/[\{guild.id\}](/docs/resources/guild#guild-object)/prune +/guilds/[\{guild.id\}](/developers/docs/resources/guild#guild-object)/prune Returns an object with one `pruned` key indicating the number of members that would be removed in a prune operation. Requires the `MANAGE_GUILD` and `KICK_MEMBERS` permissions. By default, prune will not remove users with roles. You can optionally include specific roles in your prune by providing the `include_roles` parameter. Any inactive user that has a subset of the provided role(s) will be counted in the prune and users with additional roles will not. + ###### Query String Params | Field | Type | Description | Default | @@ -1247,16 +1308,17 @@ By default, prune will not remove users with roles. You can optionally include s | include_roles | string; comma-delimited array of snowflakes | role(s) to include | none | ## Begin Guild Prune -/guilds/[\{guild.id\}](/docs/resources/guild#guild-object)/prune +/guilds/[\{guild.id\}](/developers/docs/resources/guild#guild-object)/prune -Begin a prune operation. Requires the `MANAGE_GUILD` and `KICK_MEMBERS` permissions. Returns an object with one `pruned` key indicating the number of members that were removed in the prune operation. For large guilds it's recommended to set the `compute_prune_count` option to `false`, forcing `pruned` to `null`. Fires multiple [Guild Member Remove](/docs/events/gateway-events#guild-member-remove) Gateway events. +Begin a prune operation. Requires the `MANAGE_GUILD` and `KICK_MEMBERS` permissions. Returns an object with one `pruned` key indicating the number of members that were removed in the prune operation. For large guilds it's recommended to set the `compute_prune_count` option to `false`, forcing `pruned` to `null`. Fires multiple [Guild Member Remove](/developers/docs/events/gateway-events#guild-member-remove) Gateway events. By default, prune will not remove users with roles. You can optionally include specific roles in your prune by providing the `include_roles` parameter. Any inactive user that has a subset of the provided role(s) will be included in the prune and users with additional roles will not. -:::info + This endpoint supports the `X-Audit-Log-Reason` header. -::: + + ###### JSON Params | Field | Type | Description | Default | @@ -1267,61 +1329,62 @@ This endpoint supports the `X-Audit-Log-Reason` header. | reason? | string | reason for the prune (deprecated) | | ## Get Guild Voice Regions -/guilds/[\{guild.id\}](/docs/resources/guild#guild-object)/regions +/guilds/[\{guild.id\}](/developers/docs/resources/guild#guild-object)/regions -Returns a list of [voice region](/docs/resources/voice#voice-region-object) objects for the guild. Unlike the similar `/voice` route, this returns VIP servers when the guild is VIP-enabled. +Returns a list of [voice region](/developers/docs/resources/voice#voice-region-object) objects for the guild. Unlike the similar `/voice` route, this returns VIP servers when the guild is VIP-enabled. ## Get Guild Invites -/guilds/[\{guild.id\}](/docs/resources/guild#guild-object)/invites +/guilds/[\{guild.id\}](/developers/docs/resources/guild#guild-object)/invites -Returns a list of [invite](/docs/resources/invite#invite-object) objects. Requires the `MANAGE_GUILD` or `VIEW_AUDIT_LOG` permission. [Invite Metadata](/docs/resources/invite#invite-metadata-object) is included with the `MANAGE_GUILD` permission. +Returns a list of [invite](/developers/docs/resources/invite#invite-object) objects. Requires the `MANAGE_GUILD` or `VIEW_AUDIT_LOG` permission. [Invite Metadata](/developers/docs/resources/invite#invite-metadata-object) is included with the `MANAGE_GUILD` permission. ## Get Guild Integrations -/guilds/[\{guild.id\}](/docs/resources/guild#guild-object)/integrations +/guilds/[\{guild.id\}](/developers/docs/resources/guild#guild-object)/integrations -Returns a list of [integration](/docs/resources/guild#integration-object) objects for the guild. Requires the `MANAGE_GUILD` permission. +Returns a list of [integration](/developers/docs/resources/guild#integration-object) objects for the guild. Requires the `MANAGE_GUILD` permission. -:::info + This endpoint returns a maximum of 50 integrations. If a guild has more integrations, they cannot be accessed. -::: + ## Delete Guild Integration -/guilds/[\{guild.id\}](/docs/resources/guild#guild-object)/integrations/[\{integration.id\}](/docs/resources/guild#integration-object) +/guilds/[\{guild.id\}](/developers/docs/resources/guild#guild-object)/integrations/[\{integration.id\}](/developers/docs/resources/guild#integration-object) -Delete the attached [integration](/docs/resources/guild#integration-object) object for the guild. Deletes any associated webhooks and kicks the associated bot if there is one. Requires the `MANAGE_GUILD` permission. Returns a 204 empty response on success. Fires [Guild Integrations Update](/docs/events/gateway-events#guild-integrations-update) and [Integration Delete](/docs/events/gateway-events#integration-delete) Gateway events. +Delete the attached [integration](/developers/docs/resources/guild#integration-object) object for the guild. Deletes any associated webhooks and kicks the associated bot if there is one. Requires the `MANAGE_GUILD` permission. Returns a 204 empty response on success. Fires [Guild Integrations Update](/developers/docs/events/gateway-events#guild-integrations-update) and [Integration Delete](/developers/docs/events/gateway-events#integration-delete) Gateway events. -:::info + This endpoint supports the `X-Audit-Log-Reason` header. -::: + ## Get Guild Widget Settings -/guilds/[\{guild.id\}](/docs/resources/guild#guild-object)/widget +/guilds/[\{guild.id\}](/developers/docs/resources/guild#guild-object)/widget -Returns a [guild widget settings](/docs/resources/guild#guild-widget-settings-object) object. Requires the `MANAGE_GUILD` permission. +Returns a [guild widget settings](/developers/docs/resources/guild#guild-widget-settings-object) object. Requires the `MANAGE_GUILD` permission. ## Modify Guild Widget -/guilds/[\{guild.id\}](/docs/resources/guild#guild-object)/widget +/guilds/[\{guild.id\}](/developers/docs/resources/guild#guild-object)/widget -Modify a [guild widget settings](/docs/resources/guild#guild-widget-settings-object) object for the guild. All attributes may be passed in with JSON and modified. Requires the `MANAGE_GUILD` permission. Returns the updated [guild widget settings](/docs/resources/guild#guild-widget-settings-object) object. Fires a [Guild Update](/docs/events/gateway-events#guild-update) Gateway event. +Modify a [guild widget settings](/developers/docs/resources/guild#guild-widget-settings-object) object for the guild. All attributes may be passed in with JSON and modified. Requires the `MANAGE_GUILD` permission. Returns the updated [guild widget settings](/developers/docs/resources/guild#guild-widget-settings-object) object. Fires a [Guild Update](/developers/docs/events/gateway-events#guild-update) Gateway event. -:::info + This endpoint supports the `X-Audit-Log-Reason` header. -::: + ## Get Guild Widget -/guilds/[\{guild.id\}](/docs/resources/guild#guild-object)/widget.json +/guilds/[\{guild.id\}](/developers/docs/resources/guild#guild-object)/widget.json -Returns the [widget](/docs/resources/guild#guild-widget-object) for the guild. Fires an [Invite Create](/docs/events/gateway-events#invite-create) Gateway event when an invite channel is defined and a new [Invite](/docs/resources/invite#invite-object) is generated. +Returns the [widget](/developers/docs/resources/guild#guild-widget-object) for the guild. Fires an [Invite Create](/developers/docs/events/gateway-events#invite-create) Gateway event when an invite channel is defined and a new [Invite](/developers/docs/resources/invite#invite-object) is generated. ## Get Guild Vanity URL -/guilds/[\{guild.id\}](/docs/resources/guild#guild-object)/vanity-url +/guilds/[\{guild.id\}](/developers/docs/resources/guild#guild-object)/vanity-url -Returns a partial [invite](/docs/resources/invite#invite-object) object for guilds with that feature enabled. Requires the `MANAGE_GUILD` permission. `code` will be null if a vanity url for the guild is not set. +Returns a partial [invite](/developers/docs/resources/invite#invite-object) object for guilds with that feature enabled. Requires the `MANAGE_GUILD` permission. `code` will be null if a vanity url for the guild is not set. -:::info -This endpoint is required to get the usage count of the vanity invite, but the invite code can be accessed as `vanity_url_code` in the [guild object](/docs/resources/guild#guild-object) without having the `MANAGE_GUILD` permission. -::: + +This endpoint is required to get the usage count of the vanity invite, but the invite code can be accessed as `vanity_url_code` in the [guild object](/developers/docs/resources/guild#guild-object) without having the `MANAGE_GUILD` permission. + + ###### Example Partial Invite Object ```json @@ -1332,20 +1395,22 @@ This endpoint is required to get the usage count of the vanity invite, but the i ``` ## Get Guild Widget Image -/guilds/[\{guild.id\}](/docs/resources/guild#guild-object)/widget.png +/guilds/[\{guild.id\}](/developers/docs/resources/guild#guild-object)/widget.png Returns a PNG image widget for the guild. Requires no permissions or authentication. -:::info + All parameters to this endpoint are optional. -::: + + ###### Query String Params | Field | Type | Description | Default | |-------|--------|------------------------------------------------|---------| | style | string | style of the widget image returned (see below) | shield | + ###### Widget Style Options | Value | Description | Example | @@ -1357,72 +1422,75 @@ All parameters to this endpoint are optional. | banner4 | large Discord logo at the top of the widget. Guild icon, name and online count in the middle portion of the widget and a "JOIN MY SERVER" button at the bottom | [Example](https://discord.com/api/guilds/81384788765712384/widget.png?style=banner4) | ## Get Guild Welcome Screen -/guilds/[\{guild.id\}](/docs/resources/guild#guild-object)/welcome-screen +/guilds/[\{guild.id\}](/developers/docs/resources/guild#guild-object)/welcome-screen -Returns the [Welcome Screen](/docs/resources/guild#welcome-screen-object) object for the guild. If the welcome screen is not enabled, the `MANAGE_GUILD` permission is required. +Returns the [Welcome Screen](/developers/docs/resources/guild#welcome-screen-object) object for the guild. If the welcome screen is not enabled, the `MANAGE_GUILD` permission is required. ## Modify Guild Welcome Screen -/guilds/[\{guild.id\}](/docs/resources/guild#guild-object)/welcome-screen +/guilds/[\{guild.id\}](/developers/docs/resources/guild#guild-object)/welcome-screen -Modify the guild's [Welcome Screen](/docs/resources/guild#welcome-screen-object). Requires the `MANAGE_GUILD` permission. Returns the updated [Welcome Screen](/docs/resources/guild#welcome-screen-object) object. May fire a [Guild Update](/docs/events/gateway-events#guild-update) Gateway event. +Modify the guild's [Welcome Screen](/developers/docs/resources/guild#welcome-screen-object). Requires the `MANAGE_GUILD` permission. Returns the updated [Welcome Screen](/developers/docs/resources/guild#welcome-screen-object) object. May fire a [Guild Update](/developers/docs/events/gateway-events#guild-update) Gateway event. -:::info + All parameters to this endpoint are optional and nullable -::: + -:::info + This endpoint supports the `X-Audit-Log-Reason` header. -::: + + ###### JSON Params -| Field | Type | Description | -|------------------|-------------------------------------------------------------------------------------------------------------------------|-----------------------------------------------------------------| -| enabled | boolean | whether the welcome screen is enabled | -| welcome_channels | array of [welcome screen channel](/docs/resources/guild#welcome-screen-object-welcome-screen-channel-structure) objects | channels linked in the welcome screen and their display options | -| description | string | the server description to show in the welcome screen | +| Field | Type | Description | +|------------------|------------------------------------------------------------------------------------------------------------------------------------|-----------------------------------------------------------------| +| enabled | boolean | whether the welcome screen is enabled | +| welcome_channels | array of [welcome screen channel](/developers/docs/resources/guild#welcome-screen-object-welcome-screen-channel-structure) objects | channels linked in the welcome screen and their display options | +| description | string | the server description to show in the welcome screen | ## Get Guild Onboarding -/guilds/[\{guild.id\}](/docs/resources/guild#guild-object)/onboarding +/guilds/[\{guild.id\}](/developers/docs/resources/guild#guild-object)/onboarding -Returns the [Onboarding](/docs/resources/guild#guild-onboarding-object) object for the guild. +Returns the [Onboarding](/developers/docs/resources/guild#guild-onboarding-object) object for the guild. ## Modify Guild Onboarding -/guilds/[\{guild.id\}](/docs/resources/guild#guild-object)/onboarding +/guilds/[\{guild.id\}](/developers/docs/resources/guild#guild-object)/onboarding -Modifies the onboarding configuration of the guild. Returns a 200 with the [Onboarding](/docs/resources/guild#guild-onboarding-object) object for the guild. Requires the `MANAGE_GUILD` and `MANAGE_ROLES` permissions. +Modifies the onboarding configuration of the guild. Returns a 200 with the [Onboarding](/developers/docs/resources/guild#guild-onboarding-object) object for the guild. Requires the `MANAGE_GUILD` and `MANAGE_ROLES` permissions. -:::info + Onboarding enforces constraints when enabled. These constraints are that there must be at least 7 Default Channels and at least 5 of them must allow sending messages to the @everyone role. The `mode` field modifies what is considered when enforcing these constraints. -::: + -:::info + This endpoint supports the `X-Audit-Log-Reason` header. -::: + -:::info + All parameters to this endpoint are optional. -::: + + ###### JSON Params -| Field | Type | Description | -|---------------------|-----------------------------------------------------------------------------------------------------------------|------------------------------------------------------------| -| prompts | array of [onboarding prompt](/docs/resources/guild#guild-onboarding-object-onboarding-prompt-structure) objects | Prompts shown during onboarding and in customize community | -| default_channel_ids | array of snowflakes | Channel IDs that members get opted into automatically | -| enabled | boolean | Whether onboarding is enabled in the guild | -| mode | [onboarding mode](/docs/resources/guild#guild-onboarding-object-onboarding-mode) | Current mode of onboarding | +| Field | Type | Description | +|---------------------|----------------------------------------------------------------------------------------------------------------------------|------------------------------------------------------------| +| prompts | array of [onboarding prompt](/developers/docs/resources/guild#guild-onboarding-object-onboarding-prompt-structure) objects | Prompts shown during onboarding and in customize community | +| default_channel_ids | array of snowflakes | Channel IDs that members get opted into automatically | +| enabled | boolean | Whether onboarding is enabled in the guild | +| mode | [onboarding mode](/developers/docs/resources/guild#guild-onboarding-object-onboarding-mode) | Current mode of onboarding | ## Modify Guild Incident Actions -/guilds/[\{guild.id\}](/docs/resources/guild#guild-object)/incident-actions +/guilds/[\{guild.id\}](/developers/docs/resources/guild#guild-object)/incident-actions -Modifies the incident actions of the guild. Returns a 200 with the [Incidents Data](/docs/resources/guild#incidents-data-object) object for the guild. Requires the `MANAGE_GUILD` permission. +Modifies the incident actions of the guild. Returns a 200 with the [Incidents Data](/developers/docs/resources/guild#incidents-data-object) object for the guild. Requires the `MANAGE_GUILD` permission. + ###### JSON Params -:::info + Both `invites_disabled_until` and `dms_disabled_until` can be enabled for a maximal timespan of 24 hours in the future. -::: + | Field | Type | Description | |-------------------------|-----------------------|--------------------------------------------| diff --git a/discord/developers/docs/resources/invite.mdx b/discord/developers/docs/resources/invite.mdx new file mode 100644 index 0000000000..46e1c1e735 --- /dev/null +++ b/discord/developers/docs/resources/invite.mdx @@ -0,0 +1,184 @@ +--- +title: Invite Resource +sidebarTitle: Invite +description: Reference for Discord Invite objects and management endpoints. +--- + +import {ManualAnchor} from '/snippets/manualanchor.jsx' +import {Route} from '/snippets/route.jsx' + +### Invite Object + +Represents a code that when used, adds a user to a guild or group DM channel. + + +###### Invite Structure +| Field | Type | Description | +|-----------------------------|---------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------| +| type | integer | the [type of invite](/developers/docs/resources/invite#invite-object-invite-types) | +| code | string | the invite code (unique ID) | +| guild? | partial [guild](/developers/docs/resources/guild#guild-object) object | the guild this invite is for | +| channel | ?partial [channel](/developers/docs/resources/channel#channel-object) object | the channel this invite is for | +| inviter? | [user](/developers/docs/resources/user#user-object) object | the user who created the invite | +| target_type? | integer | the [type of target](/developers/docs/resources/invite#invite-object-invite-target-types) for this voice channel invite | +| target_user? | [user](/developers/docs/resources/user#user-object) object | the user whose stream to display for this voice channel stream invite | +| target_application? | partial [application](/developers/docs/resources/application#application-object) object | the embedded application to open for this voice channel embedded application invite | +| approximate_presence_count? | integer | approximate count of online members, returned from the `GET /invites/` endpoint when `with_counts` is `true` | +| approximate_member_count? | integer | approximate count of total members, returned from the `GET /invites/` endpoint when `with_counts` is `true` | +| expires_at | ?ISO8601 timestamp | the expiration date of this invite | +| guild_scheduled_event? | [guild scheduled event](/developers/docs/resources/guild-scheduled-event#guild-scheduled-event-object) object | guild scheduled event data, only included if `guild_scheduled_event_id` contains a valid guild scheduled event id | +| flags? | integer | [guild invite flags](/developers/docs/resources/invite#invite-object-guild-invite-flags) for guild invites | + + +###### Invite Types + +| Type | Value | +|----------|-------| +| GUILD | 0 | +| GROUP_DM | 1 | +| FRIEND | 2 | + + +###### Invite Target Types + +| Type | Value | +|----------------------|-------| +| STREAM | 1 | +| EMBEDDED_APPLICATION | 2 | + + +###### Guild Invite Flags + +| Flag | Value | Description | +|-----------------|----------|---------------------------------------------------| +| IS_GUEST_INVITE | `1 << 0` | this invite is a guest invite for a voice channel | + + +###### Example Invite Object + +```json +{ + "type": 0, + "code": "0vCdhLbwjZZTWZLD", + "guild": { + "id": "165176875973476352", + "name": "CS:GO Fraggers Only", + "splash": null, + "banner": null, + "description": "Very good description", + "icon": null, + "features": ["NEWS", "DISCOVERABLE"], + "verification_level": 2, + "vanity_url_code": null, + "nsfw_level": 0, + "premium_subscription_count": 5 + }, + "channel": { + "id": "165176875973476352", + "name": "illuminati", + "type": 0 + }, + "inviter": { + "id": "115590097100865541", + "username": "speed", + "avatar": "deadbeef", + "discriminator": "7653", + "public_flags": 131328 + }, + "target_type": 1, + "target_user": { + "id": "165176875973476352", + "username": "bob", + "avatar": "deadbeef", + "discriminator": "1234", + "public_flags": 64 + } +} +``` + +### Invite Metadata Object + +Extra information about an invite, will extend the [invite](/developers/docs/resources/invite#invite-object) object. + + +###### Invite Metadata Structure + +| Field | Type | Description | +|------------|-------------------|------------------------------------------------------| +| uses | integer | number of times this invite has been used | +| max_uses | integer | max number of times this invite can be used | +| max_age | integer | duration (in seconds) after which the invite expires | +| temporary | boolean | whether this invite only grants temporary membership | +| created_at | ISO8601 timestamp | when this invite was created | + + +###### Example Invite Metadata + +```json +{ + "uses": 0, + "max_uses": 0, + "max_age": 0, + "temporary": false, + "created_at": "2016-03-31T19:15:39.954000+00:00" +} +``` + +### Invite Stage Instance Object + + +This is deprecated. + + + +###### Invite Stage Instance Structure +| Field | Type | Description | +|-------------------|-----------------------------------------------------------------------------------------------|----------------------------------------------------| +| members | array of partial [guild member](/developers/docs/resources/guild#guild-member-object) objects | the members speaking in the Stage | +| participant_count | integer | the number of users in the Stage | +| speaker_count | integer | the number of users speaking in the Stage | +| topic | string | the topic of the Stage instance (1-120 characters) | + + +###### Example Invite Stage Instance + +```json +{ + "topic": "The debate is over: diet is better than regular", + "participant_count": 200, + "speaker_count": 5 , + "members": [ + { + "roles": [], + "nick": "NOT API SUPPORT", + "avatar": null, + "premium_since": null, + "joined_at": "2015-04-26T06:26:56.936000+00:00", + "pending": false, + "user": {} + } + ] +} +``` + +## Get Invite +/invites/[\{invite.code\}](/developers/docs/resources/invite#invite-object) + +Returns an [invite](/developers/docs/resources/invite#invite-object) object for the given code. + + +###### Query String Params + +| Field | Type | Description | +|---------------------------|-------------------------------------------------------------|-------------------------------------------------------------| +| with_counts? | [boolean](/developers/docs/reference#boolean-query-strings) | whether the invite should contain approximate member counts | +| guild_scheduled_event_id? | snowflake | the guild scheduled event to include with the invite | + +## Delete Invite +/invites/[\{invite.code\}](/developers/docs/resources/invite#invite-object) + +Delete an invite. Requires the `MANAGE_CHANNELS` permission on the channel this invite belongs to, or `MANAGE_GUILD` to remove any invite across the guild. Returns an [invite](/developers/docs/resources/invite#invite-object) object on success. Fires an [Invite Delete](/developers/docs/events/gateway-events#invite-delete) Gateway event. + + +This endpoint supports the `X-Audit-Log-Reason` header. + diff --git a/discord/developers/docs/resources/lobby.mdx b/discord/developers/docs/resources/lobby.mdx new file mode 100644 index 0000000000..eaba1264e3 --- /dev/null +++ b/discord/developers/docs/resources/lobby.mdx @@ -0,0 +1,180 @@ +--- +title: Lobby Resource +sidebarTitle: Lobby +description: Reference for Discord lobby objects used for matchmaking. +--- + +import {ManualAnchor} from '/snippets/manualanchor.jsx' +import {Route} from '/snippets/route.jsx' + +### Lobby Object + +Represents a lobby within Discord. See [Managing Lobbies](/developers/docs/discord-social-sdk/development-guides/managing-lobbies) for more information. + + +###### Lobby Structure + +| Field | Type | Description | +|-----------------|---------------------------------------------------------------------------------------|---------------------------------------------------------------------| +| id | snowflake | the id of this channel | +| application_id | snowflake | application that created the lobby | +| metadata | ?dict\ | dictionary of string key/value pairs. The max total length is 1000. | +| members | array of [lobby member](/developers/docs/resources/lobby#lobby-member-object) objects | members of the lobby | +| linked_channel? | channel object | the guild channel linked to the lobby | + +### Lobby Member Object + +Represents a member of a lobby, including optional metadata and flags. + + +###### Lobby Member Structure + +| Field | Type | Description | +|-----------|-------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------| +| id | snowflake | the id of the user | +| metadata? | ?dict\ | dictionary of string key/value pairs. The max total length is 1000. | +| flags? | integer | [lobby member flags](/developers/docs/resources/lobby#lobby-member-object-lobby-member-flags) combined as a [bitfield](https://en.wikipedia.org/wiki/Bit_field) | + + +###### Lobby Member Flags + +| Flag | Value | Description | +|--------------|--------|-----------------------------------------| +| CanLinkLobby | `1<<0` | user can link a text channel to a lobby | + + + +###### Example Lobby Object + +```json +{ + "id": "96008815106887111", + "application_id": "41771983429993937", + "metadata": { + "topic": "we need more redstone", + }, + "members": [ + { + "id": "41771983429993000", + "metadata": null, + "flags": 1 + } + ] +} +``` + +## Create Lobby +/lobbies + +Creates a new lobby, adding any of the specified members to it, if provided. + +Returns a [lobby](/developers/docs/resources/lobby#lobby-object) object. + + +[Discord Social SDK](/developers/docs/discord-social-sdk/overview) clients will not be able to join or leave a lobby created using this API, such as [`Client::CreateOrJoinLobby`]. See [Managing Lobbies](/developers/docs/discord-social-sdk/development-guides/managing-lobbies) for more information. + + +### JSON Params + +| Field | Type | Description | +|-----------------------|---------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| metadata? | ?dict\ | optional dictionary of string key/value pairs. The max total length is 1000. | +| members? | array of [lobby member](/developers/docs/resources/lobby#lobby-member-object) objects | optional array of up to 25 users to be added to the lobby | +| idle_timeout_seconds? | integer | seconds to wait before shutting down a lobby after it becomes idle. Value can be between 5 and 604800 (7 days). See [`LobbyHandle`] for more details on this behavior. | + +#### Lobby Member JSON Params + +| Field | Type | Description | +|-----------|-------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------| +| id | snowflake | Discord user id of the user to add to the lobby | +| metadata? | ?dict\ | optional dictionary of string key/value pairs. The max total length is 1000. | +| flags? | integer | [lobby member flags](/developers/docs/resources/lobby#lobby-member-object-lobby-member-flags) combined as a [bitfield](https://en.wikipedia.org/wiki/Bit_field) | + +## Get Lobby +/lobbies/[\{lobby.id\}](/developers/docs/resources/lobby#lobby-object) + +Returns a [lobby](/developers/docs/resources/lobby#lobby-object) object for the specified lobby id, if it exists. + +## Modify Lobby +/lobbies/[\{lobby.id\}](/developers/docs/resources/lobby#lobby-object) + +Modifies the specified lobby with new values, if provided. + +Returns the updated [lobby](/developers/docs/resources/lobby#lobby-object) object. + +### JSON Params + +| Field | Type | Description | +|-----------------------|---------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| metadata? | ?dict\ | optional dictionary of string key/value pairs. The max total length is 1000. Overwrites any existing metadata. | +| members? | array of [lobby member](/developers/docs/resources/lobby#lobby-member-object) objects | optional array of up to 25 users to replace the lobby members with. If provided, lobby members not in this list will be removed from the lobby. | +| idle_timeout_seconds? | integer | seconds to wait before shutting down a lobby after it becomes idle. Value can be between 5 and 604800 (7 days). See [`LobbyHandle`] for more details on this behavior. | + +## Delete Lobby +/lobbies/[\{lobby.id\}](/developers/docs/resources/lobby#lobby-object) + +Deletes the specified lobby if it exists. + +It is safe to call even if the lobby is already deleted as well. + +Returns nothing. + +## Add a Member to a Lobby +/lobbies/[\{lobby.id\}](/developers/docs/resources/lobby#lobby-object)/members/[\{user.id\}](/developers/docs/resources/user#user-object) + +Adds the provided user to the specified lobby. If called when the user is already a member of the lobby will update fields such as metadata on that user instead. + +Returns the [lobby member](/developers/docs/resources/lobby#lobby-member-object) object. + +### JSON Params + +| Field | Type | Description | +|-----------|-------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------| +| metadata? | ?dict\ | optional dictionary of string key/value pairs. The max total length is 1000. | +| flags? | integer | [lobby member flags](/developers/docs/resources/lobby#lobby-member-object-lobby-member-flags) combined as a [bitfield](https://en.wikipedia.org/wiki/Bit_field) | + +## Remove a Member from a Lobby +/lobbies/[\{lobby.id\}](/developers/docs/resources/lobby#lobby-object)/members/[\{user.id\}](/developers/docs/resources/user#user-object) + +Removes the provided user from the specified lobby. It is safe to call this even if the user is no longer a member of the lobby, but will fail if the lobby does not exist. + +Returns nothing. + +## Leave Lobby +/lobbies/[\{lobby.id\}](/developers/docs/resources/lobby#lobby-object)/members/@me + +Removes the current user from the specified lobby. It is safe to call this even if the user is no longer a member of the lobby, but will fail if the lobby does not exist. + +Uses `Bearer` token for authorization. + +Returns nothing. + +## Link Channel to Lobby +/lobbies/[\{lobby.id\}](/developers/docs/resources/lobby#lobby-object)/channel-linking + +Links an existing text channel to a lobby. See [Linked Channels](/developers/docs/discord-social-sdk/development-guides/linked-channels) for more information. + +Uses `Bearer` token for authorization and user must be a lobby member with `CanLinkLobby` [lobby member flag](/developers/docs/resources/lobby#lobby-member-object-lobby-member-flags). + +Returns a [lobby](/developers/docs/resources/lobby#lobby-object) object with a linked channel. + +### JSON Params + +| Field | Type | Description | +|-------------|-----------|------------------------------------------------------------------------------------------------------------------------| +| channel_id? | snowflake | the id of the channel to link to the lobby. If not provided, will unlink any currently linked channels from the lobby. | + +## Unlink Channel from Lobby +/lobbies/[\{lobby.id\}](/developers/docs/resources/lobby#lobby-object)/channel-linking + +Unlinks any currently linked channels from the specified lobby. + +Send a request to this endpoint with an empty body to unlink any currently linked channels from the specified lobby. + +Uses `Bearer` token for authorization and user must be a lobby member with `CanLinkLobby` [lobby member flag](/developers/docs/resources/lobby#lobby-member-object-lobby-member-flags). + +Returns a [lobby](/developers/docs/resources/lobby#lobby-object) object without a linked channel. + +{/* Autogenerated Reference Links */} +[`Client::CreateOrJoinLobby`]: https://discord.com/developers/docs/social-sdk/classdiscordpp_1_1Client.html#a8b4e195555ecaa89ccdfc0acd28d3512 +[`LobbyHandle`]: https://discord.com/developers/docs/social-sdk/classdiscordpp_1_1LobbyHandle.html#a04cebab69ab0e7fb930346a14a87e843 \ No newline at end of file diff --git a/docs/resources/message.mdx b/discord/developers/docs/resources/message.mdx similarity index 58% rename from docs/resources/message.mdx rename to discord/developers/docs/resources/message.mdx index 4bc2908256..6887e250aa 100644 --- a/docs/resources/message.mdx +++ b/discord/developers/docs/resources/message.mdx @@ -1,77 +1,82 @@ --- -sidebar_label: Message +title: Message Resource +sidebarTitle: Message +description: Reference for Discord message objects and management endpoints. --- -# Messages Resource +import {ManualAnchor} from '/snippets/manualanchor.jsx' +import {Route} from '/snippets/route.jsx' ### Message Object Represents a message sent in a channel within Discord. + ###### Message Structure -:::info -Fields specific to the `MESSAGE_CREATE` and `MESSAGE_UPDATE` events are listed in the [Gateway documentation](/docs/events/gateway-events#message-create). -::: - -:::warn -An app will receive empty values in the `content`, `embeds`, `attachments`, and `components` fields while `poll` will be omitted if they have not configured (or been approved for) the [`MESSAGE_CONTENT` privileged intent (`1 << 15`)](/docs/events/gateway#message-content-intent). -::: - -| Field | Type | Description | -|---------------------------|------------------------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| -| id | snowflake | id of the message | -| channel_id | snowflake | id of the channel the message was sent in | -| author \[1\] | [user](/docs/resources/user#user-object) object | the author of this message (not guaranteed to be a valid user, see below) | -| content \[2\] | string | contents of the message | -| timestamp | ISO8601 timestamp | when this message was sent | -| edited_timestamp | ?ISO8601 timestamp | when this message was edited (or null if never) | -| tts | boolean | whether this was a TTS message | -| mention_everyone | boolean | whether this message mentions everyone | -| mentions | array of [user](/docs/resources/user#user-object) objects | users specifically mentioned in the message | -| mention_roles | array of [role](/docs/topics/permissions#role-object) object ids | roles specifically mentioned in this message | -| mention_channels? \[3\] | array of [channel mention](/docs/resources/message#channel-mention-object) objects | channels specifically mentioned in this message | -| attachments \[2\] | array of [attachment](/docs/resources/message#attachment-object) objects | any attached files | -| embeds \[2\] | array of [embed](/docs/resources/message#embed-object) objects | any embedded content | -| reactions? | array of [reaction](/docs/resources/message#reaction-object) objects | reactions to the message | -| nonce? | integer or string | used for validating a message was sent | -| pinned | boolean | whether this message is pinned | -| webhook_id? | snowflake | if the message is generated by a webhook, this is the webhook's id | -| type | integer | [type of message](/docs/resources/message#message-object-message-types) | -| activity? | [message activity](/docs/resources/message#message-object-message-activity-structure) object | sent with Rich Presence-related chat embeds | -| application? | partial [application](/docs/resources/application#application-object) object | sent with Rich Presence-related chat embeds | -| application_id? | snowflake | if the message is an [Interaction](/docs/interactions/receiving-and-responding) or application-owned webhook, this is the id of the application | -| flags? | integer | [message flags](/docs/resources/message#message-object-message-flags) combined as a [bitfield](https://en.wikipedia.org/wiki/Bit_field) | -| message_reference? | [message reference](/docs/resources/message#message-reference-structure) object | data showing the source of a crosspost, channel follow add, pin, or reply message | -| message_snapshots? \[5\] | array of [message snapshot](/docs/resources/message#message-snapshot-object) objects | the message associated with the `message_reference`. This is a minimal subset of fields in a message (e.g. `author` is excluded.) | -| referenced_message? \[4\] | ?[message object](/docs/resources/message#message-object) | the message associated with the message_reference | -| interaction_metadata? | [message interaction metadata object](/docs/resources/message#message-interaction-metadata-object) | Sent if the message is sent as a result of an [interaction](/docs/interactions/receiving-and-responding) | -| interaction? | [message interaction object](/docs/interactions/receiving-and-responding#message-interaction-object-message-interaction-structure) | **Deprecated in favor of `interaction_metadata`**; sent if the message is a response to an [interaction](/docs/interactions/receiving-and-responding) | -| thread? | [channel](/docs/resources/channel#channel-object) object | the thread that was started from this message, includes [thread member](/docs/resources/channel#thread-member-object) object | -| components? \[2\] | array of [message components](/docs/components/reference#component-object) | sent if the message contains components like buttons, action rows, or other interactive components | -| sticker_items? | array of [message sticker item objects](/docs/resources/sticker#sticker-item-object) | sent if the message contains stickers | -| stickers? | array of [sticker](/docs/resources/sticker#sticker-object) objects | **Deprecated** the stickers sent with the message | -| position? | integer | A generally increasing integer (there may be gaps or duplicates) that represents the approximate position of the message in a thread, it can be used to estimate the relative position of the message in a thread in company with `total_message_sent` on parent thread | -| role_subscription_data? | [role subscription data](/docs/resources/message#role-subscription-data-object) object | data of the role subscription purchase or renewal that prompted this ROLE_SUBSCRIPTION_PURCHASE message | -| resolved? | [resolved](/docs/interactions/receiving-and-responding#interaction-object-resolved-data-structure) data | data for users, members, channels, and roles referenced in this message | -| poll? \[2\] | [poll](/docs/resources/poll#poll-object) object | A poll! | -| call? | [message call](/docs/resources/message#message-call-object) object | the call associated with the message | + +Fields specific to the `MESSAGE_CREATE` and `MESSAGE_UPDATE` events are listed in the [Gateway documentation](/developers/docs/events/gateway-events#message-create). + + + +An app will receive empty values in the `content`, `embeds`, `attachments`, and `components` fields while `poll` will be omitted if they have not configured (or been approved for) the [`MESSAGE_CONTENT` privileged intent (`1 << 15`)](/developers/docs/events/gateway#message-content-intent). + + +| Field | Type | Description | +|---------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| id | snowflake | id of the message | +| channel_id | snowflake | id of the channel the message was sent in | +| author \[1\] | [user](/developers/docs/resources/user#user-object) object | the author of this message (not guaranteed to be a valid user, see below) | +| content \[2\] | string | contents of the message | +| timestamp | ISO8601 timestamp | when this message was sent | +| edited_timestamp | ?ISO8601 timestamp | when this message was edited (or null if never) | +| tts | boolean | whether this was a TTS message | +| mention_everyone | boolean | whether this message mentions everyone | +| mentions | array of [user](/developers/docs/resources/user#user-object) objects | users specifically mentioned in the message | +| mention_roles | array of [role](/developers/docs/topics/permissions#role-object) object ids | roles specifically mentioned in this message | +| mention_channels? \[3\] | array of [channel mention](/developers/docs/resources/message#channel-mention-object) objects | channels specifically mentioned in this message | +| attachments \[2\] | array of [attachment](/developers/docs/resources/message#attachment-object) objects | any attached files | +| embeds \[2\] | array of [embed](/developers/docs/resources/message#embed-object) objects | any embedded content | +| reactions? | array of [reaction](/developers/docs/resources/message#reaction-object) objects | reactions to the message | +| nonce? | integer or string | used for validating a message was sent | +| pinned | boolean | whether this message is pinned | +| webhook_id? | snowflake | if the message is generated by a webhook, this is the webhook's id | +| type | integer | [type of message](/developers/docs/resources/message#message-object-message-types) | +| activity? | [message activity](/developers/docs/resources/message#message-object-message-activity-structure) object | sent with Rich Presence-related chat embeds | +| application? | partial [application](/developers/docs/resources/application#application-object) object | sent with Rich Presence-related chat embeds | +| application_id? | snowflake | if the message is an [Interaction](/developers/docs/interactions/receiving-and-responding) or application-owned webhook, this is the id of the application | +| flags? | integer | [message flags](/developers/docs/resources/message#message-object-message-flags) combined as a [bitfield](https://en.wikipedia.org/wiki/Bit_field) | +| message_reference? | [message reference](/developers/docs/resources/message#message-reference-structure) object | data showing the source of a crosspost, channel follow add, pin, or reply message | +| message_snapshots? \[5\] | array of [message snapshot](/developers/docs/resources/message#message-snapshot-object) objects | the message associated with the `message_reference`. This is a minimal subset of fields in a message (e.g. `author` is excluded.) | +| referenced_message? \[4\] | ?[message object](/developers/docs/resources/message#message-object) | the message associated with the message_reference | +| interaction_metadata? | [message interaction metadata object](/developers/docs/resources/message#message-interaction-metadata-object) | Sent if the message is sent as a result of an [interaction](/developers/docs/interactions/receiving-and-responding) | +| interaction? | [message interaction object](/developers/docs/interactions/receiving-and-responding#message-interaction-object-message-interaction-structure) | **Deprecated in favor of `interaction_metadata`**; sent if the message is a response to an [interaction](/developers/docs/interactions/receiving-and-responding) | +| thread? | [channel](/developers/docs/resources/channel#channel-object) object | the thread that was started from this message, includes [thread member](/developers/docs/resources/channel#thread-member-object) object | +| components? \[2\] | array of [message components](/developers/docs/components/reference#component-object) | sent if the message contains components like buttons, action rows, or other interactive components | +| sticker_items? | array of [message sticker item objects](/developers/docs/resources/sticker#sticker-item-object) | sent if the message contains stickers | +| stickers? | array of [sticker](/developers/docs/resources/sticker#sticker-object) objects | **Deprecated** the stickers sent with the message | +| position? | integer | A generally increasing integer (there may be gaps or duplicates) that represents the approximate position of the message in a thread, it can be used to estimate the relative position of the message in a thread in company with `total_message_sent` on parent thread | +| role_subscription_data? | [role subscription data](/developers/docs/resources/message#role-subscription-data-object) object | data of the role subscription purchase or renewal that prompted this ROLE_SUBSCRIPTION_PURCHASE message | +| resolved? | [resolved](/developers/docs/interactions/receiving-and-responding#interaction-object-resolved-data-structure) data | data for users, members, channels, and roles referenced in this message | +| poll? \[2\] | [poll](/developers/docs/resources/poll#poll-object) object | A poll! | +| call? | [message call](/developers/docs/resources/message#message-call-object) object | the call associated with the message | \[1\] The author object follows the structure of the user object, but is only a valid user in the case where the message is generated by a user or bot user. If the message is generated by a webhook, the author object corresponds to the webhook's id, username, and avatar. You can tell if a message is generated by a webhook by checking for the `webhook_id` on the message object. -\[2\] An app will receive empty values in the `content`, `embeds`, `attachments`, and `components` fields while `poll` will be omitted if they have not configured (or been approved for) the [`MESSAGE_CONTENT` privileged intent (`1 << 15`)](/docs/events/gateway#message-content-intent). +\[2\] An app will receive empty values in the `content`, `embeds`, `attachments`, and `components` fields while `poll` will be omitted if they have not configured (or been approved for) the [`MESSAGE_CONTENT` privileged intent (`1 << 15`)](/developers/docs/events/gateway#message-content-intent). \[3\] Not all channel mentions in a message will appear in `mention_channels`. Only textual channels that are visible to everyone in a lurkable guild will ever be included. Only crossposted messages (via Channel Following) currently include `mention_channels` at all. If no mentions in the message meet these requirements, this field will not be sent. \[4\] This field is only returned for messages with a `type` of `19` (REPLY), `21` (THREAD_STARTER_MESSAGE), or `23` (CONTEXT_MENU_COMMAND). If the message is one of these but the `referenced_message` field is not present, the backend did not attempt to fetch the message that was being replied to, so its state is unknown. If the field exists but is null, the referenced message was deleted. -\[5\] See [message reference types](/docs/resources/message#message-reference-types) +\[5\] See [message reference types](/developers/docs/resources/message#message-reference-types) + ###### Message Types -:::warn + Type `19` and `20` are only available in API v8 and above. In v6, they are represented as type `0`. Additionally, type `21` is only available in API v9 and above. -::: + | Type | Value | Deletable | |----------------------------------------------|-------|-----------| @@ -115,13 +120,15 @@ Type `19` and `20` are only available in API v8 and above. In v6, they are repre \* Can only be deleted by members with `MANAGE_MESSAGES` permission + ###### Message Activity Structure -| Field | Type | Description | -|-----------|---------|-------------------------------------------------------------------------------------------| -| type | integer | [type of message activity](/docs/resources/message#message-object-message-activity-types) | -| party_id? | string | party_id from a Rich Presence event | +| Field | Type | Description | +|-----------|---------|------------------------------------------------------------------------------------------------------| +| type | integer | [type of message activity](/developers/docs/resources/message#message-object-message-activity-types) | +| party_id? | string | party_id from a Rich Presence event | + ###### Message Activity Types | Type | Value | @@ -131,26 +138,28 @@ Type `19` and `20` are only available in API v8 and above. In v6, they are repre | LISTEN | 3 | | JOIN_REQUEST | 5 | + ###### Message Flags -| Flag | Value | Description | -|----------------------------------------|-----------|-----------------------------------------------------------------------------------| -| CROSSPOSTED | `1 << 0` | this message has been published to subscribed channels (via Channel Following) | -| IS_CROSSPOST | `1 << 1` | this message originated from a message in another channel (via Channel Following) | -| SUPPRESS_EMBEDS | `1 << 2` | do not include any embeds when serializing this message | -| SOURCE_MESSAGE_DELETED | `1 << 3` | the source message for this crosspost has been deleted (via Channel Following) | -| URGENT | `1 << 4` | this message came from the urgent message system | -| HAS_THREAD | `1 << 5` | this message has an associated thread, with the same id as the message | -| EPHEMERAL | `1 << 6` | this message is only visible to the user who invoked the Interaction | -| LOADING | `1 << 7` | this message is an Interaction Response and the bot is "thinking" | -| FAILED_TO_MENTION_SOME_ROLES_IN_THREAD | `1 << 8` | this message failed to mention some roles and add their members to the thread | -| SUPPRESS_NOTIFICATIONS | `1 << 12` | this message will not trigger push and desktop notifications | -| IS_VOICE_MESSAGE | `1 << 13` | this message is a voice message | -| HAS_SNAPSHOT | `1 << 14` | this message has a snapshot (via Message Forwarding) | -| IS_COMPONENTS_V2 \* | `1 << 15` | allows you to create fully [component](/docs/components/overview)-driven messages | +| Flag | Value | Description | +|----------------------------------------|-----------|----------------------------------------------------------------------------------------------| +| CROSSPOSTED | `1 << 0` | this message has been published to subscribed channels (via Channel Following) | +| IS_CROSSPOST | `1 << 1` | this message originated from a message in another channel (via Channel Following) | +| SUPPRESS_EMBEDS | `1 << 2` | do not include any embeds when serializing this message | +| SOURCE_MESSAGE_DELETED | `1 << 3` | the source message for this crosspost has been deleted (via Channel Following) | +| URGENT | `1 << 4` | this message came from the urgent message system | +| HAS_THREAD | `1 << 5` | this message has an associated thread, with the same id as the message | +| EPHEMERAL | `1 << 6` | this message is only visible to the user who invoked the Interaction | +| LOADING | `1 << 7` | this message is an Interaction Response and the bot is "thinking" | +| FAILED_TO_MENTION_SOME_ROLES_IN_THREAD | `1 << 8` | this message failed to mention some roles and add their members to the thread | +| SUPPRESS_NOTIFICATIONS | `1 << 12` | this message will not trigger push and desktop notifications | +| IS_VOICE_MESSAGE | `1 << 13` | this message is a voice message | +| HAS_SNAPSHOT | `1 << 14` | this message has a snapshot (via Message Forwarding) | +| IS_COMPONENTS_V2 \* | `1 << 15` | allows you to create fully [component](/developers/docs/components/overview)-driven messages | \* Once a message has been sent with this flag, it can't be removed from that message. + ###### Example Message ```json @@ -193,6 +202,7 @@ Type `19` and `20` are only available in API v8 and above. In v6, they are repre } ``` + ###### Example Crossposted Message ```json @@ -254,55 +264,59 @@ Type `19` and `20` are only available in API v8 and above. In v6, they are repre Metadata about the interaction, including the source of the interaction and relevant server and user IDs. -One of [Application Command Interaction Metadata](/docs/resources/message#message-interaction-metadata-object-application-command-interaction-metadata-structure), [Message Component Interaction Metadata](/docs/resources/message#message-interaction-metadata-object-message-component-interaction-metadata-structure), or [Modal Submit Interaction Metadata](/docs/resources/message#message-interaction-metadata-object-modal-submit-interaction-metadata-structure). +One of [Application Command Interaction Metadata](/developers/docs/resources/message#message-interaction-metadata-object-application-command-interaction-metadata-structure), [Message Component Interaction Metadata](/developers/docs/resources/message#message-interaction-metadata-object-message-component-interaction-metadata-structure), or [Modal Submit Interaction Metadata](/developers/docs/resources/message#message-interaction-metadata-object-modal-submit-interaction-metadata-structure). + ###### Application Command Interaction Metadata Structure -| Field | Type | Description | -|--------------------------------|---------------------------------------------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| -| id | snowflake | ID of the interaction | -| type | [interaction type](/docs/interactions/receiving-and-responding#interaction-object-interaction-type) | Type of interaction | -| user | [user](/docs/resources/user#user-object) object | User who triggered the interaction | -| authorizing_integration_owners | dictionary with keys of [application integration types](/docs/resources/application#application-object-application-integration-types) | IDs for installation context(s) related to an interaction. Details in [Authorizing Integration Owners Object](/docs/interactions/receiving-and-responding#interaction-object-authorizing-integration-owners-object) | -| original_response_message_id? | snowflake | ID of the original response message, present only on [follow-up messages](/docs/interactions/receiving-and-responding) | -| target_user? | [user](/docs/resources/user#user-object) object | The user the command was run on, present only on [user command](/docs/interactions/application-commands#user-commands) interactions | -| target_message_id? | snowflake | The ID of the message the command was run on, present only on [message command](/docs/interactions/application-commands#message-commands) interactions. The original response message will also have `message_reference` and `referenced_message` pointing to this message. | +| Field | Type | Description | +|--------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| id | snowflake | ID of the interaction | +| type | [interaction type](/developers/docs/interactions/receiving-and-responding#interaction-object-interaction-type) | Type of interaction | +| user | [user](/developers/docs/resources/user#user-object) object | User who triggered the interaction | +| authorizing_integration_owners | dictionary with keys of [application integration types](/developers/docs/resources/application#application-object-application-integration-types) | IDs for installation context(s) related to an interaction. Details in [Authorizing Integration Owners Object](/developers/docs/interactions/receiving-and-responding#interaction-object-authorizing-integration-owners-object) | +| original_response_message_id? | snowflake | ID of the original response message, present only on [follow-up messages](/developers/docs/interactions/receiving-and-responding) | +| target_user? | [user](/developers/docs/resources/user#user-object) object | The user the command was run on, present only on [user command](/developers/docs/interactions/application-commands#user-commands) interactions | +| target_message_id? | snowflake | The ID of the message the command was run on, present only on [message command](/developers/docs/interactions/application-commands#message-commands) interactions. The original response message will also have `message_reference` and `referenced_message` pointing to this message. | + ###### Message Component Interaction Metadata Structure -| Field | Type | Description | -|--------------------------------|---------------------------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| -| id | snowflake | ID of the interaction | -| type | [interaction type](/docs/interactions/receiving-and-responding#interaction-object-interaction-type) | Type of interaction | -| user | [user](/docs/resources/user#user-object) object | User who triggered the interaction | -| authorizing_integration_owners | dictionary with keys of [application integration types](/docs/resources/application#application-object-application-integration-types) | IDs for installation context(s) related to an interaction. Details in [Authorizing Integration Owners Object](/docs/interactions/receiving-and-responding#interaction-object-authorizing-integration-owners-object) | -| original_response_message_id? | snowflake | ID of the original response message, present only on [follow-up messages](/docs/interactions/receiving-and-responding) | -| interacted_message_id | snowflake | ID of the message that contained the interactive component | +| Field | Type | Description | +|--------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| id | snowflake | ID of the interaction | +| type | [interaction type](/developers/docs/interactions/receiving-and-responding#interaction-object-interaction-type) | Type of interaction | +| user | [user](/developers/docs/resources/user#user-object) object | User who triggered the interaction | +| authorizing_integration_owners | dictionary with keys of [application integration types](/developers/docs/resources/application#application-object-application-integration-types) | IDs for installation context(s) related to an interaction. Details in [Authorizing Integration Owners Object](/developers/docs/interactions/receiving-and-responding#interaction-object-authorizing-integration-owners-object) | +| original_response_message_id? | snowflake | ID of the original response message, present only on [follow-up messages](/developers/docs/interactions/receiving-and-responding) | +| interacted_message_id | snowflake | ID of the message that contained the interactive component | + ###### Modal Submit Interaction Metadata Structure -| Field | Type | Description | -|---------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| -| id | snowflake | ID of the interaction | -| type | [interaction type](/docs/interactions/receiving-and-responding#interaction-object-interaction-type) | Type of interaction | -| user | [user](/docs/resources/user#user-object) object | User who triggered the interaction | -| authorizing_integration_owners | dictionary with keys of [application integration types](/docs/resources/application#application-object-application-integration-types) | IDs for installation context(s) related to an interaction. Details in [Authorizing Integration Owners Object](/docs/interactions/receiving-and-responding#interaction-object-authorizing-integration-owners-object) | -| original_response_message_id? | snowflake | ID of the original response message, present only on [follow-up messages](/docs/interactions/receiving-and-responding) | -| triggering_interaction_metadata | [Application Command Interaction Metadata](/docs/resources/message#message-interaction-metadata-object-application-command-interaction-metadata-structure) or [Message Component Interaction Metadata](/docs/resources/message#message-interaction-metadata-object-message-component-interaction-metadata-structure) object | Metadata for the interaction that was used to open the modal | +| Field | Type | Description | +|---------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| id | snowflake | ID of the interaction | +| type | [interaction type](/developers/docs/interactions/receiving-and-responding#interaction-object-interaction-type) | Type of interaction | +| user | [user](/developers/docs/resources/user#user-object) object | User who triggered the interaction | +| authorizing_integration_owners | dictionary with keys of [application integration types](/developers/docs/resources/application#application-object-application-integration-types) | IDs for installation context(s) related to an interaction. Details in [Authorizing Integration Owners Object](/developers/docs/interactions/receiving-and-responding#interaction-object-authorizing-integration-owners-object) | +| original_response_message_id? | snowflake | ID of the original response message, present only on [follow-up messages](/developers/docs/interactions/receiving-and-responding) | +| triggering_interaction_metadata | [Application Command Interaction Metadata](/developers/docs/resources/message#message-interaction-metadata-object-application-command-interaction-metadata-structure) or [Message Component Interaction Metadata](/developers/docs/resources/message#message-interaction-metadata-object-message-component-interaction-metadata-structure) object | Metadata for the interaction that was used to open the modal | ### Message Call Object Information about the call in a private channel. + ###### Message Call Object Structure -| Field | Type | Description | -|------------------|---------------------|--------------------------------------------------------------------------------------------| -| participants | array of snowflakes | array of [user](/docs/resources/user#user-object) object ids that participated in the call | -| ended_timestamp? | ?ISO8601 timestamp | time when call ended | +| Field | Type | Description | +|------------------|---------------------|-------------------------------------------------------------------------------------------------------| +| participants | array of snowflakes | array of [user](/developers/docs/resources/user#user-object) object ids that participated in the call | +| ended_timestamp? | ?ISO8601 timestamp | time when call ended | ### Message Reference Object @@ -310,7 +324,7 @@ Information about the call in a private channel. | Field | Type | Description | |---------------------|-----------|-----------------------------------------------------------------------------------------------------------------------------------------| -| type? \* | integer | [type of reference](/docs/resources/message#message-reference-types). | +| type? \* | integer | [type of reference](/developers/docs/resources/message#message-reference-types). | | message_id? | snowflake | id of the originating message | | channel_id? \*\* | snowflake | id of the originating message's channel | | guild_id? | snowflake | id of the originating message's guild | @@ -339,25 +353,29 @@ This is subject to change in the future. Message references are generic attribution on a message. There are multiple message types that have a `message_reference` object. + ###### Crosspost messages - These are messages that originated from another channel (IS_CROSSPOST flag). - These messages have all three fields, which point to the original message that was crossposted. + ###### Channel Follow Add messages - These are automatic messages sent when a channel is followed into the current channel (type 12). - These messages have the `channel_id` and `guild_id` fields, which point to the followed announcement channel. + ###### Pin messages - These are automatic messages sent when a message is pinned (type 6). - These messages have `message_id` and `channel_id`, and `guild_id` if it is in a guild, which point to the message that was pinned. + ###### Forwards - These are messages which capture a snapshot of a message. -- These messages have an array of [`message_snapshot`](/docs/resources/message#message-snapshot-object) objects containing a copy of the original message. This copy follows the same structure as a message, but has only the minimal set of fields returned required for context/rendering. +- These messages have an array of [`message_snapshot`](/developers/docs/resources/message#message-snapshot-object) objects containing a copy of the original message. This copy follows the same structure as a message, but has only the minimal set of fields returned required for context/rendering. - of note: `author` will be excluded - A forwarded message can be identified by looking at its `message_reference.type` field - `message_snapshots` will be the message data associated with the forward. Currently we support only 1 snapshot. @@ -367,6 +385,7 @@ There are multiple message types that have a `message_reference` object. - Required fields: `type`, `message_id`, `channel_id` - the requestor must have `VIEW_CHANNEL` permissions + ###### Replies - These are messages replying to a previous message (type 19). @@ -374,11 +393,13 @@ There are multiple message types that have a `message_reference` object. - Replies are created by including a message_reference when sending a message. When sending, only `message_id` is required. - These messages can have the referenced message resolved in the `referenced_message` field. + ###### Thread Created messages - These are automatic messages sent when a public thread is created from an old message or without a message (type 18). - These messages have the `channel_id` and `guild_id` fields, which point to the created thread channel. + ###### Thread starter messages - These are the first message in public threads created from messages. They point back to the message in the parent channel from which the thread was started. (type 21) @@ -386,17 +407,19 @@ There are multiple message types that have a `message_reference` object. - These messages can have the referenced message resolved in the `referenced_message` field. - These messages will never have content, embeds, or attachments, mainly just the `message_reference` and `referenced_message` fields. + ###### Poll result messages - These are automatic messages sent after a poll has ended and the results have been finalized. (type 46) - These messages have `message_id` and `channel_id`, which point to the original poll message. The `channel_id` will be the same as that of the poll. - The author will be the same as the author of the poll and will be mentioned. -- These messages contain a [`poll_result` embed](/docs/resources/message#embed-fields-by-embed-type-poll-result-embed-fields) +- These messages contain a [`poll_result` embed](/developers/docs/resources/message#embed-fields-by-embed-type-poll-result-embed-fields) + ###### Context Menu Command messages - These are messages sent when a user uses a context menu Application Command. (type 23) -- If the command was a [message command](/docs/interactions/application-commands#message-commands), the message will have have `message_id` and `channel_id`, and `guild_id` if it is in a guild, which point to the message that the command was used on. The channel_id and guild_id will be the same as the new message. +- If the command was a [message command](/developers/docs/interactions/application-commands#message-commands), the message will have have `message_id` and `channel_id`, and `guild_id` if it is in a guild, which point to the message that the command was used on. The channel_id and guild_id will be the same as the new message. - These messages can have the referenced message resolved in the `referenced_message` field. #### Voice Messages @@ -405,7 +428,7 @@ Voice messages are messages with the `IS_VOICE_MESSAGE` flag. They have the foll - They cannot be edited. - Only a single audio attachment is allowed. No content, stickers, etc... -- The [attachment](/docs/resources/message#attachment-object) has additional fields: `duration_secs` and `waveform`. The `Content-Type` of the attachment must begin with `audio/` to respect these fields. +- The [attachment](/developers/docs/resources/message#attachment-object) has additional fields: `duration_secs` and `waveform`. The `Content-Type` of the attachment must begin with `audio/` to respect these fields. The `waveform` is intended to be a preview of the entire voice message, with 1 byte per datapoint encoded in base64. Clients sample the recording at most once per 100 milliseconds, but will downsample so that no more than 256 datapoints are in the waveform. @@ -418,34 +441,36 @@ The encoding, and the waveform details, are an implementation detail and may cha #### Message Snapshot Structure -| Field | Type | Description | -|-----------|------------------------------------------------------------------|---------------------------------------------------| -| message\* | partial [message](/docs/resources/message#message-object) object | minimal subset of fields in the forwarded message | +| Field | Type | Description | +|-----------|-----------------------------------------------------------------------------|---------------------------------------------------| +| message\* | partial [message](/developers/docs/resources/message#message-object) object | minimal subset of fields in the forwarded message | \* The current subset of message fields consists of: `type`, `content`, `embeds`, `attachments`, `timestamp`, `edited_timestamp`, `flags`, `mentions`, `mention_roles`, `stickers`, `sticker_items`, and `components`. -:::info + While message snapshots are able to support nested snapshots, we currently limit the depth of nesting to 1. -::: + ### Reaction Object + ###### Reaction Structure -| Field | Type | Description | -|---------------|------------------------------------------------------------|----------------------------------------------------------------------------------------| -| count | integer | Total number of times this emoji has been used to react (including super reacts) | -| count_details | object | [Reaction count details object](/docs/resources/message#reaction-count-details-object) | -| me | boolean | Whether the current user reacted using this emoji | -| me_burst | boolean | Whether the current user super-reacted using this emoji | -| emoji | partial [emoji](/docs/resources/emoji#emoji-object) object | emoji information | -| burst_colors | array | HEX colors used for super reaction | +| Field | Type | Description | +|---------------|-----------------------------------------------------------------------|---------------------------------------------------------------------------------------------------| +| count | integer | Total number of times this emoji has been used to react (including super reacts) | +| count_details | object | [Reaction count details object](/developers/docs/resources/message#reaction-count-details-object) | +| me | boolean | Whether the current user reacted using this emoji | +| me_burst | boolean | Whether the current user super-reacted using this emoji | +| emoji | partial [emoji](/developers/docs/resources/emoji#emoji-object) object | emoji information | +| burst_colors | array | HEX colors used for super reaction | ### Reaction Count Details Object The reaction count details object contains a breakdown of normal and super reaction counts for the associated emoji. + ###### Reaction Count Details Structure | Field | Type | Description | @@ -455,36 +480,39 @@ The reaction count details object contains a breakdown of normal and super react ### Embed Object + ###### Embed Structure -| Field | Type | Description | -|--------------|--------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------| -| title? | string | title of embed | -| type? | string | [type of embed](/docs/resources/message#embed-object-embed-types) (always "rich" for webhook embeds) | -| description? | string | description of embed | -| url? | string | url of embed | -| timestamp? | ISO8601 timestamp | timestamp of embed content | -| color? | integer | color code of the embed | -| footer? | [embed footer](/docs/resources/message#embed-object-embed-footer-structure) object | footer information | -| image? | [embed image](/docs/resources/message#embed-object-embed-image-structure) object | image information | -| thumbnail? | [embed thumbnail](/docs/resources/message#embed-object-embed-thumbnail-structure) object | thumbnail information | -| video? | [embed video](/docs/resources/message#embed-object-embed-video-structure) object | video information | -| provider? | [embed provider](/docs/resources/message#embed-object-embed-provider-structure) object | provider information | -| author? | [embed author](/docs/resources/message#embed-object-embed-author-structure) object | author information | -| fields? | array of [embed field](/docs/resources/message#embed-object-embed-field-structure) objects | fields information, max of 25 | - +| Field | Type | Description | +|--------------|-------------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------| +| title? | string | title of embed | +| type? | string | [type of embed](/developers/docs/resources/message#embed-object-embed-types) (always "rich" for webhook embeds) | +| description? | string | description of embed | +| url? | string | url of embed | +| timestamp? | ISO8601 timestamp | timestamp of embed content | +| color? | integer | color code of the embed | +| footer? | [embed footer](/developers/docs/resources/message#embed-object-embed-footer-structure) object | footer information | +| image? | [embed image](/developers/docs/resources/message#embed-object-embed-image-structure) object | image information | +| thumbnail? | [embed thumbnail](/developers/docs/resources/message#embed-object-embed-thumbnail-structure) object | thumbnail information | +| video? | [embed video](/developers/docs/resources/message#embed-object-embed-video-structure) object | video information | +| provider? | [embed provider](/developers/docs/resources/message#embed-object-embed-provider-structure) object | provider information | +| author? | [embed author](/developers/docs/resources/message#embed-object-embed-author-structure) object | author information | +| fields? | array of [embed field](/developers/docs/resources/message#embed-object-embed-field-structure) objects | fields information, max of 25 | + + ###### Embed Types -| Type | Description | -|-------------|--------------------------------------------------------------------------------------------------| -| rich | generic embed rendered from embed attributes | -| image | image embed | -| video | video embed | -| gifv | animated gif image embed rendered as a video embed | -| article | article embed | -| link | link embed | -| poll_result | [poll result embed](/docs/resources/message#embed-fields-by-embed-type-poll-result-embed-fields) | - +| Type | Description | +|-------------|-------------------------------------------------------------------------------------------------------------| +| rich | generic embed rendered from embed attributes | +| image | image embed | +| video | video embed | +| gifv | animated gif image embed rendered as a video embed | +| article | article embed | +| link | link embed | +| poll_result | [poll result embed](/developers/docs/resources/message#embed-fields-by-embed-type-poll-result-embed-fields) | + + ###### Embed Thumbnail Structure | Field | Type | Description | @@ -494,6 +522,7 @@ The reaction count details object contains a breakdown of normal and super react | height? | integer | height of thumbnail | | width? | integer | width of thumbnail | + ###### Embed Video Structure | Field | Type | Description | @@ -503,6 +532,7 @@ The reaction count details object contains a breakdown of normal and super react | height? | integer | height of video | | width? | integer | width of video | + ###### Embed Image Structure | Field | Type | Description | @@ -512,6 +542,7 @@ The reaction count details object contains a breakdown of normal and super react | height? | integer | height of image | | width? | integer | width of image | + ###### Embed Provider Structure | Field | Type | Description | @@ -519,6 +550,7 @@ The reaction count details object contains a breakdown of normal and super react | name? | string | name of provider | | url? | string | url of provider | + ###### Embed Author Structure | Field | Type | Description | @@ -528,6 +560,7 @@ The reaction count details object contains a breakdown of normal and super react | icon_url? | string | url of author icon (only supports http(s) and attachments) | | proxy_icon_url? | string | a proxied url of author icon | + ###### Embed Footer Structure | Field | Type | Description | @@ -536,6 +569,7 @@ The reaction count details object contains a breakdown of normal and super react | icon_url? | string | url of footer icon (only supports http(s) and attachments) | | proxy_icon_url? | string | a proxied url of footer icon | + ###### Embed Field Structure | Field | Type | Description | @@ -544,21 +578,22 @@ The reaction count details object contains a breakdown of normal and super react | value | string | value of the field | | inline? | boolean | whether or not this field should display inline | + ###### Embed Limits To facilitate showing rich content, rich embeds do not follow the traditional limits of message content. However, some limits are still in place to prevent excessively large embeds. The following table describes the limits: All of the following limits are measured inclusively. Leading and trailing whitespace characters are not included (they are trimmed automatically). -| Field | Limit | -|----------------------------------------------------------------------------|--------------------------------------------------------------------------------------| -| title | 256 characters | -| description | 4096 characters | -| fields | Up to 25 [field](/docs/resources/message#embed-object-embed-field-structure) objects | -| [field.name](/docs/resources/message#embed-object-embed-field-structure) | 256 characters | -| [field.value](/docs/resources/message#embed-object-embed-field-structure) | 1024 characters | -| [footer.text](/docs/resources/message#embed-object-embed-footer-structure) | 2048 characters | -| [author.name](/docs/resources/message#embed-object-embed-author-structure) | 256 characters | +| Field | Limit | +|---------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------| +| title | 256 characters | +| description | 4096 characters | +| fields | Up to 25 [field](/developers/docs/resources/message#embed-object-embed-field-structure) objects | +| [field.name](/developers/docs/resources/message#embed-object-embed-field-structure) | 256 characters | +| [field.value](/developers/docs/resources/message#embed-object-embed-field-structure) | 1024 characters | +| [footer.text](/developers/docs/resources/message#embed-object-embed-footer-structure) | 2048 characters | +| [author.name](/developers/docs/resources/message#embed-object-embed-author-structure) | 256 characters | Additionally, the combined sum of characters in all `title`, `description`, `field.name`, `field.value`, `footer.text`, and `author.name` fields across all embeds attached to a message must not exceed 6000 characters. Violating any of these constraints will result in a `Bad Request` response. @@ -566,8 +601,9 @@ Embeds are deduplicated by URL. If a message contains multiple embeds with the #### Embed Fields by Embed Type -Certain embed types are used to power special UIs. These embeds use [fields](/docs/resources/message#embed-object-embed-field-structure) to include additional data in key-value pairs. Below is a reference of possible embed fields for each of the following embed types. +Certain embed types are used to power special UIs. These embeds use [fields](/developers/docs/resources/message#embed-object-embed-field-structure) to include additional data in key-value pairs. Below is a reference of possible embed fields for each of the following embed types. + ###### Poll Result Embed Fields | Field | Description | @@ -583,31 +619,33 @@ Certain embed types are used to power special UIs. These embeds use [fields](/do ### Attachment Object + ###### Attachment Structure -:::info + For the `attachments` array in Message Create/Edit requests, only the `id` is required. -::: - -| Field | Type | Description | -|----------------|-----------|--------------------------------------------------------------------------------------------------------------------------------------------------| -| id | snowflake | attachment id | -| filename | string | name of file attached | -| title? | string | the title of the file | -| description? | string | description for the file (max 1024 characters) | -| content_type? | string | the attachment's [media type](https://en.wikipedia.org/wiki/Media_type) | -| size | integer | size of file in bytes | -| url | string | source url of file | -| proxy_url | string | a proxied url of file | -| height? | ?integer | height of file (if image) | -| width? | ?integer | width of file (if image) | -| ephemeral? \* | boolean | whether this attachment is ephemeral | -| duration_secs? | float | the duration of the audio file (currently for voice messages) | -| waveform? | string | base64 encoded bytearray representing a sampled waveform (currently for voice messages) | -| flags? | integer | [attachment flags](/docs/resources/message#attachment-object-attachment-flags) combined as a [bitfield](https://en.wikipedia.org/wiki/Bit_field) | + + +| Field | Type | Description | +|----------------|-----------|-------------------------------------------------------------------------------------------------------------------------------------------------------------| +| id | snowflake | attachment id | +| filename | string | name of file attached | +| title? | string | the title of the file | +| description? | string | description for the file (max 1024 characters) | +| content_type? | string | the attachment's [media type](https://en.wikipedia.org/wiki/Media_type) | +| size | integer | size of file in bytes | +| url | string | source url of file | +| proxy_url | string | a proxied url of file | +| height? | ?integer | height of file (if image) | +| width? | ?integer | width of file (if image) | +| ephemeral? \* | boolean | whether this attachment is ephemeral | +| duration_secs? | float | the duration of the audio file (currently for voice messages) | +| waveform? | string | base64 encoded bytearray representing a sampled waveform (currently for voice messages) | +| flags? | integer | [attachment flags](/developers/docs/resources/message#attachment-object-attachment-flags) combined as a [bitfield](https://en.wikipedia.org/wiki/Bit_field) | \* Ephemeral attachments will automatically be removed after a set period of time. Ephemeral attachments on messages are guaranteed to be available as long as the message itself exists. + ###### Attachment Flags | Flag | Value | Description | @@ -616,14 +654,15 @@ For the `attachments` array in Message Create/Edit requests, only the `id` is re ### Channel Mention Object + ###### Channel Mention Structure -| Field | Type | Description | -|----------|-----------|-----------------------------------------------------------------------------| -| id | snowflake | id of the channel | -| guild_id | snowflake | id of the guild containing the channel | -| type | integer | the [type of channel](/docs/resources/channel#channel-object-channel-types) | -| name | string | the name of the channel | +| Field | Type | Description | +|----------|-----------|----------------------------------------------------------------------------------------| +| id | snowflake | id of the channel | +| guild_id | snowflake | id of the guild containing the channel | +| type | integer | the [type of channel](/developers/docs/resources/channel#channel-object-channel-types) | +| name | string | the name of the channel | ### Allowed Mentions Object @@ -635,6 +674,7 @@ Setting the `allowed_mentions` field lets you determine whether users will recei - Users can customize their notification settings through the Discord app, which might cause them to only receive a notification badge and no push notification + ###### Allowed Mention Types | Type | Value | Description | @@ -643,6 +683,7 @@ Setting the `allowed_mentions` field lets you determine whether users will recei | User Mentions | "users" | Controls user mentions | | Everyone Mentions | "everyone" | Controls @everyone and @here mentions | + ###### Default Settings for Allowed Mentions The default value for the `allowed_mentions` field, used when it is not passed in the body, varies depending on the context: @@ -663,15 +704,14 @@ In **interactions** and **webhooks**, only user mentions are parsed, which corre } ``` +| Field | Type | Description | +|---------------|--------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------| +| parse? | array of allowed mention types | An array of [allowed mention types](/developers/docs/resources/message#allowed-mentions-object-allowed-mention-types) to parse from the content | +| roles? | array of snowflakes | Array of role ids to mention, max 100 | +| users? | array of snowflakes | Array of user ids to mention, max 100 | +| replied_user? | boolean | For replies, whether to mention the author of the message being replied to, defaults to false | - -| Field | Type | Description | -|---------------|--------------------------------|--------------------------------------------------------------------------------------------------------------------------------------| -| parse? | array of allowed mention types | An array of [allowed mention types](/docs/resources/message#allowed-mentions-object-allowed-mention-types) to parse from the content | -| roles? | array of snowflakes | Array of role ids to mention, max 100 | -| users? | array of snowflakes | Array of user ids to mention, max 100 | -| replied_user? | boolean | For replies, whether to mention the author of the message being replied to, defaults to false | - + ###### Allowed Mentions Examples Because the behavior of the `allowed_mentions` field is more complex than it seems, here's a set of examples: @@ -748,6 +788,7 @@ Any entities whose id is included can be mentioned. Do note the API will silentl ### Role Subscription Data Object + ###### Role Subscription Data Object Structure | Field | Type | Description | @@ -759,26 +800,28 @@ Any entities whose id is included can be mentioned. Do note the API will silentl ### Message Pin Object + ###### Message Pin Object Struture -| Field | Type | Description | -|-----------|----------------------------------------------------------|---------------------------------| -| pinned_at | ISO8601 timestamp | the time the message was pinned | -| message | [message](/docs/resources/message#message-object) object | the pinned message | +| Field | Type | Description | +|-----------|---------------------------------------------------------------------|---------------------------------| +| pinned_at | ISO8601 timestamp | the time the message was pinned | +| message | [message](/developers/docs/resources/message#message-object) object | the pinned message | ## Get Channel Messages -/channels/[\{channel.id\}](/docs/resources/channel#channel-object)/messages +/channels/[\{channel.id\}](/developers/docs/resources/channel#channel-object)/messages -Retrieves the messages in a channel. Returns an array of [message](/docs/resources/message#message-object) objects from newest to oldest on success. +Retrieves the messages in a channel. Returns an array of [message](/developers/docs/resources/message#message-object) objects from newest to oldest on success. If operating on a guild channel, this endpoint requires the current user to have the `VIEW_CHANNEL` permission. If the channel is a voice channel, they must _also_ have the `CONNECT` permission. If the current user is missing the `READ_MESSAGE_HISTORY` permission in the channel, then no messages will be returned. -:::info + The `before`, `after`, and `around` parameters are mutually exclusive, only one may be passed at a time. -::: + + ###### Query String Params | Field | Type | Description | Default | @@ -789,26 +832,27 @@ The `before`, `after`, and `around` parameters are mutually exclusive, only one | limit? | integer | Max number of messages to return (1-100) | 50 | ## Get Channel Message -/channels/[\{channel.id\}](/docs/resources/channel#channel-object)/messages/[\{message.id\}](/docs/resources/message#message-object) +/channels/[\{channel.id\}](/developers/docs/resources/channel#channel-object)/messages/[\{message.id\}](/developers/docs/resources/message#message-object) -Retrieves a specific message in the channel. Returns a [message](/docs/resources/message#message-object) object on success. +Retrieves a specific message in the channel. Returns a [message](/developers/docs/resources/message#message-object) object on success. If operating on a guild channel, this endpoint requires the current user to have the `VIEW_CHANNEL` and `READ_MESSAGE_HISTORY` permissions. If the channel is a voice channel, they must _also_ have the `CONNECT` permission. ## Create Message -/channels/[\{channel.id\}](/docs/resources/channel#channel-object)/messages +/channels/[\{channel.id\}](/developers/docs/resources/channel#channel-object)/messages -:::warn + Discord may strip certain characters from message content, like invalid unicode characters or characters which cause unexpected message formatting. If you are passing user-generated strings into message content, consider sanitizing the data to prevent unexpected behavior and using `allowed_mentions` to prevent unexpected mentions. -::: + -Post a message to a guild text or DM channel. Returns a [message](/docs/resources/message#message-object) object. Fires a [Message Create](/docs/events/gateway-events#message-create) Gateway event. See [message formatting](/docs/reference#message-formatting) for more information on how to properly format messages. +Post a message to a guild text or DM channel. Returns a [message](/developers/docs/resources/message#message-object) object. Fires a [Message Create](/developers/docs/events/gateway-events#message-create) Gateway event. See [message formatting](/developers/docs/reference#message-formatting) for more information on how to properly format messages. -To create a message as a reply or forward of another message, apps can include a [`message_reference`](/docs/resources/message#message-reference-structure). +To create a message as a reply or forward of another message, apps can include a [`message_reference`](/developers/docs/resources/message#message-reference-structure). Refer to the documentation for required fields. -Files must be attached using a `multipart/form-data` body as described in [Uploading Files](/docs/reference#uploading-files). +Files must be attached using a `multipart/form-data` body as described in [Uploading Files](/developers/docs/reference#uploading-files). + ###### Limitations - When operating on a guild channel, the current user must have the `SEND_MESSAGES` permission. @@ -818,29 +862,31 @@ Files must be attached using a `multipart/form-data` body as described in [Uploa - The maximum request size when sending a message is **25 MiB** - For the embed object, you can set every field except `type` (it will be `rich` regardless of if you try to set it), `provider`, `video`, and any `height`, `width`, or `proxy_url` values for images. + ###### JSON/Form Params -| Field | Type | Description | -|----------------------|-----------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| -| content?\* | string | Message contents (up to 2000 characters) | -| nonce? | integer or string | Can be used to verify a message was sent (up to 25 characters). Value will appear in the [Message Create event](/docs/events/gateway-events#message-create). | -| tts? | boolean | `true` if this is a TTS message | -| embeds?\* | array of [embed](/docs/resources/message#embed-object) objects | Up to 10 `rich` embeds (up to 6000 characters) | -| allowed_mentions? | [allowed mention object](/docs/resources/message#allowed-mentions-object) | Allowed mentions for the message | -| message_reference?\* | [message reference](/docs/resources/message#message-reference-structure) | Include to make your message a reply or a forward | -| components?\* | array of [message component](/docs/components/reference#component-object) objects | Components to include with the message | -| sticker_ids?\* | array of snowflakes | IDs of up to 3 [stickers](/docs/resources/sticker#sticker-object) in the server to send in the message | -| files[n]?\* | file contents | Contents of the file being sent. See [Uploading Files](/docs/reference#uploading-files) | -| payload_json? | string | JSON-encoded body of non-file params, only for `multipart/form-data` requests. See [Uploading Files](/docs/reference#uploading-files) | -| attachments? | array of partial [attachment](/docs/resources/message#attachment-object) objects | Attachment objects with filename and description. See [Uploading Files](/docs/reference#uploading-files) | -| flags?\*\* | integer | [Message flags](/docs/resources/message#message-object-message-flags) combined as a [bitfield](https://en.wikipedia.org/wiki/Bit_field) (only `SUPPRESS_EMBEDS`, `SUPPRESS_NOTIFICATIONS`, `IS_VOICE_MESSAGE`, and `IS_COMPONENTS_V2` can be set) | -| enforce_nonce? | boolean | If true and nonce is present, it will be checked for uniqueness in the past few minutes. If another message was created by the same author with the same nonce, that message will be returned and no new message will be created. | -| poll? | [poll](/docs/resources/poll#poll-create-request-object) request object | A poll! | +| Field | Type | Description | +|----------------------|----------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| content?\* | string | Message contents (up to 2000 characters) | +| nonce? | integer or string | Can be used to verify a message was sent (up to 25 characters). Value will appear in the [Message Create event](/developers/docs/events/gateway-events#message-create). | +| tts? | boolean | `true` if this is a TTS message | +| embeds?\* | array of [embed](/developers/docs/resources/message#embed-object) objects | Up to 10 `rich` embeds (up to 6000 characters) | +| allowed_mentions? | [allowed mention object](/developers/docs/resources/message#allowed-mentions-object) | Allowed mentions for the message | +| message_reference?\* | [message reference](/developers/docs/resources/message#message-reference-structure) | Include to make your message a reply or a forward | +| components?\* | array of [message component](/developers/docs/components/reference#component-object) objects | Components to include with the message | +| sticker_ids?\* | array of snowflakes | IDs of up to 3 [stickers](/developers/docs/resources/sticker#sticker-object) in the server to send in the message | +| files[n]?\* | file contents | Contents of the file being sent. See [Uploading Files](/developers/docs/reference#uploading-files) | +| payload_json? | string | JSON-encoded body of non-file params, only for `multipart/form-data` requests. See [Uploading Files](/developers/docs/reference#uploading-files) | +| attachments? | array of partial [attachment](/developers/docs/resources/message#attachment-object) objects | Attachment objects with filename and description. See [Uploading Files](/developers/docs/reference#uploading-files) | +| flags?\*\* | integer | [Message flags](/developers/docs/resources/message#message-object-message-flags) combined as a [bitfield](https://en.wikipedia.org/wiki/Bit_field) (only `SUPPRESS_EMBEDS`, `SUPPRESS_NOTIFICATIONS`, `IS_VOICE_MESSAGE`, and `IS_COMPONENTS_V2` can be set) | +| enforce_nonce? | boolean | If true and nonce is present, it will be checked for uniqueness in the past few minutes. If another message was created by the same author with the same nonce, that message will be returned and no new message will be created. | +| poll? | [poll](/developers/docs/resources/poll#poll-create-request-object) request object | A poll! | \* At least one of `content`, `embeds`, `sticker_ids`, `components`, `files[n]`, or `poll` is required. When forwarding a message, only `message_reference` is required. \*\* When the flag `IS_COMPONENTS_V2` is set, the message can only contain `components`. Providing `content`, `embeds`, `sticker_ids`, `files[n]`, or `poll` will fail with a 400 BAD REQUEST response. + ###### Example Request Body (application/json) ```json @@ -854,47 +900,49 @@ Files must be attached using a `multipart/form-data` body as described in [Uploa } ``` -Examples for file uploads are available in [Uploading Files](/docs/reference#uploading-files). +Examples for file uploads are available in [Uploading Files](/developers/docs/reference#uploading-files). ## Crosspost Message -/channels/[\{channel.id\}](/docs/resources/channel#channel-object)/messages/[\{message.id\}](/docs/resources/message#message-object)/crosspost +/channels/[\{channel.id\}](/developers/docs/resources/channel#channel-object)/messages/[\{message.id\}](/developers/docs/resources/message#message-object)/crosspost Crosspost a message in an Announcement Channel to following channels. This endpoint requires the `SEND_MESSAGES` permission, if the current user sent the message, or additionally the `MANAGE_MESSAGES` permission, for all other messages, to be present for the current user. -Returns a [message](/docs/resources/message#message-object) object. Fires a [Message Update](/docs/events/gateway-events#message-update) Gateway event. +Returns a [message](/developers/docs/resources/message#message-object) object. Fires a [Message Update](/developers/docs/events/gateway-events#message-update) Gateway event. ## Create Reaction -/channels/[\{channel.id\}](/docs/resources/channel#channel-object)/messages/[\{message.id\}](/docs/resources/message#message-object)/reactions/[\{emoji.id\}](/docs/resources/emoji#emoji-object)/@me +/channels/[\{channel.id\}](/developers/docs/resources/channel#channel-object)/messages/[\{message.id\}](/developers/docs/resources/message#message-object)/reactions/[\{emoji.id\}](/developers/docs/resources/emoji#emoji-object)/@me -Create a reaction for the message. This endpoint requires the `READ_MESSAGE_HISTORY` permission to be present on the current user. Additionally, if nobody else has reacted to the message using this emoji, this endpoint requires the `ADD_REACTIONS` permission to be present on the current user. Returns a 204 empty response on success. Fires a [Message Reaction Add](/docs/events/gateway-events#message-reaction-add) Gateway event. +Create a reaction for the message. This endpoint requires the `READ_MESSAGE_HISTORY` permission to be present on the current user. Additionally, if nobody else has reacted to the message using this emoji, this endpoint requires the `ADD_REACTIONS` permission to be present on the current user. Returns a 204 empty response on success. Fires a [Message Reaction Add](/developers/docs/events/gateway-events#message-reaction-add) Gateway event. The `emoji` must be [URL Encoded](https://en.wikipedia.org/wiki/Percent-encoding) or the request will fail with `10014: Unknown Emoji`. To use custom emoji, you must encode it in the format `name:id` with the emoji name and emoji id. ## Delete Own Reaction -/channels/[\{channel.id\}](/docs/resources/channel#channel-object)/messages/[\{message.id\}](/docs/resources/message#message-object)/reactions/[\{emoji.id\}](/docs/resources/emoji#emoji-object)/@me +/channels/[\{channel.id\}](/developers/docs/resources/channel#channel-object)/messages/[\{message.id\}](/developers/docs/resources/message#message-object)/reactions/[\{emoji.id\}](/developers/docs/resources/emoji#emoji-object)/@me -Delete a reaction the current user has made for the message. Returns a 204 empty response on success. Fires a [Message Reaction Remove](/docs/events/gateway-events#message-reaction-remove) Gateway event. +Delete a reaction the current user has made for the message. Returns a 204 empty response on success. Fires a [Message Reaction Remove](/developers/docs/events/gateway-events#message-reaction-remove) Gateway event. The `emoji` must be [URL Encoded](https://en.wikipedia.org/wiki/Percent-encoding) or the request will fail with `10014: Unknown Emoji`. To use custom emoji, you must encode it in the format `name:id` with the emoji name and emoji id. ## Delete User Reaction -/channels/[\{channel.id\}](/docs/resources/channel#channel-object)/messages/[\{message.id\}](/docs/resources/message#message-object)/reactions/[\{emoji.id\}](/docs/resources/emoji#emoji-object)/[\{user.id\}](/docs/resources/user#user-object) +/channels/[\{channel.id\}](/developers/docs/resources/channel#channel-object)/messages/[\{message.id\}](/developers/docs/resources/message#message-object)/reactions/[\{emoji.id\}](/developers/docs/resources/emoji#emoji-object)/[\{user.id\}](/developers/docs/resources/user#user-object) -Deletes another user's reaction. This endpoint requires the `MANAGE_MESSAGES` permission to be present on the current user. Returns a 204 empty response on success. Fires a [Message Reaction Remove](/docs/events/gateway-events#message-reaction-remove) Gateway event. +Deletes another user's reaction. This endpoint requires the `MANAGE_MESSAGES` permission to be present on the current user. Returns a 204 empty response on success. Fires a [Message Reaction Remove](/developers/docs/events/gateway-events#message-reaction-remove) Gateway event. The `emoji` must be [URL Encoded](https://en.wikipedia.org/wiki/Percent-encoding) or the request will fail with `10014: Unknown Emoji`. To use custom emoji, you must encode it in the format `name:id` with the emoji name and emoji id. ## Get Reactions -/channels/[\{channel.id\}](/docs/resources/channel#channel-object)/messages/[\{message.id\}](/docs/resources/message#message-object)/reactions/[\{emoji.id\}](/docs/resources/emoji#emoji-object) +/channels/[\{channel.id\}](/developers/docs/resources/channel#channel-object)/messages/[\{message.id\}](/developers/docs/resources/message#message-object)/reactions/[\{emoji.id\}](/developers/docs/resources/emoji#emoji-object) -Get a list of users that reacted with this emoji. Returns an array of [user](/docs/resources/user#user-object) objects on success. +Get a list of users that reacted with this emoji. Returns an array of [user](/developers/docs/resources/user#user-object) objects on success. The `emoji` must be [URL Encoded](https://en.wikipedia.org/wiki/Percent-encoding) or the request will fail with `10014: Unknown Emoji`. To use custom emoji, you must encode it in the format `name:id` with the emoji name and emoji id. + ###### Query String Params -| Field | Type | Description | Default | -|--------|-----------|------------------------------------------------------------------------------|---------| -| type? | integer | The [type of reaction](/docs/resources/message#get-reactions-reaction-types) | 0 | -| after? | snowflake | Get users after this user ID | absent | -| limit? | integer | Max number of users to return (1-100) | 25 | +| Field | Type | Description | Default | +|--------|-----------|-----------------------------------------------------------------------------------------|---------| +| type? | integer | The [type of reaction](/developers/docs/resources/message#get-reactions-reaction-types) | 0 | +| after? | snowflake | Get users after this user ID | absent | +| limit? | integer | Max number of users to return (1-100) | 25 | + ###### Reaction Types | Type | Value | @@ -903,75 +951,77 @@ The `emoji` must be [URL Encoded](https://en.wikipedia.org/wiki/Percent-encoding | BURST | 1 | ## Delete All Reactions -/channels/[\{channel.id\}](/docs/resources/channel#channel-object)/messages/[\{message.id\}](/docs/resources/message#message-object)/reactions +/channels/[\{channel.id\}](/developers/docs/resources/channel#channel-object)/messages/[\{message.id\}](/developers/docs/resources/message#message-object)/reactions -Deletes all reactions on a message. This endpoint requires the `MANAGE_MESSAGES` permission to be present on the current user. Fires a [Message Reaction Remove All](/docs/events/gateway-events#message-reaction-remove-all) Gateway event. +Deletes all reactions on a message. This endpoint requires the `MANAGE_MESSAGES` permission to be present on the current user. Fires a [Message Reaction Remove All](/developers/docs/events/gateway-events#message-reaction-remove-all) Gateway event. ## Delete All Reactions for Emoji -/channels/[\{channel.id\}](/docs/resources/channel#channel-object)/messages/[\{message.id\}](/docs/resources/message#message-object)/reactions/[\{emoji.id\}](/docs/resources/emoji#emoji-object) +/channels/[\{channel.id\}](/developers/docs/resources/channel#channel-object)/messages/[\{message.id\}](/developers/docs/resources/message#message-object)/reactions/[\{emoji.id\}](/developers/docs/resources/emoji#emoji-object) -Deletes all the reactions for a given emoji on a message. This endpoint requires the `MANAGE_MESSAGES` permission to be present on the current user. Fires a [Message Reaction Remove Emoji](/docs/events/gateway-events#message-reaction-remove-emoji) Gateway event. +Deletes all the reactions for a given emoji on a message. This endpoint requires the `MANAGE_MESSAGES` permission to be present on the current user. Fires a [Message Reaction Remove Emoji](/developers/docs/events/gateway-events#message-reaction-remove-emoji) Gateway event. The `emoji` must be [URL Encoded](https://en.wikipedia.org/wiki/Percent-encoding) or the request will fail with `10014: Unknown Emoji`. To use custom emoji, you must encode it in the format `name:id` with the emoji name and emoji id. ## Edit Message -/channels/[\{channel.id\}](/docs/resources/channel#channel-object)/messages/[\{message.id\}](/docs/resources/message#message-object) +/channels/[\{channel.id\}](/developers/docs/resources/channel#channel-object)/messages/[\{message.id\}](/developers/docs/resources/message#message-object) Edit a previously sent message. The fields `content`, `embeds`, `flags` and `components` can be edited by the original message author. Other users can only edit `flags` and only if they have the `MANAGE_MESSAGES` permission in the corresponding channel. When specifying flags, ensure to include all previously set flags/bits in addition to ones that you are modifying. Only `flags` documented in the table below may be modified by users (unsupported flag changes are currently ignored without error). When the `content` field is edited, the arrays `mentions` and `mention_roles` and the boolean `mention_everyone` in the message object will be reconstructed from scratch based on the new content. When the message flag `IS_COMPONENTS_V2` is set, the reconstructed arrays and boolean are based on the edited content in the `components` array. The `allowed_mentions` field of the edit request controls how this happens. If there is no explicit `allowed_mentions` in the edit request, the content will be parsed with _default_ allowances, that is, without regard to whether or not an `allowed_mentions` was present in the request that originally created the message. -Returns a [message](/docs/resources/message#message-object) object. Fires a [Message Update](/docs/events/gateway-events#message-update) Gateway event. +Returns a [message](/developers/docs/resources/message#message-object) object. Fires a [Message Update](/developers/docs/events/gateway-events#message-update) Gateway event. -Refer to [Uploading Files](/docs/reference#uploading-files) for details on attachments and `multipart/form-data` requests. +Refer to [Uploading Files](/developers/docs/reference#uploading-files) for details on attachments and `multipart/form-data` requests. Any provided files will be **appended** to the message. To remove or replace files you will have to supply the `attachments` field which specifies the files to retain on the message after edit. -:::warn + Starting with API v10, the `attachments` array must contain all attachments that should be present after edit, including **retained and new** attachments provided in the request body. -::: + -:::info + All parameters to this endpoint are optional and nullable. -::: + + ###### JSON/Form Params -| Field | Type | Description | -|------------------|---------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------| -| content | string | Message contents (up to 2000 characters) | -| embeds | array of [embed](/docs/resources/message#embed-object) objects | Up to 10 `rich` embeds (up to 6000 characters) | -| flags\* | integer | Edit the [flags](/docs/resources/message#message-object-message-flags) of a message (`SUPPRESS_EMBEDS` and `IS_COMPONENTS_V2` only) | -| allowed_mentions | [allowed mention object](/docs/resources/message#allowed-mentions-object) | Allowed mentions for the message | -| components | array of [message component](/docs/components/reference#component-object) | Components to include with the message | -| files[n] | file contents | Contents of the file being sent/edited. See [Uploading Files](/docs/reference#uploading-files) | -| payload_json | string | JSON-encoded body of non-file params (multipart/form-data only). See [Uploading Files](/docs/reference#uploading-files) | -| attachments | array of [attachment](/docs/resources/message#attachment-object) objects | Attached files to keep and possible descriptions for new files. See [Uploading Files](/docs/reference#uploading-files) | +| Field | Type | Description | +|------------------|--------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------| +| content | string | Message contents (up to 2000 characters) | +| embeds | array of [embed](/developers/docs/resources/message#embed-object) objects | Up to 10 `rich` embeds (up to 6000 characters) | +| flags\* | integer | Edit the [flags](/developers/docs/resources/message#message-object-message-flags) of a message (`SUPPRESS_EMBEDS` and `IS_COMPONENTS_V2` only) | +| allowed_mentions | [allowed mention object](/developers/docs/resources/message#allowed-mentions-object) | Allowed mentions for the message | +| components | array of [message component](/developers/docs/components/reference#component-object) | Components to include with the message | +| files[n] | file contents | Contents of the file being sent/edited. See [Uploading Files](/developers/docs/reference#uploading-files) | +| payload_json | string | JSON-encoded body of non-file params (multipart/form-data only). See [Uploading Files](/developers/docs/reference#uploading-files) | +| attachments | array of [attachment](/developers/docs/resources/message#attachment-object) objects | Attached files to keep and possible descriptions for new files. See [Uploading Files](/developers/docs/reference#uploading-files) | \* The `SUPPRESS_EMBEDS` flag can be both set and unset, while the `IS_COMPONENTS_V2` flag can only be set. When the `IS_COMPONENTS_V2` flag is set, any of the used `content`, `embeds`, `sticker_ids`, or `poll` fields must have their values reset to empty. For `content` and `poll` this is `null`. For `embeds` and `sticker_ids` this is `[]`. Failing to do this will result in a 400 BAD REQUEST response. ## Delete Message -/channels/[\{channel.id\}](/docs/resources/channel#channel-object)/messages/[\{message.id\}](/docs/resources/message#message-object) +/channels/[\{channel.id\}](/developers/docs/resources/channel#channel-object)/messages/[\{message.id\}](/developers/docs/resources/message#message-object) -Delete a message. If operating on a guild channel and trying to delete a message that was not sent by the current user, this endpoint requires the `MANAGE_MESSAGES` permission. Returns a 204 empty response on success. Fires a [Message Delete](/docs/events/gateway-events#message-delete) Gateway event. +Delete a message. If operating on a guild channel and trying to delete a message that was not sent by the current user, this endpoint requires the `MANAGE_MESSAGES` permission. Returns a 204 empty response on success. Fires a [Message Delete](/developers/docs/events/gateway-events#message-delete) Gateway event. -:::info + This endpoint supports the `X-Audit-Log-Reason` header. -::: + ## Bulk Delete Messages -/channels/[\{channel.id\}](/docs/resources/channel#channel-object)/messages/bulk-delete +/channels/[\{channel.id\}](/developers/docs/resources/channel#channel-object)/messages/bulk-delete -Delete multiple messages in a single request. This endpoint can only be used on guild channels and requires the `MANAGE_MESSAGES` permission. Returns a 204 empty response on success. Fires a [Message Delete Bulk](/docs/events/gateway-events#message-delete-bulk) Gateway event. +Delete multiple messages in a single request. This endpoint can only be used on guild channels and requires the `MANAGE_MESSAGES` permission. Returns a 204 empty response on success. Fires a [Message Delete Bulk](/developers/docs/events/gateway-events#message-delete-bulk) Gateway event. Any message IDs given that do not exist or are invalid will count towards the minimum and maximum message count (currently 2 and 100 respectively). -:::warn + This endpoint will not delete messages older than 2 weeks, and will fail with a 400 BAD REQUEST if any message provided is older than that or if any duplicate message IDs are provided. -::: + -:::info + This endpoint supports the `X-Audit-Log-Reason` header. -::: + + ###### JSON Params | Field | Type | Description | @@ -979,10 +1029,11 @@ This endpoint supports the `X-Audit-Log-Reason` header. | messages | array of snowflakes | an array of message ids to delete (2-100) | ## Get Channel Pins -/channels/[\{channel.id\}](/docs/resources/channel#channel-object)/messages/pins +/channels/[\{channel.id\}](/developers/docs/resources/channel#channel-object)/messages/pins Retrieves the list of pins in a channel. Requires the `VIEW_CHANNEL` permission. If the user is missing the `READ_MESSAGE_HISTORY` permission in the channel, then no pins will be returned. + ###### Query String Params | Field | Type | Description | Default | @@ -990,13 +1041,15 @@ Retrieves the list of pins in a channel. Requires the `VIEW_CHANNEL` permission. | before? | ISO8601 timestamp | Get messages pinned before this timestamp | absent | | limit? | integer | Max number of pins to return (1-50) | 50 | + ###### Response Structure -| Field | Type | -|----------|----------------------------------------------------------------------------| -| items | array of [message pin](/docs/resources/message#message-pin-object) objects | -| has_more | boolean | +| Field | Type | +|----------|---------------------------------------------------------------------------------------| +| items | array of [message pin](/developers/docs/resources/message#message-pin-object) objects | +| has_more | boolean | + ###### Example If you want to get 100 pins you'd send these two requests: @@ -1004,35 +1057,35 @@ If you want to get 100 pins you'd send these two requests: `GET /channels/:id/messages/pins?limit=50&before={pins[pins.len() - 1].pinned_at}` ## Pin Message -/channels/[\{channel.id\}](/docs/resources/channel#channel-object)/messages/pins/[\{message.id\}](/docs/resources/message#message-object) +/channels/[\{channel.id\}](/developers/docs/resources/channel#channel-object)/messages/pins/[\{message.id\}](/developers/docs/resources/message#message-object) -Pin a message in a channel. Requires the `PIN_MESSAGES` permission. Fires a [Channel Pins Update](/docs/events/gateway-events#channel-pins-update) Gateway event. +Pin a message in a channel. Requires the `PIN_MESSAGES` permission. Fires a [Channel Pins Update](/developers/docs/events/gateway-events#channel-pins-update) Gateway event. -:::info + This endpoint supports the `X-Audit-Log-Reason` header. -::: + ## Unpin Message -/channels/[\{channel.id\}](/docs/resources/channel#channel-object)/messages/pins/[\{message.id\}](/docs/resources/message#message-object) +/channels/[\{channel.id\}](/developers/docs/resources/channel#channel-object)/messages/pins/[\{message.id\}](/developers/docs/resources/message#message-object) -Unpin a message in a channel. Requires the `PIN_MESSAGES` permission. Returns a 204 empty response on success. Fires a [Channel Pins Update](/docs/events/gateway-events#channel-pins-update) Gateway event. +Unpin a message in a channel. Requires the `PIN_MESSAGES` permission. Returns a 204 empty response on success. Fires a [Channel Pins Update](/developers/docs/events/gateway-events#channel-pins-update) Gateway event. -:::info + This endpoint supports the `X-Audit-Log-Reason` header. -::: + ## Get Pinned Messages (deprecated) -/channels/[\{channel.id\}](/docs/resources/channel#channel-object)/pins +/channels/[\{channel.id\}](/developers/docs/resources/channel#channel-object)/pins -Gets the first 50 pinned messages in a channel, returning an array of [message](/docs/resources/message#message-object) objects on success. -This endpoint is deprecated. Use [Get Channel Pins](/docs/resources/message#get-channel-pins) instead. +Gets the first 50 pinned messages in a channel, returning an array of [message](/developers/docs/resources/message#message-object) objects on success. +This endpoint is deprecated. Use [Get Channel Pins](/developers/docs/resources/message#get-channel-pins) instead. ## Pin Message (deprecated) -/channels/[\{channel.id\}](/docs/resources/channel#channel-object)/pins/[\{message.id\}](/docs/resources/message#message-object) +/channels/[\{channel.id\}](/developers/docs/resources/channel#channel-object)/pins/[\{message.id\}](/developers/docs/resources/message#message-object) -This endpoint is deprecated. Use [Pin Message](/docs/resources/message#pin-message) instead. +This endpoint is deprecated. Use [Pin Message](/developers/docs/resources/message#pin-message) instead. ## Unpin Message (deprecated) -/channels/[\{channel.id\}](/docs/resources/channel#channel-object)/pins/[\{message.id\}](/docs/resources/message#message-object) +/channels/[\{channel.id\}](/developers/docs/resources/channel#channel-object)/pins/[\{message.id\}](/developers/docs/resources/message#message-object) -This endpoint is deprecated. Use [Unpin Message](/docs/resources/message#unpin-message) instead. +This endpoint is deprecated. Use [Unpin Message](/developers/docs/resources/message#unpin-message) instead. diff --git a/discord/developers/docs/resources/poll.mdx b/discord/developers/docs/resources/poll.mdx new file mode 100644 index 0000000000..8c955562fe --- /dev/null +++ b/discord/developers/docs/resources/poll.mdx @@ -0,0 +1,158 @@ +--- +title: Poll Resource +sidebarTitle: Poll +description: Reference for Discord poll objects and management endpoints. +--- + +import {ManualAnchor} from '/snippets/manualanchor.jsx' +import {Route} from '/snippets/route.jsx' + +A poll is... well... a poll! It holds information about a poll! + +![Example message containing a poll](/images/example-poll.png) + +### Poll Object + +The poll object has a lot of levels and nested structures. It was also designed +to support future extensibility, so some fields may appear to be more complex than +necessary. + + +###### Poll Object Structure + +| Field | Type | Description | +|-------------------|----------------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------| +| question | [Poll Media Object](/developers/docs/resources/poll#poll-media-object-poll-media-object-structure) | The question of the poll. Only `text` is supported. | +| answers | List of [Poll Answer Objects](/developers/docs/resources/poll#poll-answer-object-poll-answer-object-structure) | Each of the answers available in the poll. | +| expiry | ?IS08601 timestamp | The time when the poll ends. | +| allow_multiselect | boolean | Whether a user can select multiple answers | +| layout_type | integer | The [layout type](/developers/docs/resources/poll#layout-type) of the poll | +| results? | [Poll Results Object](/developers/docs/resources/poll#poll-results-object-poll-results-object-structure) | The results of the poll | + +`expiry` is marked as nullable to support non-expiring polls in the future, but all polls have an expiry currently. + +### Poll Create Request Object + +This is the request object used when creating a poll across the different endpoints. +It is similar but not exactly identical to the main [poll object](/developers/docs/resources/poll#poll-object-poll-object-structure). +The main difference is that the request has `duration` which eventually becomes `expiry`. + + +###### Poll Create Request Object Structure + +| Field | Type | Description | +|--------------------|----------------------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------| +| question | [Poll Media Object](/developers/docs/resources/poll#poll-media-object-poll-media-object-structure) | The question of the poll. Only `text` is supported. | +| answers | List of [Poll Answer Objects](/developers/docs/resources/poll#poll-answer-object-poll-answer-object-structure) | Each of the answers available in the poll, up to 10 | +| duration? | integer | Number of hours the poll should be open for, up to 32 days. Defaults to 24 | +| allow_multiselect? | boolean | Whether a user can select multiple answers. Defaults to false | +| layout_type? | integer | The [layout type](/developers/docs/resources/poll#layout-type) of the poll. Defaults to... DEFAULT! | + +### Layout Type + +We might have different layouts for polls in the future. +For now though, this number will be 1. + +| Type | ID | Description | +|---------|----|--------------------------------| +| DEFAULT | 1 | The, uhm, default layout type. | + +### Poll Media Object + +The poll media object is a common object that backs both the question and answers. +The intention is that it allows us to extensibly add new ways to display things in the future. +For now, `question` only supports `text`, while answers can have an optional `emoji`. + + +###### Poll Media Object Structure + +| Field | Type | Description | +|--------|----------------------------------------------------------------|------------------------| +| emoji? | partial [emoji](/developers/docs/resources/emoji#emoji-object) | The emoji of the field | + +`text` should always be non-null for both questions and answers, but please do not depend on that in the future. +The maximum length of `text` is 300 for the question, and 55 for any answer. + +When creating a poll answer with an emoji, one only needs to send either the `id` (custom emoji) or `name` (default emoji) as the only field. + +### Poll Answer Object + +The `answer_id` is a number that labels each answer. +As an implementation detail, it currently starts at 1 for the first answer and goes up sequentially. +We recommend against depending on this sequence. + +Currently, there is a maximum of 10 answers per poll. + + +###### Poll Answer Object Structure + +| Field | Type | Description | +|-------------|----------------------------------------------------------------------------------------------------|------------------------| +| answer_id\* | integer | The ID of the answer | +| poll_media | [Poll Media Object](/developers/docs/resources/poll#poll-media-object-poll-media-object-structure) | The data of the answer | + +\* Only sent as part of responses from Discord's API/Gateway. + +### Poll Results Object + +In a nutshell, this contains the number of votes for each answer. + +The `results` field may be not present in certain responses where, as an implementation detail, we do not fetch the poll results in our backend. +This should be treated as "unknown results", as opposed to "no results". You can keep using the results if you have previously received them through other means. + +Also due to the intricacies of counting at scale, while a poll is in progress the results may not be perfectly accurate. +They usually are accurate, and shouldn't deviate significantly -- it's just difficult to make guarantees. + +To compensate for this, after a poll is finished there is a background job which performs a final, accurate tally of votes. +This tally concludes once `is_finalized` is `true`. Polls that have ended will also always contain results. + +If `answer_counts` does not contain an entry for a particular answer, then there are no votes for that answer. + + +###### Poll Results Object Structure + +| Field | Type | Description | +|---------------|----------------------------------------------------------------------------------------------------------------------------|-----------------------------------------------| +| is_finalized | boolean | Whether the votes have been precisely counted | +| answer_counts | List of [Poll Answer Count Object](/developers/docs/resources/poll#poll-results-object-poll-answer-count-object-structure) | The counts for each answer | + +###### Poll Answer Count Object Structure + +| Field | Type | Description | +|----------|---------|------------------------------------------------| +| id | integer | The `answer_id` | +| count | integer | The number of votes for this answer | +| me_voted | boolean | Whether the current user voted for this answer | + +# Poll Endpoints + +For creating a poll, see [Create Message](/developers/docs/resources/message#create-message). After creation, the poll message cannot be edited. + +Apps are not allowed to vote on polls. No rights! :) + +## Get Answer Voters +/channels/[\{channel.id\}](/developers/docs/resources/channel#channel-object)/polls/[\{message.id\}](/developers/docs/resources/message#message-object)/answers/[\{answer_id\}](/developers/docs/resources/poll#poll-answer-object) + +Get a list of users that voted for this specific answer. + + +###### Query String Params + +| Field | Type | Description | Default | +|--------|-----------|---------------------------------------|---------| +| after? | snowflake | Get users after this user ID | absent | +| limit? | integer | Max number of users to return (1-100) | 25 | + + +###### Response Body + +| Field | Type | Description | +|-------|--------------------------------------------------------------|---------------------------------| +| users | array of [user](/developers/docs/resources/user#user-object) | Users who voted for this answer | + +## End Poll +/channels/[\{channel.id\}](/developers/docs/resources/channel#channel-object)/polls/[\{message.id\}](/developers/docs/resources/message#message-object)/expire + +Immediately ends the poll. You cannot end polls from other users. + +Returns a [message](/developers/docs/resources/message#message-object) object. Fires a [Message Update](/developers/docs/events/gateway-events#message-update) Gateway event. diff --git a/docs/resources/sku.mdx b/discord/developers/docs/resources/sku.mdx similarity index 80% rename from docs/resources/sku.mdx rename to discord/developers/docs/resources/sku.mdx index d7f7ad96e1..268af8cab6 100644 --- a/docs/resources/sku.mdx +++ b/discord/developers/docs/resources/sku.mdx @@ -1,24 +1,29 @@ --- -sidebar_label: SKU +title: SKU Resource +sidebarTitle: SKU +description: Reference for Discord SKU objects that represent premium app offerings. --- -# SKU Resource +import {ManualAnchor} from '/snippets/manualanchor.jsx' +import {Route} from '/snippets/route.jsx' SKUs (stock-keeping units) in Discord represent premium offerings that can be made available to your application's users or guilds. ### SKU Object + ###### SKU Structure -| Field | Type | Description | -|----------------|-----------|-------------------------------------------------------------------------------------------------------------------------| -| id | snowflake | ID of SKU | -| type | integer | [Type of SKU](/docs/resources/sku#sku-object-sku-types) | -| application_id | snowflake | ID of the parent application | -| name | string | Customer-facing name of your premium offering | -| slug | string | System-generated URL slug based on the SKU's name | -| flags | integer | [SKU flags](/docs/resources/sku#sku-object-sku-flags) combined as a [bitfield](https://en.wikipedia.org/wiki/Bit_field) | +| Field | Type | Description | +|----------------|-----------|------------------------------------------------------------------------------------------------------------------------------------| +| id | snowflake | ID of SKU | +| type | integer | [Type of SKU](/developers/docs/resources/sku#sku-object-sku-types) | +| application_id | snowflake | ID of the parent application | +| name | string | Customer-facing name of your premium offering | +| slug | string | System-generated URL slug based on the SKU's name | +| flags | integer | [SKU flags](/developers/docs/resources/sku#sku-object-sku-flags) combined as a [bitfield](https://en.wikipedia.org/wiki/Bit_field) | + ###### SKU Example ```json @@ -39,6 +44,7 @@ SKUs (stock-keeping units) in Discord represent premium offerings that can be ma } ``` + ###### SKU Types For subscriptions, SKUs will have a type of either `SUBSCRIPTION` represented by `type: 5` or `SUBSCRIPTION_GROUP` represented by `type:6`. For any current implementations, you will want to use the SKU defined by `type: 5`. A `SUBSCRIPTION_GROUP` is automatically created for each `SUBSCRIPTION` SKU and are not used at this time. @@ -50,6 +56,7 @@ For subscriptions, SKUs will have a type of either `SUBSCRIPTION` represented by | SUBSCRIPTION | 5 | Represents a recurring subscription | | SUBSCRIPTION_GROUP | 6 | System-generated group for each SUBSCRIPTION SKU created | + ###### SKU Flags For subscriptions, there are two types of access levels you can offer to users: @@ -66,13 +73,13 @@ The `flags` field can be used to differentiate user and server subscriptions wit | USER_SUBSCRIPTION | `1 << 8` | Recurring SKU purchased by a user for themselves. Grants access to the purchasing user in every server. | ## List SKUs -/applications/[\{application.id\}](/docs/resources/application#application-object)/skus +/applications/[\{application.id\}](/developers/docs/resources/application#application-object)/skus Returns all SKUs for a given application. -:::info + Because of how our SKU and subscription systems work, you will see two SKUs for your subscription offering. For integration and testing entitlements for Subscriptions, you should use the SKU with `type: 5`. -::: + ```json [ diff --git a/discord/developers/docs/resources/soundboard.mdx b/discord/developers/docs/resources/soundboard.mdx new file mode 100644 index 0000000000..7a8169a2bf --- /dev/null +++ b/discord/developers/docs/resources/soundboard.mdx @@ -0,0 +1,160 @@ +--- +title: Soundboard Resource +sidebarTitle: Soundboard +description: Reference for Discord soundboard objects and management endpoints. +--- + +import {ManualAnchor} from '/snippets/manualanchor.jsx' +import {Route} from '/snippets/route.jsx' + +Users can play soundboard sounds in voice channels, triggering a [Voice Channel Effect Send](/developers/docs/events/gateway-events#voice-channel-effect-send) Gateway event for users connected to the voice channel. + +There is a set of [default sounds](/developers/docs/resources/soundboard#list-default-soundboard-sounds) available to all users. Soundboard sounds can also be [created in a guild](/developers/docs/resources/soundboard#create-guild-soundboard-sound); users will be able to use the sounds in the guild, and Nitro subscribers can use them in all guilds. + +Soundboard sounds in a set of guilds can be retrieved over the Gateway using [Request Soundboard Sounds](/developers/docs/events/gateway-events#request-soundboard-sounds). + +### Soundboard Sound Object + + +###### Soundboard Sound Structure + +| Field | Type | Description | +|------------|------------------------------------------------------------|---------------------------------------------------------------------------| +| name | string | the name of this sound | +| sound_id | snowflake | the id of this sound | +| volume | double | the volume of this sound, from 0 to 1 | +| emoji_id | ?snowflake | the id of this sound's custom emoji | +| emoji_name | ?string | the unicode character of this sound's standard emoji | +| guild_id? | snowflake | the id of the guild this sound is in | +| available | boolean | whether this sound can be used, may be false due to loss of Server Boosts | +| user? | [user](/developers/docs/resources/user#user-object) object | the user who created this sound | + + +###### Example Default Soundboard Sound + +```json +{ + "name": "quack", + "sound_id": "1", + "volume": 1.0, + "emoji_id": null, + "emoji_name": "🦆", + "available": true +} +``` + + +###### Example Guild Soundboard Sound + +```json +{ + "name": "Yay", + "sound_id": "1106714396018884649", + "volume": 1, + "emoji_id": "989193655938064464", + "emoji_name": null, + "guild_id": "613425648685547541", + "available": true +} +``` + +### Sound Files + +A soundboard sound can be retrieved in MP3 or Ogg format at the URL: + +``` +https://cdn.discordapp.com/soundboard-sounds/{sound_id} +``` + +## Send Soundboard Sound +/channels/[\{channel.id\}](/developers/docs/resources/channel#channel-object)/send-soundboard-sound + +Send a soundboard sound to a voice channel the user is connected to. Fires a [Voice Channel Effect Send](/developers/docs/events/gateway-events#voice-channel-effect-send) Gateway event. + +Requires the `SPEAK` and `USE_SOUNDBOARD` permissions, and also the `USE_EXTERNAL_SOUNDS` permission if the sound is from a different server. Additionally, requires the user to be connected to the voice channel, having a [voice state](/developers/docs/resources/voice#voice-state-object) without `deaf`, `self_deaf`, `mute`, or `suppress` enabled. + + +###### JSON Params + +| Field | Type | Description | +|------------------|-----------|--------------------------------------------------------------------------------------------------| +| sound_id | snowflake | the id of the soundboard sound to play | +| source_guild_id? | snowflake | the id of the guild the soundboard sound is from, required to play sounds from different servers | + +## List Default Soundboard Sounds +/soundboard-default-sounds + +Returns an array of [soundboard sound](/developers/docs/resources/soundboard#soundboard-sound-object) objects that can be used by all users. + +## List Guild Soundboard Sounds +/guilds/[\{guild.id\}](/developers/docs/resources/guild#guild-object)/soundboard-sounds + +Returns a list of the guild's soundboard sounds. Includes `user` fields if the bot has the `CREATE_GUILD_EXPRESSIONS` or `MANAGE_GUILD_EXPRESSIONS` permission. + + +###### Response Structure + +| Field | Type | +|-------|----------------------------------------------------------------------------------------------------| +| items | array of [soundboard sound](/developers/docs/resources/soundboard#soundboard-sound-object) objects | + +## Get Guild Soundboard Sound +/guilds/[\{guild.id\}](/developers/docs/resources/guild#guild-object)/soundboard-sounds/[\{sound.id\}](/developers/docs/resources/soundboard#soundboard-sound-object) + +Returns a [soundboard sound](/developers/docs/resources/soundboard#soundboard-sound-object) object for the given sound id. Includes the `user` field if the bot has the `CREATE_GUILD_EXPRESSIONS` or `MANAGE_GUILD_EXPRESSIONS` permission. + +## Create Guild Soundboard Sound +/guilds/[\{guild.id\}](/developers/docs/resources/guild#guild-object)/soundboard-sounds + +Create a new soundboard sound for the guild. Requires the `CREATE_GUILD_EXPRESSIONS` permission. Returns the new [soundboard sound](/developers/docs/resources/soundboard#soundboard-sound-object) object on success. Fires a [Guild Soundboard Sound Create](/developers/docs/events/gateway-events#guild-soundboard-sound-create) Gateway event. + + +Soundboard sounds have a max file size of 512kb and a max duration of 5.2 seconds. + + + +This endpoint supports the `X-Audit-Log-Reason` header. + + +###### JSON +###### JSON Params + +| Field | Type | Description | +|-------------|------------|-----------------------------------------------------------------------------------------------------------| +| name | string | name of the soundboard sound (2-32 characters) | +| sound | data uri | the mp3 or ogg sound data, base64 encoded, similar to [image data](/developers/docs/reference#image-data) | +| volume? | ?double | the volume of the soundboard sound, from 0 to 1, defaults to 1 | +| emoji_id? | ?snowflake | the id of the custom emoji for the soundboard sound | +| emoji_name? | ?string | the unicode character of a standard emoji for the soundboard sound | + +## Modify Guild Soundboard Sound +/guilds/[\{guild.id\}](/developers/docs/resources/guild#guild-object)/soundboard-sounds/[\{sound.id\}](/developers/docs/resources/soundboard#soundboard-sound-object) + +Modify the given soundboard sound. For sounds created by the current user, requires either the `CREATE_GUILD_EXPRESSIONS` or `MANAGE_GUILD_EXPRESSIONS` permission. For other sounds, requires the `MANAGE_GUILD_EXPRESSIONS` permission. Returns the updated [soundboard sound](/developers/docs/resources/soundboard#soundboard-sound-object) object on success. Fires a [Guild Soundboard Sound Update](/developers/docs/events/gateway-events#guild-soundboard-sound-update) Gateway event. + + +All parameters to this endpoint are optional. + + + +This endpoint supports the `X-Audit-Log-Reason` header. + + + +###### JSON Params + +| Field | Type | Description | +|------------|------------|--------------------------------------------------------------------| +| name | string | name of the soundboard sound (2-32 characters) | +| volume | ?double | the volume of the soundboard sound, from 0 to 1 | +| emoji_id | ?snowflake | the id of the custom emoji for the soundboard sound | +| emoji_name | ?string | the unicode character of a standard emoji for the soundboard sound | + +## Delete Guild Soundboard Sound +/guilds/[\{guild.id\}](/developers/docs/resources/guild#guild-object)/soundboard-sounds/[\{sound.id\}](/developers/docs/resources/soundboard#soundboard-sound-object) + +Delete the given soundboard sound. For sounds created by the current user, requires either the `CREATE_GUILD_EXPRESSIONS` or `MANAGE_GUILD_EXPRESSIONS` permission. For other sounds, requires the `MANAGE_GUILD_EXPRESSIONS` permission. Returns `204 No Content` on success. Fires a [Guild Soundboard Sound Delete](/developers/docs/events/gateway-events#guild-soundboard-sound-delete) Gateway event. + + +This endpoint supports the `X-Audit-Log-Reason` header. + diff --git a/docs/resources/stage-instance.mdx b/discord/developers/docs/resources/stage-instance.mdx similarity index 61% rename from docs/resources/stage-instance.mdx rename to discord/developers/docs/resources/stage-instance.mdx index 81772c2d0d..13df4b418c 100644 --- a/docs/resources/stage-instance.mdx +++ b/discord/developers/docs/resources/stage-instance.mdx @@ -1,25 +1,30 @@ --- -sidebar_label: Stage Instance +title: Stage Instance Resource +sidebarTitle: Stage Instance +description: Reference for Discord stage instance objects for managing live audio events. --- -# Stage Instance Resource +import {ManualAnchor} from '/snippets/manualanchor.jsx' +import {Route} from '/snippets/route.jsx' -A _Stage Instance_ holds information about a live stage. +A Stage Instance holds information about a live stage. ### Stage Instance Object + ###### Stage Instance Structure -| Field | Type | Description | -|--------------------------|------------|---------------------------------------------------------------------------------------------------------------| -| id | snowflake | The id of this Stage instance | -| guild_id | snowflake | The guild id of the associated Stage channel | -| channel_id | snowflake | The id of the associated Stage channel | -| topic | string | The topic of the Stage instance (1-120 characters) | -| privacy_level | integer | The [privacy level](/docs/resources/stage-instance#stage-instance-object-privacy-level) of the Stage instance | -| discoverable_disabled | boolean | Whether or not Stage Discovery is disabled (deprecated) | -| guild_scheduled_event_id | ?snowflake | The id of the scheduled event for this Stage instance | - +| Field | Type | Description | +|--------------------------|------------|--------------------------------------------------------------------------------------------------------------------------| +| id | snowflake | The id of this Stage instance | +| guild_id | snowflake | The guild id of the associated Stage channel | +| channel_id | snowflake | The id of the associated Stage channel | +| topic | string | The topic of the Stage instance (1-120 characters) | +| privacy_level | integer | The [privacy level](/developers/docs/resources/stage-instance#stage-instance-object-privacy-level) of the Stage instance | +| discoverable_disabled | boolean | Whether or not Stage Discovery is disabled (deprecated) | +| guild_scheduled_event_id | ?snowflake | The id of the scheduled event for this Stage instance | + + ###### Privacy Level | Level | Value | Description | @@ -27,6 +32,7 @@ A _Stage Instance_ holds information about a live stage. | PUBLIC | 1 | The Stage instance is visible publicly. (deprecated) | | GUILD_ONLY | 2 | The Stage instance is visible to only guild members. | + ###### Example Stage Instance ```json @@ -46,15 +52,16 @@ A _Stage Instance_ holds information about a live stage. Below are some definitions related to stages. - **Liveness:** A Stage channel is considered _live_ when there is an associated stage instance. Conversely, a Stage channel is _not live_ when there is no associated stage instance. -- **Speakers:** A participant of a Stage channel is a _speaker_ when their [voice state](/docs/resources/voice#voice-state-object) +- **Speakers:** A participant of a Stage channel is a _speaker_ when their [voice state](/developers/docs/resources/voice#voice-state-object) is not `suppress`ed, and has no `request_to_speak_timestamp`. -- **Moderators**: A member of the guild is a _moderator_ of a Stage channel if they have all of the following [permissions](/docs/topics/permissions#permissions): +- **Moderators**: A member of the guild is a _moderator_ of a Stage channel if they have all of the following [permissions](/developers/docs/topics/permissions): - `MANAGE_CHANNELS` - `MUTE_MEMBERS` - `MOVE_MEMBERS` - **Topic**: This is the blurb that gets shown below the channel's name, among other places. - **Public**: A Stage instance is public when it has a `privacy_level` of `PUBLIC`. While a guild has a public Stage instance: - - Users in the Stage can have the Stage show in their [activities](/docs/events/gateway-events#presence). + - Users in the Stage can have the Stage show in their [activities](/developers/docs/events/gateway-events#presence). + - [Invites](/developers/docs/resources/invite#invite-object) to the Stage channel will have the `stage_instance` field. ## Auto Closing @@ -63,56 +70,57 @@ When a Stage channel has no speakers for a certain period of time (on the order ## Create Stage Instance /stage-instances -Creates a new Stage instance associated to a Stage channel. Returns that [Stage instance](/docs/resources/stage-instance#stage-instance-object-stage-instance-structure). Fires a [Stage Instance Create](/docs/events/gateway-events#stage-instance-create) Gateway event. +Creates a new Stage instance associated to a Stage channel. Returns that [Stage instance](/developers/docs/resources/stage-instance#stage-instance-object-stage-instance-structure). Fires a [Stage Instance Create](/developers/docs/events/gateway-events#stage-instance-create) Gateway event. Requires the user to be a moderator of the Stage channel. -:::info + This endpoint supports the `X-Audit-Log-Reason` header. -::: + + ###### JSON Params -| Field | Type | Description | -|-----------------------------|-----------|------------------------------------------------------------------------------------------------------------------------------------| -| channel_id | snowflake | The id of the Stage channel | -| topic | string | The topic of the Stage instance (1-120 characters) | -| privacy_level? | integer | The [privacy level](/docs/resources/stage-instance#stage-instance-object-privacy-level) of the Stage instance (default GUILD_ONLY) | -| send_start_notification? \* | boolean | Notify @everyone that a Stage instance has started | -| guild_scheduled_event_id? | snowflake | The guild scheduled event associated with this Stage instance | +| Field | Type | Description | +|-----------------------------|-----------|-----------------------------------------------------------------------------------------------------------------------------------------------| +| channel_id | snowflake | The id of the Stage channel | +| topic | string | The topic of the Stage instance (1-120 characters) | +| privacy_level? | integer | The [privacy level](/developers/docs/resources/stage-instance#stage-instance-object-privacy-level) of the Stage instance (default GUILD_ONLY) | +| send_start_notification? \* | boolean | Notify @everyone that a Stage instance has started | +| guild_scheduled_event_id? | snowflake | The guild scheduled event associated with this Stage instance | \* The stage moderator must have the `MENTION_EVERYONE` permission for this notification to be sent. ## Get Stage Instance -/stage-instances/[\{channel.id\}](/docs/resources/channel#channel-object) +/stage-instances/[\{channel.id\}](/developers/docs/resources/channel#channel-object) Gets the stage instance associated with the Stage channel, if it exists. ## Modify Stage Instance -/stage-instances/[\{channel.id\}](/docs/resources/channel#channel-object) +/stage-instances/[\{channel.id\}](/developers/docs/resources/channel#channel-object) -Updates fields of an existing Stage instance. Returns the updated [Stage instance](/docs/resources/stage-instance#stage-instance-object-stage-instance-structure). Fires a [Stage Instance Update](/docs/events/gateway-events#stage-instance-update) Gateway event. +Updates fields of an existing Stage instance. Returns the updated [Stage instance](/developers/docs/resources/stage-instance#stage-instance-object-stage-instance-structure). Fires a [Stage Instance Update](/developers/docs/events/gateway-events#stage-instance-update) Gateway event. Requires the user to be a moderator of the Stage channel. -:::info + This endpoint supports the `X-Audit-Log-Reason` header. -::: + + ###### JSON Params -| Field | Type | Description | -|----------------|---------|---------------------------------------------------------------------------------------------------------------| -| topic? | string | The topic of the Stage instance (1-120 characters) | -| privacy_level? | integer | The [privacy level](/docs/resources/stage-instance#stage-instance-object-privacy-level) of the Stage instance | +| Field | Type | Description | +|----------------|---------|--------------------------------------------------------------------------------------------------------------------------| +| privacy_level? | integer | The [privacy level](/developers/docs/resources/stage-instance#stage-instance-object-privacy-level) of the Stage instance | ## Delete Stage Instance -/stage-instances/[\{channel.id\}](/docs/resources/channel#channel-object) +/stage-instances/[\{channel.id\}](/developers/docs/resources/channel#channel-object) -Deletes the Stage instance. Returns `204 No Content`. Fires a [Stage Instance Delete](/docs/events/gateway-events#stage-instance-delete) Gateway event. +Deletes the Stage instance. Returns `204 No Content`. Fires a [Stage Instance Delete](/developers/docs/events/gateway-events#stage-instance-delete) Gateway event. Requires the user to be a moderator of the Stage channel. -:::info + This endpoint supports the `X-Audit-Log-Reason` header. -::: + diff --git a/discord/developers/docs/resources/sticker.mdx b/discord/developers/docs/resources/sticker.mdx new file mode 100644 index 0000000000..ccc025fb49 --- /dev/null +++ b/discord/developers/docs/resources/sticker.mdx @@ -0,0 +1,202 @@ +--- +title: Sticker Resource +sidebarTitle: Sticker +description: Reference for Discord sticker objects and management endpoints. +--- + +import {ManualAnchor} from '/snippets/manualanchor.jsx' +import {Route} from '/snippets/route.jsx' + +### Sticker Object + +Represents a sticker that can be sent in messages. + + +###### Sticker Structure + +| Field | Type | Description | +|-------------|------------------------------------------------------------|--------------------------------------------------------------------------------------------------| +| id | snowflake | [id of the sticker](/developers/docs/reference#image-formatting) | +| pack_id? | snowflake | for standard stickers, id of the pack the sticker is from | +| name | string | name of the sticker | +| description | ?string | description of the sticker | +| tags\* | string | autocomplete/suggestion tags for the sticker (max 200 characters) | +| type | integer | [type of sticker](/developers/docs/resources/sticker#sticker-object-sticker-types) | +| format_type | integer | [type of sticker format](/developers/docs/resources/sticker#sticker-object-sticker-format-types) | +| available? | boolean | whether this guild sticker can be used, may be false due to loss of Server Boosts | +| guild_id? | snowflake | id of the guild that owns this sticker | +| user? | [user](/developers/docs/resources/user#user-object) object | the user that uploaded the guild sticker | +| sort_value? | integer | the standard sticker's sort order within its pack | + +\* A comma separated list of keywords is the format used in this field by standard stickers, but this is just a convention. +Incidentally the client will always use a name generated from an emoji as the value of this field when creating or modifying a guild sticker. + + +###### Sticker Types + +| Type | Value | Description | +|----------|-------|-------------------------------------------------------| +| STANDARD | 1 | an official sticker in a pack | +| GUILD | 2 | a sticker uploaded to a guild for the guild's members | + + +###### Sticker Format Types + +| Type | Value | +|--------|-------| +| PNG | 1 | +| APNG | 2 | +| LOTTIE | 3 | +| GIF | 4 | + + +###### Example Sticker + +```json +{ + "id": "749054660769218631", + "name": "Wave", + "tags": "wumpus, hello, sup, hi, oi, heyo, heya, yo, greetings, greet, welcome, wave, :wave, :hello, :hi, :hey, hey, \ud83d\udc4b, \ud83d\udc4b\ud83c\udffb, \ud83d\udc4b\ud83c\udffc, \ud83d\udc4b\ud83c\udffd, \ud83d\udc4b\ud83c\udffe, \ud83d\udc4b\ud83c\udfff, goodbye, bye, see ya, later, laterz, cya", + "type": 1, + "format_type": 3, + "description": "Wumpus waves hello", + "pack_id": "847199849233514549", + "sort_value": 12 +} +``` + +### Sticker Item Object + +The smallest amount of data required to render a sticker. A partial sticker object. + + +###### Sticker Item Structure + +| Field | Type | Description | +|-------------|-----------|--------------------------------------------------------------------------------------------------| +| id | snowflake | id of the sticker | +| name | string | name of the sticker | +| format_type | integer | [type of sticker format](/developers/docs/resources/sticker#sticker-object-sticker-format-types) | + +### Sticker Pack Object + +Represents a pack of standard stickers. + + +###### Sticker Pack Structure +| Field | Type | Description | +|-------------------|-------------------------------------------------------------------------------|--------------------------------------------------------------------------------------| +| id | snowflake | id of the sticker pack | +| stickers | array of [sticker](/developers/docs/resources/sticker#sticker-object) objects | the stickers in the pack | +| name | string | name of the sticker pack | +| sku_id | snowflake | id of the pack's SKU | +| cover_sticker_id? | snowflake | id of a sticker in the pack which is shown as the pack's icon | +| description | string | description of the sticker pack | +| banner_asset_id? | snowflake | id of the sticker pack's [banner image](/developers/docs/reference#image-formatting) | + + +###### Example Sticker Pack + +```json +{ + "id": "847199849233514549", + "stickers": [], + "name": "Wumpus Beyond", + "sku_id": "847199849233514547", + "cover_sticker_id": "749053689419006003", + "description": "Say hello to Wumpus!", + "banner_asset_id": "761773777976819732" +} +``` + +## Get Sticker +/stickers/[\{sticker.id\}](/developers/docs/resources/sticker#sticker-object) + +Returns a [sticker](/developers/docs/resources/sticker#sticker-object) object for the given sticker ID. + +## List Sticker Packs +/sticker-packs + +Returns a list of available sticker packs. + + +###### Response Structure + +| Field | Type | +|---------------|-----------------------------------------------------------------------------------------| +| sticker_packs | array of [sticker pack](/developers/docs/resources/sticker#sticker-pack-object) objects | + +## Get Sticker Pack +/sticker-packs/[\{pack.id\}](/developers/docs/resources/sticker#sticker-pack-object) + +Returns a [sticker pack](/developers/docs/resources/sticker#sticker-pack-object) object for the given sticker pack ID. + +## List Guild Stickers +/guilds/[\{guild.id\}](/developers/docs/resources/guild#guild-object)/stickers + +Returns an array of [sticker](/developers/docs/resources/sticker#sticker-object) objects for the given guild. Includes `user` fields if the bot has the `CREATE_GUILD_EXPRESSIONS` or `MANAGE_GUILD_EXPRESSIONS` permission. + +## Get Guild Sticker +/guilds/[\{guild.id\}](/developers/docs/resources/guild#guild-object)/stickers/[\{sticker.id\}](/developers/docs/resources/sticker#sticker-object) + +Returns a [sticker](/developers/docs/resources/sticker#sticker-object) object for the given guild and sticker IDs. Includes the `user` field if the bot has the `CREATE_GUILD_EXPRESSIONS` or `MANAGE_GUILD_EXPRESSIONS` permission. + +## Create Guild Sticker +/guilds/[\{guild.id\}](/developers/docs/resources/guild#guild-object)/stickers + +Create a new sticker for the guild. Send a `multipart/form-data` body. Requires the `CREATE_GUILD_EXPRESSIONS` permission. Returns the new [sticker](/developers/docs/resources/sticker#sticker-object) object on success. Fires a [Guild Stickers Update](/developers/docs/events/gateway-events#guild-stickers-update) Gateway event. + +Every guilds has five free sticker slots by default, and each Boost level will grant access to more slots. + + +This endpoint supports the `X-Audit-Log-Reason` header. + + + +Lottie stickers can only be uploaded on guilds that have either the `VERIFIED` and/or the `PARTNERED` [guild feature](/developers/docs/resources/guild#guild-object-guild-features). + + + +Uploaded stickers are constrained to 5 seconds in length for animated stickers, and 320 x 320 pixels. + + + +###### Form Params + +| Field | Type | Description | +|-------------|---------------|----------------------------------------------------------------------------------------| +| name | string | name of the sticker (2-30 characters) | +| description | string | description of the sticker (empty or 2-100 characters) | +| tags | string | autocomplete/suggestion tags for the sticker (max 200 characters) | +| file | file contents | the sticker file to upload, must be a PNG, APNG, GIF, or Lottie JSON file, max 512 KiB | + +## Modify Guild Sticker +/guilds/[\{guild.id\}](/developers/docs/resources/guild#guild-object)/stickers/[\{sticker.id\}](/developers/docs/resources/sticker#sticker-object) + +Modify the given sticker. For stickers created by the current user, requires either the `CREATE_GUILD_EXPRESSIONS` or `MANAGE_GUILD_EXPRESSIONS` permission. For other stickers, requires the `MANAGE_GUILD_EXPRESSIONS` permission. Returns the updated [sticker](/developers/docs/resources/sticker#sticker-object) object on success. Fires a [Guild Stickers Update](/developers/docs/events/gateway-events#guild-stickers-update) Gateway event. + + +All parameters to this endpoint are optional. + + + +This endpoint supports the `X-Audit-Log-Reason` header. + + + +###### JSON Params + +| Field | Type | Description | +|-------------|---------|-------------------------------------------------------------------| +| name | string | name of the sticker (2-30 characters) | +| description | ?string | description of the sticker (2-100 characters) | +| tags | string | autocomplete/suggestion tags for the sticker (max 200 characters) | + +## Delete Guild Sticker +/guilds/[\{guild.id\}](/developers/docs/resources/guild#guild-object)/stickers/[\{sticker.id\}](/developers/docs/resources/sticker#sticker-object) + +Delete the given sticker. For stickers created by the current user, requires either the `CREATE_GUILD_EXPRESSIONS` or `MANAGE_GUILD_EXPRESSIONS` permission. For other stickers, requires the `MANAGE_GUILD_EXPRESSIONS` permission. Returns `204 No Content` on success. Fires a [Guild Stickers Update](/developers/docs/events/gateway-events#guild-stickers-update) Gateway event. + + +This endpoint supports the `X-Audit-Log-Reason` header. + diff --git a/docs/resources/subscription.mdx b/discord/developers/docs/resources/subscription.mdx similarity index 83% rename from docs/resources/subscription.mdx rename to discord/developers/docs/resources/subscription.mdx index 68e7161300..51d18312d0 100644 --- a/docs/resources/subscription.mdx +++ b/discord/developers/docs/resources/subscription.mdx @@ -1,8 +1,10 @@ --- -sidebar_label: Subscription +title: Subscription Resource +sidebarTitle: Subscription +description: Reference for Discord subscription objects that represent recurring payments. --- -# Subscription Resource +import {Route} from '/snippets/route.jsx' Subscriptions in Discord represent a user making recurring payments for at least one SKU over an ongoing period. Successful payments grant the user access to entitlements associated with the SKU. @@ -49,9 +51,9 @@ If the user cancels the subscription, the subscription will enter the `ENDING` s | ENDING | 1 | Subscription is active but will not renew. | | INACTIVE | 2 | Subscription is inactive and not being charged. | -:::info -Subscription status should not be used to grant perks. Use [entitlements](/docs/resources/entitlement#entitlement-object) as an indication of whether a user should have access to a specific SKU. See our guide on [Implementing App Subscriptions](/docs/monetization/implementing-app-subscriptions) for more information. -::: + +Subscription status should not be used to grant perks. Use [entitlements](/developers/docs/resources/entitlement#entitlement-object) as an indication of whether a user should have access to a specific SKU. See our guide on [Implementing App Subscriptions](/developers/docs/monetization/implementing-app-subscriptions) for more information. + Subscriptions can start and change between any of these statuses within the current period. A subscription can be `ACTIVE` outside its current period or `INACTIVE` within its current period. @@ -61,9 +63,9 @@ Some examples of this behavior include: - A refund or chargeback during the current period would make the subscription `INACTIVE`. ## List SKU Subscriptions -/skus/[\{sku.id\}](/docs/resources/sku#sku-object)/subscriptions +/skus/[\{sku.id\}](/developers/docs/resources/sku#sku-object)/subscriptions -Returns all subscriptions containing the SKU, filtered by user. Returns a list of [subscription](/docs/resources/subscription#subscription-object) objects. +Returns all subscriptions containing the SKU, filtered by user. Returns a list of [subscription](/developers/docs/resources/subscription#subscription-object) objects. ### Query String Params @@ -75,6 +77,6 @@ Returns all subscriptions containing the SKU, filtered by user. Returns a list o | user_id? | snowflake | User ID for which to return subscriptions. Required except for OAuth queries. | absent | ## Get SKU Subscription -/skus/[\{sku.id\}](/docs/resources/sku#sku-object)/subscriptions/[\{subscription.id\}](/docs/resources/subscription#subscription-object) +/skus/[\{sku.id\}](/developers/docs/resources/sku#sku-object)/subscriptions/[\{subscription.id\}](/developers/docs/resources/subscription#subscription-object) -Get a subscription by its ID. Returns a [subscription](/docs/resources/subscription#subscription-object) object. \ No newline at end of file +Get a subscription by its ID. Returns a [subscription](/developers/docs/resources/subscription#subscription-object) object. \ No newline at end of file diff --git a/docs/resources/user.mdx b/discord/developers/docs/resources/user.mdx similarity index 55% rename from docs/resources/user.mdx rename to discord/developers/docs/resources/user.mdx index 0036189b68..74a4b002dd 100644 --- a/docs/resources/user.mdx +++ b/discord/developers/docs/resources/user.mdx @@ -1,8 +1,11 @@ --- -sidebar_label: User +title: User Resource +sidebarTitle: User +description: Reference for Discord user objects and management endpoints. --- -# Users Resource +import {ManualAnchor} from '/snippets/manualanchor.jsx' +import {Route} from '/snippets/route.jsx' Users in Discord are generally considered the base entity. Users can spawn across the entire platform, be members of guilds, participate in text and voice chat, and much more. Users are separated by a distinction of "bot" vs "normal." Although they are similar, bot users are automated users that are "owned" by another user. Unlike normal users, bot users do @@ -26,30 +29,32 @@ There are other rules and restrictions not shared here for the sake of spam and ### User Object + ###### User Structure -| Field | Type | Description | Required OAuth2 Scope | -|-------------------------|--------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------|-----------------------| -| id | snowflake | the user's id | identify | -| username | string | the user's username, not unique across the platform | identify | -| discriminator | string | the user's Discord-tag | identify | -| global_name | ?string | the user's display name, if it is set. For bots, this is the application name | identify | -| avatar | ?string | the user's [avatar hash](/docs/reference#image-formatting) | identify | -| bot? | boolean | whether the user belongs to an OAuth2 application | identify | -| system? | boolean | whether the user is an Official Discord System user (part of the urgent message system) | identify | -| mfa_enabled? | boolean | whether the user has two factor enabled on their account | identify | -| banner? | ?string | the user's [banner hash](/docs/reference#image-formatting) | identify | -| accent_color? | ?integer | the user's banner color encoded as an integer representation of hexadecimal color code | identify | -| locale? | string | the user's chosen [language option](/docs/reference#locales) | identify | -| verified? | boolean | whether the email on this account has been verified | email | -| email? | ?string | the user's email | email | -| flags? | integer | the [flags](/docs/resources/user#user-object-user-flags) on a user's account | identify | -| premium_type? | integer | the [type of Nitro subscription](/docs/resources/user#user-object-premium-types) on a user's account | identify | -| public_flags? | integer | the public [flags](/docs/resources/user#user-object-user-flags) on a user's account | identify | -| avatar_decoration_data? | ?[avatar decoration data](/docs/resources/user#avatar-decoration-data-object) object | data for the user's avatar decoration | identify | -| collectibles? | ?[collectibles](/docs/resources/user#collectibles) object | data for the user's collectibles | identify | -| primary_guild? | ?[user primary guild](/docs/resources/user#user-object-user-primary-guild) object | the user's primary guild | identify | - +| Field | Type | Description | Required OAuth2 Scope | +|-------------------------|-------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------|-----------------------| +| id | snowflake | the user's id | identify | +| username | string | the user's username, not unique across the platform | identify | +| discriminator | string | the user's Discord-tag | identify | +| global_name | ?string | the user's display name, if it is set. For bots, this is the application name | identify | +| avatar | ?string | the user's [avatar hash](/developers/docs/reference#image-formatting) | identify | +| bot? | boolean | whether the user belongs to an OAuth2 application | identify | +| system? | boolean | whether the user is an Official Discord System user (part of the urgent message system) | identify | +| mfa_enabled? | boolean | whether the user has two factor enabled on their account | identify | +| banner? | ?string | the user's [banner hash](/developers/docs/reference#image-formatting) | identify | +| accent_color? | ?integer | the user's banner color encoded as an integer representation of hexadecimal color code | identify | +| locale? | string | the user's chosen [language option](/developers/docs/reference#locales) | identify | +| verified? | boolean | whether the email on this account has been verified | email | +| email? | ?string | the user's email | email | +| flags? | integer | the [flags](/developers/docs/resources/user#user-object-user-flags) on a user's account | identify | +| premium_type? | integer | the [type of Nitro subscription](/developers/docs/resources/user#user-object-premium-types) on a user's account | identify | +| public_flags? | integer | the public [flags](/developers/docs/resources/user#user-object-user-flags) on a user's account | identify | +| avatar_decoration_data? | ?[avatar decoration data](/developers/docs/resources/user#avatar-decoration-data-object) object | data for the user's avatar decoration | identify | +| collectibles? | ?[collectibles](/developers/docs/resources/user#collectibles) object | data for the user's collectibles | identify | +| primary_guild? | ?[user primary guild](/developers/docs/resources/user#user-object-user-primary-guild) object | the user's primary guild | identify | + + ###### Example User ```json @@ -87,26 +92,28 @@ There are other rules and restrictions not shared here for the sake of spam and } ``` + ###### User Flags -| Value | Name | Description | -|-----------|--------------------------|------------------------------------------------------------------------------------------------------------------------------------------------| -| `1 << 0` | STAFF | Discord Employee | -| `1 << 1` | PARTNER | Partnered Server Owner | -| `1 << 2` | HYPESQUAD | HypeSquad Events Member | -| `1 << 3` | BUG_HUNTER_LEVEL_1 | Bug Hunter Level 1 | -| `1 << 6` | HYPESQUAD_ONLINE_HOUSE_1 | House Bravery Member | -| `1 << 7` | HYPESQUAD_ONLINE_HOUSE_2 | House Brilliance Member | -| `1 << 8` | HYPESQUAD_ONLINE_HOUSE_3 | House Balance Member | -| `1 << 9` | PREMIUM_EARLY_SUPPORTER | Early Nitro Supporter | -| `1 << 10` | TEAM_PSEUDO_USER | User is a [team](/docs/topics/teams) | -| `1 << 14` | BUG_HUNTER_LEVEL_2 | Bug Hunter Level 2 | -| `1 << 16` | VERIFIED_BOT | Verified Bot | -| `1 << 17` | VERIFIED_DEVELOPER | Early Verified Bot Developer | -| `1 << 18` | CERTIFIED_MODERATOR | Moderator Programs Alumni | -| `1 << 19` | BOT_HTTP_INTERACTIONS | Bot uses only [HTTP interactions](/docs/interactions/receiving-and-responding#receiving-an-interaction) and is shown in the online member list | -| `1 << 22` | ACTIVE_DEVELOPER | User is an [Active Developer](https://support-dev.discord.com/hc/articles/10113997751447) | - +| Value | Name | Description | +|-----------|--------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------| +| `1 << 0` | STAFF | Discord Employee | +| `1 << 1` | PARTNER | Partnered Server Owner | +| `1 << 2` | HYPESQUAD | HypeSquad Events Member | +| `1 << 3` | BUG_HUNTER_LEVEL_1 | Bug Hunter Level 1 | +| `1 << 6` | HYPESQUAD_ONLINE_HOUSE_1 | House Bravery Member | +| `1 << 7` | HYPESQUAD_ONLINE_HOUSE_2 | House Brilliance Member | +| `1 << 8` | HYPESQUAD_ONLINE_HOUSE_3 | House Balance Member | +| `1 << 9` | PREMIUM_EARLY_SUPPORTER | Early Nitro Supporter | +| `1 << 10` | TEAM_PSEUDO_USER | User is a [team](/developers/docs/topics/teams) | +| `1 << 14` | BUG_HUNTER_LEVEL_2 | Bug Hunter Level 2 | +| `1 << 16` | VERIFIED_BOT | Verified Bot | +| `1 << 17` | VERIFIED_DEVELOPER | Early Verified Bot Developer | +| `1 << 18` | CERTIFIED_MODERATOR | Moderator Programs Alumni | +| `1 << 19` | BOT_HTTP_INTERACTIONS | Bot uses only [HTTP interactions](/developers/docs/interactions/receiving-and-responding#receiving-an-interaction) and is shown in the online member list | +| `1 << 22` | ACTIVE_DEVELOPER | User is an [Active Developer](https://support-dev.discord.com/hc/articles/10113997751447) | + + ###### Premium Types Premium types denote the level of premium a user has. Visit the [Nitro](https://discord.com/nitro) page to learn more about the premium plans we currently offer. @@ -118,6 +125,7 @@ Premium types denote the level of premium a user has. Visit the [Nitro](https:// | 2 | Nitro | | 3 | Nitro Basic | + ###### User Primary Guild | Field | Type | Description | @@ -125,40 +133,42 @@ Premium types denote the level of premium a user has. Visit the [Nitro](https:// | identity_guild_id | ?snowflake | the id of the user's primary guild | | identity_enabled | ?boolean | whether the user is displaying the primary guild's server tag. This can be `null` if the system clears the identity, e.g. the server no longer supports tags. This will be `false` if the user manually removes their tag. | | tag | ?string | the text of the user's server tag. Limited to 4 characters | -| badge | ?string | the [server tag badge hash](/docs/reference#image-formatting) | +| badge | ?string | the [server tag badge hash](/developers/docs/reference#image-formatting) | ### Avatar Decoration Data Object The data for the user's [avatar decoration](https://support.discord.com/hc/en-us/articles/13410113109911-Avatar-Decorations). + ###### Avatar Decoration Data Structure -| Field | Type | Description | -|--------|-----------|----------------------------------------------------------------| -| asset | string | the [avatar decoration hash](/docs/reference#image-formatting) | -| sku_id | snowflake | id of the avatar decoration's SKU | +| Field | Type | Description | +|--------|-----------|---------------------------------------------------------------------------| +| asset | string | the [avatar decoration hash](/developers/docs/reference#image-formatting) | +| sku_id | snowflake | id of the avatar decoration's SKU | ### Collectibles The collectibles the user has, excluding Avatar Decorations and Profile Effects. + ###### Collectible Structure -| Field | Type | Description | -|------------|--------|----------------------------------------------------------------------------------------| -| nameplate? | object | object mapping of [nameplate data](/docs/resources/user#nameplate-nameplate-structure) | - +| Field | Type | Description | +|------------|--------|---------------------------------------------------------------------------------------------------| +| nameplate? | object | object mapping of [nameplate data](/developers/docs/resources/user#nameplate-nameplate-structure) | ### Nameplate The nameplate the user has. + ###### Nameplate Structure | Field | Type | Description | |---------|-----------|------------------------------------------------------------------------------------------------------------------------------------------------------| | sku_id | snowflake | id of the nameplate SKU | -| asset | string | path to the [nameplate asset](/docs/reference#image-formatting) | +| asset | string | path to the [nameplate asset](/developers/docs/reference#image-formatting) | | label | string | the label of this nameplate. Currently unused | | palette | string | background color of the nameplate, one of: `crimson`, `berry`, `sky`, `teal`, `forest`, `bubble_gum`, `violet`, `cobalt`, `clover`, `lemon`, `white` | @@ -166,21 +176,23 @@ The nameplate the user has. The connection object that the user has attached. + ###### Connection Structure -| Field | Type | Description | -|---------------|---------|------------------------------------------------------------------------------------------| -| id | string | id of the connection account | -| name | string | the username of the connection account | -| type | string | the [service](/docs/resources/user#connection-object-services) of this connection | -| revoked? | boolean | whether the connection is revoked | -| integrations? | array | an array of partial [server integrations](/docs/resources/guild#integration-object) | -| verified | boolean | whether the connection is verified | -| friend_sync | boolean | whether friend sync is enabled for this connection | -| show_activity | boolean | whether activities related to this connection will be shown in presence updates | -| two_way_link | boolean | whether this connection has a corresponding third party OAuth2 token | -| visibility | integer | [visibility](/docs/resources/user#connection-object-visibility-types) of this connection | - +| Field | Type | Description | +|---------------|---------|-----------------------------------------------------------------------------------------------------| +| id | string | id of the connection account | +| name | string | the username of the connection account | +| type | string | the [service](/developers/docs/resources/user#connection-object-services) of this connection | +| revoked? | boolean | whether the connection is revoked | +| integrations? | array | an array of partial [server integrations](/developers/docs/resources/guild#integration-object) | +| verified | boolean | whether the connection is verified | +| friend_sync | boolean | whether friend sync is enabled for this connection | +| show_activity | boolean | whether activities related to this connection will be shown in presence updates | +| two_way_link | boolean | whether this connection has a corresponding third party OAuth2 token | +| visibility | integer | [visibility](/developers/docs/resources/user#connection-object-visibility-types) of this connection | + + ###### Services | Value | Name | @@ -214,6 +226,7 @@ The connection object that the user has attached. \* Service can no longer be added by users + ###### Visibility Types | Value | Name | Description | @@ -225,46 +238,48 @@ The connection object that the user has attached. The role connection object that an application has attached to a user. + ###### Application Role Connection Structure -| Field | Type | Description | -|-------------------|---------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| -| platform_name | ?string | the vanity name of the platform a bot has connected (max 50 characters) | -| platform_username | ?string | the username on the platform a bot has connected (max 100 characters) | -| metadata | object | object mapping [application role connection metadata](/docs/resources/application-role-connection-metadata#application-role-connection-metadata-object) keys to their `string`-ified value (max 100 characters) for the user on the platform a bot has connected | +| Field | Type | Description | +|---------------|---------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| platform_name | ?string | the vanity name of the platform a bot has connected (max 50 characters) | +| metadata | object | object mapping [application role connection metadata](/developers/docs/resources/application-role-connection-metadata#application-role-connection-metadata-object) keys to their `string`-ified value (max 100 characters) for the user on the platform a bot has connected | ## Get Current User /users/@me -Returns the [user](/docs/resources/user#user-object) object of the requester's account. For OAuth2, this requires the `identify` scope, which will return the object _without_ an email, and optionally the `email` scope, which returns the object _with_ an email if the user has one. +Returns the [user](/developers/docs/resources/user#user-object) object of the requester's account. For OAuth2, this requires the `identify` scope, which will return the object _without_ an email, and optionally the `email` scope, which returns the object _with_ an email if the user has one. ## Get User -/users/[\{user.id\}](/docs/resources/user#user-object) +/users/[\{user.id\}](/developers/docs/resources/user#user-object) -Returns a [user](/docs/resources/user#user-object) object for a given user ID. +Returns a [user](/developers/docs/resources/user#user-object) object for a given user ID. ## Modify Current User /users/@me -Modify the requester's user account settings. Returns a [user](/docs/resources/user#user-object) object on success. Fires a [User Update](/docs/events/gateway-events#user-update) Gateway event. +Modify the requester's user account settings. Returns a [user](/developers/docs/resources/user#user-object) object on success. Fires a [User Update](/developers/docs/events/gateway-events#user-update) Gateway event. -:::info + All parameters to this endpoint are optional. -::: + + ###### JSON Params -| Field | Type | Description | -|----------|-------------------------------------------|----------------------------------------------------------------------------------| -| username | string | user's username, if changed may cause the user's discriminator to be randomized. | -| avatar | ?[image data](/docs/reference#image-data) | if passed, modifies the user's avatar | -| banner | ?[image data](/docs/reference#image-data) | if passed, modifies the user's banner | +| Field | Type | Description | +|----------|------------------------------------------------------|----------------------------------------------------------------------------------| +| username | string | user's username, if changed may cause the user's discriminator to be randomized. | +| avatar | ?[image data](/developers/docs/reference#image-data) | if passed, modifies the user's avatar | +| banner | ?[image data](/developers/docs/reference#image-data) | if passed, modifies the user's banner | ## Get Current User Guilds /users/@me/guilds -Returns a list of partial [guild](/docs/resources/guild#guild-object) objects the current user is a member of. For OAuth2, requires the `guilds` scope. +Returns a list of partial [guild](/developers/docs/resources/guild#guild-object) objects the current user is a member of. For OAuth2, requires the `guilds` scope. + ###### Example Partial Guild ```json @@ -281,38 +296,40 @@ Returns a list of partial [guild](/docs/resources/guild#guild-object) objects th } ``` -:::info + This endpoint returns 200 guilds by default, which is the maximum number of guilds a non-bot user can join. Therefore, pagination is **not needed** for integrations that need to get a list of the users' guilds. -::: + + ###### Query String Params -| Field | Type | Description | Required | Default | -|-------------|--------------------------------------------------|------------------------------------------------------------|----------|---------| -| before | snowflake | get guilds before this guild ID | false | absent | -| after | snowflake | get guilds after this guild ID | false | absent | -| limit | integer | max number of guilds to return (1-200) | false | 200 | -| with_counts | [boolean](/docs/reference#boolean-query-strings) | include approximate member and presence counts in response | false | false | +| Field | Type | Description | Required | Default | +|-------------|-------------------------------------------------------------|------------------------------------------------------------|----------|---------| +| before | snowflake | get guilds before this guild ID | false | absent | +| after | snowflake | get guilds after this guild ID | false | absent | +| limit | integer | max number of guilds to return (1-200) | false | 200 | +| with_counts | [boolean](/developers/docs/reference#boolean-query-strings) | include approximate member and presence counts in response | false | false | ## Get Current User Guild Member -/users/@me/guilds/[\{guild.id\}](/docs/resources/guild#guild-object)/member +/users/@me/guilds/[\{guild.id\}](/developers/docs/resources/guild#guild-object)/member -Returns a [guild member](/docs/resources/guild#guild-member-object) object for the current user. Requires the `guilds.members.read` OAuth2 scope. +Returns a [guild member](/developers/docs/resources/guild#guild-member-object) object for the current user. Requires the `guilds.members.read` OAuth2 scope. ## Leave Guild -/users/@me/guilds/[\{guild.id\}](/docs/resources/guild#guild-object) +/users/@me/guilds/[\{guild.id\}](/developers/docs/resources/guild#guild-object) -Leave a guild. Returns a 204 empty response on success. Fires a [Guild Delete](/docs/events/gateway-events#guild-delete) Gateway event and a [Guild Member Remove](/docs/events/gateway-events#guild-member-remove) Gateway event. +Leave a guild. Returns a 204 empty response on success. Fires a [Guild Delete](/developers/docs/events/gateway-events#guild-delete) Gateway event and a [Guild Member Remove](/developers/docs/events/gateway-events#guild-member-remove) Gateway event. ## Create DM /users/@me/channels -Create a new DM channel with a user. Returns a [DM channel](/docs/resources/channel#channel-object) object (if one already exists, it will be returned instead). +Create a new DM channel with a user. Returns a [DM channel](/developers/docs/resources/channel#channel-object) object (if one already exists, it will be returned instead). -:::warn + You should not use this endpoint to DM everyone in a server about something. DMs should generally be initiated by a user action. If you open a significant amount of DMs too quickly, your bot may be rate limited or blocked from opening new ones. -::: + + ###### JSON Params | Field | Type | Description | @@ -322,12 +339,13 @@ You should not use this endpoint to DM everyone in a server about something. DMs ## Create Group DM /users/@me/channels -Create a new group DM channel with multiple users. Returns a [DM channel](/docs/resources/channel#channel-object) object. This endpoint was intended to be used with the now-deprecated GameBridge SDK. Fires a [Channel Create](/docs/events/gateway-events#channel-create) Gateway event. +Create a new group DM channel with multiple users. Returns a [DM channel](/developers/docs/resources/channel#channel-object) object. This endpoint was intended to be used with the now-deprecated GameBridge SDK. Fires a [Channel Create](/developers/docs/events/gateway-events#channel-create) Gateway event. -:::warn + This endpoint is limited to 10 active group DMs. -::: + + ###### JSON Params | Field | Type | Description | @@ -338,22 +356,23 @@ This endpoint is limited to 10 active group DMs. ## Get Current User Connections /users/@me/connections -Returns a list of [connection](/docs/resources/user#connection-object) objects. Requires the `connections` OAuth2 scope. +Returns a list of [connection](/developers/docs/resources/user#connection-object) objects. Requires the `connections` OAuth2 scope. ## Get Current User Application Role Connection -/users/@me/applications/[\{application.id\}](/docs/resources/application#application-object)/role-connection +/users/@me/applications/[\{application.id\}](/developers/docs/resources/application#application-object)/role-connection -Returns the [application role connection](/docs/resources/user#application-role-connection-object) for the user. Requires an OAuth2 access token with `role_connections.write` scope for the application specified in the path. +Returns the [application role connection](/developers/docs/resources/user#application-role-connection-object) for the user. Requires an OAuth2 access token with `role_connections.write` scope for the application specified in the path. ## Update Current User Application Role Connection -/users/@me/applications/[\{application.id\}](/docs/resources/application#application-object)/role-connection +/users/@me/applications/[\{application.id\}](/developers/docs/resources/application#application-object)/role-connection -Updates and returns the [application role connection](/docs/resources/user#application-role-connection-object) for the user. Requires an OAuth2 access token with `role_connections.write` scope for the application specified in the path. +Updates and returns the [application role connection](/developers/docs/resources/user#application-role-connection-object) for the user. Requires an OAuth2 access token with `role_connections.write` scope for the application specified in the path. + ###### JSON Params -| Field | Type | Description | -|--------------------|--------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| -| platform_name? | string | the vanity name of the platform a bot has connected (max 50 characters) | -| platform_username? | string | the username on the platform a bot has connected (max 100 characters) | -| metadata? | object | object mapping [application role connection metadata](/docs/resources/application-role-connection-metadata#application-role-connection-metadata-object) keys to their `string`-ified value (max 100 characters) for the user on the platform a bot has connected | +| Field | Type | Description | +|--------------------|--------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| platform_name? | string | the vanity name of the platform a bot has connected (max 50 characters) | +| platform_username? | string | the username on the platform a bot has connected (max 100 characters) | +| metadata? | object | object mapping [application role connection metadata](/developers/docs/resources/application-role-connection-metadata#application-role-connection-metadata-object) keys to their `string`-ified value (max 100 characters) for the user on the platform a bot has connected | diff --git a/docs/resources/voice.mdx b/discord/developers/docs/resources/voice.mdx similarity index 55% rename from docs/resources/voice.mdx rename to discord/developers/docs/resources/voice.mdx index 381e0ffcaf..cccc23ce95 100644 --- a/docs/resources/voice.mdx +++ b/discord/developers/docs/resources/voice.mdx @@ -1,31 +1,36 @@ --- -sidebar_label: Voice +title: Voice Resource +sidebarTitle: Voice +description: Reference for Discord voice objects and connection endpoints. --- -# Voice Resource +import {ManualAnchor} from '/snippets/manualanchor.jsx' +import {Route} from '/snippets/route.jsx' ### Voice State Object Used to represent a user's voice connection status. + ###### Voice State Structure -| Field | Type | Description | -|----------------------------|------------------------------------------------------------------|---------------------------------------------------| -| guild_id? | snowflake | the guild id this voice state is for | -| channel_id | ?snowflake | the channel id this user is connected to | -| user_id | snowflake | the user id this voice state is for | -| member? | [guild member](/docs/resources/guild#guild-member-object) object | the guild member this voice state is for | -| session_id | string | the session id for this voice state | -| deaf | boolean | whether this user is deafened by the server | -| mute | boolean | whether this user is muted by the server | -| self_deaf | boolean | whether this user is locally deafened | -| self_mute | boolean | whether this user is locally muted | -| self_stream? | boolean | whether this user is streaming using "Go Live" | -| self_video | boolean | whether this user's camera is enabled | -| suppress | boolean | whether this user's permission to speak is denied | -| request_to_speak_timestamp | ?ISO8601 timestamp | the time at which the user requested to speak | - +| Field | Type | Description | +|----------------------------|-----------------------------------------------------------------------------|---------------------------------------------------| +| guild_id? | snowflake | the guild id this voice state is for | +| channel_id | ?snowflake | the channel id this user is connected to | +| user_id | snowflake | the user id this voice state is for | +| member? | [guild member](/developers/docs/resources/guild#guild-member-object) object | the guild member this voice state is for | +| session_id | string | the session id for this voice state | +| deaf | boolean | whether this user is deafened by the server | +| mute | boolean | whether this user is muted by the server | +| self_deaf | boolean | whether this user is locally deafened | +| self_mute | boolean | whether this user is locally muted | +| self_stream? | boolean | whether this user is streaming using "Go Live" | +| self_video | boolean | whether this user's camera is enabled | +| suppress | boolean | whether this user's permission to speak is denied | +| request_to_speak_timestamp | ?ISO8601 timestamp | the time at which the user requested to speak | + + ###### Example Voice State ```json @@ -44,6 +49,7 @@ Used to represent a user's voice connection status. ### Voice Region Object + ###### Voice Region Structure | Field | Type | Description | @@ -57,23 +63,24 @@ Used to represent a user's voice connection status. ## List Voice Regions /voice/regions -Returns an array of [voice region](/docs/resources/voice#voice-region-object) objects that can be used when setting a voice or stage channel's [`rtc_region`](/docs/resources/channel#channel-object-channel-structure). +Returns an array of [voice region](/developers/docs/resources/voice#voice-region-object) objects that can be used when setting a voice or stage channel's [`rtc_region`](/developers/docs/resources/channel#channel-object-channel-structure). ## Get Current User Voice State -/guilds/[\{guild.id\}](/docs/resources/guild#guild-object)/voice-states/@me +/guilds/[\{guild.id\}](/developers/docs/resources/guild#guild-object)/voice-states/@me -Returns the current user's [voice state](/docs/resources/voice#voice-state-object) in the guild. +Returns the current user's [voice state](/developers/docs/resources/voice#voice-state-object) in the guild. ## Get User Voice State -/guilds/[\{guild.id\}](/docs/resources/guild#guild-object)/voice-states/[\{user.id\}](/docs/resources/user#user-object) +/guilds/[\{guild.id\}](/developers/docs/resources/guild#guild-object)/voice-states/[\{user.id\}](/developers/docs/resources/user#user-object) -Returns the specified user's [voice state](/docs/resources/voice#voice-state-object) in the guild. +Returns the specified user's [voice state](/developers/docs/resources/voice#voice-state-object) in the guild. ## Modify Current User Voice State -/guilds/[\{guild.id\}](/docs/resources/guild#guild-object)/voice-states/@me +/guilds/[\{guild.id\}](/developers/docs/resources/guild#guild-object)/voice-states/@me -Updates the current user's voice state. Returns `204 No Content` on success. Fires a [Voice State Update](/docs/events/gateway-events#voice-state-update) Gateway event. +Updates the current user's voice state. Returns `204 No Content` on success. Fires a [Voice State Update](/developers/docs/events/gateway-events#voice-state-update) Gateway event. + ###### JSON Params | Field | Type | Description | @@ -82,6 +89,7 @@ Updates the current user's voice state. Returns `204 No Content` on success. Fir | suppress? | boolean | toggles the user's suppress state | | request_to_speak_timestamp? | ?ISO8601 timestamp | sets the user's request to speak | + ###### Caveats There are currently several caveats for this endpoint: @@ -93,10 +101,11 @@ There are currently several caveats for this endpoint: - You are able to set `request_to_speak_timestamp` to any present or future time. ## Modify User Voice State -/guilds/[\{guild.id\}](/docs/resources/guild#guild-object)/voice-states/[\{user.id\}](/docs/resources/user#user-object) +/guilds/[\{guild.id\}](/developers/docs/resources/guild#guild-object)/voice-states/[\{user.id\}](/developers/docs/resources/user#user-object) -Updates another user's voice state. Returns `204 No Content` on success. Fires a [Voice State Update](/docs/events/gateway-events#voice-state-update) Gateway event. +Updates another user's voice state. Returns `204 No Content` on success. Fires a [Voice State Update](/developers/docs/events/gateway-events#voice-state-update) Gateway event. + ###### JSON Params | Field | Type | Description | @@ -104,6 +113,7 @@ Updates another user's voice state. Returns `204 No Content` on success. Fires a | channel_id? | snowflake | the id of the channel the user is currently in | | suppress? | boolean | toggles the user's suppress state | + ###### Caveats There are currently several caveats for this endpoint: diff --git a/discord/developers/docs/resources/webhook.mdx b/discord/developers/docs/resources/webhook.mdx new file mode 100644 index 0000000000..f88d48567c --- /dev/null +++ b/discord/developers/docs/resources/webhook.mdx @@ -0,0 +1,359 @@ +--- +title: Webhook Resource +sidebarTitle: Webhook +description: Reference for Discord webhook objects and management endpoints. +--- + +import {ManualAnchor} from '/snippets/manualanchor.jsx' +import {Route} from '/snippets/route.jsx' + +Webhooks are a low-effort way to post messages to channels in Discord. They do not require a bot user or authentication to use. + +Apps can also subscribe to webhook events (i.e. outgoing webhooks) when events happen *in* Discord, which is detailed in the [Webhook Events](/developers/docs/events/webhook-events) documentation. + +### Webhook Object + +Used to represent a webhook. + + +###### Webhook Structure + +| Field | Type | Description | +|-------------------|-----------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------| +| id | snowflake | the id of the webhook | +| type | integer | the [type](/developers/docs/resources/webhook#webhook-object-webhook-types) of the webhook | +| guild_id? | ?snowflake | the guild id this webhook is for, if any | +| channel_id | ?snowflake | the channel id this webhook is for, if any | +| user? | [user](/developers/docs/resources/user#user-object) object | the user this webhook was created by (not returned when getting a webhook with its token) | +| name | ?string | the default name of the webhook | +| avatar | ?string | the default user avatar [hash](/developers/docs/reference#image-formatting) of the webhook | +| token? | string | the secure token of the webhook (returned for Incoming Webhooks) | +| application_id | ?snowflake | the bot/OAuth2 application that created this webhook | +| source_guild? * | partial [guild](/developers/docs/resources/guild#guild-object) object | the guild of the channel that this webhook is following (returned for Channel Follower Webhooks) | +| source_channel? * | partial [channel](/developers/docs/resources/channel#channel-object) object | the channel that this webhook is following (returned for Channel Follower Webhooks) | +| url? | string | the url used for executing the webhook (returned by the [webhooks](/developers/docs/topics/oauth2#webhooks) OAuth2 flow) | + +\* These fields will be absent if the webhook creator has since lost access to the guild where the followed channel resides + + +###### Webhook Types + + +These types don't include [webhook events](/developers/docs/events/webhook-events), which are outgoing webhooks sent to your app by Discord. See [Webhook Events](/developers/docs/events/webhook-events) for details. + + +| Value | Name | Description | +|-------|------------------|----------------------------------------------------------------------------------------------------------------| +| 1 | Incoming | Incoming Webhooks can post messages to channels with a generated token | +| 2 | Channel Follower | Channel Follower Webhooks are internal webhooks used with Channel Following to post new messages into channels | +| 3 | Application | Application webhooks are webhooks used with Interactions | + + +###### Example Incoming Webhook + +```json +{ + "name": "test webhook", + "type": 1, + "channel_id": "199737254929760256", + "token": "3d89bb7572e0fb30d8128367b3b1b44fecd1726de135cbe28a41f8b2f777c372ba2939e72279b94526ff5d1bd4358d65cf11", + "avatar": null, + "guild_id": "199737254929760256", + "id": "223704706495545344", + "application_id": null, + "user": { + "username": "test", + "discriminator": "7479", + "id": "190320984123768832", + "avatar": "b004ec1740a63ca06ae2e14c5cee11f3", + "public_flags": 131328 + } +} +``` + + +###### Example Channel Follower Webhook + +```json +{ + "type": 2, + "id": "752831914402115456", + "name": "Guildy name", + "avatar": "bb71f469c158984e265093a81b3397fb", + "channel_id": "561885260615255432", + "guild_id": "56188498421443265", + "application_id": null, + "source_guild": { + "id": "56188498421476534", + "name": "Guildy name", + "icon": "bb71f469c158984e265093a81b3397fb" + }, + "source_channel": { + "id": "5618852344134324", + "name": "announcements" + }, + "user": { + "username": "test", + "discriminator": "7479", + "id": "190320984123768832", + "avatar": "b004ec1740a63ca06ae2e14c5cee11f3", + "public_flags": 131328 + } +} +``` + + +###### Example Application Webhook + +```json +{ + "type": 3, + "id": "658822586720976555", + "name": "Clyde", + "avatar": "689161dc90ac261d00f1608694ac6bfd", + "channel_id": null, + "guild_id": null, + "application_id": "658822586720976555" +} +``` + +## Create Webhook +/channels/[\{channel.id\}](/developers/docs/resources/channel#channel-object)/webhooks + +Creates a new webhook and returns a [webhook](/developers/docs/resources/webhook#webhook-object) object on success. Requires the `MANAGE_WEBHOOKS` permission. Fires a [Webhooks Update](/developers/docs/events/gateway-events#webhooks-update) Gateway event. + +An error will be returned if a webhook name (`name`) is not valid. A webhook name is valid if: + +- It does not contain the substrings `clyde` or `discord` (case-insensitive) +- It follows the nickname guidelines in the [Usernames and Nicknames](/developers/docs/resources/user#usernames-and-nicknames) documentation, with an exception that webhook names can be up to 80 characters + + +This endpoint supports the `X-Audit-Log-Reason` header. + + + +###### JSON Params + +| Field | Type | Description | +|---------|------------------------------------------------------|---------------------------------------| +| name | string | name of the webhook (1-80 characters) | +| avatar? | ?[image data](/developers/docs/reference#image-data) | image for the default webhook avatar | + +## Get Channel Webhooks +/channels/[\{channel.id\}](/developers/docs/resources/channel#channel-object)/webhooks + +Returns a list of channel [webhook](/developers/docs/resources/webhook#webhook-object) objects. Requires the `MANAGE_WEBHOOKS` permission. + +## Get Guild Webhooks +/guilds/[\{guild.id\}](/developers/docs/resources/guild#guild-object)/webhooks + +Returns a list of guild [webhook](/developers/docs/resources/webhook#webhook-object) objects. Requires the `MANAGE_WEBHOOKS` permission. + +## Get Webhook +/webhooks/[\{webhook.id\}](/developers/docs/resources/webhook#webhook-object) + +Returns the new [webhook](/developers/docs/resources/webhook#webhook-object) object for the given id. + +This request requires the `MANAGE_WEBHOOKS` permission unless the application making the request owns the +webhook. [(see: webhook.application_id)](/developers/docs/resources/webhook#webhook-object) + +## Get Webhook with Token +/webhooks/[\{webhook.id\}](/developers/docs/resources/webhook#webhook-object)/[\{webhook.token\}](/developers/docs/resources/webhook#webhook-object) + +Same as above, except this call does not require authentication and returns no user in the webhook object. + +## Modify Webhook +/webhooks/[\{webhook.id\}](/developers/docs/resources/webhook#webhook-object) + +Modify a webhook. Requires the `MANAGE_WEBHOOKS` permission. Returns the updated [webhook](/developers/docs/resources/webhook#webhook-object) object on success. Fires a [Webhooks Update](/developers/docs/events/gateway-events#webhooks-update) Gateway event. + + +All parameters to this endpoint are optional + + + +This endpoint supports the `X-Audit-Log-Reason` header. + + + +###### JSON Params + +| Field | Type | Description | +|------------|------------------------------------------------------|----------------------------------------------------| +| name | string | the default name of the webhook | +| avatar | ?[image data](/developers/docs/reference#image-data) | image for the default webhook avatar | +| channel_id | snowflake | the new channel id this webhook should be moved to | + +## Modify Webhook with Token +/webhooks/[\{webhook.id\}](/developers/docs/resources/webhook#webhook-object)/[\{webhook.token\}](/developers/docs/resources/webhook#webhook-object) + +Same as above, except this call does not require authentication, does not accept a `channel_id` parameter in the body, and does not return a user in the webhook object. + +## Delete Webhook +/webhooks/[\{webhook.id\}](/developers/docs/resources/webhook#webhook-object) + +Delete a webhook permanently. Requires the `MANAGE_WEBHOOKS` permission. Returns a `204 No Content` response on success. Fires a [Webhooks Update](/developers/docs/events/gateway-events#webhooks-update) Gateway event. + + +This endpoint supports the `X-Audit-Log-Reason` header. + + +## Delete Webhook with Token +/webhooks/[\{webhook.id\}](/developers/docs/resources/webhook#webhook-object)/[\{webhook.token\}](/developers/docs/resources/webhook#webhook-object) + +Same as above, except this call does not require authentication. + +## Execute Webhook +/webhooks/[\{webhook.id\}](/developers/docs/resources/webhook#webhook-object)/[\{webhook.token\}](/developers/docs/resources/webhook#webhook-object) + +Refer to [Uploading Files](/developers/docs/reference#uploading-files) for details on attachments and `multipart/form-data` requests. Returns a message or `204 No Content` depending on the `wait` query parameter. + + +Note that when sending a message, you must provide a value for at **least one of** `content`, `embeds`, `components`, `file`, or `poll`. + + + +If the webhook channel is a forum or media channel, you must provide either `thread_id` in the query string params, or `thread_name` in the JSON/form params. If `thread_id` is provided, the message will send in that thread. If `thread_name` is provided, a thread with that name will be created in the channel. + + + +Discord may strip certain characters from message content, like invalid unicode characters or characters which cause unexpected message formatting. If you are passing user-generated strings into message content, consider sanitizing the data to prevent unexpected behavior and using `allowed_mentions` to prevent unexpected mentions. + + + +###### Query String Params + +| Field | Type | Description | Required | +|-----------------|-------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|----------| +| wait | [boolean](/developers/docs/reference#boolean-query-strings) | waits for server confirmation of message send before response, and returns the created message body (defaults to `false`; when `false` a message that is not saved does not return an error) | false | +| thread_id | snowflake | Send a message to the specified thread within a webhook's channel. The thread will automatically be unarchived. | false | +| with_components | [boolean](/developers/docs/reference#boolean-query-strings) | whether to respect the `components` field of the request. When enabled, allows application-owned webhooks to use all components and non-owned webhooks to use non-interactive components. (defaults to `false`) | false | + + +###### JSON/Form Params + +| Field | Type | Description | Required | +|-------------------|---------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|------------------------------------| +| content | string | the message contents (up to 2000 characters) | one of content, file, embeds, poll | +| username | string | override the default username of the webhook | false | +| avatar_url | string | override the default avatar of the webhook | false | +| tts | boolean | true if this is a TTS message | false | +| embeds | array of up to 10 [embed](/developers/docs/resources/message#embed-object) objects | embedded `rich` content | one of content, file, embeds, poll | +| allowed_mentions | [allowed mention object](/developers/docs/resources/message#allowed-mentions-object) | allowed mentions for the message | false | +| components \* | array of [message component](/developers/docs/components/reference#component-object) | the components to include with the message | false | +| files[n] \*\* | file contents | the contents of the file being sent | one of content, file, embeds, poll | +| payload_json \*\* | string | JSON encoded body of non-file params | `multipart/form-data` only | +| attachments \*\* | array of partial [attachment](/developers/docs/resources/message#attachment-object) objects | attachment objects with filename and description | false | +| flags \*\*\* | integer | [message flags](/developers/docs/resources/message#message-object-message-flags) combined as a [bitfield](https://en.wikipedia.org/wiki/Bit_field) (only `SUPPRESS_EMBEDS`, `SUPPRESS_NOTIFICATIONS` and `IS_COMPONENTS_V2` can be set) | false | +| thread_name | string | name of thread to create (requires the webhook channel to be a forum or media channel) | false | +| applied_tags | array of snowflakes | array of tag ids to apply to the thread (requires the webhook channel to be a forum or media channel) | false | +| poll | [poll](/developers/docs/resources/poll#poll-create-request-object) request object | A poll! | one of content, file, embeds, poll | + +\* Application-owned webhooks can always send components. Non-application-owned webhooks cannot send interactive components, and the `components` field will be ignored unless they set the `with_components` query param. + +\*\* See [Uploading Files](/developers/docs/reference#uploading-files) for details. + +\*\*\* When the flag `IS_COMPONENTS_V2` is set, the webhook message can only contain `components`. Providing `content`, `embeds`, `files[n]` or `poll` will fail with a 400 BAD REQUEST response. + + +For the webhook embed objects, you can set every field except `type` (it will be `rich` regardless of if you try to set it), `provider`, `video`, and any `height`, `width`, or `proxy_url` values for images. + + +## Execute Slack-Compatible Webhook +/webhooks/[\{webhook.id\}](/developers/docs/resources/webhook#webhook-object)/[\{webhook.token\}](/developers/docs/resources/webhook#webhook-object)/slack + +Refer to [Slack's documentation](https://api.slack.com/incoming-webhooks) for more information. We do not support Slack's `channel`, `icon_emoji`, `mrkdwn`, or `mrkdwn_in` properties. + + +###### Query String Params + +| Field | Type | Description | Required | +|-----------|-------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------|----------| +| thread_id | snowflake | id of the thread to send the message in | false | +| wait | [boolean](/developers/docs/reference#boolean-query-strings) | waits for server confirmation of message send before response (defaults to `true`; when `false` a message that is not saved does not return an error) | false | + +## Execute GitHub-Compatible Webhook +/webhooks/[\{webhook.id\}](/developers/docs/resources/webhook#webhook-object)/[\{webhook.token\}](/developers/docs/resources/webhook#webhook-object)/github + +[Add a new webhook](https://support.discord.com/hc/en-us/articles/228383668-Intro-to-Webhooks) to your GitHub repo (in the repo's settings), and use this endpoint as the "Payload URL." You can choose what events your Discord channel receives by choosing the "Let me select individual events" option and selecting individual events for the new webhook you're configuring. The supported [events](https://docs.github.com/en/webhooks/webhook-events-and-payloads) are `commit_comment`, `create`, `delete`, `fork`, `issue_comment`, `issues`, `member`, `public`, `pull_request`, `pull_request_review`, `pull_request_review_comment`, `push`, `release`, `watch`, `check_run`, `check_suite`, `discussion`, and `discussion_comment`. + + +###### Query String Params + +| Field | Type | Description | Required | +|-----------|-------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------|----------| +| thread_id | snowflake | id of the thread to send the message in | false | +| wait | [boolean](/developers/docs/reference#boolean-query-strings) | waits for server confirmation of message send before response (defaults to `true`; when `false` a message that is not saved does not return an error) | false | + +## Get Webhook Message +/webhooks/[\{webhook.id\}](/developers/docs/resources/webhook#webhook-object)/[\{webhook.token\}](/developers/docs/resources/webhook#webhook-object)/messages/[\{message.id\}](/developers/docs/resources/message#message-object) + +Returns a previously-sent webhook message from the same token. Returns a [message](/developers/docs/resources/message#message-object) object on success. + + +###### Query String Params + +| Field | Type | Description | Required | +|-----------|-----------|------------------------------------|----------| +| thread_id | snowflake | id of the thread the message is in | false | + +## Edit Webhook Message +/webhooks/[\{webhook.id\}](/developers/docs/resources/webhook#webhook-object)/[\{webhook.token\}](/developers/docs/resources/webhook#webhook-object)/messages/[\{message.id\}](/developers/docs/resources/message#message-object) + +Edits a previously-sent webhook message from the same token. Returns a [message](/developers/docs/resources/message#message-object) object on success. + +When the `content` field is edited, the arrays `mentions` and `mention_roles` and the boolean `mention_everyone` in the message object will be reconstructed from scratch based on the new content. When the message flag `IS_COMPONENTS_V2` is set, the reconstructed arrays and boolean are based on the edited content in the `components` array. The `allowed_mentions` field of the edit request controls how this happens. If there is no explicit `allowed_mentions` in the edit request, the content will be parsed with _default_ allowances, that is, without regard to whether or not an `allowed_mentions` was present in the request that originally created the message. + +Refer to [Uploading Files](/developers/docs/reference#uploading-files) for details on attachments and `multipart/form-data` requests. +Any provided files will be **appended** to the message. To remove or replace files you will have to supply the `attachments` field which specifies the files to retain on the message after edit. + + +Starting with API v10, the `attachments` array must contain all attachments that should be present after edit, including **retained and new** attachments provided in the request body. + + + +All parameters to this endpoint are optional and nullable. + + + +###### Query String Params + +| Field | Type | Description | Required | +|-----------------|-------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|----------| +| thread_id | snowflake | id of the thread the message is in | false | +| with_components | [boolean](/developers/docs/reference#boolean-query-strings) | whether to respect the `components` field of the request. When enabled, allows application-owned webhooks to use all components and non-owned webhooks to use non-interactive components. (defaults to `false`) | false | + + +###### JSON/Form Params + +| Field | Type | Description | +|---------------------|---------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| content | string | the message contents (up to 2000 characters) | +| embeds | array of up to 10 [embed](/developers/docs/resources/message#embed-object) objects | embedded `rich` content | +| flags \* | integer | [message flags](/developers/docs/resources/message#message-object-message-flags) combined as a [bitfield](https://en.wikipedia.org/wiki/Bit_field) (`SUPPRESS_EMBEDS` and `IS_COMPONENTS_V2` only) | +| allowed_mentions | [allowed mention object](/developers/docs/resources/message#allowed-mentions-object) | allowed mentions for the message | +| components \*\* | array of [message component](/developers/docs/components/reference#component-object) | the components to include with the message | +| files[n] \*\*\* | file contents | the contents of the file being sent/edited | +| payload_json \*\*\* | string | JSON encoded body of non-file params (multipart/form-data only) | +| attachments \*\*\* | array of partial [attachment](/developers/docs/resources/message#attachment-object) objects | attached files to keep and possible descriptions for new files | +| poll \*\*\*\* | [poll](/developers/docs/resources/poll#poll-create-request-object) request object | A poll! | + +\* The `SUPPRESS_EMBEDS` flag can be both set and unset, while the `IS_COMPONENTS_V2` flag can only be set. When the `IS_COMPONENTS_V2` flag is set, any of the used `content`, `embeds`, `files[n]` or `poll` values in the initial message must be set to `null` first, otherwise it will fail with a 400 BAD REQUEST response. + +\*\* Application-owned webhooks can always send components. Non-application-owned webhooks cannot send interactive components, and the `components` field will be ignored unless they set the `with_components` query param. + +\*\*\* See [Uploading Files](/developers/docs/reference#uploading-files) for details. + +\*\*\*\* Polls can only be added when editing a deferred interaction response. + +## Delete Webhook Message +/webhooks/[\{webhook.id\}](/developers/docs/resources/webhook#webhook-object)/[\{webhook.token\}](/developers/docs/resources/webhook#webhook-object)/messages/[\{message.id\}](/developers/docs/resources/message#message-object) + +Deletes a message that was created by the webhook. Returns a `204 No Content` response on success. + + +###### Query String Params + +| Field | Type | Description | Required | +|-----------|-----------|------------------------------------|----------| +| thread_id | snowflake | id of the thread the message is in | false | diff --git a/docs/rich-presence/best-practices.md b/discord/developers/docs/rich-presence/best-practices.mdx similarity index 79% rename from docs/rich-presence/best-practices.md rename to discord/developers/docs/rich-presence/best-practices.mdx index cc229d1baf..782539e3ef 100644 --- a/docs/rich-presence/best-practices.md +++ b/discord/developers/docs/rich-presence/best-practices.mdx @@ -1,13 +1,16 @@ --- -sidebar_label: Best Practices +title: Best Practices for Rich Presence +sidebarTitle: Best Practices +description: Best practices and guidelines for implementing effective Rich Presence. --- -# Best Practices for Rich Presence +import {ManualAnchor} from '/snippets/manualanchor.jsx' Rich Presence lets you display actionable data in a Discord user's profile about what they're up to in your game or app. This guide is intended to show some best practices on how to make that data the best it can be. -If you don't already know about Rich Presence, read [the overview](/docs/rich-presence/overview) first. +If you don't already know about Rich Presence, read [the overview](/developers/docs/rich-presence/overview) first. + ## How should you think about the data you show? The data in your players’ profiles is the first thing that others on Discord will see about your game or app, both those familiar with it and those who have never seen it before. It should answer whether someone can play with their friend right now and show data like: @@ -24,9 +27,10 @@ The data in your players’ profiles is the first thing that others on Discord w - `details` and `state` should be snippets of data, not sentences. - Make sure your strings stay on one line—especially on the small profile! + ###### Examples -![Example of a good rich presence string that is concise and easy to read compared to a bad string that is too long to fit on one line](images/rp-short-strings.webp) +![Example of a good rich presence string that is concise and easy to read compared to a bad string that is too long to fit on one line](/images/rich-presence/short-strings.png) ### Make it Actionable! @@ -34,9 +38,10 @@ The data in your players’ profiles is the first thing that others on Discord w - Keep accurate track of party state: In Queue, In Game, In Menus, etc. - Include game modes, ranked vs. unranked, etc. so others can clearly see. + ###### Examples -![Examples of good rich presence strings that show a game mode of "Ranked: Control Point" and that the user is "In Queue (2 of 3)" compared to a bad string that reads "Rank 9999"](images/rp-actionable.webp) +![Examples of good rich presence strings that show a game mode of "Ranked: Control Point" and that the user is "In Queue (2 of 3)" compared to a bad string that reads "Rank 9999"](/images/rich-presence/actionable.png) ### Use ALL of the fields (where applicable)! @@ -44,9 +49,10 @@ The data in your players’ profiles is the first thing that others on Discord w - Save space by putting map and character names in the tooltips. - Try not to repeat information. + ###### Examples -![Example of a good rich presence string that takes advantage of storing less important information in tooltips compared to a bad string that is hard to read at a glance](images/rp-all-fields.webp) +![Example of a good rich presence string that takes advantage of storing less important information in tooltips compared to a bad string that is hard to read at a glance](/images/rich-presence/all-fields.png) ### Have interesting, expressive art! @@ -55,9 +61,10 @@ The data in your players’ profiles is the first thing that others on Discord w - Use high resolution artwork so your art looks great on fancy, high DPI screens. - We strongly recommend image sizes of 1024x1024 pixels. + ###### Examples -![Example of a good rich presence icon that is clear and detailed compared to a bad icon that is too dark to see clearly](images/rp-good-art.webp) +![Example of a good rich presence icon that is clear and detailed compared to a bad icon that is too dark to see clearly](/images/rich-presence/good-art.png) ## Launch Checklist @@ -83,9 +90,9 @@ Ready to launch a Rich Presence integration for your game? If so, we recommend l #### Joining -:::info -Since all Activities presence data has an **Ask to Join** button, Join Invites are only applicable when building with the [Game SDK](/docs/rich-presence/using-with-the-game-sdk) -::: + +Since all Activities presence data has an **Ask to Join** button, Join Invites are only applicable when building with the [Game SDK](/developers/docs/rich-presence/using-with-the-game-sdk) + - Have you successfully implemented join invites for your game if applicable? - Does the state of the invite properly represent the party/group in-game with regards to: diff --git a/discord/developers/docs/rich-presence/overview.mdx b/discord/developers/docs/rich-presence/overview.mdx new file mode 100644 index 0000000000..fd562c2406 --- /dev/null +++ b/discord/developers/docs/rich-presence/overview.mdx @@ -0,0 +1,109 @@ +--- +title: Overview of Rich Presence +sidebarTitle: Overview +description: Learn how to integrate Rich Presence to display activity information on user profiles. +--- + +![Examples of Rich Presence data on Discord user profiles](/images/rich-presence/examples.png) + +Rich Presence lets you display actionable data in a Discord user's profile about what they're up to in your game or app. The data you choose to display is up to you—whether it's a user's score, the duration they've been playing your game, what they're listening to on your platform, or something else. + +--- + +## Choosing an SDK + +There are three options when integrating Rich Presence. Depending on what you're building, you'll want to choose the right SDK for your project: + +- The **[Discord Social SDK](/developers/docs/rich-presence/overview#discord-social-sdk)** allows you to build social features into your game or app, including friends lists, game invites, and more. +- The **[Embedded App SDK](/developers/docs/rich-presence/overview#embedded-app-sdk)** should be used if you're building an [Activity](/developers/docs/activities/overview) in Discord. +- The **[Game SDK (legacy)](/developers/docs/rich-presence/overview#game-sdk)** can be used if you're building an off-platform game or app and you want to integrate it into Discord. + +All SDKs use similar underlying primitives (like the [`SET_ACTIVITY` RPC command](/developers/docs/topics/rpc#setactivity)), so a lot is the same between them. But there are a few differences, like feature compatibility, which is covered in the sections below. + + +Rich Presence data appears publicly on your Discord profile, so during development you should use a test account that only belongs to your private development server(s). + + +### Discord Social SDK + +The [Discord Social SDK](/developers/docs/discord-social-sdk/overview) is used for building social features directly into your game. When a user is playing your game, you can show what they're up to in their Discord profile and even prompt their friends to join in with game invites. + +When integrating Rich Presence with an off-platform game, data can be shown about what a user is up to in your game. A "Join" button can also be configured to allow a user's friends to jump into their game and enable sending game invites. + +[Read about using Rich Presence with the Discord Social SDK](/developers/docs/rich-presence/using-with-the-discord-social-sdk) + +### Embedded App SDK + +The [Embedded App SDK](/developers/docs/developer-tools/embedded-app-sdk) is used to build Activities, which are multiplayer games and social experiences hosted in an iframe within Discord. The SDK handles communication between Discord and the Activity and helps integrate platform features (like Rich Presence!). + +After a user joins an Activity, Rich Presence can be used to dynamically show data about what that user is doing or playing, as well as prompt others to join in and play along. + +[Read about using Rich Presence with the Embedded App SDK](/developers/docs/rich-presence/using-with-the-embedded-app-sdk) + +### Game SDK + + +**The Game SDK has been archived.** + +We recommend using the [Discord Social SDK](/developers/docs/discord-social-sdk/overview) for new projects. + +Existing projects using the Game SDK will continue to work, but we encourage you to migrate to the [Discord Social SDK](/developers/docs/discord-social-sdk/overview) for new features and updates. + + +The [Game SDK](/developers/docs/developer-tools/game-sdk) makes it easier to build 3rd party games and integrate them with Discord. While many features of the Game SDK are deprecated, it can still be used for a few use cases (like integrating Rich Presence!). + +When integrating Rich Presence with an off-platform game, data can be shown about what a user is up to in your game. A "Join" button can also be configured to allow a user's friends to jump into their game. + +[Read about using Rich Presence with the Game SDK](/developers/docs/rich-presence/using-with-the-game-sdk) + +## Adding Custom Art Assets + +While integrating Rich Presence, you'll likely want to upload custom art assets for your app. **For all Rich Presence assets, it's highly recommended to make them 1024 x 1024**. + +To add custom assets for Rich Presence, navigate to your [app's settings](https://discord.com/developers/applications) and click **Rich Presence** on the left-hand sidebar. On the **Art Assets** page, there are two different types of assets you can upload. + +### Invite Image + +The Rich Presence invite image appears when [invites](/developers/docs/developer-tools/game-sdk#sendinvite) are sent for a 3rd party game or app using the [Game SDK](/developers/docs/rich-presence/overview#game-sdk). After uploading an invite image for your app, you can see a preview of it to the right (under "IRL Invite Image Example"). + + +The invite image can be ignored if you're building using the [Embedded App SDK](/developers/docs/rich-presence/overview#embedded-app-sdk). Invites sent using the Embedded App SDK's[`openInviteDialog()`](/developers/docs/developer-tools/embedded-app-sdk#openinvitedialog) use the Activity's cover art. + + +![Rich Presence invite image in app settings](/images/rich-presence/invite-image.png) + +### Assets + +Up to 300 custom assets can be added for your app to use when setting Rich Presence for a Discord user. These assets can be anything that help orient others to what a user is doing inside of your Activity or 3rd party game. + +If you need more than 300 custom assets or want to use images stored somewhere else, you can also [specify an external URL](/developers/docs/events/gateway-events#activity-object-activity-asset-image) as long it still has the proper dimensions and size. + + +For tips on choosing assets, take a look at the [Rich Presence best practices guide](/developers/docs/rich-presence/best-practices#have-interesting-expressive-art). + + +When uploading Rich Presence assets, **the asset keys will automatically be changed to lowercase**. You can see this reflected in your app's settings after saving a newly-uploaded asset, and should keep it in mind when referencing any asset keys in your code. + +![Rich Presence assets in app settings](/images/rich-presence-asset-images.webp) + +### Using the Visualizer + + +The Rich Presence visualizer currently uses an outdated Discord UI, but can still be helpful as a quick-and-dirty reference for what your Rich Presence data will look like in Discord. + + +In your app's settings, there's a Rich Presence visualizer to make it easier to see what your uploaded [assets](/developers/docs/rich-presence/overview#assets) will look like in the context of a Discord profile. To access the visualizer, navigate to your [app's settings](https://discord.com/developers/applications) and click **Rich Presence** on the left-hand sidebar. On the **Visualizer** page, you can fill out some custom strings, party information, and select your uploaded assets to see a preview. + +## Start Building + + + + Guide on using Rich Presence in the Embedded App SDK while you're building an Activity + + + Guide on using Rich Presence in the Game SDK + + + Best practices and launch checklist for when you're integrating Rich Presence with your game or app + + \ No newline at end of file diff --git a/discord/developers/docs/rich-presence/using-with-the-discord-social-sdk.mdx b/discord/developers/docs/rich-presence/using-with-the-discord-social-sdk.mdx new file mode 100644 index 0000000000..e4d2ea706e --- /dev/null +++ b/discord/developers/docs/rich-presence/using-with-the-discord-social-sdk.mdx @@ -0,0 +1,29 @@ +--- +title: Using Rich Presence with the Discord Social SDK +sidebarTitle: Using with the Discord Social SDK +description: Learn how to implement Rich Presence features using the Discord Social SDK. +--- + +When developing a game, the [Discord Social SDK](/developers/docs/discord-social-sdk/overview) makes it easy to integrate Rich Presence to display details about what a user is up to inside of your game or social experience. + + +Not sure if you should be building with the Discord Social SDK? Read through [Choosing an SDK](/developers/docs/rich-presence/overview#choosing-an-sdk) to understand your options when integrating Rich Presence with your app. + + +## Understanding Rich Presence Data + +Before we dig in, it's helpful to understand what Rich Presence data you can set when updating a user's presence data. Let's just take a look at what we're working with: + +![Graphical representation of the legend for rich presence details](/images/rich-presence/legend.png) + + +For tips on designing Rich Presence, take a look at the [Rich Presence best practices guide](/developers/docs/rich-presence/best-practices). + + +## Setting Rich Presence Data + +Check out our [Setting Rich Presence](/developers/docs/discord-social-sdk/development-guides/setting-rich-presence) guide and our to learn how to set custom presence data for your players using the Discord Social SDK. + +- [Design Guidelines: Status & Rich Presence](/developers/docs/discord-social-sdk/design-guidelines/status-rich-presence) + +![Rich Presence](/images/social-sdk/design-guidelines/StatusPresence-06.png) diff --git a/discord/developers/docs/rich-presence/using-with-the-embedded-app-sdk.mdx b/discord/developers/docs/rich-presence/using-with-the-embedded-app-sdk.mdx new file mode 100644 index 0000000000..8ac2bf7fd2 --- /dev/null +++ b/discord/developers/docs/rich-presence/using-with-the-embedded-app-sdk.mdx @@ -0,0 +1,158 @@ +--- +title: Using Rich Presence with the Embedded App SDK +sidebarTitle: Using with the Embedded App SDK +--- + +When developing an [Activity](/developers/docs/activities/overview), the [Embedded App SDK](/developers/docs/developer-tools/embedded-app-sdk) makes it easy to integrate Rich Presence to display details about what a user is up to inside of your game or social experience. + +Rich Presence data can be thought of as an extension of your Activity—and leveling it up just a *little* makes it more interesting and relevant to the user playing your Activity (and their friends that might want to jump in and play). This guide provides an overview of the platform and technical knowledge you need to integrate Rich Presence with your existing Activity. + + +Not sure if you should be building with the Embedded App SDK? Read through [Choosing an SDK](/developers/docs/rich-presence/overview#choosing-an-sdk) to understand your options when integrating Rich Presence with your app. + + +The rest of the guide assumes you've already developed an [app](/developers/docs/quick-start/overview-of-apps) that can launch an Activity. If you aren't at that point quite yet, you should follow the guide on [building your first Activity](/developers/docs/activities/building-an-activity) before continuing. + +## Understanding Rich Presence Data + +### Default Rich Presence Data + +By default, when a user is connected to your Activity, the app's icon will appear on their profile. If the user viewing the profile has the ability to join, an "Ask to Join" button will be displayed as well. + +![Example of default Rich Presence data for an Activity](/images/rich-presence/default-activities.png) + +While this is okay, it's pretty limited and doesn't provide much context about what a user is actually *doing* inside of the Activity. In the following sections, we'll take a look at what richer and more actionable presence can look like. + +### Custom Rich Presence Data + +Now let's see what custom presence data can look like when a user joins your Activity. The [types for these fields](/developers/docs/rich-presence/using-with-the-embedded-app-sdk#setactivity-fields) and [examples](/developers/docs/rich-presence/using-with-the-embedded-app-sdk#setactivity-example) are in the sections below, but for now let's just get an idea of what we're working with: + +![Image of where Rich Presence data appears in Discord profiles for Activities](/images/rich-presence/annotated-data-activities.png) + +A few small things to note about the above image: +1. `large_image` and `small_image` are both in the `assets` object, which you can see below in the [table below](/developers/docs/rich-presence/using-with-the-embedded-app-sdk#activity-partial-object). They're labeled with the object's keys to make it more clear how they appear in a Discord profile. +2. You can't set App Name when setting presence—it's always the name configured in your [app's settings](https://discord.com/developers/applications). +3. The state `(1 of max_party)` badge will only render when a party field is provided. Otherwise, state will be shown in a line of text below details. + +## Updating Presence + +When updating Rich Presence data using the Embedded App SDK, the only real command you need to use is **[`setActivity()`](/developers/docs/developer-tools/embedded-app-sdk#setactivity)**. Under the hood, `setActivity()` calls the RPC [`SET_ACTIVITY` command](/developers/docs/topics/rpc#setactivity) with the features and fields available when you're building an Activity. + + +As you start exploring the Rich Presence docs, you'll start seeing the word "activity" a *lot*. The "activities" referenced in docs (like the [RPC ones](/developers/docs/topics/rpc#setactivity)) aren't related to the Activities you're building with the Embedded App SDK. + +When Rich Presence was introduced, the underlying object that contains presence data was called an "activity" (long before the Embedded App SDK), which is what the RPC [`SET_ACTIVITY` command](/developers/docs/topics/rpc#setactivity) is referencing. And that's *also* why the Embedded App SDK's wrapper around the RPC command is called `setActivity()` yet isn't really related to setting the state for the kind of Activity that *you're* building. + +We know, it's confusing ¯\\\_(⊙︿⊙)\_/¯ — the naming was logical at the time because it was really about the user's activity in a 3rd party game or service, but now it sorta feels like activity-ception. Understanding the nuances here aren't super important, and it's why we have guides like this one. But as they say...the more you (at least sort of) know. + + +### rpc.activities.write Scope + +To display custom Rich Presence data for a user, your app will need to be authorized with the [`rpc.activities.write` scope](/developers/docs/topics/oauth2#shared-resources-oauth2-scopes) for that user. + +To request the scope, your [`authorize()`](/developers/docs/developer-tools/embedded-app-sdk#authorize) call might look something like this: + + + + +The following example only focuses on calling `authorize()`. Follow the [Building an Activity guide](/developers/docs/activities/building-an-activity) for more details on topics like installing and instantiating the Embedded App SDK. + + +```js +// Authorize with Discord Client +const { code } = await discordSdk.commands.authorize({ + client_id: import.meta.env.VITE_DISCORD_CLIENT_ID, + response_type: "code", + state: "", + prompt: "none", + scope: [ + "identify", + "rpc.activities.write" + ], +}); +``` + + +### setActivity Fields + +When calling [`setActivity()`](/developers/docs/developer-tools/embedded-app-sdk#setactivity), you are expected to pass a partial [activity object](/developers/docs/events/gateway-events#activity-object-activity-structure). + +Below is a table with many of the available fields for the activity partial. Some were left out since they don't have an effect for Activities. + +#### Activity partial object + + +All of the fields on the partial object are optional and nullable + + +| field | type | description | +|------------|-------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------| +| type | integer | [Activity](/developers/docs/events/gateway-events#activity-object-activity-types) type, which determines the header text for the Rich Presence data | +| state | string | User's current party status | +| details | string | What the player is currently doing in your Activity | +| timestamps | [timestamps](/developers/docs/events/gateway-events#activity-object-activity-timestamps) object | Unix timestamps to display start and/or end times | +| assets | [assets](/developers/docs/events/gateway-events#activity-object-activity-assets) object | Images used for the Rich Presence data (and their hover texts) | +| party | [party](/developers/docs/events/gateway-events#activity-object-activity-party) object | Information for the current party of the player | + +### setActivity Example + +Now let's take a look at more of a real example. Take a look at the Rich Presence data below that is for an Activity: + +![Example of a fake game's Rich Presence data](/images/rich-presence/activities-example.png) + +To create this sort of Rich Presence, here is what the `setActivity()` code would look like: + + + + +The following example only focuses on using `setActivity()`. Follow the [Building an Activity guide](/developers/docs/activities/building-an-activity) for more details on topics like instantiating the Embedded App SDK and authenticating users. + +```js +await discordSdk.commands.setActivity({ + activity: { + type: 0, + details: 'Traveling with a group', + state: 'In Mainframe', + assets: { + large_image: 'main-game-image', + large_text: 'in a group', + small_image: 'map-mainframe', + small_text: 'in mainframe' + }, + timestamps: { + start: 1723137832 + }, + party: { + size: [2,4] + } + } +}); +``` + + +## Using External Custom Assets + +Typically when building an Activity, you need to be aware of the proxy and [how to use external resources](/developers/docs/activities/development-guides/networking#using-external-resources). However, luckily for you (and the writer of this guide), image URLs in fields for features like Rich Presence don't need to jump through any extra hoops. + +As mentioned in the [Rich Presence overview](/developers/docs/rich-presence/overview#assets), you have more than 300 custom assets or if you want to use your stored images from somewhere else, you can specify an external URL for `large_image` or `small_image` within the `assets` object. + + + + +The following example only focuses on using `setActivity()`. Follow the [Building an Activity guide](/developers/docs/activities/building-an-activity) for more details on topics like instantiating the Embedded App SDK and authenticating users. + +```js +await discordSdk.commands.setActivity({ + activity: { + type: 2, + state: 'Broken Hearts and Code (club edit)', + details: 'DJ Wump', + assets: { + large_image: 'https://example.com/album-covers/dj-wump/broken-code-and-hearts-club-edit.jpg', + large_text: 'Listening to a track', + } + } +}); +``` + + diff --git a/docs/rich-presence/using-with-the-game-sdk.mdx b/discord/developers/docs/rich-presence/using-with-the-game-sdk.mdx similarity index 63% rename from docs/rich-presence/using-with-the-game-sdk.mdx rename to discord/developers/docs/rich-presence/using-with-the-game-sdk.mdx index bb9ce898b7..175d94d92c 100644 --- a/docs/rich-presence/using-with-the-game-sdk.mdx +++ b/discord/developers/docs/rich-presence/using-with-the-game-sdk.mdx @@ -1,32 +1,32 @@ --- -sidebar_label: Using with the Game SDK +title: Using Rich Presence with the Game SDK +sidebarTitle: Using with the Game SDK +tag: "LEGACY" --- -# Using Rich Presence with the Game SDK - -:::warn + **The Game SDK has been archived.** -We recommend using the [Discord Social SDK](/docs/discord-social-sdk/overview) for new projects. +We recommend using the [Discord Social SDK](/developers/docs/discord-social-sdk/overview) for new projects. -Existing projects using the Game SDK will continue to work, but we encourage you to migrate to the [Discord Social SDK](/docs/discord-social-sdk/overview) for new features and updates. -::: +Existing projects using the Game SDK will continue to work, but we encourage you to migrate to the [Discord Social SDK](/developers/docs/discord-social-sdk/overview) for new features and updates. + -The [Game SDK](/docs/developer-tools/game-sdk) helps you build 3rd party games and integrate them with Discord. One of its specialties is making it easy to bring your game's data to Discord using [Rich Presence](/docs/rich-presence/overview), which this guide will cover. +The [Game SDK](/developers/docs/developer-tools/game-sdk) helps you build 3rd party games and integrate them with Discord. One of its specialties is making it easy to bring your game's data to Discord using [Rich Presence](/developers/docs/rich-presence/overview), which this guide will cover. -Before we dig in, make sure you've gone through the guide on [Getting Started with the Game SDK](/docs/developer-tools/game-sdk#getting-started). This guide expects that you've already [downloaded the SDK](/docs/developer-tools/game-sdk#step-1-get-the-sdk), [configured your app](/docs/developer-tools/game-sdk#step-2-create-your-app), and [gotten up and running with a basic example](/docs/developer-tools/game-sdk#step-3-start-coding). +Before we dig in, make sure you've gone through the guide on [Getting Started with the Game SDK](/developers/docs/developer-tools/game-sdk#getting-started). This guide expects that you've already [downloaded the SDK](/developers/docs/developer-tools/game-sdk#step-1-get-the-sdk), [configured your app](/developers/docs/developer-tools/game-sdk#step-2-create-your-app), and [gotten up and running with a basic example](/developers/docs/developer-tools/game-sdk#step-3-start-coding). -:::info -Not sure if you should be building with the Game SDK? Read through [Choosing an SDK](/docs/rich-presence/overview#choosing-an-sdk) to understand your options when integrating Rich Presence. -::: + +Not sure if you should be building with the Game SDK? Read through [Choosing an SDK](/developers/docs/rich-presence/overview#choosing-an-sdk) to understand your options when integrating Rich Presence. + ## Understanding Rich Presence Data Before we dig in, it's helpful to understand what Rich Presence data you can set when updating a user's presence data. We'll explain the specific fields below, but for now let's just take a look at what we're working with: -![Graphical representation of the legend for rich presence details](images/rp-legend.webp) +![Graphical representation of the legend for rich presence details](/images/rich-presence/legend.png) - + | location | field name | notes | |----------------------------------------|----------------|----------------------------------------------------------------------------| | First row below title | details | | @@ -41,17 +41,17 @@ Before we dig in, it's helpful to understand what Rich Presence data you can set Note that this layout may be subject to change without warning. This information is only provided to help those with impaired eyesight to understand the potential layout of this information in a user interface. - + -:::info -For tips on designing Rich Presence, take a look at the [Rich Presence best practices guide](/docs/rich-presence/best-practices). -::: + +For tips on designing Rich Presence, take a look at the [Rich Presence best practices guide](/developers/docs/rich-presence/best-practices). + ## Activities Manager -As you likely learned when setting up your app, the Game SDK has a handful of specialized [manager classes](/docs/developer-tools/game-sdk#managers). The **[`ActivitiesManager`](/docs/developer-tools/game-sdk#activities)** is responsible for integrating Rich Presence and sending invites, so that's where we'll spend our focus in this guide. +As you likely learned when setting up your app, the Game SDK has a handful of specialized [manager classes](/developers/docs/developer-tools/game-sdk#managers). The **[`ActivitiesManager`](/developers/docs/developer-tools/game-sdk#activities)** is responsible for integrating Rich Presence and sending invites, so that's where we'll spend our focus in this guide. -Like other Game SDK managers, the `ActivitiesManager` class has a handful of [functions](/docs/developer-tools/game-sdk#functions) and [events](/docs/developer-tools/game-sdk#functions) that are used when building Rich Presence support. We'll touch on the ones important to presence below. +Like other Game SDK managers, the `ActivitiesManager` class has a handful of [functions](/developers/docs/developer-tools/game-sdk#functions) and [events](/developers/docs/developer-tools/game-sdk#functions) that are used when building Rich Presence support. We'll touch on the ones important to presence below. ### Fetching Activity Manager @@ -63,49 +63,49 @@ var activityManager = discord.GetActivityManager(); ## Updating Presence -The most important function when integrating Rich Presence using the Game SDK will be [`UpdateActivity()`](/docs/developer-tools/game-sdk#updateactivity). This is how you will send your game data to Discord to update a user's presence data. You should call `UpdateActivity()` any time something important in the presence payload changes. +The most important function when integrating Rich Presence using the Game SDK will be [`UpdateActivity()`](/developers/docs/developer-tools/game-sdk#updateactivity). This is how you will send your game data to Discord to update a user's presence data. You should call `UpdateActivity()` any time something important in the presence payload changes. ### UpdateActivity Fields -When calling `UpdateActivity()`, you'll be expected to pass the [activity](/docs/developer-tools/game-sdk#activity-struct) fields besides your `ApplicationId` and `Name` (which are both read-only). +When calling `UpdateActivity()`, you'll be expected to pass the [activity](/developers/docs/developer-tools/game-sdk#activity-struct) fields besides your `ApplicationId` and `Name` (which are both read-only). #### Partial Activity Struct Below are the fields we'll be paying attention to as we're passing presence data for a user. -:::info + All fields are optional and nullable -::: - -| Name | Type | Description | -|------------|--------------------------------------------------------------------------------|-----------------------------------------------------------------| -| State | string | the player's current party status | -| Details | string | what the player is currently doing | -| Timestamps | [ActivityTimestamps](/docs/developer-tools/game-sdk#activitytimestamps-struct) | helps create elapsed/remaining timestamps on a player's profile | -| Assets | [ActivityAssets](/docs/developer-tools/game-sdk#activityassets-struct) | assets to display on the player's profile | -| Party | [ActivityParty](/docs/developer-tools/game-sdk#activityparty-struct) | information about the player's party | -| Secrets | [ActivitySecrets](/docs/developer-tools/game-sdk#activitysecrets-struct) | secret passwords for joining the player's game | -| Instance | bool | whether this activity is an instanced context, like a match | + + +| Name | Type | Description | +|------------|-------------------------------------------------------------------------------------------|-----------------------------------------------------------------| +| State | string | the player's current party status | +| Details | string | what the player is currently doing | +| Timestamps | [ActivityTimestamps](/developers/docs/developer-tools/game-sdk#activitytimestamps-struct) | helps create elapsed/remaining timestamps on a player's profile | +| Assets | [ActivityAssets](/developers/docs/developer-tools/game-sdk#activityassets-struct) | assets to display on the player's profile | +| Party | [ActivityParty](/developers/docs/developer-tools/game-sdk#activityparty-struct) | information about the player's party | +| Secrets | [ActivitySecrets](/developers/docs/developer-tools/game-sdk#activitysecrets-struct) | secret passwords for joining the player's game | +| Instance | bool | whether this activity is an instanced context, like a match | ### UpdateActivity Example Now let's take a look at a code example for updating presence data. -:::info + All of the code samples in this guide are in C#, but there are some similar examples in other languages [on GitHub](https://github.com/msciotti/discord-game-sdk-test-apps). -::: + Our code sample in this section is based on the data from the example from before: -![Example of presence data with buttons](images/game-sdk-presence-example.png) +![Example of presence data with buttons](/images/rich-presence/game-sdk-example.png) The **Ask to Join** button will be covered more in the following sections, but if you don't want it included, you can remove the `Party` and `Secret` fields. - + -:::info -The following example only focuses on using `UpdateActivity()`. You can read the [Getting Started](/docs/developer-tools/game-sdk#getting-started) and [Using the SDK](/docs/developer-tools/game-sdk#using-the-sdk) sections for more general information about using the Game SDK. -::: + +The following example only focuses on using `UpdateActivity()`. You can read the [Getting Started](/developers/docs/developer-tools/game-sdk#getting-started) and [Using the SDK](/developers/docs/developer-tools/game-sdk#using-the-sdk) sections for more general information about using the Game SDK. + ```cs var activity = new Discord.Activity @@ -151,7 +151,7 @@ activityManager.UpdateActivity(activity, (result) => } }); ``` - + ## Asking to Join @@ -161,17 +161,17 @@ In the example above, there was an **Ask to Join** button that a user could clic To get the **Ask to Join** button to appear under the presence data for a 3rd party game, you should send along a few fields: `ActivityParty.Id`, `ActivityParty.Size.CurrentSize`, `ActivityParty.Size.MaxSize`, and `ActivitySecrets.Join`. -To see what you need for each Rich Presence feature, you can view the [Activity Action Field Requirements](/docs/developer-tools/game-sdk#activity-action-field-requirements) table. +To see what you need for each Rich Presence feature, you can view the [Activity Action Field Requirements](/developers/docs/developer-tools/game-sdk#activity-action-field-requirements) table. ### Handling Ask to Join -To listen for when someone clicks the button, you'll use the [`OnActivityJoinRequest` event](/docs/developer-tools/game-sdk#onactivityjoinrequest). This will include a [user](/docs/developer-tools/game-sdk#user-struct) for the individual that clicked the button. +To listen for when someone clicks the button, you'll use the [`OnActivityJoinRequest` event](/developers/docs/developer-tools/game-sdk#onactivityjoinrequest). This will include a [user](/developers/docs/developer-tools/game-sdk#user-struct) for the individual that clicked the button. As an example, let's say we updated Player A's presence data, and Player B found the **Ask to Join** button on their profile and proceeded to click it. At that point, your app will receive an `OnActivityJoinRequest`. Your game should surface this to Player A to confirm they wish to play with Player B. -After you confirm that Player A is game, you will call [`SendRequestReply`](/docs/developer-tools/game-sdk#sendrequestreply) with Player B's `userId` and a `reply` field with an [`ActivityJoinRequestReply` value](/docs/developer-tools/game-sdk#activityjoinrequestreply-enum). +After you confirm that Player A is game, you will call [`SendRequestReply`](/developers/docs/developer-tools/game-sdk#sendrequestreply) with Player B's `userId` and a `reply` field with an [`ActivityJoinRequestReply` value](/developers/docs/developer-tools/game-sdk#activityjoinrequestreply-enum). - + ```cs activityManager.OnActivityJoinRequest += user => @@ -186,10 +186,10 @@ activityManager.OnActivityJoinRequest += user => }); } ``` - + The **Ask to Join** request persists for 30 seconds after the request is received. Therefore, keep these two points in mind: -- Ensure you call [`RunCallbacks()`](/docs/developer-tools/game-sdk#runcallbacks) as frequently as possible to ensure your game client is up to date with any data from Discord +- Ensure you call [`RunCallbacks()`](/developers/docs/developer-tools/game-sdk#runcallbacks) as frequently as possible to ensure your game client is up to date with any data from Discord - If the player is in a state in which they cannot interact with an **Ask to Join** request—like in the middle of a match—you should not send `ActivitySecrets.Join` in the presence payload ## Secrets @@ -229,8 +229,8 @@ Currently, the SDK does not support this. Party slot information is determined b #### Q: Can I send images via the payload rather than uploading them to my app's settings? -Yes! In addition to uploading an asset and specifying its name, you can also specify an external image URL for us to proxy. For more information, see [Activity Asset Image](/docs/events/gateway-events#activity-object-activity-asset-image). +Yes! In addition to uploading an asset and specifying its name, you can also specify an external image URL for us to proxy. For more information, see [Activity Asset Image](/developers/docs/events/gateway-events#activity-object-activity-asset-image). #### Q: OK—I've got it working! Now, how do I make my integration look _awesome_? -I'm happy ~~we preempted your question~~ you asked! Check out our [Rich Presence Best Practices](/docs/rich-presence/best-practices) guide for a rundown on how to make your integration the best that it can be! +I'm happy ~~we preempted your question~~ you asked! Check out our [Rich Presence Best Practices](/developers/docs/rich-presence/best-practices) guide for a rundown on how to make your integration the best that it can be! diff --git a/docs/topics/certified-devices.md b/discord/developers/docs/topics/certified-devices.mdx similarity index 71% rename from docs/topics/certified-devices.md rename to discord/developers/docs/topics/certified-devices.mdx index 93e36d3bd3..fb1fcddd79 100644 --- a/docs/topics/certified-devices.md +++ b/discord/developers/docs/topics/certified-devices.mdx @@ -1,21 +1,28 @@ -# Certified Devices +--- +title: Certified Devices +description: Learn about Discord's Certified Device program for hardware integration. +--- + +import {ManualAnchor} from '/snippets/manualanchor.jsx' Baked into Discord is the ability for hardware manufacturers to tell us a little more about the certified devices that are plugged into a user's computer. Unfortunately, no, you can't show that a user's PUBG Chicken Dinner was all thanks to the amazing TotallyRealHardware RGB Mouse and Keyboard Set Extraordinaire™, but you _can_ give them an amazing experience using your hardware with Discord! + ## How's it work? I'm glad you asked! 1. [Create an application](https://discord.com/developers/applications) for your hardware vendor—save the Client ID! 2. Talk to Discord via one simple HTTP or WebSocket call -3. Send us a [`SET_CERTIFIED_DEVICES`](/docs/topics/rpc#setcertifieddevices) WebSocket payload or equivalent HTTP POST whenever the state of the device changes +3. Send us a [`SET_CERTIFIED_DEVICES`](/developers/docs/topics/rpc#setcertifieddevices) WebSocket payload or equivalent HTTP POST whenever the state of the device changes Yup, that's it. You give us the real-time info about any connected devices, and we'll handle the rest to make sure that anyone using your device will have an awesome experience. Your device will also have a `CERTIFIED` badge in Discord's audio settings, and really, who doesn't love badges? -![An example of how a certified device may be shown for an example audio input and output device](images/certified-device.webp) +![An example of how a certified device may be shown for an example audio input and output device](/images/certified-device.png) ## Connecting + ###### Query String Params | Name | Value | Required | @@ -26,12 +33,14 @@ Yup, that's it. You give us the real-time info about any connected devices, and You can send event updates to the following URIs: + ###### HTTP ``` http://127.0.0.1:PORT/rpc?v=1&client_id=YOUR_CLIENT_ID ``` + ###### WebSocket ``` @@ -48,10 +57,11 @@ Each time you update, send a full array of `devices`, sorted by your preferred p For each device in the `SET_CERTIFIED_DEVICES` payload, there is an `id` field. This `id` should be the Windows device's UUID, retrieved through the native Windows API. You'll get back something that looks like `{0.0.1.00000000}.{6cff2b76-44a8-46b9-b528-262ad8609d9f}`. -:::info + On macOS, the `id` will be the name of the device. -::: + + ###### Microphone Id Example ```cpp @@ -61,6 +71,7 @@ id = waveInMessage((HWAVEIN)IntToPtr(index), cbEndpointId); ``` + ###### Speaker Id Example ```cpp @@ -72,9 +83,10 @@ id = waveOutMessage((HWAVEIN)IntToPtr(index), ## HTTP Example + ###### HTTP Request Example -``` +```bash curl -X POST -H 'Content-Type: application/json' -d ' { "nonce": "9b4e9711-97f3-4f35-b047-32c82a51978e", @@ -106,6 +118,7 @@ curl -X POST -H 'Content-Type: application/json' -d ' The socket will respond with a `200 OK` status code and the following JSON. + ###### HTTP Response Example ```json @@ -119,6 +132,7 @@ The socket will respond with a `200 OK` status code and the following JSON. ## WebSocket Example + ###### RPC Command Example ```json @@ -149,6 +163,7 @@ The socket will respond with a `200 OK` status code and the following JSON. } ``` + ###### RPC Response Example ```json @@ -162,22 +177,24 @@ The socket will respond with a `200 OK` status code and the following JSON. ## Models + ###### Device Object -| Field | Type | Description | -|---------------------------|----------------------------------------------------------------------|----------------------------------------------------------| -| type | [device type](/docs/topics/certified-devices#models-device-type) | the type of device | -| id | string | the device's Windows UUID | -| vendor | [vendor](/docs/topics/certified-devices#models-vendor-object) object | the hardware vendor | -| model | [model](/docs/topics/certified-devices#models-model-object) object | the model of the product | -| related | array of strings | UUIDs of related devices | -| echo_cancellation?\* | boolean | if the device's native echo cancellation is enabled | -| noise_suppression?\* | boolean | if the device's native noise suppression is enabled | -| automatic_gain_control?\* | boolean | if the device's native automatic gain control is enabled | -| hardware_mute?\* | boolean | if the device is hardware muted | +| Field | Type | Description | +|---------------------------|---------------------------------------------------------------------------------|----------------------------------------------------------| +| type | [device type](/developers/docs/topics/certified-devices#models-device-type) | the type of device | +| id | string | the device's Windows UUID | +| vendor | [vendor](/developers/docs/topics/certified-devices#models-vendor-object) object | the hardware vendor | +| model | [model](/developers/docs/topics/certified-devices#models-model-object) object | the model of the product | +| related | array of strings | UUIDs of related devices | +| echo_cancellation?\* | boolean | if the device's native echo cancellation is enabled | +| noise_suppression?\* | boolean | if the device's native noise suppression is enabled | +| automatic_gain_control?\* | boolean | if the device's native automatic gain control is enabled | +| hardware_mute?\* | boolean | if the device is hardware muted | \*These fields are only applicable for `AUDIO_INPUT` device types + ###### Vendor Object | Field | Type | Description | @@ -185,6 +202,7 @@ The socket will respond with a `200 OK` status code and the following JSON. | name | string | name of the vendor | | url | string | url for the vendor | + ###### Model Object | Field | Type | Description | @@ -192,6 +210,7 @@ The socket will respond with a `200 OK` status code and the following JSON. | name | string | name of the model | | url | string | url for the model | + ###### Device Type | Type | Value | diff --git a/docs/topics/oauth2.mdx b/discord/developers/docs/topics/oauth2.mdx similarity index 69% rename from docs/topics/oauth2.mdx rename to discord/developers/docs/topics/oauth2.mdx index 33713ebad3..7ccadc295c 100644 --- a/docs/topics/oauth2.mdx +++ b/discord/developers/docs/topics/oauth2.mdx @@ -1,4 +1,10 @@ -# OAuth2 +--- +title: OAuth2 +description: Learn how to implement OAuth2 authentication flows for Discord apps. +--- + +import {ManualAnchor} from '/snippets/manualanchor.jsx' +import {Route} from '/snippets/route.jsx' OAuth2 enables application developers to build applications that utilize authentication and data from the Discord API. Within Discord, there are multiple types of OAuth2 authentication. We support the authorization code grant, the implicit grant, client credentials, and some modified special-for-Discord flows for Bots and Webhooks. @@ -6,6 +12,7 @@ OAuth2 enables application developers to build applications that utilize authent The first step in implementing OAuth2 is [registering a developer application](https://discord.com/developers/applications) and retrieving your client ID and client secret. Most people who will be implementing OAuth2 will want to find and utilize a library in the language of their choice. For those implementing OAuth2 from scratch, please see [RFC 6749](https://tools.ietf.org/html/rfc6749) for details. After you create your application with Discord, make sure that you have your `client_id` and `client_secret` handy. The next step is to figure out which OAuth2 flow is right for your purposes. + ###### OAuth2 URLs | URL | Description | @@ -14,48 +21,49 @@ The first step in implementing OAuth2 is [registering a developer application](h | https://discord.com/api/oauth2/token | Token URL | | https://discord.com/api/oauth2/token/revoke | [Token Revocation](https://tools.ietf.org/html/rfc7009) URL | -:::warn + In accordance with the relevant RFCs, the token and token revocation URLs will **only** accept a content type of `application/x-www-form-urlencoded`. JSON content is not permitted and will return an error. -::: + + ###### OAuth2 Scopes These are a list of all the OAuth2 scopes that Discord supports. Some scopes require approval from Discord to use. Requesting them from a user without approval from Discord may cause errors or undocumented behavior in the OAuth2 flow. -| Name | Description | -|------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| -| activities.read | allows your app to fetch data from a user's "Now Playing/Recently Played" list — not currently available for apps | -| activities.write | allows your app to update a user's activity - not currently available for apps (NOT REQUIRED FOR [GAMESDK ACTIVITY MANAGER](/docs/developer-tools/game-sdk#activities)) | -| applications.builds.read | allows your app to read build data for a user's applications | -| applications.builds.upload | allows your app to upload/update builds for a user's applications - requires Discord approval | -| applications.commands | allows your app to add [commands](/docs/interactions/application-commands) to a guild - included by default with the `bot` scope | -| applications.commands.update | allows your app to update its [commands](/docs/interactions/application-commands) using a Bearer token - [client credentials grant](/docs/topics/oauth2#client-credentials-grant) only | -| applications.commands.permissions.update | allows your app to update [permissions for its commands](/docs/interactions/application-commands#permissions) in a guild a user has permissions to | -| applications.entitlements | allows your app to read entitlements for a user's applications | -| applications.store.update | allows your app to read and update store data (SKUs, store listings, achievements, etc.) for a user's applications | -| bot | for oauth2 bots, this puts the bot in the user's selected guild by default | -| connections | allows [`/users/@me/connections`](/docs/resources/user#get-current-user-connections) to return linked third-party accounts | -| dm_channels.read | allows your app to see information about the user's DMs and group DMs - requires Discord approval | -| email | enables [`/users/@me`](/docs/resources/user#get-current-user) to return an `email` | -| gdm.join | allows your app to [join users to a group dm](/docs/resources/channel#group-dm-add-recipient) | -| guilds | allows [`/users/@me/guilds`](/docs/resources/user#get-current-user-guilds) to return basic information about all of a user's guilds | -| guilds.join | allows [`/guilds/{guild.id}/members/{user.id}`](/docs/resources/guild#add-guild-member) to be used for joining users to a guild | -| guilds.members.read | allows [`/users/@me/guilds/{guild.id}/member`](/docs/resources/user#get-current-user-guild-member) to return a user's member information in a guild | -| identify | allows [`/users/@me`](/docs/resources/user#get-current-user) without `email` | -| messages.read | for local rpc server api access, this allows you to read messages from all client channels (otherwise restricted to channels/guilds your app creates) | -| relationships.read | allows your app to know a user's friends and implicit relationships - requires Discord approval | -| role_connections.write | allows your app to update a user's connection and metadata for the app | -| rpc | for local rpc server access, this allows you to control a user's local Discord client - requires Discord approval | -| rpc.activities.write | for local rpc server access, this allows you to update a user's activity - requires Discord approval | -| rpc.notifications.read | for local rpc server access, this allows you to receive notifications pushed out to the user - requires Discord approval | -| rpc.voice.read | for local rpc server access, this allows you to read a user's voice settings and listen for voice events - requires Discord approval | -| rpc.voice.write | for local rpc server access, this allows you to update a user's voice settings - requires Discord approval | -| voice | allows your app to connect to voice on user's behalf and see all the voice members - requires Discord approval | -| webhook.incoming | this generates a webhook that is returned in the oauth token response for authorization code grants | - -:::info -In order to add a user to a guild, your bot has to already belong to that guild. `role_connections.write` cannot be used with the [Implicit grant type](/docs/topics/oauth2#implicit-grant). -::: +| Name | Description | +|------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| activities.read | allows your app to fetch data from a user's "Now Playing/Recently Played" list — not currently available for apps | +| activities.write | allows your app to update a user's activity - not currently available for apps (NOT REQUIRED FOR [GAMESDK ACTIVITY MANAGER](/developers/docs/developer-tools/game-sdk#activities)) | +| applications.builds.read | allows your app to read build data for a user's applications | +| applications.builds.upload | allows your app to upload/update builds for a user's applications - requires Discord approval | +| applications.commands | allows your app to add [commands](/developers/docs/interactions/application-commands) to a guild - included by default with the `bot` scope | +| applications.commands.update | allows your app to update its [commands](/developers/docs/interactions/application-commands) using a Bearer token - [client credentials grant](/developers/docs/topics/oauth2#client-credentials-grant) only | +| applications.commands.permissions.update | allows your app to update [permissions for its commands](/developers/docs/interactions/application-commands#permissions) in a guild a user has permissions to | +| applications.entitlements | allows your app to read entitlements for a user's applications | +| applications.store.update | allows your app to read and update store data (SKUs, store listings, achievements, etc.) for a user's applications | +| bot | for oauth2 bots, this puts the bot in the user's selected guild by default | +| connections | allows [`/users/@me/connections`](/developers/docs/resources/user#get-current-user-connections) to return linked third-party accounts | +| dm_channels.read | allows your app to see information about the user's DMs and group DMs - requires Discord approval | +| email | enables [`/users/@me`](/developers/docs/resources/user#get-current-user) to return an `email` | +| gdm.join | allows your app to [join users to a group dm](/developers/docs/resources/channel#group-dm-add-recipient) | +| guilds | allows [`/users/@me/guilds`](/developers/docs/resources/user#get-current-user-guilds) to return basic information about all of a user's guilds | +| guilds.join | allows [`/guilds/{guild.id}/members/{user.id}`](/developers/docs/resources/guild#add-guild-member) to be used for joining users to a guild | +| guilds.members.read | allows [`/users/@me/guilds/{guild.id}/member`](/developers/docs/resources/user#get-current-user-guild-member) to return a user's member information in a guild | +| identify | allows [`/users/@me`](/developers/docs/resources/user#get-current-user) without `email` | +| messages.read | for local rpc server api access, this allows you to read messages from all client channels (otherwise restricted to channels/guilds your app creates) | +| relationships.read | allows your app to know a user's friends and implicit relationships - requires Discord approval | +| role_connections.write | allows your app to update a user's connection and metadata for the app | +| rpc | for local rpc server access, this allows you to control a user's local Discord client - requires Discord approval | +| rpc.activities.write | for local rpc server access, this allows you to update a user's activity - requires Discord approval | +| rpc.notifications.read | for local rpc server access, this allows you to receive notifications pushed out to the user - requires Discord approval | +| rpc.voice.read | for local rpc server access, this allows you to read a user's voice settings and listen for voice events - requires Discord approval | +| rpc.voice.write | for local rpc server access, this allows you to update a user's voice settings - requires Discord approval | +| voice | allows your app to connect to voice on user's behalf and see all the voice members - requires Discord approval | +| webhook.incoming | this generates a webhook that is returned in the oauth token response for authorization code grants | + + +In order to add a user to a guild, your bot has to already belong to that guild. `role_connections.write` cannot be used with the [Implicit grant type](/developers/docs/topics/oauth2#implicit-grant). + ## State and Security @@ -71,32 +79,35 @@ The authorization code grant is what most developers will recognize as "standard All calls to the OAuth2 endpoints require either HTTP Basic authentication or `client_id` and `client_secret` supplied in the form data body. + ###### Authorization URL Example ``` https://discord.com/oauth2/authorize?response_type=code&client_id=157730590492196864&scope=identify%20guilds.join&state=15773059ghq9183habn&redirect_uri=https%3A%2F%2Fnicememe.website&prompt=consent&integration_type=0 ``` -`client_id` is your application's `client_id`. `scope` is a list of [OAuth2 scopes](/docs/topics/oauth2#shared-resources-oauth2-scopes) separated by url encoded spaces (`%20`). `redirect_uri` is whatever URL you registered when creating your application, url-encoded. `state` is the unique string mentioned in [State and Security](/docs/topics/oauth2#state-and-security). +`client_id` is your application's `client_id`. `scope` is a list of [OAuth2 scopes](/developers/docs/topics/oauth2#shared-resources-oauth2-scopes) separated by url encoded spaces (`%20`). `redirect_uri` is whatever URL you registered when creating your application, url-encoded. `state` is the unique string mentioned in [State and Security](/developers/docs/topics/oauth2#state-and-security). When someone navigates to this URL, they will be prompted to authorize your application for the requested scopes. On acceptance, they will be redirected to your `redirect_uri`, which will contain an additional querystring parameter, `code`. `state` will also be returned if previously sent, and should be validated at this point. `prompt` controls how the authorization flow handles existing authorizations. If a user has previously authorized your application with the requested scopes and prompt is set to `consent`, it will request them to reapprove their authorization. If set to `none`, it will skip the authorization screen and redirect them back to your redirect URI without requesting their authorization. For passthrough scopes, like `bot` and `webhook.incoming`, authorization is always required. -The `integration_type` parameter specifies the [installation context](/docs/resources/application#installation-context) for the authorization. The installation context determines where the application will be installed, and is only relevant when `scope` contains `applications.commands`. When set to 0 (GUILD_INSTALL) the application will be authorized for installation to a server, and when set to 1 (USER_INSTALL) the application will be authorized for installation to a user. The application must be configured in the Developer Portal to support the provided `integration_type`. +The `integration_type` parameter specifies the [installation context](/developers/docs/resources/application#installation-context) for the authorization. The installation context determines where the application will be installed, and is only relevant when `scope` contains `applications.commands`. When set to 0 (GUILD_INSTALL) the application will be authorized for installation to a server, and when set to 1 (USER_INSTALL) the application will be authorized for installation to a user. The application must be configured in the Developer Portal to support the provided `integration_type`. + ###### Redirect URL Example ``` https://nicememe.website/?code=NhhvTDYsFcdgNLnnLijcl7Ku7bEEeee&state=15773059ghq9183habn ``` -`code` is now exchanged for the user's access token by making a `POST` request to the [token URL](/docs/topics/oauth2#shared-resources-oauth2-urls) with the following parameters: +`code` is now exchanged for the user's access token by making a `POST` request to the [token URL](/developers/docs/topics/oauth2#shared-resources-oauth2-urls) with the following parameters: - `grant_type` - must be set to `authorization_code` - `code` - the code from the querystring - `redirect_uri` - the `redirect_uri` associated with this authorization, usually from your authorization URL + ###### Access Token Exchange Example ```python @@ -123,6 +134,7 @@ def exchange_code(code): In response, you will receive: + ###### Access Token Response ```json @@ -135,11 +147,12 @@ In response, you will receive: } ``` -Having the user's access token allows your application to make certain requests to the API on their behalf, restricted to whatever scopes were requested. `expires_in` is how long, in seconds, until the returned access token expires, allowing you to anticipate the expiration and refresh the token. To refresh, make another `POST` request to the [token URL](/docs/topics/oauth2#shared-resources-oauth2-urls) with the following parameters: +Having the user's access token allows your application to make certain requests to the API on their behalf, restricted to whatever scopes were requested. `expires_in` is how long, in seconds, until the returned access token expires, allowing you to anticipate the expiration and refresh the token. To refresh, make another `POST` request to the [token URL](/developers/docs/topics/oauth2#shared-resources-oauth2-urls) with the following parameters: - `grant_type` - must be set to `refresh_token` - `refresh_token` - the user's refresh token + ###### Refresh Token Exchange Example ```python @@ -162,18 +175,19 @@ def refresh_token(refresh_token): return r.json() ``` -Boom; fresh [access token response](/docs/topics/oauth2#authorization-code-grant-access-token-response)! +Boom; fresh [access token response](/developers/docs/topics/oauth2#authorization-code-grant-access-token-response)! + ###### Token Revocation Example -To disable an access or refresh token, you can revoke it by making a `POST` request to the [token revocation URL](/docs/topics/oauth2#shared-resources-oauth2-urls) with the following parameters: +To disable an access or refresh token, you can revoke it by making a `POST` request to the [token revocation URL](/developers/docs/topics/oauth2#shared-resources-oauth2-urls) with the following parameters: - `token` - the access token or refresh token to revoke - `token_type_hint` *(optional)* - the `token` parameter's type—either `access_token` or `refresh_token` -:::warn + When you revoke a token, any active access or refresh tokens associated with that authorization will be revoked, regardless of the `token` and `token_type_hint` values you pass in. -::: + ```python import requests @@ -199,14 +213,16 @@ Boom; the tokens are safely revoked. The implicit OAuth2 grant is a simplified flow optimized for in-browser clients. Instead of issuing the client an authorization code to be exchanged for an access token, the client is directly issued an access token. The URL is formatted as follows: + ###### Authorization URL Example ``` https://discord.com/oauth2/authorize?response_type=token&client_id=290926444748734499&state=15773059ghq9183habn&scope=identify ``` -On redirect, your redirect URI will contain additional **URI fragments**: `access_token`, `token_type`, `expires_in`, `scope`, and [`state`](/docs/topics/oauth2#state-and-security)(if specified). **These are not querystring parameters.** Be mindful of the "#" character: +On redirect, your redirect URI will contain additional **URI fragments**: `access_token`, `token_type`, `expires_in`, `scope`, and [`state`](/developers/docs/topics/oauth2#state-and-security)(if specified). **These are not querystring parameters.** Be mindful of the "#" character: + ###### Redirect URL Example ``` @@ -217,14 +233,15 @@ There are tradeoffs in using the implicit grant flow. It is both quicker and eas ## Client Credentials Grant -The client credential flow is a quick and easy way for bot developers to get their own bearer tokens for testing purposes. By making a `POST` request to the [token URL](/docs/topics/oauth2#shared-resources-oauth2-urls) with a grant type of `client_credentials`, using Basic authentication with your client id as the username and your client secret as the password, you will be returned an access token for the bot owner. Therefore, always be super-extra-very-we-are-not-kidding-like-really-be-secure-make-sure-your-info-is-not-in-your-source-code careful with your `client_id` and `client_secret`. We don't take kindly to imposters around these parts. +The client credential flow is a quick and easy way for bot developers to get their own bearer tokens for testing purposes. By making a `POST` request to the [token URL](/developers/docs/topics/oauth2#shared-resources-oauth2-urls) with a grant type of `client_credentials`, using Basic authentication with your client id as the username and your client secret as the password, you will be returned an access token for the bot owner. Therefore, always be super-extra-very-we-are-not-kidding-like-really-be-secure-make-sure-your-info-is-not-in-your-source-code careful with your `client_id` and `client_secret`. We don't take kindly to imposters around these parts. -You can specify scopes with the `scope` parameter, which is a list of [OAuth2 scopes](/docs/topics/oauth2#shared-resources-oauth2-scopes) separated by spaces: +You can specify scopes with the `scope` parameter, which is a list of [OAuth2 scopes](/developers/docs/topics/oauth2#shared-resources-oauth2-scopes) separated by spaces: -:::info + Team applications are limited to the `identify` and `applications.commands.update` scope, because teams are not bound to a specific user. -::: + + ###### Client Credentials Token Request Example ```python @@ -249,6 +266,7 @@ def get_token(): In return, you will receive an access token (without a refresh token): + ###### Client Credentials Access Token Response ```json @@ -262,43 +280,44 @@ In return, you will receive an access token (without a refresh token): ## Bot Users -Discord's API provides bot users, which are a separate type of user dedicated to automation. Bot users are automatically added to all apps, and are authenticated using the bot token found in your [app's settings](https://discord.com/developers/applications). Unlike the normal OAuth2 flow, bot users have full access to most API routes without using bearer tokens, and can connect to the [Real Time Gateway](/docs/events/gateway). +Discord's API provides bot users, which are a separate type of user dedicated to automation. Bot users are automatically added to all apps, and are authenticated using the bot token found in your [app's settings](https://discord.com/developers/applications). Unlike the normal OAuth2 flow, bot users have full access to most API routes without using bearer tokens, and can connect to the [Real Time Gateway](/developers/docs/events/gateway). ### Bot vs User Accounts -:::warn + Developers must abide by the [terms of service](https://support-dev.discord.com/hc/articles/8562894815383-Discord-Developer-Terms-of-Service), which includes refraining from automating standard user accounts (generally called "self-bots") outside of the OAuth2/bot API. -::: + Bot users have a few differences compared to standard Discord users: 1. Bots are added to guilds through the OAuth2 API, and cannot accept normal invites. 2. Bots cannot have friends or be added to or join Group DMs. 3. [Verified bots](https://support-dev.discord.com/hc/en-us/articles/23926564536471-How-Do-I-Get-My-App-Verified) do not have a maximum number of guilds. -4. Bots have an entirely separate set of [rate limits](/docs/topics/rate-limits#rate-limits). +4. Bots have an entirely separate set of [rate limits](/developers/docs/topics/rate-limits). ### Bot Authorization Flow Bot authorization is a special server-less and callback-less OAuth2 flow that makes it easy for users to add bots to guilds. The URL you create looks similar to what we use for full stack implementation: + ###### Bot Auth Parameters - -| name | description | -|----------------------|-----------------------------------------------------------------------| -| client_id | your app's client id | -| scope | needs to include `bot` for the bot flow | -| permissions | the [permissions](/docs/topics/permissions) you're requesting | -| guild_id | pre-fills the dropdown picker with a guild for the user | -| disable_guild_select | `true` or `false`—disallows the user from changing the guild dropdown | - +| name | description | +|----------------------|--------------------------------------------------------------------------| +| client_id | your app's client id | +| scope | needs to include `bot` for the bot flow | +| permissions | the [permissions](/developers/docs/topics/permissions) you're requesting | +| guild_id | pre-fills the dropdown picker with a guild for the user | +| disable_guild_select | `true` or `false`—disallows the user from changing the guild dropdown | + + ###### URL Example ``` https://discord.com/oauth2/authorize?client_id=157730590492196864&scope=bot&permissions=1 ``` -In the case of bots, the `scope` parameter should be set to `bot`. There's also a new parameter, `permissions`, which is an integer corresponding to the [permission calculations](/docs/topics/permissions#permissions-bitwise-permission-flags) for the bot. You'll also notice the absence of `response_type` and `redirect_uri`. Bot authorization does not require these parameters because there is no need to retrieve the user's access token. +In the case of bots, the `scope` parameter should be set to `bot`. There's also a new parameter, `permissions`, which is an integer corresponding to the [permission calculations](/developers/docs/topics/permissions#permissions-bitwise-permission-flags) for the bot. You'll also notice the absence of `response_type` and `redirect_uri`. Bot authorization does not require these parameters because there is no need to retrieve the user's access token. When the user navigates to this page, they'll be prompted to add the bot to a guild in which they have proper permissions. On acceptance, the bot will be added. Super easy! @@ -309,10 +328,11 @@ If your bot is super specific to your private clubhouse, or you just don't like ### Advanced Bot Authorization -Devs can extend the bot authorization functionality. You can request additional scopes outside of `bot` and `applications.commands`, which will prompt a continuation into a complete [authorization code grant flow](/docs/topics/oauth2#authorization-code-grant) and add the ability to request the user's access token. If you request any scopes outside of `bot` and `applications.commands`, `response_type` is again mandatory; we will also automatically redirect the user to the first URI in your application's registered list unless `redirect_uri` is specified. +Devs can extend the bot authorization functionality. You can request additional scopes outside of `bot` and `applications.commands`, which will prompt a continuation into a complete [authorization code grant flow](/developers/docs/topics/oauth2#authorization-code-grant) and add the ability to request the user's access token. If you request any scopes outside of `bot` and `applications.commands`, `response_type` is again mandatory; we will also automatically redirect the user to the first URI in your application's registered list unless `redirect_uri` is specified. -When receiving the access code on redirect, there will be additional querystring parameters of `guild_id` and `permissions`. The `guild_id` parameter should only be used as a hint as to the relationship between your bot and a guild. To be sure of the relationship between your bot and the guild, consider requiring the Oauth2 code grant in your bot's settings. Enabling it requires anyone adding your bot to a server to go through a full OAuth2 [authorization code grant flow](/docs/topics/oauth2#authorization-code-grant). When you retrieve the user's access token, you'll also receive information about the guild to which your bot was added: +When receiving the access code on redirect, there will be additional querystring parameters of `guild_id` and `permissions`. The `guild_id` parameter should only be used as a hint as to the relationship between your bot and a guild. To be sure of the relationship between your bot and the guild, consider requiring the Oauth2 code grant in your bot's settings. Enabling it requires anyone adding your bot to a server to go through a full OAuth2 [authorization code grant flow](/developers/docs/topics/oauth2#authorization-code-grant). When you retrieve the user's access token, you'll also receive information about the guild to which your bot was added: + ###### Extended Bot Authorization Access Token Example ```json @@ -374,20 +394,22 @@ When receiving the access code on redirect, there will be additional querystring ### Two-Factor Authentication Requirement -For bots with [elevated permissions](/docs/topics/permissions#permissions-bitwise-permission-flags) (permissions with a `*` next to them), we enforce two-factor authentication on the owner's account when added to guilds that have server-wide 2FA enabled. +For bots with [elevated permissions](/developers/docs/topics/permissions#permissions-bitwise-permission-flags) (permissions with a `*` next to them), we enforce two-factor authentication on the owner's account when added to guilds that have server-wide 2FA enabled. ## Webhooks -Discord's webhook flow is a specialized version of an [authorization code](/docs/topics/oauth2#authorization-code-grant) implementation. In this case, the `scope` querystring parameter needs to be set to `webhook.incoming`: +Discord's webhook flow is a specialized version of an [authorization code](/developers/docs/topics/oauth2#authorization-code-grant) implementation. In this case, the `scope` querystring parameter needs to be set to `webhook.incoming`: + ###### URL Example ``` https://discord.com/oauth2/authorize?response_type=code&client_id=157730590492196864&scope=webhook.incoming&state=15773059ghq9183habn&redirect_uri=https%3A%2F%2Fnicememe.website ``` -When the user navigates to this URL, they will be prompted to select a channel in which to allow the webhook. When the webhook is [executed](/docs/resources/webhook#execute-webhook), it will post its message into this channel. On acceptance, the user will be redirected to your `redirect_uri`. The URL will contain the `code` querystring parameter which should be [exchanged for an access token](/docs/topics/oauth2#authorization-code-grant-access-token-exchange-example). In return, you will receive a slightly modified token response: +When the user navigates to this URL, they will be prompted to select a channel in which to allow the webhook. When the webhook is [executed](/developers/docs/resources/webhook#execute-webhook), it will post its message into this channel. On acceptance, the user will be redirected to your `redirect_uri`. The URL will contain the `code` querystring parameter which should be [exchanged for an access token](/developers/docs/topics/oauth2#authorization-code-grant-access-token-exchange-example). In return, you will receive a slightly modified token response: + ###### Webhook Token Response Example ```json @@ -411,29 +433,30 @@ When the user navigates to this URL, they will be prompted to select a channel i } ``` -From this object, you should store the `webhook.token` and `webhook.id`. See the [execute webhook](/docs/resources/webhook#execute-webhook) documentation for how to send messages with the webhook. +From this object, you should store the `webhook.token` and `webhook.id`. See the [execute webhook](/developers/docs/resources/webhook#execute-webhook) documentation for how to send messages with the webhook. -Any user that wishes to add your webhook to their channel will need to go through the full OAuth2 flow. A new webhook is created each time, so you will need to save the token and id. If you wish to send a message to all your webhooks, you'll need to iterate over each stored id:token combination and make `POST` requests to each one. Be mindful of our [Rate Limits](/docs/topics/rate-limits#rate-limits)! +Any user that wishes to add your webhook to their channel will need to go through the full OAuth2 flow. A new webhook is created each time, so you will need to save the token and id. If you wish to send a message to all your webhooks, you'll need to iterate over each stored id:token combination and make `POST` requests to each one. Be mindful of our [Rate Limits](/developers/docs/topics/rate-limits)! ## Get Current Bot Application Information /oauth2/applications/@me -Returns the bot's [application](/docs/resources/application#application-object) object. +Returns the bot's [application](/developers/docs/resources/application#application-object) object. ## Get Current Authorization Information /oauth2/@me Returns info about the current authorization. Requires authentication with a bearer token. + ###### Response Structure - -| Field | Type | Description | -|-------------|------------------------------------------------------------------------------|-----------------------------------------------------------------------------------| -| application | partial [application](/docs/resources/application#application-object) object | the current application | -| scopes | array of strings | the scopes the user has authorized the application for | -| expires | ISO8601 timestamp | when the access token expires | -| user? | [user](/docs/resources/user#user-object) object | the user who has authorized, if the user has authorized with the `identify` scope | - +| Field | Type | Description | +|-------------|-----------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------| +| application | partial [application](/developers/docs/resources/application#application-object) object | the current application | +| scopes | array of strings | the scopes the user has authorized the application for | +| expires | ISO8601 timestamp | when the access token expires | +| user? | [user](/developers/docs/resources/user#user-object) object | the user who has authorized, if the user has authorized with the `identify` scope | + + ###### Example Authorization Information ```json diff --git a/docs/topics/opcodes-and-status-codes.md b/discord/developers/docs/topics/opcodes-and-status-codes.mdx similarity index 81% rename from docs/topics/opcodes-and-status-codes.md rename to discord/developers/docs/topics/opcodes-and-status-codes.mdx index 8dbdd38879..84dfebb9af 100644 --- a/docs/topics/opcodes-and-status-codes.md +++ b/discord/developers/docs/topics/opcodes-and-status-codes.mdx @@ -1,9 +1,15 @@ -# Opcodes and Status Codes +--- +title: Opcodes and Status Codes +description: Reference for Discord Gateway opcodes, voice opcodes, and HTTP response codes. +--- + +import {ManualAnchor} from '/snippets/manualanchor.jsx' ## Gateway All gateway events in Discord are tagged with an opcode that denotes the payload type. Your connection to our gateway may also sometimes close. When it does, you will receive a close code that tells you what happened. + ###### Gateway Opcodes | Code | Name | Client Action | Description | @@ -21,32 +27,34 @@ All gateway events in Discord are tagged with an opcode that denotes the payload | 11 | Heartbeat ACK | Receive | Sent in response to receiving a heartbeat to acknowledge that it has been received. | | 31 | Request Soundboard Sounds | Send | Request information about soundboard sounds in a set of guilds. | + ###### Gateway Close Event Codes In order to prevent broken reconnect loops, you should consider some close codes as a signal to stop reconnecting. This can be because your token expired, or your identification is invalid. This table explains what the application defined close codes for the gateway are, and which close codes you should not attempt to reconnect. -| Code | Description | Explanation | Reconnect | -|------|-----------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-----------| -| 4000 | Unknown error | We're not sure what went wrong. Try reconnecting? | true | -| 4001 | Unknown opcode | You sent an invalid [Gateway opcode](/docs/topics/opcodes-and-status-codes#gateway-gateway-opcodes) or an invalid payload for an opcode. Don't do that! | true | -| 4002 | Decode error | You sent an invalid [payload](/docs/events/gateway#sending-events) to Discord. Don't do that! | true | -| 4003 | Not authenticated | You sent us a payload prior to [identifying](/docs/events/gateway#identifying), or this session has been invalidated. | true | -| 4004 | Authentication failed | The account token sent with your [identify payload](/docs/events/gateway-events#identify) is incorrect. | false | -| 4005 | Already authenticated | You sent more than one identify payload. Don't do that! | true | -| 4007 | Invalid `seq` | The sequence sent when [resuming](/docs/events/gateway-events#resume) the session was invalid. Reconnect and start a new session. | true | -| 4008 | Rate limited | Woah nelly! You're sending payloads to us too quickly. Slow it down! You will be disconnected on receiving this. | true | -| 4009 | Session timed out | Your session timed out. Reconnect and start a new one. | true | -| 4010 | Invalid shard | You sent us an invalid [shard when identifying](/docs/events/gateway#sharding). | false | -| 4011 | Sharding required | The session would have handled too many guilds - you are required to [shard](/docs/events/gateway#sharding) your connection in order to connect. | false | -| 4012 | Invalid API version | You sent an invalid version for the gateway. | false | -| 4013 | Invalid intent(s) | You sent an invalid intent for a [Gateway Intent](/docs/events/gateway#gateway-intents). You may have incorrectly calculated the bitwise value. | false | -| 4014 | Disallowed intent(s) | You sent a disallowed intent for a [Gateway Intent](/docs/events/gateway#gateway-intents). You may have tried to specify an intent that you [have not enabled or are not approved for](/docs/events/gateway#privileged-intents). | false | +| Code | Description | Explanation | Reconnect | +|------|-----------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-----------| +| 4000 | Unknown error | We're not sure what went wrong. Try reconnecting? | true | +| 4001 | Unknown opcode | You sent an invalid [Gateway opcode](/developers/docs/topics/opcodes-and-status-codes#gateway-gateway-opcodes) or an invalid payload for an opcode. Don't do that! | true | +| 4002 | Decode error | You sent an invalid [payload](/developers/docs/events/gateway#sending-events) to Discord. Don't do that! | true | +| 4003 | Not authenticated | You sent us a payload prior to [identifying](/developers/docs/events/gateway#identifying), or this session has been invalidated. | true | +| 4004 | Authentication failed | The account token sent with your [identify payload](/developers/docs/events/gateway-events#identify) is incorrect. | false | +| 4005 | Already authenticated | You sent more than one identify payload. Don't do that! | true | +| 4007 | Invalid `seq` | The sequence sent when [resuming](/developers/docs/events/gateway-events#resume) the session was invalid. Reconnect and start a new session. | true | +| 4008 | Rate limited | Woah nelly! You're sending payloads to us too quickly. Slow it down! You will be disconnected on receiving this. | true | +| 4009 | Session timed out | Your session timed out. Reconnect and start a new one. | true | +| 4010 | Invalid shard | You sent us an invalid [shard when identifying](/developers/docs/events/gateway#sharding). | false | +| 4011 | Sharding required | The session would have handled too many guilds - you are required to [shard](/developers/docs/events/gateway#sharding) your connection in order to connect. | false | +| 4012 | Invalid API version | You sent an invalid version for the gateway. | false | +| 4013 | Invalid intent(s) | You sent an invalid intent for a [Gateway Intent](/developers/docs/events/gateway#gateway-intents). You may have incorrectly calculated the bitwise value. | false | +| 4014 | Disallowed intent(s) | You sent a disallowed intent for a [Gateway Intent](/developers/docs/events/gateway#gateway-intents). You may have tried to specify an intent that you [have not enabled or are not approved for](/developers/docs/events/gateway#privileged-intents). | false | ## Voice Our voice gateways have their own set of opcodes and close codes. + ###### Voice Opcodes | Code | Name | Sent By | Description | Binary | @@ -75,281 +83,284 @@ Our voice gateways have their own set of opcodes and close codes. | 30 | DAVE MLS Welcome | server | MLS Welcome to group for upcoming transition | X | | 31 | DAVE MLS Invalid Commit Welcome | client | Flag invalid commit or welcome, request re-add | | + ###### Voice Close Event Codes -| Code | Description | Explanation | -|------|-------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------| -| 4001 | Unknown opcode | You sent an invalid [opcode](/docs/topics/opcodes-and-status-codes#voice-voice-opcodes). | -| 4002 | Failed to decode payload | You sent an invalid payload in your [identifying](/docs/events/gateway-events#identify) to the Gateway. | -| 4003 | Not authenticated | You sent a payload before [identifying](/docs/events/gateway-events#identify) with the Gateway. | -| 4004 | Authentication failed | The token you sent in your [identify](/docs/events/gateway-events#identify) payload is incorrect. | -| 4005 | Already authenticated | You sent more than one [identify](/docs/events/gateway-events#identify) payload. Stahp. | -| 4006 | Session no longer valid | Your session is no longer valid. | -| 4009 | Session timeout | Your session has timed out. | -| 4011 | Server not found | We can't find the server you're trying to connect to. | -| 4012 | Unknown protocol | We didn't recognize the [protocol](/docs/topics/voice-connections#establishing-a-voice-udp-connection-example-select-protocol-payload) you sent. | -| 4014 | Disconnected | Disconnect individual client (you were kicked, the main gateway session was dropped, etc.). Should not reconnect. | -| 4015 | Voice server crashed | The server crashed. Our bad! Try [resuming](/docs/topics/voice-connections#resuming-voice-connection). | -| 4016 | Unknown encryption mode | We didn't recognize your [encryption](/docs/topics/voice-connections#transport-encryption-and-sending-voice). | -| 4020 | Bad request | You sent a malformed request | -| 4021 | Disconnected: Rate Limited | Disconnect due to rate limit exceeded. Should not reconnect. | -| 4022 | Disconnected: Call Terminated | Disconnect all clients due to call terminated (channel deleted, voice server changed, etc.). Should not reconnect. | +| Code | Description | Explanation | +|------|-------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------| +| 4001 | Unknown opcode | You sent an invalid [opcode](/developers/docs/topics/opcodes-and-status-codes#voice-voice-opcodes). | +| 4002 | Failed to decode payload | You sent an invalid payload in your [identifying](/developers/docs/events/gateway-events#identify) to the Gateway. | +| 4003 | Not authenticated | You sent a payload before [identifying](/developers/docs/events/gateway-events#identify) with the Gateway. | +| 4004 | Authentication failed | The token you sent in your [identify](/developers/docs/events/gateway-events#identify) payload is incorrect. | +| 4005 | Already authenticated | You sent more than one [identify](/developers/docs/events/gateway-events#identify) payload. Stahp. | +| 4006 | Session no longer valid | Your session is no longer valid. | +| 4009 | Session timeout | Your session has timed out. | +| 4011 | Server not found | We can't find the server you're trying to connect to. | +| 4012 | Unknown protocol | We didn't recognize the [protocol](/developers/docs/topics/voice-connections#establishing-a-voice-udp-connection-example-select-protocol-payload) you sent. | +| 4014 | Disconnected | Disconnect individual client (you were kicked, the main gateway session was dropped, etc.). Should not reconnect. | +| 4015 | Voice server crashed | The server crashed. Our bad! Try [resuming](/developers/docs/topics/voice-connections#resuming-voice-connection). | +| 4016 | Unknown encryption mode | We didn't recognize your [encryption](/developers/docs/topics/voice-connections#transport-encryption-and-sending-voice). | +| 4020 | Bad request | You sent a malformed request | +| 4021 | Disconnected: Rate Limited | Disconnect due to rate limit exceeded. Should not reconnect. | +| 4022 | Disconnected: Call Terminated | Disconnect all clients due to call terminated (channel deleted, voice server changed, etc.). Should not reconnect. | ## HTTP Our API will return semantically valid HTTP response codes based on the success of your request. The following table can be used as a reference for response codes it will return. + ###### HTTP Response Codes -| Code | Meaning | -|---------------------------|----------------------------------------------------------------------------------| -| 200 (OK) | The request completed successfully. | -| 201 (CREATED) | The entity was created successfully. | -| 204 (NO CONTENT) | The request completed successfully but returned no content. | -| 304 (NOT MODIFIED) | The entity was not modified (no action was taken). | -| 400 (BAD REQUEST) | The request was improperly formatted, or the server couldn't understand it. | -| 401 (UNAUTHORIZED) | The `Authorization` header was missing or invalid. | -| 403 (FORBIDDEN) | The `Authorization` token you passed did not have permission to the resource. | -| 404 (NOT FOUND) | The resource at the location specified doesn't exist. | -| 405 (METHOD NOT ALLOWED) | The HTTP method used is not valid for the location specified. | -| 429 (TOO MANY REQUESTS) | You are being rate limited, see [Rate Limits](/docs/topics/rate-limits). | -| 502 (GATEWAY UNAVAILABLE) | There was not a gateway available to process your request. Wait a bit and retry. | -| 5xx (SERVER ERROR) | The server had an error processing your request (these are rare). | +| Code | Meaning | +|---------------------------|-------------------------------------------------------------------------------------| +| 200 (OK) | The request completed successfully. | +| 201 (CREATED) | The entity was created successfully. | +| 204 (NO CONTENT) | The request completed successfully but returned no content. | +| 304 (NOT MODIFIED) | The entity was not modified (no action was taken). | +| 400 (BAD REQUEST) | The request was improperly formatted, or the server couldn't understand it. | +| 401 (UNAUTHORIZED) | The `Authorization` header was missing or invalid. | +| 403 (FORBIDDEN) | The `Authorization` token you passed did not have permission to the resource. | +| 404 (NOT FOUND) | The resource at the location specified doesn't exist. | +| 405 (METHOD NOT ALLOWED) | The HTTP method used is not valid for the location specified. | +| 429 (TOO MANY REQUESTS) | You are being rate limited, see [Rate Limits](/developers/docs/topics/rate-limits). | +| 502 (GATEWAY UNAVAILABLE) | There was not a gateway available to process your request. Wait a bit and retry. | +| 5xx (SERVER ERROR) | The server had an error processing your request (these are rare). | ## JSON -Along with the HTTP error code, our API can also return more detailed error codes through a `code` key in the JSON error response. The response will also contain a `message` key containing a more friendly error string. Some of these errors may include additional details in the form of [Error Messages](/docs/reference#error-messages) provided by an `errors` object. +Along with the HTTP error code, our API can also return more detailed error codes through a `code` key in the JSON error response. The response will also contain a `message` key containing a more friendly error string. Some of these errors may include additional details in the form of [Error Messages](/developers/docs/reference#error-messages) provided by an `errors` object. + ###### JSON Error Codes -| Code | Meaning | -|--------|-------------------------------------------------------------------------------------------------------------------------------| -| 0 | General error (such as a malformed request body, amongst other things) | -| 10001 | Unknown account | -| 10002 | Unknown application | -| 10003 | Unknown channel | -| 10004 | Unknown guild | -| 10005 | Unknown integration | -| 10006 | Unknown invite | -| 10007 | Unknown member | -| 10008 | Unknown message | -| 10009 | Unknown permission overwrite | -| 10010 | Unknown provider | -| 10011 | Unknown role | -| 10012 | Unknown token | -| 10013 | Unknown user | -| 10014 | Unknown emoji | -| 10015 | Unknown webhook | -| 10016 | Unknown webhook service | -| 10020 | Unknown session | -| 10021 | Unknown Asset | -| 10026 | Unknown ban | -| 10027 | Unknown SKU | -| 10028 | Unknown Store Listing | -| 10029 | Unknown entitlement | -| 10030 | Unknown build | -| 10031 | Unknown lobby | -| 10032 | Unknown branch | -| 10033 | Unknown store directory layout | -| 10036 | Unknown redistributable | -| 10038 | Unknown gift code | -| 10049 | Unknown stream | -| 10050 | Unknown premium server subscribe cooldown | -| 10057 | Unknown guild template | -| 10059 | Unknown discoverable server category | -| 10060 | Unknown sticker | -| 10061 | Unknown sticker pack | -| 10062 | Unknown interaction | -| 10063 | Unknown application command | -| 10065 | Unknown voice state | -| 10066 | Unknown application command permissions | -| 10067 | Unknown Stage Instance | -| 10068 | Unknown Guild Member Verification Form | -| 10069 | Unknown Guild Welcome Screen | -| 10070 | Unknown Guild Scheduled Event | -| 10071 | Unknown Guild Scheduled Event User | -| 10087 | Unknown Tag | -| 10097 | Unknown sound | -| 20001 | Bots cannot use this endpoint | -| 20002 | Only bots can use this endpoint | -| 20009 | Explicit content cannot be sent to the desired recipient(s) | -| 20012 | You are not authorized to perform this action on this application | -| 20016 | This action cannot be performed due to slowmode rate limit | -| 20018 | Only the owner of this account can perform this action | -| 20022 | This message cannot be edited due to announcement rate limits | -| 20024 | Under minimum age | -| 20028 | The channel you are writing has hit the write rate limit | -| 20029 | The write action you are performing on the server has hit the write rate limit | -| 20031 | Your Stage topic, server name, server description, or channel names contain words that are not allowed | -| 20035 | Guild premium subscription level too low | -| 30001 | Maximum number of guilds reached (100) | -| 30002 | Maximum number of friends reached (1000) | -| 30003 | Maximum number of pins reached for the channel (50) | -| 30004 | Maximum number of recipients reached (10) | -| 30005 | Maximum number of guild roles reached (250) | -| 30007 | Maximum number of webhooks reached (15) | -| 30008 | Maximum number of emojis reached | -| 30010 | Maximum number of reactions reached (20) | -| 30011 | Maximum number of group DMs reached (10) | -| 30013 | Maximum number of guild channels reached (500) | -| 30015 | Maximum number of attachments in a message reached (10) | -| 30016 | Maximum number of invites reached (1000) | -| 30018 | Maximum number of animated emojis reached | -| 30019 | Maximum number of server members reached | -| 30030 | Maximum number of server categories has been reached (5) | -| 30031 | Guild already has a template | -| 30032 | Maximum number of application commands reached | -| 30033 | Maximum number of thread participants has been reached (1000) | -| 30034 | Maximum number of daily application command creates has been reached (200) | -| 30035 | Maximum number of bans for non-guild members have been exceeded | -| 30037 | Maximum number of bans fetches has been reached | -| 30038 | Maximum number of uncompleted guild scheduled events reached (100) | -| 30039 | Maximum number of stickers reached | -| 30040 | Maximum number of prune requests has been reached. Try again later | -| 30042 | Maximum number of guild widget settings updates has been reached. Try again later | -| 30045 | Maximum number of soundboard sounds reached | -| 30046 | Maximum number of edits to messages older than 1 hour reached. Try again later | -| 30047 | Maximum number of pinned threads in a forum channel has been reached | -| 30048 | Maximum number of tags in a forum channel has been reached | -| 30052 | Bitrate is too high for channel of this type | -| 30056 | Maximum number of premium emojis reached (25) | -| 30058 | Maximum number of webhooks per guild reached (1000) | -| 30060 | Maximum number of channel permission overwrites reached (1000) | -| 30061 | The channels for this guild are too large | -| 40001 | Unauthorized. Provide a valid token and try again | -| 40002 | You need to verify your account in order to perform this action | -| 40003 | You are opening direct messages too fast | -| 40004 | Send messages has been temporarily disabled | -| 40005 | Request entity too large. Try sending something smaller in size | -| 40006 | This feature has been temporarily disabled server-side | -| 40007 | The user is banned from this guild | -| 40012 | Connection has been revoked | -| 40018 | Only consumable SKUs can be consumed | -| 40019 | You can only delete sandbox entitlements. | -| 40032 | Target user is not connected to voice | -| 40033 | This message has already been crossposted | -| 40041 | An application command with that name already exists | -| 40043 | Application interaction failed to send | -| 40058 | Cannot send a message in a forum channel | -| 40060 | Interaction has already been acknowledged | -| 40061 | Tag names must be unique | -| 40062 | Service resource is being rate limited | -| 40066 | There are no tags available that can be set by non-moderators | -| 40067 | A tag is required to create a forum post in this channel | -| 40074 | An entitlement has already been granted for this resource | -| 40094 | This interaction has hit the maximum number of follow up messages | -| 40333 | Cloudflare is blocking your request. This can often be resolved by setting a proper [User Agent](/docs/reference#user-agent) | -| 50001 | Missing access | -| 50002 | Invalid account type | -| 50003 | Cannot execute action on a DM channel | -| 50004 | Guild widget disabled | -| 50005 | Cannot edit a message authored by another user | -| 50006 | Cannot send an empty message | -| 50007 | Cannot send messages to this user | -| 50008 | Cannot send messages in a non-text channel | -| 50009 | Channel verification level is too high for you to gain access | -| 50010 | OAuth2 application does not have a bot | -| 50011 | OAuth2 application limit reached | -| 50012 | Invalid OAuth2 state | -| 50013 | You lack permissions to perform that action | -| 50014 | Invalid authentication token provided | -| 50015 | Note was too long | -| 50016 | Provided too few or too many messages to delete. Must provide at least 2 and fewer than 100 messages to delete | -| 50017 | Invalid MFA Level | -| 50019 | A message can only be pinned to the channel it was sent in | -| 50020 | Invite code was either invalid or taken | -| 50021 | Cannot execute action on a system message | -| 50024 | Cannot execute action on this channel type | -| 50025 | Invalid OAuth2 access token provided | -| 50026 | Missing required OAuth2 scope | -| 50027 | Invalid webhook token provided | -| 50028 | Invalid role | -| 50033 | Invalid Recipient(s) | -| 50034 | A message provided was too old to bulk delete | -| 50035 | Invalid form body (returned for both `application/json` and `multipart/form-data` bodies), or invalid `Content-Type` provided | -| 50036 | An invite was accepted to a guild the application's bot is not in | -| 50039 | Invalid Activity Action | -| 50041 | Invalid API version provided | -| 50045 | File uploaded exceeds the maximum size | -| 50046 | Invalid file uploaded | -| 50054 | Cannot self-redeem this gift | -| 50055 | Invalid Guild | -| 50057 | Invalid SKU | -| 50067 | Invalid request origin | -| 50068 | Invalid message type | -| 50070 | Payment source required to redeem gift | -| 50073 | Cannot modify a system webhook | -| 50074 | Cannot delete a channel required for Community guilds | -| 50080 | Cannot edit stickers within a message | -| 50081 | Invalid sticker sent | -| 50083 | Tried to perform an operation on an archived thread, such as editing a message or adding a user to the thread | -| 50084 | Invalid thread notification settings | -| 50085 | `before` value is earlier than the thread creation date | -| 50086 | Community server channels must be text channels | -| 50091 | The entity type of the event is different from the entity you are trying to start the event for | -| 50095 | This server is not available in your location | -| 50097 | This server needs monetization enabled in order to perform this action | -| 50101 | This server needs more boosts to perform this action | -| 50109 | The request body contains invalid JSON. | -| 50110 | The provided file is invalid. | -| 50123 | The provided file type is invalid. | -| 50124 | The provided file duration exceeds maximum of 5.2 seconds. | -| 50131 | Owner cannot be pending member | -| 50132 | Ownership cannot be transferred to a bot user | -| 50138 | Failed to resize asset below the maximum size: 262144 | -| 50144 | Cannot mix subscription and non subscription roles for an emoji | -| 50145 | Cannot convert between premium emoji and normal emoji | -| 50146 | Uploaded file not found. | -| 50151 | The specified emoji is invalid | -| 50159 | Voice messages do not support additional content. | -| 50160 | Voice messages must have a single audio attachment. | -| 50161 | Voice messages must have supporting metadata. | -| 50162 | Voice messages cannot be edited. | -| 50163 | Cannot delete guild subscription integration | -| 50173 | You cannot send voice messages in this channel. | -| 50178 | The user account must first be verified | -| 50192 | The provided file does not have a valid duration. | -| 50600 | You do not have permission to send this sticker. | -| 60003 | Two factor is required for this operation | -| 80004 | No users with DiscordTag exist | -| 90001 | Reaction was blocked | -| 90002 | User cannot use burst reactions | -| 110001 | Application not yet available. Try again later | -| 130000 | API resource is currently overloaded. Try again a little later | -| 150006 | The Stage is already open | -| 160002 | Cannot reply without permission to read message history | -| 160004 | A thread has already been created for this message | -| 160005 | Thread is locked | -| 160006 | Maximum number of active threads reached | -| 160007 | Maximum number of active announcement threads reached | -| 170001 | Invalid JSON for uploaded Lottie file | -| 170002 | Uploaded Lotties cannot contain rasterized images such as PNG or JPEG | -| 170003 | Sticker maximum framerate exceeded | -| 170004 | Sticker frame count exceeds maximum of 1000 frames | -| 170005 | Lottie animation maximum dimensions exceeded | -| 170006 | Sticker frame rate is either too small or too large | -| 170007 | Sticker animation duration exceeds maximum of 5 seconds | -| 180000 | Cannot update a finished event | -| 180002 | Failed to create stage needed for stage event | -| 200000 | Message was blocked by automatic moderation | -| 200001 | Title was blocked by automatic moderation | -| 220001 | Webhooks posted to forum channels must have a thread_name or thread_id | -| 220002 | Webhooks posted to forum channels cannot have both a thread_name and thread_id | -| 220003 | Webhooks can only create threads in forum channels | -| 220004 | Webhook services cannot be used in forum channels | -| 240000 | Message blocked by harmful links filter | -| 350000 | Cannot enable onboarding, requirements are not met | -| 350001 | Cannot update onboarding while below requirements | -| 400001 | Access to file uploads has been limited for this guild | -| 500000 | Failed to ban users | -| 520000 | Poll voting blocked | -| 520001 | Poll expired | -| 520002 | Invalid channel type for poll creation | -| 520003 | Cannot edit a poll message | -| 520004 | Cannot use an emoji included with the poll | -| 520006 | Cannot expire a non-poll message | +| Code | Meaning | +|--------|-----------------------------------------------------------------------------------------------------------------------------------------| +| 0 | General error (such as a malformed request body, amongst other things) | +| 10001 | Unknown account | +| 10002 | Unknown application | +| 10003 | Unknown channel | +| 10004 | Unknown guild | +| 10005 | Unknown integration | +| 10006 | Unknown invite | +| 10007 | Unknown member | +| 10008 | Unknown message | +| 10009 | Unknown permission overwrite | +| 10010 | Unknown provider | +| 10011 | Unknown role | +| 10012 | Unknown token | +| 10013 | Unknown user | +| 10014 | Unknown emoji | +| 10015 | Unknown webhook | +| 10016 | Unknown webhook service | +| 10020 | Unknown session | +| 10021 | Unknown Asset | +| 10026 | Unknown ban | +| 10027 | Unknown SKU | +| 10028 | Unknown Store Listing | +| 10029 | Unknown entitlement | +| 10030 | Unknown build | +| 10031 | Unknown lobby | +| 10032 | Unknown branch | +| 10033 | Unknown store directory layout | +| 10036 | Unknown redistributable | +| 10038 | Unknown gift code | +| 10049 | Unknown stream | +| 10050 | Unknown premium server subscribe cooldown | +| 10057 | Unknown guild template | +| 10059 | Unknown discoverable server category | +| 10060 | Unknown sticker | +| 10061 | Unknown sticker pack | +| 10062 | Unknown interaction | +| 10063 | Unknown application command | +| 10065 | Unknown voice state | +| 10066 | Unknown application command permissions | +| 10067 | Unknown Stage Instance | +| 10068 | Unknown Guild Member Verification Form | +| 10069 | Unknown Guild Welcome Screen | +| 10070 | Unknown Guild Scheduled Event | +| 10071 | Unknown Guild Scheduled Event User | +| 10087 | Unknown Tag | +| 10097 | Unknown sound | +| 20001 | Bots cannot use this endpoint | +| 20002 | Only bots can use this endpoint | +| 20009 | Explicit content cannot be sent to the desired recipient(s) | +| 20012 | You are not authorized to perform this action on this application | +| 20016 | This action cannot be performed due to slowmode rate limit | +| 20018 | Only the owner of this account can perform this action | +| 20022 | This message cannot be edited due to announcement rate limits | +| 20024 | Under minimum age | +| 20028 | The channel you are writing has hit the write rate limit | +| 20029 | The write action you are performing on the server has hit the write rate limit | +| 20031 | Your Stage topic, server name, server description, or channel names contain words that are not allowed | +| 20035 | Guild premium subscription level too low | +| 30001 | Maximum number of guilds reached (100) | +| 30002 | Maximum number of friends reached (1000) | +| 30003 | Maximum number of pins reached for the channel (50) | +| 30004 | Maximum number of recipients reached (10) | +| 30005 | Maximum number of guild roles reached (250) | +| 30007 | Maximum number of webhooks reached (15) | +| 30008 | Maximum number of emojis reached | +| 30010 | Maximum number of reactions reached (20) | +| 30011 | Maximum number of group DMs reached (10) | +| 30013 | Maximum number of guild channels reached (500) | +| 30015 | Maximum number of attachments in a message reached (10) | +| 30016 | Maximum number of invites reached (1000) | +| 30018 | Maximum number of animated emojis reached | +| 30019 | Maximum number of server members reached | +| 30030 | Maximum number of server categories has been reached (5) | +| 30031 | Guild already has a template | +| 30032 | Maximum number of application commands reached | +| 30033 | Maximum number of thread participants has been reached (1000) | +| 30034 | Maximum number of daily application command creates has been reached (200) | +| 30035 | Maximum number of bans for non-guild members have been exceeded | +| 30037 | Maximum number of bans fetches has been reached | +| 30038 | Maximum number of uncompleted guild scheduled events reached (100) | +| 30039 | Maximum number of stickers reached | +| 30040 | Maximum number of prune requests has been reached. Try again later | +| 30042 | Maximum number of guild widget settings updates has been reached. Try again later | +| 30045 | Maximum number of soundboard sounds reached | +| 30046 | Maximum number of edits to messages older than 1 hour reached. Try again later | +| 30047 | Maximum number of pinned threads in a forum channel has been reached | +| 30048 | Maximum number of tags in a forum channel has been reached | +| 30052 | Bitrate is too high for channel of this type | +| 30056 | Maximum number of premium emojis reached (25) | +| 30058 | Maximum number of webhooks per guild reached (1000) | +| 30060 | Maximum number of channel permission overwrites reached (1000) | +| 30061 | The channels for this guild are too large | +| 40001 | Unauthorized. Provide a valid token and try again | +| 40002 | You need to verify your account in order to perform this action | +| 40003 | You are opening direct messages too fast | +| 40004 | Send messages has been temporarily disabled | +| 40005 | Request entity too large. Try sending something smaller in size | +| 40006 | This feature has been temporarily disabled server-side | +| 40007 | The user is banned from this guild | +| 40012 | Connection has been revoked | +| 40018 | Only consumable SKUs can be consumed | +| 40019 | You can only delete sandbox entitlements. | +| 40032 | Target user is not connected to voice | +| 40033 | This message has already been crossposted | +| 40041 | An application command with that name already exists | +| 40043 | Application interaction failed to send | +| 40058 | Cannot send a message in a forum channel | +| 40060 | Interaction has already been acknowledged | +| 40061 | Tag names must be unique | +| 40062 | Service resource is being rate limited | +| 40066 | There are no tags available that can be set by non-moderators | +| 40067 | A tag is required to create a forum post in this channel | +| 40074 | An entitlement has already been granted for this resource | +| 40094 | This interaction has hit the maximum number of follow up messages | +| 40333 | Cloudflare is blocking your request. This can often be resolved by setting a proper [User Agent](/developers/docs/reference#user-agent) | +| 50001 | Missing access | +| 50002 | Invalid account type | +| 50003 | Cannot execute action on a DM channel | +| 50004 | Guild widget disabled | +| 50005 | Cannot edit a message authored by another user | +| 50006 | Cannot send an empty message | +| 50007 | Cannot send messages to this user | +| 50008 | Cannot send messages in a non-text channel | +| 50009 | Channel verification level is too high for you to gain access | +| 50010 | OAuth2 application does not have a bot | +| 50011 | OAuth2 application limit reached | +| 50012 | Invalid OAuth2 state | +| 50013 | You lack permissions to perform that action | +| 50014 | Invalid authentication token provided | +| 50015 | Note was too long | +| 50016 | Provided too few or too many messages to delete. Must provide at least 2 and fewer than 100 messages to delete | +| 50017 | Invalid MFA Level | +| 50019 | A message can only be pinned to the channel it was sent in | +| 50020 | Invite code was either invalid or taken | +| 50021 | Cannot execute action on a system message | +| 50024 | Cannot execute action on this channel type | +| 50025 | Invalid OAuth2 access token provided | +| 50026 | Missing required OAuth2 scope | +| 50027 | Invalid webhook token provided | +| 50028 | Invalid role | +| 50033 | Invalid Recipient(s) | +| 50034 | A message provided was too old to bulk delete | +| 50035 | Invalid form body (returned for both `application/json` and `multipart/form-data` bodies), or invalid `Content-Type` provided | +| 50036 | An invite was accepted to a guild the application's bot is not in | +| 50039 | Invalid Activity Action | +| 50041 | Invalid API version provided | +| 50045 | File uploaded exceeds the maximum size | +| 50046 | Invalid file uploaded | +| 50054 | Cannot self-redeem this gift | +| 50055 | Invalid Guild | +| 50057 | Invalid SKU | +| 50067 | Invalid request origin | +| 50068 | Invalid message type | +| 50070 | Payment source required to redeem gift | +| 50073 | Cannot modify a system webhook | +| 50074 | Cannot delete a channel required for Community guilds | +| 50080 | Cannot edit stickers within a message | +| 50081 | Invalid sticker sent | +| 50083 | Tried to perform an operation on an archived thread, such as editing a message or adding a user to the thread | +| 50084 | Invalid thread notification settings | +| 50085 | `before` value is earlier than the thread creation date | +| 50086 | Community server channels must be text channels | +| 50091 | The entity type of the event is different from the entity you are trying to start the event for | +| 50095 | This server is not available in your location | +| 50097 | This server needs monetization enabled in order to perform this action | +| 50101 | This server needs more boosts to perform this action | +| 50109 | The request body contains invalid JSON. | +| 50110 | The provided file is invalid. | +| 50123 | The provided file type is invalid. | +| 50124 | The provided file duration exceeds maximum of 5.2 seconds. | +| 50131 | Owner cannot be pending member | +| 50132 | Ownership cannot be transferred to a bot user | +| 50138 | Failed to resize asset below the maximum size: 262144 | +| 50144 | Cannot mix subscription and non subscription roles for an emoji | +| 50145 | Cannot convert between premium emoji and normal emoji | +| 50146 | Uploaded file not found. | +| 50151 | The specified emoji is invalid | +| 50159 | Voice messages do not support additional content. | +| 50160 | Voice messages must have a single audio attachment. | +| 50161 | Voice messages must have supporting metadata. | +| 50162 | Voice messages cannot be edited. | +| 50163 | Cannot delete guild subscription integration | +| 50173 | You cannot send voice messages in this channel. | +| 50178 | The user account must first be verified | +| 50192 | The provided file does not have a valid duration. | +| 50600 | You do not have permission to send this sticker. | +| 60003 | Two factor is required for this operation | +| 80004 | No users with DiscordTag exist | +| 90001 | Reaction was blocked | +| 90002 | User cannot use burst reactions | +| 110001 | Application not yet available. Try again later | +| 130000 | API resource is currently overloaded. Try again a little later | +| 150006 | The Stage is already open | +| 160002 | Cannot reply without permission to read message history | +| 160004 | A thread has already been created for this message | +| 160005 | Thread is locked | +| 160006 | Maximum number of active threads reached | +| 160007 | Maximum number of active announcement threads reached | +| 170001 | Invalid JSON for uploaded Lottie file | +| 170002 | Uploaded Lotties cannot contain rasterized images such as PNG or JPEG | +| 170003 | Sticker maximum framerate exceeded | +| 170004 | Sticker frame count exceeds maximum of 1000 frames | +| 170005 | Lottie animation maximum dimensions exceeded | +| 170006 | Sticker frame rate is either too small or too large | +| 170007 | Sticker animation duration exceeds maximum of 5 seconds | +| 180000 | Cannot update a finished event | +| 180002 | Failed to create stage needed for stage event | +| 200000 | Message was blocked by automatic moderation | +| 200001 | Title was blocked by automatic moderation | +| 220001 | Webhooks posted to forum channels must have a thread_name or thread_id | +| 220002 | Webhooks posted to forum channels cannot have both a thread_name and thread_id | +| 220003 | Webhooks can only create threads in forum channels | +| 220004 | Webhook services cannot be used in forum channels | +| 240000 | Message blocked by harmful links filter | +| 350000 | Cannot enable onboarding, requirements are not met | +| 350001 | Cannot update onboarding while below requirements | +| 500000 | Failed to ban users | +| 520000 | Poll voting blocked | +| 520001 | Poll expired | +| 520002 | Invalid channel type for poll creation | +| 520003 | Cannot edit a poll message | +| 520004 | Cannot use an emoji included with the poll | +| 520006 | Cannot expire a non-poll message | + ###### Example JSON Error Response ```json @@ -361,8 +372,9 @@ Along with the HTTP error code, our API can also return more detailed error code ## RPC -RPC is the [local Discord server](/docs/topics/rpc) running on localhost. Access to the RPC server requires approval from Discord. +RPC is the [local Discord server](/developers/docs/topics/rpc) running on localhost. Access to the RPC server requires approval from Discord. + ###### RPC Error Codes | Code | Name | Description | @@ -384,6 +396,7 @@ RPC is the [local Discord server](/docs/topics/rpc) running on localhost. Access | 5003 | Select voice force required | You tried to join a user to a voice channel but the user was already in one. | | 5004 | Capture shortcut already listening | You tried to capture more than one shortcut key at once. | + ###### RPC Close Event Codes | Code | Name | Description | diff --git a/docs/topics/permissions.md b/discord/developers/docs/topics/permissions.mdx similarity index 80% rename from docs/topics/permissions.md rename to discord/developers/docs/topics/permissions.mdx index 8736ce6fd8..fc995419ab 100644 --- a/docs/topics/permissions.md +++ b/discord/developers/docs/topics/permissions.mdx @@ -1,18 +1,23 @@ -# Permissions +--- +title: Permissions +description: Learn how Discord's permission system works including bitwise operations. +--- + +import {ManualAnchor} from '/snippets/manualanchor.jsx' Permissions are a way to limit and grant certain abilities to users in Discord. A set of base permissions can be configured at the guild level for different roles. When these roles are attached to users, they grant or revoke specific privileges within the guild. Along with the guild-level permissions, Discord also supports permission overwrites that can be assigned to individual roles or members on a per-channel basis. -:::info -[Application command permissions](/docs/interactions/application-commands#permissions) allow you to enable or disable specific commands for entire channels in addition to individual roles or users. -::: + +[Application command permissions](/developers/docs/interactions/application-commands#permissions) allow you to enable or disable specific commands for entire channels in addition to individual roles or users. + Permissions are stored in a variable-length integer serialized into a string, and are calculated using bitwise operations. For example, the permission value `123` will be serialized as `"123"`. For long-term stability, it's recommended to deserialize the permissions using your preferred languages' Big Integer libraries. The total permissions integer can be determined by OR-ing (`|`) together each individual value, and flags can be checked using AND (`&`) operations. In API v8 and above, all permissions are serialized as strings, including the `allow` and `deny` fields in overwrites. Any new permissions are rolled back into the base field. -:::info -In [API v6 (now deprecated)](/docs/reference), the `permissions`, `allow`, and `deny` fields in roles and overwrites are still serialized as a number; however, these numbers shall not grow beyond 31 bits. During the remaining lifetime of API v6, all new permission bits will only be introduced in `permissions_new`, `allow_new`, and `deny_new`. These `_new` fields are just for response serialization; requests with these fields should continue to use the original `permissions`, `allow`, and `deny` fields, which accept both string or number values. -::: + +In [API v6 (now deprecated)](/developers/docs/reference), the `permissions`, `allow`, and `deny` fields in roles and overwrites are still serialized as a number; however, these numbers shall not grow beyond 31 bits. During the remaining lifetime of API v6, all new permission bits will only be introduced in `permissions_new`, `allow_new`, and `deny_new`. These `_new` fields are just for response serialization; requests with these fields should continue to use the original `permissions`, `allow`, and `deny` fields, which accept both string or number values. + ```python # Permissions value that can Send Messages (0x800) and Add Reactions (0x40): @@ -30,60 +35,61 @@ Additional logic is required when permission overwrites are involved; this is fu Below is a table of all current permissions, their integer values in hexadecimal, brief descriptions of the privileges that they grant, and the channel type they apply to, if applicable. + ###### Bitwise Permission Flags -| Permission | Value | Description | Channel Type (Abbreviated) | -|----------------------------------------|----------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|----------------------------| -| CREATE_INSTANT_INVITE | `0x0000000000000001` `(1 << 0)` | Allows creation of instant invites | T, V, S | -| KICK_MEMBERS \* | `0x0000000000000002` `(1 << 1)` | Allows kicking members | | -| BAN_MEMBERS \* | `0x0000000000000004` `(1 << 2)` | Allows banning members | | -| ADMINISTRATOR \* | `0x0000000000000008` `(1 << 3)` | Allows all permissions and bypasses channel permission overwrites | | -| MANAGE_CHANNELS \* | `0x0000000000000010` `(1 << 4)` | Allows management and editing of channels | T, V, S | -| MANAGE_GUILD \* | `0x0000000000000020` `(1 << 5)` | Allows management and editing of the guild | | -| ADD_REACTIONS | `0x0000000000000040` `(1 << 6)` | Allows for adding new reactions to messages. This permission does not apply to reacting with an existing reaction on a message. | T, V, S | -| VIEW_AUDIT_LOG | `0x0000000000000080` `(1 << 7)` | Allows for viewing of audit logs | | -| PRIORITY_SPEAKER | `0x0000000000000100` `(1 << 8)` | Allows for using priority speaker in a voice channel | V | -| STREAM | `0x0000000000000200` `(1 << 9)` | Allows the user to go live | V, S | -| VIEW_CHANNEL | `0x0000000000000400` `(1 << 10)` | Allows guild members to view a channel, which includes reading messages in text channels and joining voice channels | T, V, S | -| SEND_MESSAGES | `0x0000000000000800` `(1 << 11)` | Allows for sending messages in a channel and creating threads in a forum (does not allow sending messages in threads) | T, V, S | -| SEND_TTS_MESSAGES | `0x0000000000001000` `(1 << 12)` | Allows for sending of `/tts` messages | T, V, S | -| MANAGE_MESSAGES \* | `0x0000000000002000` `(1 << 13)` | Allows for deletion of other users messages | T, V, S | -| EMBED_LINKS | `0x0000000000004000` `(1 << 14)` | Links sent by users with this permission will be auto-embedded | T, V, S | -| ATTACH_FILES | `0x0000000000008000` `(1 << 15)` | Allows for uploading images and files | T, V, S | -| READ_MESSAGE_HISTORY | `0x0000000000010000` `(1 << 16)` | Allows for reading of message history | T, V, S | -| MENTION_EVERYONE | `0x0000000000020000` `(1 << 17)` | Allows for using the `@everyone` tag to notify all users in a channel, and the `@here` tag to notify all online users in a channel | T, V, S | -| USE_EXTERNAL_EMOJIS | `0x0000000000040000` `(1 << 18)` | Allows the usage of custom emojis from other servers | T, V, S | -| VIEW_GUILD_INSIGHTS | `0x0000000000080000` `(1 << 19)` | Allows for viewing guild insights | | -| CONNECT | `0x0000000000100000` `(1 << 20)` | Allows for joining of a voice channel | V, S | -| SPEAK | `0x0000000000200000` `(1 << 21)` | Allows for speaking in a voice channel | V | -| MUTE_MEMBERS | `0x0000000000400000` `(1 << 22)` | Allows for muting members in a voice channel | V, S | -| DEAFEN_MEMBERS | `0x0000000000800000` `(1 << 23)` | Allows for deafening of members in a voice channel | V | -| MOVE_MEMBERS | `0x0000000001000000` `(1 << 24)` | Allows for moving of members between voice channels | V, S | -| USE_VAD | `0x0000000002000000` `(1 << 25)` | Allows for using voice-activity-detection in a voice channel | V | -| CHANGE_NICKNAME | `0x0000000004000000` `(1 << 26)` | Allows for modification of own nickname | | -| MANAGE_NICKNAMES | `0x0000000008000000` `(1 << 27)` | Allows for modification of other users nicknames | | -| MANAGE_ROLES \* | `0x0000000010000000` `(1 << 28)` | Allows management and editing of roles | T, V, S | -| MANAGE_WEBHOOKS \* | `0x0000000020000000` `(1 << 29)` | Allows management and editing of webhooks | T, V, S | -| MANAGE_GUILD_EXPRESSIONS \* | `0x0000000040000000` `(1 << 30)` | Allows for editing and deleting emojis, stickers, and soundboard sounds created by all users | | -| USE_APPLICATION_COMMANDS | `0x0000000080000000` `(1 << 31)` | Allows members to use application commands, including slash commands and context menu commands. | T, V, S | -| REQUEST_TO_SPEAK | `0x0000000100000000` `(1 << 32)` | Allows for requesting to speak in stage channels. (_This permission is under active development and may be changed or removed._) | S | -| MANAGE_EVENTS | `0x0000000200000000` `(1 << 33)` | Allows for editing and deleting scheduled events created by all users | V, S | -| MANAGE_THREADS \* | `0x0000000400000000` `(1 << 34)` | Allows for deleting and archiving threads, and viewing all private threads | T | -| CREATE_PUBLIC_THREADS | `0x0000000800000000` `(1 << 35)` | Allows for creating public and announcement threads | T | -| CREATE_PRIVATE_THREADS | `0x0000001000000000` `(1 << 36)` | Allows for creating private threads | T | -| USE_EXTERNAL_STICKERS | `0x0000002000000000` `(1 << 37)` | Allows the usage of custom stickers from other servers | T, V, S | -| SEND_MESSAGES_IN_THREADS | `0x0000004000000000` `(1 << 38)` | Allows for sending messages in threads | T | -| USE_EMBEDDED_ACTIVITIES | `0x0000008000000000` `(1 << 39)` | Allows for using Activities (applications with the `EMBEDDED` flag) | T, V | -| MODERATE_MEMBERS \*\* | `0x0000010000000000` `(1 << 40)` | Allows for timing out users to prevent them from sending or reacting to messages in chat and threads, and from speaking in voice and stage channels | | -| VIEW_CREATOR_MONETIZATION_ANALYTICS \* | `0x0000020000000000` `(1 << 41)` | Allows for viewing role subscription insights | | -| USE_SOUNDBOARD | `0x0000040000000000` `(1 << 42)` | Allows for using soundboard in a voice channel | V | -| CREATE_GUILD_EXPRESSIONS | `0x0000080000000000` `(1 << 43)` | Allows for creating emojis, stickers, and soundboard sounds, and editing and deleting those created by the current user. Not yet available to developers, [see changelog](/docs/change-log#clarification-on-permission-splits-for-expressions-and-events). | | -| CREATE_EVENTS | `0x0000100000000000` `(1 << 44)` | Allows for creating scheduled events, and editing and deleting those created by the current user. Not yet available to developers, [see changelog](/docs/change-log#clarification-on-permission-splits-for-expressions-and-events). | V, S | -| USE_EXTERNAL_SOUNDS | `0x0000200000000000` `(1 << 45)` | Allows the usage of custom soundboard sounds from other servers | V | -| SEND_VOICE_MESSAGES | `0x0000400000000000` `(1 << 46)` | Allows sending voice messages | T, V, S | -| SEND_POLLS | `0x0002000000000000` `(1 << 49)` | Allows sending polls | T, V, S | -| USE_EXTERNAL_APPS | `0x0004000000000000` `(1 << 50)` | Allows user-installed apps to send public responses. When disabled, users will still be allowed to use their apps but the responses will be ephemeral. This only applies to apps not also installed to the server. | T, V, S | -| PIN_MESSAGES | `0x0008000000000000` `(1 << 51)` | Allows pinning and unpinning messages | T | +| Permission | Value | Description | Channel Type (Abbreviated) | +|----------------------------------------|----------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|----------------------------| +| CREATE_INSTANT_INVITE | `0x0000000000000001` `(1 << 0)` | Allows creation of instant invites | T, V, S | +| KICK_MEMBERS \* | `0x0000000000000002` `(1 << 1)` | Allows kicking members | | +| BAN_MEMBERS \* | `0x0000000000000004` `(1 << 2)` | Allows banning members | | +| ADMINISTRATOR \* | `0x0000000000000008` `(1 << 3)` | Allows all permissions and bypasses channel permission overwrites | | +| MANAGE_CHANNELS \* | `0x0000000000000010` `(1 << 4)` | Allows management and editing of channels | T, V, S | +| MANAGE_GUILD \* | `0x0000000000000020` `(1 << 5)` | Allows management and editing of the guild | | +| ADD_REACTIONS | `0x0000000000000040` `(1 << 6)` | Allows for adding new reactions to messages. This permission does not apply to reacting with an existing reaction on a message. | T, V, S | +| VIEW_AUDIT_LOG | `0x0000000000000080` `(1 << 7)` | Allows for viewing of audit logs | | +| PRIORITY_SPEAKER | `0x0000000000000100` `(1 << 8)` | Allows for using priority speaker in a voice channel | V | +| STREAM | `0x0000000000000200` `(1 << 9)` | Allows the user to go live | V, S | +| VIEW_CHANNEL | `0x0000000000000400` `(1 << 10)` | Allows guild members to view a channel, which includes reading messages in text channels and joining voice channels | T, V, S | +| SEND_MESSAGES | `0x0000000000000800` `(1 << 11)` | Allows for sending messages in a channel and creating threads in a forum (does not allow sending messages in threads) | T, V, S | +| SEND_TTS_MESSAGES | `0x0000000000001000` `(1 << 12)` | Allows for sending of `/tts` messages | T, V, S | +| MANAGE_MESSAGES \* | `0x0000000000002000` `(1 << 13)` | Allows for deletion of other users messages | T, V, S | +| EMBED_LINKS | `0x0000000000004000` `(1 << 14)` | Links sent by users with this permission will be auto-embedded | T, V, S | +| ATTACH_FILES | `0x0000000000008000` `(1 << 15)` | Allows for uploading images and files | T, V, S | +| READ_MESSAGE_HISTORY | `0x0000000000010000` `(1 << 16)` | Allows for reading of message history | T, V, S | +| MENTION_EVERYONE | `0x0000000000020000` `(1 << 17)` | Allows for using the `@everyone` tag to notify all users in a channel, and the `@here` tag to notify all online users in a channel | T, V, S | +| USE_EXTERNAL_EMOJIS | `0x0000000000040000` `(1 << 18)` | Allows the usage of custom emojis from other servers | T, V, S | +| VIEW_GUILD_INSIGHTS | `0x0000000000080000` `(1 << 19)` | Allows for viewing guild insights | | +| CONNECT | `0x0000000000100000` `(1 << 20)` | Allows for joining of a voice channel | V, S | +| SPEAK | `0x0000000000200000` `(1 << 21)` | Allows for speaking in a voice channel | V | +| MUTE_MEMBERS | `0x0000000000400000` `(1 << 22)` | Allows for muting members in a voice channel | V, S | +| DEAFEN_MEMBERS | `0x0000000000800000` `(1 << 23)` | Allows for deafening of members in a voice channel | V | +| MOVE_MEMBERS | `0x0000000001000000` `(1 << 24)` | Allows for moving of members between voice channels | V, S | +| USE_VAD | `0x0000000002000000` `(1 << 25)` | Allows for using voice-activity-detection in a voice channel | V | +| CHANGE_NICKNAME | `0x0000000004000000` `(1 << 26)` | Allows for modification of own nickname | | +| MANAGE_NICKNAMES | `0x0000000008000000` `(1 << 27)` | Allows for modification of other users nicknames | | +| MANAGE_ROLES \* | `0x0000000010000000` `(1 << 28)` | Allows management and editing of roles | T, V, S | +| MANAGE_WEBHOOKS \* | `0x0000000020000000` `(1 << 29)` | Allows management and editing of webhooks | T, V, S | +| MANAGE_GUILD_EXPRESSIONS \* | `0x0000000040000000` `(1 << 30)` | Allows for editing and deleting emojis, stickers, and soundboard sounds created by all users | | +| USE_APPLICATION_COMMANDS | `0x0000000080000000` `(1 << 31)` | Allows members to use application commands, including slash commands and context menu commands. | T, V, S | +| REQUEST_TO_SPEAK | `0x0000000100000000` `(1 << 32)` | Allows for requesting to speak in stage channels. (_This permission is under active development and may be changed or removed._) | S | +| MANAGE_EVENTS | `0x0000000200000000` `(1 << 33)` | Allows for editing and deleting scheduled events created by all users | V, S | +| MANAGE_THREADS \* | `0x0000000400000000` `(1 << 34)` | Allows for deleting and archiving threads, and viewing all private threads | T | +| CREATE_PUBLIC_THREADS | `0x0000000800000000` `(1 << 35)` | Allows for creating public and announcement threads | T | +| CREATE_PRIVATE_THREADS | `0x0000001000000000` `(1 << 36)` | Allows for creating private threads | T | +| USE_EXTERNAL_STICKERS | `0x0000002000000000` `(1 << 37)` | Allows the usage of custom stickers from other servers | T, V, S | +| SEND_MESSAGES_IN_THREADS | `0x0000004000000000` `(1 << 38)` | Allows for sending messages in threads | T | +| USE_EMBEDDED_ACTIVITIES | `0x0000008000000000` `(1 << 39)` | Allows for using Activities (applications with the `EMBEDDED` flag) | T, V | +| MODERATE_MEMBERS \*\* | `0x0000010000000000` `(1 << 40)` | Allows for timing out users to prevent them from sending or reacting to messages in chat and threads, and from speaking in voice and stage channels | | +| VIEW_CREATOR_MONETIZATION_ANALYTICS \* | `0x0000020000000000` `(1 << 41)` | Allows for viewing role subscription insights | | +| USE_SOUNDBOARD | `0x0000040000000000` `(1 << 42)` | Allows for using soundboard in a voice channel | V | +| CREATE_GUILD_EXPRESSIONS | `0x0000080000000000` `(1 << 43)` | Allows for creating emojis, stickers, and soundboard sounds, and editing and deleting those created by the current user. Not yet available to developers, [see changelog](/developers/docs/change-log#clarification-on-permission-splits-for-expressions-and-events). | | +| CREATE_EVENTS | `0x0000100000000000` `(1 << 44)` | Allows for creating scheduled events, and editing and deleting those created by the current user. Not yet available to developers, [see changelog](/developers/docs/change-log#clarification-on-permission-splits-for-expressions-and-events). | V, S | +| USE_EXTERNAL_SOUNDS | `0x0000200000000000` `(1 << 45)` | Allows the usage of custom soundboard sounds from other servers | V | +| SEND_VOICE_MESSAGES | `0x0000400000000000` `(1 << 46)` | Allows sending voice messages | T, V, S | +| SEND_POLLS | `0x0002000000000000` `(1 << 49)` | Allows sending polls | T, V, S | +| USE_EXTERNAL_APPS | `0x0004000000000000` `(1 << 50)` | Allows user-installed apps to send public responses. When disabled, users will still be allowed to use their apps but the responses will be ephemeral. This only applies to apps not also installed to the server. | T, V, S | +| PIN_MESSAGES | `0x0008000000000000` `(1 << 51)` | Allows pinning and unpinning messages | T | | Channel Type (Abbreviated) | Description | Channel Types | |----------------------------|-------------|----------------------------------------------------------| @@ -91,9 +97,9 @@ Below is a table of all current permissions, their integer values in hexadecimal | V | Voice | GUILD_VOICE | | S | Stage | GUILD_STAGE_VOICE | -**\* These permissions require the owner account to use [two-factor authentication](/docs/topics/oauth2#twofactor-authentication-requirement) when used on a guild that has server-wide 2FA enabled.** +**\* These permissions require the owner account to use [two-factor authentication](/developers/docs/topics/oauth2#twofactor-authentication-requirement) when used on a guild that has server-wide 2FA enabled.** -**\*\* See [Permissions for Timed Out Members](/docs/topics/permissions#permissions-for-timed-out-members) to understand how permissions are temporarily modified for timed out users.** +**\*\* See [Permissions for Timed Out Members](/developers/docs/topics/permissions#permissions-for-timed-out-members) to understand how permissions are temporarily modified for timed out users.** Note that permission names may be referred to differently in the Discord client. For example, "Manage Permissions" refers to MANAGE_ROLES, "Use Voice Activity" refers to USE_VAD, and "Timeout Members" refers to MODERATE_MEMBERS. @@ -202,28 +208,30 @@ Permissions with regards to categories and channels within categories are a bit Roles represent a set of permissions attached to a group of users. Roles have names, colors, and can be "pinned" to the side bar, causing their members to be listed separately. Roles can have separate permission profiles for the global context (guild) and channel context. The `@everyone` role has the same ID as the guild it belongs to. + ###### Role Structure -| Field | Type | Description | -|----------------|-------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------| -| id | snowflake | role id | -| name | string | role name | -| color* | integer | **Deprecated** integer representation of hexadecimal color code | -| colors | [role colors](/docs/topics/permissions#role-object-role-colors-object) object | the role's colors | -| hoist | boolean | if this role is pinned in the user listing | -| icon? | ?string | role [icon hash](/docs/reference#image-formatting) | -| unicode_emoji? | ?string | role unicode emoji | -| position | integer | position of this role (roles with the same position are sorted by id) | -| permissions | string | permission bit set | -| managed | boolean | whether this role is managed by an integration | -| mentionable | boolean | whether this role is mentionable | -| tags? | [role tags](/docs/topics/permissions#role-object-role-tags-structure) object | the tags this role has | -| flags | integer | [role flags](/docs/topics/permissions#role-object-role-flags) combined as a [bitfield](https://en.wikipedia.org/wiki/Bit_field) | +| Field | Type | Description | +|----------------|------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------| +| id | snowflake | role id | +| name | string | role name | +| color* | integer | **Deprecated** integer representation of hexadecimal color code | +| colors | [role colors](/developers/docs/topics/permissions#role-object-role-colors-object) object | the role's colors | +| hoist | boolean | if this role is pinned in the user listing | +| icon? | ?string | role [icon hash](/developers/docs/reference#image-formatting) | +| unicode_emoji? | ?string | role unicode emoji | +| position | integer | position of this role (roles with the same position are sorted by id) | +| permissions | string | permission bit set | +| managed | boolean | whether this role is managed by an integration | +| mentionable | boolean | whether this role is mentionable | +| tags? | [role tags](/developers/docs/topics/permissions#role-object-role-tags-structure) object | the tags this role has | +| flags | integer | [role flags](/developers/docs/topics/permissions#role-object-role-flags) combined as a [bitfield](https://en.wikipedia.org/wiki/Bit_field) | Roles without colors (`colors.primary_color == 0`) do not count towards the final computed color in the user list. \* `color` will still be returned by the API, but using the `colors` field is recommended when doing requests. + ###### Role Tags Structure Tags with type `null` represent booleans. They will be present and set to `null` if they are "true", and will be not present if they are "false". @@ -237,9 +245,10 @@ Tags with type `null` represent booleans. They will be present and set to `null` | available_for_purchase? | null | whether this role is available for purchase | | guild_connections? | null | whether this role is a guild's linked role | + ###### Role Colors Object -This object will always be filled with `primary_color` being the role's `color`. Other fields can only be set to a non-null value if the guild has the `ENHANCED_ROLE_COLORS` [guild feature](/docs/resources/guild#guild-object-guild-features). +This object will always be filled with `primary_color` being the role's `color`. Other fields can only be set to a non-null value if the guild has the `ENHANCED_ROLE_COLORS` [guild feature](/developers/docs/resources/guild#guild-object-guild-features). | Field | Type | Description | |-----------------|----------|--------------------------------------------------------------------------------------------------------| @@ -247,11 +256,12 @@ This object will always be filled with `primary_color` being the role's `color`. | secondary_color | ?integer | the secondary color for the role, this will make the role a gradient between the other provided colors | | tertiary_color | ?integer | the tertiary color for the role, this will turn the gradient into a holographic style | -:::info + When sending `tertiary_color` the API enforces the role color to be a holographic style with values of: `primary_color = 11127295`, `secondary_color = 16759788`, and `tertiary_color = 16761760`. -::: + + ###### Default Role Colors Object ```json @@ -262,6 +272,7 @@ When sending `tertiary_color` the API enforces the role color to be a holographi } ``` + ###### Example Role ```json @@ -285,11 +296,12 @@ When sending `tertiary_color` the API enforces the role color to be a holographi } ``` + ###### Role Flags -| Flag | Value | Description | -|-----------|----------|----------------------------------------------------------------------------------------------------------| -| IN_PROMPT | `1 << 0` | role can be selected by members in an [onboarding](/docs/resources/guild#guild-onboarding-object) prompt | +| Flag | Value | Description | +|-----------|----------|---------------------------------------------------------------------------------------------------------------------| +| IN_PROMPT | `1 << 0` | role can be selected by members in an [onboarding](/developers/docs/resources/guild#guild-onboarding-object) prompt | ## Permissions For Timed Out Members diff --git a/docs/topics/rate-limits.md b/discord/developers/docs/topics/rate-limits.mdx similarity index 74% rename from docs/topics/rate-limits.md rename to discord/developers/docs/topics/rate-limits.mdx index dc86c61c1a..6f279056e1 100644 --- a/docs/topics/rate-limits.md +++ b/discord/developers/docs/topics/rate-limits.mdx @@ -1,25 +1,31 @@ -# Rate Limits +--- +title: Rate Limits +description: Understand Discord's rate limiting system including per-route and global limits. +--- + +import {ManualAnchor} from '/snippets/manualanchor.jsx' Rate limits exist across Discord's APIs to prevent spam, abuse, and service overload. Limits are applied to individual bots and users both on a per-route basis and globally. Individuals are determined using a request's authentication—for example, a bot token for a bot. -:::info -Because rate limits depend on a variety of factors and are subject to change, **rate limits should not be hard coded into your app**. Instead, your app should parse [response headers](/docs/topics/rate-limits#header-format-rate-limit-header-examples) to prevent hitting the limit, and to respond accordingly in case you do. -::: + +Because rate limits depend on a variety of factors and are subject to change, **rate limits should not be hard coded into your app**. Instead, your app should parse [response headers](/developers/docs/topics/rate-limits#header-format-rate-limit-header-examples) to prevent hitting the limit, and to respond accordingly in case you do. + **Per-route rate limits** exist for many individual endpoints, and may include the HTTP method (`GET`, `POST`, `PUT`, or `DELETE`). In some cases, per-route limits will be shared across a set of similar endpoints, indicated in the `X-RateLimit-Bucket` header. It's recommended to use this header as a unique identifier for a rate limit, which will allow you to group shared limits as you encounter them. -During calculation, per-route rate limits often account for top-level resources within the path using an identifier—for example, `guild_id` when calling [`/guilds/{guild.id}/channels`](/docs/resources/guild#get-guild-channels). Top-level resources are currently limited to channels (`channel_id`), guilds (`guild_id`), and webhooks (`webhook_id` or `webhook_id + webhook_token`). This means that an endpoint with two different top-level resources may calculate limits independently. As an example, if you exceeded a rate limit when calling one endpoint `/channels/1234`, you could still call another similar endpoint like `/channels/9876` without a problem. +During calculation, per-route rate limits often account for top-level resources within the path using an identifier—for example, `guild_id` when calling [`/guilds/{guild.id}/channels`](/developers/docs/resources/guild#get-guild-channels). Top-level resources are currently limited to channels (`channel_id`), guilds (`guild_id`), and webhooks (`webhook_id` or `webhook_id + webhook_token`). This means that an endpoint with two different top-level resources may calculate limits independently. As an example, if you exceeded a rate limit when calling one endpoint `/channels/1234`, you could still call another similar endpoint like `/channels/9876` without a problem. -**Global rate limits** apply to the total number of requests a bot or user makes, independent of any per-route limits. You can read more on [global rate limits](/docs/topics/rate-limits#global-rate-limit) below. +**Global rate limits** apply to the total number of requests a bot or user makes, independent of any per-route limits. You can read more on [global rate limits](/developers/docs/topics/rate-limits#global-rate-limit) below. -:::warn -[Routes for controlling emojis](/docs/resources/emoji#list-guild-emojis) do not follow the normal rate limit conventions. These routes are specifically limited on a per-guild basis to prevent abuse. This means that the quota returned by our APIs may be inaccurate, and you may encounter 429s. -::: + +[Routes for controlling emojis](/developers/docs/resources/emoji#list-guild-emojis) do not follow the normal rate limit conventions. These routes are specifically limited on a per-guild basis to prevent abuse. This means that the quota returned by our APIs may be inaccurate, and you may encounter 429s. + ## Header Format For most API requests made, we return optional HTTP response headers containing the rate limit encountered during your request. + ###### Rate Limit Header Examples ``` @@ -42,17 +48,19 @@ X-RateLimit-Bucket: abcd1234 In the case that a rate limit is exceeded, the API will return a HTTP 429 response code with a JSON body. Your application should rely on the `Retry-After` header or `retry_after` field to determine when to retry the request. + ###### Rate Limit Response Structure -| Field | Type | Description | -|-------------|---------|-----------------------------------------------------------------------------| -| message | string | A message saying you are being rate limited. | -| retry_after | float | The number of seconds to wait before submitting another request. | -| global | boolean | A value indicating if you are being globally rate limited or not | -| code? | integer | An [error code](/docs/topics/opcodes-and-status-codes#json) for some limits | +| Field | Type | Description | +|-------------|---------|----------------------------------------------------------------------------------------| +| message | string | A message saying you are being rate limited. | +| retry_after | float | The number of seconds to wait before submitting another request. | +| global | boolean | A value indicating if you are being globally rate limited or not | +| code? | integer | An [error code](/developers/docs/topics/opcodes-and-status-codes#json) for some limits | Note that normal route rate-limiting headers will also be sent in this response. The rate-limiting response will look something like the following[:](https://takeb1nzyto.space/) + ###### Example Exceeded User Rate Limit Response ``` @@ -73,6 +81,7 @@ Note that normal route rate-limiting headers will also be sent in this response. ``` + ###### Example Exceeded Resource Rate Limit Response ``` @@ -92,6 +101,7 @@ Note that normal route rate-limiting headers will also be sent in this response. } ``` + ###### Example Exceeded Global Rate Limit Response ``` @@ -115,7 +125,7 @@ Global rate limit issues generally show up as repeatedly getting banned from the If you are experiencing repeated Cloudflare bans from the Discord API within normal operations of your bot, you can reach out to support to see if you qualify for increased global rate limits. You can contact Discord support using [https://dis.gd/rate-limit](https://dis.gd/rate-limit). -[Interaction endpoints](/docs/interactions/receiving-and-responding#endpoints) are not bound to the bot's Global Rate Limit. +[Interaction endpoints](/developers/docs/interactions/receiving-and-responding#endpoints) are not bound to the bot's Global Rate Limit. ## Invalid Request Limit aka Cloudflare bans diff --git a/docs/topics/rpc.md b/discord/developers/docs/topics/rpc.mdx similarity index 59% rename from docs/topics/rpc.md rename to discord/developers/docs/topics/rpc.mdx index bd9f3cb4ae..a93353e9bb 100644 --- a/docs/topics/rpc.md +++ b/discord/developers/docs/topics/rpc.mdx @@ -1,11 +1,18 @@ -# RPC +--- +title: RPC +description: Learn about Discord's Rich Presence Client (RPC) for local application integration. +--- -:::danger +import {ManualAnchor} from '/snippets/manualanchor.jsx' + + + For now, RPC is in a private beta. We are not currently accepting any new developers into the program at this time. -::: + All Discord clients have an RPC server running on localhost that allows control over local Discord clients. + ###### RPC Versions | Version | Out of Service | @@ -14,21 +21,22 @@ All Discord clients have an RPC server running on localhost that allows control ## Restrictions -For connections to the RPC server, a [list of approved testers](/docs/topics/rpc#authorize) is used to restrict access while you're still developing. You can invite up to 50 people. +For connections to the RPC server, a [list of approved testers](/developers/docs/topics/rpc#authorize) is used to restrict access while you're still developing. You can invite up to 50 people. For applications/games not approved, we limit you to creating 10 guilds and 10 channels. This limit is raised to virtually unlimited after approval. ## Payloads + ###### Payload Structure -| Field | Type | Description | Present | -|-------|--------|-----------------------------------------------------------------------|----------------------------------------------------------| -| cmd | enum | [payload command](/docs/topics/rpc#commands-and-events-rpc-commands) | Always | -| nonce | string | unique string used once for replies from the server | In responses to commands (not subscribed events) | -| evt | enum | [subscription event](/docs/topics/rpc#commands-and-events-rpc-events) | In subscribed events, errors, and (un)subscribing events | -| data | object | event data | In responses from the server | -| args | object | command arguments | In commands sent to the server | +| Field | Type | Description | Present | +|-------|--------|----------------------------------------------------------------------------------|----------------------------------------------------------| +| cmd | enum | [payload command](/developers/docs/topics/rpc#commands-and-events-rpc-commands) | Always | +| nonce | string | unique string used once for replies from the server | In responses to commands (not subscribed events) | +| evt | enum | [subscription event](/developers/docs/topics/rpc#commands-and-events-rpc-events) | In subscribed events, errors, and (un)subscribing events | +| data | object | event data | In responses from the server | +| args | object | command arguments | In commands sent to the server | ## Connecting @@ -55,8 +63,9 @@ The port range for Discord's local RPC server is [6463, 6472]. Since the RPC ser ## Authenticating -In order to call any commands over RPC, you must be authenticated or you will receive a code `4006` error response. Thankfully, we've removed the oppressive nature of a couple commands that will let you `AUTHORIZE` and `AUTHENTICATE` new users. First, call [AUTHORIZE](/docs/topics/rpc#authorize): +In order to call any commands over RPC, you must be authenticated or you will receive a code `4006` error response. Thankfully, we've removed the oppressive nature of a couple commands that will let you `AUTHORIZE` and `AUTHENTICATE` new users. First, call [AUTHORIZE](/developers/docs/topics/rpc#authorize): + ###### RPC Authorize Example ```json @@ -70,8 +79,9 @@ In order to call any commands over RPC, you must be authenticated or you will re } ``` -The user will then be prompted to authorize your app to access RPC on Discord. The `AUTHORIZE` command returns a `code` that you can exchange with a POST to `https://discord.com/api/oauth2/token` containing the [standard OAuth2 body parameters](https://tools.ietf.org/html/rfc6749#section-4.1.3) for the token exchange. The token endpoint on our API will return an `access_token` that can be sent with [AUTHENTICATE](/docs/topics/rpc#authenticate): +The user will then be prompted to authorize your app to access RPC on Discord. The `AUTHORIZE` command returns a `code` that you can exchange with a POST to `https://discord.com/api/oauth2/token` containing the [standard OAuth2 body parameters](https://tools.ietf.org/html/rfc6749#section-4.1.3) for the token exchange. The token endpoint on our API will return an `access_token` that can be sent with [AUTHENTICATE](/developers/docs/topics/rpc#authenticate): + ###### RPC Authenticate Example ```json @@ -90,56 +100,58 @@ You can now call RPC commands on behalf of the authorized user! Commands are requests made to the RPC socket by a client. + ###### RPC Commands -| Name | Description | -|------------------------------------------------------------------------|-----------------------------------------------------------------| -| [DISPATCH](/docs/topics/rpc#commands-and-events-rpc-events) | event dispatch | -| [AUTHORIZE](/docs/topics/rpc#authorize) | used to authorize a new client with your app | -| [AUTHENTICATE](/docs/topics/rpc#authenticate) | used to authenticate an existing client with your app | -| [GET_GUILD](/docs/topics/rpc#getguild) | used to retrieve guild information from the client | -| [GET_GUILDS](/docs/topics/rpc#getguilds) | used to retrieve a list of guilds from the client | -| [GET_CHANNEL](/docs/topics/rpc#getchannel) | used to retrieve channel information from the client | -| [GET_CHANNELS](/docs/topics/rpc#getchannels) | used to retrieve a list of channels for a guild from the client | -| [SUBSCRIBE](/docs/topics/rpc#subscribe) | used to subscribe to an RPC event | -| [UNSUBSCRIBE](/docs/topics/rpc#unsubscribe) | used to unsubscribe from an RPC event | -| [SET_USER_VOICE_SETTINGS](/docs/topics/rpc#setuservoicesettings) | used to change voice settings of users in voice channels | -| [SELECT_VOICE_CHANNEL](/docs/topics/rpc#selectvoicechannel) | used to join or leave a voice channel, group dm, or dm | -| [GET_SELECTED_VOICE_CHANNEL](/docs/topics/rpc#getselectedvoicechannel) | used to get the current voice channel the client is in | -| [SELECT_TEXT_CHANNEL](/docs/topics/rpc#selecttextchannel) | used to join or leave a text channel, group dm, or dm | -| [GET_VOICE_SETTINGS](/docs/topics/rpc#getvoicesettings) | used to retrieve the client's voice settings | -| [SET_VOICE_SETTINGS](/docs/topics/rpc#setvoicesettings) | used to set the client's voice settings | -| [SET_CERTIFIED_DEVICES](/docs/topics/rpc#setcertifieddevices) | used to send info about certified hardware devices | -| [SET_ACTIVITY](/docs/topics/rpc#setactivity) | used to update a user's Rich Presence | -| [SEND_ACTIVITY_JOIN_INVITE](/docs/topics/rpc#sendactivityjoininvite) | used to consent to a Rich Presence Ask to Join request | -| [CLOSE_ACTIVITY_REQUEST](/docs/topics/rpc#closeactivityrequest) | used to reject a Rich Presence Ask to Join request | +| Name | Description | +|-----------------------------------------------------------------------------------|-----------------------------------------------------------------| +| [DISPATCH](/developers/docs/topics/rpc#commands-and-events-rpc-events) | event dispatch | +| [AUTHORIZE](/developers/docs/topics/rpc#authorize) | used to authorize a new client with your app | +| [AUTHENTICATE](/developers/docs/topics/rpc#authenticate) | used to authenticate an existing client with your app | +| [GET_GUILD](/developers/docs/topics/rpc#getguild) | used to retrieve guild information from the client | +| [GET_GUILDS](/developers/docs/topics/rpc#getguilds) | used to retrieve a list of guilds from the client | +| [GET_CHANNEL](/developers/docs/topics/rpc#getchannel) | used to retrieve channel information from the client | +| [GET_CHANNELS](/developers/docs/topics/rpc#getchannels) | used to retrieve a list of channels for a guild from the client | +| [SUBSCRIBE](/developers/docs/topics/rpc#subscribe) | used to subscribe to an RPC event | +| [UNSUBSCRIBE](/developers/docs/topics/rpc#unsubscribe) | used to unsubscribe from an RPC event | +| [SET_USER_VOICE_SETTINGS](/developers/docs/topics/rpc#setuservoicesettings) | used to change voice settings of users in voice channels | +| [SELECT_VOICE_CHANNEL](/developers/docs/topics/rpc#selectvoicechannel) | used to join or leave a voice channel, group dm, or dm | +| [GET_SELECTED_VOICE_CHANNEL](/developers/docs/topics/rpc#getselectedvoicechannel) | used to get the current voice channel the client is in | +| [SELECT_TEXT_CHANNEL](/developers/docs/topics/rpc#selecttextchannel) | used to join or leave a text channel, group dm, or dm | +| [GET_VOICE_SETTINGS](/developers/docs/topics/rpc#getvoicesettings) | used to retrieve the client's voice settings | +| [SET_VOICE_SETTINGS](/developers/docs/topics/rpc#setvoicesettings) | used to set the client's voice settings | +| [SET_CERTIFIED_DEVICES](/developers/docs/topics/rpc#setcertifieddevices) | used to send info about certified hardware devices | +| [SET_ACTIVITY](/developers/docs/topics/rpc#setactivity) | used to update a user's Rich Presence | +| [SEND_ACTIVITY_JOIN_INVITE](/developers/docs/topics/rpc#sendactivityjoininvite) | used to consent to a Rich Presence Ask to Join request | +| [CLOSE_ACTIVITY_REQUEST](/developers/docs/topics/rpc#closeactivityrequest) | used to reject a Rich Presence Ask to Join request | Events are payloads sent over the socket to a client that correspond to events in Discord. + ###### RPC Events -| Name | Description | -|-----------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------| -| [READY](/docs/topics/rpc#ready) | non-subscription event sent immediately after connecting, contains server information | -| [ERROR](/docs/topics/rpc#error) | non-subscription event sent when there is an error, including command responses | -| [GUILD_STATUS](/docs/topics/rpc#guildstatus) | sent when a subscribed server's state changes | -| [GUILD_CREATE](/docs/topics/rpc#guildcreate) | sent when a guild is created/joined on the client | -| [CHANNEL_CREATE](/docs/topics/rpc#channelcreate) | sent when a channel is created/joined on the client | -| [VOICE_CHANNEL_SELECT](/docs/topics/rpc#voicechannelselect) | sent when the client joins a voice channel | -| [VOICE_STATE_CREATE](/docs/topics/rpc#voicestatecreatevoicestateupdatevoicestatedelete) | sent when a user joins a subscribed voice channel | -| [VOICE_STATE_UPDATE](/docs/topics/rpc#voicestatecreatevoicestateupdatevoicestatedelete) | sent when a user's voice state changes in a subscribed voice channel (mute, volume, etc.) | -| [VOICE_STATE_DELETE](/docs/topics/rpc#voicestatecreatevoicestateupdatevoicestatedelete) | sent when a user parts a subscribed voice channel | -| [VOICE_SETTINGS_UPDATE](/docs/topics/rpc#voicesettingsupdate) | sent when the client's voice settings update | -| [VOICE_CONNECTION_STATUS](/docs/topics/rpc#voiceconnectionstatus) | sent when the client's voice connection status changes | -| [SPEAKING_START](/docs/topics/rpc#speakingstartspeakingstop) | sent when a user in a subscribed voice channel speaks | -| [SPEAKING_STOP](/docs/topics/rpc#speakingstartspeakingstop) | sent when a user in a subscribed voice channel stops speaking | -| [MESSAGE_CREATE](/docs/topics/rpc#messagecreatemessageupdatemessagedelete) | sent when a message is created in a subscribed text channel | -| [MESSAGE_UPDATE](/docs/topics/rpc#messagecreatemessageupdatemessagedelete) | sent when a message is updated in a subscribed text channel | -| [MESSAGE_DELETE](/docs/topics/rpc#messagecreatemessageupdatemessagedelete) | sent when a message is deleted in a subscribed text channel | -| [NOTIFICATION_CREATE](/docs/topics/rpc#notificationcreate) | sent when the client receives a notification (mention or new message in eligible channels) | -| [ACTIVITY_JOIN](/docs/topics/rpc#activityjoin) | sent when the user clicks a Rich Presence join invite in chat to join a game | -| [ACTIVITY_SPECTATE](/docs/topics/rpc#activityspectate) | sent when the user clicks a Rich Presence spectate invite in chat to spectate a game | -| [ACTIVITY_JOIN_REQUEST](/docs/topics/rpc#activityjoinrequest) | sent when the user receives a Rich Presence Ask to Join request | +| Name | Description | +|----------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------| +| [READY](/developers/docs/topics/rpc#ready) | non-subscription event sent immediately after connecting, contains server information | +| [ERROR](/developers/docs/topics/rpc#error) | non-subscription event sent when there is an error, including command responses | +| [GUILD_STATUS](/developers/docs/topics/rpc#guildstatus) | sent when a subscribed server's state changes | +| [GUILD_CREATE](/developers/docs/topics/rpc#guildcreate) | sent when a guild is created/joined on the client | +| [CHANNEL_CREATE](/developers/docs/topics/rpc#channelcreate) | sent when a channel is created/joined on the client | +| [VOICE_CHANNEL_SELECT](/developers/docs/topics/rpc#voicechannelselect) | sent when the client joins a voice channel | +| [VOICE_STATE_CREATE](/developers/docs/topics/rpc#voicestatecreatevoicestateupdatevoicestatedelete) | sent when a user joins a subscribed voice channel | +| [VOICE_STATE_UPDATE](/developers/docs/topics/rpc#voicestatecreatevoicestateupdatevoicestatedelete) | sent when a user's voice state changes in a subscribed voice channel (mute, volume, etc.) | +| [VOICE_STATE_DELETE](/developers/docs/topics/rpc#voicestatecreatevoicestateupdatevoicestatedelete) | sent when a user parts a subscribed voice channel | +| [VOICE_SETTINGS_UPDATE](/developers/docs/topics/rpc#voicesettingsupdate) | sent when the client's voice settings update | +| [VOICE_CONNECTION_STATUS](/developers/docs/topics/rpc#voiceconnectionstatus) | sent when the client's voice connection status changes | +| [SPEAKING_START](/developers/docs/topics/rpc#speakingstartspeakingstop) | sent when a user in a subscribed voice channel speaks | +| [SPEAKING_STOP](/developers/docs/topics/rpc#speakingstartspeakingstop) | sent when a user in a subscribed voice channel stops speaking | +| [MESSAGE_CREATE](/developers/docs/topics/rpc#messagecreatemessageupdatemessagedelete) | sent when a message is created in a subscribed text channel | +| [MESSAGE_UPDATE](/developers/docs/topics/rpc#messagecreatemessageupdatemessagedelete) | sent when a message is updated in a subscribed text channel | +| [MESSAGE_DELETE](/developers/docs/topics/rpc#messagecreatemessageupdatemessagedelete) | sent when a message is deleted in a subscribed text channel | +| [NOTIFICATION_CREATE](/developers/docs/topics/rpc#notificationcreate) | sent when the client receives a notification (mention or new message in eligible channels) | +| [ACTIVITY_JOIN](/developers/docs/topics/rpc#activityjoin) | sent when the user clicks a Rich Presence join invite in chat to join a game | +| [ACTIVITY_SPECTATE](/developers/docs/topics/rpc#activityspectate) | sent when the user clicks a Rich Presence spectate invite in chat to spectate a game | +| [ACTIVITY_JOIN_REQUEST](/developers/docs/topics/rpc#activityjoinrequest) | sent when the user receives a Rich Presence Ask to Join request | #### AUTHORIZE @@ -149,21 +161,24 @@ Used to authenticate a new client with your app. By default this pops up a modal We also have an RPC token system to bypass the user authorization modal. This is usable by approved games as well as by users on a game's list of testers, and also disallows use of the `messages.read` scope. If you have been granted access, you can send a POST request to `https://discord.com/api/oauth2/token/rpc` with your application's `client_id` and `client_secret` in the body (sent as a url-encoded body, **not JSON**). You can then pass the returned `rpc_token` value to the `rpc_token` field in your RPC authorize request (documented below). + ###### Authorize Argument Structure -| Field | Type | Description | -|-----------|------------------------------------------------------------------------------|---------------------------------------------------------------------------| -| scopes | array of [OAuth2 scopes](/docs/topics/oauth2#shared-resources-oauth2-scopes) | scopes to authorize | -| client_id | string | OAuth2 application id | -| rpc_token | string | one-time use RPC token | -| username | string | username to create a guest account with if the user does not have Discord | +| Field | Type | Description | +|-----------|-----------------------------------------------------------------------------------------|---------------------------------------------------------------------------| +| scopes | array of [OAuth2 scopes](/developers/docs/topics/oauth2#shared-resources-oauth2-scopes) | scopes to authorize | +| client_id | string | OAuth2 application id | +| rpc_token | string | one-time use RPC token | +| username | string | username to create a guest account with if the user does not have Discord | + ###### Authorize Response Structure | Field | Type | Description | |-------|--------|---------------------------| | code | string | OAuth2 authorization code | + ###### Example Authorize Command Payload ```json @@ -177,6 +192,7 @@ We also have an RPC token system to bypass the user authorization modal. This is } ``` + ###### Example Authorize Response Payload ```json @@ -193,21 +209,24 @@ We also have an RPC token system to bypass the user authorization modal. This is Used to authenticate an existing client with your app. + ###### Authenticate Argument Structure | Field | Type | Description | |--------------|--------|---------------------| | access_token | string | OAuth2 access token | + ###### Authenticate Response Structure -| Field | Type | Description | -|-------------|-----------------------------------------------------------------------------------------|---------------------------------| -| user | partial [user](/docs/resources/user#user-object) object | the authed user | -| scopes | array of [OAuth2 scopes](/docs/topics/oauth2#shared-resources-oauth2-scopes) | authorized scopes | -| expires | date | expiration date of OAuth2 token | -| application | [OAuth2 application](/docs/topics/rpc#authenticate-oauth2-application-structure) object | application the user authorized | +| Field | Type | Description | +|-------------|----------------------------------------------------------------------------------------------------|---------------------------------| +| user | partial [user](/developers/docs/resources/user#user-object) object | the authed user | +| scopes | array of [OAuth2 scopes](/developers/docs/topics/oauth2#shared-resources-oauth2-scopes) | authorized scopes | +| expires | date | expiration date of OAuth2 token | +| application | [OAuth2 application](/developers/docs/topics/rpc#authenticate-oauth2-application-structure) object | application the user authorized | + ###### OAuth2 Application Structure | Field | Type | Description | @@ -218,6 +237,7 @@ Used to authenticate an existing client with your app. | rpc_origins | array of strings | array of rpc origin urls | | name | string | application name | + ###### Example Authenticate Command Payload ```json @@ -230,6 +250,7 @@ Used to authenticate an existing client with your app. } ``` + ###### Example Authenticate Response Payload ```json @@ -256,16 +277,19 @@ Used to authenticate an existing client with your app. } ``` + #### GET_GUILDS Used to get a list of guilds the client is in. + ###### Get Guilds Response Structure -| Field | Type | Description | -|--------|----------------------------------------------------------------------|---------------------------| -| guilds | array of partial [guild](/docs/resources/guild#guild-object) objects | the guilds the user is in | +| Field | Type | Description | +|--------|---------------------------------------------------------------------------------|---------------------------| +| guilds | array of partial [guild](/developers/docs/resources/guild#guild-object) objects | the guilds the user is in | + ###### Example Get Guilds Command Payload ```json @@ -276,6 +300,7 @@ Used to get a list of guilds the client is in. } ``` + ###### Example Get Guilds Response Payload ```json @@ -293,10 +318,12 @@ Used to get a list of guilds the client is in. } ``` + #### GET_GUILD Used to get a guild the client is in. + ###### Get Guild Argument Structure | Field | Type | Description | @@ -304,15 +331,17 @@ Used to get a guild the client is in. | guild_id | string | id of the guild to get | | timeout | integer | asynchronously get guild with time to wait before timing out | + ###### Get Guild Response Structure -| Field | Type | Description | -|----------|----------------------------------------------------------------------------|-------------------------------------------------------| -| id | string | guild id | -| name | string | guild name | -| icon_url | string | guild icon url | -| members | array of [guild member](/docs/resources/guild#guild-member-object) objects | members of the guild (deprecated; always empty array) | +| Field | Type | Description | +|----------|---------------------------------------------------------------------------------------|-------------------------------------------------------| +| id | string | guild id | +| name | string | guild name | +| icon_url | string | guild icon url | +| members | array of [guild member](/developers/docs/resources/guild#guild-member-object) objects | members of the guild (deprecated; always empty array) | + ###### Example Get Guild Command Payload ```json @@ -325,6 +354,7 @@ Used to get a guild the client is in. } ``` + ###### Example Get Guild Response Payload ```json @@ -340,31 +370,35 @@ Used to get a guild the client is in. } ``` + #### GET_CHANNEL Used to get a channel the client is in. + ###### Get Channel Argument Structure | Field | Type | Description | |------------|--------|--------------------------| | channel_id | string | id of the channel to get | + ###### Get Channel Response Structure -| Field | Type | Description | -|--------------|--------------------------------------------------------------------------|------------------------------------------------------------------| -| id | string | channel id | -| guild_id | string | channel's guild id | -| name | string | channel name | -| type | integer | channel type (guild text: 0, guild voice: 2, dm: 1, group dm: 3) | -| topic | string | (text) channel topic | -| bitrate | integer | (voice) bitrate of voice channel | -| user_limit | integer | (voice) user limit of voice channel (0 for none) | -| position | integer | position of channel in channel list | -| voice_states | array of [voice state](/docs/resources/voice#voice-state-object) objects | (voice) channel's voice states | -| messages | array of [message](/docs/resources/message#message-object) objects | (text) channel's messages | - +| Field | Type | Description | +|--------------|-------------------------------------------------------------------------------------|------------------------------------------------------------------| +| id | string | channel id | +| guild_id | string | channel's guild id | +| name | string | channel name | +| type | integer | channel type (guild text: 0, guild voice: 2, dm: 1, group dm: 3) | +| topic | string | (text) channel topic | +| bitrate | integer | (voice) bitrate of voice channel | +| user_limit | integer | (voice) user limit of voice channel (0 for none) | +| position | integer | position of channel in channel list | +| voice_states | array of [voice state](/developers/docs/resources/voice#voice-state-object) objects | (voice) channel's voice states | +| messages | array of [message](/developers/docs/resources/message#message-object) objects | (text) channel's messages | + + ###### Example Get Channel Command Payload ```json @@ -377,6 +411,7 @@ Used to get a channel the client is in. } ``` + ###### Example Get Channel Response Payload ```json @@ -420,22 +455,26 @@ Used to get a channel the client is in. } ``` + #### GET_CHANNELS Used to get a guild's channels the client is in. + ###### Get Channels Argument Structure | Field | Type | Description | |----------|--------|-------------------------------------| | guild_id | string | id of the guild to get channels for | + ###### Get Channels Response Structure -| Field | Type | Description | -|----------|----------------------------------------------------------------------------|-------------------------------| -| channels | array of partial [channel](/docs/resources/channel#channel-object) objects | guild channels the user is in | +| Field | Type | Description | +|----------|---------------------------------------------------------------------------------------|-------------------------------| +| channels | array of partial [channel](/developers/docs/resources/channel#channel-object) objects | guild channels the user is in | + ###### Example Get Channels Command Payload ```json @@ -448,6 +487,7 @@ Used to get a guild's channels the client is in. } ``` + ###### Example Get Channels Response Payload ```json @@ -471,23 +511,26 @@ Used to get a guild's channels the client is in. } ``` + #### SET_USER_VOICE_SETTINGS Used to change voice settings of users in voice channels + ###### Set User Voice Settings Argument and Response Structure -| Field | Type | Description | -|---------|----------------------------------------------------------------|----------------------------------------------------------| -| user_id | string | user id | -| pan? | [pan](/docs/topics/rpc#setuservoicesettings-pan-object) object | set the pan of the user | -| volume? | integer | set the volume of user (defaults to 100, min 0, max 200) | -| mute? | boolean | set the mute state of the user | +| Field | Type | Description | +|---------|---------------------------------------------------------------------------|----------------------------------------------------------| +| user_id | string | user id | +| pan? | [pan](/developers/docs/topics/rpc#setuservoicesettings-pan-object) object | set the pan of the user | +| volume? | integer | set the volume of user (defaults to 100, min 0, max 200) | +| mute? | boolean | set the mute state of the user | -:::info + In the current release, we only support a single modifier of voice settings at a time over RPC. If an app changes voice settings, it will lock voice settings so that other apps connected simultaneously lose the ability to change voice settings. Settings reset to what they were before being changed after the controlling app disconnects. When an app that has previously set voice settings connects, the client will swap to that app's configured voice settings and lock voice settings again. This is a temporary situation that will be changed in the future. -::: + + ###### Pan Object | Field | Type | Description | @@ -495,6 +538,7 @@ In the current release, we only support a single modifier of voice settings at a | left | float | left pan of user (min: 0.0, max: 1.0) | | right | float | right pan of user (min: 0.0, max: 1.0) | + ###### Example Set User Voice Settings Command Payload ```json @@ -513,6 +557,7 @@ In the current release, we only support a single modifier of voice settings at a } ``` + ###### Example Set User Voice Settings Response Payload ```json @@ -531,10 +576,12 @@ In the current release, we only support a single modifier of voice settings at a } ``` + #### SELECT_VOICE_CHANNEL -Used to join and leave voice channels, group dms, or dms. Returns the [Get Channel](/docs/topics/rpc#getchannel) response, `null` if none. +Used to join and leave voice channels, group dms, or dms. Returns the [Get Channel](/developers/docs/topics/rpc#getchannel) response, `null` if none. + ###### Select Voice Channel Argument Structure | Field | Type | Description | @@ -544,10 +591,11 @@ Used to join and leave voice channels, group dms, or dms. Returns the [Get Chann | force | boolean | forces a user to join a voice channel | | navigate | boolean | after joining the voice channel, navigate to it in the client | -:::warn + When trying to join the user to a voice channel, you will receive a `5003` error coded response if the user is already in a voice channel. The `force` parameter should only be specified in response to the case where a user is already in a voice channel and they have **approved** to be moved by your app to a new voice channel. -::: + + ###### Example Select Voice Channel Command Payload ```json @@ -560,6 +608,7 @@ When trying to join the user to a voice channel, you will receive a `5003` error } ``` + ###### Example Select Voice Channel Response Payload ```json @@ -603,14 +652,17 @@ When trying to join the user to a voice channel, you will receive a `5003` error } ``` + #### GET_SELECTED_VOICE_CHANNEL -Used to get the client's current voice channel. There are no arguments for this command. Returns the [Get Channel](/docs/topics/rpc#getchannel) response, or `null` if none. +Used to get the client's current voice channel. There are no arguments for this command. Returns the [Get Channel](/developers/docs/topics/rpc#getchannel) response, or `null` if none. + #### SELECT_TEXT_CHANNEL -Used to join and leave text channels, group dms, or dms. Returns the [Get Channel](/docs/topics/rpc#getchannel) response, or `null` if none. +Used to join and leave text channels, group dms, or dms. Returns the [Get Channel](/developers/docs/topics/rpc#getchannel) response, or `null` if none. + ###### Select Text Channel Argument Structure | Field | Type | Description | @@ -618,23 +670,26 @@ Used to join and leave text channels, group dms, or dms. Returns the [Get Channe | channel_id | string | channel id to join (or `null` to leave) | | timeout | integer | asynchronously join channel with time to wait before timing out | + #### GET_VOICE_SETTINGS + ###### Get Voice Settings Response Structure -| Field | Type | Description | -|------------------------|------------------------------------------------------------------------------------------------|-----------------------------------| -| input | [voice settings input](/docs/topics/rpc#getvoicesettings-voice-settings-input-object) object | input settings | -| output | [voice settings output](/docs/topics/rpc#getvoicesettings-voice-settings-output-object) object | output settings | -| mode | [voice settings mode](/docs/topics/rpc#getvoicesettings-voice-settings-mode-object) object | voice mode settings | -| automatic_gain_control | boolean | state of automatic gain control | -| echo_cancellation | boolean | state of echo cancellation | -| noise_suppression | boolean | state of noise suppression | -| qos | boolean | state of voice quality of service | -| silence_warning | boolean | state of silence warning notice | -| deaf | boolean | state of self-deafen | -| mute | boolean | state of self-mute | - +| Field | Type | Description | +|------------------------|-----------------------------------------------------------------------------------------------------------|-----------------------------------| +| input | [voice settings input](/developers/docs/topics/rpc#getvoicesettings-voice-settings-input-object) object | input settings | +| output | [voice settings output](/developers/docs/topics/rpc#getvoicesettings-voice-settings-output-object) object | output settings | +| mode | [voice settings mode](/developers/docs/topics/rpc#getvoicesettings-voice-settings-mode-object) object | voice mode settings | +| automatic_gain_control | boolean | state of automatic gain control | +| echo_cancellation | boolean | state of echo cancellation | +| noise_suppression | boolean | state of noise suppression | +| qos | boolean | state of voice quality of service | +| silence_warning | boolean | state of silence warning notice | +| deaf | boolean | state of self-deafen | +| mute | boolean | state of self-mute | + + ###### Voice Settings Input Object | Field | Type | Description | @@ -643,6 +698,7 @@ Used to join and leave text channels, group dms, or dms. Returns the [Get Channe | volume | float | input voice level (min: 0, max: 100) | | available_devices | array of objects | array of _read-only_ device objects containing `id` and `name` string keys | + ###### Voice Settings Output Object | Field | Type | Description | @@ -651,24 +707,27 @@ Used to join and leave text channels, group dms, or dms. Returns the [Get Channe | volume | float | output voice level (min: 0, max: 200) | | available_devices | array of objects | array of _read-only_ device objects containing `id` and `name` string keys | + ###### Voice Settings Mode Object -| Field | Type | Description | -|----------------|------------------------------------------------------------------------------------------|---------------------------------------------------------------------| -| type | string | voice setting mode type (can be `PUSH_TO_TALK` or `VOICE_ACTIVITY`) | -| auto_threshold | boolean | voice activity threshold automatically sets its threshold | -| threshold | float | threshold for voice activity (in dB) (min: -100, max: 0) | -| shortcut | [shortcut key combo](/docs/topics/rpc#getvoicesettings-shortcut-key-combo-object) object | shortcut key combos for PTT | -| delay | float | the PTT release delay (in ms) (min: 0, max: 2000) | +| Field | Type | Description | +|----------------|-----------------------------------------------------------------------------------------------------|---------------------------------------------------------------------| +| type | string | voice setting mode type (can be `PUSH_TO_TALK` or `VOICE_ACTIVITY`) | +| auto_threshold | boolean | voice activity threshold automatically sets its threshold | +| threshold | float | threshold for voice activity (in dB) (min: -100, max: 0) | +| shortcut | [shortcut key combo](/developers/docs/topics/rpc#getvoicesettings-shortcut-key-combo-object) object | shortcut key combos for PTT | +| delay | float | the PTT release delay (in ms) (min: 0, max: 2000) | + ###### Shortcut Key Combo Object -| Field | Type | Description | -|-------|---------|--------------------------------------------------------------| -| type | integer | see [key types](/docs/topics/rpc#getvoicesettings-key-types) | -| code | integer | key code | -| name | string | key name | +| Field | Type | Description | +|-------|---------|-------------------------------------------------------------------------| +| type | integer | see [key types](/developers/docs/topics/rpc#getvoicesettings-key-types) | +| code | integer | key code | +| name | string | key name | + ###### Key Types | Type | Id | @@ -678,6 +737,7 @@ Used to join and leave text channels, group dms, or dms. Returns the [Get Channe | KEYBOARD_MODIFIER_KEY | 2 | | GAMEPAD_BUTTON | 3 | + ###### Example Get Voice Settings Response Payload ```json @@ -731,29 +791,32 @@ Used to join and leave text channels, group dms, or dms. Returns the [Get Channe } ``` + #### SET_VOICE_SETTINGS -:::info + In the current release, we only support a single modifier of voice settings at a time over RPC. If an app changes voice settings, it will lock voice settings so that other apps connected simultaneously lose the ability to change voice settings. Settings reset to what they were before being changed after the controlling app disconnects. When an app that has previously set voice settings connects, the client will swap to that app's configured voice settings and lock voice settings again. This is a temporary situation that will be changed in the future. -::: + When setting voice settings, all fields are optional. Only passed fields are updated. + ###### Set Voice Settings Argument and Response Structure -| Field | Type | Description | -|------------------------|------------------------------------------------------------------------------------------------|-----------------------------------| -| input | [voice settings input](/docs/topics/rpc#getvoicesettings-voice-settings-input-object) object | input settings | -| output | [voice settings output](/docs/topics/rpc#getvoicesettings-voice-settings-output-object) object | output settings | -| mode | [voice settings mode](/docs/topics/rpc#getvoicesettings-voice-settings-mode-object) object | voice mode settings | -| automatic_gain_control | boolean | state of automatic gain control | -| echo_cancellation | boolean | state of echo cancellation | -| noise_suppression | boolean | state of noise suppression | -| qos | boolean | state of voice quality of service | -| silence_warning | boolean | state of silence warning notice | -| deaf | boolean | state of self-deafen | -| mute | boolean | state of self-mute | - +| Field | Type | Description | +|------------------------|-----------------------------------------------------------------------------------------------------------|-----------------------------------| +| input | [voice settings input](/developers/docs/topics/rpc#getvoicesettings-voice-settings-input-object) object | input settings | +| output | [voice settings output](/developers/docs/topics/rpc#getvoicesettings-voice-settings-output-object) object | output settings | +| mode | [voice settings mode](/developers/docs/topics/rpc#getvoicesettings-voice-settings-mode-object) object | voice mode settings | +| automatic_gain_control | boolean | state of automatic gain control | +| echo_cancellation | boolean | state of echo cancellation | +| noise_suppression | boolean | state of noise suppression | +| qos | boolean | state of voice quality of service | +| silence_warning | boolean | state of silence warning notice | +| deaf | boolean | state of self-deafen | +| mute | boolean | state of self-mute | + + ###### Example Set Voice Settings Command Payload ```json @@ -768,6 +831,7 @@ When setting voice settings, all fields are optional. Only passed fields are upd } ``` + ###### Example Set Voice Settings Response Payload ```json @@ -825,12 +889,14 @@ When setting voice settings, all fields are optional. Only passed fields are upd Used to subscribe to events. `evt` of the payload should be set to the event being subscribed to. `args` of the payload should be set to the args needed for the event. + ###### Subscribe Response Structure | Field | Type | Description | |-------|--------|------------------------------| | evt | string | event name now subscribed to | + ###### Example Subscribe Command Payload ```json @@ -844,6 +910,7 @@ Used to subscribe to events. `evt` of the payload should be set to the event bei } ``` + ###### Example Subscribe Response Payload ```json @@ -860,12 +927,14 @@ Used to subscribe to events. `evt` of the payload should be set to the event bei Used to unsubscribe from events. `evt` of the payload should be set to the event that was subscribed to. `args` of the payload should be set to the args needed for the previously subscribed event. + ###### Unsubscribe Response Structure | Field | Type | Description | |-------|--------|----------------------------------| | evt | string | event name now unsubscribed from | + ###### Example Unsubscribe Command Payload ```json @@ -879,6 +948,7 @@ Used to unsubscribe from events. `evt` of the payload should be set to the event } ``` + ###### Example Unsubscribe Response Payload ```json @@ -891,32 +961,36 @@ Used to unsubscribe from events. `evt` of the payload should be set to the event } ``` + #### SET_CERTIFIED_DEVICES Used by hardware manufacturers to send information about the current state of their certified devices that are connected to Discord. + ###### Set Certified Devices Argument Structure -| Field | Type | Description | -|---------|-----------------------------------------------------------------------------------------|---------------------------------------------------------------| -| devices | array of [certified device](/docs/topics/rpc#setcertifieddevices-device-object) objects | a list of devices for your manufacturer, in order of priority | +| Field | Type | Description | +|---------|----------------------------------------------------------------------------------------------------|---------------------------------------------------------------| +| devices | array of [certified device](/developers/docs/topics/rpc#setcertifieddevices-device-object) objects | a list of devices for your manufacturer, in order of priority | + ###### Device Object -| Field | Type | Description | -|---------------------------|---------------------------------------------------------------------|----------------------------------------------------------| -| type | [device type](/docs/topics/rpc#setcertifieddevices-device-type) | the type of device | -| id | string | the device's Windows UUID | -| vendor | [vendor](/docs/topics/rpc#setcertifieddevices-vendor-object) object | the hardware vendor | -| model | [model](/docs/topics/rpc#setcertifieddevices-model-object) object | the model of the product | -| related | array of strings | UUIDs of related devices | -| echo_cancellation?\* | boolean | if the device's native echo cancellation is enabled | -| noise_suppression?\* | boolean | if the device's native noise suppression is enabled | -| automatic_gain_control?\* | boolean | if the device's native automatic gain control is enabled | -| hardware_mute?\* | boolean | if the device is hardware muted | +| Field | Type | Description | +|---------------------------|--------------------------------------------------------------------------------|----------------------------------------------------------| +| type | [device type](/developers/docs/topics/rpc#setcertifieddevices-device-type) | the type of device | +| id | string | the device's Windows UUID | +| vendor | [vendor](/developers/docs/topics/rpc#setcertifieddevices-vendor-object) object | the hardware vendor | +| model | [model](/developers/docs/topics/rpc#setcertifieddevices-model-object) object | the model of the product | +| related | array of strings | UUIDs of related devices | +| echo_cancellation?\* | boolean | if the device's native echo cancellation is enabled | +| noise_suppression?\* | boolean | if the device's native noise suppression is enabled | +| automatic_gain_control?\* | boolean | if the device's native automatic gain control is enabled | +| hardware_mute?\* | boolean | if the device is hardware muted | \*These fields are only applicable for `AUDIO_INPUT` device types + ###### Vendor Object | Field | Type | Description | @@ -924,6 +998,7 @@ Used by hardware manufacturers to send information about the current state of th | name | string | name of the vendor | | url | string | url for the vendor | + ###### Model Object | Field | Type | Description | @@ -931,6 +1006,7 @@ Used by hardware manufacturers to send information about the current state of th | name | string | name of the model | | url | string | url for the model | + ###### Device Type | Type | Value | @@ -939,6 +1015,7 @@ Used by hardware manufacturers to send information about the current state of th | AUDIO_OUTPUT | "audiooutput" | | VIDEO_INPUT | "videoinput" | + ###### Example Set Certified Devices Command Payload ```json @@ -969,6 +1046,7 @@ Used by hardware manufacturers to send information about the current state of th } ``` + ###### Example Set Certified Devices Response Payload ```json @@ -980,21 +1058,24 @@ Used by hardware manufacturers to send information about the current state of th } ``` + #### SET_ACTIVITY Used to update a user's Rich Presence. + ###### Set Activity Argument Structure -:::info + When using `SET_ACTIVITY`, the `activity` object is limited to a `type` of Playing (`0`), Listening (`2`), Watching (`3`), or Competing (`5`). -::: + -| Field | Type | Description | -|----------|----------------------------------------------------------------|-----------------------------------------| -| pid | integer | the application's process id | -| activity | [activity](/docs/events/gateway-events#activity-object) object | the rich presence to assign to the user | +| Field | Type | Description | +|----------|---------------------------------------------------------------------------|-----------------------------------------| +| pid | integer | the application's process id | +| activity | [activity](/developers/docs/events/gateway-events#activity-object) object | the rich presence to assign to the user | + ###### Example Set Activity Payload ```json @@ -1035,16 +1116,19 @@ When using `SET_ACTIVITY`, the `activity` object is limited to a `type` of Playi } ``` + #### SEND_ACTIVITY_JOIN_INVITE Used to accept an Ask to Join request. + ###### Send Activity Join Invite Argument Structure | Field | Type | Description | |---------|-----------|-------------------------------| | user_id | snowflake | the id of the requesting user | + ###### Example Send Activity Join Invite Payload ```json @@ -1057,16 +1141,19 @@ Used to accept an Ask to Join request. } ``` + #### CLOSE_ACTIVITY_REQUEST Used to reject an Ask to Join request. + ###### Close Activity Request Argument Structure | Field | Type | Description | |---------|-----------|-------------------------------| | user_id | snowflake | the id of the requesting user | + ###### Example Close Activity Request Payload ```json @@ -1081,14 +1168,16 @@ Used to reject an Ask to Join request. #### READY + ###### Ready Dispatch Data Structure -| Field | Type | Description | -|--------|-------------------------------------------------------------------------------------------|------------------------------------| -| v | integer | RPC version | -| config | [rpc server configuration](/docs/topics/rpc#ready-rpc-server-configuration-object) object | server configuration | -| user | partial [user](/docs/resources/user#user-object) object | the user to whom you are connected | +| Field | Type | Description | +|--------|------------------------------------------------------------------------------------------------------|------------------------------------| +| v | integer | RPC version | +| config | [rpc server configuration](/developers/docs/topics/rpc#ready-rpc-server-configuration-object) object | server configuration | +| user | partial [user](/developers/docs/resources/user#user-object) object | the user to whom you are connected | + ###### RPC Server Configuration Object | Field | Type | Description | @@ -1097,6 +1186,7 @@ Used to reject an Ask to Join request. | api_endpoint | string | server's api endpoint | | environment | string | server's environment | + ###### Example Ready Dispatch Payload ```json @@ -1122,6 +1212,7 @@ Used to reject an Ask to Join request. #### ERROR + ###### Error Data Structure | Field | Type | Description | @@ -1129,6 +1220,7 @@ Used to reject an Ask to Join request. | code | integer | RPC Error Code | | message | string | Error description | + ###### Example Error Payload ```json @@ -1143,21 +1235,25 @@ Used to reject an Ask to Join request. } ``` + #### GUILD_STATUS + ###### Guild Status Argument Structure | Field | Type | Description | |----------|--------|-------------------------------------| | guild_id | string | id of guild to listen to updates of | + ###### Guild Status Dispatch Data Structure -| Field | Type | Description | -|--------|------------------------------------------------------------|--------------------------------------------------------| -| guild | partial [guild](/docs/resources/guild#guild-object) object | guild with requested id | -| online | integer | number of online users in guild (deprecated; always 0) | +| Field | Type | Description | +|--------|-----------------------------------------------------------------------|--------------------------------------------------------| +| guild | partial [guild](/developers/docs/resources/guild#guild-object) object | guild with requested id | +| online | integer | number of online users in guild (deprecated; always 0) | + ###### Example Guild Status Dispatch Payload ```json @@ -1175,10 +1271,12 @@ Used to reject an Ask to Join request. } ``` + #### GUILD_CREATE No arguments + ###### Guild Create Dispatch Data Structure | Field | Type | Description | @@ -1186,6 +1284,7 @@ No arguments | id | string | guild id | | name | string | name of the guild | + ###### Example Guild Create Dispatch Payload ```json @@ -1199,10 +1298,12 @@ No arguments } ``` + #### CHANNEL_CREATE No arguments + ###### Channel Create Dispatch Data Structure | Field | Type | Description | @@ -1211,6 +1312,7 @@ No arguments | name | string | name of the channel | | type | integer | channel type (guild text: 0, guild voice: 2, dm: 1, group dm: 3) | + ###### Example Channel Create Dispatch Payload ```json @@ -1225,10 +1327,12 @@ No arguments } ``` + #### VOICE_CHANNEL_SELECT No arguments + ###### Voice Channel Select Dispatch Data Structure | Field | Type | Description | @@ -1236,6 +1340,7 @@ No arguments | channel_id | string | id of channel (`null` if none) | | guild_id | string | id of guild (`null` if none) | + ###### Example Voice Channel Select Dispatch Payload ```json @@ -1249,12 +1354,15 @@ No arguments } ``` + #### VOICE_SETTINGS_UPDATE + ###### Voice Settings Argument Structure -No arguments. Dispatches the [Get Voice Settings](/docs/topics/rpc#getvoicesettings) response. +No arguments. Dispatches the [Get Voice Settings](/developers/docs/topics/rpc#getvoicesettings) response. + ###### Example Voice Settings Dispatch Payload ```json @@ -1306,16 +1414,19 @@ No arguments. Dispatches the [Get Voice Settings](/docs/topics/rpc#getvoicesetti } ``` + #### VOICE_STATE_CREATE/VOICE_STATE_UPDATE/VOICE_STATE_DELETE Dispatches channel voice state objects + ###### Voice State Argument Structure | Field | Type | Description | |------------|--------|---------------------------------------| | channel_id | string | id of channel to listen to updates of | + ###### Example Voice State Dispatch Payload ```json @@ -1348,10 +1459,12 @@ Dispatches channel voice state objects } ``` + #### VOICE_CONNECTION_STATUS No arguments + ###### Voice Connection Status Dispatch Data Structure | Field | Type | Description | @@ -1362,6 +1475,7 @@ No arguments | average_ping | integer | average ping (in ms) | | last_ping | integer | last ping (in ms) | + ###### Voice Connection States | Field | Description | @@ -1377,6 +1491,7 @@ No arguments | NO_ROUTE | No route to host | | ICE_CHECKING | WebRTC ice checking | + ###### Example Voice Connection Status Dispatch Payload ```json @@ -1393,16 +1508,19 @@ No arguments } ``` + #### MESSAGE_CREATE/MESSAGE_UPDATE/MESSAGE_DELETE Dispatches message objects, with the exception of deletions, which only contains the id in the message object. + ###### Message Argument Structure | Field | Type | Description | |------------|--------|---------------------------------------| | channel_id | string | id of channel to listen to updates of | + ###### Example Message Dispatch Payload ```json @@ -1444,20 +1562,24 @@ Dispatches message objects, with the exception of deletions, which only contains } ``` + #### SPEAKING_START/SPEAKING_STOP + ###### Speaking Argument Structure | Field | Type | Description | |------------|--------|---------------------------------------| | channel_id | string | id of channel to listen to updates of | + ###### Speaking Dispatch Data Structure | Field | Type | Description | |---------|--------|-----------------------------------------| | user_id | string | id of user who started/stopped speaking | + ###### Example Speaking Dispatch Payload ```json @@ -1470,20 +1592,23 @@ Dispatches message objects, with the exception of deletions, which only contains } ``` + #### NOTIFICATION_CREATE -No arguments. This event requires the `rpc.notifications.read` [OAuth2 scope](/docs/topics/oauth2#shared-resources-oauth2-scopes). +No arguments. This event requires the `rpc.notifications.read` [OAuth2 scope](/developers/docs/topics/oauth2#shared-resources-oauth2-scopes). + ###### Notification Create Dispatch Data Structure -| Field | Type | Description | -|------------|----------------------------------------------------------|-------------------------------------------| -| channel_id | string | id of channel where notification occurred | -| message | [message](/docs/resources/message#message-object) object | message that generated this notification | -| icon_url | string | icon url of the notification | -| title | string | title of the notification | -| body | string | body of the notification | +| Field | Type | Description | +|------------|---------------------------------------------------------------------|-------------------------------------------| +| channel_id | string | id of channel where notification occurred | +| message | [message](/developers/docs/resources/message#message-object) object | message that generated this notification | +| icon_url | string | icon url of the notification | +| title | string | title of the notification | +| body | string | body of the notification | + ###### Example Notification Create Dispatch Payload ```json @@ -1528,16 +1653,19 @@ No arguments. This event requires the `rpc.notifications.read` [OAuth2 scope](/d } ``` + #### ACTIVITY_JOIN No arguments + ###### Activity Join Dispatch Data Structure -| Field | Type | Description | -|--------|--------|-------------------------------------------------------------------------------------------------| -| secret | string | the [`join_secret`](/docs/developer-tools/game-sdk#activitysecrets-struct) for the given invite | +| Field | Type | Description | +|--------|--------|------------------------------------------------------------------------------------------------------------| +| secret | string | the [`join_secret`](/developers/docs/developer-tools/game-sdk#activitysecrets-struct) for the given invite | + ###### Example Activity Join Dispatch Payload ```json @@ -1550,16 +1678,19 @@ No arguments } ``` + #### ACTIVITY_SPECTATE No arguments + ###### Activity Spectate Dispatch Data Structure -| Field | Type | Description | -|--------|--------|-----------------------------------------------------------------------------------------------------| -| secret | string | the [`spectate_secret`](/docs/developer-tools/game-sdk#activitysecrets-struct) for the given invite | +| Field | Type | Description | +|--------|--------|----------------------------------------------------------------------------------------------------------------| +| secret | string | the [`spectate_secret`](/developers/docs/developer-tools/game-sdk#activitysecrets-struct) for the given invite | + ###### Example Activity Spectate Dispatch Payload ```json @@ -1572,16 +1703,19 @@ No arguments } ``` + #### ACTIVITY_JOIN_REQUEST No arguments + ###### Activity Join Request Data Structure -| Field | Type | Description | -|-------|---------------------------------------------------------|-----------------------------------------------| -| user | partial [user](/docs/resources/user#user-object) object | information about the user requesting to join | +| Field | Type | Description | +|-------|--------------------------------------------------------------------|-----------------------------------------------| +| user | partial [user](/developers/docs/resources/user#user-object) object | information about the user requesting to join | + ###### Example Activity Join Request Dispatch Payload ```json diff --git a/docs/topics/teams.md b/discord/developers/docs/topics/teams.mdx similarity index 68% rename from docs/topics/teams.md rename to discord/developers/docs/topics/teams.mdx index b28b64a2b0..765c31f282 100644 --- a/docs/topics/teams.md +++ b/discord/developers/docs/topics/teams.mdx @@ -1,4 +1,9 @@ -# Teams +--- +title: Teams +description: Learn how to create and manage developer teams for collaborative development. +--- + +import {ManualAnchor} from '/snippets/manualanchor.jsx' Teams are groups of developers (or other Discord users) who want to collaborate and share access to an app's configuration, management, and payout settings. Go team(s)! @@ -6,13 +11,13 @@ Teams are groups of developers (or other Discord users) who want to collaborate To create or be a member on a team, you must [enable 2FA for your Discord account](https://support.discord.com/hc/en-us/articles/219576828-Setting-up-Two-Factor-Authentication). After you have 2FA enabled, create a team by navigating to the [Teams page](https://discord.com/developers/teams) then clicking the "New Team" button. -![Screenshot of the Teams page](images/team-page.webp) +![Screenshot of the Teams page](/images/team-page.png) Once you create a team, you'll land on the **Team Information** page where you can fill out details and start inviting other Discord users to join your team. Since users added to a team have access to any apps that team owns, use caution when adding new team members. -:::info + Only the team Owner and team Admins can invite or remove additional users. -::: + ## Adding Apps to a Team @@ -22,22 +27,23 @@ Once your team is set up, you can create or transfer apps that will be owned by To create a new app that belongs to a team, select the team from the **Team** dropdown in the app creation modal. If you want to keep the app under your own account's ownership, choose `Personal`: -![Screenshot of the create application modal with a Team selected](images/create-team-owned-app.webp) +![Screenshot of the create application modal with a Team selected](/images/create-team-owned-app.png) ### Transferring an App To transfer an existing app to a team, navigate to the [Application](https://discord.com/developers/applications) that you want to transfer. At the bottom of the app's **General Information** page, click "Transfer App to Team". -:::danger + Once an app has been transferred to a team, it _cannot_ be transferred back. -::: + -![Screenshot of where to find the button to transfer an Application to a team](images/transfer-app-to-team.webp) +![Screenshot of where to find the button to transfer an Application to a team](/images/transfer-app-to-team.png) ## Team Member Roles Team members can be one of four roles (owner, admin, developer, and read-only), and each role inherits the access of those below it. Roles for team members can be configured under **Team Members** in a team's settings. + ###### Team Member Role Types | Role Name | Value | Description | @@ -47,29 +53,32 @@ Team members can be one of four roles (owner, admin, developer, and read-only), | Developer | developer | Developers can access information about team-owned apps, like the client secret or public key. They can also take limited actions on team-owned apps, like configuring interaction endpoints or resetting the bot token. Members with the Developer role *cannot* manage the team or its members, or take destructive actions on team-owned apps. | | Read-only | read_only | Read-only members can access information about a team and any team-owned apps. Some examples include getting the IDs of applications and exporting payout records. Members can also invite bots associated with team-owned apps that are marked private. | -\* The owner role is not represented in the `role` field on the [team member object](/docs/topics/teams#data-models-team-member-object). Instead, the `owner_user_id` field on the [team object](/docs/topics/teams#data-models-team-object) should be used to identify which user has the owner role for the team. +\* The owner role is not represented in the `role` field on the [team member object](/developers/docs/topics/teams#data-models-team-member-object). Instead, the `owner_user_id` field on the [team object](/developers/docs/topics/teams#data-models-team-object) should be used to identify which user has the owner role for the team. ## Data Models + ###### Team Object -| field | type | description | -|---------------|-----------------------------------------------------------------------------------|--------------------------------------| -| icon | ?string | Hash of the image of the team's icon | -| id | snowflake | Unique ID of the team | -| members | array of [team member](/docs/topics/teams#data-models-team-member-object) objects | Members of the team | -| name | string | Name of the team | -| owner_user_id | snowflake | User ID of the current team owner | +| field | type | description | +|---------------|----------------------------------------------------------------------------------------------|--------------------------------------| +| icon | ?string | Hash of the image of the team's icon | +| id | snowflake | Unique ID of the team | +| members | array of [team member](/developers/docs/topics/teams#data-models-team-member-object) objects | Members of the team | +| name | string | Name of the team | +| owner_user_id | snowflake | User ID of the current team owner | + ###### Team Member Object -| field | type | description | -|------------------|---------------------------------------------------------|---------------------------------------------------------------------------------------------| -| membership_state | integer | User's [membership state](/docs/topics/teams#data-models-membership-state-enum) on the team | -| team_id | snowflake | ID of the parent team of which they are a member | -| user | partial [user](/docs/resources/user#user-object) object | Avatar, discriminator, ID, and username of the user | -| role | string | [Role](/docs/topics/teams#team-member-roles-team-member-role-types) of the team member | +| field | type | description | +|------------------|--------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------| +| membership_state | integer | User's [membership state](/developers/docs/topics/teams#data-models-membership-state-enum) on the team | +| team_id | snowflake | ID of the parent team of which they are a member | +| user | partial [user](/developers/docs/resources/user#user-object) object | Avatar, discriminator, ID, and username of the user | +| role | string | [Role](/developers/docs/topics/teams#team-member-roles-team-member-role-types) of the team member | + ###### Membership State Enum | name | value | diff --git a/docs/topics/threads.md b/discord/developers/docs/topics/threads.mdx similarity index 58% rename from docs/topics/threads.md rename to discord/developers/docs/topics/threads.mdx index 846cefa3c2..324754b66a 100644 --- a/docs/topics/threads.md +++ b/discord/developers/docs/topics/threads.mdx @@ -1,12 +1,15 @@ -# Threads +--- +title: Threads +description: Learn about Discord threads - temporary sub-channels for organizing conversations. +--- -[Threads](/docs/resources/channel#channel-object) can be thought of as temporary sub-channels inside an existing channel, to help better organize conversation in a busy channel. +[Threads](/developers/docs/resources/channel#channel-object) can be thought of as temporary sub-channels inside an existing channel, to help better organize conversation in a busy channel. -Threads have been designed to be very similar to [channel](/docs/resources/channel#channel-object) objects, and this topic aggregates all of the information about threads, which should all help to make migrating very straightforward. +Threads have been designed to be very similar to [channel](/developers/docs/resources/channel#channel-object) objects, and this topic aggregates all of the information about threads, which should all help to make migrating very straightforward. ## Backwards Compatibility -Threads are only available in API v9 and above. Bots that do not update to API v9 or above will not receive most gateway events for threads, or things that happen in threads (such as [Message Create](/docs/events/gateway-events#message-create)). Bots on API v8 will still receive gateway events for Interactions. +Threads are only available in API v9 and above. Bots that do not update to API v9 or above will not receive most gateway events for threads, or things that happen in threads (such as [Message Create](/developers/docs/events/gateway-events#message-create)). Bots on API v8 will still receive gateway events for Interactions. The list of gateway events that may be dropped includes, but is not limited to: @@ -26,9 +29,9 @@ The list of gateway events that may be dropped includes, but is not limited to: ## Thread Fields -Threads share and repurpose a number of the existing fields from the [channel object](/docs/resources/channel#channel-object): +Threads share and repurpose a number of the existing fields from the [channel object](/developers/docs/resources/channel#channel-object): -- `id`, `guild_id`, `type`, `name`, `last_message_id`, `last_pin_timestamp`, `rate_limit_per_user` and `flags` are being re-used +- `id`, `guild_id`, `type`, `name`, `last_message_id`, `last_pin_timestamp`, `rate_limit_per_user` are being re-used - `owner_id` has been repurposed to store the id of the user that started the thread - `parent_id` has been repurposed to store the id of the `GUILD_TEXT` or `GUILD_ANNOUNCEMENT` channel the thread was created in @@ -40,9 +43,9 @@ Additionally, there are a few fields that are only available on threads: ## Public & Private Threads -Public threads are viewable by everyone who can view the parent channel of the thread. Public threads must be created from an existing message, but can be "orphaned" if that message is deleted. The created thread and the message it was started from will share the same id. The [type](/docs/resources/channel#channel-object-channel-types) of thread created matches the [type](/docs/resources/channel#channel-object-channel-types) of the parent channel. `GUILD_TEXT` channels [create](/docs/resources/channel#start-thread-from-message) `PUBLIC_THREAD` and `GUILD_ANNOUNCEMENT` channels [create](/docs/resources/channel#start-thread-from-message) `ANNOUNCEMENT_THREAD`. +Public threads are viewable by everyone who can view the parent channel of the thread. Public threads must be created from an existing message, but can be "orphaned" if that message is deleted. The created thread and the message it was started from will share the same id. The [type](/developers/docs/resources/channel#channel-object-channel-types) of thread created matches the [type](/developers/docs/resources/channel#channel-object-channel-types) of the parent channel. `GUILD_TEXT` channels [create](/developers/docs/resources/channel#start-thread-from-message) `PUBLIC_THREAD` and `GUILD_ANNOUNCEMENT` channels [create](/developers/docs/resources/channel#start-thread-from-message) `ANNOUNCEMENT_THREAD`. -Private threads behave similar to Group DMs, but in a Guild. Private threads are always [created](/docs/resources/channel#start-thread-without-message) with the `GUILD_PRIVATE_THREAD` [type](/docs/resources/channel#channel-object-channel-types) and can only be created in `GUILD_TEXT` channels. +Private threads behave similar to Group DMs, but in a Guild. Private threads are always [created](/developers/docs/resources/channel#start-thread-without-message) with the `GUILD_PRIVATE_THREAD` [type](/developers/docs/resources/channel#channel-object-channel-types) and can only be created in `GUILD_TEXT` channels. ## Locked Threads Users (including bot users) without the `MANAGE_THREADS` permission are more restricted in locked threads. Users won't be able to create or update messages in locked threads, or update properties like its title or tags. Additionally, some user activity like deleting messages and adding or removing reactions will *only* be allowed in locked threads if that thread is also active (or un-archived). @@ -67,9 +70,9 @@ Threads generally inherit permissions from the parent channel (e.g. if you can a Three permission bits are specific to threads: `CREATE_PUBLIC_THREADS`, `CREATE_PRIVATE_THREADS`, and `SEND_MESSAGES_IN_THREADS`. -:::warn + The `SEND_MESSAGES` permission has no effect in threads; users must have `SEND_MESSAGES_IN_THREADS` to talk in a thread. -::: + Private threads are similar to Group DMs, but in a guild: You must be invited to the thread to be able to view or participate in it, or be a moderator (`MANAGE_THREADS` permission). @@ -77,36 +80,36 @@ Finally, threads are treated slightly differently from channels in the gateway p ## Gateway Events -- [Guild Create](/docs/events/gateway-events#guild-create) contains a field, `threads`, which is an array of channel objects. This represents all active threads in the guild that the current user is able to view. -- When a thread is created, updated, or deleted, a [Thread Create](/docs/events/gateway-events#thread-create), [Thread Update](/docs/events/gateway-events#thread-update), or [Thread Delete](/docs/events/gateway-events#thread-delete) event is sent. Like their channel counterparts, these just contain a thread. -- Since the gateway only syncs active threads that the user can see, if a user _gains_ access to a channel, then the gateway may need to sync the active threads in that channel to the user. It will send a [Thread List Sync](/docs/events/gateway-events#thread-list-sync) event for this. +- [Guild Create](/developers/docs/events/gateway-events#guild-create) contains a field, `threads`, which is an array of channel objects. This represents all active threads in the guild that the current user is able to view. +- When a thread is created, updated, or deleted, a [Thread Create](/developers/docs/events/gateway-events#thread-create), [Thread Update](/developers/docs/events/gateway-events#thread-update), or [Thread Delete](/developers/docs/events/gateway-events#thread-delete) event is sent. Like their channel counterparts, these just contain a thread. +- Since the gateway only syncs active threads that the user can see, if a user _gains_ access to a channel, then the gateway may need to sync the active threads in that channel to the user. It will send a [Thread List Sync](/developers/docs/events/gateway-events#thread-list-sync) event for this. ## Thread Membership Each thread tracks explicit membership. There are two primary use cases for this data: -- Clients use _their own_ [thread member](/docs/resources/channel#thread-member-object) to calculate read states and notification settings. This is largely irrelevant for bots though, but is the reason for some of the syncing complexity detailed here. +- Clients use _their own_ [thread member](/developers/docs/resources/channel#thread-member-object) to calculate read states and notification settings. This is largely irrelevant for bots though, but is the reason for some of the syncing complexity detailed here. - Knowing everyone that is in a thread. -Membership is tracked in an array of [thread member](/docs/resources/channel#thread-member-object) objects. These have four fields, `id` (the thread id), `user_id`, `join_timestamp`, and `flags`. Currently the only `flags` are for notification settings, but others may be added in future updates. +Membership is tracked in an array of [thread member](/developers/docs/resources/channel#thread-member-object) objects. These have four fields, `id` (the thread id), `user_id`, `join_timestamp`, and `flags`. Currently the only `flags` are for notification settings, but others may be added in future updates. ### Syncing for the current user -- A [Thread Members Update](/docs/events/gateway-events#thread-members-update) Gateway Event is always sent when the current user is added to or removed from a thread. -- A [Thread Member Update](/docs/events/gateway-events#thread-member-update) Gateway Event is sent whenever the current user's [thread member](/docs/resources/channel#thread-member-object) object is updated. -- Certain API calls, such as listing archived threads and search will return an array of [thread member](/docs/resources/channel#thread-member-object) objects for any returned threads the current user is a member of. Other API calls, such as getting a channel will return the [thread member](/docs/resources/channel#thread-member-object) object for the current user as a property on the channel, if the current user is a member of the thread. -- The [Guild Create](/docs/events/gateway-events#guild-create) Gateway Event will contain a [thread member](/docs/resources/channel#thread-member-object) object as a property on any returned threads the current is a member of. -- The [Thread Create](/docs/events/gateway-events#thread-create) Gateway Event will contain a [thread member](/docs/resources/channel#thread-member-object) object as a property of the thread if the current user is a member of, and the user has recently gained access to view the parent channel. -- The [Thread List Sync](/docs/events/gateway-events#thread-list-sync) Gateway Event will contain an array of [thread member](/docs/resources/channel#thread-member-object) objects for any returned threads the current user is a member of. +- A [Thread Members Update](/developers/docs/events/gateway-events#thread-members-update) Gateway Event is always sent when the current user is added to or removed from a thread. +- A [Thread Member Update](/developers/docs/events/gateway-events#thread-member-update) Gateway Event is sent whenever the current user's [thread member](/developers/docs/resources/channel#thread-member-object) object is updated. +- Certain API calls, such as listing archived threads and search will return an array of [thread member](/developers/docs/resources/channel#thread-member-object) objects for any returned threads the current user is a member of. Other API calls, such as getting a channel will return the [thread member](/developers/docs/resources/channel#thread-member-object) object for the current user as a property on the channel, if the current user is a member of the thread. +- The [Guild Create](/developers/docs/events/gateway-events#guild-create) Gateway Event will contain a [thread member](/developers/docs/resources/channel#thread-member-object) object as a property on any returned threads the current is a member of. +- The [Thread Create](/developers/docs/events/gateway-events#thread-create) Gateway Event will contain a [thread member](/developers/docs/resources/channel#thread-member-object) object as a property of the thread if the current user is a member of, and the user has recently gained access to view the parent channel. +- The [Thread List Sync](/developers/docs/events/gateway-events#thread-list-sync) Gateway Event will contain an array of [thread member](/developers/docs/resources/channel#thread-member-object) objects for any returned threads the current user is a member of. ### Syncing for other users -:::info -These require the `GUILD_MEMBERS` [Gateway Intent](/docs/events/gateway#gateway-intents) -::: + +These require the `GUILD_MEMBERS` [Gateway Intent](/developers/docs/events/gateway#gateway-intents) + -- An API `GET` call to [`/channels//thread-members`](/docs/resources/channel#list-thread-members) which returns an array of [thread member](/docs/resources/channel#thread-member-object) objects. -- The [Thread Members Update](/docs/events/gateway-events#thread-members-update) Gateway Event which will include all users who were added to or removed from a thread by an action. +- An API `GET` call to [`/channels//thread-members`](/developers/docs/resources/channel#list-thread-members) which returns an array of [thread member](/developers/docs/resources/channel#thread-member-object) objects. +- The [Thread Members Update](/developers/docs/events/gateway-events#thread-members-update) Gateway Event which will include all users who were added to or removed from a thread by an action. ## Editing & Deleting Threads @@ -123,31 +126,31 @@ Threads do not explicitly set the `nsfw` field. All threads in a channel marked ## New Message Types -Threads introduce a few [message types](/docs/resources/message#message-object-message-types), and repurpose some others: +Threads introduce a few [message types](/developers/docs/resources/message#message-object-message-types), and repurpose some others: - `RECIPIENT_ADD` and `RECIPIENT_REMOVE` have been repurposed to also send when a user is added to or removed from a thread by someone else - `CHANNEL_NAME_CHANGE` has been repurposed and is sent when the thread's name is changed -- `THREAD_CREATED` is a new message sent to the parent `GUILD_TEXT` channel, used to inform users that a thread has been created. It is currently only sent in one case: when a `PUBLIC_THREAD` is created from an older message (older is still TBD, but is currently set to a very small value). The message contains a [message reference](/docs/resources/message#message-reference-structure) with the `guild_id` and `channel_id` of the thread. The `content` of the message is the `name` of the thread. -- `THREAD_STARTER_MESSAGE` is a new message sent as the first message in threads that are started from an existing message in the parent channel. It _only_ contains a [message reference](/docs/resources/message#message-reference-structure) field that points to the message from which the thread was started. +- `THREAD_CREATED` is a new message sent to the parent `GUILD_TEXT` channel, used to inform users that a thread has been created. It is currently only sent in one case: when a `PUBLIC_THREAD` is created from an older message (older is still TBD, but is currently set to a very small value). The message contains a [message reference](/developers/docs/resources/message#message-reference-structure) with the `guild_id` and `channel_id` of the thread. The `content` of the message is the `name` of the thread. +- `THREAD_STARTER_MESSAGE` is a new message sent as the first message in threads that are started from an existing message in the parent channel. It _only_ contains a [message reference](/developers/docs/resources/message#message-reference-structure) field that points to the message from which the thread was started. ## Enumerating threads There are four `GET` routes for enumerating threads in a specific channel: -- [`/guilds//threads/active`](/docs/resources/guild#list-active-guild-threads) returns all active threads in a guild that the current user can access, includes public & private threads -- [`/channels//users/@me/threads/archived/private`](/docs/resources/channel#list-joined-private-archived-threads) returns all archived, private threads in a channel, that the current user has is a member of, sorted by thread id descending -- [`/channels//threads/archived/public`](/docs/resources/channel#list-public-archived-threads) returns all archived, public threads in a channel, sorted by archive timestamp descending -- [`/channels//threads/archived/private`](/docs/resources/channel#list-private-archived-threads) returns all archived, private threads in a channel, sorted by archive timestamp descending +- [`/guilds//threads/active`](/developers/docs/resources/guild#list-active-guild-threads) returns all active threads in a guild that the current user can access, includes public & private threads +- [`/channels//users/@me/threads/archived/private`](/developers/docs/resources/channel#list-joined-private-archived-threads) returns all archived, private threads in a channel, that the current user has is a member of, sorted by thread id descending +- [`/channels//threads/archived/public`](/developers/docs/resources/channel#list-public-archived-threads) returns all archived, public threads in a channel, sorted by archive timestamp descending +- [`/channels//threads/archived/private`](/developers/docs/resources/channel#list-private-archived-threads) returns all archived, private threads in a channel, sorted by archive timestamp descending ## Webhooks -Webhooks can send messages to threads by using the `thread_id` query parameter. See the [execute webhook](/docs/resources/webhook#execute-webhook) docs for more details. +Webhooks can send messages to threads by using the `thread_id` query parameter. See the [execute webhook](/developers/docs/resources/webhook#execute-webhook) docs for more details. ## Details about Thread Access and Syncing -While the syncing of threads is similar to channels, there are two important differences that are relevant for [Thread List Sync](/docs/events/gateway-events#thread-list-sync) and [Thread Create](/docs/events/gateway-events#thread-create) events: +While the syncing of threads is similar to channels, there are two important differences that are relevant for [Thread List Sync](/developers/docs/events/gateway-events#thread-list-sync) and [Thread Create](/developers/docs/events/gateway-events#thread-create) events: -1. The [Gateway](/docs/events/gateway) will only sync threads that the app has permission to view +1. The [Gateway](/developers/docs/events/gateway) will only sync threads that the app has permission to view 2. The Gateway will only sync threads once the app has "subscribed" to the guild. For context, in Discord's official clients, a subscription happens when the user visits a channel in the guild. These differences mean there is some unique behavior that is worth going into. @@ -158,44 +161,44 @@ These differences mean there is some unique behavior that is worth going into. When an app is added to a private thread, it likely doesn't have that thread in memory yet since it doesn't have permission to view it. -Private threads are only synced to you if you are a member or a moderator. Whenever a user is added to a private thread, the Gateway also sends a [Thread Create](/docs/events/gateway-events#thread-create) event. This ensures the client always has a non-null value for that thread. +Private threads are only synced to you if you are a member or a moderator. Whenever a user is added to a private thread, the Gateway also sends a [Thread Create](/developers/docs/events/gateway-events#thread-create) event. This ensures the client always has a non-null value for that thread. -:::info + The `THREAD_CREATE` event is also sent when the user is a moderator (and thus would already have the channel in memory). -::: + #### Gaining Access to Public Threads Upon connecting to the Gateway, apps will be automatically subscribed to thread events and active threads. -However, when a non-app is added to a public thread but hasn't subscribed to threads, it may not have that thread in memory yet (which is a requirement for Discord's clients). Because of this, the Gateway will send a [Thread Create](/docs/events/gateway-events#thread-create) event when a user is added to _any_ thread, even if the event is not necessary for apps. +However, when a non-app is added to a public thread but hasn't subscribed to threads, it may not have that thread in memory yet (which is a requirement for Discord's clients). Because of this, the Gateway will send a [Thread Create](/developers/docs/events/gateway-events#thread-create) event when a user is added to _any_ thread, even if the event is not necessary for apps. ### Channel Access #### Gaining Access to Channels -When an app gains access to a channel (for example, they're given the moderator role), they likely won't have the threads in memory for that channel since the Gateway only syncs threads that the client has permission to view. To account for this, a [Thread List Sync](/docs/events/gateway-events#thread-list-sync) event is sent. +When an app gains access to a channel (for example, they're given the moderator role), they likely won't have the threads in memory for that channel since the Gateway only syncs threads that the client has permission to view. To account for this, a [Thread List Sync](/developers/docs/events/gateway-events#thread-list-sync) event is sent. -The [Thread List Sync](/docs/events/gateway-events#thread-list-sync) event contains a `channel_ids` array, which is the IDs of all channels whose threads are being synced. This field can be used to first clear out any active threads whose `parent_id` is in the `channel_ids` array, and then ingest any threads that were in the event. +The [Thread List Sync](/developers/docs/events/gateway-events#thread-list-sync) event contains a `channel_ids` array, which is the IDs of all channels whose threads are being synced. This field can be used to first clear out any active threads whose `parent_id` is in the `channel_ids` array, and then ingest any threads that were in the event. #### Losing Access to Channels -When an app loses access to a channel, the Gateway does **not** send it [Thread Delete](/docs/events/gateway-events#thread-delete) event (or any equivalent thread-specific event). Instead, the app will receive the event that caused its permissions on the channel to change. +When an app loses access to a channel, the Gateway does **not** send it [Thread Delete](/developers/docs/events/gateway-events#thread-delete) event (or any equivalent thread-specific event). Instead, the app will receive the event that caused its permissions on the channel to change. -If an app wanted to track when it lost access to any thread, it's possible but difficult as it would need to handle all cases correctly. Usually, events that cause permission changes are a [Guild Role Update](/docs/events/gateway-events#guild-role-update), [Guild Member Update](/docs/events/gateway-events#guild-member-update) or [Channel Update](/docs/events/gateway-events#channel-update) event. +If an app wanted to track when it lost access to any thread, it's possible but difficult as it would need to handle all cases correctly. Usually, events that cause permission changes are a [Guild Role Update](/developers/docs/events/gateway-events#guild-role-update), [Guild Member Update](/developers/docs/events/gateway-events#guild-member-update) or [Channel Update](/developers/docs/events/gateway-events#channel-update) event. -:::info + Discord's clients check their permissions *first* when performing an action. That way, even if it has some stale data, it does not end up acting on it. -::: + -Additionally, when a user or app loses access to a channel, they are not removed from the thread and will continue to be reported as a member of that thread. However, they will **not** receive any new Gateway events unless they are removed from the thread, in which case they will receive a [Thread Members Update](/docs/events/gateway-events#thread-members-update) event. +Additionally, when a user or app loses access to a channel, they are not removed from the thread and will continue to be reported as a member of that thread. However, they will **not** receive any new Gateway events unless they are removed from the thread, in which case they will receive a [Thread Members Update](/developers/docs/events/gateway-events#thread-members-update) event. ### Unarchiving a Thread When a thread is unarchived, there is no guarantee that an app has the thread or its member status in memory. To account for this, the Gateway will send two events (in the listed order): -1. A [Thread Update](/docs/events/gateway-events#thread-update) event, which contains the full channel object. -2. A [Thread Member Update](/docs/events/gateway-events#thread-member-update) event, which is sent to all members of the unarchived thread. Discord's clients only load active threads into memory on start, so this event is sent even if it may not be relevant to most apps. +1. A [Thread Update](/developers/docs/events/gateway-events#thread-update) event, which contains the full channel object. +2. A [Thread Member Update](/developers/docs/events/gateway-events#thread-member-update) event, which is sent to all members of the unarchived thread. Discord's clients only load active threads into memory on start, so this event is sent even if it may not be relevant to most apps. ## Forums @@ -203,22 +206,22 @@ A `GUILD_FORUM` (type `15`) channel is similar to a `GUILD_TEXT` channel, except Messages cannot be sent directly in forum channels. -:::info + More information about forum channels and how they appear in Discord can be found in the [Forum Channels FAQ](https://support.discord.com/hc/en-us/articles/6208479917079-Forum-Channels-FAQ#h_01G69FJQWTWN88HFEHK7Z6X79N) -::: + ## Media Channels A `GUILD_MEDIA` (type `16`) channel is similar to a `GUILD_FORUM` channel in that only threads can be created in them. Unless otherwise noted, threads in media channels behave in the same way as in forum channels - meaning they use the same endpoints and receive the same Gateway events. More information about media channels and how they appear in Discord can be found in the [media channels Help Center Article](https://creator-support.discord.com/hc/en-us/articles/14346342766743). -:::warn + `GUILD_MEDIA` channels are in beta and still being actively developed. The API and other technical details are subject to change. -::: + ### Creating Threads in Forum and Media Channels -Within thread-only channels, threads appear as posts. Threads can be created using the [`POST /channels//threads`](/docs/resources/channel#start-thread-in-forum-or-media-channel) endpoint with [slightly different parameters](/docs/resources/channel#start-thread-in-forum-or-media-channel-jsonform-params) than threads in text channels. For example, when creating threads in a threads-only channel, a message is created that has the same ID as the thread which requires you to pass parameters for both a thread *and* a message. +Within thread-only channels, threads appear as posts. Threads can be created using the [`POST /channels//threads`](/developers/docs/resources/channel#start-thread-in-forum-or-media-channel) endpoint with [slightly different parameters](/developers/docs/resources/channel#start-thread-in-forum-or-media-channel-jsonform-params) than threads in text channels. For example, when creating threads in a threads-only channel, a message is created that has the same ID as the thread which requires you to pass parameters for both a thread *and* a message. Threads in thread-only channels have the same permissions behavior as threads in a text channel, inheriting all permissions from the parent channel, with one exception: creating a thread in a thread-only channel only requires the `SEND_MESSAGES` permission. @@ -226,21 +229,21 @@ Threads in thread-only channels have the same permissions behavior as threads in It's worth calling out a few details about fields specific to thread-only channels that may be important to keep in mind: -- The `last_message_id` field is the ID of the most recently created thread in that channel. As with messages, your app will not receive a `CHANNEL_UPDATE` event when the field is changed. Instead clients should update the value when receiving [Thread Create](/docs/events/gateway-events#thread-create) events. +- The `last_message_id` field is the ID of the most recently created thread in that channel. As with messages, your app will not receive a `CHANNEL_UPDATE` event when the field is changed. Instead clients should update the value when receiving [Thread Create](/developers/docs/events/gateway-events#thread-create) events. - The `topic` field is what is shown in the "Guidelines" section within the Discord client. - The `rate_limit_per_user` field limits how frequently threads can be created. There is a new `default_thread_rate_limit_per_user` field on thread-only channels as well, which limits how often messages can be sent _in a thread_. This field is copied into `rate_limit_per_user` on the thread at creation time. - The `available_tags` field can be set when creating or updating a channel, which determines which tags can be set on individual threads within the thread's `applied_tags` field. -- The `flags` field indicates any [channel flags](/docs/resources/channel#channel-object-channel-flags) set for a thread-only channel. Currently only `REQUIRE_TAG` can be used, which requires that a tag from `available_tags` be specified when creating a thread in that channel. +- The `flags` field indicates any [channel flags](/developers/docs/resources/channel#channel-object-channel-flags) set for a thread-only channel. Currently only `REQUIRE_TAG` can be used, which requires that a tag from `available_tags` be specified when creating a thread in that channel. -All fields for channels, including thread-only channels, can be found in the [Channel Object](/docs/resources/channel#channel-object). +All fields for channels, including thread-only channels, can be found in the [Channel Object](/developers/docs/resources/channel#channel-object). ### Forum and Media Channel Thread Fields -A thread can be pinned within a thread-only, which will be represented as the [`PINNED` flag](/docs/resources/channel#channel-object-channel-flags) in the `flags` field within a thread-only channel. A thread that is pinned will have the `(1 << 1)` flag set, and archiving that thread will unset the flag. A pinned thread will *not* auto-archive. +A thread can be pinned within a thread-only, which will be represented as the [`PINNED` flag](/developers/docs/resources/channel#channel-object-channel-flags) in the `flags` field within a thread-only channel. A thread that is pinned will have the `(1 << 1)` flag set, and archiving that thread will unset the flag. A pinned thread will *not* auto-archive. The `message_count` and `total_message_sent` fields on threads in thread-only channels will increment on `MESSAGE_CREATE` events, and decrement on `MESSAGE_DELETE` and `MESSAGE_DELETE_BULK` events. There will be no specific `CHANNEL_UPDATE` event that notifies your app of changes to those fields—instead, apps should update those values when receiving corresponding events. -All fields for threads in thread-only channels can be found in the [channel resources documentation](/docs/resources/channel#start-thread-in-forum-or-media-channel-jsonform-params). +All fields for threads in thread-only channels can be found in the [channel resources documentation](/developers/docs/resources/channel#start-thread-in-forum-or-media-channel-jsonform-params). ### Forum and Media Channel Formatting diff --git a/docs/topics/voice-connections.mdx b/discord/developers/docs/topics/voice-connections.mdx similarity index 65% rename from docs/topics/voice-connections.mdx rename to discord/developers/docs/topics/voice-connections.mdx index 834a8df2f4..e96655046c 100644 --- a/docs/topics/voice-connections.mdx +++ b/discord/developers/docs/topics/voice-connections.mdx @@ -1,17 +1,23 @@ -# Voice +--- +title: Voice +description: Technical guide to implementing voice connections with Discord. +--- -Voice connections operate in a similar fashion to the [Gateway](/docs/events/gateway) connection. However, they use a different set of payloads and a separate UDP-based connection for voice data transmission. Because UDP is used for both receiving and transmitting voice data, your client _must_ be able to receive UDP packets, even through a firewall or NAT (see [UDP Hole Punching](https://en.wikipedia.org/wiki/UDP_hole_punching) for more information). The Discord Voice servers implement functionality (see [IP Discovery](/docs/topics/voice-connections#ip-discovery)) for discovering the local machines remote UDP IP/Port, which can assist in some network configurations. +import {ManualAnchor} from '/snippets/manualanchor.jsx' + +Voice connections operate in a similar fashion to the [Gateway](/developers/docs/events/gateway) connection. However, they use a different set of payloads and a separate UDP-based connection for voice data transmission. Because UDP is used for both receiving and transmitting voice data, your client _must_ be able to receive UDP packets, even through a firewall or NAT (see [UDP Hole Punching](https://en.wikipedia.org/wiki/UDP_hole_punching) for more information). The Discord Voice servers implement functionality (see [IP Discovery](/developers/docs/topics/voice-connections#ip-discovery)) for discovering the local machines remote UDP IP/Port, which can assist in some network configurations. ## Voice Gateway Versioning -To ensure that you have the most up-to-date information, please use [version 8](/docs/topics/voice-connections#voice-gateway-versioning-gateway-versions). Otherwise, we cannot guarantee that the [Opcodes](/docs/topics/opcodes-and-status-codes#voice) documented here will reflect what you receive over the socket. +To ensure that you have the most up-to-date information, please use [version 8](/developers/docs/topics/voice-connections#voice-gateway-versioning-gateway-versions). Otherwise, we cannot guarantee that the [Opcodes](/developers/docs/topics/opcodes-and-status-codes#voice) documented here will reflect what you receive over the socket. Previously if the version query string `v` was omitted the voice gateway would default to version 1. That behavior is being deprecated, in the future you must present a voice gateway version or your voice connection will be rejected. -:::warn + Versions below 4 as well as the default version behavior will be discontinued as of November 18th, 2024. Connections without a version or with a version less than version 4 will be rejected as of this date. -::: + + ###### Gateway Versions | Version | Status | WebSocket URL Append | Change | @@ -22,15 +28,16 @@ Versions below 4 as well as the default version behavior will be discontinued as | 5 | available | ?v=5 | Added video sink wants opcode | | 4 | available | ?v=4 | Changed speaking status to bitmask from boolean | | 3 | deprecated | ?v=3 | Added video | -| 2 | deprecated | ?v=2 | Changed heartbeat reply from server to heartbeak ACK opcode | +| 2 | deprecated | ?v=2 | Changed heartbeat reply from server to heartbeat ACK opcode | | 1 | deprecated | ?v=1 | Initial version | ## Connecting to Voice ### Retrieving Voice Server Information -The first step in connecting to a voice server (and in turn, a guild's voice channel) is formulating a request that can be sent to the [Gateway](/docs/events/gateway), which will return information about the voice server we will connect to. Because Discord's voice platform is widely distributed, users **should never** cache or save the results of this call. To inform the gateway of our intent to establish voice connectivity, we first send an [Opcode 4 Gateway Voice State Update](/docs/topics/opcodes-and-status-codes#gateway): +The first step in connecting to a voice server (and in turn, a guild's voice channel) is formulating a request that can be sent to the [Gateway](/developers/docs/events/gateway), which will return information about the voice server we will connect to. Because Discord's voice platform is widely distributed, users **should never** cache or save the results of this call. To inform the gateway of our intent to establish voice connectivity, we first send an [Opcode 4 Gateway Voice State Update](/developers/docs/topics/opcodes-and-status-codes#gateway): + ###### Gateway Voice State Update Example ```json @@ -45,8 +52,9 @@ The first step in connecting to a voice server (and in turn, a guild's voice cha } ``` -If our request succeeded, the gateway will respond with _two_ events—a [Voice State Update](/docs/events/gateway-events#voice-state-update) event and a [Voice Server Update](/docs/events/gateway-events#voice-server-update) event—meaning your library must properly wait for both events before continuing. The first will contain a new key, `session_id`, and the second will provide voice server information we can use to establish a new voice connection: +If our request succeeded, the gateway will respond with _two_ events—a [Voice State Update](/developers/docs/events/gateway-events#voice-state-update) event and a [Voice Server Update](/developers/docs/events/gateway-events#voice-server-update) event—meaning your library must properly wait for both events before continuing. The first will contain a new key, `session_id`, and the second will provide voice server information we can use to establish a new voice connection: + ###### Example Voice Server Update Payload ```json @@ -66,15 +74,16 @@ With this information, we can move on to establishing a voice WebSocket connecti When sending a voice state update to change channels within the same guild, it is possible to receive a VOICE_SERVER_UPDATE with the same `endpoint` as the previous VOICE_SERVER_UPDATE. The `token` will be changed and you cannot re-use the previous session during a channel change, even if the endpoint remains the same. -:::info + Bot users respect the voice channel's user limit, if set. When the voice channel is full, you will not receive the Voice State Update or Voice Server Update events in response to your own Voice State Update. Having `MANAGE_CHANNELS` permission bypasses this limit and allows you to join regardless of the channel being full or not. -::: + ## Establishing a Voice Websocket Connection -Once we retrieve a session_id, token, and endpoint information, we can connect and handshake with the voice server over another secure WebSocket. Unlike the gateway endpoint we receive in an HTTP [Get Gateway](/docs/events/gateway#get-gateway) request, the endpoint received from our [Voice Server Update](/docs/events/gateway-events#voice-server-update) payload does not contain a URL protocol, so some libraries may require manually prepending it with "wss://" before connecting. Once connected to the voice WebSocket endpoint, we can send an [Opcode 0 Identify](/docs/topics/opcodes-and-status-codes#voice) payload with our server_id, user_id, session_id, and token: +Once we retrieve a session_id, token, and endpoint information, we can connect and handshake with the voice server over another secure WebSocket. Unlike the gateway endpoint we receive in an HTTP [Get Gateway](/developers/docs/events/gateway#get-gateway) request, the endpoint received from our [Voice Server Update](/developers/docs/events/gateway-events#voice-server-update) payload does not contain a URL protocol, so some libraries may require manually prepending it with "wss://" before connecting. Once connected to the voice WebSocket endpoint, we can send an [Opcode 0 Identify](/developers/docs/topics/opcodes-and-status-codes#voice) payload with our server_id, user_id, session_id, and token: + ###### Example Voice Identify Payload ```json @@ -90,8 +99,9 @@ Once we retrieve a session_id, token, and endpoint information, we can connect a } ``` -The voice server should respond with an [Opcode 2 Ready](/docs/topics/opcodes-and-status-codes#voice) payload, which informs us of the `SSRC`, UDP IP/port, and supported encryption modes the voice server expects: +The voice server should respond with an [Opcode 2 Ready](/developers/docs/topics/opcodes-and-status-codes#voice) payload, which informs us of the `SSRC`, UDP IP/port, and supported encryption modes the voice server expects: + ###### Example Voice Ready Payload ```json @@ -107,14 +117,15 @@ The voice server should respond with an [Opcode 2 Ready](/docs/topics/opcodes-an } ``` -:::danger + `heartbeat_interval` here is an erroneous field and should be ignored. The correct `heartbeat_interval` value comes from the Hello payload. -::: + ## Heartbeating -In order to maintain your WebSocket connection, you need to continuously send heartbeats at the interval determined in [Opcode 8 Hello](/docs/topics/opcodes-and-status-codes#voice): +In order to maintain your WebSocket connection, you need to continuously send heartbeats at the interval determined in [Opcode 8 Hello](/developers/docs/topics/opcodes-and-status-codes#voice): + ###### Example Hello Payload ```json @@ -126,8 +137,9 @@ In order to maintain your WebSocket connection, you need to continuously send he } ``` -After receiving [Opcode 8 Hello](/docs/topics/opcodes-and-status-codes#voice), you should send [Opcode 3 Heartbeat](/docs/topics/opcodes-and-status-codes#voice)—which contains an integer nonce—every elapsed interval: +After receiving [Opcode 8 Hello](/developers/docs/topics/opcodes-and-status-codes#voice), you should send [Opcode 3 Heartbeat](/developers/docs/topics/opcodes-and-status-codes#voice)—which contains an integer nonce—every elapsed interval: + ###### Example Heartbeat Payload since V8 ```json @@ -140,8 +152,9 @@ After receiving [Opcode 8 Hello](/docs/topics/opcodes-and-status-codes#voice), y } ``` -Since voice gateway version 8, heartbeat messages must include `seq_ack` which contains the sequence number of last numbered message received from the gateway. See [Buffered Resume](/docs/topics/voice-connections#buffered-resume) for more information. +Since voice gateway version 8, heartbeat messages must include `seq_ack` which contains the sequence number of last numbered message received from the gateway. See [Buffered Resume](/developers/docs/topics/voice-connections#buffered-resume) for more information. + ###### Example Heartbeat Payload below V8 ```json @@ -151,8 +164,9 @@ Since voice gateway version 8, heartbeat messages must include `seq_ack` which c } ``` -In return, you will be sent back an [Opcode 6 Heartbeat ACK](/docs/topics/opcodes-and-status-codes#voice) that contains the previously sent nonce: +In return, you will be sent back an [Opcode 6 Heartbeat ACK](/developers/docs/topics/opcodes-and-status-codes#voice) that contains the previously sent nonce: + ###### Example Heartbeat ACK Payload since V8 ```json @@ -164,6 +178,7 @@ In return, you will be sent back an [Opcode 6 Heartbeat ACK](/docs/topics/opcode } ``` + ###### Example Heartbeat ACK Payload below V8 ```json @@ -175,8 +190,9 @@ In return, you will be sent back an [Opcode 6 Heartbeat ACK](/docs/topics/opcode ## Establishing a Voice UDP Connection -Once we receive the properties of a UDP voice server from our [Opcode 2 Ready](/docs/topics/opcodes-and-status-codes#voice) payload, we can proceed to the final step of voice connections, which entails establishing and handshaking a UDP connection for voice data. +Once we receive the properties of a UDP voice server from our [Opcode 2 Ready](/developers/docs/topics/opcodes-and-status-codes#voice) payload, we can proceed to the final step of voice connections, which entails establishing and handshaking a UDP connection for voice data. + ###### Example Ready Payload ```json @@ -189,8 +205,9 @@ Once we receive the properties of a UDP voice server from our [Opcode 2 Ready](/ } ``` -First, we open a UDP connection to the IP and port provided in the Ready payload. If required, we can now perform an [IP Discovery](/docs/topics/voice-connections#ip-discovery) using this connection. Once we've fully discovered our external IP and UDP port, we can then tell the voice WebSocket what it is, and start receiving/sending data. We do this using [Opcode 1 Select Protocol](/docs/topics/opcodes-and-status-codes#voice): +First, we open a UDP connection to the IP and port provided in the Ready payload. If required, we can now perform an [IP Discovery](/developers/docs/topics/voice-connections#ip-discovery) using this connection. Once we've fully discovered our external IP and UDP port, we can then tell the voice WebSocket what it is, and start receiving/sending data. We do this using [Opcode 1 Select Protocol](/developers/docs/topics/opcodes-and-status-codes#voice): + ###### Example Select Protocol Payload ```json @@ -211,12 +228,12 @@ First, we open a UDP connection to the IP and port provided in the Ready payload Since September 2024, Discord is migrating voice and video in DMs, Group DMs, voice channels, and Go Live streams to use end-to-end encryption (E2EE). -:::warn + To support our long-term privacy goals, we will **only support E2EE calls starting on March 1st, 2026** for all audio and video conversations in direct messages (DMs), group messages (GDMs), voice channels, and Go Live streams on Discord.

We highly recommend you implement DAVE support as soon as possible to ensure a smooth transition. -::: +
This section is a high-level overview of how to support Discord's audio & video end-to-end encryption (DAVE) protocol, centered around the voice gateway opcodes necessary for the protocol. The most thorough documentation on the DAVE protocol is found in the [Protocol Whitepaper](https://daveprotocol.com). You may additionally be able to leverage or refer to our open-source library [libdave](https://github.com/discord/libdave) to assist your implementation. The exact format of the DAVE protocol opcodes is detailed in the [Voice Gateway Opcodes section of the protocol whitepaper](https://daveprotocol.com/#voice-gateway-opcodes). @@ -224,7 +241,7 @@ When a call is E2EE, all members of the call exchange keys via a [Messaging Laye ### Binary Websocket Messages -To reduce overhead, some of the new DAVE protocol opcodes are sent as binary instead of JSON text. See the binary column in the [Voice Opcodes Table](/docs/topics/opcodes-and-status-codes#voice) to identify these opcodes. Binary websocket messages have the following format: +To reduce overhead, some of the new DAVE protocol opcodes are sent as binary instead of JSON text. See the binary column in the [Voice Opcodes Table](/developers/docs/topics/opcodes-and-status-codes#voice) to identify these opcodes. Binary websocket messages have the following format: | Field | Description | Size | |-----------------|--------------------------------------------------------------------|----------------| @@ -232,35 +249,35 @@ To reduce overhead, some of the new DAVE protocol opcodes are sent as binary ins | Opcode | Unsigned integer opcode value | 1 bytes | | Payload | Binary message payload (format defined by opcode) | Variable bytes | -Sequence numbers are only sent from the server to the client, and all server-sent binary opcodes require the sequence number. See [Resuming Voice Connection](/docs/topics/voice-connections#resuming-voice-connection) for further details on how sequence numbers are used when present. +Sequence numbers are only sent from the server to the client, and all server-sent binary opcodes require the sequence number. See [Resuming Voice Connection](/developers/docs/topics/voice-connections#resuming-voice-connection) for further details on how sequence numbers are used when present. ### Indicating DAVE Protocol Support -Include the highest DAVE protocol version you support in [Opcode 0 Identify](/docs/topics/opcodes-and-status-codes#voice) as `max_dave_protocol_version`. Sending version 0, or omitting the `max_dave_protocol_version` field, indicates no DAVE protocol support. +Include the highest DAVE protocol version you support in [Opcode 0 Identify](/developers/docs/topics/opcodes-and-status-codes#voice) as `max_dave_protocol_version`. Sending version 0, or omitting the `max_dave_protocol_version` field, indicates no DAVE protocol support. -The voice gateway specifies the initial protocol version in [Opcode 4 Session Description](/docs/topics/opcodes-and-status-codes#voice) under `dave_protocol_version`. This may be any non-discontinued protocol version equal to or less than your supported protocol version. +The voice gateway specifies the initial protocol version in [Opcode 4 Session Description](/developers/docs/topics/opcodes-and-status-codes#voice) under `dave_protocol_version`. This may be any non-discontinued protocol version equal to or less than your supported protocol version. -:::warn + Clients must retain backwards-compatibility of any non-discontinued DAVE protocol versions. The voice gateway selects the lowest shared protocol version for the call. -::: + ### Protocol Transitions The voice gateway negotiates protocol version and MLS group transitions, to ensure the continuity of media being sent for the call. This can occur when the call is upgrading/downgrading to/from E2EE (in the initial transition phase), changing protocol versions, or when the MLS group is changing. -Some opcodes include a transition ID. After preparing local state necessary to perform the transition, send [Opcode 23 DAVE Protocol Transition Ready](/docs/topics/opcodes-and-status-codes#voice) to indicate to the voice gateway that you are ready to execute the transition. When all participants are ready or when a timeout has been reached, the voice gateway dispatches [Opcode 22 DAVE Protocol Execute Transition](/docs/topics/opcodes-and-status-codes#voice) to confirm execution of the transition. The transition execution is what indicates to media senders that they can begin sending media with the new protocol context (e.g. without E2EE after a downgrade, with a new protocol version after a protocol version change, or using a new key ratchet after a group participant change). +Some opcodes include a transition ID. After preparing local state necessary to perform the transition, send [Opcode 23 DAVE Protocol Transition Ready](/developers/docs/topics/opcodes-and-status-codes#voice) to indicate to the voice gateway that you are ready to execute the transition. When all participants are ready or when a timeout has been reached, the voice gateway dispatches [Opcode 22 DAVE Protocol Execute Transition](/developers/docs/topics/opcodes-and-status-codes#voice) to confirm execution of the transition. The transition execution is what indicates to media senders that they can begin sending media with the new protocol context (e.g. without E2EE after a downgrade, with a new protocol version after a protocol version change, or using a new key ratchet after a group participant change). #### Downgrade -Downgrades to protocol version 0 are announced via [Opcode 21 DAVE Protocol Prepare Transition](/docs/topics/opcodes-and-status-codes#voice). This can occur during the transition phase when a client that does not support the protocol joins the call. When this transition is executed, senders should stop sending media using the protocol format. +Downgrades to protocol version 0 are announced via [Opcode 21 DAVE Protocol Prepare Transition](/developers/docs/topics/opcodes-and-status-codes#voice). This can occur during the transition phase when a client that does not support the protocol joins the call. When this transition is executed, senders should stop sending media using the protocol format. #### Protocol Version Change & Upgrade -Protocol version transitions (including upgrades from protocol version 0) are announced via [Opcode 24 DAVE Protocol Prepare Epoch](/docs/topics/opcodes-and-status-codes#voice). In addition to the `transition_id`, this opcode includes the `epoch_id` for the upcoming MLS epoch. +Protocol version transitions (including upgrades from protocol version 0) are announced via [Opcode 24 DAVE Protocol Prepare Epoch](/developers/docs/topics/opcodes-and-status-codes#voice). In addition to the `transition_id`, this opcode includes the `epoch_id` for the upcoming MLS epoch. -Receiving [Opcode 24 DAVE Protocol Prepare Epoch](/docs/topics/opcodes-and-status-codes#voice) with `epoch_id = 1` indicates that a new MLS group is being created. Participants must: +Receiving [Opcode 24 DAVE Protocol Prepare Epoch](/developers/docs/topics/opcodes-and-status-codes#voice) with `epoch_id = 1` indicates that a new MLS group is being created. Participants must: - prepare a local MLS group with the parameters appropriate for the DAVE protocol version -- generate and send [Opcode 26 DAVE MLS Key Package](/docs/topics/opcodes-and-status-codes#voice) to deliver a new MLS key package to the voice gateway +- generate and send [Opcode 26 DAVE MLS Key Package](/developers/docs/topics/opcodes-and-status-codes#voice) to deliver a new MLS key package to the voice gateway When the `epoch_id` is greater than 1, the protocol version of the existing MLS group is changing. @@ -268,11 +285,11 @@ When the transition is executed, senders must start sending media using the new #### MLS Group Changes -When the participants of the MLS group must change, existing participants receive an [Opcode 29 DAVE MLS Announce Commit Transition](/docs/topics/opcodes-and-status-codes#voice) whereas new members being added to the group receive [Opcode 30 DAVE MLS Welcome](/docs/topics/opcodes-and-status-codes#voice). Both opcodes include the transition ID and binary MLS Commit or MLS Welcome message. +When the participants of the MLS group must change, existing participants receive an [Opcode 29 DAVE MLS Announce Commit Transition](/developers/docs/topics/opcodes-and-status-codes#voice) whereas new members being added to the group receive [Opcode 30 DAVE MLS Welcome](/developers/docs/topics/opcodes-and-status-codes#voice). Both opcodes include the transition ID and binary MLS Commit or MLS Welcome message. -To prepare for the protocol transition, existing group members must apply the commit to progress their local MLS group to the correct next state. [Opcode 23 DAVE Protocol Transition Ready](/docs/topics/opcodes-and-status-codes#voice) is sent when the MLS commit has been processed. +To prepare for the protocol transition, existing group members must apply the commit to progress their local MLS group to the correct next state. [Opcode 23 DAVE Protocol Transition Ready](/developers/docs/topics/opcodes-and-status-codes#voice) is sent when the MLS commit has been processed. -Welcomed members send [Opcode 23 DAVE Protocol Transition Ready](/docs/topics/opcodes-and-status-codes#voice) after succesfully joining the group received in the MLS Welcome message. +Welcomed members send [Opcode 23 DAVE Protocol Transition Ready](/developers/docs/topics/opcodes-and-status-codes#voice) after successfully joining the group received in the MLS Welcome message. ### External Sender @@ -280,17 +297,17 @@ The voice gateway must be an external sender of the MLS group, so that it can se DAVE protocol participants only process proposals which arrive from the external sender, and not from any other group members. The external sender only sends Add or Remove proposals. -The voice gateway uses [Opcode 25 DAVE MLS External Sender Package](/docs/topics/opcodes-and-status-codes#voice) to provide the external sender public key and credential to MLS group participants. This message may be sent immediately on voice gateway connection or at a later time when the call is upgrading to use the DAVE protocol. +The voice gateway uses [Opcode 25 DAVE MLS External Sender Package](/developers/docs/topics/opcodes-and-status-codes#voice) to provide the external sender public key and credential to MLS group participants. This message may be sent immediately on voice gateway connection or at a later time when the call is upgrading to use the DAVE protocol. Group creators must include the external sender they receive from the voice gateway in their MLS group extensions when creating the group. Welcomed group members ensure that the expected external sender extension is present in the group they are about to join. ### Joining the MLS Group -Except for the initial creation of the first group for the call, joining the MLS group always occurs after receiving [Opcode 30 DAVE MLS Welcome](/docs/topics/opcodes-and-status-codes#voice). +Except for the initial creation of the first group for the call, joining the MLS group always occurs after receiving [Opcode 30 DAVE MLS Welcome](/developers/docs/topics/opcodes-and-status-codes#voice). #### Key Packages -To be proposed to be added to the MLS group, pending members must send an MLS key package via [Opcode 26 DAVE MLS Key Package](/docs/topics/opcodes-and-status-codes#voice). Key packages are only used one time, and a new key package must be generated each time pending member is waiting to be added or re-added to the group. +To be proposed to be added to the MLS group, pending members must send an MLS key package via [Opcode 26 DAVE MLS Key Package](/developers/docs/topics/opcodes-and-status-codes#voice). Key packages are only used one time, and a new key package must be generated each time pending member is waiting to be added or re-added to the group. ##### Identity Public Key @@ -300,27 +317,27 @@ You can choose to generate a new ephemeral keypair for every protocol call or us #### Initial Group -When there is not yet an MLS group (e.g. a transport-only encrypted call is upgrading or two members have just joined a new call) all pending group members create a local group using the MLS parameters defined by the DAVE protocol version and including the voice gateway external sender received via [Opcode 25 DAVE MLS External Sender Package](/docs/topics/opcodes-and-status-codes#voice). Every pending member of the group has the chance to produce the initial commit that creates the MLS group with `epoch = 1`. +When there is not yet an MLS group (e.g. a transport-only encrypted call is upgrading or two members have just joined a new call) all pending group members create a local group using the MLS parameters defined by the DAVE protocol version and including the voice gateway external sender received via [Opcode 25 DAVE MLS External Sender Package](/developers/docs/topics/opcodes-and-status-codes#voice). Every pending member of the group has the chance to produce the initial commit that creates the MLS group with `epoch = 1`. Pending group members receive add proposals for every other pending group member from the voice gateway. If an additional pending member joins while there is not yet an MLS group, they receive all in-flight proposal messages. -Proposal and commit handling follows the same process whether or not there is an established group. See [Proposals and Commits](/docs/topics/voice-connections#proposals-and-commits) +Proposal and commit handling follows the same process whether or not there is an established group. See [Proposals and Commits](/developers/docs/topics/voice-connections#proposals-and-commits) #### Welcome -Pending group members receive a welcome message from another group member which adds them to the MLS group. This is dispatched from the voice gateway via [Opcode 30 DAVE MLS Welcome](/docs/topics/opcodes-and-status-codes#voice). +Pending group members receive a welcome message from another group member which adds them to the MLS group. This is dispatched from the voice gateway via [Opcode 30 DAVE MLS Welcome](/developers/docs/topics/opcodes-and-status-codes#voice). #### Invalid Group -If the group received in an [Opcode 30 DAVE MLS Welcome](/docs/topics/opcodes-and-status-codes#voice) or [Opcode 29 DAVE MLS Announce Commit Transition](/docs/topics/opcodes-and-status-codes#voice) is unprocessable, the member receiving the unprocessable message sends [Opcode 31 DAVE MLS Invalid Commit Welcome](/docs/topics/opcodes-and-status-codes#voice) to the voice gateway. Additionally, the local group state is reset and a new key package is generated and sent to the voice gateway via [Opcode 26 DAVE MLS Key Package](/docs/topics/opcodes-and-status-codes#voice). +If the group received in an [Opcode 30 DAVE MLS Welcome](/developers/docs/topics/opcodes-and-status-codes#voice) or [Opcode 29 DAVE MLS Announce Commit Transition](/developers/docs/topics/opcodes-and-status-codes#voice) is unprocessable, the member receiving the unprocessable message sends [Opcode 31 DAVE MLS Invalid Commit Welcome](/developers/docs/topics/opcodes-and-status-codes#voice) to the voice gateway. Additionally, the local group state is reset and a new key package is generated and sent to the voice gateway via [Opcode 26 DAVE MLS Key Package](/developers/docs/topics/opcodes-and-status-codes#voice). This causes the voice gateway to propose the removal and re-addition of the requesting member. ### Proposals and Commits -The voice gateway dispatches proposals which must be appended or revoked via [Opcode 27 DAVE MLS Proposals](/docs/topics/opcodes-and-status-codes#voice). All members of the established or pending MLS group must append or revoke the proposals they receive, and then produce an MLS commit message and optionally an MLS welcome message (when committing add proposals which add new members) which they send to the voice gateway via [Opcode 28 DAVE MLS Commit Welcome](/docs/topics/opcodes-and-status-codes#voice). +The voice gateway dispatches proposals which must be appended or revoked via [Opcode 27 DAVE MLS Proposals](/developers/docs/topics/opcodes-and-status-codes#voice). All members of the established or pending MLS group must append or revoke the proposals they receive, and then produce an MLS commit message and optionally an MLS welcome message (when committing add proposals which add new members) which they send to the voice gateway via [Opcode 28 DAVE MLS Commit Welcome](/developers/docs/topics/opcodes-and-status-codes#voice). -In each epoch, the voice gateway dispatches the "winning" commit via [Opcode 29 DAVE MLS Announce Commit Transition](/docs/topics/opcodes-and-status-codes#voice) and optionally the associated welcome messages via [Opcode 30 DAVE MLS Welcome](/docs/topics/opcodes-and-status-codes#voice). The voice gateway broadcasts the first valid commit and welcome(s) it sees in the given epoch, and drops any commits later received for the out-of-date epoch. All dispatched unrevoked proposals in the epoch must be included in the commit for it to be valid. All members added in the epoch must be welcomed for the welcome to be valid. +In each epoch, the voice gateway dispatches the "winning" commit via [Opcode 29 DAVE MLS Announce Commit Transition](/developers/docs/topics/opcodes-and-status-codes#voice) and optionally the associated welcome messages via [Opcode 30 DAVE MLS Welcome](/developers/docs/topics/opcodes-and-status-codes#voice). The voice gateway broadcasts the first valid commit and welcome(s) it sees in the given epoch, and drops any commits later received for the out-of-date epoch. All dispatched unrevoked proposals in the epoch must be included in the commit for it to be valid. All members added in the epoch must be welcomed for the welcome to be valid. ### Audio Frame E2EE @@ -388,7 +405,7 @@ OPUS frames are fully encrypted and no additional data is passed to the AEAD. Transport encryption between the client and the selective forwarding unit (SFU) is still used even in E2EE calls. -Voice data sent to discord should be encoded with [Opus](https://www.opus-codec.org/), using two channels (stereo) and a sample rate of 48kHz. Voice Data is sent using a [RTP Header](https://www.rfcreader.com/#rfc3550_line548), followed by encrypted Opus audio data. Voice encryption uses the key passed in [Opcode 4 Session Description](/docs/topics/opcodes-and-status-codes#voice) and the nonce formed with the 12 byte header appended with 12 null bytes to achieve the 24 required by xsalsa20_poly1305. Discord encrypts with the [libsodium](https://download.libsodium.org/doc/) encryption library. +Voice data sent to discord should be encoded with [Opus](https://www.opus-codec.org/), using two channels (stereo) and a sample rate of 48kHz. Voice Data is sent using a [RTP Header](https://www.rfcreader.com/#rfc3550_line548), followed by encrypted Opus audio data. Voice encryption uses the key passed in [Opcode 4 Session Description](/developers/docs/topics/opcodes-and-status-codes#voice) and the nonce formed with the 12 byte header appended with 12 null bytes to achieve the 24 required by xsalsa20_poly1305. Discord encrypts with the [libsodium](https://download.libsodium.org/doc/) encryption library. ### Transport Encryption Modes @@ -402,24 +419,25 @@ Voice data sent to discord should be encoded with [Opus](https://www.opus-codec. | XSalsa20 Poly1305 Suffix | xsalsa20_poly1305_suffix | 24 random bytes | Deprecated | | XSalsa20 Poly1305 Lite | xsalsa20_poly1305_lite | 32-bit incremental integer value, appended to payload | Deprecated | -:::warn + The deprecated encryption modes above will be discontinued as of November 18th, 2024. As of this date the voice gateway will not allow you to connect with one of the deprecated encryption modes. -::: + -:::warn + The nonce has to be stripped from the payload before encrypting and before decrypting the audio data -::: + The RTP size variants determine the unencrypted size of the RTP header in [the same way as SRTP](https://tools.ietf.org/html/rfc3711#section-3.1), which considers CSRCs and (optionally) the extension preamble to be part of the unencrypted header. The deprecated variants use a fixed size unencrypted header for RTP. -The voice gateway will report what encryption modes are available in [Opcode 2 Ready](/docs/topics/opcodes-and-status-codes#voice). +The voice gateway will report what encryption modes are available in [Opcode 2 Ready](/developers/docs/topics/opcodes-and-status-codes#voice). Voice gateway compatible modes will always include `aead_xchacha20_poly1305_rtpsize` but may not include `aead_aes256_gcm_rtpsize` depending on the underlying hardware. You must support `aead_xchacha20_poly1305_rtpsize`. You should prefer to use `aead_aes256_gcm_rtpsize` when it is available. -Include your selected mode in [Opcode 1 Select Protocol](/docs/topics/opcodes-and-status-codes#voice). +Include your selected mode in [Opcode 1 Select Protocol](/developers/docs/topics/opcodes-and-status-codes#voice). -Finally, the voice server will respond with a [Opcode 4 Session Description](/docs/topics/opcodes-and-status-codes#voice) that includes the `mode` and `secret_key`, a 32 byte array used for [transport encryption and sending](/docs/topics/voice-connections#transport-encryption-and-sending-voice) voice data: +Finally, the voice server will respond with a [Opcode 4 Session Description](/developers/docs/topics/opcodes-and-status-codes#voice) that includes the `mode` and `secret_key`, a 32 byte array used for [transport encryption and sending](/developers/docs/topics/voice-connections#transport-encryption-and-sending-voice) voice data: + ###### Example Session Description Payload ```json @@ -435,6 +453,7 @@ Finally, the voice server will respond with a [Opcode 4 Session Description](/do We can now start encrypting and sending voice data over the previously established UDP connection. + ###### Voice Packet Structure | Field | Type | Size | @@ -448,7 +467,7 @@ We can now start encrypting and sending voice data over the previously establish ## Speaking -Speaking updates are used to update the **speaking modes** used by the client. This speaking mode is set using a [Opcode 5 Speaking](/docs/topics/opcodes-and-status-codes#voice) payload. The client must send this at least once before sending audio to update the SSRC and set the initial speaking mode. +Speaking updates are used to update the **speaking modes** used by the client. This speaking mode is set using a [Opcode 5 Speaking](/developers/docs/topics/opcodes-and-status-codes#voice) payload. The client must send this at least once before sending audio to update the SSRC and set the initial speaking mode. The following flags can be used as a bitwise mask. For example `5` would be priority and voice. The speaking mode should not be 0 to allow sending audio. @@ -458,6 +477,7 @@ The following flags can be used as a bitwise mask. For example `5` would be prio | Soundshare | Transmission of context audio for video, no speaking indicator | `1 << 1` | | Priority | Priority speaker, lowering audio of other speakers | `1 << 2` | + ###### Example Speaking Payload ```json @@ -471,13 +491,13 @@ The following flags can be used as a bitwise mask. For example `5` would be prio } ``` -:::warn -You must send at least one [Opcode 5 Speaking](/docs/topics/opcodes-and-status-codes#voice) payload before sending voice data, or you will be disconnected with an invalid SSRC error. -::: + +You must send at least one [Opcode 5 Speaking](/developers/docs/topics/opcodes-and-status-codes#voice) payload before sending voice data, or you will be disconnected with an invalid SSRC error. + -:::info + The `delay` property should be set to `0` for bots that use the voice gateway. -::: + ### Voice Data Interpolation @@ -485,8 +505,9 @@ When there's a break in the sent data, the packet transmission shouldn't simply ## Resuming Voice Connection -When your client detects that its connection has been severed, it should open a new WebSocket connection. Once the new connection has been opened, your client should send an [Opcode 7 Resume](/docs/topics/opcodes-and-status-codes#voice) payload: +When your client detects that its connection has been severed, it should open a new WebSocket connection. Once the new connection has been opened, your client should send an [Opcode 7 Resume](/developers/docs/topics/opcodes-and-status-codes#voice) payload: + ###### Example Resume Connection Payload Since V8 ```json @@ -501,6 +522,7 @@ When your client detects that its connection has been severed, it should open a } ``` + ###### Example Resume Connection Payload Before V8 ```json @@ -514,8 +536,9 @@ When your client detects that its connection has been severed, it should open a } ``` -If successful, the Voice server will respond with an [Opcode 9 Resumed](/docs/topics/opcodes-and-status-codes#voice) to signal that your client is now resumed: +If successful, the Voice server will respond with an [Opcode 9 Resumed](/developers/docs/topics/opcodes-and-status-codes#voice) to signal that your client is now resumed: + ###### Example Resumed Payload ```json @@ -525,12 +548,13 @@ If successful, the Voice server will respond with an [Opcode 9 Resumed](/docs/to } ``` -If the resume is unsuccessful—for example, due to an invalid session—the WebSocket connection will close with the appropriate [close event code](/docs/topics/opcodes-and-status-codes#voice-voice-close-event-codes). You should then follow the [Connecting](/docs/topics/voice-connections#connecting-to-voice) flow to reconnect. +If the resume is unsuccessful—for example, due to an invalid session—the WebSocket connection will close with the appropriate [close event code](/developers/docs/topics/opcodes-and-status-codes#voice-voice-close-event-codes). You should then follow the [Connecting](/developers/docs/topics/voice-connections#connecting-to-voice) flow to reconnect. ### Buffered Resume Since voice gateway version 8, the gateway can resend buffered messages that have been lost upon resume. To support this, the gateway includes a sequence number with all messages that may need to be re-sent. + ###### Example Message With Sequence Number ```json @@ -545,15 +569,15 @@ Since voice gateway version 8, the gateway can resend buffered messages that hav } ``` -A client using voice gateway version 8 must include the last sequence number they received under the data `d` key as `seq_ack` in both the [Opcode 3 Heartbeat](/docs/topics/opcodes-and-status-codes#voice) and [Opcode 7 Resume](/docs/topics/opcodes-and-status-codes#voice) payloads. +A client using voice gateway version 8 must include the last sequence number they received under the data `d` key as `seq_ack` in both the [Opcode 3 Heartbeat](/developers/docs/topics/opcodes-and-status-codes#voice) and [Opcode 7 Resume](/developers/docs/topics/opcodes-and-status-codes#voice) payloads. If no sequence numbered messages have been received, `seq_ack` can be omitted or included with a value of -1. The gateway server uses a fixed bit length sequence number and handles wrapping the sequence number around. Since voice gateway messages will always arrive in order, a client only needs to retain the last sequence number they have seen. -If the session is successfully resumed the voice gateway will respond with an [Opcode 9 Resumed](/docs/topics/opcodes-and-status-codes#voice) and will re-send any messages that the client did not receive. +If the session is successfully resumed the voice gateway will respond with an [Opcode 9 Resumed](/developers/docs/topics/opcodes-and-status-codes#voice) and will re-send any messages that the client did not receive. -The resume may be unsuccessful if the voice gateway buffer for the session no longer contains a message that has been missed. In this case the session will be closed and you should then follow the [Connecting](/docs/topics/voice-connections#connecting-to-voice) flow to reconnect. +The resume may be unsuccessful if the voice gateway buffer for the session no longer contains a message that has been missed. In this case the session will be closed and you should then follow the [Connecting](/developers/docs/topics/voice-connections#connecting-to-voice) flow to reconnect. ## IP Discovery diff --git a/docs/tutorials/configuring-app-metadata-for-linked-roles.md b/discord/developers/docs/tutorials/configuring-app-metadata-for-linked-roles.mdx similarity index 70% rename from docs/tutorials/configuring-app-metadata-for-linked-roles.md rename to discord/developers/docs/tutorials/configuring-app-metadata-for-linked-roles.mdx index cab556f2f8..801b3a6b3f 100644 --- a/docs/tutorials/configuring-app-metadata-for-linked-roles.md +++ b/discord/developers/docs/tutorials/configuring-app-metadata-for-linked-roles.mdx @@ -1,32 +1,35 @@ -# Configuring App Metadata for Linked Roles +--- +title: Configuring App Metadata for Linked Roles +description: Tutorial for setting up role connection metadata to link external app data with Discord roles. +--- Linked roles are a type of role in Discord that requires a user to connect to 3rd-party services and meet defined criteria. A role's criteria could just include the user connecting to that service, but it's often more narrow—like having a verified account, having certain stats, or having more than a certain number of followers. -Apps can define their own [role connection metadata](/docs/resources/application-role-connection-metadata), which admins can use to configure linked roles in servers where that app is installed. Apps must also set up an [OAuth2 flow](/docs/topics/oauth2) to allow users to authenticate and grant the required `role_connections.write` scope. +Apps can define their own [role connection metadata](/developers/docs/resources/application-role-connection-metadata), which admins can use to configure linked roles in servers where that app is installed. Apps must also set up an [OAuth2 flow](/developers/docs/topics/oauth2) to allow users to authenticate and grant the required `role_connections.write` scope. This tutorial walks through building a Discord app in JavaScript with linked roles support. -:::info + All of the sample code used in this tutorial can be found in the [`linked-roles-sample` GitHub repo](https://github.com/discord/linked-roles-sample) -::: + --- ## Creating an app -The first thing we’ll do is create an app through the [developer dashboard](https://discord.com/developers/applications). If you already have an app created, you can jump right to the [Running your app](/docs/tutorials/configuring-app-metadata-for-linked-roles#running-your-app) section. +The first thing we’ll do is create an app through the [developer dashboard](https://discord.com/developers/applications). If you already have an app created, you can jump right to the [Running your app](/developers/docs/tutorials/configuring-app-metadata-for-linked-roles#running-your-app) section. -:::info -Basic steps to create an app are outlined below, but a more detailed walkthrough is in the [Getting Started guide](/docs/quick-start/getting-started). -::: + +Basic steps to create an app are outlined below, but a more detailed walkthrough is in the [Getting Started guide](/developers/docs/quick-start/getting-started). + - Navigate to the [developer dashboard](https://discord.com/developers/applications) - Click **New Application** in the upper right corner, then select a name and create your app - Click on the **Bot** tab on the left sidebar. On that page, click **Reset Token** and store the token somewhere safe (like in a password manager) -:::warn + Bot tokens are used to authorize API requests and carry your bot's permissions, making them highly sensitive. Never share your token or check it into any kind of version control. -::: + ### Adding scopes @@ -36,9 +39,9 @@ Apps need approval from installing users to perform actions inside of Discord. S - Check the `bot` scope - After the scope is selected, you should see a **Generated URL** which can be used to install your app -:::info -See a list of all [OAuth2 scopes](/docs/topics/oauth2#shared-resources-oauth2-scopes), or read more on [user permissions](/docs/topics/permissions) in the documentation. -::: + +See a list of all [OAuth2 scopes](/developers/docs/topics/oauth2#shared-resources-oauth2-scopes), or read more on [user permissions](/developers/docs/topics/permissions) in the documentation. + ### Installing your app @@ -54,15 +57,15 @@ All of the code used in the example app can be found in the [GitHub repository]( This guide uses Glitch, which allows you to quickly clone and develop an app from within your browser. There are also instructions on developing locally using ngrok in the README if you'd prefer. -:::info + While Glitch is great for development and testing, [it has technical limitations](https://help.glitch.com/kb/article/17-technical-restrictions/) so other hosting providers should be considered for production apps. -::: + To start, [remix (or clone) the Glitch project 🎏](https://glitch.com/edit/#!/remix/linked-role-discord-bot) When you remix the project, you'll see a new Glitch project with a unique name similar to this: -![Glitch Remix](images/linked-roles-glitch.webp) +![Glitch Remix](/images/tutorials/linked-roles-glitch.png) #### Project structure @@ -71,11 +74,11 @@ All of the files for the project are on the left-hand side. Here's a quick glimp ``` ├── assets -> images used in this tutorial ├── src -│ ├── config.js -> Parsing of local configuration -│ ├── discord.js -> Discord specific auth & API wrapper -│ ├── register.js -> Tool to register the metadata schema -│ ├── server.js -> Main entry point for the application -│ ├── storage.js -> Provider for storing OAuth2 tokens +├──├── config.js -> Parsing of local configuration +├──├── discord.js -> Discord specific auth & API wrapper +├──├── register.js -> Tool to register the metadata schema +├──├── server.js -> Main entry point for the application +├──├── storage.js -> Provider for storing OAuth2 tokens ├── .env -> your credentials and IDs ├── .gitignore ├── package.json @@ -86,29 +89,29 @@ All of the files for the project are on the left-hand side. Here's a quick glimp There's already some code in your `server.js` file, but you’ll need your app’s token and ID to make requests. All of your credentials can be stored directly in the `.env` file. -:::warn + It bears repeating that you should never check any credentials or secrets into source control. The getting started project's `.gitignore` comes pre-loaded with `.env` to prevent it. -::: + First, copy your bot user’s token from earlier and paste it in the `DISCORD_TOKEN` variable in your `.env` file. Next, navigate to your app settings in the developer portal, and navigate to OAuth2 -> General. Copy the Client ID and Client Secret for your application, and paste the values as `DISCORD_CLIENT_ID` and `DISCORD_CLIENT_SECRET` in your `.env`. -![Configure OAuth2](images/linked-roles-oauth-config.webp) +![Configure OAuth2](/images/tutorials/linked-roles-oauth-config.png) Now, we need to set the Redirect URL that will be used for our OAuth2 flow. Go back to Glitch, and click the `Share` button for your project. Copy the public live URL for your app: -![Glitch Share](images/linked-roles-glitch-share-url.webp) +![Glitch Share](/images/tutorials/linked-roles-glitch-shared-url.png) Go back to the OAuth2 -> General tab in the Discord developer portal, and add a new redirect for your app using the Glitch URL and the `/discord-oauth-callback` route. Copy this URL, then paste it as `DISCORD_REDIRECT_URI` in your `.env`. Go to the General Information tab in the developer portal, and scroll down to the `Linked Roles Verification Url` field. Paste the base URL to your Glitch app, add the `/linked-role` route, then save. -:::info + For the Glitch project used in the screenshots, the verification URL would be `https://adjoining-crawling-yamamomo.glitch.me/linked-role` -::: + -![Verify endpoint](images/linked-roles-verify-endpoint.webp) +![Verify endpoint](/images/tutorials/linked-roles-verify-endpoint.png) Finally, to generate a unique cookie secret, go back to Glitch, and click on the `Terminal` tab. Run the following commands: @@ -131,7 +134,7 @@ COOKIE_SECRET: As a one-time step, you must tell Discord which metadata fields you are going to allow admins to use for linked roles associated with your app. -To configure connection metadata for your app, you'll call the [PUT /users/@me/applications//role-connection](/docs/resources/application-role-connection-metadata#update-application-role-connection-metadata-records) method with [application connection role metadata](/docs/resources/application-role-connection-metadata#application-role-connection-metadata-object). In the sample app, this is handled in [`src/register.js`](https://github.com/discord/linked-roles-sample/blob/main/src/register.js), and can be run via the command line. +To configure connection metadata for your app, you'll call the [PUT /users/@me/applications/<application_id>/role-connection](/developers/docs/resources/application-role-connection-metadata#update-application-role-connection-metadata-records) method with [application connection role metadata](/developers/docs/resources/application-role-connection-metadata#application-role-connection-metadata-object). In the sample app, this is handled in [`src/register.js`](https://github.com/discord/linked-roles-sample/blob/main/src/register.js), and can be run via the command line. Go back to Glitch, click the **terminal** tab, and run the following command: @@ -139,7 +142,7 @@ Go back to Glitch, click the **terminal** tab, and run the following command: $ node src/register.js ``` -![Register Metadata Schema](images/linked-roles-register.webp) +![Register Metadata Schema](/images/tutorials/linked-roles-register.png) ## Trying it out @@ -151,25 +154,25 @@ To try out the app, we'll create a linked role in a server where you have admin Give the role a name, save it, then click on `Links`. Click the `Add requirement` button, and you should see your bot in the list of available Apps. Click on it, and you will see a setup screen where you can configure specific criteria for your role. -![Verification Setup](images/linked-roles-verification-setup.webp) +![Verification Setup](/images/tutorials/linked-roles-verification-setup.png) ### Acquiring the role To acquire your newly created role, click the server name in the upper left corner of the screen, and select `Linked Roles`. Click on your role, and it will present the opportunity to connect your account. -:::info + When you connect your account, one of the scopes requested in the OAuth flow is `role_connections.write`, which is required for an app to update a user's role connection information. -::: + -![Connect accounts](images/linked-roles-connect-account.webp) +![Connect accounts](/images/tutorials/linked-roles-connect-account.png) Click on the linked role criteria. This should lead to the Discord OAuth2 consent screen. Click `Authorize`, and then return to Discord. -![Consent Dialog](images/linked-roles-consent-dialog.webp) +![Consent Dialog](/images/tutorials/linked-roles-consent-dialog.png) After returning to Discord, you should see your account granted the linked role. -![Connected](images/linked-roles-connected.webp) +![Connected](/images/tutorials/linked-roles-connected.png) Finally, create a new private channel, and add the new linked role. @@ -177,7 +180,7 @@ Finally, create a new private channel, and add the new linked role. ### Token storage -This app largely relies on Discord's [OAuth2](/docs/topics/oauth2) implementation to obtain access tokens. This model of user based authentication relies on storing refresh tokens, and using them to acquire access tokens. The example code in [`src/storage.js`](https://github.com/discord/linked-roles-sample/blob/main/src/storage.js) uses in-memory storage to manage these tokens, but for any production deployment a database with persistent storage should be used. +This app largely relies on Discord's [OAuth2](/developers/docs/topics/oauth2) implementation to obtain access tokens. This model of user based authentication relies on storing refresh tokens, and using them to acquire access tokens. The example code in [`src/storage.js`](https://github.com/discord/linked-roles-sample/blob/main/src/storage.js) uses in-memory storage to manage these tokens, but for any production deployment a database with persistent storage should be used. ### Advanced examples diff --git a/docs/tutorials/developing-a-user-installable-app.mdx b/discord/developers/docs/tutorials/developing-a-user-installable-app.mdx similarity index 76% rename from docs/tutorials/developing-a-user-installable-app.mdx rename to discord/developers/docs/tutorials/developing-a-user-installable-app.mdx index 6b2ead5806..9ffa7f51ed 100644 --- a/docs/tutorials/developing-a-user-installable-app.mdx +++ b/discord/developers/docs/tutorials/developing-a-user-installable-app.mdx @@ -1,16 +1,21 @@ -# Developing A User-Installable App +--- +title: Developing A User-Installable App +description: Tutorial for creating Discord apps that can be installed to user accounts. +--- + +import {LinkButton} from '/snippets/linkbutton.jsx' Discord apps can be installed to servers, users, or both. This guide will walk you through building a basic game integration app that is installable to both Discord users and servers. -While the tutorial will focus on supporting different [installation contexts](/docs/resources/application#installation-context), we'll be building a basic game integration along the way with a wiki lookup with user-specific bookmarking and a server leaderboard. The app has four commands (`/link`, `/profile`, `/leaderboard`, and `/wiki`) that can be run in different installation and interaction contexts (which are concepts we'll dig into later in the tutorial). +While the tutorial will focus on supporting different [installation contexts](/developers/docs/resources/application#installation-context), we'll be building a basic game integration along the way with a wiki lookup with user-specific bookmarking and a server leaderboard. The app has four commands (`/link`, `/profile`, `/leaderboard`, and `/wiki`) that can be run in different installation and interaction contexts (which are concepts we'll dig into later in the tutorial). - + - **[GitHub repository](https://github.com/discord/user-install-example)** where the code from this guide lives. - **[discord-interactions](https://github.com/discord/discord-interactions-js)**, a library that provides types and helper functions for Discord apps. - **[Express](https://expressjs.com/)**, a popular JavaScript web framework we'll use to create a server where Discord can send requests. - **[ngrok](https://ngrok.com/)**, a tool that lets us tunnel our local server to a public URL where Discord can send requests. - + --- @@ -18,7 +23,7 @@ While the tutorial will focus on supporting different [installation contexts](/d Before we dig in, you'll need the project code from the [sample app repository](https://github.com/discord/user-install-example). - + ``` ├── .env.sample -> sample .env file ├── app.js -> main entrypoint for the app @@ -29,11 +34,11 @@ Before we dig in, you'll need the project code from the [sample app repository]( ├── README.md └── .gitignore ``` - + -:::info + We'll be developing our app locally with a little help from [ngrok](https://ngrok.com/), but you can use your preferred development environment. -::: + If you don't have [NodeJS](https://nodejs.org/en/download/) installed, install that first. @@ -59,7 +64,7 @@ With that out of the way, open your new project in the code editor of your choic First, you'll need to create an app in the developer portal if you don't have one already: - +Create App Enter a name for your app, then press **Create**. @@ -69,9 +74,9 @@ After you create your app, you'll land on the **General Overview** page of the a While we're in your app's settings, we'll want to get a few sensitive values for your app, like its token and ID. -:::warn + Your token is used to authorize API requests and carry your app's permissions, so they are *highly* sensitive. Make sure to never share your token or check it into any kind of version control. -::: + Back in your project folder, rename the `.env.sample` file to `.env`. `.env` is where we'll store all of your app's credentials. @@ -85,13 +90,13 @@ Now that you have the credentials you need, we'll configure your app to support ### Add Guild Members intent -The sample app fetches members in the server when constructing a fake game leaderboard. Getting server members requires a special permission called a [privileged intent](/docs/events/gateway#privileged-intents), so we'll add that to our app. +The sample app fetches members in the server when constructing a fake game leaderboard. Getting server members requires a special permission called a [privileged intent](/developers/docs/events/gateway#privileged-intents), so we'll add that to our app. Go to the **Bot** page and find the **Privileged Gateway Intents** section. Toggle "Server Member Intent" to be active. ### Choosing Supported Installation Contexts -An app's **[installation context](/docs/resources/application#installation-context)** defines how it's installed: to a server, to a user, or both. +An app's **[installation context](/developers/docs/resources/application#installation-context)** defines how it's installed: to a server, to a user, or both. We're going to configure our app to support both installation contexts, and while that's a good default for most apps, some apps may only make sense in one context or the other. @@ -99,11 +104,11 @@ In your app's settings, go to the **Installation** page from the sidebar. Under ### Configuring Default Install Settings -The default install settings of your app determines the default [scopes](/docs/topics/oauth2#shared-resources-oauth2-scopes) and [bot user permissions](/docs/topics/permissions) for each supported installation context. At the moment, apps installed to a user context only support the `applications.commands` scope (which allows your app to install [commands](/docs/interactions/application-commands)) in the default install settings. +The default install settings of your app determines the default [scopes](/developers/docs/topics/oauth2#shared-resources-oauth2-scopes) and [bot user permissions](/developers/docs/topics/permissions) for each supported installation context. At the moment, apps installed to a user context only support the `applications.commands` scope (which allows your app to install [commands](/developers/docs/interactions/application-commands)) in the default install settings. ###### Update Install Link -Before adding default install settings, we need to select Discord Provided Link for the app's [install link](/docs/resources/application#install-links). Under the **Install Link** section, select `Discord Provided Link` from the dropdown if it isn't already selected (it should be by default). Once it's selected, the **Default Install Settings** will appear. +Before adding default install settings, we need to select Discord Provided Link for the app's [install link](/developers/docs/resources/application#install-links). Under the **Install Link** section, select `Discord Provided Link` from the dropdown if it isn't already selected (it should be by default). Once its selected, the **Default Install Settings** will appear. ###### Adding Default Install Settings @@ -111,13 +116,13 @@ Under the **Default Install Settings** section: - For **User Install**, add the `applications.commands` scope - For **Guild Install**, add the `applications.commands` scope and `bot` scope. When you select `bot`, a new **Permissions** menu will appear to select the bot user's permissions. Select any permissions that you may want for your app—for now, I'll just select `Send Messages`. -:::info -Permissions for a bot user are very similar to permissions for other Discord users. Details about permissions, and a list of available permissions is on the [Permissions](/docs/topics/permissions#permissions-bitwise-permission-flags) page. -::: + +Permissions for a bot user are very similar to permissions for other Discord users. Details about permissions, and a list of available permissions is on the [Permissions](/developers/docs/topics/permissions#permissions-bitwise-permission-flags) page. + After you've selected the scopes and permissions for your app, click **Save Changes**. -![Installation settings in App Settings](images/user-install-settings.webp) +![Installation settings in App Settings](/images/tutorials/user-install-settings.png) ### Installing your app @@ -137,17 +142,17 @@ Follow the installation prompt to install your app to your user account. Once it ## Step 2: Setting Up Commands -Next, we'll register the [application commands](/docs/interactions/application-commands) for our app. But before touching code, it's important to understand the concept of command contexts: +Next, we'll register the [application commands](/developers/docs/interactions/application-commands) for our app. But before touching code, it's important to understand the concept of command contexts: - + Commands have two context fields that can be set when creating or updating a command which let you limit the supported install methods and surfaces in Discord for that command: -- **`integration_types`** lets you control which **[installation contexts](/docs/interactions/application-commands#installation-context)** a command is supported (user, guild, or both). For example, the `/link` and `/profile` commands we'll be creating are only available when the app is installed to a user. -- **`contexts`** lets you set the **[interaction contexts](/docs/interactions/application-commands#interaction-contexts)**, or the surfaces in Discord, where a command can be used (in a guild channel, in your bot user's DM, and within other DMs or GDMs). For example, the `/leaderboard` command we'll be creating is only available when the command is run from a guild channel. +- **`integration_types`** lets you control which **[installation contexts](/developers/docs/interactions/application-commands#installation-context)** a command is supported (user, guild, or both). For example, the `/link` and `/profile` commands we'll be creating are only available when the app is installed to a user. +- **`contexts`** lets you set the **[interaction contexts](/developers/docs/interactions/application-commands#interaction-contexts)**, or the surfaces in Discord, where a command can be used (in a guild channel, in your bot user's DM, and within other DMs or GDMs). For example, the `/leaderboard` command we'll be creating is only available when the command is run from a guild channel. -More information and details about command contexts are in the [contexts](/docs/interactions/application-commands#contexts) documentation, but for now we'll get a better understanding of contexts by using them in our sample app. - +More information and details about command contexts are in the [contexts](/developers/docs/interactions/application-commands#contexts) documentation, but for now we'll get a better understanding of contexts by using them in our sample app. + ### Commands in the sample project @@ -160,9 +165,9 @@ We'll be setting up four commands for our sample app that all have *slightly* di | `/profile` | Get information about your game inventory and progress | `USER_INSTALL` | `GUILD`, `BOT_DM`, `PRIVATE_CHANNEL` | | `/link` | Link your game account to Discord | `USER_INSTALL` | `BOT_DM` | -:::info -The supported installation contexts for a command affects which interaction contexts you can set. Specifically, the `PRIVATE_CHANNEL` interaction context can only be included in `contexts` if `USER_INSTALL` is included in `integration_types` for the command. Read details in the [documentation](/docs/interactions/application-commands#contexts). -::: + +The supported installation contexts for a command affects which interaction contexts you can set. Specifically, the `PRIVATE_CHANNEL` interaction context can only be included in `contexts` if `USER_INSTALL` is included in `integration_types` for the command. Read details in the [documentation](/developers/docs/interactions/application-commands#contexts). + The payloads for our app's commands are in `commands.js` in the project folder in case you want to change any values or see what the command's context fields (`integration_types` and `contexts`) look like for each of the commands in the table above. @@ -174,7 +179,7 @@ Now let's register your app's commands so you can see them in Discord. In your p npm run register ``` -The register command will call the [Create Global Application Command](/docs/interactions/application-commands#create-global-application-command) endpoint for each of the command payloads in `commands.js`. +The register command will call the [Create Global Application Command](/developers/docs/interactions/application-commands#create-global-application-command) endpoint for each of the command payloads in `commands.js`. After your new commands have been created, you can go into Discord and look for the commands in the surfaces where we made them available: - In **channels within the guild you installed your app**, you should see `/leaderboard`, `/wiki`, and `/profile` @@ -200,11 +205,11 @@ First, go to your project's folder and run the following to start your app: npm run start ``` -There should be some output indicating your app is running on port 3000. Behind the scenes, our app is ready to handle interactions from Discord, which includes verifying security request headers and responding to `PING` requests. We're skipping over a lot of the details in this tutorial, but details about preparing apps for interactions is in the [Interactions Overview](/docs/interactions/overview#preparing-for-interactions) documentation. +There should be some output indicating your app is running on port 3000. Behind the scenes, our app is ready to handle interactions from Discord, which includes verifying security request headers and responding to `PING` requests. We're skipping over a lot of the details in this tutorial, but details about preparing apps for interactions is in the [Interactions Overview](/developers/docs/interactions/overview#preparing-for-interactions) documentation. -:::info + By default, the server will listen to requests sent to port 3000, but if you want to change the port, you can specify a `PORT` variable in your `.env` file. -::: + Next, we'll start our ngrok tunnel. If you don't have ngrok installed locally, you can install it by following the instructions on the [ngrok download page](https://ngrok.com/download). @@ -225,9 +230,9 @@ Go to your [app's settings](https://discord.com/developers/applications) and on Click **Save Changes** and if all is well, your Interactions Endpoint URL should be verified by Discord. -:::info + If you have troubles verifying your endpoint, make sure both ngrok and your app is running on the same port, and that you've copied the ngrok URL correctly -::: + ### Understanding metadata for interactions @@ -235,7 +240,7 @@ Now that our Interactions Endpoint URL is set up, we should now be able to run o Back on the command line, our app is logging incoming requests from Discord, so you can see what the request body for your command invocation looked like. - + The payload below is condensed to be more readable, but your interaction request body should look something like this: ```json @@ -261,15 +266,15 @@ The payload below is condensed to be more readable, but your interaction request } ``` - + -To see which command was run, you can look at the [`data` object](/docs/interactions/receiving-and-responding#interaction-object-interaction-data). +To see which command was run, you can look at the [`data` object](/developers/docs/interactions/receiving-and-responding#interaction-object-interaction-data). However, for this tutorial, we're going to focus more on the metadata related to installation and interaction contexts. There are a few metadata fields you'll want to pay attention to when building an app that can be installed to multiple interaction contexts— ###### `context` -`context` tells you which [interaction context](/docs/interactions/application-commands#interaction-contexts) the command was invoked from. Since I triggered the command from my app's DM the `context` is `1` (or `BOT_DM`). +`context` tells you which [interaction context](/developers/docs/interactions/application-commands#interaction-contexts) the command was invoked from. Since I triggered the command from my app's DM the `context` is `1` (or `BOT_DM`). With interaction context, something to keep in mind in `BOT_DM` is only the *DM with your bot user*. If you run the same command in a DM with your bestie, or in a group DM, the interaction context will be `PRIVATE_CHANNEL` (`2`). @@ -279,11 +284,11 @@ With interaction context, something to keep in mind in `BOT_DM` is only the *DM The keys in the object are the relevant installation context(s) (`GUILD_INSTALL`/`"0"` and/or `USER_INSTALL`/`"1"`). The values depend on the key, but for `USER_INSTALL` the key will always be the ID of the user that authorized your app. -:::info + `authorizing_integration_owners` is not the same as the user that triggered the interaction. Information about the user that triggered the interaction is in the `user` object. -::: + -Understanding the authorization owner can be helpful when handling interactions from message components for apps installed to a user, which is discussed more in the [message component interactions](/docs/tutorials/developing-a-user-installable-app#using-metadata-for-message-component-interactions) section. Or you can find technical details in the [Authorizing Integration Owners](/docs/interactions/receiving-and-responding#interaction-object-authorizing-integration-owners-object) documentation. +Understanding the authorization owner can be helpful when handling interactions from message components for apps installed to a user, which is discussed more in the [message component interactions](/developers/docs/tutorials/developing-a-user-installable-app#using-metadata-for-message-component-interactions) section. Or you can find technical details in the [Authorizing Integration Owners](/developers/docs/interactions/receiving-and-responding#interaction-object-authorizing-integration-owners-object) documentation. ###### `app_permissions` @@ -291,13 +296,13 @@ Understanding the authorization owner can be helpful when handling interactions In the sample payload, the value is `"442368"`. -These values can be helpful when deciding how you want your app to [respond to the interaction](/docs/interactions/receiving-and-responding#responding-to-an-interaction). For example, perhaps you want your app to respond ephemerally when a specific command is invoked from a server, which the sample app does for the `/profile` command. +These values can be helpful when deciding how you want your app to [respond to the interaction](/developers/docs/interactions/receiving-and-responding#responding-to-an-interaction). For example, perhaps you want your app to respond ephemerally when a specific command is invoked from a server, which the sample app does for the `/profile` command. ### Using metadata for command interactions As mentioned above, the `/profile` command for our app will respond ephemerally, meaning only the invoking user will see the response, when invoked from a server. If it's invoked within a DM with the bot user, it'll respond with a non-ephemeral message. In the project, you can see this logic in `app.js` when handling the `/profile` command: - + Below is the logic for handling the `/profile` command. When the context for the interaction is in a server, we'll make our interaction response ephemeral and add a button so the user can share their profile if they want. @@ -342,7 +347,7 @@ if (name === 'profile') { }); } ``` - + In the sample app code, we assign the value of `context` in the request body to a new `interactionContext` variable. Based on the context, we modify how we respond to the command interaction. If it was run in a guild or within a G(DM) other than the DM with the app's bot user, `flags` is set to `64` to make the response ephemeral, and a new button component is added so that the user can share their profile if they want. @@ -352,17 +357,17 @@ Message component interactions can be triggered by any user the component is vis Consider we added a new `/game` command supported in the `USER_INSTALL` installation context that a user could trigger to send a message to whatever guild or group DM they're in to ask others if they're interested in joining a game match: -![Sample game command response](images/user-install-game-message.webp) +![Sample game command response](/images/tutorials/user-install-game-message.png) When someone clicks on the button, our app would care about two users when handling the interaction: 1. User B, who clicked the "Join" button so our app can track who is interested in joining the match 2. User A, who ran the `/game` command so our app can tell them who is interested in joining the match -There are two additional fields to know about that can be helpful in this scenario— +There are two fields additional fields to know about that can be helpful in this scenario— ###### `interaction_metadata` -Messages created in response to an interaction will include an [`interaction_metadata` object](/docs/resources/message#message-interaction-metadata-object) which includes metadata related to the interaction. +Messages created in response to an interaction will include an [`interaction_metadata` object](/developers/docs/resources/message#message-interaction-metadata-object) which includes metadata related to the interaction. ###### `authorizing_integration_owners` @@ -374,11 +379,11 @@ For user-installed apps, it can be used to differentiate between the user that i *Yay~!* At this point, you have an app that supports both installation contexts and understand the basics of using metadata to support different contexts. Now you can go explore the documentation for details, or play with the sample app to develop more complex features. - - + + Explore the Interactions documentation to learn more about receiving and responding to commands and message components - + GitHub repository with sample project - + diff --git a/docs/tutorials/hosting-on-cloudflare-workers.md b/discord/developers/docs/tutorials/hosting-on-cloudflare-workers.mdx similarity index 85% rename from docs/tutorials/hosting-on-cloudflare-workers.md rename to discord/developers/docs/tutorials/hosting-on-cloudflare-workers.mdx index 682f7361ee..928d986c74 100644 --- a/docs/tutorials/hosting-on-cloudflare-workers.md +++ b/discord/developers/docs/tutorials/hosting-on-cloudflare-workers.mdx @@ -1,22 +1,20 @@ --- -sidebar_label: Hosting on Cloudflare Workers +title: Hosting a Reddit API Discord app on Cloudflare Workers +sidebarTitle: Hosting on Cloudflare Workers +description: Tutorial for deploying Discord apps on Cloudflare Workers. --- -# Hosting a Reddit API Discord app on Cloudflare Workers - -When building Discord apps, your app can receive common events from the client as [webhooks](/docs/resources/webhook) when users interact with your app through interactions like [application commands](/docs/interactions/application-commands) or [message components](/docs/components/reference). +When building Discord apps, your app can receive common events from the client as [webhooks](/developers/docs/resources/webhook) when users interact with your app through interactions like [application commands](/developers/docs/interactions/application-commands) or [message components](/developers/docs/components/reference). Discord will send these events to a pre-configured HTTPS endpoint (called an Interactions Endpoint URL in an app's configuration) as a JSON payload with details about the event. -This tutorial walks through building a Discord app powered by [`r/aww`](https://www.reddit.com/r/aww) using JavaScript: - -![Demo of Reddit API app](images/cloudflare-tutorial-demo.webp) +This tutorial walks through building a Discord app powered by [`r/aww`](https://www.reddit.com/r/aww) using JavaScript. All of the code for this app can be found **[on GitHub](https://github.com/discord/cloudflare-sample-app)**. ### Features and technologies used -- [Discord Interactions API](/docs/interactions/receiving-and-responding) (specifically slash commands) +- [Discord Interactions API](/developers/docs/interactions/receiving-and-responding) (specifically slash commands) - [Cloudflare Workers](https://workers.cloudflare.com/) for hosting - [Reddit API](https://www.reddit.com/dev/api/) to send messages back to the user @@ -30,23 +28,23 @@ To start, we'll create the app through the [Discord Developer Dashboard](https:/ - Click `New Application`, and choose a name - Copy your **Public Key** and **Application ID**, and put them somewhere locally (we'll need these later) -![IDs found in app settings](images/cloudflare-general-overview.webp) +![IDs found in app settings](/images/tutorials/cloudflare-general-overview.png) - Now click on the **Bot** tab on the left sidebar. - Grab the `token` for your bot, and store it somewhere safe (I like to put these tokens in a password manager like [1password](https://1password.com/) or [lastpass](https://www.lastpass.com/)). -:::warn + For security reasons, you can only view your bot token once. If you misplace your token, you'll have to generate a new one. -::: + ## Adding bot permissions -Now we'll configure the bot with [permissions](/docs/topics/permissions) required to create and use slash commands, as well as send messages in channels. +Now we'll configure the bot with [permissions](/developers/docs/topics/permissions) required to create and use slash commands, as well as send messages in channels. - Click on the `OAuth2` tab, and choose the `URL Generator`. Click the `bot` and `applications.commands` scopes. - Check the boxes next to `Send Messages` and `Use Slash Commands`, then copy the `Generated URL`. -![Configuring bot permissions in app settings](images/cloudflare-url-generator.webp) +![Configuring bot permissions in app settings](/images/tutorials/cloudflare-url-generator.png) - Paste the URL into the browser and follow the OAuth flow, selecting the server where you'd like to develop and test your bot. @@ -54,9 +52,9 @@ Now we'll configure the bot with [permissions](/docs/topics/permissions) require Cloudflare Workers are a convenient way to host Discord apps due to the free tier, simple development model, and automatically managed environment (no VMs!). -:::warn + When using Cloudflare Workers, your app won't be able to access non-ephemeral CDN media. For example, trying to fetch an image like `https://cdn.discordapp.com/attachments/1234/56789/my_image.png` would result in a `403` error. Cloudflare Workers are still able to access ephemeral CDN media. -::: + - Visit the [Cloudflare Dashboard](https://dash.cloudflare.com/) - Click on the `Workers` tab, and create a new service using the same name as your Discord bot @@ -74,9 +72,9 @@ $ wrangler secret put DISCORD_APPLICATION_ID You'll also need the Guild ID for the server where your app is installed. This can be found in the URL when you visit any channel in that server. -:::info + For example, if my URL was `https://discord.com/channels/123456/789101112`, the Guild ID is the first number—in this case **`123456`**. -::: + Once you know your Guild ID, set that variable as well: @@ -86,9 +84,9 @@ $ wrangler secret put DISCORD_TEST_GUILD_ID ## Running locally -:::info + This depends on the beta version of the `wrangler` package, which better supports ESM on Cloudflare Workers. -::: + Let's start by cloning the repository and installing dependencies. This requires at least v16 of [Node.js](https://nodejs.org/en/): @@ -103,12 +101,12 @@ A brief look at the cloned app's project structure: ``` ├── .github/workflows/ci.yaml -> GitHub Action configuration ├── src -│ ├── commands.js -> JSON payloads for commands -│ ├── reddit.js -> Interactions with the Reddit API -│ ├── register.js -> Sets up commands with the Discord API -│ ├── server.js -> Discord app logic and routing +├── ├── commands.js -> JSON payloads for commands +├── ├── reddit.js -> Interactions with the Reddit API +├── ├── register.js -> Sets up commands with the Discord API +├── ├── server.js -> Discord app logic and routing ├── test -| ├── test.js -> Tests for app +├── ├── test.js -> Tests for app ├── wrangler.toml -> Configuration for Cloudflare Workers ├── package.json ├── README.md @@ -135,7 +133,7 @@ export const INVITE_COMMAND = { }; ``` -The code to register commands lives in `register.js`. Commands can be [registered globally](/docs/interactions/application-commands#create-global-application-command), making them available for all servers with the app installed, or they can be [registered on a single server](/docs/interactions/application-commands#create-guild-application-command). +The code to register commands lives in `register.js`. Commands can be [registered globally](/developers/docs/interactions/application-commands#create-global-application-command), making them available for all servers with the app installed, or they can be [registered on a single server](/developers/docs/interactions/application-commands#create-guild-application-command). In this example - we'll just focus on global commands: @@ -215,13 +213,13 @@ When a user types a slash command, Discord will send an HTTP request to a public $ npm run ngrok ``` -![ngrok forwarding address](images/cloudflare-ngrok.webp) +![ngrok forwarding address](/images/tutorials/cloudflare-ngrok.png) This is going to bounce requests off of an external endpoint, and forward them to your machine. Copy the HTTPS link provided by the tool. It should look something like `https://8098-24-22-245-250.ngrok.io`. Now head back to the Discord Developer Dashboard, and update the `Interactions Endpoint URL` for your app: -![Interactions Endpoint URL](images/cloudflare-interactions-endpoint.webp) +![Interactions Endpoint URL](/images/tutorials/cloudflare-interactions-endpoint.png) This is the process we'll use for local testing and development. When you've published your app to Cloudflare, you will **want to update this field to use your Cloudflare Worker URL.** @@ -293,7 +291,7 @@ All of the API calls from Discord in this example will be POSTed to `/`. From he /** * Main route for all requests sent from Discord. All incoming messages will * include a JSON payload described here: - * https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object + * /developers/docs/interactions/receiving-and-responding#interaction-object */ router.post('/', async (request, env) => { const message = await request.json(); @@ -344,12 +342,12 @@ router.post('/', async (request, env) => { ## Next steps -:::info + In case you need to reference any of the code, you can find the repo [on GitHub](https://github.com/discord/cloudflare-sample-app) -::: + With your app built and deployed, you can start customizing it to be your own: -- Use **[message components](/docs/components/reference)** in your app to add more interactivity (like buttons and select menus). +- Use **[message components](/developers/docs/components/reference)** in your app to add more interactivity (like buttons and select menus). - Take a look at different **[public APIs](https://github.com/public-apis/public-apis)** on GitHub. - Join the **[Discord Developers server](https://discord.gg/discord-developers)** to ask questions about the API, attend events hosted by the Discord API team, and interact with other developers. diff --git a/docs/tutorials/upgrading-to-application-commands.md b/discord/developers/docs/tutorials/upgrading-to-application-commands.mdx similarity index 63% rename from docs/tutorials/upgrading-to-application-commands.md rename to discord/developers/docs/tutorials/upgrading-to-application-commands.mdx index b3744a2bd2..e62a1c13e6 100644 --- a/docs/tutorials/upgrading-to-application-commands.md +++ b/discord/developers/docs/tutorials/upgrading-to-application-commands.mdx @@ -1,18 +1,18 @@ --- -sidebar_label: Upgrading to Application Commands +title: Upgrading Apps to Use Application Commands +sidebarTitle: Upgrading to Application Commands +description: Migration guide for upgrading from legacy text commands to application commands. --- -# Upgrading Apps to Use Application Commands - -As [message content has become a privileged intent](https://support-dev.discord.com/hc/en-us/articles/4404772028055-Message-Content-Privileged-Intent-FAQ) for verified apps, [application commands](/docs/interactions/application-commands) are the primary way Discord users interact with apps. The three types of commands (slash commands, user commands, and message commands) act as entry points into apps, and can be registered globally or for a subset of guilds. +As [message content has become a privileged intent](https://support-dev.discord.com/hc/en-us/articles/4404772028055-Message-Content-Privileged-Intent-FAQ) for verified apps, [application commands](/developers/docs/interactions/application-commands) are the primary way Discord users interact with apps. The three types of commands (slash commands, user commands, and message commands) act as entry points into apps, and can be registered globally or for a subset of guilds. This guide is intended to provide developers with apps currently using message content with a resource to walk through implementing and designing commands. Throughout the guide, the terms "application commands" and "commands" are used interchangeably. -![Client interfaces showing the different types of application commands](images/command-types.webp) +![Client interfaces showing the different types of application commands](/images/tutorials/command-types.png) -:::info -If you are developing an app for the first time, the [commands documentation](/docs/interactions/application-commands) may be a more helpful resource for you. -::: + +If you are developing an app for the first time, the [commands documentation](/developers/docs/interactions/application-commands) may be a more helpful resource for you. + Before diving in, it’s worth noting that with the message content changes, apps can still access message content in their DMs with users, as well as when messages are sent that directly `@mentions` their bot user (since there is clear user intent that the bot can read those messages). @@ -26,21 +26,21 @@ There are three types of application commands: slash commands, user commands, an ### Slash Commands -[Slash commands](/docs/interactions/application-commands#slash-commands) are the most common type of command. They are accessed by typing a forward slash (`/`) followed by the command’s name, or by using the plus button (+) to the left of the message input. +[Slash commands](/developers/docs/interactions/application-commands#slash-commands) are the most common type of command. They are accessed by typing a forward slash (`/`) followed by the command’s name, or by using the plus button (+) to the left of the message input. Slash commands can appear in channels and DMs, so they’re helpful when an action is tied to a channel, a server, or nothing at all. ### User Commands -[User commands](/docs/interactions/application-commands#user-commands) are in the context menu for users, which is accessed by right-clicking or tapping on any user. They’re helpful when an action is tied to an individual user, like a moderation app adding a timeout to someone. +[User commands](/developers/docs/interactions/application-commands#user-commands) are in the context menu for users, which is accessed by right-clicking or tapping on any user. They’re helpful when an action is tied to an individual user, like a moderation app adding a timeout to someone. -:::info + Within the context menus for users and messages, the `Apps` submenu will only appear if an app in that server has installed a corresponding command (whether or not an individual user can use the installed command). -::: + ### Message Commands -[Message commands](/docs/interactions/application-commands#message-commands) are in the context menu for messages, which is accessed by right-clicking on a message, or by clicking on the ellipses at the top-right of a message. They’re helpful when an action is tied to a message, like creating a reminder to reply to a message the following day. +[Message commands](/developers/docs/interactions/application-commands#message-commands) are in the context menu for messages, which is accessed by right-clicking on a message, or by clicking on the ellipses at the top-right of a message. They’re helpful when an action is tied to a message, like creating a reminder to reply to a message the following day. ### After This Section - Start thinking about how different app features might map to the different types of application commands. @@ -49,32 +49,32 @@ Within the context menus for users and messages, the `Apps` submenu will only ap Commands can be registered via HTTP requests after an app is authorized with the `applications.commands` scope. The `applications.commands` scope is also automatically included when an app requests the `bot` scope. -:::info -There is a section on [designing commands](/docs/tutorials/upgrading-to-application-commands#designing-for-commands) below implementation details that may be helpful as you start mapping out different commands -::: + +There is a section on [designing commands](/developers/docs/tutorials/upgrading-to-application-commands#designing-for-commands) below implementation details that may be helpful as you start mapping out different commands + The API endpoint to register (or create) commands is different depending on its scope: -- **[Global commands](/docs/interactions/application-commands#making-a-global-command)** are available in all of the servers where your app is installed, and can be created using the [`/applications/{YOUR APP ID}/commands` endpoint](/docs/interactions/application-commands#create-global-application-command). All of your app's global commands will automatically be added to the servers your app is installed in, regardless of whether they were registered before or after installation. -- **[Guild commands](/docs/interactions/application-commands#making-a-guild-command)** are only available in the servers you explicitly add them to via the API, making them useful for features available only to a subset of guilds. They can be created using the [`/applications/{YOUR APP ID}/guilds/{A GUILD ID}/commands` endpoint](/docs/interactions/application-commands#create-guild-application-command). +- **[Global commands](/developers/docs/interactions/application-commands#making-a-global-command)** are available in all of the servers where your app is installed, and can be created using the [`/applications/{YOUR APP ID}/commands` endpoint](/developers/docs/interactions/application-commands#create-global-application-command). All of your app's global commands will automatically be added to the servers your app is installed in, regardless of whether they were registered before or after installation. +- **[Guild commands](/developers/docs/interactions/application-commands#making-a-guild-command)** are only available in the servers you explicitly add them to via the API, making them useful for features available only to a subset of guilds. They can be created using the [`/applications/{YOUR APP ID}/guilds/{A GUILD ID}/commands` endpoint](/developers/docs/interactions/application-commands#create-guild-application-command). -While most apps won’t need to register more than a handful of commands, apps can have up to 100 global slash commands and 100 guild slash commands with unique names. They can also have 5 global user commands and 5 global message commands. Different limitations apply for global and guild commands, which can be found [in the documentation](/docs/interactions/application-commands#registering-a-command). +While most apps won’t need to register more than a handful of commands, apps can have up to 100 global slash commands and 100 guild slash commands with unique names. They can also have 5 global user commands and 5 global message commands. Different limitations apply for global and guild commands, which can be found [in the documentation](/developers/docs/interactions/application-commands#registering-a-command). ### Using Options as Parameters -Command options is an optional field (`options`) that can be defined when creating commands. When used, options will display for the user to fill out during invocation. You can also provide dynamic option suggestions using the `autocomplete` field. Read more about options [in the documentation](/docs/interactions/application-commands#application-command-object-application-command-option-structure). +Command options is an optional field (`options`) that can be defined when creating commands. When used, options will display for the user to fill out during invocation. You can also provide dynamic option suggestions using the `autocomplete` field. Read more about options [in the documentation](/developers/docs/interactions/application-commands#application-command-object-application-command-option-structure). -![Slash command using options](images/slash-command-options.png) +![Slash command using options](/images/tutorials/slash-command-options.png) ### Using Subcommands to Group Actions -[Subcommands and subcommand groups](/docs/interactions/application-commands#subcommands-and-subcommand-groups) help organize commands that are related to a shared resource or action. Instead of several top-level commands (like `/add-resource` and `/delete-resource`), you can have one top-level command with several subcommands (like `/resource add` and `/resource delete`). +[Subcommands and subcommand groups](/developers/docs/interactions/application-commands#subcommands-and-subcommand-groups) help organize commands that are related to a shared resource or action. Instead of several top-level commands (like `/add-resource` and `/delete-resource`), you can have one top-level command with several subcommands (like `/resource add` and `/resource delete`). Subcommands use the same `options` field as passing parameters, but with a type of `2`. ### Restricting Command Use -[Application command permissions](/docs/interactions/application-commands#permissions) allow users and apps to restrict command usage in a server. When commands are restricted for a user, they won't appear for them in the client. +[Application command permissions](/developers/docs/interactions/application-commands#permissions) allow users and apps to restrict command usage in a server. When commands are restricted for a user, they won't appear for them in the client. If your app currently relies on permissioning, using command permissions can be a way to port them. It also cleans up the command picker UI for users, making it easier for them to find your app’s commands that are most relevant to them. @@ -114,13 +114,13 @@ Below is a sample payload to create a global slash command with an optional para #### Default Permissions -When [creating](/docs/interactions/application-commands#create-global-application-command) or [updating](/docs/interactions/application-commands#edit-global-application-command) a command, you can use the `default_member_permissions` field to restrict the command to a set of bitwise permissions that reflect the default permission flags a user must be granted in order to use the command. +When [creating](/developers/docs/interactions/application-commands#create-global-application-command) or [updating](/developers/docs/interactions/application-commands#edit-global-application-command) a command, you can use the `default_member_permissions` field to restrict the command to a set of bitwise permissions that reflect the default permission flags a user must be granted in order to use the command. In addition, the `dm_permission` flag can be used to control whether a global command is available in DMs (not available for guild commands). #### Updating Permissions -Permissions for specific roles, users, and channels can be updated by your app if you have the `applications.commands.permissions.update` scope and a [Bearer token](/docs/topics/oauth2) that’s authenticated by a user with the necessary user permissions. Details about updating a command’s permissions are [in the documentation](/docs/interactions/application-commands#permissions). +Permissions for specific roles, users, and channels can be updated by your app if you have the `applications.commands.permissions.update` scope and a [Bearer token](/developers/docs/topics/oauth2) that’s authenticated by a user with the necessary user permissions. Details about updating a command’s permissions are [in the documentation](/developers/docs/interactions/application-commands#permissions). ### After This Section @@ -131,34 +131,34 @@ Permissions for specific roles, users, and channels can be updated by your app i ## Handling Commands -Commands use the [interactions model](/docs/interactions/receiving-and-responding) through HTTP-based outgoing webhooks or the WebSocket-based [Interaction Create gateway event](/docs/events/gateway-events#interaction-create). Regardless of the transit method used to arrive, your app will receive relevant information when a Discord user triggers one of your app’s interactions. +Commands use the [interactions model](/developers/docs/interactions/receiving-and-responding) through HTTP-based outgoing webhooks or the WebSocket-based [Interaction Create gateway event](/developers/docs/events/gateway-events#interaction-create). Regardless of the transit method used to arrive, your app will receive relevant information when a Discord user triggers one of your app’s interactions. -:::warn -If you continue using Gateway events, you’ll still receive message events but the payloads will have empty string or array data for message content-related fields like `content`, `embeds`, `attachments`, and `components` while `poll` will be omitted. You can read more in the [message content intent](/docs/events/gateway#message-content-intent) section. -::: + +If you continue using Gateway events, you’ll still receive message events but the payloads will have empty string or array data for message content-related fields like `content`, `embeds`, `attachments`, and `components` while `poll` will be omitted. You can read more in the [message content intent](/developers/docs/events/gateway#message-content-intent) section. + -For commands, this means that each time one of your commands is used, your app will receive information like the command name and the user who triggered it. More information about this information is below in the section on [parsing command payloads](/docs/tutorials/upgrading-to-application-commands#parsing-command-payloads). +For commands, this means that each time one of your commands is used, your app will receive information like the command name and the user who triggered it. More information about this information is below in the section on [parsing command payloads](/developers/docs/tutorials/upgrading-to-application-commands#parsing-command-payloads). ### Adding an Interactions Endpoint URL -:::info -This step is specific to receiving interactions over HTTP. If you prefer to use the [Gateway](/docs/events/gateway), this step won't be applicable to your app. -::: + +This step is specific to receiving interactions over HTTP. If you prefer to use the [Gateway](/developers/docs/events/gateway), this step won't be applicable to your app. + Before your app can receive interactions, you’ll need to set up an **Interaction Endpoint URL** in your app settings. This endpoint should be a public URL where Discord can send all interactions-related requests. However, before adding your URL to your app settings, your endpoint must be set up to handle two things: -1. **Responding to `PING` events**: When you save a URL in your settings, Discord will send a `POST` request with `type: 1`. To acknowledge this request (and thus verify your endpoint), you should return a `200` response with a payload containing `type: 1`. More information can be found in the [Receiving an Interaction documentation](/docs/interactions/receiving-and-responding#receiving-an-interaction). -2. **Verifying request signatures**: To ensure that requests are coming from Discord, your endpoint must verify each request using the included headers, specifically `X-Signature-Ed25519` and `X-Signature-Timestamp`. If the signature fails validating, your app should return a `401` response. More information and example code can be found in the [Security and Authorization documentation](/docs/interactions/overview#setting-up-an-endpoint-validating-security-request-headers). +1. **Responding to `PING` events**: When you save a URL in your settings, Discord will send a `POST` request with `type: 1`. To acknowledge this request (and thus verify your endpoint), you should return a `200` response with a payload containing `type: 1`. More information can be found in the [Receiving an Interaction documentation](/developers/docs/interactions/receiving-and-responding#receiving-an-interaction). +2. **Verifying request signatures**: To ensure that requests are coming from Discord, your endpoint must verify each request using the included headers, specifically `X-Signature-Ed25519` and `X-Signature-Timestamp`. If the signature fails validating, your app should return a `401` response. More information and example code can be found in the [Security and Authorization documentation](/developers/docs/interactions/overview#setting-up-an-endpoint-validating-security-request-headers). -:::info -Many libraries on the [Community Resources page](/docs/developer-tools/community-resources#interactions) simplify verification and interaction request handling by exporting reusable functions and/or handling it automatically. -::: + +Many libraries on the [Community Resources page](/developers/docs/developer-tools/community-resources#interactions) simplify verification and interaction request handling by exporting reusable functions and/or handling it automatically. + After your URL is set up to handle signature verification and `PING` requests, you can add your Interaction Endpoint URL by navigating to your app settings from the [developer portal](https://discord.com/developers/applications). On the **General Information** page, you’ll see a field for your **Interactions Endpoint URL**. -![Interactions endpoint URL in app settings](images/interactions-url.webp) +![Interactions endpoint URL in app settings](/images/tutorials/interactions-url.png) After you paste your URL and click **Save Changes**, Discord will attempt to verify your endpoint. @@ -168,13 +168,13 @@ If all goes well, your endpoint will successfully save. And if not, you should d Once your app has a verified endpoint, you should start being able to receive command requests from Discord. -As mentioned above, these include information relevant to handling the command like its name, the user who invoked it, and the guild and channel it was invoked from. It also includes additional details that could be relevant, like the [command options](/docs/interactions/application-commands#application-command-object-application-command-option-structure) or [locale information](/docs/interactions/application-commands#localization). +As mentioned above, these include information relevant to handling the command like its name, the user who invoked it, and the guild and channel it was invoked from. It also includes additional details that could be relevant, like the [command options](/developers/docs/interactions/application-commands#application-command-object-application-command-option-structure) or [locale information](/developers/docs/interactions/application-commands#localization). -Since slash commands (`CHAT_INPUT` commands) are run in the context of a channel, you’ll notice that their payloads don’t contain any information about specific messages. If your app needs the message content, you can use [message commands](/docs/interactions/application-commands#message-commands) which *do* include the message content. +Since slash commands (`CHAT_INPUT` commands) are run in the context of a channel, you’ll notice that their payloads don’t contain any information about specific messages. If your app needs the message content, you can use [message commands](/developers/docs/interactions/application-commands#message-commands) which *do* include the message content. -:::info + In the getting started guide’s repository, there’s a code sample showing [how to create and handle commands using JavaScript](https://github.com/discord/discord-example-app/blob/main/examples/command.js). -::: + Below is an example payload your app would receive when a user invoked a global command with an option: @@ -218,7 +218,7 @@ Below is an example payload your app would receive when a user invoked a global } ``` -To determine how your app should handle an incoming command-related interaction, you can look in the `data` object which contains all of the command-specific information (including any options a user selected). Details about the full interactions object your app receives can be found in the [Interactions documentation](/docs/interactions/receiving-and-responding#interaction-object). +To determine how your app should handle an incoming command-related interaction, you can look in the `data` object which contains all of the command-specific information (including any options a user selected). Details about the full interactions object your app receives can be found in the [Interactions documentation](/developers/docs/interactions/receiving-and-responding#interaction-object). ### After This Section @@ -230,30 +230,30 @@ To determine how your app should handle an incoming command-related interaction, Adding commands to your app can add discoverability and interactivity for users. While porting your app’s features, it’s worth considering how your app will be seen and used inside of the client. This section includes a handful of areas to consider when designing your app’s commands, and what happens after they’re invoked. -:::info + CLIs (Command Line Interfaces) can be a helpful analogy when designing Discord commands, their options and subcommands, and how it all fits together into one experience. A good resource for this can be the open source [Command Interface Guidelines](https://clig.dev/). -::: + ### Choosing a Name When creating a command, keep the name short and relevant. The name of the command should give users an idea of the action they’re invoking. A description can be a bit more verbose, leaving room to be more explicit about the action and its result. -And when your app has several commands (and perhaps [subcommands](/docs/interactions/application-commands#subcommands-and-subcommand-groups)), it’s important to keep the naming scheme consistent. +And when your app has several commands (and perhaps [subcommands](/developers/docs/interactions/application-commands#subcommands-and-subcommand-groups)), it’s important to keep the naming scheme consistent. #### Examples - You should use a descriptive name like `/stats` rather than a vague name like `/get` for a command that displays stats to a user. -- You should use a shorter name like `/poll` rather than a verbose name like `/create-new-poll` for a command that creates a new poll. If there are many actions to take related to `/poll`, it might be more intuitive to use a `create` subcommand. +- You should use shorter name like `/poll` rather than a verbose name like `/create-new-poll` for a command that creates a new poll. If there are many actions to take related to `/poll`, it might be more intuitive to use a `create` subcommand. ### Collecting User Input -When commands need a bit of input from a user, you can use the `options` field. Command options can be thought of as parameters to your command. They can be one of many [types](/docs/interactions/application-commands#application-command-object-application-command-option-type), like the standard string or number, or the more Discord-specific role, user, and channel. +When commands need a bit of input from a user, you can use the `options` field. Command options can be thought of as parameters to your command. They can be one of many [types](/developers/docs/interactions/application-commands#application-command-object-application-command-option-type), like the standard string or number, or the more Discord-specific role, user, and channel. -Options are great for short input, but if you need user input that’s longer than a couple of words, like a title or description, you can collect form-like input using [modals](/docs/interactions/receiving-and-responding#interaction-response-object-modal) as a response to the command invocation. +Options are great for short input, but if you need user input that’s longer than a couple of words, like a title or description, you can collect form-like input using [modals](/developers/docs/interactions/receiving-and-responding#interaction-response-object-modal) as a response to the command invocation. ### Scoping a Command -Commands can optionally be [scoped to specific guilds](/docs/interactions/application-commands#create-guild-application-command), rather than available everywhere your app is installed. Guild commands can be useful when your app has functionality that may not be relevant to all servers like: +Commands can optionally be [scoped to specific guilds](/developers/docs/interactions/application-commands#create-guild-application-command), rather than available everywhere your app is installed. Guild commands can be useful when your app has functionality that may not be relevant to all servers like: - When a command is in development - When a specific command is opt-in or opt-out @@ -261,9 +261,9 @@ Commands can optionally be [scoped to specific guilds](/docs/interactions/applic ### Responding to a Command -Interactions (including commands) can have a hand-picked reply using one of the many available [interaction responses](/docs/interactions/receiving-and-responding#responding-to-an-interaction). +Interactions (including commands) can have a hand-picked reply using one of the many available [interaction responses](/developers/docs/interactions/receiving-and-responding#responding-to-an-interaction). -The specific response type should be picked based on the situation. Some commands may call for sending a message back to the channel where the command was invoked from, or perhaps just to the specific user who ran the command (for this, the [ephemeral message flag](/docs/interactions/receiving-and-responding#interaction-response-object-messages) can be used). Other commands may necessitate descriptive input from the user, in which case responding with a follow-up modal with text inputs might make the most sense. +The specific response type should be picked based on the situation. Some commands may call for sending a message back to the channel where the command was invoked from, or perhaps just to the specific user who ran the command (for this, the [ephemeral message flag](/developers/docs/interactions/receiving-and-responding#interaction-response-object-messages) can be used). Other commands may necessitate descriptive input from the user, in which case responding with a follow-up modal with text inputs might make the most sense. Regardless of the response, it should be picked based on the specific interaction the user is taking. @@ -273,7 +273,7 @@ For a `/search` command that searches an external service, an app could respond Ephemeral messages can also contain message components, so when relevant, there could be a button to share the information in the ephemeral message to a channel. -![Example of ephemeral message to show search results](images/examples-ephemeral-message.png) +![Example of ephemeral message to show search results](/images/tutorials/examples-ephemeral-message.png) ## Onboarding Users @@ -287,15 +287,15 @@ As to where to communicate the changes, you can start with any communication cha You can also inform users about changes within the servers your app is installed in as long as it’s done in a non-intrusive way. If your app has a dedicated channel in posts, that would be a good place. -:::warn + Don’t DM all users in a server where your app is installed. It could get your app rate limited, but more importantly, it can be pretty intrusive and might lead to your app being uninstalled. -::: + #### Example The following is an example of an app update that may be sent to communicate the new way to access commands. Depending on the different features your app adopts (like options, subcommands, permissions, etc.), an update message or changelog entry will look very different. -![Example message updating users about a new feature](images/examples-update-message.png) +![Example message updating users about a new feature](/images/tutorials/examples-update-message.png) ### Making Help Available @@ -307,6 +307,6 @@ This can come in the form of a specific command that shows app usage, a message Hopefully this guide was helpful in considering how to design and implement application commands. Below is a couple of follow-up resources you can use: -- [Application command documentation](/docs/interactions/application-commands)—I know it's linked a bunch in this guide, but there's a reason! +- [Application command documentation](/developers/docs/interactions/application-commands)—I know it's linked a bunch in this guide, but there's a reason! - Help center article on [message content intent workarounds](https://support-dev.discord.com/hc/en-us/articles/6383579033751-Message-Content-Intent-Alternatives-Workarounds) - The [DDevs server](https://discord.gg/discord-developers) where you can find API updates, ask questions about developing apps, and connect with other developers diff --git a/discord/docs.json b/discord/docs.json new file mode 100644 index 0000000000..6397fe44ec --- /dev/null +++ b/discord/docs.json @@ -0,0 +1,342 @@ +{ + "$schema": "https://mintlify.com/docs.json", + "theme": "mint", + "name": "Documentation - Discord", + "colors": { + "primary": "#5865F2", + "light": "#5865F2", + "dark": "#5865F2" + }, + "appearance": { + "default": "dark" + }, + "styling": { + "codeblocks": "system", + "eyebrows": "breadcrumbs" + }, + "favicon": "/favicon.png", + "errors": { + "404": { + "redirect": false + } + }, + "interaction": { + "drilldown": false + }, + "contextual": { + "options": [ + "copy", + "view", + "chatgpt", + "claude", + "perplexity" + ] + }, + "navigation": { + "tabs": [ + { + "tab": "Documentation", + "groups": [ + { + "group": "Home", + "pages": [ + "developers/docs/intro", + "developers/docs/reference" + ] + }, + { + "group": "Quick Start", + "pages": [ + "developers/docs/quick-start/overview-of-apps", + "developers/docs/quick-start/getting-started" + ] + }, + { + "group": "Interactions", + "pages": [ + "developers/docs/interactions/overview", + "developers/docs/interactions/receiving-and-responding", + "developers/docs/interactions/application-commands" + ] + }, + { + "group": "Components", + "pages": [ + "developers/docs/components/overview", + "developers/docs/components/using-message-components", + "developers/docs/components/using-modal-components", + "developers/docs/components/reference" + ] + }, + { + "group": "Activities", + "pages": [ + "developers/docs/activities/overview", + "developers/docs/activities/how-activities-work", + "developers/docs/activities/building-an-activity", + { + "group": "Development Guides", + "pages": [ + "developers/docs/activities/development-guides", + "developers/docs/activities/development-guides/local-development", + "developers/docs/activities/development-guides/user-actions", + "developers/docs/activities/development-guides/mobile", + "developers/docs/activities/development-guides/layout", + "developers/docs/activities/development-guides/networking", + "developers/docs/activities/development-guides/multiplayer-experience", + "developers/docs/activities/development-guides/growth-and-referrals", + "developers/docs/activities/development-guides/assets-and-metadata", + "developers/docs/activities/development-guides/production-readiness" + ] + }, + "developers/docs/activities/design-patterns" + ] + }, + { + "group": "Discord Social SDK", + "pages": [ + "developers/docs/discord-social-sdk/overview", + { + "group": "Core Concepts", + "pages": [ + "developers/docs/discord-social-sdk/core-concepts", + "developers/docs/discord-social-sdk/core-concepts/core-features", + "developers/docs/discord-social-sdk/core-concepts/communication-features", + "developers/docs/discord-social-sdk/core-concepts/integration-overview", + "developers/docs/discord-social-sdk/core-concepts/platform-compatibility", + "developers/docs/discord-social-sdk/core-concepts/oauth2-scopes" + ] + }, + { + "group": "Getting Started", + "pages": [ + "developers/docs/discord-social-sdk/getting-started", + "developers/docs/discord-social-sdk/getting-started/using-c++", + "developers/docs/discord-social-sdk/getting-started/using-unity", + "developers/docs/discord-social-sdk/getting-started/using-unreal-engine" + ] + }, + { + "group": "Development Guides", + "pages": [ + "developers/docs/discord-social-sdk/development-guides", + "developers/docs/discord-social-sdk/development-guides/account-linking-with-discord", + "developers/docs/discord-social-sdk/development-guides/account-linking-on-consoles", + "developers/docs/discord-social-sdk/development-guides/using-provisional-accounts", + "developers/docs/discord-social-sdk/development-guides/creating-a-unified-friends-list", + "developers/docs/discord-social-sdk/development-guides/managing-relationships", + "developers/docs/discord-social-sdk/development-guides/setting-rich-presence", + "developers/docs/discord-social-sdk/development-guides/managing-game-invites", + "developers/docs/discord-social-sdk/development-guides/sending-direct-messages", + "developers/docs/discord-social-sdk/development-guides/managing-lobbies", + "developers/docs/discord-social-sdk/development-guides/linked-channels", + "developers/docs/discord-social-sdk/development-guides/managing-voice-chat" + ] + }, + { + "group": "Design Guidelines", + "pages": [ + "developers/docs/discord-social-sdk/design-guidelines", + "developers/docs/discord-social-sdk/design-guidelines/principles", + "developers/docs/discord-social-sdk/design-guidelines/signing-in", + "developers/docs/discord-social-sdk/design-guidelines/connection-points", + "developers/docs/discord-social-sdk/design-guidelines/branding-guidelines", + "developers/docs/discord-social-sdk/design-guidelines/unified-friends-list", + "developers/docs/discord-social-sdk/design-guidelines/direct-messages", + "developers/docs/discord-social-sdk/design-guidelines/chat-history", + "developers/docs/discord-social-sdk/design-guidelines/social-settings", + "developers/docs/discord-social-sdk/design-guidelines/provisional-accounts", + "developers/docs/discord-social-sdk/design-guidelines/status-rich-presence", + "developers/docs/discord-social-sdk/design-guidelines/consoles", + "developers/docs/discord-social-sdk/design-guidelines/game-friends", + "developers/docs/discord-social-sdk/design-guidelines/linked-channels" + ] + }, + { + "group": "How To", + "pages": [ + "developers/docs/discord-social-sdk/how-to", + "developers/docs/discord-social-sdk/how-to/debug-log", + "developers/docs/discord-social-sdk/how-to/use-with-discord-apis", + "developers/docs/discord-social-sdk/how-to/integrate-moderation", + "developers/docs/discord-social-sdk/how-to/market-your-integration", + "developers/docs/discord-social-sdk/how-to/handle-special-characters-display-names" + ] + }, + "developers/docs/discord-social-sdk/social-sdk-reference" + ] + }, + { + "group": "Rich Presence", + "pages": [ + "developers/docs/rich-presence/overview", + "developers/docs/rich-presence/using-with-the-embedded-app-sdk", + "developers/docs/rich-presence/using-with-the-discord-social-sdk", + "developers/docs/rich-presence/using-with-the-game-sdk", + "developers/docs/rich-presence/best-practices" + ] + }, + { + "group": "Monetization", + "pages": [ + "developers/docs/monetization/overview", + "developers/docs/monetization/enabling-monetization", + "developers/docs/monetization/managing-skus", + "developers/docs/monetization/implementing-app-subscriptions", + "developers/docs/monetization/implementing-one-time-purchases", + "developers/docs/monetization/implementing-iap-for-activities" + ] + }, + { + "group": "Discovery", + "pages": [ + "developers/docs/discovery/overview", + "developers/docs/discovery/enabling-discovery", + "developers/docs/discovery/best-practices" + ] + }, + { + "group": "Events", + "pages": [ + "developers/docs/events/overview", + "developers/docs/events/gateway", + "developers/docs/events/gateway-events", + "developers/docs/events/webhook-events" + ] + }, + { + "group": "Developer Tools", + "pages": [ + "developers/docs/developer-tools/embedded-app-sdk", + "developers/docs/developer-tools/community-resources", + "developers/docs/developer-tools/game-sdk" + ] + }, + { + "group": "Resources", + "pages": [ + "developers/docs/resources/application-role-connection-metadata", + "developers/docs/resources/application", + "developers/docs/resources/audit-log", + "developers/docs/resources/auto-moderation", + "developers/docs/resources/channel", + "developers/docs/resources/emoji", + "developers/docs/resources/entitlement", + "developers/docs/resources/guild", + "developers/docs/resources/guild-scheduled-event", + "developers/docs/resources/guild-template", + "developers/docs/resources/invite", + "developers/docs/resources/lobby", + "developers/docs/resources/message", + "developers/docs/resources/poll", + "developers/docs/resources/sku", + "developers/docs/resources/soundboard", + "developers/docs/resources/stage-instance", + "developers/docs/resources/sticker", + "developers/docs/resources/subscription", + "developers/docs/resources/user", + "developers/docs/resources/voice", + "developers/docs/resources/webhook" + ] + }, + { + "group": "Topics", + "pages": [ + "developers/docs/topics/certified-devices", + "developers/docs/topics/oauth2", + "developers/docs/topics/opcodes-and-status-codes", + "developers/docs/topics/permissions", + "developers/docs/topics/rate-limits", + "developers/docs/topics/rpc", + "developers/docs/topics/teams", + "developers/docs/topics/threads", + "developers/docs/topics/voice-connections" + ] + }, + { + "group": "Tutorials", + "pages": [ + "developers/docs/tutorials/configuring-app-metadata-for-linked-roles", + "developers/docs/tutorials/developing-a-user-installable-app", + "developers/docs/tutorials/hosting-on-cloudflare-workers", + "developers/docs/tutorials/upgrading-to-application-commands" + ] + }, + { + "group": "Policies and Agreements", + "pages": [ + "developers/docs/policies/developer-policy", + "developers/docs/policies/developer-terms-of-service" + ] + } + ] + }, + { + "tab": "Change Log", + "pages": [ + "developers/docs/change-log" + ] + } + ] + }, + "redirects": [ + { + "source": "/developers/docs", + "destination": "/developers/docs/intro" + }, + { + "source": "/developers/docs/", + "destination": "/developers/docs/intro" + }, + { + "source": "/developers/docs/index", + "destination": "/developers/docs/intro" + } + ], + "logo": { + "light": "/logo/light.svg", + "dark": "/logo/dark.svg", + "href": "https://discord.com/developers/docs/" + }, + "background": { + "color": { + "light": "#ffffff", + "dark": "#36373e" + } + }, + "api": { + "playground": { + "display": "simple" + } + }, + "navbar": { + "links": [ + { + "label": "Help Center", + "href": "https://support-dev.discord.com/hc/en-us" + } + ], + "primary": { + "type": "button", + "label": "Developer Portal", + "href": "https://discord.com/developers/applications" + } + }, + "footer": { + "socials": { + "github": "https://github.com/discord/discord-api-docs", + "discord": "https://discord.gg/discord-developers", + "youtube": "https://www.youtube.com/@DiscordDevelopers", + "linkedin": "https://www.linkedin.com/showcase/discord-developers" + } + }, + "banner" : { + "content": "New docs? Check out the [change log](/developers/docs/change-log#next-generation-docs-project) to learn more!", + "dismissible": true + }, + "integrations": { + "gtm": { + "tagId": "G-5CWMJQ1S0X" + } + } +} \ No newline at end of file diff --git a/discord/favicon.png b/discord/favicon.png new file mode 100644 index 0000000000..e813e10b9c Binary files /dev/null and b/discord/favicon.png differ diff --git a/static/images/1.4vs1.5.webp b/discord/images/1.4vs1.5.webp similarity index 100% rename from static/images/1.4vs1.5.webp rename to discord/images/1.4vs1.5.webp diff --git a/static/images/activities-presence-example.png b/discord/images/activities-presence-example.png similarity index 100% rename from static/images/activities-presence-example.png rename to discord/images/activities-presence-example.png diff --git a/discord/images/activities/activities-hero.png b/discord/images/activities/activities-hero.png new file mode 100644 index 0000000000..56c65a8a0f Binary files /dev/null and b/discord/images/activities/activities-hero.png differ diff --git a/discord/images/activities/activity-instance-validation.jpg b/discord/images/activities/activity-instance-validation.jpg new file mode 100644 index 0000000000..3857dbc42e Binary files /dev/null and b/discord/images/activities/activity-instance-validation.jpg differ diff --git a/discord/images/activities/application-test-mode-prod.gif b/discord/images/activities/application-test-mode-prod.gif new file mode 100644 index 0000000000..ee66fe8963 Binary files /dev/null and b/discord/images/activities/application-test-mode-prod.gif differ diff --git a/discord/images/activities/bobble-bash.png b/discord/images/activities/bobble-bash.png new file mode 100644 index 0000000000..989916990c Binary files /dev/null and b/discord/images/activities/bobble-bash.png differ diff --git a/discord/images/activities/bobble-league.png b/discord/images/activities/bobble-league.png new file mode 100644 index 0000000000..51e1f240df Binary files /dev/null and b/discord/images/activities/bobble-league.png differ diff --git a/discord/images/activities/chess-victory.png b/discord/images/activities/chess-victory.png new file mode 100644 index 0000000000..5fcae0d705 Binary files /dev/null and b/discord/images/activities/chess-victory.png differ diff --git a/discord/images/activities/custom-link-embed.png b/discord/images/activities/custom-link-embed.png new file mode 100644 index 0000000000..ebc0183d6c Binary files /dev/null and b/discord/images/activities/custom-link-embed.png differ diff --git a/discord/images/activities/debug-logs-filtering.gif b/discord/images/activities/debug-logs-filtering.gif new file mode 100644 index 0000000000..ce8d6429f9 Binary files /dev/null and b/discord/images/activities/debug-logs-filtering.gif differ diff --git a/discord/images/activities/default_orientation_lock_state.png b/discord/images/activities/default_orientation_lock_state.png new file mode 100644 index 0000000000..201ae8990a Binary files /dev/null and b/discord/images/activities/default_orientation_lock_state.png differ diff --git a/discord/images/activities/eights.png b/discord/images/activities/eights.png new file mode 100644 index 0000000000..eab453f914 Binary files /dev/null and b/discord/images/activities/eights.png differ diff --git a/static/images/activities/embedded-app-flow-diagram.svg b/discord/images/activities/embedded-app-flow-diagram.svg similarity index 100% rename from static/images/activities/embedded-app-flow-diagram.svg rename to discord/images/activities/embedded-app-flow-diagram.svg diff --git a/discord/images/activities/enable-activities.png b/discord/images/activities/enable-activities.png new file mode 100644 index 0000000000..8fde7e3105 Binary files /dev/null and b/discord/images/activities/enable-activities.png differ diff --git a/discord/images/activities/encourage-hardware-acceleration-modal.png b/discord/images/activities/encourage-hardware-acceleration-modal.png new file mode 100644 index 0000000000..85c51fab28 Binary files /dev/null and b/discord/images/activities/encourage-hardware-acceleration-modal.png differ diff --git a/discord/images/activities/external-link-modal.png b/discord/images/activities/external-link-modal.png new file mode 100644 index 0000000000..1465b9d56d Binary files /dev/null and b/discord/images/activities/external-link-modal.png differ diff --git a/discord/images/activities/invite-dialog.png b/discord/images/activities/invite-dialog.png new file mode 100644 index 0000000000..d3bf2abe32 Binary files /dev/null and b/discord/images/activities/invite-dialog.png differ diff --git a/discord/images/activities/join-application.png b/discord/images/activities/join-application.png new file mode 100644 index 0000000000..c336d4cef9 Binary files /dev/null and b/discord/images/activities/join-application.png differ diff --git a/discord/images/activities/oauth-flow-diagram.svg b/discord/images/activities/oauth-flow-diagram.svg new file mode 100644 index 0000000000..6ce500a5a3 --- /dev/null +++ b/discord/images/activities/oauth-flow-diagram.svg @@ -0,0 +1 @@ +Discord APIApplication-ServerApplication-IframeDiscord-ClientDiscord APIApplication-ServerApplication-IframeDiscord-ClientRequest to authorize scopes(This step opens the OAuth modal)Reply with OAuth authorize codeSend OAuth code to application serverUse OAuth code and client secretto fetch access_token from developer portalReply with access_tokenReply with access_tokenApplication Instance Validation \ No newline at end of file diff --git a/discord/images/activities/oauth2-redirect.png b/discord/images/activities/oauth2-redirect.png new file mode 100644 index 0000000000..c095c12023 Binary files /dev/null and b/discord/images/activities/oauth2-redirect.png differ diff --git a/discord/images/activities/share-moment-dialog-example.png b/discord/images/activities/share-moment-dialog-example.png new file mode 100644 index 0000000000..5ba1121471 Binary files /dev/null and b/discord/images/activities/share-moment-dialog-example.png differ diff --git a/discord/images/activities/start-activity.png b/discord/images/activities/start-activity.png new file mode 100644 index 0000000000..2706616a69 Binary files /dev/null and b/discord/images/activities/start-activity.png differ diff --git a/discord/images/activities/supported-platforms.png b/discord/images/activities/supported-platforms.png new file mode 100644 index 0000000000..71f6add725 Binary files /dev/null and b/discord/images/activities/supported-platforms.png differ diff --git a/discord/images/activities/tutorial-auth.png b/discord/images/activities/tutorial-auth.png new file mode 100644 index 0000000000..d70edcae49 Binary files /dev/null and b/discord/images/activities/tutorial-auth.png differ diff --git a/discord/images/activities/tutorial-channel-name.png b/discord/images/activities/tutorial-channel-name.png new file mode 100644 index 0000000000..c2b6a947fe Binary files /dev/null and b/discord/images/activities/tutorial-channel-name.png differ diff --git a/discord/images/activities/tutorial-hero.png b/discord/images/activities/tutorial-hero.png new file mode 100644 index 0000000000..04f72676b2 Binary files /dev/null and b/discord/images/activities/tutorial-hero.png differ diff --git a/discord/images/activities/url-mapping-do.png b/discord/images/activities/url-mapping-do.png new file mode 100644 index 0000000000..e5e0ef26a5 Binary files /dev/null and b/discord/images/activities/url-mapping-do.png differ diff --git a/discord/images/activities/url-mapping-dont.png b/discord/images/activities/url-mapping-dont.png new file mode 100644 index 0000000000..806aefd7f1 Binary files /dev/null and b/discord/images/activities/url-mapping-dont.png differ diff --git a/discord/images/activities/url-mapping-tutorial.png b/discord/images/activities/url-mapping-tutorial.png new file mode 100644 index 0000000000..878a21c9c7 Binary files /dev/null and b/discord/images/activities/url-mapping-tutorial.png differ diff --git a/static/images/alerts.webp b/discord/images/alerts.webp similarity index 100% rename from static/images/alerts.webp rename to discord/images/alerts.webp diff --git a/static/images/annotated-presence-data-activities.png b/discord/images/annotated-presence-data-activities.png similarity index 100% rename from static/images/annotated-presence-data-activities.png rename to discord/images/annotated-presence-data-activities.png diff --git a/static/images/botuser-profile.webp b/discord/images/botuser-profile.webp similarity index 100% rename from static/images/botuser-profile.webp rename to discord/images/botuser-profile.webp diff --git a/static/images/bp-productpage-app-description.webp b/discord/images/bp-productpage-app-description.webp similarity index 100% rename from static/images/bp-productpage-app-description.webp rename to discord/images/bp-productpage-app-description.webp diff --git a/static/images/bp-productpage-summary-bad.webp b/discord/images/bp-productpage-summary-bad.webp similarity index 100% rename from static/images/bp-productpage-summary-bad.webp rename to discord/images/bp-productpage-summary-bad.webp diff --git a/static/images/bp-productpage-summary-good.webp b/discord/images/bp-productpage-summary-good.webp similarity index 100% rename from static/images/bp-productpage-summary-good.webp rename to discord/images/bp-productpage-summary-good.webp diff --git a/static/images/bp-productpage-tags.webp b/discord/images/bp-productpage-tags.webp similarity index 100% rename from static/images/bp-productpage-tags.webp rename to discord/images/bp-productpage-tags.webp diff --git a/discord/images/certified-device.png b/discord/images/certified-device.png new file mode 100644 index 0000000000..b3eb266027 Binary files /dev/null and b/discord/images/certified-device.png differ diff --git a/static/images/certified-device.webp b/discord/images/certified-device.webp similarity index 100% rename from static/images/certified-device.webp rename to discord/images/certified-device.webp diff --git a/static/images/cloudflare-general-overview.webp b/discord/images/cloudflare-general-overview.webp similarity index 100% rename from static/images/cloudflare-general-overview.webp rename to discord/images/cloudflare-general-overview.webp diff --git a/static/images/cloudflare-interactions-endpoint.webp b/discord/images/cloudflare-interactions-endpoint.webp similarity index 100% rename from static/images/cloudflare-interactions-endpoint.webp rename to discord/images/cloudflare-interactions-endpoint.webp diff --git a/static/images/cloudflare-ngrok.webp b/discord/images/cloudflare-ngrok.webp similarity index 100% rename from static/images/cloudflare-ngrok.webp rename to discord/images/cloudflare-ngrok.webp diff --git a/static/images/cloudflare-tutorial-demo.webp b/discord/images/cloudflare-tutorial-demo.webp similarity index 100% rename from static/images/cloudflare-tutorial-demo.webp rename to discord/images/cloudflare-tutorial-demo.webp diff --git a/static/images/cloudflare-url-generator.webp b/discord/images/cloudflare-url-generator.webp similarity index 100% rename from static/images/cloudflare-url-generator.webp rename to discord/images/cloudflare-url-generator.webp diff --git a/discord/images/command-entry-point.png b/discord/images/command-entry-point.png new file mode 100644 index 0000000000..eb359e0560 Binary files /dev/null and b/discord/images/command-entry-point.png differ diff --git a/static/images/command-entry-point.webp b/discord/images/command-entry-point.webp similarity index 100% rename from static/images/command-entry-point.webp rename to discord/images/command-entry-point.webp diff --git a/discord/images/command-types.png b/discord/images/command-types.png new file mode 100644 index 0000000000..1497c807f6 Binary files /dev/null and b/discord/images/command-types.png differ diff --git a/static/images/command-types.webp b/discord/images/command-types.webp similarity index 100% rename from static/images/command-types.webp rename to discord/images/command-types.webp diff --git a/discord/images/command-with-groups-subcommands-parameters.png b/discord/images/command-with-groups-subcommands-parameters.png new file mode 100644 index 0000000000..9c35a81e3d Binary files /dev/null and b/discord/images/command-with-groups-subcommands-parameters.png differ diff --git a/static/images/command-with-groups-subcommands-parameters.webp b/discord/images/command-with-groups-subcommands-parameters.webp similarity index 100% rename from static/images/command-with-groups-subcommands-parameters.webp rename to discord/images/command-with-groups-subcommands-parameters.webp diff --git a/discord/images/command-with-groups-subcommands.png b/discord/images/command-with-groups-subcommands.png new file mode 100644 index 0000000000..af77d45b2b Binary files /dev/null and b/discord/images/command-with-groups-subcommands.png differ diff --git a/static/images/command-with-groups-subcommands.webp b/discord/images/command-with-groups-subcommands.webp similarity index 100% rename from static/images/command-with-groups-subcommands.webp rename to discord/images/command-with-groups-subcommands.webp diff --git a/discord/images/command.png b/discord/images/command.png new file mode 100644 index 0000000000..cc0c23e7c6 Binary files /dev/null and b/discord/images/command.png differ diff --git a/static/images/command.webp b/discord/images/command.webp similarity index 100% rename from static/images/command.webp rename to discord/images/command.webp diff --git a/discord/images/components/action-row.png b/discord/images/components/action-row.png new file mode 100644 index 0000000000..376bf28294 Binary files /dev/null and b/discord/images/components/action-row.png differ diff --git a/static/images/components/action-row.webp b/discord/images/components/action-row.webp similarity index 100% rename from static/images/components/action-row.webp rename to discord/images/components/action-row.webp diff --git a/discord/images/components/channel-select.png b/discord/images/components/channel-select.png new file mode 100644 index 0000000000..ab89bda496 Binary files /dev/null and b/discord/images/components/channel-select.png differ diff --git a/static/images/components/channel-select.webp b/discord/images/components/channel-select.webp similarity index 100% rename from static/images/components/channel-select.webp rename to discord/images/components/channel-select.webp diff --git a/discord/images/components/container.png b/discord/images/components/container.png new file mode 100644 index 0000000000..68c71c2e58 Binary files /dev/null and b/discord/images/components/container.png differ diff --git a/static/images/components/container.webp b/discord/images/components/container.webp similarity index 100% rename from static/images/components/container.webp rename to discord/images/components/container.webp diff --git a/static/images/components/file-upload-modal-example.webp b/discord/images/components/file-upload-modal-example.webp similarity index 100% rename from static/images/components/file-upload-modal-example.webp rename to discord/images/components/file-upload-modal-example.webp diff --git a/discord/images/components/file.png b/discord/images/components/file.png new file mode 100644 index 0000000000..28076faa40 Binary files /dev/null and b/discord/images/components/file.png differ diff --git a/static/images/components/file.webp b/discord/images/components/file.webp similarity index 100% rename from static/images/components/file.webp rename to discord/images/components/file.webp diff --git a/discord/images/components/hero.png b/discord/images/components/hero.png new file mode 100644 index 0000000000..5245070138 Binary files /dev/null and b/discord/images/components/hero.png differ diff --git a/static/images/components/hero.webp b/discord/images/components/hero.webp similarity index 100% rename from static/images/components/hero.webp rename to discord/images/components/hero.webp diff --git a/discord/images/components/media-gallery.png b/discord/images/components/media-gallery.png new file mode 100644 index 0000000000..6b567864e3 Binary files /dev/null and b/discord/images/components/media-gallery.png differ diff --git a/static/images/components/media-gallery.webp b/discord/images/components/media-gallery.webp similarity index 100% rename from static/images/components/media-gallery.webp rename to discord/images/components/media-gallery.webp diff --git a/discord/images/components/mentionable-select.png b/discord/images/components/mentionable-select.png new file mode 100644 index 0000000000..07c29c7baf Binary files /dev/null and b/discord/images/components/mentionable-select.png differ diff --git a/static/images/components/mentionable-select.webp b/discord/images/components/mentionable-select.webp similarity index 100% rename from static/images/components/mentionable-select.webp rename to discord/images/components/mentionable-select.webp diff --git a/static/images/components/modal-channel-select.webp b/discord/images/components/modal-channel-select.webp similarity index 100% rename from static/images/components/modal-channel-select.webp rename to discord/images/components/modal-channel-select.webp diff --git a/discord/images/components/modal-desktop.png b/discord/images/components/modal-desktop.png new file mode 100644 index 0000000000..0f94dabdf4 Binary files /dev/null and b/discord/images/components/modal-desktop.png differ diff --git a/static/images/components/modal-label.webp b/discord/images/components/modal-label.webp similarity index 100% rename from static/images/components/modal-label.webp rename to discord/images/components/modal-label.webp diff --git a/static/images/components/modal-mentionable-select.webp b/discord/images/components/modal-mentionable-select.webp similarity index 100% rename from static/images/components/modal-mentionable-select.webp rename to discord/images/components/modal-mentionable-select.webp diff --git a/static/images/components/modal-role-select.webp b/discord/images/components/modal-role-select.webp similarity index 100% rename from static/images/components/modal-role-select.webp rename to discord/images/components/modal-role-select.webp diff --git a/static/images/components/modal-string-select.webp b/discord/images/components/modal-string-select.webp similarity index 100% rename from static/images/components/modal-string-select.webp rename to discord/images/components/modal-string-select.webp diff --git a/static/images/components/modal-text-display.webp b/discord/images/components/modal-text-display.webp similarity index 100% rename from static/images/components/modal-text-display.webp rename to discord/images/components/modal-text-display.webp diff --git a/static/images/components/modal-user-select.webp b/discord/images/components/modal-user-select.webp similarity index 100% rename from static/images/components/modal-user-select.webp rename to discord/images/components/modal-user-select.webp diff --git a/discord/images/components/modal.png b/discord/images/components/modal.png new file mode 100644 index 0000000000..765426ee09 Binary files /dev/null and b/discord/images/components/modal.png differ diff --git a/static/images/components/modal.webp b/discord/images/components/modal.webp similarity index 100% rename from static/images/components/modal.webp rename to discord/images/components/modal.webp diff --git a/discord/images/components/multiple-buttons-example-1.png b/discord/images/components/multiple-buttons-example-1.png new file mode 100644 index 0000000000..fe8acdd25f Binary files /dev/null and b/discord/images/components/multiple-buttons-example-1.png differ diff --git a/static/images/components/multiple-buttons-example-1.webp b/discord/images/components/multiple-buttons-example-1.webp similarity index 100% rename from static/images/components/multiple-buttons-example-1.webp rename to discord/images/components/multiple-buttons-example-1.webp diff --git a/discord/images/components/multiple-buttons-example-2.png b/discord/images/components/multiple-buttons-example-2.png new file mode 100644 index 0000000000..f646978dc0 Binary files /dev/null and b/discord/images/components/multiple-buttons-example-2.png differ diff --git a/static/images/components/multiple-buttons-example-2.webp b/discord/images/components/multiple-buttons-example-2.webp similarity index 100% rename from static/images/components/multiple-buttons-example-2.webp rename to discord/images/components/multiple-buttons-example-2.webp diff --git a/discord/images/components/premium-button.png b/discord/images/components/premium-button.png new file mode 100644 index 0000000000..8f566c20b2 Binary files /dev/null and b/discord/images/components/premium-button.png differ diff --git a/static/images/components/premium-button.webp b/discord/images/components/premium-button.webp similarity index 100% rename from static/images/components/premium-button.webp rename to discord/images/components/premium-button.webp diff --git a/discord/images/components/role-select.png b/discord/images/components/role-select.png new file mode 100644 index 0000000000..953881aca1 Binary files /dev/null and b/discord/images/components/role-select.png differ diff --git a/static/images/components/role-select.webp b/discord/images/components/role-select.webp similarity index 100% rename from static/images/components/role-select.webp rename to discord/images/components/role-select.webp diff --git a/discord/images/components/section.png b/discord/images/components/section.png new file mode 100644 index 0000000000..af9d7dd987 Binary files /dev/null and b/discord/images/components/section.png differ diff --git a/static/images/components/section.webp b/discord/images/components/section.webp similarity index 100% rename from static/images/components/section.webp rename to discord/images/components/section.webp diff --git a/discord/images/components/separator.png b/discord/images/components/separator.png new file mode 100644 index 0000000000..f7282988a9 Binary files /dev/null and b/discord/images/components/separator.png differ diff --git a/static/images/components/separator.webp b/discord/images/components/separator.webp similarity index 100% rename from static/images/components/separator.webp rename to discord/images/components/separator.webp diff --git a/discord/images/components/string-select.png b/discord/images/components/string-select.png new file mode 100644 index 0000000000..b8a02c2923 Binary files /dev/null and b/discord/images/components/string-select.png differ diff --git a/static/images/components/string-select.webp b/discord/images/components/string-select.webp similarity index 100% rename from static/images/components/string-select.webp rename to discord/images/components/string-select.webp diff --git a/discord/images/components/text-display.png b/discord/images/components/text-display.png new file mode 100644 index 0000000000..f42211b847 Binary files /dev/null and b/discord/images/components/text-display.png differ diff --git a/static/images/components/text-display.webp b/discord/images/components/text-display.webp similarity index 100% rename from static/images/components/text-display.webp rename to discord/images/components/text-display.webp diff --git a/discord/images/components/user-select.png b/discord/images/components/user-select.png new file mode 100644 index 0000000000..ce64e5c39c Binary files /dev/null and b/discord/images/components/user-select.png differ diff --git a/static/images/components/user-select.webp b/discord/images/components/user-select.webp similarity index 100% rename from static/images/components/user-select.webp rename to discord/images/components/user-select.webp diff --git a/discord/images/cpp-files-sdk.png b/discord/images/cpp-files-sdk.png new file mode 100644 index 0000000000..e2826574fd Binary files /dev/null and b/discord/images/cpp-files-sdk.png differ diff --git a/static/images/cpp-files-sdk.webp b/discord/images/cpp-files-sdk.webp similarity index 100% rename from static/images/cpp-files-sdk.webp rename to discord/images/cpp-files-sdk.webp diff --git a/discord/images/create-team-owned-app.png b/discord/images/create-team-owned-app.png new file mode 100644 index 0000000000..d157c0ceb8 Binary files /dev/null and b/discord/images/create-team-owned-app.png differ diff --git a/static/images/create-team-owned-app.webp b/discord/images/create-team-owned-app.webp similarity index 100% rename from static/images/create-team-owned-app.webp rename to discord/images/create-team-owned-app.webp diff --git a/static/images/default-presence-activities.png b/discord/images/default-presence-activities.png similarity index 100% rename from static/images/default-presence-activities.png rename to discord/images/default-presence-activities.png diff --git a/discord/images/demo-gif.gif b/discord/images/demo-gif.gif new file mode 100644 index 0000000000..54e123f5f3 Binary files /dev/null and b/discord/images/demo-gif.gif differ diff --git a/static/images/discovery-app-directory-product-page.webp b/discord/images/discovery-app-directory-product-page.webp similarity index 100% rename from static/images/discovery-app-directory-product-page.webp rename to discord/images/discovery-app-directory-product-page.webp diff --git a/static/images/discovery-app-launcher.webp b/discord/images/discovery-app-launcher.webp similarity index 100% rename from static/images/discovery-app-launcher.webp rename to discord/images/discovery-app-launcher.webp diff --git a/static/images/discovery-sharing-links.webp b/discord/images/discovery-sharing-links.webp similarity index 100% rename from static/images/discovery-sharing-links.webp rename to discord/images/discovery-sharing-links.webp diff --git a/discord/images/discovery/app-description.png b/discord/images/discovery/app-description.png new file mode 100644 index 0000000000..c5f4902de1 Binary files /dev/null and b/discord/images/discovery/app-description.png differ diff --git a/discord/images/discovery/app-launcher.png b/discord/images/discovery/app-launcher.png new file mode 100644 index 0000000000..2f5427edfb Binary files /dev/null and b/discord/images/discovery/app-launcher.png differ diff --git a/discord/images/discovery/directory-product-page.png b/discord/images/discovery/directory-product-page.png new file mode 100644 index 0000000000..b780113b8e Binary files /dev/null and b/discord/images/discovery/directory-product-page.png differ diff --git a/discord/images/discovery/sharing-links.png b/discord/images/discovery/sharing-links.png new file mode 100644 index 0000000000..226d8cf100 Binary files /dev/null and b/discord/images/discovery/sharing-links.png differ diff --git a/discord/images/discovery/summary-bad.png b/discord/images/discovery/summary-bad.png new file mode 100644 index 0000000000..fa5615a947 Binary files /dev/null and b/discord/images/discovery/summary-bad.png differ diff --git a/discord/images/discovery/summary-good.png b/discord/images/discovery/summary-good.png new file mode 100644 index 0000000000..ef23e5a8c6 Binary files /dev/null and b/discord/images/discovery/summary-good.png differ diff --git a/discord/images/discovery/tags.png b/discord/images/discovery/tags.png new file mode 100644 index 0000000000..0598e3cffd Binary files /dev/null and b/discord/images/discovery/tags.png differ diff --git a/discord/images/events/gateway-lifecycle.svg b/discord/images/events/gateway-lifecycle.svg new file mode 100644 index 0000000000..34cedcf2b8 --- /dev/null +++ b/discord/images/events/gateway-lifecycle.svg @@ -0,0 +1,463 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/discord/images/example-poll.png b/discord/images/example-poll.png new file mode 100644 index 0000000000..2c934fae52 Binary files /dev/null and b/discord/images/example-poll.png differ diff --git a/static/images/example-poll.webp b/discord/images/example-poll.webp similarity index 100% rename from static/images/example-poll.webp rename to discord/images/example-poll.webp diff --git a/static/images/examples-ephemeral-message.png b/discord/images/examples-ephemeral-message.png similarity index 100% rename from static/images/examples-ephemeral-message.png rename to discord/images/examples-ephemeral-message.png diff --git a/static/images/examples-update-message.png b/discord/images/examples-update-message.png similarity index 100% rename from static/images/examples-update-message.png rename to discord/images/examples-update-message.png diff --git a/discord/images/frame-wumpus.png b/discord/images/frame-wumpus.png new file mode 100644 index 0000000000..4f736d0d22 Binary files /dev/null and b/discord/images/frame-wumpus.png differ diff --git a/static/images/game-overlay-sdk-invite.webp b/discord/images/game-overlay-sdk-invite.webp similarity index 100% rename from static/images/game-overlay-sdk-invite.webp rename to discord/images/game-overlay-sdk-invite.webp diff --git a/static/images/game-overlay-sdk-voice-settings.webp b/discord/images/game-overlay-sdk-voice-settings.webp similarity index 100% rename from static/images/game-overlay-sdk-voice-settings.webp rename to discord/images/game-overlay-sdk-voice-settings.webp diff --git a/static/images/game-sdk-presence-example.png b/discord/images/game-sdk-presence-example.png similarity index 100% rename from static/images/game-sdk-presence-example.png rename to discord/images/game-sdk-presence-example.png diff --git a/static/images/gateway-lifecycle.svg b/discord/images/gateway-lifecycle.svg similarity index 100% rename from static/images/gateway-lifecycle.svg rename to discord/images/gateway-lifecycle.svg diff --git a/discord/images/getting-started-default-install.png b/discord/images/getting-started-default-install.png new file mode 100644 index 0000000000..de254df6ff Binary files /dev/null and b/discord/images/getting-started-default-install.png differ diff --git a/static/images/getting-started-default-install.webp b/discord/images/getting-started-default-install.webp similarity index 100% rename from static/images/getting-started-default-install.webp rename to discord/images/getting-started-default-install.webp diff --git a/static/images/getting-started-demo.gif b/discord/images/getting-started-demo copy.gif similarity index 100% rename from static/images/getting-started-demo.gif rename to discord/images/getting-started-demo copy.gif diff --git a/discord/images/getting-started-demo.gif b/discord/images/getting-started-demo.gif new file mode 100644 index 0000000000..54e123f5f3 Binary files /dev/null and b/discord/images/getting-started-demo.gif differ diff --git a/discord/images/getting-started-interactions-endpoint.png b/discord/images/getting-started-interactions-endpoint.png new file mode 100644 index 0000000000..5d79345a9a Binary files /dev/null and b/discord/images/getting-started-interactions-endpoint.png differ diff --git a/static/images/getting-started-interactions-endpoint.webp b/discord/images/getting-started-interactions-endpoint.webp similarity index 100% rename from static/images/getting-started-interactions-endpoint.webp rename to discord/images/getting-started-interactions-endpoint.webp diff --git a/static/images/interactions-url.webp b/discord/images/interactions-url.webp similarity index 100% rename from static/images/interactions-url.webp rename to discord/images/interactions-url.webp diff --git a/discord/images/introduction.svg b/discord/images/introduction.svg new file mode 100644 index 0000000000..788129ff6e --- /dev/null +++ b/discord/images/introduction.svg @@ -0,0 +1,1841 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +<657.338Gradient id="linear" x1="0" y1="601.542" x2="748.333" y2="601.542"> + + + + + +<657.516Gradient id="linear" x1="0" y1="587.883" x2="745.548" y2="587.883"> + + + + + +<1587.35Gradient id="linear" x1="0" y1="239.308" x2="1666.71" y2="230.729"> + + + + + + + +<1491.84Gradient id="linear" x1="0" y1="192.359" x2="1576.79" y2="352.727"> + + + + + + +<748.815Gradient id="linear" x1="0" y1="20.0728" x2="748.815" y2="125.178"> + + + + + + + +<955.512Gradient id="linear" x1="0" y1="19.9154" x2="955.512" y2="125.227"> + + + + + + + +<1088.81Gradient id="linear" x1="0" y1="21.0174" x2="1088.81" y2="125.208"> + + + + + + + +<1560.97Gradient id="linear" x1="0" y1="338.518" x2="1544.36" y2="289.719"> + + + + + + + +<1481.77Gradient id="linear" x1="0" y1="315.442" x2="1481.77" y2="274.752"> + + + + + + + +<1577.75Gradient id="linear" x1="0" y1="259.972" x2="1606.63" y2="284.209"> + + + + + + + + +<1536.92Gradient id="linear" x1="0" y1="263.633" x2="1526.25" y2="302.63"> + + + +<1524.87Gradient id="linear" x1="0" y1="259.972" x2="1495.98" y2="284.209"> + + + + + + + + +<1553.4Gradient id="linear" x1="0" y1="338.338" x2="1549.61" y2="349.49"> + + + + + + + +<1573.24Gradient id="linear" x1="0" y1="339.915" x2="1574.45" y2="350.553"> + + + + + + + +<1491.84Gradient id="linear" x1="0" y1="192.359" x2="1576.79" y2="352.727"> + + + + + + + +<895.142Gradient id="linear" x1="0" y1="51.7983" x2="951.261" y2="51.7983"> + + + + + + + +<1471.31Gradient id="linear" x1="0" y1="585.994" x2="1486.53" y2="585.994"> + + + + + + + +<1445.18Gradient id="linear" x1="0" y1="585.994" x2="1460.4" y2="585.994"> + + + + + + + +<1427.81Gradient id="linear" x1="0" y1="466.502" x2="1410.7" y2="419.495"> + + + + + + + + + + +<1516.15Gradient id="linear" x1="0" y1="451.063" x2="1556.9" y2="485.248"> + + + + + + + + +<1450.3Gradient id="linear" x1="0" y1="522.189" x2="1503.5" y2="522.189"> + + + + + + +<871.593Gradient id="linear" x1="0" y1="566.943" x2="871.593" y2="429.236"> + + + + + + + + + + +<1202.55Gradient id="linear" x1="0" y1="375.843" x2="1178.76" y2="348.496"> + + + +<635.916Gradient id="linear" x1="0" y1="55.705" x2="657.791" y2="133.375"> + + + + + + + +<963.837Gradient id="linear" x1="0" y1="337.741" x2="858.368" y2="337.741"> + + + + +<853.221Gradient id="linear" x1="0" y1="254.343" x2="790.42" y2="339.541"> + + + +<823.307Gradient id="linear" x1="0" y1="235.892" x2="801.185" y2="238.608"> + + + + + +<1058.13Gradient id="linear" x1="0" y1="81.5064" x2="1058.13" y2="172.875"> + + + + + + + +<1052.15Gradient id="linear" x1="0" y1="106.472" x2="1114.5" y2="106.472"> + + + + + + + +<843.627Gradient id="linear" x1="0" y1="106.245" x2="843.627" y2="186.356"> + + + + + + + +<678.495Gradient id="linear" x1="0" y1="83.8682" x2="678.495" y2="167.266"> + + + + + + + +<631.567Gradient id="linear" x1="0" y1="56.807" x2="653.609" y2="135.078"> + + + + + + + + + + diff --git a/discord/images/lib-linked-sdk.png b/discord/images/lib-linked-sdk.png new file mode 100644 index 0000000000..baa0cce836 Binary files /dev/null and b/discord/images/lib-linked-sdk.png differ diff --git a/static/images/lib-linked-sdk.webp b/discord/images/lib-linked-sdk.webp similarity index 100% rename from static/images/lib-linked-sdk.webp rename to discord/images/lib-linked-sdk.webp diff --git a/static/images/linked-roles-connect-account.webp b/discord/images/linked-roles-connect-account.webp similarity index 100% rename from static/images/linked-roles-connect-account.webp rename to discord/images/linked-roles-connect-account.webp diff --git a/static/images/linked-roles-connected.webp b/discord/images/linked-roles-connected.webp similarity index 100% rename from static/images/linked-roles-connected.webp rename to discord/images/linked-roles-connected.webp diff --git a/static/images/linked-roles-consent-dialog.webp b/discord/images/linked-roles-consent-dialog.webp similarity index 100% rename from static/images/linked-roles-consent-dialog.webp rename to discord/images/linked-roles-consent-dialog.webp diff --git a/static/images/linked-roles-glitch-share-url.webp b/discord/images/linked-roles-glitch-share-url.webp similarity index 100% rename from static/images/linked-roles-glitch-share-url.webp rename to discord/images/linked-roles-glitch-share-url.webp diff --git a/static/images/linked-roles-glitch.webp b/discord/images/linked-roles-glitch.webp similarity index 100% rename from static/images/linked-roles-glitch.webp rename to discord/images/linked-roles-glitch.webp diff --git a/static/images/linked-roles-oauth-config.webp b/discord/images/linked-roles-oauth-config.webp similarity index 100% rename from static/images/linked-roles-oauth-config.webp rename to discord/images/linked-roles-oauth-config.webp diff --git a/static/images/linked-roles-register.webp b/discord/images/linked-roles-register.webp similarity index 100% rename from static/images/linked-roles-register.webp rename to discord/images/linked-roles-register.webp diff --git a/static/images/linked-roles-verification-setup.webp b/discord/images/linked-roles-verification-setup.webp similarity index 100% rename from static/images/linked-roles-verification-setup.webp rename to discord/images/linked-roles-verification-setup.webp diff --git a/static/images/linked-roles-verify-endpoint.webp b/discord/images/linked-roles-verify-endpoint.webp similarity index 100% rename from static/images/linked-roles-verify-endpoint.webp rename to discord/images/linked-roles-verify-endpoint.webp diff --git a/static/images/mdx-button.webp b/discord/images/mdx-button.webp similarity index 100% rename from static/images/mdx-button.webp rename to discord/images/mdx-button.webp diff --git a/static/images/mdx-card.webp b/discord/images/mdx-card.webp similarity index 100% rename from static/images/mdx-card.webp rename to discord/images/mdx-card.webp diff --git a/static/images/mdx-collapsible.webp b/discord/images/mdx-collapsible.webp similarity index 100% rename from static/images/mdx-collapsible.webp rename to discord/images/mdx-collapsible.webp diff --git a/discord/images/message-command.png b/discord/images/message-command.png new file mode 100644 index 0000000000..096834662f Binary files /dev/null and b/discord/images/message-command.png differ diff --git a/static/images/message-command.webp b/discord/images/message-command.webp similarity index 100% rename from static/images/message-command.webp rename to discord/images/message-command.webp diff --git a/static/images/modal-desktop.webp b/discord/images/modal-desktop.webp similarity index 100% rename from static/images/modal-desktop.webp rename to discord/images/modal-desktop.webp diff --git a/static/images/monetization-overview.webp b/discord/images/monetization-overview.webp similarity index 100% rename from static/images/monetization-overview.webp rename to discord/images/monetization-overview.webp diff --git a/discord/images/monetization/botuser-profile.png b/discord/images/monetization/botuser-profile.png new file mode 100644 index 0000000000..016359e432 Binary files /dev/null and b/discord/images/monetization/botuser-profile.png differ diff --git a/discord/images/monetization/multisub.png b/discord/images/monetization/multisub.png new file mode 100644 index 0000000000..22349c2b4d Binary files /dev/null and b/discord/images/monetization/multisub.png differ diff --git a/discord/images/monetization/overview.png b/discord/images/monetization/overview.png new file mode 100644 index 0000000000..dc450ec99a Binary files /dev/null and b/discord/images/monetization/overview.png differ diff --git a/discord/images/monetization/premium-button.png b/discord/images/monetization/premium-button.png new file mode 100644 index 0000000000..8f566c20b2 Binary files /dev/null and b/discord/images/monetization/premium-button.png differ diff --git a/discord/images/monetization/premium-items.png b/discord/images/monetization/premium-items.png new file mode 100644 index 0000000000..1f813936af Binary files /dev/null and b/discord/images/monetization/premium-items.png differ diff --git a/discord/images/monetization/sku-benefits.png b/discord/images/monetization/sku-benefits.png new file mode 100644 index 0000000000..d3dc2d1af6 Binary files /dev/null and b/discord/images/monetization/sku-benefits.png differ diff --git a/discord/images/monetization/sku_embed.png b/discord/images/monetization/sku_embed.png new file mode 100644 index 0000000000..1e9c198bc0 Binary files /dev/null and b/discord/images/monetization/sku_embed.png differ diff --git a/discord/images/monetization/store_embed.png b/discord/images/monetization/store_embed.png new file mode 100644 index 0000000000..315d14511a Binary files /dev/null and b/discord/images/monetization/store_embed.png differ diff --git a/static/images/multiple-buttons-example-1.webp b/discord/images/multiple-buttons-example-1.webp similarity index 100% rename from static/images/multiple-buttons-example-1.webp rename to discord/images/multiple-buttons-example-1.webp diff --git a/static/images/multiple-buttons-example-2.webp b/discord/images/multiple-buttons-example-2.webp similarity index 100% rename from static/images/multiple-buttons-example-2.webp rename to discord/images/multiple-buttons-example-2.webp diff --git a/static/images/multisub.webp b/discord/images/multisub.webp similarity index 100% rename from static/images/multisub.webp rename to discord/images/multisub.webp diff --git a/static/images/new-permissions-flowchart.svg b/discord/images/new-permissions-flowchart copy.svg similarity index 100% rename from static/images/new-permissions-flowchart.svg rename to discord/images/new-permissions-flowchart copy.svg diff --git a/discord/images/new-permissions-flowchart.svg b/discord/images/new-permissions-flowchart.svg new file mode 100644 index 0000000000..d946b97dd3 --- /dev/null +++ b/discord/images/new-permissions-flowchart.svg @@ -0,0 +1,299 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/discord/images/overview-apps.png b/discord/images/overview-apps.png new file mode 100644 index 0000000000..707cfd9f99 Binary files /dev/null and b/discord/images/overview-apps.png differ diff --git a/discord/images/overview-command-desktop.png b/discord/images/overview-command-desktop.png new file mode 100644 index 0000000000..cb3411ad71 Binary files /dev/null and b/discord/images/overview-command-desktop.png differ diff --git a/static/images/overview-command-desktop.webp b/discord/images/overview-command-desktop.webp similarity index 100% rename from static/images/overview-command-desktop.webp rename to discord/images/overview-command-desktop.webp diff --git a/discord/images/overview-components.png b/discord/images/overview-components.png new file mode 100644 index 0000000000..19ca8b1a13 Binary files /dev/null and b/discord/images/overview-components.png differ diff --git a/static/images/overview-components.webp b/discord/images/overview-components.webp similarity index 100% rename from static/images/overview-components.webp rename to discord/images/overview-components.webp diff --git a/discord/images/overview-modals.png b/discord/images/overview-modals.png new file mode 100644 index 0000000000..410104e8b4 Binary files /dev/null and b/discord/images/overview-modals.png differ diff --git a/static/images/overview-modals.webp b/discord/images/overview-modals.webp similarity index 100% rename from static/images/overview-modals.webp rename to discord/images/overview-modals.webp diff --git a/static/images/overview-of-apps-banner.webp b/discord/images/overview-of-apps-banner.webp similarity index 100% rename from static/images/overview-of-apps-banner.webp rename to discord/images/overview-of-apps-banner.webp diff --git a/static/images/premium-button.webp b/discord/images/premium-button.webp similarity index 100% rename from static/images/premium-button.webp rename to discord/images/premium-button.webp diff --git a/static/images/premium-items.webp b/discord/images/premium-items.webp similarity index 100% rename from static/images/premium-items.webp rename to discord/images/premium-items.webp diff --git a/static/images/rich-presence-asset-images.webp b/discord/images/rich-presence-asset-images.webp similarity index 100% rename from static/images/rich-presence-asset-images.webp rename to discord/images/rich-presence-asset-images.webp diff --git a/static/images/rich-presence-examples.png b/discord/images/rich-presence-examples.png similarity index 100% rename from static/images/rich-presence-examples.png rename to discord/images/rich-presence-examples.png diff --git a/static/images/rich-presence-invite-image.webp b/discord/images/rich-presence-invite-image.webp similarity index 100% rename from static/images/rich-presence-invite-image.webp rename to discord/images/rich-presence-invite-image.webp diff --git a/discord/images/rich-presence/actionable.png b/discord/images/rich-presence/actionable.png new file mode 100644 index 0000000000..bc19ffdb6b Binary files /dev/null and b/discord/images/rich-presence/actionable.png differ diff --git a/discord/images/rich-presence/activities-example.png b/discord/images/rich-presence/activities-example.png new file mode 100644 index 0000000000..35e013b2f0 Binary files /dev/null and b/discord/images/rich-presence/activities-example.png differ diff --git a/discord/images/rich-presence/all-fields.png b/discord/images/rich-presence/all-fields.png new file mode 100644 index 0000000000..9778ef895a Binary files /dev/null and b/discord/images/rich-presence/all-fields.png differ diff --git a/discord/images/rich-presence/annotated-data-activities.png b/discord/images/rich-presence/annotated-data-activities.png new file mode 100644 index 0000000000..bbe990ac05 Binary files /dev/null and b/discord/images/rich-presence/annotated-data-activities.png differ diff --git a/discord/images/rich-presence/asset-images.png b/discord/images/rich-presence/asset-images.png new file mode 100644 index 0000000000..7ca8681095 Binary files /dev/null and b/discord/images/rich-presence/asset-images.png differ diff --git a/discord/images/rich-presence/default-activities.png b/discord/images/rich-presence/default-activities.png new file mode 100644 index 0000000000..1db6748dcc Binary files /dev/null and b/discord/images/rich-presence/default-activities.png differ diff --git a/discord/images/rich-presence/examples.png b/discord/images/rich-presence/examples.png new file mode 100644 index 0000000000..d834cb7c87 Binary files /dev/null and b/discord/images/rich-presence/examples.png differ diff --git a/discord/images/rich-presence/game-sdk-example.png b/discord/images/rich-presence/game-sdk-example.png new file mode 100644 index 0000000000..4d986a089b Binary files /dev/null and b/discord/images/rich-presence/game-sdk-example.png differ diff --git a/discord/images/rich-presence/good-art.png b/discord/images/rich-presence/good-art.png new file mode 100644 index 0000000000..20b38a03b4 Binary files /dev/null and b/discord/images/rich-presence/good-art.png differ diff --git a/discord/images/rich-presence/invite-image.png b/discord/images/rich-presence/invite-image.png new file mode 100644 index 0000000000..929a4657d8 Binary files /dev/null and b/discord/images/rich-presence/invite-image.png differ diff --git a/discord/images/rich-presence/legend.png b/discord/images/rich-presence/legend.png new file mode 100644 index 0000000000..b0416341f0 Binary files /dev/null and b/discord/images/rich-presence/legend.png differ diff --git a/discord/images/rich-presence/short-strings.png b/discord/images/rich-presence/short-strings.png new file mode 100644 index 0000000000..9ad0faa532 Binary files /dev/null and b/discord/images/rich-presence/short-strings.png differ diff --git a/static/images/rp-actionable.webp b/discord/images/rp-actionable.webp similarity index 100% rename from static/images/rp-actionable.webp rename to discord/images/rp-actionable.webp diff --git a/static/images/rp-all-fields.webp b/discord/images/rp-all-fields.webp similarity index 100% rename from static/images/rp-all-fields.webp rename to discord/images/rp-all-fields.webp diff --git a/static/images/rp-good-art.webp b/discord/images/rp-good-art.webp similarity index 100% rename from static/images/rp-good-art.webp rename to discord/images/rp-good-art.webp diff --git a/static/images/rp-legend.webp b/discord/images/rp-legend.webp similarity index 100% rename from static/images/rp-legend.webp rename to discord/images/rp-legend.webp diff --git a/static/images/rp-short-strings.webp b/discord/images/rp-short-strings.webp similarity index 100% rename from static/images/rp-short-strings.webp rename to discord/images/rp-short-strings.webp diff --git a/static/images/sku-benefits.webp b/discord/images/sku-benefits.webp similarity index 100% rename from static/images/sku-benefits.webp rename to discord/images/sku-benefits.webp diff --git a/static/images/sku-custom.webp b/discord/images/sku-custom.webp similarity index 100% rename from static/images/sku-custom.webp rename to discord/images/sku-custom.webp diff --git a/static/images/sku-unicode.webp b/discord/images/sku-unicode.webp similarity index 100% rename from static/images/sku-unicode.webp rename to discord/images/sku-unicode.webp diff --git a/static/images/sku_embed.webp b/discord/images/sku_embed.webp similarity index 100% rename from static/images/sku_embed.webp rename to discord/images/sku_embed.webp diff --git a/static/images/slash-command-options.png b/discord/images/slash-command-options.png similarity index 100% rename from static/images/slash-command-options.png rename to discord/images/slash-command-options.png diff --git a/discord/images/snowflake-to-datetime.svg b/discord/images/snowflake-to-datetime.svg new file mode 100644 index 0000000000..73f3da0a60 --- /dev/null +++ b/discord/images/snowflake-to-datetime.svg @@ -0,0 +1 @@ +1759288472991170634194470579614620151057962016-04-30 11:18:25.796 UTC0000001001110001000001100101101011000001000000100000to binaryto decimalParse unix timestamp (ms)+ 1420070400000Discord Epoch (unix timestamp in ms)Number of milliseconds since the Discord epoch (first seconds of 2015)InternalworkerIDInternalprocessID000000000111Incremented for every generated ID on that process642212017 diff --git a/discord/images/snowflake.png b/discord/images/snowflake.png new file mode 100644 index 0000000000..c8f4fd1485 Binary files /dev/null and b/discord/images/snowflake.png differ diff --git a/discord/images/social-sdk/design-guidelines/Brand-02.png b/discord/images/social-sdk/design-guidelines/Brand-02.png new file mode 100644 index 0000000000..02269ef229 Binary files /dev/null and b/discord/images/social-sdk/design-guidelines/Brand-02.png differ diff --git a/discord/images/social-sdk/design-guidelines/Brand-03.png b/discord/images/social-sdk/design-guidelines/Brand-03.png new file mode 100644 index 0000000000..42d0962df9 Binary files /dev/null and b/discord/images/social-sdk/design-guidelines/Brand-03.png differ diff --git a/discord/images/social-sdk/design-guidelines/Brand-04.png b/discord/images/social-sdk/design-guidelines/Brand-04.png new file mode 100644 index 0000000000..2fd7ab4caf Binary files /dev/null and b/discord/images/social-sdk/design-guidelines/Brand-04.png differ diff --git a/static/images/social-sdk/design-guidelines/ChatHistory-02.webp b/discord/images/social-sdk/design-guidelines/ChatHistory-02.webp similarity index 100% rename from static/images/social-sdk/design-guidelines/ChatHistory-02.webp rename to discord/images/social-sdk/design-guidelines/ChatHistory-02.webp diff --git a/static/images/social-sdk/design-guidelines/ChatHistory-03.webp b/discord/images/social-sdk/design-guidelines/ChatHistory-03.webp similarity index 100% rename from static/images/social-sdk/design-guidelines/ChatHistory-03.webp rename to discord/images/social-sdk/design-guidelines/ChatHistory-03.webp diff --git a/discord/images/social-sdk/design-guidelines/ConnectionPoints-02.png b/discord/images/social-sdk/design-guidelines/ConnectionPoints-02.png new file mode 100644 index 0000000000..f33ce3fac1 Binary files /dev/null and b/discord/images/social-sdk/design-guidelines/ConnectionPoints-02.png differ diff --git a/discord/images/social-sdk/design-guidelines/ConnectionPoints-03.png b/discord/images/social-sdk/design-guidelines/ConnectionPoints-03.png new file mode 100644 index 0000000000..85559c65fa Binary files /dev/null and b/discord/images/social-sdk/design-guidelines/ConnectionPoints-03.png differ diff --git a/discord/images/social-sdk/design-guidelines/ConnectionPoints-04.png b/discord/images/social-sdk/design-guidelines/ConnectionPoints-04.png new file mode 100644 index 0000000000..89ce604340 Binary files /dev/null and b/discord/images/social-sdk/design-guidelines/ConnectionPoints-04.png differ diff --git a/discord/images/social-sdk/design-guidelines/ConnectionPoints-05.png b/discord/images/social-sdk/design-guidelines/ConnectionPoints-05.png new file mode 100644 index 0000000000..8c48aea151 Binary files /dev/null and b/discord/images/social-sdk/design-guidelines/ConnectionPoints-05.png differ diff --git a/discord/images/social-sdk/design-guidelines/Consoles-01.jpg b/discord/images/social-sdk/design-guidelines/Consoles-01.jpg new file mode 100644 index 0000000000..fdea7b4a67 Binary files /dev/null and b/discord/images/social-sdk/design-guidelines/Consoles-01.jpg differ diff --git a/discord/images/social-sdk/design-guidelines/Consoles-02.jpg b/discord/images/social-sdk/design-guidelines/Consoles-02.jpg new file mode 100644 index 0000000000..166b861220 Binary files /dev/null and b/discord/images/social-sdk/design-guidelines/Consoles-02.jpg differ diff --git a/discord/images/social-sdk/design-guidelines/Consoles-03.jpg b/discord/images/social-sdk/design-guidelines/Consoles-03.jpg new file mode 100644 index 0000000000..99ade45742 Binary files /dev/null and b/discord/images/social-sdk/design-guidelines/Consoles-03.jpg differ diff --git a/discord/images/social-sdk/design-guidelines/Consoles-04.jpg b/discord/images/social-sdk/design-guidelines/Consoles-04.jpg new file mode 100644 index 0000000000..0a4f506d1d Binary files /dev/null and b/discord/images/social-sdk/design-guidelines/Consoles-04.jpg differ diff --git a/discord/images/social-sdk/design-guidelines/Consoles-05.jpg b/discord/images/social-sdk/design-guidelines/Consoles-05.jpg new file mode 100644 index 0000000000..c654bd977b Binary files /dev/null and b/discord/images/social-sdk/design-guidelines/Consoles-05.jpg differ diff --git a/discord/images/social-sdk/design-guidelines/Consoles-06.jpg b/discord/images/social-sdk/design-guidelines/Consoles-06.jpg new file mode 100644 index 0000000000..c889e587a5 Binary files /dev/null and b/discord/images/social-sdk/design-guidelines/Consoles-06.jpg differ diff --git a/discord/images/social-sdk/design-guidelines/DMs-02.png b/discord/images/social-sdk/design-guidelines/DMs-02.png new file mode 100644 index 0000000000..1f098307a4 Binary files /dev/null and b/discord/images/social-sdk/design-guidelines/DMs-02.png differ diff --git a/discord/images/social-sdk/design-guidelines/DMs-03.png b/discord/images/social-sdk/design-guidelines/DMs-03.png new file mode 100644 index 0000000000..ca7f6cb186 Binary files /dev/null and b/discord/images/social-sdk/design-guidelines/DMs-03.png differ diff --git a/discord/images/social-sdk/design-guidelines/DMs-04.png b/discord/images/social-sdk/design-guidelines/DMs-04.png new file mode 100644 index 0000000000..8e68feba8b Binary files /dev/null and b/discord/images/social-sdk/design-guidelines/DMs-04.png differ diff --git a/discord/images/social-sdk/design-guidelines/GameFriends-01.png b/discord/images/social-sdk/design-guidelines/GameFriends-01.png new file mode 100644 index 0000000000..e89a537769 Binary files /dev/null and b/discord/images/social-sdk/design-guidelines/GameFriends-01.png differ diff --git a/discord/images/social-sdk/design-guidelines/GameFriends-02.png b/discord/images/social-sdk/design-guidelines/GameFriends-02.png new file mode 100644 index 0000000000..d3907aa73d Binary files /dev/null and b/discord/images/social-sdk/design-guidelines/GameFriends-02.png differ diff --git a/discord/images/social-sdk/design-guidelines/GameFriends-03.png b/discord/images/social-sdk/design-guidelines/GameFriends-03.png new file mode 100644 index 0000000000..af7e74e2e4 Binary files /dev/null and b/discord/images/social-sdk/design-guidelines/GameFriends-03.png differ diff --git a/discord/images/social-sdk/design-guidelines/GameFriends-04.png b/discord/images/social-sdk/design-guidelines/GameFriends-04.png new file mode 100644 index 0000000000..85ab375edf Binary files /dev/null and b/discord/images/social-sdk/design-guidelines/GameFriends-04.png differ diff --git a/discord/images/social-sdk/design-guidelines/GameFriends-05.png b/discord/images/social-sdk/design-guidelines/GameFriends-05.png new file mode 100644 index 0000000000..e5ee72d173 Binary files /dev/null and b/discord/images/social-sdk/design-guidelines/GameFriends-05.png differ diff --git a/discord/images/social-sdk/design-guidelines/GameFriends-06.png b/discord/images/social-sdk/design-guidelines/GameFriends-06.png new file mode 100644 index 0000000000..00e4e9440a Binary files /dev/null and b/discord/images/social-sdk/design-guidelines/GameFriends-06.png differ diff --git a/discord/images/social-sdk/design-guidelines/GameFriends-07.png b/discord/images/social-sdk/design-guidelines/GameFriends-07.png new file mode 100644 index 0000000000..58451b3238 Binary files /dev/null and b/discord/images/social-sdk/design-guidelines/GameFriends-07.png differ diff --git a/discord/images/social-sdk/design-guidelines/GameFriends-08.png b/discord/images/social-sdk/design-guidelines/GameFriends-08.png new file mode 100644 index 0000000000..39de2c5e20 Binary files /dev/null and b/discord/images/social-sdk/design-guidelines/GameFriends-08.png differ diff --git a/discord/images/social-sdk/design-guidelines/GameFriends-09.png b/discord/images/social-sdk/design-guidelines/GameFriends-09.png new file mode 100644 index 0000000000..a940fd7bcd Binary files /dev/null and b/discord/images/social-sdk/design-guidelines/GameFriends-09.png differ diff --git a/discord/images/social-sdk/design-guidelines/GameFriends-10.png b/discord/images/social-sdk/design-guidelines/GameFriends-10.png new file mode 100644 index 0000000000..e60a475212 Binary files /dev/null and b/discord/images/social-sdk/design-guidelines/GameFriends-10.png differ diff --git a/discord/images/social-sdk/design-guidelines/LinkedChannels-04.png b/discord/images/social-sdk/design-guidelines/LinkedChannels-04.png new file mode 100644 index 0000000000..d89701b672 Binary files /dev/null and b/discord/images/social-sdk/design-guidelines/LinkedChannels-04.png differ diff --git a/discord/images/social-sdk/design-guidelines/LinkedChannels-05.png b/discord/images/social-sdk/design-guidelines/LinkedChannels-05.png new file mode 100644 index 0000000000..d95e9a4e58 Binary files /dev/null and b/discord/images/social-sdk/design-guidelines/LinkedChannels-05.png differ diff --git a/discord/images/social-sdk/design-guidelines/LinkedChannels-06.png b/discord/images/social-sdk/design-guidelines/LinkedChannels-06.png new file mode 100644 index 0000000000..0c8286ed5d Binary files /dev/null and b/discord/images/social-sdk/design-guidelines/LinkedChannels-06.png differ diff --git a/discord/images/social-sdk/design-guidelines/LinkedChannels-07.png b/discord/images/social-sdk/design-guidelines/LinkedChannels-07.png new file mode 100644 index 0000000000..8ad42cf506 Binary files /dev/null and b/discord/images/social-sdk/design-guidelines/LinkedChannels-07.png differ diff --git a/discord/images/social-sdk/design-guidelines/Principle-02.png b/discord/images/social-sdk/design-guidelines/Principle-02.png new file mode 100644 index 0000000000..71ef86af82 Binary files /dev/null and b/discord/images/social-sdk/design-guidelines/Principle-02.png differ diff --git a/discord/images/social-sdk/design-guidelines/Principle-03.png b/discord/images/social-sdk/design-guidelines/Principle-03.png new file mode 100644 index 0000000000..97a9a81619 Binary files /dev/null and b/discord/images/social-sdk/design-guidelines/Principle-03.png differ diff --git a/discord/images/social-sdk/design-guidelines/Principle-04.png b/discord/images/social-sdk/design-guidelines/Principle-04.png new file mode 100644 index 0000000000..8e45d44831 Binary files /dev/null and b/discord/images/social-sdk/design-guidelines/Principle-04.png differ diff --git a/discord/images/social-sdk/design-guidelines/Principle-05.png b/discord/images/social-sdk/design-guidelines/Principle-05.png new file mode 100644 index 0000000000..006333f543 Binary files /dev/null and b/discord/images/social-sdk/design-guidelines/Principle-05.png differ diff --git a/discord/images/social-sdk/design-guidelines/Principle-06.png b/discord/images/social-sdk/design-guidelines/Principle-06.png new file mode 100644 index 0000000000..808d10ac0c Binary files /dev/null and b/discord/images/social-sdk/design-guidelines/Principle-06.png differ diff --git a/discord/images/social-sdk/design-guidelines/Principle-07.png b/discord/images/social-sdk/design-guidelines/Principle-07.png new file mode 100644 index 0000000000..66c7b30071 Binary files /dev/null and b/discord/images/social-sdk/design-guidelines/Principle-07.png differ diff --git a/discord/images/social-sdk/design-guidelines/Prov-02.png b/discord/images/social-sdk/design-guidelines/Prov-02.png new file mode 100644 index 0000000000..8ad43b5062 Binary files /dev/null and b/discord/images/social-sdk/design-guidelines/Prov-02.png differ diff --git a/discord/images/social-sdk/design-guidelines/Prov-03.png b/discord/images/social-sdk/design-guidelines/Prov-03.png new file mode 100644 index 0000000000..7b7a2e3d0b Binary files /dev/null and b/discord/images/social-sdk/design-guidelines/Prov-03.png differ diff --git a/discord/images/social-sdk/design-guidelines/Prov-04.png b/discord/images/social-sdk/design-guidelines/Prov-04.png new file mode 100644 index 0000000000..a8b14e2926 Binary files /dev/null and b/discord/images/social-sdk/design-guidelines/Prov-04.png differ diff --git a/discord/images/social-sdk/design-guidelines/Prov-05.png b/discord/images/social-sdk/design-guidelines/Prov-05.png new file mode 100644 index 0000000000..f3dfc0d39e Binary files /dev/null and b/discord/images/social-sdk/design-guidelines/Prov-05.png differ diff --git a/discord/images/social-sdk/design-guidelines/SigningIn-02.png b/discord/images/social-sdk/design-guidelines/SigningIn-02.png new file mode 100644 index 0000000000..b0881d1805 Binary files /dev/null and b/discord/images/social-sdk/design-guidelines/SigningIn-02.png differ diff --git a/discord/images/social-sdk/design-guidelines/SigningIn-03.png b/discord/images/social-sdk/design-guidelines/SigningIn-03.png new file mode 100644 index 0000000000..0ca40bc1c1 Binary files /dev/null and b/discord/images/social-sdk/design-guidelines/SigningIn-03.png differ diff --git a/discord/images/social-sdk/design-guidelines/SigningIn-04.png b/discord/images/social-sdk/design-guidelines/SigningIn-04.png new file mode 100644 index 0000000000..3808f3d78b Binary files /dev/null and b/discord/images/social-sdk/design-guidelines/SigningIn-04.png differ diff --git a/discord/images/social-sdk/design-guidelines/SigningIn-05.png b/discord/images/social-sdk/design-guidelines/SigningIn-05.png new file mode 100644 index 0000000000..7f3d91d858 Binary files /dev/null and b/discord/images/social-sdk/design-guidelines/SigningIn-05.png differ diff --git a/discord/images/social-sdk/design-guidelines/SigningIn-06.png b/discord/images/social-sdk/design-guidelines/SigningIn-06.png new file mode 100644 index 0000000000..3cc5d3a4e6 Binary files /dev/null and b/discord/images/social-sdk/design-guidelines/SigningIn-06.png differ diff --git a/discord/images/social-sdk/design-guidelines/SigningIn-07.png b/discord/images/social-sdk/design-guidelines/SigningIn-07.png new file mode 100644 index 0000000000..5cb7a1af90 Binary files /dev/null and b/discord/images/social-sdk/design-guidelines/SigningIn-07.png differ diff --git a/discord/images/social-sdk/design-guidelines/SigningIn-08.png b/discord/images/social-sdk/design-guidelines/SigningIn-08.png new file mode 100644 index 0000000000..10e0d65fd3 Binary files /dev/null and b/discord/images/social-sdk/design-guidelines/SigningIn-08.png differ diff --git a/static/images/social-sdk/design-guidelines/SocialSettings-02.webp b/discord/images/social-sdk/design-guidelines/SocialSettings-02.webp similarity index 100% rename from static/images/social-sdk/design-guidelines/SocialSettings-02.webp rename to discord/images/social-sdk/design-guidelines/SocialSettings-02.webp diff --git a/static/images/social-sdk/design-guidelines/SocialSettings-03.webp b/discord/images/social-sdk/design-guidelines/SocialSettings-03.webp similarity index 100% rename from static/images/social-sdk/design-guidelines/SocialSettings-03.webp rename to discord/images/social-sdk/design-guidelines/SocialSettings-03.webp diff --git a/static/images/social-sdk/design-guidelines/SocialSettings-04.webp b/discord/images/social-sdk/design-guidelines/SocialSettings-04.webp similarity index 100% rename from static/images/social-sdk/design-guidelines/SocialSettings-04.webp rename to discord/images/social-sdk/design-guidelines/SocialSettings-04.webp diff --git a/discord/images/social-sdk/design-guidelines/StatusPresence-02.png b/discord/images/social-sdk/design-guidelines/StatusPresence-02.png new file mode 100644 index 0000000000..c8be99b2d4 Binary files /dev/null and b/discord/images/social-sdk/design-guidelines/StatusPresence-02.png differ diff --git a/discord/images/social-sdk/design-guidelines/StatusPresence-03.png b/discord/images/social-sdk/design-guidelines/StatusPresence-03.png new file mode 100644 index 0000000000..eb3f55239c Binary files /dev/null and b/discord/images/social-sdk/design-guidelines/StatusPresence-03.png differ diff --git a/discord/images/social-sdk/design-guidelines/StatusPresence-04.png b/discord/images/social-sdk/design-guidelines/StatusPresence-04.png new file mode 100644 index 0000000000..6a9933426b Binary files /dev/null and b/discord/images/social-sdk/design-guidelines/StatusPresence-04.png differ diff --git a/discord/images/social-sdk/design-guidelines/StatusPresence-05.png b/discord/images/social-sdk/design-guidelines/StatusPresence-05.png new file mode 100644 index 0000000000..89669c4ffe Binary files /dev/null and b/discord/images/social-sdk/design-guidelines/StatusPresence-05.png differ diff --git a/discord/images/social-sdk/design-guidelines/StatusPresence-06.png b/discord/images/social-sdk/design-guidelines/StatusPresence-06.png new file mode 100644 index 0000000000..dae7578002 Binary files /dev/null and b/discord/images/social-sdk/design-guidelines/StatusPresence-06.png differ diff --git a/discord/images/social-sdk/design-guidelines/UFL-02.png b/discord/images/social-sdk/design-guidelines/UFL-02.png new file mode 100644 index 0000000000..62c8ed066c Binary files /dev/null and b/discord/images/social-sdk/design-guidelines/UFL-02.png differ diff --git a/discord/images/social-sdk/design-guidelines/UFL-03.png b/discord/images/social-sdk/design-guidelines/UFL-03.png new file mode 100644 index 0000000000..5adca8c896 Binary files /dev/null and b/discord/images/social-sdk/design-guidelines/UFL-03.png differ diff --git a/discord/images/social-sdk/design-guidelines/UFL-04.png b/discord/images/social-sdk/design-guidelines/UFL-04.png new file mode 100644 index 0000000000..7a6234ff15 Binary files /dev/null and b/discord/images/social-sdk/design-guidelines/UFL-04.png differ diff --git a/discord/images/social-sdk/design-guidelines/UFL-05.png b/discord/images/social-sdk/design-guidelines/UFL-05.png new file mode 100644 index 0000000000..b617a2e258 Binary files /dev/null and b/discord/images/social-sdk/design-guidelines/UFL-05.png differ diff --git a/discord/images/social-sdk/design-guidelines/UFL-06.png b/discord/images/social-sdk/design-guidelines/UFL-06.png new file mode 100644 index 0000000000..6d8d5f1c4f Binary files /dev/null and b/discord/images/social-sdk/design-guidelines/UFL-06.png differ diff --git a/discord/images/social-sdk/design-guidelines/UFL-07.png b/discord/images/social-sdk/design-guidelines/UFL-07.png new file mode 100644 index 0000000000..28916851d6 Binary files /dev/null and b/discord/images/social-sdk/design-guidelines/UFL-07.png differ diff --git a/discord/images/social-sdk/design-guidelines/UFL-08.png b/discord/images/social-sdk/design-guidelines/UFL-08.png new file mode 100644 index 0000000000..2712e1d2fe Binary files /dev/null and b/discord/images/social-sdk/design-guidelines/UFL-08.png differ diff --git a/discord/images/social-sdk/design-guidelines/animated/Connecting-via-Browser.gif b/discord/images/social-sdk/design-guidelines/animated/Connecting-via-Browser.gif new file mode 100644 index 0000000000..2fd1fb4c63 Binary files /dev/null and b/discord/images/social-sdk/design-guidelines/animated/Connecting-via-Browser.gif differ diff --git a/discord/images/social-sdk/design-guidelines/animated/Connecting-via-Client.gif b/discord/images/social-sdk/design-guidelines/animated/Connecting-via-Client.gif new file mode 100644 index 0000000000..8e23dcccf8 Binary files /dev/null and b/discord/images/social-sdk/design-guidelines/animated/Connecting-via-Client.gif differ diff --git a/static/images/social-sdk/design-guidelines/animated/DMs-02.gif b/discord/images/social-sdk/design-guidelines/animated/DMs-02.gif similarity index 100% rename from static/images/social-sdk/design-guidelines/animated/DMs-02.gif rename to discord/images/social-sdk/design-guidelines/animated/DMs-02.gif diff --git a/discord/images/social-sdk/design-guidelines/animated/LinkedChannel-Setup.gif b/discord/images/social-sdk/design-guidelines/animated/LinkedChannel-Setup.gif new file mode 100644 index 0000000000..331fb9c474 Binary files /dev/null and b/discord/images/social-sdk/design-guidelines/animated/LinkedChannel-Setup.gif differ diff --git a/discord/images/social-sdk/design-guidelines/animated/LinkedChannel-Unlink.gif b/discord/images/social-sdk/design-guidelines/animated/LinkedChannel-Unlink.gif new file mode 100644 index 0000000000..09edd3c30f Binary files /dev/null and b/discord/images/social-sdk/design-guidelines/animated/LinkedChannel-Unlink.gif differ diff --git a/static/images/social-sdk/design-guidelines/animated/LinkedChannels-02.gif b/discord/images/social-sdk/design-guidelines/animated/LinkedChannels-02.gif similarity index 100% rename from static/images/social-sdk/design-guidelines/animated/LinkedChannels-02.gif rename to discord/images/social-sdk/design-guidelines/animated/LinkedChannels-02.gif diff --git a/static/images/social-sdk/design-guidelines/animated/LinkedChannels-08.gif b/discord/images/social-sdk/design-guidelines/animated/LinkedChannels-08.gif similarity index 100% rename from static/images/social-sdk/design-guidelines/animated/LinkedChannels-08.gif rename to discord/images/social-sdk/design-guidelines/animated/LinkedChannels-08.gif diff --git a/static/images/social-sdk/design-guidelines/animated/UFL-06.gif b/discord/images/social-sdk/design-guidelines/animated/UFL-06.gif similarity index 100% rename from static/images/social-sdk/design-guidelines/animated/UFL-06.gif rename to discord/images/social-sdk/design-guidelines/animated/UFL-06.gif diff --git a/static/images/social-sdk/design-guidelines/starter_pack.webp b/discord/images/social-sdk/design-guidelines/starter_pack.webp similarity index 100% rename from static/images/social-sdk/design-guidelines/starter_pack.webp rename to discord/images/social-sdk/design-guidelines/starter_pack.webp diff --git a/discord/images/social-sdk/development-guides/authorize_device.png b/discord/images/social-sdk/development-guides/authorize_device.png new file mode 100644 index 0000000000..7db81bacd9 Binary files /dev/null and b/discord/images/social-sdk/development-guides/authorize_device.png differ diff --git a/discord/images/social-sdk/development-guides/discord-game-dm-settings.png b/discord/images/social-sdk/development-guides/discord-game-dm-settings.png new file mode 100644 index 0000000000..f2b6ff9516 Binary files /dev/null and b/discord/images/social-sdk/development-guides/discord-game-dm-settings.png differ diff --git a/static/images/social-sdk/development-guides/game-invite.webp b/discord/images/social-sdk/development-guides/game-invite.webp similarity index 100% rename from static/images/social-sdk/development-guides/game-invite.webp rename to discord/images/social-sdk/development-guides/game-invite.webp diff --git a/discord/images/social-sdk/getting-started/partials/error.png b/discord/images/social-sdk/getting-started/partials/error.png new file mode 100644 index 0000000000..30a54a671b Binary files /dev/null and b/discord/images/social-sdk/getting-started/partials/error.png differ diff --git a/discord/images/social-sdk/getting-started/partials/open-anyway.png b/discord/images/social-sdk/getting-started/partials/open-anyway.png new file mode 100644 index 0000000000..a76fb99d60 Binary files /dev/null and b/discord/images/social-sdk/getting-started/partials/open-anyway.png differ diff --git a/discord/images/social-sdk/getting-started/partials/security-settings.png b/discord/images/social-sdk/getting-started/partials/security-settings.png new file mode 100644 index 0000000000..b053189f04 Binary files /dev/null and b/discord/images/social-sdk/getting-started/partials/security-settings.png differ diff --git a/static/images/social-sdk/getting-started/partials/settings-security.webp b/discord/images/social-sdk/getting-started/partials/settings-security.webp similarity index 100% rename from static/images/social-sdk/getting-started/partials/settings-security.webp rename to discord/images/social-sdk/getting-started/partials/settings-security.webp diff --git a/static/images/social-sdk/getting-started/unity-sample-preview.webp b/discord/images/social-sdk/getting-started/unity-sample-preview.webp similarity index 100% rename from static/images/social-sdk/getting-started/unity-sample-preview.webp rename to discord/images/social-sdk/getting-started/unity-sample-preview.webp diff --git a/discord/images/social-sdk/overview/social_sdk_header.png b/discord/images/social-sdk/overview/social_sdk_header.png new file mode 100644 index 0000000000..e163a5e477 Binary files /dev/null and b/discord/images/social-sdk/overview/social_sdk_header.png differ diff --git a/static/images/store_embed.webp b/discord/images/store_embed.webp similarity index 100% rename from static/images/store_embed.webp rename to discord/images/store_embed.webp diff --git a/discord/images/team-page.png b/discord/images/team-page.png new file mode 100644 index 0000000000..461f136b1d Binary files /dev/null and b/discord/images/team-page.png differ diff --git a/static/images/team-page.webp b/discord/images/team-page.webp similarity index 100% rename from static/images/team-page.webp rename to discord/images/team-page.webp diff --git a/discord/images/transfer-app-to-team.png b/discord/images/transfer-app-to-team.png new file mode 100644 index 0000000000..aee30c80a3 Binary files /dev/null and b/discord/images/transfer-app-to-team.png differ diff --git a/static/images/transfer-app-to-team.webp b/discord/images/transfer-app-to-team.webp similarity index 100% rename from static/images/transfer-app-to-team.webp rename to discord/images/transfer-app-to-team.webp diff --git a/discord/images/tutorials/cloudflare-general-overview.png b/discord/images/tutorials/cloudflare-general-overview.png new file mode 100644 index 0000000000..eff35d6423 Binary files /dev/null and b/discord/images/tutorials/cloudflare-general-overview.png differ diff --git a/discord/images/tutorials/cloudflare-interactions-endpoint.png b/discord/images/tutorials/cloudflare-interactions-endpoint.png new file mode 100644 index 0000000000..6d8017b517 Binary files /dev/null and b/discord/images/tutorials/cloudflare-interactions-endpoint.png differ diff --git a/discord/images/tutorials/cloudflare-ngrok.png b/discord/images/tutorials/cloudflare-ngrok.png new file mode 100644 index 0000000000..b64d99b137 Binary files /dev/null and b/discord/images/tutorials/cloudflare-ngrok.png differ diff --git a/discord/images/tutorials/cloudflare-tutorial-demo.gif b/discord/images/tutorials/cloudflare-tutorial-demo.gif new file mode 100644 index 0000000000..e61bbd314d Binary files /dev/null and b/discord/images/tutorials/cloudflare-tutorial-demo.gif differ diff --git a/discord/images/tutorials/cloudflare-url-generator.png b/discord/images/tutorials/cloudflare-url-generator.png new file mode 100644 index 0000000000..8e4bc8920f Binary files /dev/null and b/discord/images/tutorials/cloudflare-url-generator.png differ diff --git a/discord/images/tutorials/command-types.png b/discord/images/tutorials/command-types.png new file mode 100644 index 0000000000..aafb9d86f7 Binary files /dev/null and b/discord/images/tutorials/command-types.png differ diff --git a/discord/images/tutorials/examples-ephemeral-message.png b/discord/images/tutorials/examples-ephemeral-message.png new file mode 100644 index 0000000000..bc318a0817 Binary files /dev/null and b/discord/images/tutorials/examples-ephemeral-message.png differ diff --git a/discord/images/tutorials/examples-update-message.png b/discord/images/tutorials/examples-update-message.png new file mode 100644 index 0000000000..9935ecc13e Binary files /dev/null and b/discord/images/tutorials/examples-update-message.png differ diff --git a/discord/images/tutorials/interactions-url.png b/discord/images/tutorials/interactions-url.png new file mode 100644 index 0000000000..f4f9862fb6 Binary files /dev/null and b/discord/images/tutorials/interactions-url.png differ diff --git a/discord/images/tutorials/linked-roles-connect-account.png b/discord/images/tutorials/linked-roles-connect-account.png new file mode 100644 index 0000000000..6f30a20644 Binary files /dev/null and b/discord/images/tutorials/linked-roles-connect-account.png differ diff --git a/discord/images/tutorials/linked-roles-connected.png b/discord/images/tutorials/linked-roles-connected.png new file mode 100644 index 0000000000..e0abee8d48 Binary files /dev/null and b/discord/images/tutorials/linked-roles-connected.png differ diff --git a/discord/images/tutorials/linked-roles-consent-dialog.png b/discord/images/tutorials/linked-roles-consent-dialog.png new file mode 100644 index 0000000000..329163ec3e Binary files /dev/null and b/discord/images/tutorials/linked-roles-consent-dialog.png differ diff --git a/discord/images/tutorials/linked-roles-glitch-shared-url.png b/discord/images/tutorials/linked-roles-glitch-shared-url.png new file mode 100644 index 0000000000..e1ea49ba65 Binary files /dev/null and b/discord/images/tutorials/linked-roles-glitch-shared-url.png differ diff --git a/discord/images/tutorials/linked-roles-glitch.png b/discord/images/tutorials/linked-roles-glitch.png new file mode 100644 index 0000000000..88109b74d9 Binary files /dev/null and b/discord/images/tutorials/linked-roles-glitch.png differ diff --git a/discord/images/tutorials/linked-roles-oauth-config.png b/discord/images/tutorials/linked-roles-oauth-config.png new file mode 100644 index 0000000000..fb66f047f1 Binary files /dev/null and b/discord/images/tutorials/linked-roles-oauth-config.png differ diff --git a/discord/images/tutorials/linked-roles-register.png b/discord/images/tutorials/linked-roles-register.png new file mode 100644 index 0000000000..dfe6035886 Binary files /dev/null and b/discord/images/tutorials/linked-roles-register.png differ diff --git a/discord/images/tutorials/linked-roles-verification-setup.png b/discord/images/tutorials/linked-roles-verification-setup.png new file mode 100644 index 0000000000..b0b29c4e5b Binary files /dev/null and b/discord/images/tutorials/linked-roles-verification-setup.png differ diff --git a/discord/images/tutorials/linked-roles-verify-endpoint.png b/discord/images/tutorials/linked-roles-verify-endpoint.png new file mode 100644 index 0000000000..32f2f1775f Binary files /dev/null and b/discord/images/tutorials/linked-roles-verify-endpoint.png differ diff --git a/discord/images/tutorials/slash-command-options.png b/discord/images/tutorials/slash-command-options.png new file mode 100644 index 0000000000..bf2f7af322 Binary files /dev/null and b/discord/images/tutorials/slash-command-options.png differ diff --git a/discord/images/tutorials/user-install-game-message.png b/discord/images/tutorials/user-install-game-message.png new file mode 100644 index 0000000000..89cbcc8378 Binary files /dev/null and b/discord/images/tutorials/user-install-game-message.png differ diff --git a/discord/images/tutorials/user-install-settings.png b/discord/images/tutorials/user-install-settings.png new file mode 100644 index 0000000000..516901d859 Binary files /dev/null and b/discord/images/tutorials/user-install-settings.png differ diff --git a/static/images/url-generator.webp b/discord/images/url-generator.webp similarity index 100% rename from static/images/url-generator.webp rename to discord/images/url-generator.webp diff --git a/discord/images/user-command.png b/discord/images/user-command.png new file mode 100644 index 0000000000..ef669dd32a Binary files /dev/null and b/discord/images/user-command.png differ diff --git a/static/images/user-command.webp b/discord/images/user-command.webp similarity index 100% rename from static/images/user-command.webp rename to discord/images/user-command.webp diff --git a/static/images/user-install-game-message.webp b/discord/images/user-install-game-message.webp similarity index 100% rename from static/images/user-install-game-message.webp rename to discord/images/user-install-game-message.webp diff --git a/static/images/user-install-settings.webp b/discord/images/user-install-settings.webp similarity index 100% rename from static/images/user-install-settings.webp rename to discord/images/user-install-settings.webp diff --git a/discord/logo/dark.png b/discord/logo/dark.png new file mode 100644 index 0000000000..11c6612c98 Binary files /dev/null and b/discord/logo/dark.png differ diff --git a/discord/logo/dark.svg b/discord/logo/dark.svg new file mode 100644 index 0000000000..d99a9245ff --- /dev/null +++ b/discord/logo/dark.svg @@ -0,0 +1,4 @@ + + + + diff --git a/discord/logo/dot_dev.svg b/discord/logo/dot_dev.svg new file mode 100644 index 0000000000..867878bdfe --- /dev/null +++ b/discord/logo/dot_dev.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/discord/logo/light.png b/discord/logo/light.png new file mode 100644 index 0000000000..f88870f616 Binary files /dev/null and b/discord/logo/light.png differ diff --git a/discord/logo/light.svg b/discord/logo/light.svg new file mode 100644 index 0000000000..e21d461422 --- /dev/null +++ b/discord/logo/light.svg @@ -0,0 +1,4 @@ + + + + diff --git a/discord/scripts/ga.js b/discord/scripts/ga.js new file mode 100644 index 0000000000..b607914919 --- /dev/null +++ b/discord/scripts/ga.js @@ -0,0 +1,4 @@ +window.dataLayer = window.dataLayer || []; +function gtag() { dataLayer.push(arguments); } +gtag('js', new Date()); +gtag('config', 'G-5CWMJQ1S0X'); \ No newline at end of file diff --git a/discord/snippets/card.mdx b/discord/snippets/card.mdx new file mode 100644 index 0000000000..5aab8f4649 --- /dev/null +++ b/discord/snippets/card.mdx @@ -0,0 +1,23 @@ +export const IntroCard = ({ img, href, title, description }) => { + return ( + +
+
+ {title} +
+
+

+ {title} +

+

+ {description} +

+
+
+
+ ); +}; \ No newline at end of file diff --git a/discord/snippets/discord-social-sdk/callouts/console-access.mdx b/discord/snippets/discord-social-sdk/callouts/console-access.mdx new file mode 100644 index 0000000000..8f746f80df --- /dev/null +++ b/discord/snippets/discord-social-sdk/callouts/console-access.mdx @@ -0,0 +1,3 @@ + +To use the Discord Social SDK in your console games, you will need to request middleware approval and be an approved developer for the target console. Check out [this article](https://support-dev.discord.com/hc/en-us/articles/30209074764183) to learn more. + diff --git a/discord/snippets/discord-social-sdk/callouts/limited-access.mdx b/discord/snippets/discord-social-sdk/callouts/limited-access.mdx new file mode 100644 index 0000000000..07bb468eae --- /dev/null +++ b/discord/snippets/discord-social-sdk/callouts/limited-access.mdx @@ -0,0 +1,6 @@ + +This feature is currently available with +[limited access](/developers/docs/discord-social-sdk/core-concepts/communication-features#limited-access). To apply for full access +to closed beta features, or to reach out to Discord directly to discuss your game, please fill out +[this form](https://discord.com/developers/social-sdk-closed-beta-access-request-form). + \ No newline at end of file diff --git a/discord/snippets/discord-social-sdk/callouts/oauth-comms-scopes.mdx b/discord/snippets/discord-social-sdk/callouts/oauth-comms-scopes.mdx new file mode 100644 index 0000000000..1e20bb44ca --- /dev/null +++ b/discord/snippets/discord-social-sdk/callouts/oauth-comms-scopes.mdx @@ -0,0 +1,7 @@ + +To utilize this communication feature, you must enable [`Client::GetDefaultCommunicationScopes`] in your OAuth Scope configuration. +See the [OAuth Scopes Core Concepts Guide](/developers/docs/discord-social-sdk/core-concepts/oauth2-scopes) for more details. + + +{/* Autogenerated Reference Links */} +[`Client::GetDefaultCommunicationScopes`]: https://discord.com/developers/docs/social-sdk/classdiscordpp_1_1Client.html#a71499da752fbdc2d4326ae0fd36c0dd1 \ No newline at end of file diff --git a/discord/snippets/discord-social-sdk/callouts/public-client.mdx b/discord/snippets/discord-social-sdk/callouts/public-client.mdx new file mode 100644 index 0000000000..96fe5d6caf --- /dev/null +++ b/discord/snippets/discord-social-sdk/callouts/public-client.mdx @@ -0,0 +1,3 @@ + +This method requires enabling **Public Client** for your app. Most games will not want to ship with this enabled. [Learn more](/developers/docs/discord-social-sdk/core-concepts/oauth2-scopes#oauth2-client-types) + \ No newline at end of file diff --git a/discord/snippets/discord-social-sdk/callouts/rate-limit.mdx b/discord/snippets/discord-social-sdk/callouts/rate-limit.mdx new file mode 100644 index 0000000000..d62d7bb73a --- /dev/null +++ b/discord/snippets/discord-social-sdk/callouts/rate-limit.mdx @@ -0,0 +1,5 @@ + +This feature is currently available with rate limits. +To remove the rate limits for your game, please follow +[Communication Features: Applying for Rate Limit Removal](/developers/docs/discord-social-sdk/core-concepts/communication-features#applying-for-rate-limit-removal). + \ No newline at end of file diff --git a/discord/snippets/discord-social-sdk/callouts/sony.mdx b/discord/snippets/discord-social-sdk/callouts/sony.mdx new file mode 100644 index 0000000000..7ed72c4255 --- /dev/null +++ b/discord/snippets/discord-social-sdk/callouts/sony.mdx @@ -0,0 +1,8 @@ + +Exception: Prohibited Off-Platform Interactions by Sony
+For integrations experienced on Sony Platforms (e.g. PlayStation 5)… +

1. **Do not allow access to Account Linking** entry points. +
2. **Do not allow access to Linked Channels**. +
3. **Limit messaging and Invites to other players currently playing** the game. +
4. **Do not display off-platform presence and logos** (including Discord). +
\ No newline at end of file diff --git a/discord/snippets/discord-social-sdk/callouts/support.mdx b/discord/snippets/discord-social-sdk/callouts/support.mdx new file mode 100644 index 0000000000..c8f9c6c069 --- /dev/null +++ b/discord/snippets/discord-social-sdk/callouts/support.mdx @@ -0,0 +1,3 @@ +Need help? Join the [Discord Developers Server](https://discord.gg/discord-developers) and share questions in the `#social-sdk-dev-help` channel for support from the community. + +If you encounter a bug while working with the Social SDK, please report it here: https://dis.gd/social-sdk-bug-report diff --git a/discord/snippets/discord-social-sdk/partials/dylib-mac-error.mdx b/discord/snippets/discord-social-sdk/partials/dylib-mac-error.mdx new file mode 100644 index 0000000000..9ae08b4439 --- /dev/null +++ b/discord/snippets/discord-social-sdk/partials/dylib-mac-error.mdx @@ -0,0 +1,14 @@ + +On Mac you may get the error "libdiscord_partner_sdk.dylib" Not Opened because Apple couldn't verify it. If this happens press **Done** on the popup. + +![Error](/images/social-sdk/getting-started/partials/error.png) + +You'll need to open your **System Settings > Privacy & Security** and scroll down to the **Security** section. It will tell you "libdiscord_partner_sdk.dylib" was blocked to protect your Mac. Press **Open Anyway** and try running again. + +![Settings](/images/social-sdk/getting-started/partials/security-settings.png) + +Now when you get the pop up you'll have the option to select **Open Anyway** and it will be able to use it successfully. + +![Open](/images/social-sdk/getting-started/partials/open-anyway.png) + + \ No newline at end of file diff --git a/discord/snippets/discord-social-sdk/partials/getting-started.mdx b/discord/snippets/discord-social-sdk/partials/getting-started.mdx new file mode 100644 index 0000000000..e66c14149b --- /dev/null +++ b/discord/snippets/discord-social-sdk/partials/getting-started.mdx @@ -0,0 +1,35 @@ +## Step 1: Create a Discord Developer Team + +Before you start, you'll need to create a developer team on the Discord Developer Portal. This team will be used to manage your Discord applications and SDK integrations. + +If you already have a team configured, you can skip this step. + +1. Create a developer team on the [Discord Developer Portal](https://discord.com/developers/teams). + +Later, you can invite your team members to your new team to collaborate on your integration. + +--- + +## Step 2: Create a Discord Application + +1. Create a new application on the [Discord Developer Portal](https://discord.com/developers/applications) and assign it to your team. +3. Add a redirect URL in the `OAuth2` tab: + - For desktop applications: `http://127.0.0.1/callback` (this can be changed later). + - See [`discordpp::Client::Authorize`](https://discord.com/developers/docs/social-sdk/classdiscordpp_1_1Client.html#ace94a58e27545a933d79db32b387a468) for more details on setting up more advanced redirect URIs. +4. Enable the `Public Client` toggle in the `OAuth2` tab. + + +This guide requires enabling **Public Client** to allow you to get started with the SDK quickly. Most games will not want to ship as a public client. This setting should be reviewed by your team prior to releasing your game. [Learn more about public clients](/developers/docs/discord-social-sdk/core-concepts/oauth2-scopes#oauth2-client-types). + + +--- + +## Step 3: Enable Discord Social SDK for Your App + +Once you've created your Discord application, you'll need to enable the Discord Social SDK for it. + +1. From the [Discord Developer Portal](https://discord.com/developers/applications), select your newly created application from Step 2. +2. In the left sidebar for your app, locate and click the `Getting Started` link under `Discord Social SDK`. +3. Fill out the form to share details about your game. +4. Click `Submit` and the Social SDK will be enabled for your application. +5. Once enabled, you'll find binaries for the Social SDK under `Downloads`. \ No newline at end of file diff --git a/discord/snippets/icons/ActivitiesIcon.jsx b/discord/snippets/icons/ActivitiesIcon.jsx new file mode 100644 index 0000000000..efccb2c34e --- /dev/null +++ b/discord/snippets/icons/ActivitiesIcon.jsx @@ -0,0 +1,3 @@ +// AUTOGENERATED BY tools/icons/generate-icons.js: DO NOT MODIFY DIRECTLY + +export const ActivitiesIcon = (props) => (); \ No newline at end of file diff --git a/discord/snippets/icons/AppsIcon.jsx b/discord/snippets/icons/AppsIcon.jsx new file mode 100644 index 0000000000..cd264fdd6c --- /dev/null +++ b/discord/snippets/icons/AppsIcon.jsx @@ -0,0 +1,3 @@ +// AUTOGENERATED BY tools/icons/generate-icons.js: DO NOT MODIFY DIRECTLY + +export const AppsIcon = (props) => (); \ No newline at end of file diff --git a/discord/snippets/icons/BookCheckIcon.jsx b/discord/snippets/icons/BookCheckIcon.jsx new file mode 100644 index 0000000000..7a9776b4ff --- /dev/null +++ b/discord/snippets/icons/BookCheckIcon.jsx @@ -0,0 +1,3 @@ +// AUTOGENERATED BY tools/icons/generate-icons.js: DO NOT MODIFY DIRECTLY + +export const BookCheckIcon = (props) => (); \ No newline at end of file diff --git a/discord/snippets/icons/BrowserIcon.jsx b/discord/snippets/icons/BrowserIcon.jsx new file mode 100644 index 0000000000..210d880fc6 --- /dev/null +++ b/discord/snippets/icons/BrowserIcon.jsx @@ -0,0 +1,3 @@ +// AUTOGENERATED BY tools/icons/generate-icons.js: DO NOT MODIFY DIRECTLY + +export const BrowserIcon = (props) => (); \ No newline at end of file diff --git a/discord/snippets/icons/BugIcon.jsx b/discord/snippets/icons/BugIcon.jsx new file mode 100644 index 0000000000..c632b969c9 --- /dev/null +++ b/discord/snippets/icons/BugIcon.jsx @@ -0,0 +1,3 @@ +// AUTOGENERATED BY tools/icons/generate-icons.js: DO NOT MODIFY DIRECTLY + +export const BugIcon = (props) => (); \ No newline at end of file diff --git a/discord/snippets/icons/ChatDotsIcon.jsx b/discord/snippets/icons/ChatDotsIcon.jsx new file mode 100644 index 0000000000..86b0cdb4ab --- /dev/null +++ b/discord/snippets/icons/ChatDotsIcon.jsx @@ -0,0 +1,3 @@ +// AUTOGENERATED BY tools/icons/generate-icons.js: DO NOT MODIFY DIRECTLY + +export const ChatDotsIcon = (props) => (); \ No newline at end of file diff --git a/discord/snippets/icons/ChatIcon.jsx b/discord/snippets/icons/ChatIcon.jsx new file mode 100644 index 0000000000..43d28ba8bf --- /dev/null +++ b/discord/snippets/icons/ChatIcon.jsx @@ -0,0 +1,3 @@ +// AUTOGENERATED BY tools/icons/generate-icons.js: DO NOT MODIFY DIRECTLY + +export const ChatIcon = (props) => (); \ No newline at end of file diff --git a/discord/snippets/icons/CircleQuestionIcon.jsx b/discord/snippets/icons/CircleQuestionIcon.jsx new file mode 100644 index 0000000000..e8cd263aa7 --- /dev/null +++ b/discord/snippets/icons/CircleQuestionIcon.jsx @@ -0,0 +1,3 @@ +// AUTOGENERATED BY tools/icons/generate-icons.js: DO NOT MODIFY DIRECTLY + +export const CircleQuestionIcon = (props) => (); \ No newline at end of file diff --git a/discord/snippets/icons/ClydeIcon.jsx b/discord/snippets/icons/ClydeIcon.jsx new file mode 100644 index 0000000000..77c6f8136c --- /dev/null +++ b/discord/snippets/icons/ClydeIcon.jsx @@ -0,0 +1,3 @@ +// AUTOGENERATED BY tools/icons/generate-icons.js: DO NOT MODIFY DIRECTLY + +export const ClydeIcon = (props) => (); \ No newline at end of file diff --git a/discord/snippets/icons/CompassIcon.jsx b/discord/snippets/icons/CompassIcon.jsx new file mode 100644 index 0000000000..4d565074df --- /dev/null +++ b/discord/snippets/icons/CompassIcon.jsx @@ -0,0 +1,3 @@ +// AUTOGENERATED BY tools/icons/generate-icons.js: DO NOT MODIFY DIRECTLY + +export const CompassIcon = (props) => (); \ No newline at end of file diff --git a/discord/snippets/icons/ContactsIcon.jsx b/discord/snippets/icons/ContactsIcon.jsx new file mode 100644 index 0000000000..4139090a7b --- /dev/null +++ b/discord/snippets/icons/ContactsIcon.jsx @@ -0,0 +1,3 @@ +// AUTOGENERATED BY tools/icons/generate-icons.js: DO NOT MODIFY DIRECTLY + +export const ContactsIcon = (props) => (); \ No newline at end of file diff --git a/discord/snippets/icons/CrownIcon.jsx b/discord/snippets/icons/CrownIcon.jsx new file mode 100644 index 0000000000..75f04522b2 --- /dev/null +++ b/discord/snippets/icons/CrownIcon.jsx @@ -0,0 +1,3 @@ +// AUTOGENERATED BY tools/icons/generate-icons.js: DO NOT MODIFY DIRECTLY + +export const CrownIcon = (props) => (); \ No newline at end of file diff --git a/discord/snippets/icons/DoorEnterIcon.jsx b/discord/snippets/icons/DoorEnterIcon.jsx new file mode 100644 index 0000000000..10022c1a4d --- /dev/null +++ b/discord/snippets/icons/DoorEnterIcon.jsx @@ -0,0 +1,3 @@ +// AUTOGENERATED BY tools/icons/generate-icons.js: DO NOT MODIFY DIRECTLY + +export const DoorEnterIcon = (props) => (); \ No newline at end of file diff --git a/discord/snippets/icons/DpadIcon.jsx b/discord/snippets/icons/DpadIcon.jsx new file mode 100644 index 0000000000..b84a005a9f --- /dev/null +++ b/discord/snippets/icons/DpadIcon.jsx @@ -0,0 +1,3 @@ +// AUTOGENERATED BY tools/icons/generate-icons.js: DO NOT MODIFY DIRECTLY + +export const DpadIcon = (props) => (); \ No newline at end of file diff --git a/discord/snippets/icons/ForumIcon.jsx b/discord/snippets/icons/ForumIcon.jsx new file mode 100644 index 0000000000..06e3fbe0b0 --- /dev/null +++ b/discord/snippets/icons/ForumIcon.jsx @@ -0,0 +1,3 @@ +// AUTOGENERATED BY tools/icons/generate-icons.js: DO NOT MODIFY DIRECTLY + +export const ForumIcon = (props) => (); \ No newline at end of file diff --git a/discord/snippets/icons/GameControllerIcon.jsx b/discord/snippets/icons/GameControllerIcon.jsx new file mode 100644 index 0000000000..18b454b205 --- /dev/null +++ b/discord/snippets/icons/GameControllerIcon.jsx @@ -0,0 +1,3 @@ +// AUTOGENERATED BY tools/icons/generate-icons.js: DO NOT MODIFY DIRECTLY + +export const GameControllerIcon = (props) => (); \ No newline at end of file diff --git a/discord/snippets/icons/GlobeEarthIcon.jsx b/discord/snippets/icons/GlobeEarthIcon.jsx new file mode 100644 index 0000000000..1035ccddc0 --- /dev/null +++ b/discord/snippets/icons/GlobeEarthIcon.jsx @@ -0,0 +1,3 @@ +// AUTOGENERATED BY tools/icons/generate-icons.js: DO NOT MODIFY DIRECTLY + +export const GlobeEarthIcon = (props) => (); \ No newline at end of file diff --git a/discord/snippets/icons/GroupIcon.jsx b/discord/snippets/icons/GroupIcon.jsx new file mode 100644 index 0000000000..7d5a4db816 --- /dev/null +++ b/discord/snippets/icons/GroupIcon.jsx @@ -0,0 +1,3 @@ +// AUTOGENERATED BY tools/icons/generate-icons.js: DO NOT MODIFY DIRECTLY + +export const GroupIcon = (props) => (); \ No newline at end of file diff --git a/discord/snippets/icons/HammerIcon.jsx b/discord/snippets/icons/HammerIcon.jsx new file mode 100644 index 0000000000..2cd575fe34 --- /dev/null +++ b/discord/snippets/icons/HammerIcon.jsx @@ -0,0 +1,3 @@ +// AUTOGENERATED BY tools/icons/generate-icons.js: DO NOT MODIFY DIRECTLY + +export const HammerIcon = (props) => (); \ No newline at end of file diff --git a/discord/snippets/icons/HashmarkIcon.jsx b/discord/snippets/icons/HashmarkIcon.jsx new file mode 100644 index 0000000000..8269515ef0 --- /dev/null +++ b/discord/snippets/icons/HashmarkIcon.jsx @@ -0,0 +1,3 @@ +// AUTOGENERATED BY tools/icons/generate-icons.js: DO NOT MODIFY DIRECTLY + +export const HashmarkIcon = (props) => (); \ No newline at end of file diff --git a/discord/snippets/icons/InboxIcon.jsx b/discord/snippets/icons/InboxIcon.jsx new file mode 100644 index 0000000000..634846b0fb --- /dev/null +++ b/discord/snippets/icons/InboxIcon.jsx @@ -0,0 +1,3 @@ +// AUTOGENERATED BY tools/icons/generate-icons.js: DO NOT MODIFY DIRECTLY + +export const InboxIcon = (props) => (); \ No newline at end of file diff --git a/discord/snippets/icons/LettersIcon.jsx b/discord/snippets/icons/LettersIcon.jsx new file mode 100644 index 0000000000..746179e063 --- /dev/null +++ b/discord/snippets/icons/LettersIcon.jsx @@ -0,0 +1,3 @@ +// AUTOGENERATED BY tools/icons/generate-icons.js: DO NOT MODIFY DIRECTLY + +export const LettersIcon = (props) => (); \ No newline at end of file diff --git a/discord/snippets/icons/LinkIcon.jsx b/discord/snippets/icons/LinkIcon.jsx new file mode 100644 index 0000000000..8554452385 --- /dev/null +++ b/discord/snippets/icons/LinkIcon.jsx @@ -0,0 +1,3 @@ +// AUTOGENERATED BY tools/icons/generate-icons.js: DO NOT MODIFY DIRECTLY + +export const LinkIcon = (props) => (); \ No newline at end of file diff --git a/discord/snippets/icons/ListViewIcon.jsx b/discord/snippets/icons/ListViewIcon.jsx new file mode 100644 index 0000000000..0f4500c3f0 --- /dev/null +++ b/discord/snippets/icons/ListViewIcon.jsx @@ -0,0 +1,3 @@ +// AUTOGENERATED BY tools/icons/generate-icons.js: DO NOT MODIFY DIRECTLY + +export const ListViewIcon = (props) => (); \ No newline at end of file diff --git a/discord/snippets/icons/MagicDoorIcon.jsx b/discord/snippets/icons/MagicDoorIcon.jsx new file mode 100644 index 0000000000..063964f002 --- /dev/null +++ b/discord/snippets/icons/MagicDoorIcon.jsx @@ -0,0 +1,3 @@ +// AUTOGENERATED BY tools/icons/generate-icons.js: DO NOT MODIFY DIRECTLY + +export const MagicDoorIcon = (props) => (); \ No newline at end of file diff --git a/discord/snippets/icons/MagicWandIcon.jsx b/discord/snippets/icons/MagicWandIcon.jsx new file mode 100644 index 0000000000..0d3f7a9be5 --- /dev/null +++ b/discord/snippets/icons/MagicWandIcon.jsx @@ -0,0 +1,3 @@ +// AUTOGENERATED BY tools/icons/generate-icons.js: DO NOT MODIFY DIRECTLY + +export const MagicWandIcon = (props) => (); \ No newline at end of file diff --git a/discord/snippets/icons/PaintPaletteIcon.jsx b/discord/snippets/icons/PaintPaletteIcon.jsx new file mode 100644 index 0000000000..1be1f298de --- /dev/null +++ b/discord/snippets/icons/PaintPaletteIcon.jsx @@ -0,0 +1,3 @@ +// AUTOGENERATED BY tools/icons/generate-icons.js: DO NOT MODIFY DIRECTLY + +export const PaintPaletteIcon = (props) => (); \ No newline at end of file diff --git a/discord/snippets/icons/PhoneCallIcon.jsx b/discord/snippets/icons/PhoneCallIcon.jsx new file mode 100644 index 0000000000..4ac52d4644 --- /dev/null +++ b/discord/snippets/icons/PhoneCallIcon.jsx @@ -0,0 +1,3 @@ +// AUTOGENERATED BY tools/icons/generate-icons.js: DO NOT MODIFY DIRECTLY + +export const PhoneCallIcon = (props) => (); \ No newline at end of file diff --git a/discord/snippets/icons/PlayIcon.jsx b/discord/snippets/icons/PlayIcon.jsx new file mode 100644 index 0000000000..c8f123d745 --- /dev/null +++ b/discord/snippets/icons/PlayIcon.jsx @@ -0,0 +1,3 @@ +// AUTOGENERATED BY tools/icons/generate-icons.js: DO NOT MODIFY DIRECTLY + +export const PlayIcon = (props) => (); \ No newline at end of file diff --git a/discord/snippets/icons/RobotIcon.jsx b/discord/snippets/icons/RobotIcon.jsx new file mode 100644 index 0000000000..4d6ea650af --- /dev/null +++ b/discord/snippets/icons/RobotIcon.jsx @@ -0,0 +1,3 @@ +// AUTOGENERATED BY tools/icons/generate-icons.js: DO NOT MODIFY DIRECTLY + +export const RobotIcon = (props) => (); \ No newline at end of file diff --git a/discord/snippets/icons/ShieldIcon.jsx b/discord/snippets/icons/ShieldIcon.jsx new file mode 100644 index 0000000000..f7bc297815 --- /dev/null +++ b/discord/snippets/icons/ShieldIcon.jsx @@ -0,0 +1,3 @@ +// AUTOGENERATED BY tools/icons/generate-icons.js: DO NOT MODIFY DIRECTLY + +export const ShieldIcon = (props) => (); \ No newline at end of file diff --git a/discord/snippets/icons/ShopIcon.jsx b/discord/snippets/icons/ShopIcon.jsx new file mode 100644 index 0000000000..ab6459b5cc --- /dev/null +++ b/discord/snippets/icons/ShopIcon.jsx @@ -0,0 +1,3 @@ +// AUTOGENERATED BY tools/icons/generate-icons.js: DO NOT MODIFY DIRECTLY + +export const ShopIcon = (props) => (); \ No newline at end of file diff --git a/discord/snippets/icons/SlashBoxIcon.jsx b/discord/snippets/icons/SlashBoxIcon.jsx new file mode 100644 index 0000000000..663f31327f --- /dev/null +++ b/discord/snippets/icons/SlashBoxIcon.jsx @@ -0,0 +1,3 @@ +// AUTOGENERATED BY tools/icons/generate-icons.js: DO NOT MODIFY DIRECTLY + +export const SlashBoxIcon = (props) => (); \ No newline at end of file diff --git a/discord/snippets/icons/StarShootingIcon.jsx b/discord/snippets/icons/StarShootingIcon.jsx new file mode 100644 index 0000000000..10474acfdb --- /dev/null +++ b/discord/snippets/icons/StarShootingIcon.jsx @@ -0,0 +1,3 @@ +// AUTOGENERATED BY tools/icons/generate-icons.js: DO NOT MODIFY DIRECTLY + +export const StarShootingIcon = (props) => (); \ No newline at end of file diff --git a/discord/snippets/icons/TextControllerIcon.jsx b/discord/snippets/icons/TextControllerIcon.jsx new file mode 100644 index 0000000000..e53b702912 --- /dev/null +++ b/discord/snippets/icons/TextControllerIcon.jsx @@ -0,0 +1,3 @@ +// AUTOGENERATED BY tools/icons/generate-icons.js: DO NOT MODIFY DIRECTLY + +export const TextControllerIcon = (props) => (); \ No newline at end of file diff --git a/discord/snippets/icons/TrophyIcon.jsx b/discord/snippets/icons/TrophyIcon.jsx new file mode 100644 index 0000000000..1a1a68744c --- /dev/null +++ b/discord/snippets/icons/TrophyIcon.jsx @@ -0,0 +1,3 @@ +// AUTOGENERATED BY tools/icons/generate-icons.js: DO NOT MODIFY DIRECTLY + +export const TrophyIcon = (props) => (); \ No newline at end of file diff --git a/discord/snippets/icons/UserIcon.jsx b/discord/snippets/icons/UserIcon.jsx new file mode 100644 index 0000000000..45fb87df50 --- /dev/null +++ b/discord/snippets/icons/UserIcon.jsx @@ -0,0 +1,3 @@ +// AUTOGENERATED BY tools/icons/generate-icons.js: DO NOT MODIFY DIRECTLY + +export const UserIcon = (props) => (); \ No newline at end of file diff --git a/discord/snippets/icons/UserPlatformIcon.jsx b/discord/snippets/icons/UserPlatformIcon.jsx new file mode 100644 index 0000000000..97e42eb19b --- /dev/null +++ b/discord/snippets/icons/UserPlatformIcon.jsx @@ -0,0 +1,3 @@ +// AUTOGENERATED BY tools/icons/generate-icons.js: DO NOT MODIFY DIRECTLY + +export const UserPlatformIcon = (props) => (); \ No newline at end of file diff --git a/discord/snippets/icons/UserPlusIcon.jsx b/discord/snippets/icons/UserPlusIcon.jsx new file mode 100644 index 0000000000..b0ebfa0f14 --- /dev/null +++ b/discord/snippets/icons/UserPlusIcon.jsx @@ -0,0 +1,3 @@ +// AUTOGENERATED BY tools/icons/generate-icons.js: DO NOT MODIFY DIRECTLY + +export const UserPlusIcon = (props) => (); \ No newline at end of file diff --git a/discord/snippets/icons/UserStatusIcon.jsx b/discord/snippets/icons/UserStatusIcon.jsx new file mode 100644 index 0000000000..070dd6b887 --- /dev/null +++ b/discord/snippets/icons/UserStatusIcon.jsx @@ -0,0 +1,3 @@ +// AUTOGENERATED BY tools/icons/generate-icons.js: DO NOT MODIFY DIRECTLY + +export const UserStatusIcon = (props) => (); \ No newline at end of file diff --git a/discord/snippets/icons/VoiceNormalIcon.jsx b/discord/snippets/icons/VoiceNormalIcon.jsx new file mode 100644 index 0000000000..b3e2407762 --- /dev/null +++ b/discord/snippets/icons/VoiceNormalIcon.jsx @@ -0,0 +1,3 @@ +// AUTOGENERATED BY tools/icons/generate-icons.js: DO NOT MODIFY DIRECTLY + +export const VoiceNormalIcon = (props) => (); \ No newline at end of file diff --git a/discord/snippets/icons/WrenchIcon.jsx b/discord/snippets/icons/WrenchIcon.jsx new file mode 100644 index 0000000000..1918f37b73 --- /dev/null +++ b/discord/snippets/icons/WrenchIcon.jsx @@ -0,0 +1,3 @@ +// AUTOGENERATED BY tools/icons/generate-icons.js: DO NOT MODIFY DIRECTLY + +export const WrenchIcon = (props) => (); \ No newline at end of file diff --git a/discord/snippets/linkbutton.jsx b/discord/snippets/linkbutton.jsx new file mode 100644 index 0000000000..2157601510 --- /dev/null +++ b/discord/snippets/linkbutton.jsx @@ -0,0 +1,7 @@ +export const LinkButton = ({ children, to, color }) => { + return ( + + {children} + + ); +}; \ No newline at end of file diff --git a/discord/snippets/manualanchor.jsx b/discord/snippets/manualanchor.jsx new file mode 100644 index 0000000000..6bc490e278 --- /dev/null +++ b/discord/snippets/manualanchor.jsx @@ -0,0 +1,5 @@ +export const ManualAnchor = ({ id }) => { + return ( +
+ ); +}; \ No newline at end of file diff --git a/discord/snippets/monospace.jsx b/discord/snippets/monospace.jsx new file mode 100644 index 0000000000..3b1a2bb4a6 --- /dev/null +++ b/discord/snippets/monospace.jsx @@ -0,0 +1,7 @@ +export const Monospace = ({ method, children }) => { + return ( +
+ {children} +
+ ); +}; \ No newline at end of file diff --git a/discord/snippets/route.jsx b/discord/snippets/route.jsx new file mode 100644 index 0000000000..e9540c308e --- /dev/null +++ b/discord/snippets/route.jsx @@ -0,0 +1,8 @@ +export const Route = ({ method, children }) => { + return ( +
+ {method} + {children} +
+ ); +}; \ No newline at end of file diff --git a/discord/snippets/snowflake.jsx b/discord/snippets/snowflake.jsx new file mode 100644 index 0000000000..dcd42b8a62 --- /dev/null +++ b/discord/snippets/snowflake.jsx @@ -0,0 +1,159 @@ +export const Snowflake = () => { + return ( +
+ + + + 175928847299117063 + + + + + 41944705796 + + + + + 1462015105796 + + + + + 2016-04-30 11:18:25.796 UTC + + + + + 000000100111000100000110010110101100000100 + + + + + 00001 + + + + + 00000 + + + + + to binary + + + + + to decimal + + + + + Parse unix timestamp (ms) + + + + + + 1420070400000 + + + Discord Epoch (unix timestamp in ms) + + + + + Number of milliseconds since the Discord epoch{' '} + + + (first seconds of 2015) + + + + + Internal + + + worker + + + ID + + + + + Internal + + + process + + + ID + + + + + 000000000111 + + + + + Incremented{' '} + + + for every{' '} + + + generated ID{' '} + + + on that{' '} + + + process + + + + + 64 + + + + + 22 + + + + + 12 + + + + + 0 + + + + + 17 + + + + + + + +
+ ); +} diff --git a/discord/styles/api.css b/discord/styles/api.css new file mode 100644 index 0000000000..d0a31fd862 --- /dev/null +++ b/discord/styles/api.css @@ -0,0 +1,21 @@ +/* Hide link icon for anchors on hover */ +.param-head .absolute { + display: none; +} + +.param-head .dark\:text-primary-light:is(.dark *) { + color: #929af2; + font-weight: bold; +} + +.api-section .py-6 { + padding: 0.5rem 0.5rem; +} + +.code-group:first-child { + display: none; +} + +#content-side-layout:has(.code-group) { + top: 8.5rem; +} \ No newline at end of file diff --git a/discord/styles/changelog.css b/discord/styles/changelog.css new file mode 100644 index 0000000000..34556fdf6b --- /dev/null +++ b/discord/styles/changelog.css @@ -0,0 +1,6 @@ +#content-area:has(.mdx-content[data-page-href="/src/_props/developers/docs/change-log"]), +#content-area:has(.mdx-content[data-page-href="/developers/docs/change-log"]) { + div#page-context-menu { + display: none; + } +} \ No newline at end of file diff --git a/discord/styles/fonts.css b/discord/styles/fonts.css new file mode 100644 index 0000000000..831660693a --- /dev/null +++ b/discord/styles/fonts.css @@ -0,0 +1,49 @@ +/* +Imports Discord brand font + */ + + @font-face { + font-family: discord; + src: url('https://mintlify-assets.b-cdn.net/fonts/discord/discord.woff2'); + } + @font-face { + font-family: "gg sans"; + font-weight: 200; + src: url('https://mintlify-assets.b-cdn.net/fonts/discord/gg_200.woff2') + } + + @font-face { + font-family: "gg sans"; + font-weight: 400; + src: url('https://mintlify-assets.b-cdn.net/fonts/discord/gg_400.woff2'); + } + + @font-face { + font-family: "gg sans"; + font-weight: 600; + src: url('https://mintlify-assets.b-cdn.net/fonts/discord/gg_600.woff2'); + } + +@font-face { + font-family: "gg sans"; + font-weight: 800; + src: url('https://mintlify-assets.b-cdn.net/fonts/discord/gg_800.woff2') +} + +body { + font-family: "gg sans", var(--font-inter), -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif; + font-weight: 400; +} + +h1, h2, h3, h4, h5, h6 { + font-family: "gg sans", var(--font-inter), -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif; + font-weight: 600; +} + +.\[\&_\*\:not\(h1\2c h2\2c h3\2c h4\2c h5\2c h6\2c h1_\*\2c h2_\*\2c h3_\*\2c h4_\*\2c h5_\*\2c h6_\*\)\]\:font-bodyWeight :not(h1,h2,h3,h4,h5,h6,h1 *,h2 *,h3 *,h4 *,h5 *,h6 *) { + font-weight: 400; +} + + + + diff --git a/discord/styles/homepage.css b/discord/styles/homepage.css new file mode 100644 index 0000000000..13ff1f9e14 --- /dev/null +++ b/discord/styles/homepage.css @@ -0,0 +1,62 @@ +#homepage-hero { + display: grid; + + margin: -1rem auto 1.5rem auto; + background-image: url(https://mintlify-assets.b-cdn.net/discord-back.png); + background-size: cover; + background-position: center; + grid-area: 1/1; + border-radius: var(--radius-lg); + + #hero-text { + display: flex; + grid-area: 1/1; + align-self: center; + margin: 2rem; + gap: 1rem; + color: white; + } + + #hero-tagline { + font-size: 2rem; + line-height: 2rem; + font-family: 'discord'; + margin: 2rem 0 0.5rem 0; + color: white; + } + + #hero-image { + width: 300px; + height: 300px; + display: none; + } +} + +@media (min-width: 1024px) { + #homepage-hero { + #hero-image { + display: block; + } + #hero-tagline { + font-size: 4rem; + line-height: 4rem; + margin-bottom: 0rem; + } + #hero-text { + margin: 4rem; + } + } +} + +#content-area:has(.mdx-content[data-page-href="/src/_props/developers/docs/intro"]), +#content-area:has(.mdx-content[data-page-href="/developers/docs/intro"]) { + padding-right: 1rem; + + div:has(h1#page-title) { + display: none; + } + + div#page-context-menu { + display: none; + } +} \ No newline at end of file diff --git a/discord/styles/linkbutton.css b/discord/styles/linkbutton.css new file mode 100644 index 0000000000..2f11276640 --- /dev/null +++ b/discord/styles/linkbutton.css @@ -0,0 +1,15 @@ +.MDXLinkButton { + display: block; + color: white !important; + font-size: 15px; + padding: 10px 16px; + border-radius: var(--radius-xs); + width: fit-content; + height: fit-content; + box-sizing: border-box; + line-height: 18px; + + &.brand { + background-color: var(--brand-500); + } +} \ No newline at end of file diff --git a/discord/styles/manualanchor.css b/discord/styles/manualanchor.css new file mode 100644 index 0000000000..7b9bdbb908 --- /dev/null +++ b/discord/styles/manualanchor.css @@ -0,0 +1,10 @@ + +.MDXManualAnchor { + display: inline; + width: 100px; + height: 10px; + background-color: red; + position: relative; + top: -120px; + visibility: hidden; +} \ No newline at end of file diff --git a/discord/styles/monospace.css b/discord/styles/monospace.css new file mode 100644 index 0000000000..63bb56546a --- /dev/null +++ b/discord/styles/monospace.css @@ -0,0 +1,6 @@ +.MDXMonospace { + font-family: var(--font-jetbrains-mono), ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace; + font-feature-settings: normal; + font-variation-settings: normal; + font-size: 1em; +} \ No newline at end of file diff --git a/discord/styles/route.css b/discord/styles/route.css new file mode 100644 index 0000000000..3406cff0e7 --- /dev/null +++ b/discord/styles/route.css @@ -0,0 +1,47 @@ +.MDXRoute { + display: flex; + align-items: center; + + .verb { + font-size: 14px; + color: var(--white-500); + background-color: var(--primary-600); + border: 1px solid var(--primary-500); + font-family: var(--font-code); + text-transform: uppercase; + margin-right: 10px; + padding: 4px 8px; + padding-bottom: 1.5px; + border-radius: var(--radius-md); + } + + .url { + font-family: var(--font-code); + font-size: 16px; + } + + .delete { + background-color: var(--red-630); + border: 1px solid var(--red-500); + } + + .get { + background-color: var(--brand-700); + border: 1px solid var(--brand-530); + } + + .patch { + background-color: var(--yellow-530); + border: 1px solid var(--yellow-400); + } + + .post { + background-color: var(--green-500); + border: 1px solid var(--green-360); + } + + .put { + background-color: var(--orange-600); + border: 1px solid var(--orange-430); + } +} \ No newline at end of file diff --git a/discord/styles/snowflake.css b/discord/styles/snowflake.css new file mode 100644 index 0000000000..a8ab862c13 --- /dev/null +++ b/discord/styles/snowflake.css @@ -0,0 +1,52 @@ + +/* Light mode styles */ +html[style*="color-scheme: light"] .MDXSnowflake { + text { + fill: black; + } + + .arrow { + fill: oklab(0.251834 0.00131807 -0.008479); + } +} + +html[style*="color-scheme: dark"] .MDXSnowflake { + text { + fill: white; + } +} + +.MDXSnowflake { + display: flex; + justify-content: center; + margin-top: 40px; + margin-bottom: 40px; + + + .arrow { + fill: oklab(0.751834 0.00131807 -0.008479); + } + + .header { + font-weight: bold; + font-size: 16px; + + &.group1 { + fill: oklab(0.747617 0.00671133 -0.126112); + } + + &.group2 { + fill: oklab(0.773758 0.0289854 0.0857202); + } + + &.group3 { + fill: oklab(0.723746 0.150768 0.055049); + } + + &.group4 { + fill: oklab(0.700146 -0.0932133 -0.0629166); + } + } + + +} diff --git a/discord/styles/theme.css b/discord/styles/theme.css new file mode 100644 index 0000000000..6d5162063d --- /dev/null +++ b/discord/styles/theme.css @@ -0,0 +1,535 @@ +/* +Below are tweaks to Mintlify theme CSS. + */ + + /* +Mintlify's way of setting background color can +cause black flashes at bottom of page + */ +body { + background-color: #ffffff; + +} +body:is(.dark *) { + background-color: #36373e; +} + +/* Allow the content to stretch as wide as the page body */ +#content-container { + max-width: unset; +} + +/* Set page width of navigation items */ +.max-w-8xl, +/* Set page width of content */ +.peer.is-not-center~.peer-\[\.is-not-center\]\:max-w-8xl { + max-width: 110rem; +} + +/* +Make HRs thicker +*/ +hr { + border: none; + margin: 48px 0; + height: 1px; + background-color: #e6e6e7; +} + +hr:is(.dark *) { + background-color: #606169; +} +/* +.prose is the container for the main markdown content + */ +.prose,.prose-sm { + font-size: 1rem; + line-height: 1.5rem; + /* Turn all text white */ + p :is(.dark *) { + color: white; + } + + /* + Ensure code tags don't wrap when inline in text + */ + code { + white-space: pre; + overflow-x: auto; + overflow-y: hidden; + line-height: 1.1rem; + } + + code span { + font-size: 0.85rem; + line-height: 1rem; + } + + .code-block { + margin-top: 1.5rem; + margin-bottom: 1.5rem; + } + + /* .accordion { + border-radius: var(--radius-sm); + + summary { + border-radius: calc(var(--radius-sm) -1px) var(--radius-sm) 0 0; + } + } */ + + /* + Ensure lists have reasonable padding + */ + li { + margin: 0px; + } + /* + Make title bold + */ + h1, h2, h3, h4, h5, h6 { + font-weight: bold; + + /* Hide link icon for anchors on hover */ + .absolute { + display: none; + } + } + + /* + Make bold, strong tags bold + */ + b, strong { + font-weight: 800; + } + + [data-component-part=update-label] { + font-size: 1rem; + } + /* + Make changelog tags resemble tags + */ + [data-component-part=update-tag] { + opacity: 0.7; + padding: 0.1rem 0.3rem; + display: inline-block; + font-size: 0.8rem; + border: 1px solid #e6e6e7; + } + [data-component-part=update-tag]:is(.dark *) { + opacity: 0.5; + border-color: white; + } +} + +/* +This pushes all shades of gray to a full white, +which is more similar to legacy docs. + +However it may add some visual clutter. + */ +.text-gray-200:is(.light *), +.text-gray-400:is(.light *), +.text-gray-500:is(.light *), +.text-gray-600:is(.light *), +.text-gray-800:is(.light *) { + color: black; + --tw-text-opacity: 1; +} + +.dark\:text-gray-200:is(.dark *), +.dark\:text-gray-400:is(.dark *), +.dark\:text-gray-500:is(.dark *), +.dark\:text-gray-600:is(.dark *), +.dark\:text-gray-800:is(.dark *) { + color: white; +} + +/* +Remove eyebrow / breadcrumbs + */ +.eyebrow { + display: none; +} + +/* +Style left-hand navigation headers + */ +#sidebar-title { + font-family: "gg sans","Noto Sans","Helvetica Neue",Helvetica,Arial,sans-serif; + text-transform: uppercase; + font-size: 12px; + line-height: 1.3333333333333333; + font-weight: 600; +} + +/* +Indent left-hand navigation areas + */ +#sidebar-group { + margin-left: 1rem; + + li > a, [data-group-tag] > div, [data-group-tag] > button { + padding: 0.1rem; + padding-right: 0.5rem; + border-radius: var(--radius-sm); + } +} + +/* +Reduce spacing between left-hand categories + */ +#navigation-items > div:not(:first-of-type) { + margin-top: 1rem; +} + + +.dark\:text-primary-light:is(.dark *) { + color: rgba(255, 255, 255, 0.8); +} + +/* Inline code blocks */ +:not(pre)>code:is(.dark *) { + background-color: #232428; + color: white; +} + +/* +Darken table of contents (right hand) items + */ +.toc-item a { + opacity: 0.7; + border-width: 0px; +} + +/* +Lighten table of contents selected item + */ +.toc-item a.dark\:text-primary-light:is(.dark *) { + opacity: 1; + color: white; +} + +/* +Hide table of contents items below top depth in tree + */ +.toc-item:not([data-depth="0"]) { + text-decoration: underline; + display: none; +} + +/* +Tighten spacing between table of contents items + */ +.toc-item a { + padding: 0px; +} + +/* +Style anchor tags as blue without underline + */ +.prose a:is(.dark *):not(.card), .prose a:is(.dark *) code, .prose a:is(.dark *) strong{ + color: #7aaef3; + text-decoration: none; + border-bottom: 0px; +} + +/* +Fix code blocks inside links that break page width + */ +.prose a code { + white-space: pre-wrap; + word-break: break-all; + overflow-wrap: break-word; + max-width: 100%; +} + +/* +Fix MDXRoute components breaking page width on mobile + */ +@media (max-width: 768px) { + .MDXRoute { + flex-wrap: wrap; + gap: 0.5rem; + } + + .MDXRoute .url { + word-break: break-all; + overflow-wrap: break-word; + max-width: 100%; + flex: 1; + min-width: 0; + } +} + +/* +Fix inline code blocks breaking page width in prose content + */ +.prose code:not(pre code) { + word-break: break-all; + overflow-wrap: break-word; + white-space: pre-wrap; + max-width: 100%; +} + +.callout { + padding: 0.5rem 1rem; + border-radius: var(--radius-sm); +} + +.callout code { + white-space: pre-wrap; + word-break: break-word; + overflow-wrap: break-word; +} + +/* Expand tables horizontally */ +.prose table { + display: table; + /* Uncomment this and the th,td,tr below to wrap tables */ + table-layout: fixed; +} + +th, td, tr { + word-wrap: break-word; +} + +td { + overflow: hidden; +} + +td code { + white-space: pre-wrap; + word-break: break-word; + overflow-wrap: break-word; +} + +/* +Set table header styles + */ +table > thead > tr > th { + font-family: "gg sans","Noto Sans","Helvetica Neue",Helvetica,Arial,sans-serif; + text-transform: uppercase; + font-size: 12px; + line-height: 1.3333333333333333; + font-weight: 800 !important; + text-align: left; +} + +/* +Add padding to table cells + */ +.prose th, .prose td { + padding: 0.5rem; + padding-inline: 0.5rem; +} + +/* +Set default table row color + */ + +tr:is(.dark *) { + background-color: #323338; + border-bottom: 2px solid #161718; +} + +/* +Alternate table row colors with darker color + */ +tr:nth-child(even) { + background-color: #ebedef; +} +tr:nth-child(even):is(.dark *) { + background-color: #232428; +} + +.dark\:bg-zinc-500\/10:is(.dark *) { + background-color: #353c4b; + border-color: #05aafc; +} + +/* +Hide bottom of page pagination + */ +#pagination { + display: none; +} + +/* +On change log only, we remove some HR spacing +*/ +[data-page-title="Change Log"] { + hr { + padding: 0px; + margin: 0px; + } +} + +/* +Shrink and lighten accordian description + */ +[data-component-part=accordion-description] { + font-size: 0.8rem; + opacity: 0.7; +} + + +/* + Move content up to cover eyebrow / breadcrumb space, but only when wide (see media queries below) +*/ +#content-container > div:first-of-type { + padding-top: 8rem; +} + +/* +Very slightly shrink left hand nav +*/ +#sidebar { + width: 17rem; +} + +/* +Hide breadcrumbs when there is only one item +*/ +header > div > .flex-row > div { + display: none; +} + +@media (min-width: 1024px) { + /* Middle breakpoint */ + /* + Show breadcrumbs when the page is wide and there are multiple items + */ + header > div > .flex-row > div:not(:only-child) { + display: flex; + } + + /* Content mostly at top when not mobile */ + #content-container > div:first-of-type { + padding-top: 1.5rem; + } + + #content-container #content-side-layout { + padding-top: 0rem; + } + + /* Widen main content on left and right */ + #content-area:not(:has(div div.not-found-container)) { + margin-left: -5rem; + margin-right: 1rem; + } + /* + Hide TOC when only one category + */ + #sidebar:has(#navigation-items > ul:only-child) { + display: none; + + + #content-container:has([data-page-title="Change Log"]) { + margin-left: -17rem; + } + } +} + +@media (min-width: 1280px) { + /* Wide breakpoint */ + + /* Remove gap between main content and right TOC */ + .gap-12 { + gap: 0rem; + } + + /* + Move TOC up to cover eyebrow / breadcrumb space + */ + #table-of-contents { + padding-top: 1.5rem; + } +} + +/* Fix LEGACY tag in nav */ +.dark .nav-tag-pill { + background-color: black; +} + +.nav-tag-pill { + padding: 0.1rem 0.2rem; + border-radius: var(--radius-sm); +} + +.mdx-content { + margin-top: 1rem; +} + +/* Set sidebar icon color */ +[data-title="Developer Terms of Service"] svg, [data-title="Developer Policy"] svg { + display: none; +} +[data-title] > a > svg:first-child:is(.dark *) { + display: block; + background-color: white; +} + +/* Add some spacing to icons on cards and set a suble background color */ +[data-component-part=card-icon] { + width: 54px; + height: 54px; + padding: 15px; + margin-right: 0.5rem; + background-color: rgba(255, 255, 255, 0.05); + border-radius: var(--radius-sm); + align-self: start; + margin-top: 0.5rem; +} + +[data-component-part=card-icon]:is(.light *) { + background-color: rgba(0, 0, 0, 0.05); +} + +/* Light mode overrides */ +html[style*="color-scheme: light"] { + /* Style inline code blocks with light background */ + .prose code:not(pre code) { + background-color: #f0f1f5; + } + + + .prose :where(a):not(:where([class~=not-prose],[class~=not-prose] *)) { + border-bottom: none; + color: rgb(var(--primary)); + } +} + +.chat-assistant-floating-input, #assistant-bar-placeholder { + display: none; +} + +#banner { + a, a:visited { + color: white; + font-weight: bold; + } + + a:hover { + border-bottom: 1px solid white; + } +} + +/* Add top margin when banner is present - mobile only */ +@media (max-width: 1023px) { + body:has(#banner) #content-container { + margin-top: 64px; + } + + /* Override banner styling on mobile */ + #banner { + button { + position: relative; + top: unset; + right: unset; + display: flex; + --tw-translate-y: 0; + padding: 10px; + } + font-size: 0.9rem; + } +} \ No newline at end of file diff --git a/discord/styles/variables.css b/discord/styles/variables.css new file mode 100644 index 0000000000..993a228b4b --- /dev/null +++ b/discord/styles/variables.css @@ -0,0 +1,483 @@ +:root { + /* Border Radius */ + --radius-none: 0px; + --radius-xs: 4px; + --radius-sm: 8px; + --radius-md: 12px; + --radius-lg: 16px; + + /* Colors */ + --saturation-factor: 1; + --red-100: hsl(var(--red-100-hsl) / 1); + --red-100-hsl: 350 calc(var(--saturation-factor, 1) * 75%) 98.431%; + --red-130: hsl(var(--red-130-hsl) / 1); + --red-130-hsl: 0 calc(var(--saturation-factor, 1) * 83.333%) 97.647%; + --red-160: hsl(var(--red-160-hsl) / 1); + --red-160-hsl: 0 calc(var(--saturation-factor, 1) * 90.909%) 95.686%; + --red-200: hsl(var(--red-200-hsl) / 1); + --red-200-hsl: 358.125 calc(var(--saturation-factor, 1) * 88.889%) 92.941%; + --red-230: hsl(var(--red-230-hsl) / 1); + --red-230-hsl: 358.696 calc(var(--saturation-factor, 1) * 85.185%) 89.412%; + --red-260: hsl(var(--red-260-hsl) / 1); + --red-260-hsl: 359.077 calc(var(--saturation-factor, 1) * 89.041%) 85.686%; + --red-300: hsl(var(--red-300-hsl) / 1); + --red-300-hsl: 358.588 calc(var(--saturation-factor, 1) * 91.398%) 81.765%; + --red-330: hsl(var(--red-330-hsl) / 1); + --red-330-hsl: 358.857 calc(var(--saturation-factor, 1) * 91.304%) 77.451%; + --red-345: hsl(var(--red-345-hsl) / 1); + --red-345-hsl: 358.168 calc(var(--saturation-factor, 1) * 92.908%) 72.353%; + --red-360: hsl(var(--red-360-hsl) / 1); + --red-360-hsl: 358.471 calc(var(--saturation-factor, 1) * 91.813%) 66.471%; + --red-400: hsl(var(--red-400-hsl) / 1); + --red-400-hsl: 358.659 calc(var(--saturation-factor, 1) * 87.317%) 59.804%; + --red-430: hsl(var(--red-430-hsl) / 1); + --red-430-hsl: 358.16 calc(var(--saturation-factor, 1) * 68.776%) 53.529%; + --red-460: hsl(var(--red-460-hsl) / 1); + --red-460-hsl: 358.705 calc(var(--saturation-factor, 1) * 59.149%) 46.078%; + --red-500: hsl(var(--red-500-hsl) / 1); + --red-500-hsl: 359.504 calc(var(--saturation-factor, 1) * 60.199%) 39.412%; + --red-530: hsl(var(--red-530-hsl) / 1); + --red-530-hsl: 358.919 calc(var(--saturation-factor, 1) * 63.429%) 34.314%; + --red-560: hsl(var(--red-560-hsl) / 1); + --red-560-hsl: 358.788 calc(var(--saturation-factor, 1) * 63.871%) 30.392%; + --red-600: hsl(var(--red-600-hsl) / 1); + --red-600-hsl: 358.636 calc(var(--saturation-factor, 1) * 64.706%) 26.667%; + --red-630: hsl(var(--red-630-hsl) / 1); + --red-630-hsl: 358.5 calc(var(--saturation-factor, 1) * 65.574%) 23.922%; + --red-660: hsl(var(--red-660-hsl) / 1); + --red-660-hsl: 359.155 calc(var(--saturation-factor, 1) * 65.138%) 21.373%; + --red-700: hsl(var(--red-700-hsl) / 1); + --red-700-hsl: 358.125 calc(var(--saturation-factor, 1) * 66.667%) 18.824%; + --red-730: hsl(var(--red-730-hsl) / 1); + --red-730-hsl: 358.929 calc(var(--saturation-factor, 1) * 66.667%) 16.471%; + --red-760: hsl(var(--red-760-hsl) / 1); + --red-760-hsl: 358.846 calc(var(--saturation-factor, 1) * 70.27%) 14.51%; + --red-800: hsl(var(--red-800-hsl) / 1); + --red-800-hsl: 358.636 calc(var(--saturation-factor, 1) * 68.75%) 12.549%; + --red-830: hsl(var(--red-830-hsl) / 1); + --red-830-hsl: 358.378 calc(var(--saturation-factor, 1) * 67.273%) 10.784%; + --red-860: hsl(var(--red-860-hsl) / 1); + --red-860-hsl: 0 calc(var(--saturation-factor, 1) * 66.667%) 9.412%; + --red-900: hsl(var(--red-900-hsl) / 1); + --red-900-hsl: 0 calc(var(--saturation-factor, 1) * 70%) 7.843%; + --orange-100: hsl(var(--orange-100-hsl) / 1); + --orange-100-hsl: 18 calc(var(--saturation-factor, 1) * 100%) 98.039%; + --orange-130: hsl(var(--orange-130-hsl) / 1); + --orange-130-hsl: 23.333 calc(var(--saturation-factor, 1) * 100%) 96.471%; + --orange-160: hsl(var(--orange-160-hsl) / 1); + --orange-160-hsl: 21.29 calc(var(--saturation-factor, 1) * 93.939%) 93.529%; + --orange-200: hsl(var(--orange-200-hsl) / 1); + --orange-200-hsl: 21.25 calc(var(--saturation-factor, 1) * 92.308%) 89.804%; + --orange-230: hsl(var(--orange-230-hsl) / 1); + --orange-230-hsl: 23.514 calc(var(--saturation-factor, 1) * 92.5%) 84.314%; + --orange-260: hsl(var(--orange-260-hsl) / 1); + --orange-260-hsl: 23.301 calc(var(--saturation-factor, 1) * 94.495%) 78.627%; + --orange-300: hsl(var(--orange-300-hsl) / 1); + --orange-300-hsl: 25.468 calc(var(--saturation-factor, 1) * 94.558%) 71.176%; + --orange-330: hsl(var(--orange-330-hsl) / 1); + --orange-330-hsl: 27 calc(var(--saturation-factor, 1) * 94.737%) 62.745%; + --orange-345: hsl(var(--orange-345-hsl) / 1); + --orange-345-hsl: 28.342 calc(var(--saturation-factor, 1) * 87.665%) 55.49%; + --orange-360: hsl(var(--orange-360-hsl) / 1); + --orange-360-hsl: 26.145 calc(var(--saturation-factor, 1) * 71.315%) 50.784%; + --orange-400: hsl(var(--orange-400-hsl) / 1); + --orange-400-hsl: 25.443 calc(var(--saturation-factor, 1) * 67.521%) 45.882%; + --orange-430: hsl(var(--orange-430-hsl) / 1); + --orange-430-hsl: 24.681 calc(var(--saturation-factor, 1) * 69.458%) 39.804%; + --orange-460: hsl(var(--orange-460-hsl) / 1); + --orange-460-hsl: 23.538 calc(var(--saturation-factor, 1) * 72.222%) 35.294%; + --orange-500: hsl(var(--orange-500-hsl) / 1); + --orange-500-hsl: 22.314 calc(var(--saturation-factor, 1) * 76.101%) 31.176%; + --orange-530: hsl(var(--orange-530-hsl) / 1); + --orange-530-hsl: 21.869 calc(var(--saturation-factor, 1) * 76.978%) 27.255%; + --orange-560: hsl(var(--orange-560-hsl) / 1); + --orange-560-hsl: 21.474 calc(var(--saturation-factor, 1) * 77.236%) 24.118%; + --orange-600: hsl(var(--orange-600-hsl) / 1); + --orange-600-hsl: 22.857 calc(var(--saturation-factor, 1) * 79.245%) 20.784%; + --orange-630: hsl(var(--orange-630-hsl) / 1); + --orange-630-hsl: 22.105 calc(var(--saturation-factor, 1) * 79.167%) 18.824%; + --orange-660: hsl(var(--orange-660-hsl) / 1); + --orange-660-hsl: 22.388 calc(var(--saturation-factor, 1) * 78.824%) 16.667%; + --orange-700: hsl(var(--orange-700-hsl) / 1); + --orange-700-hsl: 21.724 calc(var(--saturation-factor, 1) * 76.316%) 14.902%; + --orange-730: hsl(var(--orange-730-hsl) / 1); + --orange-730-hsl: 21.923 calc(var(--saturation-factor, 1) * 78.788%) 12.941%; + --orange-760: hsl(var(--orange-760-hsl) / 1); + --orange-760-hsl: 21.333 calc(var(--saturation-factor, 1) * 78.947%) 11.176%; + --orange-800: hsl(var(--orange-800-hsl) / 1); + --orange-800-hsl: 21 calc(var(--saturation-factor, 1) * 80%) 9.804%; + --orange-830: hsl(var(--orange-830-hsl) / 1); + --orange-830-hsl: 20 calc(var(--saturation-factor, 1) * 76.744%) 8.431%; + --orange-860: hsl(var(--orange-860-hsl) / 1); + --orange-860-hsl: 20 calc(var(--saturation-factor, 1) * 72.973%) 7.255%; + --orange-900: hsl(var(--orange-900-hsl) / 1); + --orange-900-hsl: 25.714 calc(var(--saturation-factor, 1) * 72.414%) 5.686%; + --yellow-100: hsl(var(--yellow-100-hsl) / 1); + --yellow-100-hsl: 33.75 calc(var(--saturation-factor, 1) * 100%) 96.863%; + --yellow-130: hsl(var(--yellow-130-hsl) / 1); + --yellow-130-hsl: 31.304 calc(var(--saturation-factor, 1) * 100%) 95.49%; + --yellow-160: hsl(var(--yellow-160-hsl) / 1); + --yellow-160-hsl: 32.727 calc(var(--saturation-factor, 1) * 100%) 91.373%; + --yellow-200: hsl(var(--yellow-200-hsl) / 1); + --yellow-200-hsl: 35 calc(var(--saturation-factor, 1) * 97.297%) 85.49%; + --yellow-230: hsl(var(--yellow-230-hsl) / 1); + --yellow-230-hsl: 36.637 calc(var(--saturation-factor, 1) * 96.581%) 77.059%; + --yellow-260: hsl(var(--yellow-260-hsl) / 1); + --yellow-260-hsl: 40.656 calc(var(--saturation-factor, 1) * 96.825%) 62.941%; + --yellow-300: hsl(var(--yellow-300-hsl) / 1); + --yellow-300-hsl: 40.421 calc(var(--saturation-factor, 1) * 86.364%) 56.863%; + --yellow-330: hsl(var(--yellow-330-hsl) / 1); + --yellow-330-hsl: 40 calc(var(--saturation-factor, 1) * 75.309%) 52.353%; + --yellow-345: hsl(var(--yellow-345-hsl) / 1); + --yellow-345-hsl: 39.545 calc(var(--saturation-factor, 1) * 70.968%) 48.627%; + --yellow-360: hsl(var(--yellow-360-hsl) / 1); + --yellow-360-hsl: 39.018 calc(var(--saturation-factor, 1) * 74.429%) 42.941%; + --yellow-400: hsl(var(--yellow-400-hsl) / 1); + --yellow-400-hsl: 37.792 calc(var(--saturation-factor, 1) * 78.571%) 38.431%; + --yellow-430: hsl(var(--yellow-430-hsl) / 1); + --yellow-430-hsl: 37.447 calc(var(--saturation-factor, 1) * 84.431%) 32.745%; + --yellow-460: hsl(var(--yellow-460-hsl) / 1); + --yellow-460-hsl: 36.279 calc(var(--saturation-factor, 1) * 87.755%) 28.824%; + --yellow-500: hsl(var(--yellow-500-hsl) / 1); + --yellow-500-hsl: 35.5 calc(var(--saturation-factor, 1) * 93.75%) 25.098%; + --yellow-530: hsl(var(--yellow-530-hsl) / 1); + --yellow-530-hsl: 34.857 calc(var(--saturation-factor, 1) * 92.92%) 22.157%; + --yellow-560: hsl(var(--yellow-560-hsl) / 1); + --yellow-560-hsl: 33.83 calc(var(--saturation-factor, 1) * 94%) 19.608%; + --yellow-600: hsl(var(--yellow-600-hsl) / 1); + --yellow-600-hsl: 34.815 calc(var(--saturation-factor, 1) * 93.103%) 17.059%; + --yellow-630: hsl(var(--yellow-630-hsl) / 1); + --yellow-630-hsl: 34.521 calc(var(--saturation-factor, 1) * 92.405%) 15.49%; + --yellow-660: hsl(var(--yellow-660-hsl) / 1); + --yellow-660-hsl: 34.688 calc(var(--saturation-factor, 1) * 91.429%) 13.725%; + --yellow-700: hsl(var(--yellow-700-hsl) / 1); + --yellow-700-hsl: 34.286 calc(var(--saturation-factor, 1) * 90.323%) 12.157%; + --yellow-730: hsl(var(--yellow-730-hsl) / 1); + --yellow-730-hsl: 32.941 calc(var(--saturation-factor, 1) * 92.727%) 10.784%; + --yellow-760: hsl(var(--yellow-760-hsl) / 1); + --yellow-760-hsl: 32.727 calc(var(--saturation-factor, 1) * 91.667%) 9.412%; + --yellow-800: hsl(var(--yellow-800-hsl) / 1); + --yellow-800-hsl: 32.432 calc(var(--saturation-factor, 1) * 90.244%) 8.039%; + --yellow-830: hsl(var(--yellow-830-hsl) / 1); + --yellow-830-hsl: 31.875 calc(var(--saturation-factor, 1) * 88.889%) 7.059%; + --yellow-860: hsl(var(--yellow-860-hsl) / 1); + --yellow-860-hsl: 32.308 calc(var(--saturation-factor, 1) * 86.667%) 5.882%; + --yellow-900: hsl(var(--yellow-900-hsl) / 1); + --yellow-900-hsl: 36 calc(var(--saturation-factor, 1) * 83.333%) 4.706%; + --green-100: hsl(var(--green-100-hsl) / 1); + --green-100-hsl: 136.667 calc(var(--saturation-factor, 1) * 90%) 96.078%; + --green-130: hsl(var(--green-130-hsl) / 1); + --green-130-hsl: 136.875 calc(var(--saturation-factor, 1) * 94.118%) 93.333%; + --green-160: hsl(var(--green-160-hsl) / 1); + --green-160-hsl: 140.952 calc(var(--saturation-factor, 1) * 91.304%) 86.471%; + --green-200: hsl(var(--green-200-hsl) / 1); + --green-200-hsl: 143.478 calc(var(--saturation-factor, 1) * 93.496%) 75.882%; + --green-230: hsl(var(--green-230-hsl) / 1); + --green-230-hsl: 146.323 calc(var(--saturation-factor, 1) * 86.592%) 64.902%; + --green-260: hsl(var(--green-260-hsl) / 1); + --green-260-hsl: 145.605 calc(var(--saturation-factor, 1) * 75.12%) 59.02%; + --green-300: hsl(var(--green-300-hsl) / 1); + --green-300-hsl: 146.323 calc(var(--saturation-factor, 1) * 65.401%) 53.529%; + --green-330: hsl(var(--green-330-hsl) / 1); + --green-330-hsl: 146.494 calc(var(--saturation-factor, 1) * 63.115%) 47.843%; + --green-345: hsl(var(--green-345-hsl) / 1); + --green-345-hsl: 146.939 calc(var(--saturation-factor, 1) * 65.919%) 43.725%; + --green-360: hsl(var(--green-360-hsl) / 1); + --green-360-hsl: 145.385 calc(var(--saturation-factor, 1) * 65%) 39.216%; + --green-400: hsl(var(--green-400-hsl) / 1); + --green-400-hsl: 142.703 calc(var(--saturation-factor, 1) * 60.656%) 35.882%; + --green-430: hsl(var(--green-430-hsl) / 1); + --green-430-hsl: 141.522 calc(var(--saturation-factor, 1) * 56.098%) 32.157%; + --green-460: hsl(var(--green-460-hsl) / 1); + --green-460-hsl: 141.481 calc(var(--saturation-factor, 1) * 56.643%) 28.039%; + --green-500: hsl(var(--green-500-hsl) / 1); + --green-500-hsl: 141.37 calc(var(--saturation-factor, 1) * 58.4%) 24.51%; + --green-530: hsl(var(--green-530-hsl) / 1); + --green-530-hsl: 140.308 calc(var(--saturation-factor, 1) * 60.748%) 20.98%; + --green-560: hsl(var(--green-560-hsl) / 1); + --green-560-hsl: 138.621 calc(var(--saturation-factor, 1) * 61.702%) 18.431%; + --green-600: hsl(var(--green-600-hsl) / 1); + --green-600-hsl: 139.245 calc(var(--saturation-factor, 1) * 65.432%) 15.882%; + --green-630: hsl(var(--green-630-hsl) / 1); + --green-630-hsl: 140 calc(var(--saturation-factor, 1) * 66.667%) 14.118%; + --green-660: hsl(var(--green-660-hsl) / 1); + --green-660-hsl: 139.091 calc(var(--saturation-factor, 1) * 68.75%) 12.549%; + --green-700: hsl(var(--green-700-hsl) / 1); + --green-700-hsl: 141 calc(var(--saturation-factor, 1) * 74.074%) 10.588%; + --green-730: hsl(var(--green-730-hsl) / 1); + --green-730-hsl: 138.333 calc(var(--saturation-factor, 1) * 78.261%) 9.02%; + --green-760: hsl(var(--green-760-hsl) / 1); + --green-760-hsl: 140 calc(var(--saturation-factor, 1) * 84.615%) 7.647%; + --green-800: hsl(var(--green-800-hsl) / 1); + --green-800-hsl: 139.286 calc(var(--saturation-factor, 1) * 82.353%) 6.667%; + --green-830: hsl(var(--green-830-hsl) / 1); + --green-830-hsl: 137.5 calc(var(--saturation-factor, 1) * 80%) 5.882%; + --green-860: hsl(var(--green-860-hsl) / 1); + --green-860-hsl: 132.632 calc(var(--saturation-factor, 1) * 70.37%) 5.294%; + --green-900: hsl(var(--green-900-hsl) / 1); + --green-900-hsl: 128.571 calc(var(--saturation-factor, 1) * 58.333%) 4.706%; + --blue-100: hsl(var(--blue-100-hsl) / 1); + --blue-100-hsl: 210 calc(var(--saturation-factor, 1) * 80%) 98.039%; + --blue-130: hsl(var(--blue-130-hsl) / 1); + --blue-130-hsl: 210 calc(var(--saturation-factor, 1) * 87.5%) 96.863%; + --blue-160: hsl(var(--blue-160-hsl) / 1); + --blue-160-hsl: 208.889 calc(var(--saturation-factor, 1) * 87.097%) 93.922%; + --blue-200: hsl(var(--blue-200-hsl) / 1); + --blue-200-hsl: 206.25 calc(var(--saturation-factor, 1) * 92.308%) 89.804%; + --blue-230: hsl(var(--blue-230-hsl) / 1); + --blue-230-hsl: 205.135 calc(var(--saturation-factor, 1) * 92.5%) 84.314%; + --blue-260: hsl(var(--blue-260-hsl) / 1); + --blue-260-hsl: 204.231 calc(var(--saturation-factor, 1) * 94.545%) 78.431%; + --blue-300: hsl(var(--blue-300-hsl) / 1); + --blue-300-hsl: 202.649 calc(var(--saturation-factor, 1) * 97.419%) 69.608%; + --blue-330: hsl(var(--blue-330-hsl) / 1); + --blue-330-hsl: 200.957 calc(var(--saturation-factor, 1) * 100%) 59.02%; + --blue-345: hsl(var(--blue-345-hsl) / 1); + --blue-345-hsl: 199.524 calc(var(--saturation-factor, 1) * 100%) 49.412%; + --blue-360: hsl(var(--blue-360-hsl) / 1); + --blue-360-hsl: 202.562 calc(var(--saturation-factor, 1) * 100%) 47.451%; + --blue-400: hsl(var(--blue-400-hsl) / 1); + --blue-400-hsl: 206.809 calc(var(--saturation-factor, 1) * 100%) 46.078%; + --blue-430: hsl(var(--blue-430-hsl) / 1); + --blue-430-hsl: 212.208 calc(var(--saturation-factor, 1) * 100%) 45.294%; + --blue-460: hsl(var(--blue-460-hsl) / 1); + --blue-460-hsl: 213.589 calc(var(--saturation-factor, 1) * 100%) 40.98%; + --blue-500: hsl(var(--blue-500-hsl) / 1); + --blue-500-hsl: 213.297 calc(var(--saturation-factor, 1) * 100%) 35.686%; + --blue-530: hsl(var(--blue-530-hsl) / 1); + --blue-530-hsl: 212.129 calc(var(--saturation-factor, 1) * 100%) 30.392%; + --blue-560: hsl(var(--blue-560-hsl) / 1); + --blue-560-hsl: 211.765 calc(var(--saturation-factor, 1) * 100%) 26.667%; + --blue-600: hsl(var(--blue-600-hsl) / 1); + --blue-600-hsl: 211.017 calc(var(--saturation-factor, 1) * 100%) 23.137%; + --blue-630: hsl(var(--blue-630-hsl) / 1); + --blue-630-hsl: 211.132 calc(var(--saturation-factor, 1) * 100%) 20.784%; + --blue-660: hsl(var(--blue-660-hsl) / 1); + --blue-660-hsl: 211.579 calc(var(--saturation-factor, 1) * 100%) 18.627%; + --blue-700: hsl(var(--blue-700-hsl) / 1); + --blue-700-hsl: 211.765 calc(var(--saturation-factor, 1) * 100%) 16.667%; + --blue-730: hsl(var(--blue-730-hsl) / 1); + --blue-730-hsl: 210.833 calc(var(--saturation-factor, 1) * 100%) 14.118%; + --blue-760: hsl(var(--blue-760-hsl) / 1); + --blue-760-hsl: 211.429 calc(var(--saturation-factor, 1) * 100%) 12.353%; + --blue-800: hsl(var(--blue-800-hsl) / 1); + --blue-800-hsl: 211.111 calc(var(--saturation-factor, 1) * 100%) 10.588%; + --blue-830: hsl(var(--blue-830-hsl) / 1); + --blue-830-hsl: 212.5 calc(var(--saturation-factor, 1) * 100%) 9.412%; + --blue-860: hsl(var(--blue-860-hsl) / 1); + --blue-860-hsl: 213.488 calc(var(--saturation-factor, 1) * 100%) 8.431%; + --blue-900: hsl(var(--blue-900-hsl) / 1); + --blue-900-hsl: 213.333 calc(var(--saturation-factor, 1) * 100%) 7.059%; + --teal-100: hsl(var(--teal-100-hsl) / 1); + --teal-100-hsl: 193.333 calc(var(--saturation-factor, 1) * 69.231%) 97.451%; + --teal-130: hsl(var(--teal-130-hsl) / 1); + --teal-130-hsl: 192 calc(var(--saturation-factor, 1) * 83.333%) 95.294%; + --teal-160: hsl(var(--teal-160-hsl) / 1); + --teal-160-hsl: 190.5 calc(var(--saturation-factor, 1) * 83.333%) 90.588%; + --teal-200: hsl(var(--teal-200-hsl) / 1); + --teal-200-hsl: 188.333 calc(var(--saturation-factor, 1) * 85.714%) 83.529%; + --teal-230: hsl(var(--teal-230-hsl) / 1); + --teal-230-hsl: 187.934 calc(var(--saturation-factor, 1) * 88.321%) 73.137%; + --teal-260: hsl(var(--teal-260-hsl) / 1); + --teal-260-hsl: 188.276 calc(var(--saturation-factor, 1) * 81.921%) 65.294%; + --teal-300: hsl(var(--teal-300-hsl) / 1); + --teal-300-hsl: 188.903 calc(var(--saturation-factor, 1) * 72.77%) 58.235%; + --teal-330: hsl(var(--teal-330-hsl) / 1); + --teal-330-hsl: 189.375 calc(var(--saturation-factor, 1) * 65.574%) 52.157%; + --teal-345: hsl(var(--teal-345-hsl) / 1); + --teal-345-hsl: 189.677 calc(var(--saturation-factor, 1) * 62.753%) 48.431%; + --teal-360: hsl(var(--teal-360-hsl) / 1); + --teal-360-hsl: 189.718 calc(var(--saturation-factor, 1) * 63.964%) 43.529%; + --teal-400: hsl(var(--teal-400-hsl) / 1); + --teal-400-hsl: 189.6 calc(var(--saturation-factor, 1) * 63.452%) 38.627%; + --teal-430: hsl(var(--teal-430-hsl) / 1); + --teal-430-hsl: 190.459 calc(var(--saturation-factor, 1) * 63.006%) 33.922%; + --teal-460: hsl(var(--teal-460-hsl) / 1); + --teal-460-hsl: 190.515 calc(var(--saturation-factor, 1) * 64.238%) 29.608%; + --teal-500: hsl(var(--teal-500-hsl) / 1); + --teal-500-hsl: 190.465 calc(var(--saturation-factor, 1) * 65.152%) 25.882%; + --teal-530: hsl(var(--teal-530-hsl) / 1); + --teal-530-hsl: 190.263 calc(var(--saturation-factor, 1) * 66.667%) 22.353%; + --teal-560: hsl(var(--teal-560-hsl) / 1); + --teal-560-hsl: 189.565 calc(var(--saturation-factor, 1) * 69.697%) 19.412%; + --teal-600: hsl(var(--teal-600-hsl) / 1); + --teal-600-hsl: 188.852 calc(var(--saturation-factor, 1) * 71.765%) 16.667%; + --teal-630: hsl(var(--teal-630-hsl) / 1); + --teal-630-hsl: 189.643 calc(var(--saturation-factor, 1) * 73.684%) 14.902%; + --teal-660: hsl(var(--teal-660-hsl) / 1); + --teal-660-hsl: 188.4 calc(var(--saturation-factor, 1) * 75.758%) 12.941%; + --teal-700: hsl(var(--teal-700-hsl) / 1); + --teal-700-hsl: 189.13 calc(var(--saturation-factor, 1) * 79.31%) 11.373%; + --teal-730: hsl(var(--teal-730-hsl) / 1); + --teal-730-hsl: 189 calc(var(--saturation-factor, 1) * 80%) 9.804%; + --teal-760: hsl(var(--teal-760-hsl) / 1); + --teal-760-hsl: 188.571 calc(var(--saturation-factor, 1) * 81.395%) 8.431%; + --teal-800: hsl(var(--teal-800-hsl) / 1); + --teal-800-hsl: 188 calc(var(--saturation-factor, 1) * 83.333%) 7.059%; + --teal-830: hsl(var(--teal-830-hsl) / 1); + --teal-830-hsl: 188.889 calc(var(--saturation-factor, 1) * 87.097%) 6.078%; + --teal-860: hsl(var(--teal-860-hsl) / 1); + --teal-860-hsl: 187.826 calc(var(--saturation-factor, 1) * 85.185%) 5.294%; + --teal-900: hsl(var(--teal-900-hsl) / 1); + --teal-900-hsl: 189 calc(var(--saturation-factor, 1) * 90.909%) 4.314%; + --white: hsl(var(--white-hsl) / 1); + --white-hsl: 0 calc(var(--saturation-factor, 1) * 0%) 100%; + --white-100: hsl(var(--white-100-hsl) / 1); + --white-100-hsl: 0 calc(var(--saturation-factor, 1) * 0%) 100%; + --white-130: hsl(var(--white-130-hsl) / 1); + --white-130-hsl: 0 calc(var(--saturation-factor, 1) * 0%) 100%; + --white-160: hsl(var(--white-160-hsl) / 1); + --white-160-hsl: 0 calc(var(--saturation-factor, 1) * 0%) 100%; + --white-200: hsl(var(--white-200-hsl) / 1); + --white-200-hsl: 0 calc(var(--saturation-factor, 1) * 0%) 100%; + --white-230: hsl(var(--white-230-hsl) / 1); + --white-230-hsl: 0 calc(var(--saturation-factor, 1) * 0%) 100%; + --white-260: hsl(var(--white-260-hsl) / 1); + --white-260-hsl: 0 calc(var(--saturation-factor, 1) * 0%) 100%; + --white-300: hsl(var(--white-300-hsl) / 1); + --white-300-hsl: 0 calc(var(--saturation-factor, 1) * 0%) 100%; + --white-330: hsl(var(--white-330-hsl) / 1); + --white-330-hsl: 0 calc(var(--saturation-factor, 1) * 0%) 100%; + --white-345: hsl(var(--white-345-hsl) / 1); + --white-345-hsl: 0 calc(var(--saturation-factor, 1) * 0%) 100%; + --white-360: hsl(var(--white-360-hsl) / 1); + --white-360-hsl: 0 calc(var(--saturation-factor, 1) * 0%) 100%; + --white-400: hsl(var(--white-400-hsl) / 1); + --white-400-hsl: 0 calc(var(--saturation-factor, 1) * 0%) 100%; + --white-430: hsl(var(--white-430-hsl) / 1); + --white-430-hsl: 0 calc(var(--saturation-factor, 1) * 0%) 100%; + --white-460: hsl(var(--white-460-hsl) / 1); + --white-460-hsl: 0 calc(var(--saturation-factor, 1) * 0%) 100%; + --white-500: hsl(var(--white-500-hsl) / 1); + --white-500-hsl: 0 calc(var(--saturation-factor, 1) * 0%) 100%; + --white-530: hsl(var(--white-530-hsl) / 1); + --white-530-hsl: 0 calc(var(--saturation-factor, 1) * 0%) 90.98%; + --white-560: hsl(var(--white-560-hsl) / 1); + --white-560-hsl: 0 calc(var(--saturation-factor, 1) * 0%) 81.176%; + --white-600: hsl(var(--white-600-hsl) / 1); + --white-600-hsl: 0 calc(var(--saturation-factor, 1) * 0%) 67.843%; + --white-630: hsl(var(--white-630-hsl) / 1); + --white-630-hsl: 0 calc(var(--saturation-factor, 1) * 0%) 58.824%; + --white-660: hsl(var(--white-660-hsl) / 1); + --white-660-hsl: 0 calc(var(--saturation-factor, 1) * 0%) 51.373%; + --white-700: hsl(var(--white-700-hsl) / 1); + --white-700-hsl: 0 calc(var(--saturation-factor, 1) * 0%) 40%; + --white-730: hsl(var(--white-730-hsl) / 1); + --white-730-hsl: 0 calc(var(--saturation-factor, 1) * 0%) 37.255%; + --white-760: hsl(var(--white-760-hsl) / 1); + --white-760-hsl: 0 calc(var(--saturation-factor, 1) * 0%) 34.51%; + --white-800: hsl(var(--white-800-hsl) / 1); + --white-800-hsl: 0 calc(var(--saturation-factor, 1) * 0%) 30.196%; + --white-830: hsl(var(--white-830-hsl) / 1); + --white-830-hsl: 0 calc(var(--saturation-factor, 1) * 0%) 23.137%; + --white-860: hsl(var(--white-860-hsl) / 1); + --white-860-hsl: 0 calc(var(--saturation-factor, 1) * 0%) 14.902%; + --white-900: hsl(var(--white-900-hsl) / 1); + --white-900-hsl: 0 calc(var(--saturation-factor, 1) * 0%) 5.098%; + --black: hsl(var(--black-hsl) / 1); + --black-hsl: 0 calc(var(--saturation-factor, 1) * 0%) 0%; + --black-100: hsl(var(--black-100-hsl) / 1); + --black-100-hsl: 0 calc(var(--saturation-factor, 1) * 0%) 94.902%; + --black-130: hsl(var(--black-130-hsl) / 1); + --black-130-hsl: 0 calc(var(--saturation-factor, 1) * 0%) 90.98%; + --black-160: hsl(var(--black-160-hsl) / 1); + --black-160-hsl: 0 calc(var(--saturation-factor, 1) * 0%) 85.49%; + --black-200: hsl(var(--black-200-hsl) / 1); + --black-200-hsl: 0 calc(var(--saturation-factor, 1) * 0%) 80%; + --black-230: hsl(var(--black-230-hsl) / 1); + --black-230-hsl: 0 calc(var(--saturation-factor, 1) * 0%) 74.118%; + --black-260: hsl(var(--black-260-hsl) / 1); + --black-260-hsl: 0 calc(var(--saturation-factor, 1) * 0%) 67.451%; + --black-300: hsl(var(--black-300-hsl) / 1); + --black-300-hsl: 0 calc(var(--saturation-factor, 1) * 0%) 60%; + --black-330: hsl(var(--black-330-hsl) / 1); + --black-330-hsl: 0 calc(var(--saturation-factor, 1) * 0%) 47.843%; + --black-345: hsl(var(--black-345-hsl) / 1); + --black-345-hsl: 0 calc(var(--saturation-factor, 1) * 0%) 40%; + --black-360: hsl(var(--black-360-hsl) / 1); + --black-360-hsl: 0 calc(var(--saturation-factor, 1) * 0%) 36.078%; + --black-400: hsl(var(--black-400-hsl) / 1); + --black-400-hsl: 0 calc(var(--saturation-factor, 1) * 0%) 20%; + --black-430: hsl(var(--black-430-hsl) / 1); + --black-430-hsl: 0 calc(var(--saturation-factor, 1) * 0%) 14.51%; + --black-460: hsl(var(--black-460-hsl) / 1); + --black-460-hsl: 0 calc(var(--saturation-factor, 1) * 0%) 7.843%; + --black-500: hsl(var(--black-500-hsl) / 1); + --black-500-hsl: 0 calc(var(--saturation-factor, 1) * 0%) 0%; + --black-530: hsl(var(--black-530-hsl) / 1); + --black-530-hsl: 0 calc(var(--saturation-factor, 1) * 0%) 0%; + --black-560: hsl(var(--black-560-hsl) / 1); + --black-560-hsl: 0 calc(var(--saturation-factor, 1) * 0%) 0%; + --black-600: hsl(var(--black-600-hsl) / 1); + --black-600-hsl: 0 calc(var(--saturation-factor, 1) * 0%) 0%; + --black-630: hsl(var(--black-630-hsl) / 1); + --black-630-hsl: 0 calc(var(--saturation-factor, 1) * 0%) 0%; + --black-660: hsl(var(--black-660-hsl) / 1); + --black-660-hsl: 0 calc(var(--saturation-factor, 1) * 0%) 0%; + --black-700: hsl(var(--black-700-hsl) / 1); + --black-700-hsl: 0 calc(var(--saturation-factor, 1) * 0%) 0%; + --black-730: hsl(var(--black-730-hsl) / 1); + --black-730-hsl: 0 calc(var(--saturation-factor, 1) * 0%) 0%; + --black-760: hsl(var(--black-760-hsl) / 1); + --black-760-hsl: 0 calc(var(--saturation-factor, 1) * 0%) 0%; + --black-800: hsl(var(--black-800-hsl) / 1); + --black-800-hsl: 0 calc(var(--saturation-factor, 1) * 0%) 0%; + --black-830: hsl(var(--black-830-hsl) / 1); + --black-830-hsl: 0 calc(var(--saturation-factor, 1) * 0%) 0%; + --black-860: hsl(var(--black-860-hsl) / 1); + --black-860-hsl: 0 calc(var(--saturation-factor, 1) * 0%) 0%; + --black-900: hsl(var(--black-900-hsl) / 1); + --black-900-hsl: 0 calc(var(--saturation-factor, 1) * 0%) 0%; + --brand-100: hsl(var(--brand-100-hsl) / 1); + --brand-100-hsl: 240 calc(var(--saturation-factor, 1) * 77.778%) 98.235%; + --brand-130: hsl(var(--brand-130-hsl) / 1); + --brand-130-hsl: 235.714 calc(var(--saturation-factor, 1) * 87.5%) 96.863%; + --brand-160: hsl(var(--brand-160-hsl) / 1); + --brand-160-hsl: 234.545 calc(var(--saturation-factor, 1) * 84.615%) 94.902%; + --brand-200: hsl(var(--brand-200-hsl) / 1); + --brand-200-hsl: 236 calc(var(--saturation-factor, 1) * 83.333%) 92.941%; + --brand-230: hsl(var(--brand-230-hsl) / 1); + --brand-230-hsl: 235.5 calc(var(--saturation-factor, 1) * 86.957%) 90.98%; + --brand-260: hsl(var(--brand-260-hsl) / 1); + --brand-260-hsl: 235.2 calc(var(--saturation-factor, 1) * 86.207%) 88.627%; + --brand-300: hsl(var(--brand-300-hsl) / 1); + --brand-300-hsl: 235.161 calc(var(--saturation-factor, 1) * 86.111%) 85.882%; + --brand-330: hsl(var(--brand-330-hsl) / 1); + --brand-330-hsl: 234.75 calc(var(--saturation-factor, 1) * 85.106%) 81.569%; + --brand-345: hsl(var(--brand-345-hsl) / 1); + --brand-345-hsl: 234.783 calc(var(--saturation-factor, 1) * 85.185%) 78.824%; + --brand-360: hsl(var(--brand-360-hsl) / 1); + --brand-360-hsl: 235.152 calc(var(--saturation-factor, 1) * 86.087%) 77.451%; + --brand-400: hsl(var(--brand-400-hsl) / 1); + --brand-400-hsl: 234.677 calc(var(--saturation-factor, 1) * 86.111%) 71.765%; + --brand-430: hsl(var(--brand-430-hsl) / 1); + --brand-430-hsl: 235 calc(var(--saturation-factor, 1) * 85.714%) 69.804%; + --brand-460: hsl(var(--brand-460-hsl) / 1); + --brand-460-hsl: 234.93 calc(var(--saturation-factor, 1) * 85.542%) 67.451%; + --brand-500: hsl(var(--brand-500-hsl) / 1); + --brand-500-hsl: 234.935 calc(var(--saturation-factor, 1) * 85.556%) 64.706%; + --brand-530: hsl(var(--brand-530-hsl) / 1); + --brand-530-hsl: 234.857 calc(var(--saturation-factor, 1) * 66.667%) 58.824%; + --brand-560: hsl(var(--brand-560-hsl) / 1); + --brand-560-hsl: 234.72 calc(var(--saturation-factor, 1) * 51.44%) 52.353%; + --brand-600: hsl(var(--brand-600-hsl) / 1); + --brand-600-hsl: 234.857 calc(var(--saturation-factor, 1) * 46.667%) 44.118%; + --brand-630: hsl(var(--brand-630-hsl) / 1); + --brand-630-hsl: 235.385 calc(var(--saturation-factor, 1) * 46.667%) 38.235%; + --brand-660: hsl(var(--brand-660-hsl) / 1); + --brand-660-hsl: 234.75 calc(var(--saturation-factor, 1) * 47.059%) 33.333%; + --brand-700: hsl(var(--brand-700-hsl) / 1); + --brand-700-hsl: 235.161 calc(var(--saturation-factor, 1) * 46.97%) 25.882%; + --brand-730: hsl(var(--brand-730-hsl) / 1); + --brand-730-hsl: 234.828 calc(var(--saturation-factor, 1) * 46.774%) 24.314%; + --brand-760: hsl(var(--brand-760-hsl) / 1); + --brand-760-hsl: 234.34 calc(var(--saturation-factor, 1) * 46.903%) 22.157%; + --brand-800: hsl(var(--brand-800-hsl) / 1); + --brand-800-hsl: 234.894 calc(var(--saturation-factor, 1) * 47.475%) 19.412%; + --brand-830: hsl(var(--brand-830-hsl) / 1); + --brand-830-hsl: 235 calc(var(--saturation-factor, 1) * 47.368%) 14.902%; + --brand-860: hsl(var(--brand-860-hsl) / 1); + --brand-860-hsl: 234.783 calc(var(--saturation-factor, 1) * 46.939%) 9.608%; + --brand-900: hsl(var(--brand-900-hsl) / 1); + --brand-900-hsl: 232.5 calc(var(--saturation-factor, 1) * 50%) 3.137%; +} \ No newline at end of file diff --git a/discord/vale/config/vocabularies/Discord/accept.txt b/discord/vale/config/vocabularies/Discord/accept.txt new file mode 100644 index 0000000000..62fee0dd27 --- /dev/null +++ b/discord/vale/config/vocabularies/Discord/accept.txt @@ -0,0 +1,288 @@ +_asset +_banner +_event +_id +ACKs +afk +anonymized +API's +api +applicationId +application_id +app_id +Arctis +Astley +audioinput +authed +Autoincrementing +authentication +backoff +badging +bigint +bitfield +bitfields +bitmask +bitrate +Bitrate +bitwise +Bitwise +Blurple +boolean +booleans +bot's +breakpoint +bytearray +bynweekday +byweekday +clientId +cloudflared +cmd +comms +composable +cooldown +Ciphertext +ciphertext +crosspost +Crosspost +crossposted +cron +crypto +CSRCs +CTAs +Currated +currentSize +custom_id +cya +datapoint +datapoints +deadbeef +deallocated +Deeplink +deduplicated +Deletable +deserialize +devs +Devs +dialogs +deauthorized +deduped +discordSdk +discrim +DLLs +DMs +dms +DMing +dnd +downsample +dropoff +endian +Enums +enums +entity_type +embed's +evt +expirations +extensibly +falsy +Figma +Fitbit +Fraggers +framerate +FString +gameplay +gank +GDMs +gif +GIFs +gifs +gifv +globbing +guild_id +hardcode +Heartbeating +heya +heyo +hoges +hostname +Hypesquad +ie +image_id +incentivized +Incentivized +Inclusivity +inexhaustive +influencer +influencers +instanceId +interaction_token +invitable +inviter +ip +joinSecret +keypair +largeImage +largeText +laterz +launchable +leaderboard +leaderboards +Lotties +Lua +lurkable +maxSize +mediaUrl +mentionables +message_id +modmins +ngrok +ngrok's +nsfw +nullable +Nullable +num_shards +Ogg +ogg +onwards +param +passthrough +pdb +performant +permissioning +pid +pingable +Playstation +prepending +primary_color +proxied +pseudocode +qos +querystring +rasterized +realtime +reapprove +redistributable +redstone +referrer_id +renderable +repurpose +requester's +requestor +Sandscape +sandboxed +scrollback +SDKs +shaders +shard_id +Sharding +sharding +shareLink +signum +signalHandler +Sku +sku +sku_ids +skus +SKUs +slowmode +smallImage +smallText +social_layer +Soundshare +spectateSecret +Spotify +Stahp +steamId +Steamworks +Struture +Subcommand +subcommand +Subcommands +subcommands +submenu +Substring +substrings +Supa +templated +threadsafe +toolbelt +toolkits +tooltips +touchpoints +tts +twitchusername +uhm +ulong +unarchive +Unarchiving +unarchiving +unarchived +Unencrypted +unencrypted +unicode +Unlinking +unlinks +Unmerging +unmerge +unmerging +Unpublish +unpublish +Unpublishing +unpublishing +unprocessable +unranked +Unrenderable +Unsyncing +unsynced +untappable +upsell +upsells +upserts +URIs +urls +user_id +userId +UUIDs +UIs +version_number +videoinput +VMs +Vulkan +walkthrough +Walkthrough +webserver +websockets +Woah +Wordmark +wordmark +wss +Wumpus +wumpus +Xbox +youtube +zlib +zombied +zstd +command_id +channel_id +prepended +glibc +timeframe +rollout +whitepaper +Whitepaper +deeplinking +deauthorization +distros +starter_pack +guildId +unmerges +unmerged +application_asset_id +dateutil +setActivity +ratelimit +audiooutput +startTimestamp +partySize +partyMax +Wump \ No newline at end of file diff --git a/discord/vale/config/vocabularies/Mintlify/accept.txt b/discord/vale/config/vocabularies/Mintlify/accept.txt new file mode 100644 index 0000000000..8799898d5a --- /dev/null +++ b/discord/vale/config/vocabularies/Mintlify/accept.txt @@ -0,0 +1,267 @@ +Mintlify +mintlify +VSCode +openapi +OpenAPI +Github +APIs + +repo +npm +dev + +Lorem +ipsum +impsum +amet + +const +myName +myObject +bearerAuth +favicon +topbar +url +borderRadius +args +modeToggle +ModeToggle +isHidden +autoplay + +_italic_ +Strikethrough +Blockquotes +Blockquote +Singleline +Multiline + +onboarding + +async +await +boolean +enum +func +impl +init +instanceof +typeof +params +stdin +stdout +stderr +stdout +stdin +var +const +let +null +undefined +struct +bool + +cors +csrf +env +xhr +xhr2 +jwt +oauth +websocket +localhost +middleware +runtime +webhook +stdin +stdout + +json +yaml +yml +md +txt +tsx +jsx +css +scss +html +png +jpg +svg + +cdn +cli +css +dom +dto +env +git +gui +http +https +ide +jvm +mvc +orm +rpc +sdk +sql +ssh +ssl +tcp +tls +uri +url +ux +ui + +nodejs +npm +yarn +pnpm +eslint +pytest +golang +rustc +kubectl +mongo +postgres +redis + +JavaScript +TypeScript +Python +Ruby +Rust +Go +Golang +Java +Kotlin +Swift +Node.js +NodeJS +Deno + +React +Vue +Angular +Next.js +Nuxt +Express +Django +Flask +Spring +Laravel +Redux +Vuex +TensorFlow +PostgreSQL +MongoDB +Redis +PNPM + +Docker +Kubernetes +AWS +Azure +GCP +Terraform +Jenkins +CircleCI +GitLab +Heroku + +Git +git +GitHub +GitLab +Bitbucket +VSCode +Visual Studio Code +IntelliJ +WebStorm +ESLint +eslint +Prettier +prettier +Webpack +webpack +Vite +vite +Babel +babel +Jest +jest +Mocha +Cypress +Postman + +HTTP +HTTPS +OAuth +JWT +GraphQL +REST +WebSocket +TCP/IP + +NPM +Yarn +PNPM +Pip +PIP +Cargo +RubyGems + +Swagger +OpenAPI +Markdown +MDX +Storybook +TypeDoc +JSDoc + +MySQL +PostgreSQL +MongoDB +Redis +Elasticsearch +DynamoDB + +Linux +Unix +macOS +iOS + +Firefox +Chromium +WebKit + +config +ctx +desc +dir +elem +err +len +msg +num +obj +prev +proc +ptr +req +res +str +tmp +val +vars + +todo +href +lang +nav +prev +next +toc diff --git a/docs/activities/development-guides.mdx b/docs/activities/development-guides.mdx deleted file mode 100644 index 976b799836..0000000000 --- a/docs/activities/development-guides.mdx +++ /dev/null @@ -1,151 +0,0 @@ ---- -sidebar_label: Development Guides -showTOC: true -subpages: - - development-guides/local-development.mdx - - development-guides/user-actions.mdx - - development-guides/mobile.mdx - - development-guides/layout.mdx - - development-guides/networking.mdx - - development-guides/multiplayer-experience.mdx - - development-guides/growth-and-referrals.mdx - - development-guides/assets-and-metadata.mdx - - development-guides/production-readiness.mdx ---- - -[Home](/docs/intro) > [Activities](/docs/activities/overview) > Development Guides - -# Activity Development Guides - -These guides include suggested development practices, SDK commands, and user flows for you to consider while building your Activity. These will help to provide your users with a consistent and clear experience while interacting with your application. - -## Local Development - - - Get up and running with a local development application. - - - How to launch your app on mobile and desktop Discord clients. - - - Configure the Discord proxy to allow network requests to necessary external endpoints. - - - How to use the various levels of logging while building your application. - - - -## User Actions - - - Open an external link from within your app. - - - Open the Application Channel Invite dialog within Discord. - - - Open a dialog to share media from your application to a channel, DM, or GDM. - - - Configure a command that allows users to open your Activity from the App Launcher. - - - Open a dialog to enable hardware acceleration for compute-intensive applications. - - - -## Mobile - - - Update your application settings to support iOS and Android. - - - Ensure that your app's assets fall within mobile-safe areas. - - - Respond to thermal state changes surfaced from iOS and Android. - - - -## Layout - - - Configure and subscribe to changes in application orientation. - - - Subscribe to layout mode changes to update your application's user interface. - - - -## Networking - - - Working with our Activity Proxy - - - Generate a full URL when working with network requests. - - - Allow network requests to external resources from inside the Discord proxy. - - - Keep things safe and secure in your Activity. - - - -## Multiplayer Experience - - - Managing instances to ensure users join the same instance as their friends. - - - Use the SDK to fetch the users currently connected to an instance. - - - Retrieve and render the usernames and avatars of users connected to your application. - - - Validating activity sessions are via a Discord client before adding them to an instance's session. - - - -## Growth and Referrals - - - Encourage your users to share links to your activity by adding tracking and offering rewards for engagement. - - - - For off-platform sharing of rewards, promotions, or limited time experiences. - - - - An API to be able to generate ephemeral links with a customizable embed. - - - -## Assets & Metadata - - - Best practices for configuring how your application shows up in Discord. - - - Best practices for configuring how your application shows up in Discord. - - - -## Production Readiness - - - Manage asset caching in your application and the Discord Activity proxy. - - - Stay within rate limits to keep the fun going in your Activity. - - - Network routing considerations when preparing your Activity for production use. - - - Future-proof your application and support new commands as they become available in the SDK. - - diff --git a/docs/change-log.mdx b/docs/change-log.mdx deleted file mode 100644 index 3bb9c66ef7..0000000000 --- a/docs/change-log.mdx +++ /dev/null @@ -1,9 +0,0 @@ ---- -showTOC: false ---- - -# Change Log - -Discover the latest updates, new features, and bug fixes on the Discord Developer Platform. To join in on the conversation, join the [Discord Developers Server](https://discord.com/invite/discord-developers). - - diff --git a/docs/change-log/2017-07-19-breaking-change-version-6.md b/docs/change-log/2017-07-19-breaking-change-version-6.md deleted file mode 100644 index 1e135982fe..0000000000 --- a/docs/change-log/2017-07-19-breaking-change-version-6.md +++ /dev/null @@ -1,14 +0,0 @@ ---- -title: "Breaking Change: Version 6" -date: "2017-07-19" -breaking: true ---- - -* [Channel](/docs/resources/channel#channel-object) Object - * `is_private` removed - * [`type`](/docs/resources/channel#channel-object-channel-types) is now an integer - * `recipient` is now `recipients`, an array of [user](/docs/resources/user#user-object) objects -* [Message](/docs/resources/message#message-object) Object - * [`type`](/docs/resources/message#message-object-message-types) added to support system messages -* [Status Update](/docs/events/gateway-events#update-presence-gateway-presence-update-structure) Object - * `idle_since` renamed to `since` diff --git a/docs/change-log/2017-07-24-new-feature-audit-logs.md b/docs/change-log/2017-07-24-new-feature-audit-logs.md deleted file mode 100644 index 97ea39fb13..0000000000 --- a/docs/change-log/2017-07-24-new-feature-audit-logs.md +++ /dev/null @@ -1,6 +0,0 @@ ---- -title: "New Feature: Audit Logs" -date: "2017-07-24" ---- - -Audit logs are here! Well, they've been here all along, but now we've got [documentation](/docs/resources/audit-log) about them. Check it out, but remember: with great power comes great responsibility. diff --git a/docs/change-log/2017-08-03-breaking-change-default-channels.md b/docs/change-log/2017-08-03-breaking-change-default-channels.md deleted file mode 100644 index 3c835583ec..0000000000 --- a/docs/change-log/2017-08-03-breaking-change-default-channels.md +++ /dev/null @@ -1,11 +0,0 @@ ---- -title: "Breaking Change: Default Channels" -date: "2017-08-03" -breaking: true ---- - -After today, we are changing how default channels function. The "default" channel for a given user is now the channel with the highest position that their permissions allow them to see. New guilds will no longer have a default channel with the same id as the guild. Existing guilds will not have their #general channel id changed. It is possible, if permissions are set in such a way, that a user will not have a default channel in a guild. - -We saw a use case in many servers where the previously-default #general channel was being repurposed as an announcement-only, non-writable channel for new members by using bots to clear the entire message history. Now, that channel can simply be deleted and re-created with the desired permissions. This change also allows dynamic default channels for users based on permissions. - -We are also rolling out a change in conjunction that will allow Discord to remember your last-visited channel in a guild across sessions. Newly-joined users will be directed to the guild's default channel on first join; existing members will return to whichever channel they last visited. diff --git a/docs/change-log/2017-08-16-breaking-change-presence-activity-objects.md b/docs/change-log/2017-08-16-breaking-change-presence-activity-objects.md deleted file mode 100644 index fdf03d5474..0000000000 --- a/docs/change-log/2017-08-16-breaking-change-presence-activity-objects.md +++ /dev/null @@ -1,7 +0,0 @@ ---- -title: "Breaking Change: Presence Activity Objects" -date: "2017-08-16" -breaking: true ---- - -The `type` field in the [activity object](/docs/events/gateway-events#activity-object) for [Gateway Status Update](/docs/events/gateway-events#update-presence) and [Presence Update](/docs/events/gateway-events#presence-update) payloads is no longer optional when the activity object is not null. diff --git a/docs/change-log/2017-09-10-new-feature-emoji-endpoints.md b/docs/change-log/2017-09-10-new-feature-emoji-endpoints.md deleted file mode 100644 index 1e294bab06..0000000000 --- a/docs/change-log/2017-09-10-new-feature-emoji-endpoints.md +++ /dev/null @@ -1,6 +0,0 @@ ---- -title: "New Feature: Emoji Endpoints" -date: "2017-09-10" ---- - -[Emoji endpoints](/docs/resources/emoji#emoji-resource) have been added to the API. Bots can now manage guild emojis to their robo-hearts' content! diff --git a/docs/change-log/2017-09-20-new-feature-channel-categories.md b/docs/change-log/2017-09-20-new-feature-channel-categories.md deleted file mode 100644 index 96120567f6..0000000000 --- a/docs/change-log/2017-09-20-new-feature-channel-categories.md +++ /dev/null @@ -1,6 +0,0 @@ ---- -title: "New Feature: Channel Categories" -date: "2017-09-20" ---- - -Changes have been made throughout the documentation to reflect the addition of channel categories to Discord. These includes an additional field—`parent_id`—to the base [channel](/docs/resources/channel#channel-object) object and a new [channel category example](/docs/resources/channel#channel-object-example-channel-category). diff --git a/docs/change-log/2017-10-16-breaking-change-api-gateway-below-v6-discontinued.md b/docs/change-log/2017-10-16-breaking-change-api-gateway-below-v6-discontinued.md deleted file mode 100644 index 88c49181fc..0000000000 --- a/docs/change-log/2017-10-16-breaking-change-api-gateway-below-v6-discontinued.md +++ /dev/null @@ -1,7 +0,0 @@ ---- -title: "Breaking Change: API & Gateway Below v6 Discontinued" -date: "2017-10-16" -breaking: true ---- - -[API](/docs/reference#api-versioning) and Gateway versions below v6 are now discontinued after being previously deprecated. Version 6 is now the default API and Gateway version. Attempting to use a version below 6 will result in an error. diff --git a/docs/change-log/2017-11-09-new-feature-rich-presence.md b/docs/change-log/2017-11-09-new-feature-rich-presence.md deleted file mode 100644 index de47121b02..0000000000 --- a/docs/change-log/2017-11-09-new-feature-rich-presence.md +++ /dev/null @@ -1,12 +0,0 @@ ---- -title: "New Feature: Rich Presence" -date: "2017-11-09" ---- - -Rich Presence is now live and available for all developers! Rich Presence allows developers to closely integrate with Discord in a number of new, cool ways like: - -* Showing more information about a user's current game in their profile -* Allowing users to post invitations to join their party or spectate their game in chat -* Displaying "Spectate" and "Ask to Join" buttons on users' profiles - -For more information, check out our [Rich Presence site](https://discord.com/rich-presence). To get started on development, [read the docs](/docs/rich-presence/overview)! diff --git a/docs/change-log/2018-01-03-semi-breaking-change-very-large-bot-sharding.md b/docs/change-log/2018-01-03-semi-breaking-change-very-large-bot-sharding.md deleted file mode 100644 index 08d3cbfbbc..0000000000 --- a/docs/change-log/2018-01-03-semi-breaking-change-very-large-bot-sharding.md +++ /dev/null @@ -1,7 +0,0 @@ ---- -title: "Semi-Breaking Change: Very Large Bot Sharding" -date: "2018-01-03" -breaking: true ---- - -Additional sharding requirements and information for bots in over 100,000 guilds has been added. This requires a small change in numbers of shards for affected bots. See the [documentation](/docs/events/gateway#sharding-for-large-bots) for more information. diff --git a/docs/change-log/2018-01-23-deprecation-accept-invite-endpoint.md b/docs/change-log/2018-01-23-deprecation-accept-invite-endpoint.md deleted file mode 100644 index 2a7a136698..0000000000 --- a/docs/change-log/2018-01-23-deprecation-accept-invite-endpoint.md +++ /dev/null @@ -1,6 +0,0 @@ ---- -title: "Deprecation: Accept Invite Endpoint" -date: "2018-01-23" ---- - -The [Accept Invite](/docs/resources/invite) endpoint is deprecated starting today, and will be discontinued on March 23, 2018. The [Add Guild Member](/docs/resources/guild#add-guild-member) endpoint should be used in its place. diff --git a/docs/change-log/2018-01-30-enhancement-get-guild-emoji-endpoint.md b/docs/change-log/2018-01-30-enhancement-get-guild-emoji-endpoint.md deleted file mode 100644 index 83b5ae9178..0000000000 --- a/docs/change-log/2018-01-30-enhancement-get-guild-emoji-endpoint.md +++ /dev/null @@ -1,6 +0,0 @@ ---- -title: "Enhancement: Get Guild Emoji Endpoint" -date: "2018-01-30" ---- - -The [Get Guild Emoji](/docs/resources/emoji#get-guild-emoji) response now also includes a user object if the emoji was added by a user. diff --git a/docs/change-log/2018-02-05-enhancement-new-message-properties.md b/docs/change-log/2018-02-05-enhancement-new-message-properties.md deleted file mode 100644 index 07b2deed88..0000000000 --- a/docs/change-log/2018-02-05-enhancement-new-message-properties.md +++ /dev/null @@ -1,6 +0,0 @@ ---- -title: "Enhancement: New Message Properties" -date: "2018-02-05" ---- - -Additional `activity` and `application` fields—as well as corresponding object documentation—have been added to the [Message](/docs/resources/message#message-object) object in support of our newly-released [Spotify integration](https://support.discord.com/hc/en-us/articles/360000167212-Discord-Spotify-Connection) and previous Rich Presence enhancements. diff --git a/docs/change-log/2018-06-11-deprecation-rpc-online-member-count-and-members-list.md b/docs/change-log/2018-06-11-deprecation-rpc-online-member-count-and-members-list.md deleted file mode 100644 index dd599f6639..0000000000 --- a/docs/change-log/2018-06-11-deprecation-rpc-online-member-count-and-members-list.md +++ /dev/null @@ -1,6 +0,0 @@ ---- -title: "Deprecation: RPC online member count and members list" -date: "2018-06-11" ---- - -We released server changes that allow guilds to represent an incomplete state of the member list in our clients, which results in inaccurate member lists and online counts over RPC. These fields are now deprecated and will now return an empty members array and an online count of 0 moving forward. diff --git a/docs/change-log/2018-06-19-documentation-fix-list-of-open-dms-in-certain-payloads.md b/docs/change-log/2018-06-19-documentation-fix-list-of-open-dms-in-certain-payloads.md deleted file mode 100644 index 19ab1c4af5..0000000000 --- a/docs/change-log/2018-06-19-documentation-fix-list-of-open-dms-in-certain-payloads.md +++ /dev/null @@ -1,6 +0,0 @@ ---- -title: "Documentation Fix: List of Open DMS in Certain Payloads" -date: "2018-06-19" ---- - -The documentation has been updated to correctly note that the `private_channels` field in the [Ready](/docs/events/gateway-events#ready) should be an empty array, as well as the response from `/users/@me/channels` for a bot user. This change has been in effect for a long time, but the documentation was not updated. diff --git a/docs/change-log/2018-11-30-enhancement-user-object.md b/docs/change-log/2018-11-30-enhancement-user-object.md deleted file mode 100644 index 2f9f23d630..0000000000 --- a/docs/change-log/2018-11-30-enhancement-user-object.md +++ /dev/null @@ -1,6 +0,0 @@ ---- -title: "Enhancement: User Object" -date: "2018-11-30" ---- - -The [User object](/docs/resources/user#user-object) now includes two new additional fields, `premium_type` and `flags`. These can be used to know the Nitro status of a user, or determine which HypeSquad house a user is in. diff --git a/docs/change-log/2018-12-11-documentation-dispatch-store-listings.md b/docs/change-log/2018-12-11-documentation-dispatch-store-listings.md deleted file mode 100644 index b1d3518f53..0000000000 --- a/docs/change-log/2018-12-11-documentation-dispatch-store-listings.md +++ /dev/null @@ -1,6 +0,0 @@ ---- -title: "Documentation: Dispatch Store Listings" -date: "2018-12-11" ---- - -Dispatch documentation around store listings has been removed. Store pages for the Discord Store are now managed entirely within the [Developer Portal](https://discord.com/developers). diff --git a/docs/change-log/2019-01-14-ask-to-join-rich-presence-sdk.md b/docs/change-log/2019-01-14-ask-to-join-rich-presence-sdk.md deleted file mode 100644 index 6c70be5656..0000000000 --- a/docs/change-log/2019-01-14-ask-to-join-rich-presence-sdk.md +++ /dev/null @@ -1,8 +0,0 @@ ---- -title: "Ask to Join & Rich Presence SDK" -date: "2019-01-14" ---- - -Ask to Join no longer requires approval or whitelisting to use. You are welcome to create in-game UI, but all Ask to Join requests are also now handled by the Discord overlay. - -There have also been some small additions to the Rich Presence SDK. The previously undocumented `UpdateHandlers()` function is now documented. diff --git a/docs/change-log/2019-04-18-new-invite-object-fields.md b/docs/change-log/2019-04-18-new-invite-object-fields.md deleted file mode 100644 index 587f723be6..0000000000 --- a/docs/change-log/2019-04-18-new-invite-object-fields.md +++ /dev/null @@ -1,6 +0,0 @@ ---- -title: "New Invite Object Fields" -date: "2019-04-18" ---- - -The [Invite Object](/docs/resources/invite#invite-object) now includes two additional fields, `target_user` and `target_user_type`. diff --git a/docs/change-log/2019-04-29-deprecation-of-discord-rpc-rich-presence-sdk.md b/docs/change-log/2019-04-29-deprecation-of-discord-rpc-rich-presence-sdk.md deleted file mode 100644 index 4292f6a135..0000000000 --- a/docs/change-log/2019-04-29-deprecation-of-discord-rpc-rich-presence-sdk.md +++ /dev/null @@ -1,6 +0,0 @@ ---- -title: "Deprecation of Discord-RPC Rich Presence SDK" -date: "2019-04-29" ---- - -The [Discord-RPC](https://github.com/discord/discord-rpc) implementation of Rich Presence has been deprecated in favor of Discord's new GameSDK. If you're interested in using Rich Presence, please read our [SDK Starter Guide](/docs/developer-tools/game-sdk#getting-started) and check out the relevant functions in the [Activity Manager](/docs/developer-tools/game-sdk#activities). diff --git a/docs/change-log/2019-05-29-added-info-around-nitro-boosting-experiment.md b/docs/change-log/2019-05-29-added-info-around-nitro-boosting-experiment.md deleted file mode 100644 index 07fe17274a..0000000000 --- a/docs/change-log/2019-05-29-added-info-around-nitro-boosting-experiment.md +++ /dev/null @@ -1,6 +0,0 @@ ---- -title: "Added Info Around Nitro Boosting Experiment" -date: "2019-05-29" ---- - -Additional information has been documented to support [Server Nitro Boosting](https://support.discord.com/hc/en-us/articles/360028038352-Server-Boosting). This includes the addition of a few [message types](/docs/resources/message#message-object-message-types), as well as some [new fields on guilds](/docs/resources/guild#guild-object-premium-tier). Please note that this feature is currently under experimentation, and these fields may be subject to change. diff --git a/docs/change-log/2019-06-19-additional-team-information.md b/docs/change-log/2019-06-19-additional-team-information.md deleted file mode 100644 index 63b1bf429b..0000000000 --- a/docs/change-log/2019-06-19-additional-team-information.md +++ /dev/null @@ -1,6 +0,0 @@ ---- -title: "Additional Team Information" -date: "2019-06-19" ---- - -Additional information around Teams has been added to both the API and the documentation. The [Teams](/docs/topics/teams#teams) page now includes information about the team and team member objects. Additionally, the [Get Current Application Information](/docs/topics/oauth2#get-current-bot-application-information) endpoint now returns a `team` object if that application belongs to a team. That documentation has also been updated to includes fields that were missing for applications that are games sold on Discord. diff --git a/docs/change-log/2019-07-18-bot-tokens-for-achievements.md b/docs/change-log/2019-07-18-bot-tokens-for-achievements.md deleted file mode 100644 index 5281380591..0000000000 --- a/docs/change-log/2019-07-18-bot-tokens-for-achievements.md +++ /dev/null @@ -1,6 +0,0 @@ ---- -title: "Bot Tokens for Achievements" -date: "2019-07-18" ---- - -You can now use Bot tokens for authorization headers against the HTTP API for [Achievements](https://github.com/discord/discord-api-docs/blob/legacy-gamesdk/docs/game_sdk/Achievements.md#the-api-way). diff --git a/docs/change-log/2019-08-12-more-precise-rate-limits.md b/docs/change-log/2019-08-12-more-precise-rate-limits.md deleted file mode 100644 index 266c53cf19..0000000000 --- a/docs/change-log/2019-08-12-more-precise-rate-limits.md +++ /dev/null @@ -1,6 +0,0 @@ ---- -title: "More Precise Rate Limits" -date: "2019-08-12" ---- - -You can now get more precise rate limit reset times, via a new request header. Check out the [rate limits](/docs/topics/rate-limits) documentation for more information. diff --git a/docs/change-log/2019-08-22-changes-to-special-channels.md b/docs/change-log/2019-08-22-changes-to-special-channels.md deleted file mode 100644 index 8268379d2c..0000000000 --- a/docs/change-log/2019-08-22-changes-to-special-channels.md +++ /dev/null @@ -1,6 +0,0 @@ ---- -title: "Changes to Special Channels" -date: "2019-08-22" ---- - -News Channels are now changed to Announcement Channels. Developer License owners will continue to get access to them (both existing and new). Underlying channel type (GUILD\_NEWS = 5) remains the same. diff --git a/docs/change-log/2019-11-14-gamesdk-version-2.5.5.md b/docs/change-log/2019-11-14-gamesdk-version-2.5.5.md deleted file mode 100644 index 829c4b9945..0000000000 --- a/docs/change-log/2019-11-14-gamesdk-version-2.5.5.md +++ /dev/null @@ -1,8 +0,0 @@ ---- -title: "GameSDK Version 2.5.5" -date: "2019-11-14" ---- - -We've shipped some updates to the GameSDK, including support for Linux as well as the IL2CPP backend system for Unity. These changes also fixed a bug in the [`SetUserAchievement()`](https://github.com/discord/discord-api-docs/blob/legacy-gamesdk/docs/game_sdk/Achievements.md#setuserachievement) method. - -Get the latest at the top of the [Getting Started](/docs/developer-tools/game-sdk#step-1-get-the-sdk) documentation. If you're looking for help interacting with the GameSDK or want to report a bug, join us on the [official Discord](https://discord.gg/discord-developers). diff --git a/docs/change-log/2019-11-27-gamesdk-version-2.5.6.md b/docs/change-log/2019-11-27-gamesdk-version-2.5.6.md deleted file mode 100644 index fd1a6fdcad..0000000000 --- a/docs/change-log/2019-11-27-gamesdk-version-2.5.6.md +++ /dev/null @@ -1,6 +0,0 @@ ---- -title: "GameSDK Version 2.5.6" -date: "2019-11-27" ---- - -Fixed a bug from the 2.5.5 release that caused network handshakes to fail, resulting in no networking data being sent. The networking manager and integrated lobby networking should be full operational again after updating. diff --git a/docs/change-log/2019-12-06-ip-discovery-updates.md b/docs/change-log/2019-12-06-ip-discovery-updates.md deleted file mode 100644 index c21b2d80ac..0000000000 --- a/docs/change-log/2019-12-06-ip-discovery-updates.md +++ /dev/null @@ -1,6 +0,0 @@ ---- -title: "IP Discovery Updates" -date: "2019-12-06" ---- - -Updated our [IP discovery message](/docs/topics/voice-connections#ip-discovery). The old message is deprecated and will be removed in the future. diff --git a/docs/change-log/2020-02-14-gateway-intents.md b/docs/change-log/2020-02-14-gateway-intents.md deleted file mode 100644 index d8c9cd9198..0000000000 --- a/docs/change-log/2020-02-14-gateway-intents.md +++ /dev/null @@ -1,16 +0,0 @@ ---- -title: "Gateway Intents" -date: "2020-02-14" ---- - -We've added documentation around a brand new feature: [Gateway Intents!](/docs/events/gateway#gateway-intents) Gateway Intents are a great way to specify which events you want to receive from our gateway. Go on, save yourself some bandwidth and CPU usage. - -Using Intents will change the behavior of some existing events and commands, so please refer to: - -* [Guild Create](/docs/events/gateway-events#guild-create) -* [Request Guild Members](/docs/events/gateway-events#request-guild-members) -* [Guild Member Add](/docs/events/gateway-events#guild-member-add) -* [Guild Member Remove](/docs/events/gateway-events#guild-member-remove) -* [Guild Member Update](/docs/events/gateway-events#guild-member-update) -* [Presence Update](/docs/events/gateway-events#presence-update) -* [List Guild Members](/docs/resources/guild#list-guild-members) diff --git a/docs/change-log/2020-02-26-rich-presence-spectate-approval.md b/docs/change-log/2020-02-26-rich-presence-spectate-approval.md deleted file mode 100644 index b995e534cc..0000000000 --- a/docs/change-log/2020-02-26-rich-presence-spectate-approval.md +++ /dev/null @@ -1,6 +0,0 @@ ---- -title: "Rich Presence Spectate Approval" -date: "2020-02-26" ---- - -The [Spectate](/docs/developer-tools/game-sdk#onactivityspectate) functionality of Rich Presence no longer requires whitelisting or approval. diff --git a/docs/change-log/2020-03-02-new-invite-events-and-reactions-endpoint.md b/docs/change-log/2020-03-02-new-invite-events-and-reactions-endpoint.md deleted file mode 100644 index 25f94ad2bb..0000000000 --- a/docs/change-log/2020-03-02-new-invite-events-and-reactions-endpoint.md +++ /dev/null @@ -1,11 +0,0 @@ ---- -title: "New Invite Events and Reactions Endpoint" -date: "2020-03-02" ---- - -We've added a new endpoint for deleting all reactions of a specific emoji from a message, as well as some new invite and reaction gateway events. Read more: - -* [Delete All Reactions for Emoji](/docs/resources/message#delete-all-reactions-for-emoji) -* [Invite Create](/docs/events/gateway-events#invite-create) -* [Invite Delete](/docs/events/gateway-events#invite-delete) -* [Message Reaction Remove Emoji](/docs/events/gateway-events#message-reaction-remove-emoji) diff --git a/docs/change-log/2020-03-03-new-allowed-mentions-object.md b/docs/change-log/2020-03-03-new-allowed-mentions-object.md deleted file mode 100644 index 5b08e4828f..0000000000 --- a/docs/change-log/2020-03-03-new-allowed-mentions-object.md +++ /dev/null @@ -1,8 +0,0 @@ ---- -title: "New Allowed Mentions Object" -date: "2020-03-03" ---- - -We've added a way to specify mentions in a more granular form. This change also begins the start of a 60 day deprecation cycle on legacy mention behavior. Read more: - -* [Allowed mentions object](/docs/resources/message#allowed-mentions-object) diff --git a/docs/change-log/2020-04-24-new-properties-on-guild-members-chunk-event.md b/docs/change-log/2020-04-24-new-properties-on-guild-members-chunk-event.md deleted file mode 100644 index b925c0abf3..0000000000 --- a/docs/change-log/2020-04-24-new-properties-on-guild-members-chunk-event.md +++ /dev/null @@ -1,6 +0,0 @@ ---- -title: "New Properties on Guild Members Chunk Event" -date: "2020-04-24" ---- - -The [Guild Members Chunk](/docs/events/gateway-events#guild-members-chunk) gateway event now contains two properties: `chunk_index` and `chunk_count`. These values can be used to keep track of how many events you have left to receive in response to a [Request Guild Members](/docs/events/gateway-events#request-guild-members) command. diff --git a/docs/change-log/2020-05-11-legacy-mention-behavior-deprecation.md b/docs/change-log/2020-05-11-legacy-mention-behavior-deprecation.md deleted file mode 100644 index 87e1d33da8..0000000000 --- a/docs/change-log/2020-05-11-legacy-mention-behavior-deprecation.md +++ /dev/null @@ -1,6 +0,0 @@ ---- -title: "Legacy Mention Behavior Deprecation" -date: "2020-05-11" ---- - -The legacy mention behavior for bots is now removed, and granular control of mentions should use the [Allowed Mentions](/docs/resources/message#allowed-mentions-object) API moving forwards. diff --git a/docs/change-log/2020-07-28-new-permission-fields.md b/docs/change-log/2020-07-28-new-permission-fields.md deleted file mode 100644 index 1a42b973e2..0000000000 --- a/docs/change-log/2020-07-28-new-permission-fields.md +++ /dev/null @@ -1,6 +0,0 @@ ---- -title: "New Permission Fields" -date: "2020-07-28" ---- - -Documented `permissions_new`, `allow_new`, and `deny_new` as string-serialized permission bitfields. diff --git a/docs/change-log/2020-09-24-api-and-gateway-v8.md b/docs/change-log/2020-09-24-api-and-gateway-v8.md deleted file mode 100644 index 682f18400f..0000000000 --- a/docs/change-log/2020-09-24-api-and-gateway-v8.md +++ /dev/null @@ -1,47 +0,0 @@ ---- -title: "API and Gateway V8" -date: "2020-09-24" ---- - -We've introduced API and Gateway v8! Changes are noted throughout the documentation, and you can also read [this commit in our docs repo](https://github.com/discord/discord-api-docs/commit/545ff4a7883e5eee7ee91d19a5e5d760a0730033) for a full diff. - -The changes are: - -* API and Gateway v8 are now available. v6 is still the default for the time being. -* [Gateway Intents](/docs/events/gateway#gateway-intents) are now required -* Removed `guild_subscriptions` in identify in favor of [Gateway Intents](/docs/events/gateway#gateway-intents). -* All permissions have been converted to strings-serialized numbers. As such, `permissions_new`, `allow_new`, and `deny_new` have been removed -* The `game` field has been removed. If you need a direct replacement, you can instead reference the first element of `activities` -* Channel Permission Overwrite `type`s are now numbers (0 and 1) instead of strings ("role" and "member"). However due to a current technical constraint, they are string-serialized numbers in audit log `options`. -* `embed_enabled` and `embed_channel_id` have been removed. Use `widget_enabled` and `widget_channel_id` instead. -* Form body errors have been improved to include more helpful messaging on validation. [See more here](/docs/reference#error-messages) -* The `Retry-After` header value and `retry_after` body value is now based in seconds instead of milliseconds (e.g. `123` means 123 seconds) -* The `X-RateLimit-Precision` header is no longer respected. `X-RateLimit-Reset` and `X-RateLimit-Reset-After` are always returned at millisecond precision (e.g. `123.456` instead of `124`) -* Bots no longer receive [Channel Create Gateway Event](/docs/events/gateway-events#channel-create) for DMs -* `delete-message-days` is no longer available. Use `delete_message_days`. -* Removed `roles`, `premium_since`, and `nick` from [Presence Update Gateway Event](/docs/events/gateway-events#presence-update) -* Removed some [integration object](/docs/resources/guild#integration-object) fields for Discord application integrations -* Removed `include_applications` from [Get Guild Integrations](/docs/resources/guild#get-guild-integrations). Application integrations are always included. -* The following deprecated routes have been removed for better naming conventions: - -Removed in favor of `/guilds//widget`: - -* `/guilds//embed` - -Removed in favor of `/guilds//widget.json`: - -* `/servers//embed.json` -* `/servers//widget.json` -* `/guilds//embed.json` - -Removed in favor of `/guilds//widget.png`: - -* `/guilds//embed.png` - -Removed in favor of `/channels//messages/bulk-delete`: - -* `/channels//messages/bulk_delete/` - -Removed in favor of `/invites//`: - -* `/invite//` diff --git a/docs/change-log/2020-10-27-gateway-v6-intent-restrictions.md b/docs/change-log/2020-10-27-gateway-v6-intent-restrictions.md deleted file mode 100644 index ce0ccc1d4a..0000000000 --- a/docs/change-log/2020-10-27-gateway-v6-intent-restrictions.md +++ /dev/null @@ -1,9 +0,0 @@ ---- -title: "Gateway v6 Intent Restrictions" -date: "2020-10-27" ---- - -The v6 gateway now applies the restrictions for gateway intents. This means the new chunking limitations are now in effect, regardless of intents being used. See [Request Guild Members](/docs/events/gateway-events#request-guild-members) for further details. -Additionally, if privileged intents are not enabled in the application dashboard the bot will not receive the events for those intents. - -All other intents are always enabled by default unless specified otherwise by the identify payload. We have made a support article to explain some of the changes and resulting issues with more details: [Gateway Update FAQ](https://dis.gd/gwupdate) diff --git a/docs/change-log/2020-11-13-stickers.md b/docs/change-log/2020-11-13-stickers.md deleted file mode 100644 index 77ea376a79..0000000000 --- a/docs/change-log/2020-11-13-stickers.md +++ /dev/null @@ -1,6 +0,0 @@ ---- -title: "Stickers" -date: "2020-11-13" ---- - -Stickers are now documented as part of the [message](/docs/resources/message#message-object) object. diff --git a/docs/change-log/2020-11-16-inline-replies.md b/docs/change-log/2020-11-16-inline-replies.md deleted file mode 100644 index f8bc843872..0000000000 --- a/docs/change-log/2020-11-16-inline-replies.md +++ /dev/null @@ -1,12 +0,0 @@ ---- -title: "Inline Replies" -date: "2020-11-16" ---- - -Inline Replies have been added to our documentation. They behave differently in v6 and v8, so be cautious in your implementation: - -* Inline replies are type `19` in v8, but remain type `0` in v6 -* You can now add a `message_reference` on message create to create a reply -* A new field `referenced_message` has been added to the [Message Object](/docs/resources/message#message-object) -* A new field `replied_user` has been added to the [Allowed Mentions Object](/docs/resources/message#allowed-mentions-object) -* [Message Create](/docs/events/gateway-events#message-create) gateway event is guaranteed to have a `referenced_message` if the message created is a reply. Otherwise, that field is not guaranteed. diff --git a/docs/change-log/2020-12-15-slash-commands-and-interactions.md b/docs/change-log/2020-12-15-slash-commands-and-interactions.md deleted file mode 100644 index a04de4e9d7..0000000000 --- a/docs/change-log/2020-12-15-slash-commands-and-interactions.md +++ /dev/null @@ -1,12 +0,0 @@ ---- -title: "Slash Commands and Interactions" -date: "2020-12-15" ---- - -Slash Commands are here! There's a *lot* to cover, so go check out specific documentation under [Slash Commands](/docs/interactions/application-commands). - -Slash Commands include some new features for webhooks as well: - -* Webhooks can now update previously-sent messages from the same webhook using [Edit Webhook Message](/docs/resources/webhook#edit-webhook-message) and [Delete Webhook Message](/docs/resources/webhook#delete-webhook-message) - -This PR also documents the `application` field on the `READY` gateway event, which is a partial [application object](/docs/resources/application#application-object) containing `id` and `flags`. diff --git a/docs/change-log/2021-01-22-change-to-permission-checking-when-creating-channels.md b/docs/change-log/2021-01-22-change-to-permission-checking-when-creating-channels.md deleted file mode 100644 index 2d5a07ba15..0000000000 --- a/docs/change-log/2021-01-22-change-to-permission-checking-when-creating-channels.md +++ /dev/null @@ -1,6 +0,0 @@ ---- -title: "Change to Permission Checking when Creating Channels" -date: "2021-01-22" ---- - -Permission overwrites in the guild channel creation endpoint are now validated against the permissions your bot has in the guild. Permission overwrites specified in the request body when creating guild channels will now require your bot to also have the permissions being applied. Setting `MANAGE_ROLES` permission in channel overwrites is only possible for guild administrators or users with `MANAGE_ROLES` as a permission overwrite in the channel. diff --git a/docs/change-log/2021-02-09-slash-commands-in-dms.md b/docs/change-log/2021-02-09-slash-commands-in-dms.md deleted file mode 100644 index 6a0b840dac..0000000000 --- a/docs/change-log/2021-02-09-slash-commands-in-dms.md +++ /dev/null @@ -1,6 +0,0 @@ ---- -title: "Slash Commands in DMs" -date: "2021-02-09" ---- - -Slash Commands are now supported in DMs with bots. Due to this change, some of the fields on the [Interaction object](/docs/interactions/receiving-and-responding#interaction-object-interaction-structure) have been made optional. Newly optional fields don't reflect any behavior changes in Slash Commands within guilds; they are to support commands in the context of a DM only. diff --git a/docs/change-log/2021-03-05-changes-to-slash-command-response-types-and-flags.md b/docs/change-log/2021-03-05-changes-to-slash-command-response-types-and-flags.md deleted file mode 100644 index baebbddf8f..0000000000 --- a/docs/change-log/2021-03-05-changes-to-slash-command-response-types-and-flags.md +++ /dev/null @@ -1,14 +0,0 @@ ---- -title: "Changes to Slash Command Response Types and Flags" -date: "2021-03-05" ---- - -Changes to interaction response types have been made to support better designs for application commands: - -* Type `2` `Acknowledge` has been deprecated -* Type `3` `ChannelMessage` has been deprecated -* Type `5` `AcknowledgeWithSource` has been renamed to `DeferredChannelMessageWithSource` - -These deprecated types will be removed and break on **April 9, 2021**. - -Additionally, `flags` has been documented on [InteractionApplicationCommandCallbackData](/docs/interactions/receiving-and-responding#interaction-response-object-interaction-callback-data-structure). Setting `flags` to `64` will make the interaction response ephemeral. diff --git a/docs/change-log/2021-03-15-large-bot-sharding-lowered-to-150-000-guilds.md b/docs/change-log/2021-03-15-large-bot-sharding-lowered-to-150-000-guilds.md deleted file mode 100644 index 6c07f37302..0000000000 --- a/docs/change-log/2021-03-15-large-bot-sharding-lowered-to-150-000-guilds.md +++ /dev/null @@ -1,6 +0,0 @@ ---- -title: "Large Bot Sharding Lowered to 150,000 Guilds" -date: "2021-03-15" ---- - -There have been reports that sessions have higher frequency of errors when starting if a bot has joined too many guilds (the gateway connection times out). To account for this we have lowered the requirement for large bot sharding down to 150,000 guilds in order to improve reliability. diff --git a/docs/change-log/2021-04-05-application-command-permissions.md b/docs/change-log/2021-04-05-application-command-permissions.md deleted file mode 100644 index 70bf603a04..0000000000 --- a/docs/change-log/2021-04-05-application-command-permissions.md +++ /dev/null @@ -1,16 +0,0 @@ ---- -title: "Application Command Permissions" -date: "2021-04-05" ---- - -Need to keep some of your commands safe from prying eyes, or only available to the right people? Commands now support [command permissions](/docs/interactions/application-commands#permissions)! - -You can enable or disable a command (guild or global) for a specific user or role in a guild. For now, users will still be able to see the commands, but won't be able to use them. - -New routes have been added to support this functionality: - -* [`GET Guild Application Command Permissions`](/docs/interactions/application-commands#get-guild-application-command-permissions) -* [`GET Application Command Permissions`](/docs/interactions/application-commands#get-application-command-permissions) -* [`PUT Application Command Permissions`](/docs/interactions/application-commands#batch-edit-application-command-permissions) - -A `default_permission` field has also been added to the [ApplicationCommand](/docs/interactions/application-commands#application-command-object-application-command-structure) model. This field allows you to disable commands for everyone in a guild by default, if you prefer to make some of your commands an opt-in experience. diff --git a/docs/change-log/2021-04-28-api-v9.md b/docs/change-log/2021-04-28-api-v9.md deleted file mode 100644 index de2d875350..0000000000 --- a/docs/change-log/2021-04-28-api-v9.md +++ /dev/null @@ -1,12 +0,0 @@ ---- -title: "API v9" -date: "2021-04-28" ---- - -API v9 is now available. - -API v9 includes support for [threads](/docs/topics/threads), an upcoming feature. Older API versions will not receive any Gateway Events for threads, so it is important to update soon! We've prepared a [migration guide](/docs/topics/threads) to help make the upgrade process very straightforward. - -This documentation is being published early so bots can have at least two months to upgrade before threads launch. - -Additionally, API v9 also removes the `/channels/:id/messages/:id/suppress-embeds` route. diff --git a/docs/change-log/2021-05-26-buttons-and-message-components.md b/docs/change-log/2021-05-26-buttons-and-message-components.md deleted file mode 100644 index 5b73b6eda9..0000000000 --- a/docs/change-log/2021-05-26-buttons-and-message-components.md +++ /dev/null @@ -1,13 +0,0 @@ ---- -title: "Buttons and Message Components" -date: "2021-05-26" ---- - -Message components are now available with our first two components: a layout-based `ActionRow` and...buttons! - -You can now include buttons on messages sent by your app, whether they're bot messages or responses to interactions. [Learn more about message components](/docs/components/overview). - -The addition of message components means new fields and response types: - -* An optional `components` field has been added to the [message object](/docs/resources/message#message-object) -* New response types `6` and `7` have been added for [interaction responses](/docs/interactions/receiving-and-responding#interaction-response-object-interaction-callback-type), valid only for component-based interactions diff --git a/docs/change-log/2021-06-10-support-for-multiple-embeds-in-message-routes.md b/docs/change-log/2021-06-10-support-for-multiple-embeds-in-message-routes.md deleted file mode 100644 index 49a77f9a39..0000000000 --- a/docs/change-log/2021-06-10-support-for-multiple-embeds-in-message-routes.md +++ /dev/null @@ -1,6 +0,0 @@ ---- -title: "Support for Multiple Embeds in Message Routes" -date: "2021-06-10" ---- - -Message routes now accept an embeds array in addition to the existing embed field. Bots can now send up to 10 embeds per message, to be consistent with webhook behavior. The existing embed field is considered deprecated and will be removed in the next API version. diff --git a/docs/change-log/2021-06-30-select-menu-components.md b/docs/change-log/2021-06-30-select-menu-components.md deleted file mode 100644 index 2a1aab356d..0000000000 --- a/docs/change-log/2021-06-30-select-menu-components.md +++ /dev/null @@ -1,8 +0,0 @@ ---- -title: "Select Menu Components" -date: "2021-06-30" ---- - -Select Menus are now part of the components API! They're the greatest thing since the invention of buttons yesterday. Select menus allow you to offer users a choice of one or many options in a friendly UI-based way. - -Select menus can be used like other [message components](/docs/components/overview). Learn all the specifics in the [documentation](/docs/components/reference#string-select). diff --git a/docs/change-log/2021-08-10-user-and-message-commands.md b/docs/change-log/2021-08-10-user-and-message-commands.md deleted file mode 100644 index 3810d54d01..0000000000 --- a/docs/change-log/2021-08-10-user-and-message-commands.md +++ /dev/null @@ -1,8 +0,0 @@ ---- -title: "User and Message Commands" -date: "2021-08-10" ---- - -[User commands](/docs/interactions/application-commands#user-commands) and [message commands](/docs/interactions/application-commands#message-commands) are now live! These commands appear on context menus for users and messages, with more to come in the future. - -Context menu commands are a type of application command. The "Slash Commands" documentation page has been renamed to "Application Commands" and split out by type to show this. diff --git a/docs/change-log/2021-09-16-updated-thread-permissions.md b/docs/change-log/2021-09-16-updated-thread-permissions.md deleted file mode 100644 index 89cb16fc9d..0000000000 --- a/docs/change-log/2021-09-16-updated-thread-permissions.md +++ /dev/null @@ -1,13 +0,0 @@ ---- -title: "Updated Thread Permissions" -date: "2021-09-16" ---- - -Thread permissions have been updated and simplified: - -* "Use Public Threads" is now "Create Public Threads", which allows users to create public threads and announcement threads in a channel, even if they cannot send messages in that channel. -* "Use Private Threads" is now "Create Private Threads", which allows users to create private threads in a channel, even if they cannot send messages in that channel. - -A new permission has also been added: - -* "Send Messages in Threads", which allows users to send a message in a thread. The "Send Messages" permission has no effect in threads: users **must** have "Send Messages in Threads" to send a message in a thread. This allows for setups where a user can participate in a thread but cannot send a message in the parent channel (like a thread on an announcement post). diff --git a/docs/change-log/2021-10-27-application-command-autocomplete-interactions.md b/docs/change-log/2021-10-27-application-command-autocomplete-interactions.md deleted file mode 100644 index 6266d52dff..0000000000 --- a/docs/change-log/2021-10-27-application-command-autocomplete-interactions.md +++ /dev/null @@ -1,6 +0,0 @@ ---- -title: "Application Command Autocomplete Interactions" -date: "2021-10-27" ---- - -Autocomplete interactions are now available, allowing application commands to provide server completed options. Check out [the autocomplete interaction docs](/docs/interactions/application-commands#autocomplete) for more information. diff --git a/docs/change-log/2021-11-23-guild-scheduled-events.md b/docs/change-log/2021-11-23-guild-scheduled-events.md deleted file mode 100644 index f2dd642e49..0000000000 --- a/docs/change-log/2021-11-23-guild-scheduled-events.md +++ /dev/null @@ -1,18 +0,0 @@ ---- -title: "Guild Scheduled Events" -date: "2021-11-23" ---- - -* Add official support for `guild_scheduled_events` field on `Guild` resource sent with `GUILD_CREATE` event - -#### Nov 18, 2021 - -* Breaking change for return type for `GET /guilds/{guild.id}/scheduled-events/{guild_scheduled_event.id}/users` -* Add `with_user_count` query param for `GET /guilds/{guild.id}/scheduled-events/{guild_scheduled_event.id}` -* Return additional `creator` field by default in response for `GET /guilds/{guild.id}/scheduled-events/{guild_scheduled_event.id}` -* More details and clarification for the guild scheduled events feature. -* Document support for `before` and `after` query params for `GET /guilds/{guild.id}/scheduled-events/{guild_scheduled_event.id}/users` - -#### Nov 15, 2021 - -Add new documentation for the recently released Guild Scheduled Events feature. diff --git a/docs/change-log/2021-12-20-guild-member-timeouts.md b/docs/change-log/2021-12-20-guild-member-timeouts.md deleted file mode 100644 index d48cb84615..0000000000 --- a/docs/change-log/2021-12-20-guild-member-timeouts.md +++ /dev/null @@ -1,6 +0,0 @@ ---- -title: "Guild Member Timeouts" -date: "2021-12-20" ---- - -Add new documentation for the recently released guild member timeout feature. diff --git a/docs/change-log/2022-02-08-interaction-modals-and-application-command-attachment-option-type.md b/docs/change-log/2022-02-08-interaction-modals-and-application-command-attachment-option-type.md deleted file mode 100644 index 53742cfbc0..0000000000 --- a/docs/change-log/2022-02-08-interaction-modals-and-application-command-attachment-option-type.md +++ /dev/null @@ -1,8 +0,0 @@ ---- -title: "Interaction Modals and Application Command Attachment Option Type" -date: "2022-02-08" ---- - -Interaction modals are now available, allowing applications to prompt users for further detailed input. Check out [the modal docs](/docs/interactions/receiving-and-responding#interaction-response-object-modal) for more information. - -Application Commands can now add an attachment option type. See [the option type table](/docs/interactions/application-commands#application-command-object-application-command-option-type) for more information. diff --git a/docs/change-log/2022-02-14-api-v10.md b/docs/change-log/2022-02-14-api-v10.md deleted file mode 100644 index cb647a2452..0000000000 --- a/docs/change-log/2022-02-14-api-v10.md +++ /dev/null @@ -1,20 +0,0 @@ ---- -title: "API v10" -date: "2022-02-14" ---- - -* API v8 is now deprecated. -* `GET /channels/{channel.id}/threads/active` is decommissioned in favor of [`GET /guilds/{guild.id}/threads/active`](/docs/resources/guild#list-active-guild-threads). -* Starting in v10, you must specify the message content intent (`1 << 15`) to receive content-related fields in message dispatches. Read more in the [Gateway Intents documentation](/docs/events/gateway#gateway-intents). -* To specify a reason for an administrative action in audit logs, apps must now pass the `X-Audit-Log-Reason` header rather than the `reason` parameter for all endpoints. Read more in the [Audit Logs documentation](/docs/resources/audit-log). -* Message routes (like [`POST /channels/{channel.id}/messages`](/docs/resources/message#create-message)) now use the `embeds` field (an array of embed objects) instead of `embed`. -* The `summary` field for [applications](/docs/resources/application) now returns an empty string for all API versions. -* The `name` and `description` fields for [Achievements](https://github.com/discord/discord-api-docs/blob/legacy-gamesdk/docs/game_sdk/Achievements.md#achievement-struct) are now strings, and localization info is now passed in new `name_localizations` and `description_localizations` dictionaries. This change standardizes localization to match [Application Commands](/docs/interactions/application-commands#localization). Read details in the [Achievements documentation](https://github.com/discord/discord-api-docs/blob/legacy-gamesdk/docs/game_sdk/Achievements.md#achievement-struct). -* Existing attachments must be specified when [`PATCH`ing messages with new attachments](/docs/reference#editing-message-attachments). Any attachments not specified will be removed and replaced with the specified list -* Requests to v10 and higher will no longer be supported on `discordapp.com` (this does **not** affect `cdn.discordapp.com`) - -#### Upcoming changes - -* API v6 and v7 will be decommissioned **in early 2023** -* `MESSAGE_CONTENT` is becoming a privileged intent for verified bots in 75+ servers **on August 31, 2022**. Read details in [the FAQ](https://support-dev.discord.com/hc/en-us/articles/4404772028055-Message-Content-Privileged-Intent-FAQ) or follow [the guide](/docs/tutorials/upgrading-to-application-commands) on updating your app. -* The `summary` field for applications will be removed in the next API version (v11) diff --git a/docs/change-log/2022-03-31-guild-bans-pagination.md b/docs/change-log/2022-03-31-guild-bans-pagination.md deleted file mode 100644 index a1146427f7..0000000000 --- a/docs/change-log/2022-03-31-guild-bans-pagination.md +++ /dev/null @@ -1,6 +0,0 @@ ---- -title: "Guild Bans Pagination" -date: "2022-03-31" ---- - -The `GET /guilds/{guild.id}/bans` endpoint has been migrated to require pagination to improve reliability and stability. Check out the [endpoint docs](/docs/resources/guild#get-guild-bans) for more information. diff --git a/docs/change-log/2022-04-06-forum-channels.md b/docs/change-log/2022-04-06-forum-channels.md deleted file mode 100644 index a26809c6fa..0000000000 --- a/docs/change-log/2022-04-06-forum-channels.md +++ /dev/null @@ -1,6 +0,0 @@ ---- -title: "Forum Channels" -date: "2022-04-06" ---- - -Added new channel type, `GUILD_FORUM` (15). A `GUILD_FORUM` channel is an unreleased feature that is very similar (from an API perspective) to a `GUILD_TEXT` channel, except only threads can be created in that channel; messages cannot be sent directly in that channel. Check out the [forums topic](/docs/topics/threads#forums) for more information. diff --git a/docs/change-log/2022-04-27-updated-command-permissions.md b/docs/change-log/2022-04-27-updated-command-permissions.md deleted file mode 100644 index 0e14717a47..0000000000 --- a/docs/change-log/2022-04-27-updated-command-permissions.md +++ /dev/null @@ -1,22 +0,0 @@ ---- -title: "Updated Command Permissions" -date: "2022-04-27" -breaking: true ---- - -Application command permissions have been updated to add more granular control and access to commands in Discord. You can read the major changes below, and [the updated documentation](/docs/interactions/application-commands#permissions) for details. - -#### Breaking changes - -* Bearer tokens are now required to edit command permissions. Bearer tokens are tokens tied to an authenticating user's permissions, and can be [retrieved using OAuth](/docs/topics/oauth2). The user must have permission to manage the guild and roles. -* [`applications.commands.permissions.update`](/docs/topics/oauth2#shared-resources-oauth2-scopes) scope was added as a requirement to edit command permissions. -* Disabled the batch editing endpoint ([`PUT /applications/{application.id}/guilds/{guild.id}/commands/permissions`](/docs/interactions/application-commands#batch-edit-application-command-permissions)). - -#### Other changes - -* Created a [`CHANNEL` command permission type](/docs/interactions/application-commands#application-command-permissions-object-application-command-permission-type) -* Increase permission limit from `10` to `100` -* [constant (`guild_id - 1`)](/docs/interactions/application-commands#application-command-permissions-object-application-command-permissions-constants) to represent all channels in command permissions -* Added `default_member_permissions` field, which is a bitwise OR-ed set of [permissions](/docs/topics/permissions#permissions-bitwise-permission-flags), expressed as a string. This replaces the `default_permission` field, which will soon be deprecated. -* Added `dm_permission`, which is a boolean flag used to indicate whether a command is available in DMs (only for global application commands). If no value is passed, the global command will be visible in DMs. -* Added `APPLICATION_COMMAND_PERMISSIONS_UPDATE` [gateway](/docs/events/gateway-events#application-command-permissions-update) event and `APPLICATION_COMMAND_PERMISSION_UPDATE` [audit log](/docs/resources/audit-log) event. diff --git a/docs/change-log/2022-06-16-auto-moderation.md b/docs/change-log/2022-06-16-auto-moderation.md deleted file mode 100644 index f9f85f6e28..0000000000 --- a/docs/change-log/2022-06-16-auto-moderation.md +++ /dev/null @@ -1,11 +0,0 @@ ---- -title: "Auto Moderation" -date: "2022-06-16" ---- - -Add new [Auto Moderation feature](/docs/resources/auto-moderation) which enables guilds to moderate message content based on keywords, harmful links, and unwanted spam. This change includes: - -* New endpoints for [creating](/docs/resources/auto-moderation#create-auto-moderation-rule), [updating](/docs/resources/auto-moderation#modify-auto-moderation-rule), and [deleting](/docs/resources/auto-moderation#delete-auto-moderation-rule) Auto Moderation rules -* New gateway events emitted when Auto Moderation rules are [created](/docs/events/gateway-events#auto-moderation-rule-create) (`AUTO_MODERATION_RULE_CREATE`), [updated](/docs/events/gateway-events#auto-moderation-rule-update) (`AUTO_MODERATION_RULE_UPDATE `), and [deleted](/docs/events/gateway-events#auto-moderation-rule-delete) (`AUTO_MODERATION_RULE_DELETE `). Requires the `AUTO_MODERATION_CONFIGURATION` (`1 << 20`) intent -* New gateway event emitted when an [action is executed](/docs/events/gateway-events#auto-moderation-action-execution) (`AUTO_MODERATION_ACTION_EXECUTION`). Requires the `AUTO_MODERATION_EXECUTION` (`1 << 21`) intent -* New [audit log entries](/docs/resources/audit-log#audit-log-entry-object-audit-log-events) when rules are created (`AUTO_MODERATION_RULE_CREATE`), updated (`AUTO_MODERATION_RULE_UPDATE`), or deleted (`AUTO_MODERATION_RULE_DELETE`), or when Auto Moderation performs an action (`AUTO_MODERATION_BLOCK_MESSAGE`) diff --git a/docs/change-log/2022-06-17-updated-connection-property-field-names.md b/docs/change-log/2022-06-17-updated-connection-property-field-names.md deleted file mode 100644 index 351f326920..0000000000 --- a/docs/change-log/2022-06-17-updated-connection-property-field-names.md +++ /dev/null @@ -1,8 +0,0 @@ ---- -title: "Updated Connection Property Field Names" -date: "2022-06-17" ---- - -The `$` prefix in [identify connection properties](/docs/events/gateway-events#identify-identify-connection-properties) are deprecated. The new field names are `os`, `browser`, and `device`. When passed, the `$`-prefixed names will resolve to the new ones. - -In API v11, support for the previous field names (`$os`, `$browser`, and `$device`) will be removed. diff --git a/docs/change-log/2022-06-21-message-content-in-auto-moderation-events.md b/docs/change-log/2022-06-21-message-content-in-auto-moderation-events.md deleted file mode 100644 index 25fa593f02..0000000000 --- a/docs/change-log/2022-06-21-message-content-in-auto-moderation-events.md +++ /dev/null @@ -1,7 +0,0 @@ ---- -title: "Message Content in Auto Moderation events" -date: "2022-06-21" -breaking: true ---- - -In API v10, the `MESSAGE_CONTENT` (`1 << 15`) intent is now required to receive non-empty values for the `content` and `matched_content` fields in [`AUTO_MODERATION_ACTION_EXECUTION`](/docs/events/gateway-events#auto-moderation-action-execution) gateway events. This matches the intended behavior for message content across the API. diff --git a/docs/change-log/2022-06-29-calculated-permissions-in-interaction-payloads.md b/docs/change-log/2022-06-29-calculated-permissions-in-interaction-payloads.md deleted file mode 100644 index 4725d09906..0000000000 --- a/docs/change-log/2022-06-29-calculated-permissions-in-interaction-payloads.md +++ /dev/null @@ -1,8 +0,0 @@ ---- -title: "Calculated Permissions in Interaction Payloads" -date: "2022-06-29" ---- - -Interaction payloads now contain an `app_permissions` field whose value is the computed [permissions](/docs/topics/permissions#permissions-bitwise-permission-flags) for a bot or app in the context of a specific interaction (including any channel overwrites). Similar to other permission fields, the value of `app_permissions` is a bitwise OR-ed set of permissions expressed as a string. Read details in the [interactions documentation](/docs/interactions/receiving-and-responding#interaction-object). - -For apps without a bot user (or without the `bot` scope), the value of `app_permissions` will be the same as the permissions for `@everyone`, but limited to the permissions that can be used in interaction responses (currently `ATTACH_FILES`, `EMBED_LINKS`, `MENTION_EVERYONE`, and `USE_EXTERNAL_EMOJIS`). diff --git a/docs/change-log/2022-06-29-changes-to-bot-permissions-for-interactions-and-webhooks.md b/docs/change-log/2022-06-29-changes-to-bot-permissions-for-interactions-and-webhooks.md deleted file mode 100644 index 5db2faefd1..0000000000 --- a/docs/change-log/2022-06-29-changes-to-bot-permissions-for-interactions-and-webhooks.md +++ /dev/null @@ -1,26 +0,0 @@ ---- -title: "Changes to Bot Permissions for Interactions and Webhooks" -date: "2022-06-29" -breaking: true ---- - -#### Upcoming Changes - -:::warn -`MENTION_EVERYONE`, `SEND_TTS_MESSAGES` and `USE_EXTERNAL_EMOJIS` are the only permissions that will be affected by this change. In a previous version of this changelog, it was indicated that `ATTACH_FILES` and `EMBED_LINKS` would be affected but this is no longer the case. -::: - -Starting **August 3, 2022**, the way some of a bot's `MENTION_EVERYONE`, `SEND_TTS_MESSAGES` and `USE_EXTERNAL_EMOJIS` [permissions](/docs/topics/permissions#permissions) are calculated is changing in two cases: - -* When **responding to an [interaction](/docs/interactions/receiving-and-responding)** (like application commands or message components) -* When **executing a [webhook](/docs/resources/webhook) that the bot created** - -Going forward, in the above cases, a bot’s `MENTION_EVERYONE`, `SEND_TTS_MESSAGES` and `USE_EXTERNAL_EMOJIS` permissions will be calculated based on the permissions its granted, *including* any [overwrites](/docs/topics/permissions#permission-overwrites). Previously, a bot’s permissions in these cases relied only on those granted to `@everyone`. - -This change *only* applies to bots. The permissions for an app without a bot user (or without the `bot` scope) will still depend on `@everyone`. - -#### Updating Your App - -If your bot wants to use the `MENTION_EVERYONE`, `SEND_TTS_MESSAGES` or `USE_EXTERNAL_EMOJIS` permissions when responding to interactions or executing a webhook, **ensure that the bot was installed (or explicitly granted) with them**. - -Note that even if your bot is installed with certain permissions, they can be changed using overwrites. For interactions, you can use the [`app_permissions` field](/docs/interactions/receiving-and-responding#interaction-object-interaction-structure) to determine your app or bot's contextual permissions before replying. diff --git a/docs/change-log/2022-07-01-add-subcommand-groups-and-subcommands-to-message-interaction-objects.md b/docs/change-log/2022-07-01-add-subcommand-groups-and-subcommands-to-message-interaction-objects.md deleted file mode 100644 index 06ab2203f9..0000000000 --- a/docs/change-log/2022-07-01-add-subcommand-groups-and-subcommands-to-message-interaction-objects.md +++ /dev/null @@ -1,26 +0,0 @@ ---- -title: "Add Subcommand Groups and Subcommands to Message Interaction Objects" -date: "2022-07-01" -breaking: true ---- - -While this is a breaking change, most apps only rely on interaction responses (`INTERACTION_CREATE`), *not* message interaction objects (`MESSAGE_CREATE`). [Interaction responses](/docs/interactions/receiving-and-responding#interaction-object-interaction-data) are unaffected by this change. - -#### Upcoming Changes - -Starting **July 18, 2022**, the `name` field for [message interaction objects](/docs/interactions/receiving-and-responding#message-interaction-object) will now include subcommands and subcommand groups in the value (along with the existing top-level command). In the future, we recommend not relying on this message interaction field. - -The format of the value will be the different command levels (if they exist), separated by spaces: -` ` - -The `name` field is only seen on messages that are a response to an interaction without an existing message, so interaction objects for message components don’t include this field. - -#### Updating your app - -Most apps only rely on interaction responses, not message interaction objects. - -We don't recommend that your app relies on the `name` field for message interactions objects, but if it does you should update your app to handle subcommands and subcommand groups that your app may encounter. - -As an example of the change, pretend your app had a command `/role` with subcommands `add` and `remove`. Currently, the `name` field in the original interaction payload would contain `role`. If you responded to that interaction with a message then fetched its contents, the `name` field for that message interaction object would contain `role` as well. - -After this change, the `name` field for the original interaction payload will still contain `role`. However, now if you responded to that interaction with a message then fetched its contents, the `name` field for that message interaction object would contain `role add` or `role remove`. diff --git a/docs/change-log/2022-07-01-min-and-max-length-for-command-options.md b/docs/change-log/2022-07-01-min-and-max-length-for-command-options.md deleted file mode 100644 index 0f98617868..0000000000 --- a/docs/change-log/2022-07-01-min-and-max-length-for-command-options.md +++ /dev/null @@ -1,8 +0,0 @@ ---- -title: "Min and Max Length for Command Options" -date: "2022-07-01" ---- - -Application [command options](/docs/interactions/application-commands#application-command-object-application-command-option-structure) of type `STRING` now includes optional `min_length` and `max_length` fields to control the length of text a user can input. - -The value of `min_length` must be greater or equal to `0`, and the value of `max_length` must be greater or equal to `1`. diff --git a/docs/change-log/2022-07-13-upcoming-permissions-change-to-webhook-routes.md b/docs/change-log/2022-07-13-upcoming-permissions-change-to-webhook-routes.md deleted file mode 100644 index 5c4d943417..0000000000 --- a/docs/change-log/2022-07-13-upcoming-permissions-change-to-webhook-routes.md +++ /dev/null @@ -1,12 +0,0 @@ ---- -title: "Upcoming Permissions Change to Webhook Routes" -date: "2022-07-13" ---- - -On August 8th, 2022 we will begin requiring the `VIEW_CHANNEL (1 << 10)` permission for webhook routes which require `MANAGE_WEBHOOKS (1 << 29)`, to align with our documented behavior. We don't expect that many applications will be affected by this, but in case you are, please ensure you have updated permissions needed for accessing the following routes: - -* [`GET /webhooks/{webhook.id}`](/docs/resources/webhook#get-webhook) -* [`DELETE /webhooks/{webhook.id}`](/docs/resources/webhook#delete-webhook) -* [`PATCH /webhooks/{webhook.id}`](/docs/resources/webhook#modify-webhook) -* [`GET /channels/{channel.id}/webhooks`](/docs/resources/webhook#get-channel-webhooks) -* [`POST /channels/{channel.id}/webhooks`](/docs/resources/webhook#create-webhook) diff --git a/docs/change-log/2022-08-09-session-specific-gateway-resume-urls.md b/docs/change-log/2022-08-09-session-specific-gateway-resume-urls.md deleted file mode 100644 index 372e85d8ed..0000000000 --- a/docs/change-log/2022-08-09-session-specific-gateway-resume-urls.md +++ /dev/null @@ -1,12 +0,0 @@ ---- -title: "Session-specific Gateway Resume URLs" -date: "2022-08-09" ---- - -:::warn -Starting on **September 12, 2022**, apps that aren’t using the new `resume_gateway_url` field to resume gateway sessions will be disconnected significantly faster than normal. -::: - -A new `resume_gateway_url` field has been added to the [Ready](/docs/events/gateway-events#ready) gateway event to support session-specific gateway connections. The value of `resume_gateway_url` is a session-specific URL that should be used when resuming the gateway session after a disconnect. Previously, `wss://gateway.discord.gg` was used to connect *and* resume sessions, but should now only be used during the connection. - -At the moment, the value of `resume_gateway_url` will always be `wss://gateway.discord.gg` to give developers more time to adopt the new field. In the near future, the value will change to the session-specific URLs. diff --git a/docs/change-log/2022-08-22-slash-command-mentions.md b/docs/change-log/2022-08-22-slash-command-mentions.md deleted file mode 100644 index 5f7c452374..0000000000 --- a/docs/change-log/2022-08-22-slash-command-mentions.md +++ /dev/null @@ -1,8 +0,0 @@ ---- -title: "Slash Command Mentions" -date: "2022-08-22" ---- - -This week, [Slash Command mentions](/docs/reference#message-formatting) are rolling out across all Discord clients (for Android, mentions are limited to the [React Native client](https://discord.com/blog/android-react-native-framework-update)). Clicking a Slash Command mention will auto-populate the command in the user's message input. - -Slash Command mentions use the following format: ``. You can also use `` and `` for subcommands and subcommand groups. diff --git a/docs/change-log/2022-09-01-message-content-is-a-privileged-intent.md b/docs/change-log/2022-09-01-message-content-is-a-privileged-intent.md deleted file mode 100644 index 871f445f18..0000000000 --- a/docs/change-log/2022-09-01-message-content-is-a-privileged-intent.md +++ /dev/null @@ -1,23 +0,0 @@ ---- -title: "Message Content is a Privileged Intent" -date: "2022-09-01" -breaking: true ---- - -As of today, [message content](/docs/events/gateway#message-content-intent) is a privileged intent for all verified apps *and* apps eligible for verification. More details about why it's becoming a privileged intent and how to apply for it is in the [Help Center FAQ](https://support-dev.discord.com/hc/articles/4404772028055-Message-Content-Privileged-Intent-FAQ). - -Any app that does not have the message content intent configured in its app's settings within the Developer Portal will receive empty values in fields that expose message content across Discord's APIs (including the `content`, `embeds`, `attachments`, and `components` fields). These restrictions do not apply for messages that a bot or app sends, in DMs that it receives, or in messages in which it is mentioned. - -#### If your app is verified - -Verified apps and verification-eligible apps must be approved for the message content intent to receive message content. If your verified app isn’t approved, or doesn’t account for the new message content restrictions, it will break for users. - -##### Temporary Message Content Intent - -Verified apps or apps that have submitted for verification can temporarily opt-in to a grace period which will allow your app to continue receiving message content until October 1. However, if you opt-in to the grace period, your app will be prevented from joining any additional servers until you opt-out. More details are in the [Help Center article](https://support-dev.discord.com/hc/en-us/articles/8561391080471). - -#### If your app is unverified - -Unverified apps must still must enable the intent in your app’s settings within the Developer Portal. - -Existing unverified apps will automatically have the message content intent toggled on in their settings. New unverified apps will have to manually toggle the intent in the Developer Portal. diff --git a/docs/change-log/2022-09-14-forum-channels-release.md b/docs/change-log/2022-09-14-forum-channels-release.md deleted file mode 100644 index c94ee3f568..0000000000 --- a/docs/change-log/2022-09-14-forum-channels-release.md +++ /dev/null @@ -1,8 +0,0 @@ ---- -title: "Forum Channels Release" -date: "2022-09-14" ---- - -Forum channels ([`GUILD_FORUM` or `15`](/docs/resources/channel#channel-object-channel-types)) have been released to all community servers. `GUILD_FORUM` channels are a new channel type that only supports threads, which display differently than in text (`GUILD_TEXT`) channels. - -Check out the [forums topic](/docs/topics/threads#forums) for more information on the relevant APIs and technical details, and the [Forums FAQ](https://support.discord.com/hc/en-us/articles/6208479917079-Forum-Channels-FAQ#h_01G69FJQWTWN88HFEHK7Z6X79N) for more about the feature. diff --git a/docs/change-log/2022-09-21-auto-moderation-spam-and-mention-spam-trigger-types.md b/docs/change-log/2022-09-21-auto-moderation-spam-and-mention-spam-trigger-types.md deleted file mode 100644 index 4837b24829..0000000000 --- a/docs/change-log/2022-09-21-auto-moderation-spam-and-mention-spam-trigger-types.md +++ /dev/null @@ -1,11 +0,0 @@ ---- -title: "Auto Moderation Spam and Mention Spam Trigger Types" -date: "2022-09-21" ---- - -Two new [trigger types](/docs/resources/auto-moderation#auto-moderation-rule-object-trigger-types) were added to Auto Moderation: - -* `MENTION_SPAM` blocks messages that mention more than a set number of unique server members or roles. Apps can define the number (up to 50) using the `mention_total_limit` field in the [trigger metadata object](/docs/resources/auto-moderation#auto-moderation-rule-object-trigger-metadata) when creating or updating an Auto Moderation rule. -* `SPAM` blocks links and messages that are identified as spam. - -More information can be found in the [Auto Moderation documentation](/docs/resources/auto-moderation). diff --git a/docs/change-log/2022-09-22-default-sort-order-for-forum-channels.md b/docs/change-log/2022-09-22-default-sort-order-for-forum-channels.md deleted file mode 100644 index 26186c61c4..0000000000 --- a/docs/change-log/2022-09-22-default-sort-order-for-forum-channels.md +++ /dev/null @@ -1,8 +0,0 @@ ---- -title: "Default Sort Order for Forum Channels" -date: "2022-09-22" ---- - -`default_sort_order` is an optional field in the [channel object](/docs/resources/channel) that indicates how the threads in a [forum channel](/docs/topics/threads#forums) will be sorted for users by default. Setting `default_sort_order` requires the `MANAGE_CHANNELS` permission. - -If `default_sort_order` hasn't been set, its value will be `null`. diff --git a/docs/change-log/2022-10-13-new-select-menu-components.md b/docs/change-log/2022-10-13-new-select-menu-components.md deleted file mode 100644 index 8704c710e5..0000000000 --- a/docs/change-log/2022-10-13-new-select-menu-components.md +++ /dev/null @@ -1,15 +0,0 @@ ---- -title: "New Select Menu Components" -date: "2022-10-13" ---- - -Four new select menu [component types](/docs/components/reference#component-object-component-types) have been added to make it easier to populate selects with common resources in Discord: - -* User select (type `5`) -* Role select (type `6`) -* Mentionable (user *and* role) select (type `7`) -* Channel select (type `8`) - -The new select menu components are defined similarly to the existing string select menu—with the exception of not including the `options` field and, within channel select menus, having the option to include a `channel_types` field. The [select menu interaction](/docs/components/reference#user-select-examples) apps receive also contain a [`resolved` field](/docs/components/reference#user-select-examples) for the new components. - -More details can be found in the updated [select menu documentation](/docs/components/reference#component-object-component-types). diff --git a/docs/change-log/2022-10-20-delete-ephemeral-messages.md b/docs/change-log/2022-10-20-delete-ephemeral-messages.md deleted file mode 100644 index 5c57fe9185..0000000000 --- a/docs/change-log/2022-10-20-delete-ephemeral-messages.md +++ /dev/null @@ -1,11 +0,0 @@ ---- -title: "Delete Ephemeral Messages" -date: "2022-10-20" ---- - -Ephemeral interaction responses and follow-ups can now be deleted with a valid interaction token using the following endpoints: - -* [`DELETE /webhooks///messages/@original`](/docs/interactions/receiving-and-responding#delete-original-interaction-response) -* [`DELETE /webhooks///messages/`](/docs/interactions/receiving-and-responding#delete-followup-message) - -As a reminder, interaction tokens stay valid for up to 15 minutes after the interaction occurs. Details can be found in the [interaction documentation](/docs/interactions/receiving-and-responding). diff --git a/docs/change-log/2022-11-04-add-auto-moderation-regex-support.md b/docs/change-log/2022-11-04-add-auto-moderation-regex-support.md deleted file mode 100644 index 006cfd8f10..0000000000 --- a/docs/change-log/2022-11-04-add-auto-moderation-regex-support.md +++ /dev/null @@ -1,8 +0,0 @@ ---- -title: "Add Auto Moderation Regex Support" -date: "2022-11-04" ---- - -Auto Moderation rules with [trigger\_type](/docs/resources/auto-moderation#auto-moderation-rule-object-trigger-types) `KEYWORD` now support -a `regex_patterns` field in its [trigger\_metadata](/docs/resources/auto-moderation#auto-moderation-rule-object-trigger-types). -Regex patterns are a powerful way to describe many keywords all at once using one expression. Only Rust flavored regex is supported, which can be tested in online editors such as [Rustexp](https://rustexp.lpil.uk/). diff --git a/docs/change-log/2022-11-09-gamesdk-feature-deprecation.md b/docs/change-log/2022-11-09-gamesdk-feature-deprecation.md deleted file mode 100644 index 00b1b88c7f..0000000000 --- a/docs/change-log/2022-11-09-gamesdk-feature-deprecation.md +++ /dev/null @@ -1,21 +0,0 @@ ---- -title: "GameSDK Feature Deprecation" -date: "2022-11-09" -breaking: true ---- - -To help keep us focused on the features, improvements, and gaming-related experiences that Discord users love, we are deprecating the following pieces of the GameSDK **starting today**, and decommissioning them on **Tuesday, May 2, 2023**: - - * [Achievements](https://github.com/discord/discord-api-docs/blob/legacy-gamesdk/docs/game_sdk/Achievements.md) - * [Applications](https://github.com/discord/discord-api-docs/blob/legacy-gamesdk/docs/game_sdk/Applications.md) - * [Voice](https://github.com/discord/discord-api-docs/blob/legacy-gamesdk/docs/game_sdk/Discord_Voice.md) - * [Images](https://github.com/discord/discord-api-docs/blob/legacy-gamesdk/docs/game_sdk/Images.md) - * [Lobbies](https://github.com/discord/discord-api-docs/blob/legacy-gamesdk/docs/game_sdk/Lobbies.md) - * [Networking](https://github.com/discord/discord-api-docs/blob/legacy-gamesdk/docs/game_sdk/Networking.md) - * [Relationships](https://github.com/discord/discord-api-docs/blob/legacy-gamesdk/docs/game_sdk/Relationships.md) - * [Storage](https://github.com/discord/discord-api-docs/blob/legacy-gamesdk/docs/game_sdk/Storage.md) - * [Store](https://github.com/discord/discord-api-docs/blob/legacy-gamesdk/docs/game_sdk/Store.mdmd) - -This deprecation period will last until **Tuesday May 2, 2023**, after which these pieces will be decommissioned and no longer work. The other pieces of the GameSDK will continue to be supported. - -We know that Discord is an important place for people to find belonging, and that using your Discord identity in games is a crucial part of that sense of belonging. You’ll still be able to use the GameSDK to integrate Rich Presence, relationships, entitlements, basic user information, and the overlay. diff --git a/docs/change-log/2022-11-17-upcoming-application-command-permission-changes.md b/docs/change-log/2022-11-17-upcoming-application-command-permission-changes.md deleted file mode 100644 index 13d21a536f..0000000000 --- a/docs/change-log/2022-11-17-upcoming-application-command-permission-changes.md +++ /dev/null @@ -1,129 +0,0 @@ ---- -title: "Upcoming Application Command Permission Changes" -date: "2022-11-17" -breaking: true ---- - -Based on feedback, we’re updating permissions for [application commands](/docs/interactions/application-commands) to simplify permission management and to make command permissions more closely resemble other permissions systems in Discord. - -Server admins can begin to opt-in to the command permission changes outlined here on a per-server basis **starting on December 16, 2022**. However, changes will not be applied to all servers **until late January or early February**. - -:::info -Current permissions behavior is documented in [the application commands documentation](/docs/interactions/application-commands#permissions) and in [the changelog for the previous permissions update](/docs/change-log#updated-command-permissions) -::: - -These changes are focused on how configured permissions are used by Discord clients, so most apps will be unaffected. However, if your app uses the [Update Permissions endpoint](/docs/interactions/application-commands#edit-application-command-permissions) (`PUT /applications//guilds//commands//permissions`), you may need to make updates and should read these changes carefully. - -#### Types of command permission configurations - -:::info -The following information isn’t changing, but it’s helpful context to understand the changes. -::: - -Discord’s clients determine whether a user can see or invoke a command based on three different permission configurations: - -* **Command-level permissions** are set up by an admin for a specific *command* in their server. These permissions affect only a specific command. -* **App-level permissions** are set up by an admin for a specific *app* in their server. These permissions affect all commands for an app. -* **`default_member_permissions`** are set up by an app when creating or updating a command. `default_member_permissions` apply to that command in *all* servers (unless an override exists). More information about `default_member_permissions` is [in the documentation](/docs/interactions/application-commands#application-command-permissions-object-using-default-permissions). - -The concepts of these permission configurations are not changing. But then of course, the question becomes… - -### What's changing? - -There are two changes around command permissions: - -1. The logic used to apply permission configurations to a user in a given context within Discord clients -2. New `APPLICATION_COMMAND_PERMISSIONS_V2` guild feature flag to indicate whether that guild is using the old permissions logic or the new (upcoming) logic. - -Let's go deeper into both of these. - -#### 1. How permission configurations are applied in Discord - -##### Current behavior: - -Currently, these systems are **mutually-exclusive**, meaning that only one type of permission configuration is used to determine whether a user can invoke a command. - -With this current system, there is a clear hierarchy: command-level permission configurations take precedence (if present), then app-level permission configurations (if present), and finally `default_member_permissions` if neither are present. - -The implication of the current permissions system means that: - -* If any command-level permissions are configured, all app-level permissions and `default_member_permissions` are ignored for that command. -* If any app-level permissions are configured, `default_member_permissions` is ignored for *all* of that app’s commands. - -This system leads to unintentional permission escalations, and can force moderators to manually re-define their app-level configurations to make small tweaks on the command-level. - -##### Upcoming behavior: - -The new system removes the mutual exclusion aspect, meaning that the different types of permission configurations work together rather than independently—specifically, more than one may be used to determine whether a user can invoke a command. - -**`default_member_permissions` continues to act as a “default” that a developer can set when creating or updating a command.** - -**App-level permission configurations now act as the "base" configuration.** - -App-level configurations define who is allowed to use the app and where. These will work *together* with `default_member_permissions`, meaning if a user is granted access via an app-level permission configuration, they will still be restricted to the `default_member_permissions` for each command (by default). No more accidentally granting `/ban` which requires `BAN_MEMBERS` to `@BotMemers` just because you gave them access to the app! - -**Command-level permission configurations now act as an “override” of the app-level.** - -Command-level configurations override what is present at the app-level *and* any restrictions set by `default_member_permissions`. This means that an admin can explicitly grant a user access to a specific command even if they are denied access on the app-level *or* if they don't have permissions that meet that command's `default_member_permissions`. - -If a command-level configuration does not exist for the given context, the system will fall back to looking at the app-level configuration. - -##### Flowchart for command permissions logic - -Below is a simplified flowchart that illustrates how permissions will be applied by the Discord client after the new changes take effect. - -![Flowchart with an overview of the new permissions configurations logic](images/new-permissions-flowchart.svg) - -#### 2. `APPLICATION_COMMAND_PERMISSIONS_V2` Guild Feature - -We added a new [`APPLICATION_COMMAND_PERMISSIONS_V2` feature flag](/docs/resources/guild#guild-object-guild-features) which indicates whether that server is using **the current permissions logic**. - -* If the flag *is* present, that server is using the old command permissions behavior. -* If the flag *is not* present, that server has migrated from the old command permissions behavior to the new behavior. - -### Am I affected? - -Your app will only be affected if it uses the [`PUT /applications//guilds//commands//permissions`](/docs/interactions/application-commands#edit-application-command-permissions) endpoint. This is a pretty restricted endpoint used to manage and update application command permissions on behalf of admins, meaning that it requires the `applications.commands.permissions.update` scope. - -**If your app doesn’t use this endpoint, there’s nothing you need to prepare for these changes.** - -If your app does use this endpoint, you should read the section on preparing for changes below. - -### How do I prepare for the changes? - -To prepare for these changes, you should take two steps: - -**1. Use the `APPLICATION_COMMAND_PERMISSIONS_V2` flag** - -Use this flag to determine which permissions logic that server is using. While the transition from the old behavior to the new behavior is happening, you may need two code paths depending on if the flag is present or not. - -```py -if 'APPLICATION_COMMAND_PERMISSIONS_V2' in guild.features: - # Use current behaviors when interacting with endpoint -else: - # Use new permissions behaviors when interacting with endpoint -``` - -:::info -If you don’t have access to guild features already through Gateway events, you can fetch that information using the [`GET /guilds/` endpoint](/docs/resources/guild#get-guild). -::: - -**2. Modify the behavior based on your use case** - -After you know what permissions behavior the server is using, you should update how you handle that server specifically. - -To understand what changes you need to make, you should look at the assumptions users have when your app updates their server’s commands permissions. Do you have a web dashboard where admins update permissions? If so, analyze the logic of that dashboard and what your permission configurations are trying to do to map them to the new permissions behavior. Do you document what your app is doing in regards to certain command permissions you’re configuring on behalf of the admin? If so, map that documentation to the new behavior. - -If you are unsure, you can communicate with your admin users to ask if your new logic meets their expectations. - -#### What happens if I don’t update my app? - -If your app is affected and you don’t update it, permissions behavior that your app configures may not match what you or the users of your app expect. - -#### How long do I have to update my app? - -The new `APPLICATION_COMMAND_PERMISSIONS_V2` flag is already live, and you should start seeing it in guilds’ feature flags. - -The new permissions behavior will roll out **on December 16, 2022**. On this date, admins will begin to see a banner that allows them to *optionally* move their server to the new behavior. - -In **late January or early February**, all servers will be migrated to the new behavior. We'll post another changelog at this point, at which time you can remove any logic around the old permissions behavior. diff --git a/docs/change-log/2022-11-22-add-auto-moderation-allow-list-for-keyword-rules-and-increase-max-keyword-rules-per-guild-limit.md b/docs/change-log/2022-11-22-add-auto-moderation-allow-list-for-keyword-rules-and-increase-max-keyword-rules-per-guild-limit.md deleted file mode 100644 index 0d85293a43..0000000000 --- a/docs/change-log/2022-11-22-add-auto-moderation-allow-list-for-keyword-rules-and-increase-max-keyword-rules-per-guild-limit.md +++ /dev/null @@ -1,8 +0,0 @@ ---- -title: "Add Auto Moderation Allow List for Keyword Rules and Increase Max Keyword Rules Per Guild Limit" -date: "2022-11-22" ---- - -* Auto Moderation rules with [trigger\_type](/docs/resources/auto-moderation#auto-moderation-rule-object-trigger-types) `KEYWORD` now support an `allow_list` field in its [trigger\_metadata](/docs/resources/auto-moderation#auto-moderation-rule-object-trigger-metadata). Any message content that matches an `allow_list` keyword will be ignored by the Auto Moderation `KEYWORD` rule. Each `allow_list` keyword can be a multi-word phrase and can contain [wildcard symbols](/docs/resources/auto-moderation#auto-moderation-rule-object-keyword-matching-strategies). -* Increase maximum number of rules with `KEYWORD` [trigger\_type](/docs/resources/auto-moderation#auto-moderation-rule-object-trigger-types) per guild from 3 to 5 -* Increase maximum length for each regex pattern in the `regex_patterns` [trigger\_metadata](/docs/resources/auto-moderation#auto-moderation-rule-object-trigger-metadata) field from 75 to 260. diff --git a/docs/change-log/2022-12-12-add-application-connections-metadata-and-linked-roles.md b/docs/change-log/2022-12-12-add-application-connections-metadata-and-linked-roles.md deleted file mode 100644 index d1bdb0560d..0000000000 --- a/docs/change-log/2022-12-12-add-application-connections-metadata-and-linked-roles.md +++ /dev/null @@ -1,16 +0,0 @@ ---- -title: "Add Application Connections Metadata and Linked Roles" -date: "2022-12-12" ---- - -Introducing [linked roles](https://discord.com/blog/connected-accounts-functionality-boost-linked-roles) as well as the ability for all developers to set up their own linked roles with an application. This includes: - -* New [`role_connections_verification_url`](/docs/resources/application#application-object) that can be set in the developer portal in order for the application to render as potential verification option for linked roles. -* [Application metadata](/docs/resources/application-role-connection-metadata#application-role-connection-metadata-object) to specify more detailed linked role requirements. -* New endpoints to [retrieve](/docs/resources/application-role-connection-metadata#get-application-role-connection-metadata-records) (`GET /applications//role-connections/metadata`) and [update](/docs/resources/application-role-connection-metadata#update-application-role-connection-metadata-records) (`PUT /applications//role-connections/metadata`) application connection metadata. -* New [`role_connections.write`](/docs/topics/oauth2#shared-resources-oauth2-scopes) OAuth2 scope required to authenticate the below requests. -* Endpoints to [retrieve](/docs/resources/user#get-current-user-application-role-connection) (`GET /users/@me/applications/{application.id}/role-connection`) and [update](/docs/resources/user#update-current-user-application-role-connection) (`PUT /users/@me/applications/{application.id}/role-connection`) a user's role connections, both of which return an [application role connection](/docs/resources/user#application-role-connection-object) object. - -:::info -For a quick rundown on how to get started using linked roles, refer to the [tutorial](/docs/tutorials/configuring-app-metadata-for-linked-roles). -::: diff --git a/docs/change-log/2022-12-13-add-default-layout-setting-for-forum-channels.md b/docs/change-log/2022-12-13-add-default-layout-setting-for-forum-channels.md deleted file mode 100644 index 496a459d23..0000000000 --- a/docs/change-log/2022-12-13-add-default-layout-setting-for-forum-channels.md +++ /dev/null @@ -1,8 +0,0 @@ ---- -title: "Add Default Layout setting for Forum channels" -date: "2022-12-13" ---- - -`default_forum_layout` is an optional field in the [channel object](/docs/resources/channel) that indicates the default layout for posts in a [forum channel](/docs/topics/threads#forums). A value of 1 (`LIST_VIEW`) indicates that posts will be displayed as a chronological list, and 2 (`GALLERY_VIEW`) indicates they will be displayed as a collection of tiles. If `default_forum_layout` hasn't been set, the value will be `0`. - -Setting `default_forum_layout` requires the `MANAGE_CHANNELS` permission. diff --git a/docs/change-log/2023-01-09-thread-member-details-and-pagination.md b/docs/change-log/2023-01-09-thread-member-details-and-pagination.md deleted file mode 100644 index d0f89fea58..0000000000 --- a/docs/change-log/2023-01-09-thread-member-details-and-pagination.md +++ /dev/null @@ -1,13 +0,0 @@ ---- -title: "Thread Member Details and Pagination" -date: "2023-01-09" -breaking: true ---- - -A new `member` field was added to the [thread member object](/docs/resources/channel#thread-member-object). `member` is a [guild member object](/docs/resources/guild#guild-member-object) that will be included within returned thread member objects when the new `with_member` field is set to `true` in the [List Thread Members](/docs/resources/channel#list-thread-members) (`GET /channels//thread-members`) and [Get Thread Member](/docs/resources/channel#get-thread-member) (`GET /channels//thread-members/`) endpoints. - -Setting `with_member` to `true` will also enable pagination for the [List Thread Members](/docs/resources/channel#list-thread-members) endpoint. When the results are paginated, you can use the new `after` and `limit` fields to fetch additional thread members and limit the number of thread members returned. By default, `limit` is 100. - -#### Upcoming Changes - -Starting in API v11, [List Thread Members](/docs/resources/channel#list-thread-members) (`GET /channels//thread-members`) will *always* return paginated results, regardless of whether `with_member` is passed or not. diff --git a/docs/change-log/2023-01-18-guild-audit-log-events.md b/docs/change-log/2023-01-18-guild-audit-log-events.md deleted file mode 100644 index 0bbb3ac208..0000000000 --- a/docs/change-log/2023-01-18-guild-audit-log-events.md +++ /dev/null @@ -1,6 +0,0 @@ ---- -title: "Guild Audit Log Events" -date: "2023-01-18" ---- - -At long last, a new [`GUILD_AUDIT_LOG_ENTRY_CREATE`](/docs/events/gateway-events#guild-audit-log-entry-create) event has been added to the gateway, allowing your application to react to moderation actions in guilds. The `VIEW_AUDIT_LOG` permission is required in order to receive these events, and the [`GUILD_MODERATION` intent](/docs/events/gateway#gateway-intents) needs to be set when connecting to the gateway. diff --git a/docs/change-log/2023-02-08-increase-auto-moderation-keyword-limits.md b/docs/change-log/2023-02-08-increase-auto-moderation-keyword-limits.md deleted file mode 100644 index 8a6e6d61bc..0000000000 --- a/docs/change-log/2023-02-08-increase-auto-moderation-keyword-limits.md +++ /dev/null @@ -1,7 +0,0 @@ ---- -title: "Increase Auto Moderation Keyword Limits" -date: "2023-02-08" ---- - -* Increase maximum number of rules with `KEYWORD` [trigger\_type](/docs/resources/auto-moderation#auto-moderation-rule-object-trigger-types) per guild from 5 to 6 -* Increase maximum length for each keyword in the `keyword_filter` and `allow_list` [trigger\_metadata](/docs/resources/auto-moderation#auto-moderation-rule-object-trigger-metadata) fields from 30 to 60. diff --git a/docs/change-log/2023-02-10-update-to-locked-threads.md b/docs/change-log/2023-02-10-update-to-locked-threads.md deleted file mode 100644 index 930be22417..0000000000 --- a/docs/change-log/2023-02-10-update-to-locked-threads.md +++ /dev/null @@ -1,16 +0,0 @@ ---- -title: "Update to Locked Threads" -date: "2023-02-10" ---- - -### Upcoming Changes - -Currently, threads in Discord (including forum posts) can either be archived or both locked and archived. Starting on **March 6, 2023**, threads will be able to be locked *without* being archived, which will slightly change the meaning of the [`locked` field](/docs/resources/channel#thread-metadata-object-thread-metadata-structure). - -`locked` currently indicates that a thread cannot be reopened by a user without the [`MANAGE_THREADS` (`1 << 34`) permission](/docs/topics/permissions#permissions-bitwise-permission-flags), but it doesn't restrict user activity within active (meaning non-archived) threads. After this change, users (including bot users) without the `MANAGE_THREADS` permission will be more restricted in locked threads. Users won't be able to create or update messages in locked threads, or update properties like its title or tags. Additionally, some user activity like deleting messages and adding or removing reactions will *only* be allowed in locked threads if that thread is also active (or un-archived). - -If a user or bot user has the `MANAGE_THREADS` permission, they will still be able to make changes to the thread and messages. The upcoming change does not affect the meaning of the [`archived` field](/docs/resources/channel#thread-metadata-object-thread-metadata-structure) or the behavior of a thread that is both locked and archived. - -### How do I prepare for this change? - -If your app is interacting with threads (including forum posts), it should check the state of the `locked` and/or `archived` field for the thread to understand which actions it can or cannot perform. It should also be prepared to handle any errors that it may receive when a thread is locked. diff --git a/docs/change-log/2023-02-24-add-auto-moderation-custom-message-action-metadata-field.md b/docs/change-log/2023-02-24-add-auto-moderation-custom-message-action-metadata-field.md deleted file mode 100644 index 4aaf655a63..0000000000 --- a/docs/change-log/2023-02-24-add-auto-moderation-custom-message-action-metadata-field.md +++ /dev/null @@ -1,6 +0,0 @@ ---- -title: "Add Auto Moderation custom_message Action Metadata Field" -date: "2023-02-24" ---- - -Add new `custom_message` [action metadata](/docs/resources/auto-moderation#auto-moderation-action-object-action-metadata) for the `BLOCK_MESSAGE` [action type](/docs/resources/auto-moderation#auto-moderation-action-object-action-types)). You can now specify a custom string for every Auto Moderation rule that will be shown to members whenever the rule blocks their message. This can be used as an additional explanation for why a message was blocked and as a chance to help members understand your server's rules and guidelines. diff --git a/docs/change-log/2023-04-06-interaction-channel-data.md b/docs/change-log/2023-04-06-interaction-channel-data.md deleted file mode 100644 index 05d0ec8c58..0000000000 --- a/docs/change-log/2023-04-06-interaction-channel-data.md +++ /dev/null @@ -1,6 +0,0 @@ ---- -title: "Interaction Channel Data" -date: "2023-04-06" ---- - -Interactions now contain a `channel` field which is a partial channel object and guaranteed to contain `id` and `type`. We recommend that you begin using this channel field to identify the source channel of the interaction, and may deprecate the existing `channel_id` field in the future. See the [interaction documentation](/docs/interactions/receiving-and-responding#interaction-object) for more details. diff --git a/docs/change-log/2023-04-14-bot-users-added-to-all-new-apps.md b/docs/change-log/2023-04-14-bot-users-added-to-all-new-apps.md deleted file mode 100644 index 6f3eecd7f0..0000000000 --- a/docs/change-log/2023-04-14-bot-users-added-to-all-new-apps.md +++ /dev/null @@ -1,8 +0,0 @@ ---- -title: "Bot users added to all new apps" -date: "2023-04-14" ---- - -Starting today, [bot users](/docs/topics/oauth2#bot-vs-user-accounts) will be added to all newly-created apps. Settings and configuration options for bot users remain the same, and can still be accessed on the **Bot** page within your [app's settings](https://discord.com/developers/applications). - -If your app doesn't need or want a bot user associated with it, you can refrain from adding the [`bot` scope](/docs/topics/oauth2#shared-resources-oauth2-scopes) when installing your app. diff --git a/docs/change-log/2023-05-03-unique-usernames-on-discord.md b/docs/change-log/2023-05-03-unique-usernames-on-discord.md deleted file mode 100644 index 38b52d6761..0000000000 --- a/docs/change-log/2023-05-03-unique-usernames-on-discord.md +++ /dev/null @@ -1,45 +0,0 @@ ---- -title: "Unique usernames on Discord" -date: "2023-05-03" ---- - -:::warn -Bot users will stay on the legacy username system for now. More details can be found on the [Developer Help Center article](https://dis.gd/app-usernames). -::: - -Discord’s username system is changing. Discriminators are being removed and new, unique usernames and display names are being introduced. You can read more details about how changes to the username system affects non-bot users in the [general Help Center article](https://dis.gd/usernames). To learn how it impacts bot users specifically, you can read the [Developer Help Center article](https://dis.gd/app-usernames). - -This changelog focuses only on the technical changes to be aware of to update your app's code. - -### Identifying migrated users - -The new username system will rollout to users over time rather than all at once. The value of a single zero (`"0"`) in the [`discriminator` field](/docs/resources/user#user-object-user-structure) on a user will indicate that the user has been migrated to the new username system. Note that the discriminator for migrated users will *not* be 4-digits like a standard discriminator (it is `"0"`, not `"0000"`). The value of the `username` field will become the migrated user's unique username. - -After migration of all users is complete, the `discriminator` field may be removed. - -#### Example migrated user - -```json -{ - "id": "80351110224678912", - "username": "nelly", - "discriminator": "0", - "global_name": "Nelly", - "avatar": "8342729096ea3675442027381ff50dfe", - "verified": true, - "email": "nelly@discord.com", - "flags": 64, - "banner": "06c16474723fe537c283b8efa61a30c8", - "accent_color": 16711680, - "premium_type": 1, - "public_flags": 64 -} -``` - -### Display names - -As part of the new username system, standard Discord users can define a non-unique display name. This value will be a new `global_name` field with a max length of 32 characters. If the user has not set a display name, `global_name` will be null. - -### Default avatars - -For users with migrated accounts, default avatar URLs will be based on the user ID instead of the discriminator. The URL can now be calculated using `(user_id >> 22) % 6`. Users on the legacy username system will continue using `discriminator % 5`. diff --git a/docs/change-log/2023-05-05-add-join-raid-and-mention-raid-fields.md b/docs/change-log/2023-05-05-add-join-raid-and-mention-raid-fields.md deleted file mode 100644 index d510c0a11f..0000000000 --- a/docs/change-log/2023-05-05-add-join-raid-and-mention-raid-fields.md +++ /dev/null @@ -1,7 +0,0 @@ ---- -title: "Add Join Raid and Mention Raid fields" -date: "2023-05-05" ---- - -* Add Auto Moderation `mention_raid_protection_enabled` [trigger\_metadata](/docs/resources/auto-moderation#auto-moderation-rule-object-trigger-metadata) field for the `MENTION_SPAM` [trigger\_type](/docs/resources/auto-moderation#auto-moderation-rule-object-trigger-types). If this field and its parent `MENTION_SPAM` rule are enabled, Auto Moderation provides baseline detection against sudden spikes in mention activity that are normally indicative of mention raids. -* Add `safety_alerts_channel_id` [guild](/docs/resources/guild#guild-object) field and [`RAID_ALERTS_DISABLED` guild feature flag](/docs/resources/guild#guild-object-guild-features) which are associated with join raid protection diff --git a/docs/change-log/2023-08-01-new-guild-media-channel-type.md b/docs/change-log/2023-08-01-new-guild-media-channel-type.md deleted file mode 100644 index 09fc576d35..0000000000 --- a/docs/change-log/2023-08-01-new-guild-media-channel-type.md +++ /dev/null @@ -1,8 +0,0 @@ ---- -title: "New GUILD_MEDIA channel type" -date: "2023-08-01" ---- - -* Add the [`GUILD_MEDIA` (16) channel type](/docs/resources/channel#channel-object-channel-types). `GUILD_MEDIA` channels only support threads, similar to `GUILD_FORUM` channels. - -Read the [media channel topic](/docs/topics/threads#media-channels) for more information on the relevant APIs and technical details, or the [media channel Help Center Article](https://creator-support.discord.com/hc/en-us/articles/14346342766743) for more about the feature. diff --git a/docs/change-log/2023-08-02-public-preview-of-openapi-3.1-specification.md b/docs/change-log/2023-08-02-public-preview-of-openapi-3.1-specification.md deleted file mode 100644 index 20190f5a24..0000000000 --- a/docs/change-log/2023-08-02-public-preview-of-openapi-3.1-specification.md +++ /dev/null @@ -1,12 +0,0 @@ ---- -title: "Public Preview of OpenAPI 3.1 Specification" -date: "2023-08-02" ---- - -We're introducing an [OpenAPI 3.1 spec](https://github.com/discord/discord-api-spec) in public preview to make it easier and more reliable to develop with the HTTP API. While our current developer documentation requires manual reviews and updates, the OpenAPI spec is generated from the source code which means it better reflects the nooks, crannies, and nuances of the Discord API. - -:::warn -The public preview of the OpenAPI spec is subject to breaking changes without advance notice, and should not be used within production environments. If you see something that looks incorrect or can be improved, you can [open an issue](https://github.com/discord/discord-api-spec/issues). -::: - -The public spec can be found in the new [`discord-api-spec` repository on GitHub](https://github.com/discord/discord-api-spec). diff --git a/docs/change-log/2023-08-08-activity-state-for-bot-users.md b/docs/change-log/2023-08-08-activity-state-for-bot-users.md deleted file mode 100644 index 433b994c4b..0000000000 --- a/docs/change-log/2023-08-08-activity-state-for-bot-users.md +++ /dev/null @@ -1,6 +0,0 @@ ---- -title: "Activity State for Bot Users" -date: "2023-08-08" ---- - -The `state` field in [activity objects](/docs/events/gateway-events#activity-object) can now be set when [updating presence](/docs/events/gateway-events#update-presence) for a bot user. The value of `state` will appear as a custom status for the bot user when an [activity's `type`](/docs/events/gateway-events#activity-object-activity-types) is set to `4`, or as additional data under an activity's name for other activity types. diff --git a/docs/change-log/2023-08-10-embed-debugger.md b/docs/change-log/2023-08-10-embed-debugger.md deleted file mode 100644 index cfc592485f..0000000000 --- a/docs/change-log/2023-08-10-embed-debugger.md +++ /dev/null @@ -1,6 +0,0 @@ ---- -title: "Embed Debugger" -date: "2023-08-10" ---- - -We've released a new [Embed Debugger tool](https://discord.com/developers/embeds) that shows you how a URL's metadata will be parsed and rendered as a link embed within the Discord client. Use it to preview your site's embed, or debug why your site's link embed isn't working as expected. diff --git a/docs/change-log/2023-08-23-team-member-roles.md b/docs/change-log/2023-08-23-team-member-roles.md deleted file mode 100644 index 5b25ace460..0000000000 --- a/docs/change-log/2023-08-23-team-member-roles.md +++ /dev/null @@ -1,8 +0,0 @@ ---- -title: "Team Member Roles" -date: "2023-08-23" ---- - -You can now select roles other than admin when inviting users or configuring members of a team. There are four [role types](/docs/topics/teams#team-member-roles-team-member-role-types) that a team member can be assigned: owner, admin, developer, or read-only. The team member object now has an additional [`role` field](/docs/topics/teams#data-models-team-member-object), which is a string representing the member's current role. - -Details about team member roles are in the updated [Teams documentation](/docs/topics/teams#team-member-roles). diff --git a/docs/change-log/2023-09-22-default-value-in-auto-populated-select-menus.md b/docs/change-log/2023-09-22-default-value-in-auto-populated-select-menus.md deleted file mode 100644 index 6a4713319c..0000000000 --- a/docs/change-log/2023-09-22-default-value-in-auto-populated-select-menus.md +++ /dev/null @@ -1,6 +0,0 @@ ---- -title: "Default Value in Auto-populated Select Menus" -date: "2023-09-22" ---- - -A new `default_values` field was added for user (`5`), role (`6`), mentionable (`7`), and channel (`8`) [select menu components](/docs/components/reference). `default_values` is a list of [default value objects](/docs/components/reference#user-select-select-default-value-structure), which each include an `id` (the snowflake value for the resource), as well as a corresponding `type` (either `"user"`, `"role"`, or `"channel"`). diff --git a/docs/change-log/2023-09-26-premium-app-subscriptions-available-in-the-us.md b/docs/change-log/2023-09-26-premium-app-subscriptions-available-in-the-us.md deleted file mode 100644 index ac26f16d98..0000000000 --- a/docs/change-log/2023-09-26-premium-app-subscriptions-available-in-the-us.md +++ /dev/null @@ -1,22 +0,0 @@ ---- -title: "Premium App Subscriptions Available in the US" -date: "2023-09-26" -topics: -- "Premium Apps" ---- - -Starting today, eligible US-based developers can monetize their verified apps with App Subscriptions. [App Subscriptions](/docs/monetization/overview) let you to charge your users for premium functionality with a recurring, monthly subscription. - -* Manage subscription SKUs in the Developer Portal -* View monetization analytics in the Developer Portal -* Team owners can setup and manage payouts in Developer Portal -* New endpoints for working with [SKUs](/docs/resources/sku) and [Entitlements](/docs/resources/entitlement): - * [List SKUs](/docs/resources/sku#list-skus) `GET /applications//skus` - * [List Entitlements](/docs/resources/entitlement#list-entitlements) `GET /applications//entitlements` - * [Create Test Entitlement](/docs/resources/entitlement#create-test-entitlement) `POST /applications//entitlements` - * [Delete Test Entitlement](/docs/resources/entitlement#delete-test-entitlement) `DELETE /applications//entitlements/` -* [Gateway Events](/docs/events/gateway-events#entitlements) for working with entitlements: `ENTITLEMENT_CREATE`, `ENTITLEMENT_UPDATE`, `ENTITLEMENT_DELETE` -* New [`PREMIUM_REQUIRED (10)` interaction response type](/docs/interactions/receiving-and-responding#interaction-response-object-interaction-callback-type) is available to prompt users to upgrade -* New `entitlements` field, which is an array of [entitlement](/docs/resources/entitlement) objects, available in interaction data payloads when [receiving and responding to interactions](/docs/interactions/receiving-and-responding#interaction-object-interaction-structure) - -To learn more about eligibility details and how to enable monetization for your app, check out the [Monetization Overview](/docs/monetization/overview). diff --git a/docs/change-log/2023-10-17-global-rate-limit-added-to-discord.com.md b/docs/change-log/2023-10-17-global-rate-limit-added-to-discord.com.md deleted file mode 100644 index 5a2123a8ba..0000000000 --- a/docs/change-log/2023-10-17-global-rate-limit-added-to-discord.com.md +++ /dev/null @@ -1,15 +0,0 @@ ---- -title: "Global Rate Limit added to discordapp.com/*" -date: "2023-10-17" ---- - -We have added a global rate limit for API requests made to `discordapp.com/*` and may further restrict requests in the future. - -To limit impact on your app, please make sure you are making calls to `discord.com/*`. - -This does **not** apply for `cdn.discordapp.com`. - -Refer to the [API Reference](/docs/reference) for more info on which url(s) to use when building on the REST API - -* [February 14, 2022 Change Log](/docs/change-log#api-v10): Requests to v10 and higher will no longer be supported on `discordapp.com` (this does not affect `cdn.discordapp.com`) -* [May 4, 2020 #api-announcements](https://discord.com/channels/613425648685547541/697138785317814292/706944540971630662) diff --git a/docs/change-log/2023-10-19-premium-app-subscriptions-now-available-in-the-eu-and-uk.md b/docs/change-log/2023-10-19-premium-app-subscriptions-now-available-in-the-eu-and-uk.md deleted file mode 100644 index 90dd558764..0000000000 --- a/docs/change-log/2023-10-19-premium-app-subscriptions-now-available-in-the-eu-and-uk.md +++ /dev/null @@ -1,14 +0,0 @@ ---- -title: "Premium App Subscriptions Now Available in the EU and UK" -date: "2023-10-19" -topics: -- "Premium Apps" ---- - -Starting today, eligible developers based in EU and UK can now monetize their verified apps with App Subscriptions. [App Subscriptions](/docs/monetization/overview) let you to charge your users for premium functionality with a recurring, monthly subscription. - -:::info -New features for Premium App Subscriptions are documented in the [App Subscriptions overview](/docs/monetization/overview) and in [the changelog for the previous App Subscriptions release](/docs/change-log#premium-app-subscriptions-available-in-the-us). -::: - -To learn more about eligibility details and how to enable monetization for your app, check out the [Monetization Overview](/docs/monetization/overview). diff --git a/docs/change-log/2023-11-01-fix-message-edit-interaction-response-permissions.md b/docs/change-log/2023-11-01-fix-message-edit-interaction-response-permissions.md deleted file mode 100644 index ed2e1eaadd..0000000000 --- a/docs/change-log/2023-11-01-fix-message-edit-interaction-response-permissions.md +++ /dev/null @@ -1,8 +0,0 @@ ---- -title: "Fix Message Edit Interaction Response Permissions" -date: "2023-11-01" ---- - -Behavior for message edit interaction response actions like [updating interaction responses](/docs/interactions/receiving-and-responding#edit-original-interaction-response) and [sending follow-up messages](/docs/interactions/receiving-and-responding#followup-messages) have been updated to follow a bot user's permissions. - -Previously, some message edit interaction response actions would use the default permissions rather than a bot user's permissions. diff --git a/docs/change-log/2023-11-29-premium-app-subscriptions-new-ways-for-testing-app-subscriptions.md b/docs/change-log/2023-11-29-premium-app-subscriptions-new-ways-for-testing-app-subscriptions.md deleted file mode 100644 index 00eff1b453..0000000000 --- a/docs/change-log/2023-11-29-premium-app-subscriptions-new-ways-for-testing-app-subscriptions.md +++ /dev/null @@ -1,13 +0,0 @@ ---- -title: "Premium App Subscriptions: New Ways for Testing App Subscriptions" -date: "2023-11-29" -topics: -- "Premium Apps" ---- - -Following feedback on Premium App Subscriptions, we've made it easier for developers to test their app subscriptions. The goal is to provide you with flexibility during testing and prevent you from having to use live payment methods. - -* Team members will automatically receive a 100% discount on a subscription for your app, allowing you to test the end-to-end payment flow -* Developers can create and delete [test entitlements](/docs/resources/entitlement#create-test-entitlement) to toggle access to an application's premium features - -Read more about [Testing your App Subscriptions Implementation](/docs/monetization/implementing-app-subscriptions#testing-your-app-subscription-implementation) for details. diff --git a/docs/change-log/2023-12-01-experimenting-with-end-to-end-encryption-for-voice-video.md b/docs/change-log/2023-12-01-experimenting-with-end-to-end-encryption-for-voice-video.md deleted file mode 100644 index 9a160350d2..0000000000 --- a/docs/change-log/2023-12-01-experimenting-with-end-to-end-encryption-for-voice-video.md +++ /dev/null @@ -1,22 +0,0 @@ ---- -title: "Experimenting with End-to-End Encryption for Voice & Video" -date: "2023-12-01" -topics: -- "Voice" ---- - -#### What’s Happening? - -As outlined in [a blog post earlier this year](https://discord.com/blog/encryption-for-voice-and-video-on-discord), we are experimenting with end-to-end encryption (e2ee) for voice and video channels. - -End-to-end encryption is designed to only allow the participants in a call to decipher its contents. One of the protocols we’re experimenting with is called Messaging Layer Security, which we believe would allow us to deliver end-to-end encryption at scale. Intermediaries, including platforms like Discord, are unable to access the content of communications encrypted with end-to-end encryption. - -#### How do I prepare for the changes? - -During this testing phase, there is nothing developers need to do to support end-to-end encryption. Voice channels will automatically downgrade to documented, non-e2ee protocols when a bot user joins the channel. This is transparent to the connecting client but may result in a slight delay between establishing a connection and receiving audio. - -#### What is planned for the future? - -We will be continuing our testing and will share updates along with developer documentation and sample code once it is available. - -Once this information is published, we will provide developers with a substantial timeframe to implement end-to-end encryption when interacting with voice and video. diff --git a/docs/change-log/2023-12-15-clarification-on-permission-splits-for-expressions-and-events.md b/docs/change-log/2023-12-15-clarification-on-permission-splits-for-expressions-and-events.md deleted file mode 100644 index f73e002f4f..0000000000 --- a/docs/change-log/2023-12-15-clarification-on-permission-splits-for-expressions-and-events.md +++ /dev/null @@ -1,19 +0,0 @@ ---- -title: "Clarification on Permission Splits for Expressions and Events" -date: "2023-12-15" ---- - -:::info -The existing behavior for `MANAGE_GUILD_EXPRESSIONS` and `MANAGE_EVENTS` will **not be changing**. These permissions will continue to allow your bot users to create, update and delete expressions/events. No action will be needed if you plan to continue using these permissions. -::: - -To support added controls for expressions and events, new [permissions](/docs/topics/permissions#permissions) were added for users and roles in July 2023: - -* `CREATE_GUILD_EXPRESSIONS`: `1 << 43` -* `CREATE_EVENTS`: `1 << 44` - -These allow for creating new expressions and events, as well as editing and deleting those created by the current user. - -:::warn -These were rolled out in July 2023 to users and roles and have been added to our developer documentation but **are not yet available to app developers**. We will share an update here when these new permissions are available in your apps. -::: diff --git a/docs/change-log/2023-12-19-limit-number-of-fields-in-embeds.md b/docs/change-log/2023-12-19-limit-number-of-fields-in-embeds.md deleted file mode 100644 index 4755aa684a..0000000000 --- a/docs/change-log/2023-12-19-limit-number-of-fields-in-embeds.md +++ /dev/null @@ -1,8 +0,0 @@ ---- -title: "Limit Number of Fields in Embeds" -date: "2023-12-19" ---- - -[Embed objects](/docs/resources/message#embed-object) are now limited more explicitly to 25 [embed fields](/docs/resources/message#embed-object-embed-field-structure). If you pass more than 25 fields within the an embed's `fields` property, an error will be returned. - -Previously, only the first 25 embed fields would be displayed within the embed but no error was returned. diff --git a/docs/change-log/2024-00-20-soundboard-api.md b/docs/change-log/2024-00-20-soundboard-api.md deleted file mode 100644 index 570b60a16a..0000000000 --- a/docs/change-log/2024-00-20-soundboard-api.md +++ /dev/null @@ -1,6 +0,0 @@ ---- -title: "Soundboard API" -date: "2024-09-20" ---- - -[Soundboard](/docs/resources/soundboard) is now available in the API! Apps can now [get](/docs/resources/soundboard#list-default-soundboard-sounds) soundboard sounds, [modify](/docs/resources/soundboard#modify-guild-soundboard-sound) them, [send](/docs/resources/soundboard#send-soundboard-sound) them in voice channels, and listen to other users playing them! diff --git a/docs/change-log/2024-02-12-enforced-nonces-on-create-message-endpoint.md b/docs/change-log/2024-02-12-enforced-nonces-on-create-message-endpoint.md deleted file mode 100644 index ec6047161c..0000000000 --- a/docs/change-log/2024-02-12-enforced-nonces-on-create-message-endpoint.md +++ /dev/null @@ -1,6 +0,0 @@ ---- -title: "Enforced Nonces on Create Message Endpoint" -date: "2024-02-12" ---- - -The [Create message](/docs/resources/message#create-message) endpoint now supports an `enforce_nonce` parameter. When set to true, the message will be deduped for the same sender within a few minutes. If a message was created with the same nonce, no new message will be created and the previous message will be returned instead. This behavior will become the default for this endpoint in a future API version. diff --git a/docs/change-log/2024-03-15-guild-prune-requiring.md b/docs/change-log/2024-03-15-guild-prune-requiring.md deleted file mode 100644 index 662f2611a6..0000000000 --- a/docs/change-log/2024-03-15-guild-prune-requiring.md +++ /dev/null @@ -1,8 +0,0 @@ ---- -title: "Guild Prune Requiring" -date: "2024-03-15" -breaking: true ---- - -The [Get Guild Prune Count](/docs/resources/guild#get-guild-prune-count) and [Begin Guild Prune](/docs/resources/guild#begin-guild-prune) -endpoints now require the `MANAGE_GUILD` permission alongside the existing `KICK_MEMBERS` requirement `₍^ >ヮ<^₎ .ᐟ.ᐟ`. diff --git a/docs/change-log/2024-03-18-discord-activities-developer-preview-of-the-embedded-app-sdk.md b/docs/change-log/2024-03-18-discord-activities-developer-preview-of-the-embedded-app-sdk.md deleted file mode 100644 index 0895b7fa8a..0000000000 --- a/docs/change-log/2024-03-18-discord-activities-developer-preview-of-the-embedded-app-sdk.md +++ /dev/null @@ -1,17 +0,0 @@ ---- -title: "Discord Activities: Developer Preview of the Embedded App SDK" -date: "2024-03-18" -topics: -- "Embedded App SDK" -- "Activities" ---- - -Discord Developers can now build Activities! - -Activities are interactive, multiplayer experiences that run in an iframe in Discord. In order to make the communication between your experience and Discord, we've introduced the Embedded App SDK to assist in communicating between your app and the Discord client. - -* New [Discord Activities](/docs/activities/overview) developer docs with a tutorial, code samples, development guides, and design principles. -* The Embedded App SDK is now available via [npm](https://npmjs.com/package/@discord/embedded-app-sdk) and [GitHub](http://github.com/discord/embedded-app-sdk). -* The [Embedded App SDK Reference](/docs/developer-tools/embedded-app-sdk) is now available. - -To learn more about how to get started building your own Activity, check out the [Activities Overview](/docs/activities/overview). diff --git a/docs/change-log/2024-03-18-user-installable-apps-preview.md b/docs/change-log/2024-03-18-user-installable-apps-preview.md deleted file mode 100644 index 078de6b426..0000000000 --- a/docs/change-log/2024-03-18-user-installable-apps-preview.md +++ /dev/null @@ -1,38 +0,0 @@ ---- -title: "User-Installable Apps Preview" -date: "2024-03-18" -topics: -- "User Apps" ---- - -Apps can now be installed to users—making them easier to install, discover, and access across Discord. User-installed apps can be used across all of a user's servers, within their (G)DMs, and in DMs with the app's bot user. - -When creating or updating your app, you can choose which installation types your app supports on the **Installation** page in your [app's settings](https://discord.com/developers/applications). To quickly get started, you can follow the new [Developing a User-Installable App tutorial](/docs/tutorials/developing-a-user-installable-app) or read details about the new changes below. - -This change introduces new concepts and fields across the API that apps will now encounter— - -###### API Changes - -**Concepts:** - -* [Installation context](/docs/resources/application#installation-context) defines how an app was installed: to a user, a guild (server), or both. Currently, apps will default to only support the guild installation context, but the default may change in the future. -* Commands can also support one or both installation contexts, with the default being the same as the app's supported installation context(s) at the time of command creation. -* [Interaction context](/docs/interactions/application-commands#interaction-contexts) defines where a command can be used in Discord—within guilds, DM with your app's bot user, and/or within group DMs and DMs other than with your app's bot user. -* The installation flow for apps have been updated so users can select whether they want to install an app to their account or to a server. - -**API Fields:** - -* New `integration_types_config` field for [Applications](/docs/resources/application#application-object) include the default scopes and permissions for app's supported installation contexts -* New `integration_types` and `contexts` fields for [Commands](/docs/interactions/application-commands#application-command-object-application-command-structure) are the supported [installation](/docs/interactions/application-commands#installation-context) and [interaction](/docs/interactions/application-commands#interaction-contexts) contexts (respectively) for the command. Read [command contexts](/docs/interactions/application-commands#contexts) documentation for details. -* New `context` field for [Interactions](/docs/interactions/receiving-and-responding#interaction-object-interaction-structure) indicates the [interaction context](/docs/interactions/application-commands#interaction-contexts) where an interaction was triggered from. -* New `authorizing_integration_owners` field for [Interactions](/docs/interactions/receiving-and-responding#interaction-object-interaction-structure) includes a mapping of installation contexts that the interaction was authorized for, to related snowflakes for that context. Read [Authorizing Integration Owners Object](/docs/interactions/receiving-and-responding#interaction-object-authorizing-integration-owners-object) for details. -* `app_permissions` is now always serialized for interactions to indicate what [permissions](/docs/topics/permissions#permissions-bitwise-permission-flags) your app has access to in the context its' responding. For (G)DMs with other users, it will include the `ATTACH_FILES | EMBED_LINKS | MENTION_EVERYONE`, and for DMs with the app's bot user it will also contain `USE_EXTERNAL_EMOJIS` for the bot’s DM -* New `interaction_metadata` on [Messages](/docs/resources/message#message-object) that are created as part of an interaction response (either a response or follow-up). See [Message Interaction Metadata Object](/docs/resources/message#message-interaction-metadata-object) for details. -* `dm_permission` field for [Commands](/docs/interactions/application-commands#application-command-object-application-command-structure) is deprecated. Apps should use `contexts` instead. -* `interaction` field for [Messages](/docs/resources/message#message-object) is deprecated. Apps should use `interaction_metadata` instead. - -###### Limitations and Known Issues - -* During the preview, interaction responses for the user installation context will be forced to be ephemeral in servers with over 25 members. Forced ephemerality is enforced at the client-level, so your app does not need to manually pay attention to server size, and will not receive errors via the API. -* All [follow-up messages](/docs/interactions/receiving-and-responding#followup-messages) are currently forced to be ephemeral in DMs -* Follow-up messages have a bug where they will not correctly respect user permissions diff --git a/docs/change-log/2024-04-02-csv-export-for-premium-app-analytics.md b/docs/change-log/2024-04-02-csv-export-for-premium-app-analytics.md deleted file mode 100644 index 822894bfbf..0000000000 --- a/docs/change-log/2024-04-02-csv-export-for-premium-app-analytics.md +++ /dev/null @@ -1,8 +0,0 @@ ---- -title: "CSV Export for Premium App Analytics" -date: "2024-04-02" ---- - -For apps with [Monetization](/docs/monetization/overview) enabled, we have released the ability to export your SKU analytics to CSV. These exports allow you to use your preferred data tools to report on your premium offerings. - -You can find the export at the bottom of the `Monetization → Analytics` tab of your app to export data points such as `sales_count`, `sales_amount`, `sales_currencies`, `cancellation_count`, `refund_amount`, and `refund_count`, aggregated by each of your offerings for the selected month. diff --git a/docs/change-log/2024-04-23-modify-guild-member-flags-field-permissions.md b/docs/change-log/2024-04-23-modify-guild-member-flags-field-permissions.md deleted file mode 100644 index 71adb19bf8..0000000000 --- a/docs/change-log/2024-04-23-modify-guild-member-flags-field-permissions.md +++ /dev/null @@ -1,6 +0,0 @@ ---- -title: "Modify Guild Member flags field permissions" -date: "2024-04-23" ---- - -Update permissions necessary to modify the `flags` field when calling the [Modify Guild Member](/docs/resources/guild#modify-guild-member) endpoint. diff --git a/docs/change-log/2024-04-24-premium-apps-one-time-purchases-and-store.md b/docs/change-log/2024-04-24-premium-apps-one-time-purchases-and-store.md deleted file mode 100644 index 6ce8562e40..0000000000 --- a/docs/change-log/2024-04-24-premium-apps-one-time-purchases-and-store.md +++ /dev/null @@ -1,28 +0,0 @@ ---- -title: "Premium Apps: One-Time Purchases and Store" -date: "2024-04-24" ---- - -Two new features are now available for Premium Apps: One-Time Purchases and Stores. - -**One-Time Purchases** - -* **Durable Items**: A one-time purchase that is permanent and is not subject to either renewal or consumption, such as lifetime access to an app's premium features. -* **Consumable Items**: A one-time, non-renewable purchase that provides access, such as a temporary power-up or boost in a game. - -Learn more about [Implementing One-Time Purchases](/docs/monetization/implementing-one-time-purchases). - -**A Store for Your Premium App** - -We have also introduced a Store for your Premium App to showcase your app subscriptions and one-time purchase items. You can now create a unique Store page within the developer portal and add your published subscription SKUs or one-time purchase SKUs to your store view, allowing your users to buy these items from your App Directory or Bot User Profile. - -To explore these features, eligibility details, and how to enable monetization for your app, check out the [Monetization Overview](/docs/monetization/overview). - -**API Documentation Updates** - -The following were added to our public Monetization documentation with this update: - -* New [SKU Object Types](/docs/resources/sku#sku-object-sku-types) -* New [Entitlement Object Types](/docs/resources/entitlement#entitlement-object-entitlement-types) -* [Consume an Entitlement](/docs/resources/entitlement#consume-an-entitlement) API endpoint -* `consumed` field on the [Entitlement](/docs/resources/entitlement) resource diff --git a/docs/change-log/2024-05-31-auto-moderation-member-profile-rule.md b/docs/change-log/2024-05-31-auto-moderation-member-profile-rule.md deleted file mode 100644 index 59313f9694..0000000000 --- a/docs/change-log/2024-05-31-auto-moderation-member-profile-rule.md +++ /dev/null @@ -1,7 +0,0 @@ ---- -title: "Auto Moderation Member Profile Rule" -date: "2024-05-31" ---- - -* Add Auto Moderation `MEMBER_PROFILE` rule [trigger\_type](/docs/resources/auto-moderation#auto-moderation-rule-object-trigger-types). This rule type will check if a member's profile contains disallowed keywords. -* Add Auto Moderation `BLOCK_MEMBER_INTERACTION` [action type](/docs/resources/auto-moderation#auto-moderation-action-object-action-types) currently available for the `MEMBER_PROFILE` rule [trigger\_type](/docs/resources/auto-moderation#auto-moderation-rule-object-trigger-types). This action will "quarantine" the member to some extent and prevent them from performing most interactions within a specific server. diff --git a/docs/change-log/2024-06-17-premium-apps-new-premium-button-style-deep-linking-url-schemes.md b/docs/change-log/2024-06-17-premium-apps-new-premium-button-style-deep-linking-url-schemes.md deleted file mode 100644 index 0fc8dc6306..0000000000 --- a/docs/change-log/2024-06-17-premium-apps-new-premium-button-style-deep-linking-url-schemes.md +++ /dev/null @@ -1,25 +0,0 @@ ---- -title: "Premium Apps: New Premium Button Style & Deep Linking URL Schemes" -date: "2024-06-17" ---- - -**New Premium Button Style** - -Introduces a new `premium` [button style](/docs/components/reference#button-button-styles) to be used with a `sku_id` which points to an active [SKU](/docs/resources/sku#sku-object). This allows developers to customize their premium experience by returning specific subscription or one-time purchase products. - -Learn more about using [button components with interactions](/docs/components/reference#button). - -:::warn -This change deprecates Interaction Response Type 10 -::: - -The `PREMIUM_REQUIRED (10)` interaction response type is now deprecated in favor of using custom premium buttons. This will continue to function but may be eventually unsupported. It is recommended to migrate your bots to use the more flexible [premium button component](/docs/components/reference#button-button-styles). - -Learn more about [gating features with premium interactions](/docs/monetization/implementing-app-subscriptions#prompting-users-to-subscribe). - -**Deep Linking URL Schemes for SKUs and Store** - -Introduces two new url schemes for linking directly to the Application Directory. When these links are used in chat, they are rendered as rich embeds that users can interact with to launch an app's store or open a SKU detail modal. - -* New [Store URL Scheme](/docs/monetization/managing-skus#linking-to-your-store): `https://discord.com/application-directory/:appID/store` -* New [SKU URL Scheme](/docs/monetization/managing-skus#linking-to-a-specific-sku): `https://discord.com/application-directory/:appID/store/:skuID` diff --git a/docs/change-log/2024-06-27-user-installed-apps-general-availability.md b/docs/change-log/2024-06-27-user-installed-apps-general-availability.md deleted file mode 100644 index 86923c9485..0000000000 --- a/docs/change-log/2024-06-27-user-installed-apps-general-availability.md +++ /dev/null @@ -1,30 +0,0 @@ ---- -title: "User-Installed Apps General Availability" -date: "2024-06-27" -breaking: true ---- - -Back in March, we announced [the beta for user-installed apps](/docs/change-log#userinstallable-apps-preview). After listening and making updates based on feedback from developers and modmins, we're excited to announce that user-installed apps are now considered generally available and can be used in all servers (regardless of size). - -With this update, there are a few API and behavioral updates for user-installed apps. - -###### API Updates - -* `user_id` has been removed from the `interaction_metadata` field on messages. Instead, you can use the `id` field in the nested `user` object. See the [Message Interaction Metadata Object](/docs/resources/message#message-interaction-metadata-object) for details. -* User-installed apps are now limited to creating a maximum of 5 [follow-ups](/docs/interactions/receiving-and-responding#followup-messages) when responding to interactions. This only affects the [Create Followup Message endpoint](/docs/interactions/receiving-and-responding#create-followup-message), and apps installed to the server are unaffected. -* On [Interactions](/docs/interactions/receiving-and-responding#interaction-object-interaction-structure), the value of `authorizing_integration_owners` is now correctly serialized as a string. Previously, the `"0"` value was incorrectly serialized as a number. -* `app_permissions` on [Interactions](/docs/interactions/receiving-and-responding#interaction-object-interaction-structure) now correctly represents the permissions for user-installed apps. Previously, the value was incorrect for user-installed apps. -* Updating a message can result in a `400` response if the content of the message was blocked by AutoMod, which may be particularly important for [deferred messages](/docs/interactions/receiving-and-responding#responding-to-an-interaction). -* Interaction responses are no longer forced to be ephemeral for servers with over 25 members. - -###### New `Use External Apps` Permission - -A new [`USE_EXTERNAL_APPS` (`1 << 50`) permission](/docs/topics/permissions#permissions-bitwise-permission-flags) was added, and is enabled for servers by default. The new permission lets modmins control whether user-installed apps can post public replies in a server. If `Use External Apps` is disabled and your app is *not* installed to the server, your app’s responses will be ephemeral for the end user. - -Read more in the [Moderating Apps on Discord Help Center article](https://support.discord.com/hc/en-us/articles/23957313048343-Moderating-Apps-on-Discord#h_01HZQQQEADYVN2CM4AX4EZGKHM). - -###### Updated Defaults for New Apps - -* Newly-created apps now default to having both "User Install" *and* "Guild Install" [installation contexts](/docs/resources/application#installation-context) enabled. This can be updated in the **Installation** tab in an [app's settings](https://discord.com/developers/applications). -* Newly-created apps now default to using the "Discord Provided Link" [install link](/docs/resources/application#install-links). This can be updated in the **Installation** tab in an [app's settings](https://discord.com/developers/applications). -* If Discord Provided Link is selected as the install link type, `application.commands` scope is added to both installation contexts. diff --git a/docs/change-log/2024-07-09-banners-in-get-current-user-guilds.md b/docs/change-log/2024-07-09-banners-in-get-current-user-guilds.md deleted file mode 100644 index 01bd2d7777..0000000000 --- a/docs/change-log/2024-07-09-banners-in-get-current-user-guilds.md +++ /dev/null @@ -1,6 +0,0 @@ ---- -title: "Banners in Get Current User Guilds" -date: "2024-07-09" ---- - -[`GET /users/@me/guilds`](/docs/resources/user#get-current-user-guilds) now includes each guild's `banner` field! This enables apps using OAuth2 with the `guilds` scope to display guild banners. diff --git a/docs/change-log/2024-07-15-message-forwarding-rollout.md b/docs/change-log/2024-07-15-message-forwarding-rollout.md deleted file mode 100644 index effebd5e77..0000000000 --- a/docs/change-log/2024-07-15-message-forwarding-rollout.md +++ /dev/null @@ -1,41 +0,0 @@ ---- -title: "Message Forwarding rollout" -date: "2024-07-15" ---- - -We are slowly rolling out the message forwarding feature to users. This feature allows callers to create a message using `message_reference.type = FORWARD` and have the API generate a `message_snapshot` for the sent message. The feature has [some limitations](/docs/resources/message#message-reference-types) and the snapshot is a minimal version of a standard `MessageObject`, but does capture the core parts of a message. - -The resulting message will look something like: - -```json -{ - "id": "1255957733279273083", - "message_reference": { - "type": 1, // Forward - ... - } - "message_snapshots": [ - { - "message": { - "content": "original message", - "embeds": [...], - "attachments": [...], - ... - } - } - ], - ... -} -``` - -We have applied stricter rate limits for this feature based on the following: - -* number of forwards sent by the user -* total attachment size - -###### API Updates since preview - -This was [previously announced](https://discord.com/channels/613425648685547541/697138785317814292/1233463756160503859) but note that the final API has a few changes since the API was first previewed: - -* [`message snapshot`](/docs/resources/message#message-snapshot-object) objects don't include a `guild` field anymore since the `message_reference` already provides that information -* forwarded messages have a distinctive `message_reference` type of `FORWARD` now diff --git a/docs/change-log/2024-07-16-member-banners.md b/docs/change-log/2024-07-16-member-banners.md deleted file mode 100644 index 96796b6029..0000000000 --- a/docs/change-log/2024-07-16-member-banners.md +++ /dev/null @@ -1,7 +0,0 @@ ---- -title: "Guild Member Banners" -date: "2024-07-16" -breaking: false ---- - -Apps can now access guild member profile banners via the API and Gateway! The [guild member object](/docs/resources/guild#guild-member-object) now includes a `banner` field which can be used to create the [guild member banner URL](/docs/reference#image-formatting). \ No newline at end of file diff --git a/docs/change-log/2024-07-17-activities-proxy-csp-update.md b/docs/change-log/2024-07-17-activities-proxy-csp-update.md deleted file mode 100644 index f5a8b24617..0000000000 --- a/docs/change-log/2024-07-17-activities-proxy-csp-update.md +++ /dev/null @@ -1,27 +0,0 @@ ---- -title: "Activities Proxy CSP Update" -date: "2024-07-17" -breaking: true -topics: -- "Activities" -- "Embedded App SDK" ---- - -:::warn -This change is outdated. We have since updated the Activities Proxy CSP and the use of `/.proxy/` is no longer required. For the latest information, please refer to [this changelog](/docs/change-log#remove-proxy-from-discord-activity-proxy-path). -::: - -This change will be rolled out to all existing applications on **August 28, 2024**. - -We will be updating our Content Security Policy (CSP) for the Activities Domain (`https://.discordsays.com`). This represents a **breaking change** for **all Activities**, and as such we have a migration plan in order. - -our CSP will be updated as follows: - -* all requests must be made through `https://.discordsays.com/.proxy/`, and requests to other paths on the `discordsays.com` domain will be blocked. -* requests to `https://discord.com/api/` will be permitted, but other paths on the `discord.com` domain will be blocked. -* Only allowed paths on `cdn.discordapp.com` and `media.discordapp.net` will be permitted such as `/attachments/`, `/icons/`, and `/avatars/`. -* nested child iframes must also mount paths prepended by `/.proxy/` - -As of [embedded-app-sdk v1.4.0](https://github.com/discord/embedded-app-sdk/releases/tag/v1.4.0) we have updated `patchUrlMappings` to automatically route requests through `/.proxy/`, so updating your SDK version calling `patchUrlMappings` is a good first step. If you are unfamiliar with `patchUrlMappings`, please consult the [documentation](/docs/activities/development-guides/networking#using-external-resources). - -All Application IDs created after `07/17/2024 12:00:00` UTC (applicationID greater than `1263102905548800000`) will also automatically have the new CSP applied. Testing your production code on a new application created after this date is a suggested way for developers to test compliance with this new CSP. diff --git a/docs/change-log/2024-07-18-application-emoji.md b/docs/change-log/2024-07-18-application-emoji.md deleted file mode 100644 index 936e991605..0000000000 --- a/docs/change-log/2024-07-18-application-emoji.md +++ /dev/null @@ -1,10 +0,0 @@ ---- -title: "Application Emoji" -date: "2024-07-18" ---- - -You can now upload emojis for your application in your [app's settings](https://discord.com/developers/applications) and use them as custom emojis anywhere on Discord. - -* Up to 2000 emojis per app -* Support for user-installable apps -* Can be [managed via the API](/docs/resources/emoji#create-application-emoji) with a bot token diff --git a/docs/change-log/2024-07-25-supported-activity-types-for-set-activity.md b/docs/change-log/2024-07-25-supported-activity-types-for-set-activity.md deleted file mode 100644 index e56f9c1faa..0000000000 --- a/docs/change-log/2024-07-25-supported-activity-types-for-set-activity.md +++ /dev/null @@ -1,10 +0,0 @@ ---- -title: "Supported Activity Types for SET_ACTIVITY" -date: "2024-07-25" ---- - -The [`SET_ACTIVITY` RPC command](/docs/topics/rpc#setactivity) has been updated to support 3 additional [activity types](/docs/events/gateway-events#activity-object-activity-types): Listening (`2`), Watching (`3`), and Competing (`5`). Previously, it only accepted Playing (`0`). - -:::warn -The [Game SDK](/docs/developer-tools/game-sdk#activities) has not been updated to support setting [`ActivityType`](/docs/developer-tools/game-sdk#activitytype-enum), and is still limited to read-only (to handle events that you receive from Discord). -::: diff --git a/docs/change-log/2024-08-05-voice-state-endpoints.md b/docs/change-log/2024-08-05-voice-state-endpoints.md deleted file mode 100644 index 3b4b23172d..0000000000 --- a/docs/change-log/2024-08-05-voice-state-endpoints.md +++ /dev/null @@ -1,9 +0,0 @@ ---- -title: "Voice State Endpoints" -date: "2024-08-05" -topics: -- "Voice" -- "HTTP API" ---- - -Voice states can now be accessed over the HTTP API! Apps can use the new [Get Current User Voice State](/docs/resources/voice#get-current-user-voice-state) and [Get User Voice State](/docs/resources/voice#get-user-voice-state) endpoints to fetch a user's voice state without a Gateway connection. diff --git a/docs/change-log/2024-08-09-user-app-install-count.md b/docs/change-log/2024-08-09-user-app-install-count.md deleted file mode 100644 index 9d1a917aaf..0000000000 --- a/docs/change-log/2024-08-09-user-app-install-count.md +++ /dev/null @@ -1,8 +0,0 @@ ---- -title: "User App Install Count" -date: "2024-08-09" -topics: -- "User Apps" ---- - -We've added an approximate user install count to the [Application object](/docs/resources/application#application-object) for user-installable apps. You can also view an app's install counts in the developer portal. diff --git a/docs/change-log/2024-08-12-get-guild-role-endpoint.md b/docs/change-log/2024-08-12-get-guild-role-endpoint.md deleted file mode 100644 index 3258729758..0000000000 --- a/docs/change-log/2024-08-12-get-guild-role-endpoint.md +++ /dev/null @@ -1,8 +0,0 @@ ---- -title: "Get Guild Role Endpoint" -date: "2024-08-12" -topics: -- "HTTP API" ---- - -Need to get just one role, not the whole role list? Use the new [Get Guild Role](/docs/resources/guild#get-guild-role) endpoint to fetch a single role by ID. diff --git a/docs/change-log/2024-08-13-voice-encryption-modes.md b/docs/change-log/2024-08-13-voice-encryption-modes.md deleted file mode 100644 index 27e13b6c60..0000000000 --- a/docs/change-log/2024-08-13-voice-encryption-modes.md +++ /dev/null @@ -1,12 +0,0 @@ ---- -title: "Voice Encryption Modes" -date: "2024-08-13" -topics: -- "Voice" ---- - -Added documentation for voice [encryption modes](/docs/topics/voice-connections#transport-encryption-modes) `aead_aes256_gcm_rtpsize` and `aead_xchacha20_poly1305_rtpsize` while announcing the deprecation of all `xsalsa20_poly1305*` variants and `aead_aes256_gcm`. Deprecated encryption modes will be discontinued as of November 18th, 2024. - -:::danger -Deprecated encryption modes will be discontinued as of November 18th, 2024. -::: diff --git a/docs/change-log/2024-08-13-voice-gateway-version-8-and-deprecation-of-versions-older-than-4.md b/docs/change-log/2024-08-13-voice-gateway-version-8-and-deprecation-of-versions-older-than-4.md deleted file mode 100644 index 4e1fbd40f4..0000000000 --- a/docs/change-log/2024-08-13-voice-gateway-version-8-and-deprecation-of-versions-older-than-4.md +++ /dev/null @@ -1,16 +0,0 @@ ---- -title: "Voice Gateway Version 8 and Deprecation of Versions < 4" -date: "2024-08-13" -topics: -- "Gateway" -- "Voice" ---- - -We are officially deprecating some very old voice gateway versions (> 7 years ago). - -* The voice gateway now supports a resume which re-sends lost messages. Use voice gateway version 8 and refer to [Buffered Resume](/docs/topics/voice-connections#buffered-resume). -* We have removed the default option for voice gateway version. Once this is deprecated, you must pass a voice gateway version. - -:::danger -You will be required to pass a voice gateway version and deprecated voice gateway versions will be discontinued as of November 18th, 2024. See [Voice Gateway Versioning](/docs/topics/voice-connections#voice-gateway-versioning) for futher details. -::: diff --git a/docs/change-log/2024-08-26-entry-point-commands.md b/docs/change-log/2024-08-26-entry-point-commands.md deleted file mode 100644 index 6f868a962e..0000000000 --- a/docs/change-log/2024-08-26-entry-point-commands.md +++ /dev/null @@ -1,19 +0,0 @@ ---- -title: "Entry Point Commands" -date: "2024-08-26" -topics: -- "Activities" -- "Interactions" ---- - -Apps with [Activities](/docs/activities/overview) enabled can now create [Entry Point commands](/docs/interactions/application-commands#entry-point-commands) using the `PRIMARY_ENTRY_POINT` (type `4`) [command type](/docs/interactions/application-commands#application-command-object-application-command-types). Apps are limited to one globally-scoped Entry Point command, which appears in the App Launcher. - -When creating or updating an Entry Point command, an [Entry Point handler](/docs/interactions/application-commands#application-command-object-entry-point-command-handler-types) can be defined using the [`handler` field](/docs/interactions/application-commands#application-command-object-application-command-structure). The `handler` field determines whether your app wants to manually handle responding to the interaction: -- If the value is `DISCORD_LAUNCH_ACTIVITY` (`2`), Discord will automatically handle the interaction and send a follow-up message to the channel where the Entry Point command was invoked from. -- If the value is `APP_HANDLER` (`1`), your app will receive an interaction token and will be responsible for responding to the interaction. In this case, you can launch your Activity using the `LAUNCH_ACTIVITY` (type `12`) [interaction callback](/docs/interactions/receiving-and-responding#interaction-response-object-interaction-callback-type). - -More details about Entry Point commands can be found in the [Application Commands documentation](/docs/interactions/application-commands#entry-point-commands) and in the [Activity development guide](/docs/activities/development-guides/user-actions#setting-up-an-entry-point-command). - -### Default Entry Point Commands - -Starting today, when you enable Activities in your [app's settings](http://discord.com/developers/applications), a [default Entry Point command](/docs/interactions/application-commands#default-entry-point-command) called "Launch" will automatically be created for your app. This can be customized or deleted like other commands if you want to update the name or handler type. diff --git a/docs/change-log/2024-08-26-launching-activities-via-interactions.md b/docs/change-log/2024-08-26-launching-activities-via-interactions.md deleted file mode 100644 index 674281d66d..0000000000 --- a/docs/change-log/2024-08-26-launching-activities-via-interactions.md +++ /dev/null @@ -1,9 +0,0 @@ ---- -title: "Launching Activities in Response to Interactions" -date: "2024-08-26" -topics: -- "Activities" -- "Interactions" ---- - -[Activities](/docs/activities/overview) can now be launched as a response to interactions using the `LAUNCH_ACTIVITY` (type `12`) [interaction callback type](/docs/interactions/receiving-and-responding#interaction-response-object-interaction-callback-type). `LAUNCH_ACTIVITY` can be used in response to `APPLICATION_COMMAND`, `MESSAGE_COMPONENT`, and `MODAL_SUBMIT` [interaction types](/docs/interactions/receiving-and-responding#interaction-object-interaction-type). diff --git a/docs/change-log/2024-08-28-subscription-api-and-entitlement-migration.md b/docs/change-log/2024-08-28-subscription-api-and-entitlement-migration.md deleted file mode 100644 index 87d237801d..0000000000 --- a/docs/change-log/2024-08-28-subscription-api-and-entitlement-migration.md +++ /dev/null @@ -1,105 +0,0 @@ ---- -title: "Premium Apps: Entitlement Migration and New Subscription API" -date: "2024-08-28" -topics: -- "Premium Apps" -breaking: true ---- - -:::info -Updates to this Change Log entry was published on **October 7, 2024** to reflect up-to-date information. See the [new Change Log entry](/docs/change-log#updates-to-entitlement-migration-guide) for details on updates. -::: - -We are migrating our entitlement system to a new behavior where entitlements will not end until explicitly canceled, representing a breaking change for subscription management. We are introducing a [Subscription API](/docs/resources/subscription) and [Subscription Events](/docs/events/gateway-events#subscriptions) to allow handling subscription-related events. - -:::warn -This change will be rolled out to all existing applications that have entitlements for user and guild subscription SKUs, starting on October 1, 2024. -::: - -#### Entitlement Migration Details - -- `ENTITLEMENT_CREATE` events will now be triggered with a null `ends_at` value for all ongoing subscriptions, indicating an indefinite entitlement. -- `ENTITLEMENT_UPDATE` events will occur only when a subscription ends, with the `ends_at` value indicating the end date. -- Discord-managed Subscription entitlements will have an `type` value of `PURCHASE` (type `1`) instead of `APPLICATION_SUBSCRIPTION` (type `8`). - -### Migration Plan & Guide: - -As of **October 1, 2024**, all existing entitlements that grant access to user-subscription and guild-subscription SKUs will automatically transfer to the new system on their renewal date. This means we will have a month-long migration window to allow all of your entitlements to migrate to the new system upon renewal. - -Developers are advised to update their systems to handle the new `ENTITLEMENT_CREATE` and `ENTITLEMENT_UPDATE` events according to the following migration guide before the rollout date to avoid service disruptions. - -### Introducing a New Subscription API - -With the new entitlement behavior, entitlements for subscription SKUs will no longer emit events at the start of a new subscription billing period. Instead, subscription lifecycle management can be handled through the new [Subscription API](/docs/monetization/implementing-app-subscriptions#using-the-subscription-api). -Developers should refer to the [Subscription resource](/docs/resources/subscription) for information on calling the Subscription API and responding to Subscription events. For in-depth implementation details, see our [Implementing App Subscriptions](/docs/monetization/implementing-app-subscriptions#using-the-subscription-api) guide. You can start using this API now. - -### Monetization Documentation Updates - -As part of these changes, we've updated the documentation for Premium Apps. - -- Created a new [Enabling Monetization](/docs/monetization/enabling-monetization) page to cover setting up your team, managing payouts, and enabling monetization for your apps -- Created a new [Managing SKUs](/docs/monetization/managing-skus#creating-a-sku) page to document how to create, update, publish, and promote your SKUs -- Moved and added [Entitlement](/docs/resources/entitlement), [SKU](/docs/resources/sku) and [Subscription](/docs/resources/subscription) resources to the **Resources** section -- Updated guides for [Implementing App Subscriptions](/docs/monetization/implementing-app-subscriptions) and [Implementing One-Time Purchases](/docs/monetization/implementing-one-time-purchases) - -### Subscription Entitlement Migration Guide - -Starting on **October 1, 2024**, we will be migrating our existing entitlement system to a new behavior where **entitlements do not expire until explicitly canceled**. This migration guide outlines the changes and impacts of this migration on developers and guides how to manage these changes effectively. - -:::warn -With this update, entitlements for subscription SKUs will no longer emit events when a new subscription billing period begins. If you need to know when a subscription has been renewed, use the new [Subscription API](/docs/resources/subscription) and related [Subscription Gateway Events](/docs/events/gateway-events#subscriptions). -::: - -### Current System - -Currently, entitlements for Subscription SKUs purchased through Discord have: - -- An `ends_at` date that corresponds to the subscription interval. This date is updated at each billing cycle. -- A entitlement `type` value of `APPLICATION_SUBSCRIPTION` (type `8`). -- An `ENTITLEMENT_UPDATE` event is triggered at the start of each new subscription period. - -### New System - -Post-migration, entitlements for Subscription SKUs purchased through Discord will: - -- No longer have an end date (`ends_at` will be `null`) until the user decides to cancel the subscription. -- Now have an entitlement `type` value of `PURCHASE` (type `1`). -- No `ENTITLEMENT_UPDATE` events will be triggered until the subscription is canceled. - -### Migration Timeline - -- **Migration Start Date:** October 1, 2024 -- **Migration End Date:** November 1, 2024 - -### Migration Impacts - -### 1) Existing Entitlements Scheduled to Renew - -- **During Migration Window:** - - These will automatically transfer to the new system. - - A new `ENTITLEMENT_CREATE` event will be triggered to indicate the migration. This does not indicate a net new entitlement. - - No further events will be generated until the entitlement ends, which will then trigger an `ENTITLEMENT_UPDATE` event. - - The `ends_at` value in the `ENTITLEMENT_UPDATE` event and in the Entitlement API will indicate the timestamp when the entitlement ends. - -### 2) Existing Entitlements Set to End - -- **During Migration Window:** - - These entitlements will naturally expire and not renew under the new system. - - No new entitlement events will be generated for these cases. - -### Developer Actions - -- **Pre-Migration:** - - Review and understand the new entitlement event structure. - - Adjust your system to handle `ends_at` being null, which now indicates an indefinite entitlement. - - Adjust your system not to expect type `APPLICATION_SUBSCRIPTION` (type `8`) for Discord-managed subscription entitlements. -- **Post-Migration:** - - Monitor for `ENTITLEMENT_CREATE`, `ENTITLEMENT_UPDATE`, `SUBSCRIPTION_CREATE`, and `SUBSCRIPTION_UPDATE` events. - - Update any references to an entitlement `ends_at` timestamps, which now indicate the ending of an entitlement. If you need to know when a subscription's period ends, use the [Subscription API](/docs/resources/subscription) and related [Subscription Gateway Events](/docs/events/gateway-events#subscriptions). - - -- The Entitlement Migration begins on October 1, 2024 -- You have an existing user subscription that has an existing `ends_at` timestamp for October 10, 2024. -- If the subscription renews successfully, you will receive an `ENTITLEMENT_CREATE` event on October 10, 2024, with an `ends_at` value of null -- ~~If you receive an `ENTITLEMENT_UPDATE` event with an `ends_at` timestamp, the entitlement for this subscription is expected to end at the timestamp value unless you receive subsequent `ENTITLEMENT_UPDATE` events between the cancellation and the `ends_at` value.~~ - diff --git a/docs/change-log/2024-09-04-add-polls-when-editing-deferred-interaction-responses.md b/docs/change-log/2024-09-04-add-polls-when-editing-deferred-interaction-responses.md deleted file mode 100644 index 6b4bb2efce..0000000000 --- a/docs/change-log/2024-09-04-add-polls-when-editing-deferred-interaction-responses.md +++ /dev/null @@ -1,8 +0,0 @@ ---- -title: "Add Polls when Editing Deferred Interaction Responses" -date: "2024-09-04" -topics: -- "Interactions" ---- - -You can now create a poll while editing a deferred interaction response with the [Edit Original Interaction Response](/docs/interactions/receiving-and-responding#edit-original-interaction-response) endpoint. Poll away! diff --git a/docs/change-log/2024-09-17-voice-e2ee-dave-protocol.md b/docs/change-log/2024-09-17-voice-e2ee-dave-protocol.md deleted file mode 100644 index a1b08e9069..0000000000 --- a/docs/change-log/2024-09-17-voice-e2ee-dave-protocol.md +++ /dev/null @@ -1,36 +0,0 @@ ---- -title: "Voice End-to-End Encryption (DAVE Protocol)" -date: "2024-09-17" -topics: -- "Voice" ---- - -Introduced [high-level documentation](/docs/topics/voice-connections) for Discord's Audio and Video End-to-End Encryption (DAVE) protocol, and the [new voice gateway opcodes](/docs/topics/opcodes-and-status-codes#voice) required to support it - -### **Developer Impact** - -Starting September 2024, Discord is migrating voice and video in DMs, Group DMs, voice channels, and Go Live streams to use end-to-end encryption (E2EE). - -**Who this affects:** Any libraries or apps that support [Voice Connections](/docs/topics/voice-connections). - -You are not immediately required to support the E2EE protocol, as calls will automatically upgrade/downgrade to/from E2EE depending on the support of clients in the call. - -### **Implementing E2EE Voice** - -We have added high-level documentation for Discord's Audio and Video End-to-End Encryption (DAVE) protocol, and the new voice gateway opcodes required to support it. - -The most thorough documentation on the DAVE protocol is found in the [Protocol Whitepaper](https://daveprotocol.com/). You can also use our open-source library [libdave](https://github.com/discord/libdave) to assist with your implementation. The exact format of the DAVE protocol opcodes is detailed in the [Voice Gateway Opcodes section of the protocol whitepaper](https://daveprotocol.com/#voice-gateway-opcodes). - -### **Future Deprecation and Discontinuation of Non-E2EE Voice** - -Non-E2EE connections to voice in DMs, Group DMs, voice channels, and Go Live streams will eventually be deprecated and discontinued. - -In 2025, all official Discord clients will support the protocol and it will be an enforced requirement to connect to the end-to-end encryption-eligible audio/video session types listed above. - -Once a timeline for deprecation and discontinuation is finalized, we will share details and developers will have **at least six months** to implement before we sunset non-E2EE voice connections. - -Read more about Discord's Audio and Video End-to-End Encryption (DAVE) protocol: - -- [Meet DAVE: Discord's New End-to-End Encryption for Audio & Video](https://discord.com/blog/meet-dave-e2ee-for-audio-video) -- [DAVE Protocol Whitepaper](https://daveprotocol.com/) -- [libdave open-source library on GitHub](https://github.com/discord/libdave) \ No newline at end of file diff --git a/docs/change-log/2024-09-26-activities-general-availability.md b/docs/change-log/2024-09-26-activities-general-availability.md deleted file mode 100644 index b4488cb0e8..0000000000 --- a/docs/change-log/2024-09-26-activities-general-availability.md +++ /dev/null @@ -1,32 +0,0 @@ ---- -title: "Activities General Availability" -date: "2024-09-26" -topics: -- "Activities" -- "Embedded App SDK" -- "Premium Apps" ---- - -Following up on [the rollout of the App Launcher](https://discord.com/blog/discover-more-ways-to-play-with-apps-now-anywhere-on-discord), we’re excited to announce that [Activities](/docs/activities/overview) are now generally available for developers. In addition to API stability, this means that apps with Activities can now be [verified](https://support-dev.discord.com/hc/en-us/articles/23926564536471-How-Do-I-Get-My-App-Verified), [discoverable](/docs/discovery/enabling-discovery) in the App Directory, and [implement monetization](/docs/monetization/overview). - -### Recent API Updates - -Since the developer preview was announced, there have been a few important API updates: - -- Activities can now enable and implement monetization features, and [`getEntitlements`](/docs/developer-tools/embedded-app-sdk#getentitlements),[`getSkus`](/docs/developer-tools/embedded-app-sdk#getskus), and [`startPurchase`](/docs/developer-tools/embedded-app-sdk#startpurchase) are generally available in the Embedded App SDK. -- New [Get Application Activity Instance](/docs/resources/application#get-application-activity-instance) endpoint to make [managing Activity instances](/docs/activities/development-guides/multiplayer-experience#activity-instance-management) easier. -- Apps with Activities can create an [Entry Point command (type `4`)](/docs/interactions/application-commands#entry-point-commands), which are the primary entry point for Activities in the App Launcher. When new apps enable Activities, a [default Entry Point command](/docs/interactions/application-commands#default-entry-point-command) will be created for the app. Read the [original change log](/docs/change-log#entry-point-commands) and the [Entry Point command guide](/docs/activities/development-guides/user-actions#setting-up-an-entry-point-command) for details. -- Activities can now be launched in response to interactions using the `LAUNCH_ACTIVITY` (type `12`) [interaction callback type](/docs/interactions/receiving-and-responding#interaction-response-object-interaction-callback-type) for `APPLICATION_COMMAND`, `MESSAGE_COMPONENT`, and `MODAL_SUBMIT` [interaction types](/docs/interactions/receiving-and-responding#interaction-object-interaction-type). -- Apps can now be installed to users (in addition to servers). After [setting up your installation contexts](/docs/resources/application#setting-supported-installation-contexts), make sure to request the `application.commands` scope when authorizing with users to make sure your Activity is available for them across their Discord servers, DMs, and Group DMs. -- In August, there were updates to the Content Security Policy (CSP) for Activities that limits how you can make requests to external resources when building Activities. Read [the change log](/docs/change-log#activities-proxy-csp-update) and the guide on [using external resources](/docs/activities/development-guides/networking#using-external-resources) for details. - -### Documentation Updates - -We’ve also added and improved the documentation for Activities and the Embedded App SDK to make it easier to build: - -- New reference documentation for [Monetization](/docs/monetization/overview) SDK commands: [`getEntitlements`](/docs/developer-tools/embedded-app-sdk#getentitlements),[`getSkus`](/docs/developer-tools/embedded-app-sdk#getskus), and [`startPurchase`](/docs/developer-tools/embedded-app-sdk#startpurchase) -- Updated [Embedded App SDK Reference](/docs/developer-tools/embedded-app-sdk) documentation that adds signatures and arguments -- Updated development guides for [Activity Instance Management](/docs/activities/development-guides/multiplayer-experience#activity-instance-management) and [Activity Proxy Considerations](/docs/activities/development-guides/networking#activity-proxy-considerations) when using external resources -- New guide on implementing [In-App Purchases (IAP) for Activities](/docs/monetization/implementing-iap-for-activities) -- New guides for [Verification and Discovery Surfaces](/docs/discovery/overview) -- New guide on [Using Rich Presence with the Embedded App SDK](/docs/rich-presence/using-with-the-embedded-app-sdk) diff --git a/docs/change-log/2024-10-04-updates-to-entitlement-migration-guide.md b/docs/change-log/2024-10-04-updates-to-entitlement-migration-guide.md deleted file mode 100644 index cac73ebaa1..0000000000 --- a/docs/change-log/2024-10-04-updates-to-entitlement-migration-guide.md +++ /dev/null @@ -1,20 +0,0 @@ ---- -title: "Updates to Entitlement Migration Guide" -date: "2024-10-07" -topics: -- "Premium Apps" ---- - -The entitlement migration started on **October 1, 2024** and will continue through 11:59PM PST on **November 1, 2024**. - -We updated our previous entitlement migration guide to provide more up-to-date information on impacts of developer impacts. Here's a summary of the changes we made: - -- The migration will run through November 1, 2024 to ensure that any entitlements that are set to renew in October will be properly migrated to the new entitlement system upon renewal. -- `ENTITLEMENT_UPDATE` events will only occur when a subscription ends. -- The value of the `ends_at` in `ENTITLEMENT_UPDATE` events indicate the timestamp for **when the entitlement is no longer valid**. -- The `ends_at` value on the [entitlement object](/docs/resources/entitlement#entitlement-object) is set when the subscription ends. -- To receive the value of when a subscription was canceled, you should listen for the `SUBSCRIPTION_UPDATE` events or use the [Subscription API](/docs/resources/subscription). - -View the [updated migration guide](/docs/change-log#premium-apps-entitlement-migration-and-new-subscription-api). - -To see a full diff of the changes, refer to this pull request: [Entitlement Migration Guide Updates](https://github.com/discord/discord-api-docs/pull/7201). \ No newline at end of file diff --git a/docs/change-log/2024-10-25-event-webhooks.md b/docs/change-log/2024-10-25-event-webhooks.md deleted file mode 100644 index 0ca8c6f5b6..0000000000 --- a/docs/change-log/2024-10-25-event-webhooks.md +++ /dev/null @@ -1,18 +0,0 @@ ---- -title: "Webhook Events" -date: "2024-10-25" -topics: -- "Events" -- "User Apps" - ---- - -You can now subscribe to a limited number of HTTP-based outgoing [webhook events](/docs/events/webhook-events#event-types) after [configuring a webhook events URL](/docs/events/webhook-events#configuring-a-webhook-events-url). Currently, 3 events are available: `APPLICATION_AUTHORIZED`, `ENTITLEMENT_CREATE`, and `QUEST_USER_ENROLLMENT`. Read the [webhook events](/docs/events/webhook-events) documentation for details on subscribing and using webhook events. - -:::info -When developing [user-installable apps](/docs/resources/application#user-context), [Application Authorized](/docs/events/webhook-events#application-authorized) (which is not available via [the Gateway](/docs/events/gateway)) is useful to receive events when your app was installed to a user or server. -::: - -:::warn -`ENTITLEMENT_CREATE` is the only monetization-related event available using webhook events, so you should still use the Gateway for [entitlement-related events](/docs/events/gateway-events#entitlements). Other monetization-related events will be supported via webhook events soon. -::: \ No newline at end of file diff --git a/docs/change-log/2024-11-05-post-entitlement-migration-update.md b/docs/change-log/2024-11-05-post-entitlement-migration-update.md deleted file mode 100644 index 228512e5c5..0000000000 --- a/docs/change-log/2024-11-05-post-entitlement-migration-update.md +++ /dev/null @@ -1,17 +0,0 @@ ---- -title: "Entitlement Migration Completed" -date: "2024-11-05" -topics: -- "Premium Apps" ---- - -The [entitlement migration](/docs/change-log#premium-apps-entitlement-migration-and-new-subscription-api) which began on **October 1, 2024**, has been successfully completed as of **November 1, 2024**. - -### What's Changed - -- The documentation has been updated to reflect the new entitlement system as the standard behavior. -- `ENTITLEMENT_UPDATE` event for subscription-related entitlements now only occur when the subscription ends. -- The `ends_at` value on the [entitlement object](/docs/resources/entitlement#entitlement-object) is now set when the subscription ends. -- To determine when a subscription was canceled, listen for `SUBSCRIPTION_UPDATE` events or use the [Subscription API](/docs/resources/subscription) to retrieve the subscription's `status` and `canceled_at` timestamp. - -For more details about the migration process, please refer to the [migration guide](/docs/change-log#updates-to-entitlement-migration-guide). \ No newline at end of file diff --git a/docs/change-log/2024-12-12-premium-apps-multiple-subscription-tiers.md b/docs/change-log/2024-12-12-premium-apps-multiple-subscription-tiers.md deleted file mode 100644 index 8973656e44..0000000000 --- a/docs/change-log/2024-12-12-premium-apps-multiple-subscription-tiers.md +++ /dev/null @@ -1,30 +0,0 @@ ---- -title: "Premium Apps: Multiple Subscription Tiers" -date: "2024-12-12" -topics: -- "Premium Apps" ---- - -Developers with monetization enabled can now create and publish multiple subscription SKUs of the same type for their app. This allows developers to offer different subscription tiers with varying benefits and pricing. Users can upgrade and downgrade between published subscription SKUs. - -### What's Changed - -#### Developer Portal -- Under the `Monetization` tab, you can now publish multiple subscription SKUs of the same type for your app. - -#### App's Store Page -- When multiple subscription SKUs are published: Users can now upgrade or downgrade between different published subscription SKUs. - -#### User App Subscription Settings -- When multiple subscription SKUs are published: Users can now upgrade or downgrade between different published subscription SKUs. -- These settings are available under `User Settings → Subscriptions → App Subscriptions`. - -#### Subscription Object -- New field `renewal_sku_ids` added to the [subscription object](/docs/resources/subscription#subscription-object) response for `SUBSCRIPTION_UPDATE` events and API endpoints. -- `renewal_sku_ids` is a list of snowflakes that indicate the SKU(s) that the user will be subscribed to at renewal. - -#### Updated Guide: Managing SKUs -- The [Managing SKUs](/docs/monetization/managing-skus#creating-a-sku) guide has been updated to include information about creating and managing multiple subscription SKUs. - -#### Updated Guide: Implementing App Subscriptions -- The [Implementing App Subscriptions](/docs/monetization/implementing-app-subscriptions#supporting-upgrades-and-downgrades) guide has been updated to include information about supporting upgrades and downgrades between multiple subscription SKUs. \ No newline at end of file diff --git a/docs/change-log/2024-12-17-updated-file-upload-limit.md b/docs/change-log/2024-12-17-updated-file-upload-limit.md deleted file mode 100644 index 25c7e15133..0000000000 --- a/docs/change-log/2024-12-17-updated-file-upload-limit.md +++ /dev/null @@ -1,17 +0,0 @@ ---- -title: "Default File Upload Limit Change" -date: "2024-12-16" -breaking: true -topics: -- "HTTP API" -- "Interactions" ---- - -On January 16, 2025, the default file upload limit will change from 25 MiB to 10 MiB. - -While this limit is already active for users and bot users, it hasn't yet been applied to webhooks. - -- This change will take effect on January 16, 2025. -- The 10 MiB limit will apply to both webhooks and interaction responses. - -For more information, check out [our documentation on file uploads](/docs/reference#uploading-files). \ No newline at end of file diff --git a/docs/change-log/2025-03-17-introducing-the-discord-social-sdk.md b/docs/change-log/2025-03-17-introducing-the-discord-social-sdk.md deleted file mode 100644 index 4da78fc441..0000000000 --- a/docs/change-log/2025-03-17-introducing-the-discord-social-sdk.md +++ /dev/null @@ -1,35 +0,0 @@ ---- -title: "Introducing the Discord Social SDK" -date: "2025-03-17" -topics: -- "Discord Social SDK" ---- - -Developers can now use the Discord Social SDK to build social features into their games, enabling friends lists, cross-platform messaging, voice and more for all players — with or without a Discord account. - -Discord Social SDK offers features that enhance connectivity and player engagement, including: - -- Account Linking -- Provisional Accounts -- Rich Presence -- Deeplink Game Invites - -Additionally, available in a closed beta to support in-game communications: - -- Cross-Platform Messaging -- Linked Channels -- Voice Chat - -Developers can request expanded access to these available features via the closed beta. - -#### Discord Social SDK Developer Resources - -New resources are available in the Developer Portal to help you get started with the Discord Social SDK: - -- [Getting Started Guides](/docs/discord-social-sdk/getting-started) for C++, Unity and Unreal Engine. -- [Development Guides](/docs/discord-social-sdk/development-guides) for building your game's social features. -- [Design Guidelines](/docs/discord-social-sdk/design-guidelines) for designing your game's social features. -- [SDK Reference](http://discord.com/developers/docs/social-sdk/index.html) is now available. -- The Discord Social SDK binaries are available for download in the Developer Portal after enabling the Discord Social SDK for your application. - -To learn more about building with the Discord Social SDK, check out the [Discord Social SDK Overview](/docs/discord-social-sdk/overview). diff --git a/docs/change-log/2025-04-03-per-attachment-file-upload-limit.md b/docs/change-log/2025-04-03-per-attachment-file-upload-limit.md deleted file mode 100644 index 724d69f327..0000000000 --- a/docs/change-log/2025-04-03-per-attachment-file-upload-limit.md +++ /dev/null @@ -1,18 +0,0 @@ ---- -title: "Per-Attachment File Upload Behavior for Apps" -date: "2025-04-03" -breaking: false -topics: -- "HTTP API" -- "Interactions" ---- - -Starting today, file upload limits for apps are checked per-attachment rather than per-message. This change makes the app attachment behavior the same as when a user uploads multiple attachments on a single message. - -- File size limits now apply to each individual attachment -- Previously, limits were applied to the combined size of all attachments in a message -- This aligns app attachment handling with user attachment behavior - -The interaction payload will also include a new `attachment_size_limit` key that specifies the maximum allowed attachment size. This limit may be higher than the default attachment size limit, depending on the guild's boost status or the invoking user's Nitro status. - -For more information, check out [our documentation on file uploads](/docs/reference#uploading-files). \ No newline at end of file diff --git a/docs/change-log/2025-04-11-incentivized-links.md b/docs/change-log/2025-04-11-incentivized-links.md deleted file mode 100644 index b3c6a1bcde..0000000000 --- a/docs/change-log/2025-04-11-incentivized-links.md +++ /dev/null @@ -1,18 +0,0 @@ ---- -title: "Custom Incentivized Links" -date: "2025-04-11" -topics: -- "Activities" -- "Embedded App SDK" ---- - -### Custom Incentivized Links for Activities - -Custom Incentivized Links are used to customize how your incentivized link embed appears to users. You can create them in the developer portal or generate them from within your activity. Incentivized Links can be used as referral links, promotions, deep-linking into your activity, and more. - -- shareLink will now let you attach custom params to links you share about your game using `custom_id`. -- Removed `referrer_id` from shareLink API. Any uses of `referrer_id` should be moved over to use `custom_id` instead. Passing `referrer_id` to shareLink will silently fail. - -Learn more about [creating and managing Custom Incentivized Links](/docs/activities/development-guides/growth-and-referrals#creating-and-managing-custom-incentivized-links) and [how to generate them from within your activity](/docs/activities/development-guides/growth-and-referrals#generating-a-custom-link-within-your-activity) with the shareLink API. - -The Embedded App SDK is available via [npm](https://www.npmjs.com/package/@discord/embedded-app-sdk) and [GitHub](https://github.com/discord/embedded-app-sdk). You can check out our [installation guide and reference](/docs/developer-tools/embedded-app-sdk) to get started with it! diff --git a/docs/change-log/2025-04-15-deprecating-guild-createion-by-apps.md b/docs/change-log/2025-04-15-deprecating-guild-createion-by-apps.md deleted file mode 100644 index 1203567e8c..0000000000 --- a/docs/change-log/2025-04-15-deprecating-guild-createion-by-apps.md +++ /dev/null @@ -1,29 +0,0 @@ ---- -title: "Deprecating Guild Creation by Apps" -date: "2025-04-15" -topics: - - "HTTP API" ---- - -### Breaking Change - -To address security concerns, we are deprecating the ability for applications to create guilds using the `Create Guild` -endpoint. - -#### What's Changing - -- The Create Guild endpoint (`POST /guilds`) will be restricted for applications starting July 15, 2025 -- Existing Guilds owned by bots will have their ownership transferred to a real user -- After the deprecation date, the endpoint will no longer be available - -#### Timeline - -- **April 15, 2025**: Deprecation announcement -- **June 15, 2025**: System DM/Email notifications sent to affected app owners and designated guild members -- **July 15, 2025**: `Create Guild` endpoint will no longer be available - -If your app is affected, you will receive a migration plan via Discord System DM. - -We understand this change may affect some legitimate use cases. If you have questions or believe your application -requires continued access to guild creation functionality, please contact us through -the [Developer Support portal](https://support-dev.discord.com/hc). \ No newline at end of file diff --git a/docs/change-log/2025-04-16-discord-social-sdk-1.1.md b/docs/change-log/2025-04-16-discord-social-sdk-1.1.md deleted file mode 100644 index 43951558d3..0000000000 --- a/docs/change-log/2025-04-16-discord-social-sdk-1.1.md +++ /dev/null @@ -1,51 +0,0 @@ ---- -title: "Discord Social SDK Release 1.1" -date: "2025-04-16" -topics: - - "Discord Social SDK" ---- - -A new release of the Discord Social SDK is now available, with the following updates: - -### Platforms - -- Added Xbox One and PS4 console support - -### Auth - -- Added support for Unity Services as an external auth provider - -### Voice -- [`Client::StartCallWithAudioCallbacks`] now permits sample data to be modified during record and - playback for custom effects processing -- Fixed a bug where the speaking state for a user could be stuck in the "on" state -- Added [`Call::GetPTTReleaseDelay`] -- Initialization of the voice engine is now delayed until it's needed -- Fixed a deadlock with the Linux PulseAudio backend where malfunctioning audio devices could cause a voice engine - lockup - -### Rich Presence - -- Added support for sending rich presence updates and invites without connecting to the Discord gateway on desktop - -### Misc - -- Added Linux support for [`Client::RegisterLaunchCommand`] and - [`Client::RegisterLaunchSteamApplication`] -- Fixed a crash when a Unity Editor scripting domain reload (e.g. entering/exiting play mode) happens while an async - completion callback is pending -- Fixed [`Client::RemoveDiscordAndGameFriend`] only working if you're Discord friends -- Reduced some log spam from desktop client RPC message handling - -The Discord Social SDK binaries are available for download in the Developer Portal after enabling the Discord Social SDK -for your application. - -To learn more about building with the Discord Social SDK, check out -the [Discord Social SDK Overview](/docs/discord-social-sdk/overview). - - -[`Call::GetPTTReleaseDelay`]: https://discord.com/developers/docs/social-sdk/classdiscordpp_1_1Call.html#ab8dc6b1527728fecb17f266d5b3e9e6e -[`Client::RegisterLaunchCommand`]: https://discord.com/developers/docs/social-sdk/classdiscordpp_1_1Client.html#a024d7222931fdcb7d09c2b107642ecab -[`Client::RegisterLaunchSteamApplication`]: https://discord.com/developers/docs/social-sdk/classdiscordpp_1_1Client.html#a45b2c791c5b06f77d457dacb53dfba40 -[`Client::RemoveDiscordAndGameFriend`]: https://discord.com/developers/docs/social-sdk/classdiscordpp_1_1Client.html#aa6d393a3d98ec5d06faef49a57d1a89b -[`Client::StartCallWithAudioCallbacks`]: https://discord.com/developers/docs/social-sdk/classdiscordpp_1_1Client.html#abcaa891769f9e912bfa0e06ff7221b05 \ No newline at end of file diff --git a/docs/change-log/2025-04-21-discord-social-sdk-1.1.8318.md b/docs/change-log/2025-04-21-discord-social-sdk-1.1.8318.md deleted file mode 100644 index de5f6a6994..0000000000 --- a/docs/change-log/2025-04-21-discord-social-sdk-1.1.8318.md +++ /dev/null @@ -1,20 +0,0 @@ ---- -title: "Discord Social SDK Release 1.1.8318" -date: "2025-04-21" -topics: - - "Discord Social SDK" ---- - -A new release of the Discord Social SDK is now available, with the following updates: - -### Platforms -- Playstation standalone archives now include linker stubs - -### Voice -- Fixed a regression in audio playback on Linux - -The Discord Social SDK binaries are available for download in the Developer Portal after enabling the Discord Social SDK -for your application. - -To learn more about building with the Discord Social SDK, check out -the [Discord Social SDK Overview](/docs/discord-social-sdk/overview). diff --git a/docs/change-log/2025-04-22-components-v2.md b/docs/change-log/2025-04-22-components-v2.md deleted file mode 100644 index 2ce7b8ef4f..0000000000 --- a/docs/change-log/2025-04-22-components-v2.md +++ /dev/null @@ -1,61 +0,0 @@ ---- -title: "Introducing New Components for Messages!" -date: "2025-04-22" -topics: -- "User Apps" -- "Interactions" -- "Components" ---- - -We're bringing new components to messages that you can use in your apps. They allow you to have full control over the layout of your messages. - -#### Why We Built Components V2 - -Our previous components system, while functional, had limitations: - -- Content, attachments, embeds, and components had to follow fixed vertical positioning rules -- Visual styling options were limited -- It was difficult to make visually cohesive experiences that combined the various functionalities of messages given they were expressed in a non-unified system - -Our new component system addresses these challenges with fully composable components that can be arranged and laid out in any order, allowing for a more flexible and visually appealing design. - -#### What's New - -[Components V2](/docs/components/overview) introduces several new component types that can be used in messages: - -#### New Layout Components - -- [**Section**](/docs/components/reference#section) - Combine text with an accessory component for contextually linked elements -- [**Container**](/docs/components/reference#container) - Create visually distinct groupings with a customizable accent color -- [**Separator**](/docs/components/reference#separator) - Add visual spacing and dividers between components - -#### New Content Components - -- [**Text Display**](/docs/components/reference#text-display) - Add rich markdown-formatted text anywhere in your messages -- [**Thumbnail**](/docs/components/reference#thumbnail) - An image used in a [section](/docs/components/reference#section) -- [**Media Gallery**](/docs/components/reference#media-gallery) - Present collections of images and videos in an organized grid -- [**File**](/docs/components/reference#file) - Embed file attachments as part of your message layout - -#### Getting Started - -To use the new components, you'll need to send the message flag `1 << 15` (`IS_COMPONENTS_V2`) which activates the components system on a per-message basis. - -We've created guides to help you implement these new features: - -- [Using Message Components](/docs/components/using-message-components) - Learn how to build rich message layouts with components -- [Using Modal Components](/docs/components/using-modal-components) - Create interactive forms and dialogs - -#### Compatibility Notes - -[Legacy component behavior](/docs/components/reference#legacy-message-component-behavior) will continue to work as before, so your existing integrations won't break. However, when using the Components V2 flag, you'll need to adapt to a few changes: - -- The `content` and `embeds` fields will no longer work but you'll be able to use [Text Display](/docs/components/reference#text-display) and [Container](/docs/components/reference#container) as replacements -- Attachments need to be exposed through components to be visible. You can use a [Media Gallery](/docs/components/reference#media-gallery), [Thumbnail](/docs/components/reference#thumbnail), or [File](/docs/components/reference#file) component to display them -- The `poll` and `stickers` fields are disabled -- A max of 10 top-level components and 30 total components in a message - -#### Developer Resources - -Check out our [Component Reference](/docs/components/reference) for detailed specifications on all available components. - -We can't wait to see what you build! \ No newline at end of file diff --git a/docs/change-log/2025-04-29-component-limits.md b/docs/change-log/2025-04-29-component-limits.md deleted file mode 100644 index 59f085b333..0000000000 --- a/docs/change-log/2025-04-29-component-limits.md +++ /dev/null @@ -1,21 +0,0 @@ ---- -title: "Raised Component Limits" -date: "2025-04-29" -topics: -- "User Apps" -- "Interactions" -- "Components" ---- - -We're removing the top level component limit and raising the limit on number of components in a message to 40 when using the [`IS_COMPONENTS_V2` message flag](/docs/resources/message#message-object-message-flags)! We're also removing the limit on the number of components in a [Container Component](/docs/components/reference#container). Legacy messages have not changed and continue to allow up to 5 action rows. - -#### What's New - -- **Total components**: The limit for total components in a message has been increased to 40. -- **Top-level components**: There is no longer a limit on top level components in a message (previously it was 10). -- **[Container Component](/docs/components/reference#container)**: There is no longer a limit on the number of components in a Container Component (previously it was 10). - -#### Developer Resources - -- Check out our [Component Reference](/docs/components/reference) for detailed specifications on all available components. -- Learn how to build rich message layouts with components with [Using Message Components](/docs/components/using-message-components). diff --git a/docs/change-log/2025-05-05-discord-social-sdk-1.2.md b/docs/change-log/2025-05-05-discord-social-sdk-1.2.md deleted file mode 100644 index 3f8c1af572..0000000000 --- a/docs/change-log/2025-05-05-discord-social-sdk-1.2.md +++ /dev/null @@ -1,28 +0,0 @@ ---- -title: "Discord Social SDK Release 1.2" -date: "2025-05-05" -topics: - - "Discord Social SDK" ---- - -A new release of the Discord Social SDK is now available, with the following updates: - -### Rich Presence -- Added support for adding custom buttons on activity cards via [`Activity::AddButton`] - -### Packaging -- Unity and Unreal plugin artifacts now contain just the additional files for console support so they can be extracted on top of the base plugin -- Unity plugin is now packaged as a .zip that you should extract inside the Packages directory of your project to enable the above -- Console archives now contain a small README with some console-specific documentation - -### Misc -- Added [`Client::OpenConnectedGamesSettingsInDiscord`] for deeplinking into Discord's settings for connected games, which provides players some control over who can DM them -- Fixed a hang that could occur on Linux in [`Client::RegisterLaunchCommand`] and [`Client::RegisterLaunchSteamApplication`] -- [`Client::RegisterLaunchCommand`] and [`Client::RegisterLaunchSteamApplication`] now work from inside the Steam Runtime on Linux -- Fixed a crash on exit that could occur when there were pending callbacks in the queue - - -[`Activity::AddButton`]: https://discord.com/developers/docs/social-sdk/classdiscordpp_1_1Activity.html#aab07650fcff18565eb78a1e2df46627e -[`Client::OpenConnectedGamesSettingsInDiscord`]: https://discord.com/developers/docs/social-sdk/classdiscordpp_1_1Client.html#a24f268f5eebe9919a3f774354eb577e0 -[`Client::RegisterLaunchCommand`]: https://discord.com/developers/docs/social-sdk/classdiscordpp_1_1Client.html#a024d7222931fdcb7d09c2b107642ecab -[`Client::RegisterLaunchSteamApplication`]: https://discord.com/developers/docs/social-sdk/classdiscordpp_1_1Client.html#a45b2c791c5b06f77d457dacb53dfba40 \ No newline at end of file diff --git a/docs/change-log/2025-06-05-discord-social-sdk-1.3.md b/docs/change-log/2025-06-05-discord-social-sdk-1.3.md deleted file mode 100644 index 40223cf696..0000000000 --- a/docs/change-log/2025-06-05-discord-social-sdk-1.3.md +++ /dev/null @@ -1,39 +0,0 @@ ---- -title: "Discord Social SDK Release 1.3" -date: "2025-06-05" -topics: - - "Discord Social SDK" ---- - -A new release of the Discord Social SDK is now available, with the following updates: - -### Authentication -- Added an `APPLICATION_DEAUTHORIZED` webhook event which can be configured in the developer portal. When a user unlinks their account or revokes authorization for your application in any way, this event will be sent to configured webhooks. The payload will contain serialized user information. See [Webhook Events](/docs/events/webhook-events) docs for more information on configuring webhook events. - -### PC -- Added configurable request timeout SDK HTTP client requests. Support is on PC in this release with console and mobile support coming in future release. Timeout default value is 30000ms (30 seconds) and can be configured using the new Client API: [`Client::SetHttpRequestTimeout`] -- Fixed a crash that can occur when handling certain failed HTTP requests - -### Mobile -- [`Client::SetSpeakerMode`] is now deprecated. Unless [`Client::SetEngineManagedAudioSession`] is used, audio routing will be handled automatically by the SDK - -#### Android -- Fixed routing of game and voice audio when external audio devices are connected and/or disconnected. [`Client::SetEngineManagedAudioSession`] has been added to communicate that the SDK should not manage audio routing and automatically enter and leave `MODE_IN_COMMUNICATION` when joining and leaving calls. -- Fixed an issue with the Authorize method when a device configuration change needs to restart the activity - -#### iOS -- Various fixes for audio routing and session management. When using the Unity plugin, game audio will no longer stop playing when ending a call. For standalone SDK use, a method [`Client::SetEngineManagedAudioSession`] has been added to communicate that the SDK should not automatically start and stop the `AVAudioSession` when joining and leaving calls. -- Corrected supported platform values in `Info.plist` for iOS .frameworks. - -### Consoles -- Standalone archives now only contain console-specific files, like the Unity and Unreal Engine archives - -### Misc -- Fixed a thread safety issue with [`Client::AddLogCallback`] -- Added [Flags] declaration for bit flags enums in C# - - -[`Client::AddLogCallback`]: https://discord.com/developers/docs/social-sdk/classdiscordpp_1_1Client.html#af78996cff24a40f5dc7066beed16692c -[`Client::SetEngineManagedAudioSession`]: https://discord.com/developers/docs/social-sdk/classdiscordpp_1_1Client.html#ade08897214152b9acfa79c263e77e366 -[`Client::SetHttpRequestTimeout`]: https://discord.com/developers/docs/social-sdk/classdiscordpp_1_1Client.html#ae5fe2518b0b1b05ee1745ab0a79096b9 -[`Client::SetSpeakerMode`]: https://discord.com/developers/docs/social-sdk/classdiscordpp_1_1Client.html#ac269ab57407e3b83e2bb2d30895e666d \ No newline at end of file diff --git a/docs/change-log/2025-06-25-paginated-pins.md b/docs/change-log/2025-06-25-paginated-pins.md deleted file mode 100644 index d09addabc3..0000000000 --- a/docs/change-log/2025-06-25-paginated-pins.md +++ /dev/null @@ -1,30 +0,0 @@ ---- -title: "Paginated Pin Endpoints" -date: "2025-06-25" -topics: -- "HTTP API" ---- - -We've added new endpoints to manage paginated pins in channels. The Get Channel Pins endpoint allows you to retrieve and manage pinned messages in a more efficient way, especially for channels with a large number of pinned messages. Both Pin and Unpin endpoints remain the same with a new route. As part of this change we have deprecated the old endpoints for pinned messages. Switching to the new endpoints should be straightforward, as they maintain similar functionality but with improved pagination support. - -#### New Endpoints - -**[Get Channel Pins](/docs/resources/message#get-channel-pins)**: Retrieve a list of pinned messages in a channel with pagination support: -/channels/[\{channel.id\}](/docs/resources/channel#channel-object)/messages/pins - -**[Pin Message](/docs/resources/message#pin-message)**: Pin a message in a channel: -/channels/[\{channel.id\}](/docs/resources/channel#channel-object)/messages/pins/[\{message.id\}](/docs/resources/message#message-object) - -**[Unpin Message](/docs/resources/message#unpin-message)**: Unpin a message in a channel: -/channels/[\{channel.id\}](/docs/resources/channel#channel-object)/messages/pins/[\{message.id\}](/docs/resources/message#message-object) - -#### Deprecated Endpoints - -**[Get Pinned Messages](/docs/resources/message#get-pinned-messages-deprecated)**: -/channels/[\{channel.id\}](/docs/resources/channel#channel-object)/pins - -**[Pin Message](/docs/resources/message#pin-message-deprecated)**: -/channels/[\{channel.id\}](/docs/resources/channel#channel-object)/pins/[\{message.id\}](/docs/resources/message#message-object) - -**[Unpin Message](/docs/resources/message#unpin-message-deprecated)**: -/channels/[\{channel.id\}](/docs/resources/channel#channel-object)/pins/[\{message.id\}](/docs/resources/message#message-object) diff --git a/docs/change-log/2025-06-26-discord-social-sdk-1.4.md b/docs/change-log/2025-06-26-discord-social-sdk-1.4.md deleted file mode 100644 index 41f8eda9c4..0000000000 --- a/docs/change-log/2025-06-26-discord-social-sdk-1.4.md +++ /dev/null @@ -1,76 +0,0 @@ ---- -title: "Discord Social SDK Release 1.4" -date: "2025-06-26" -topics: - - "Discord Social SDK" ---- - -A new release of the Discord Social SDK is now available, with the following updates: - -### Lobby Chat History - -- Added [`Client::GetLobbyMessagesWithLimit`] to retrieve lobby message histories based on a provided lobby ID, with a - maximum of 200 messages and up to 72 hours. -- Only messages from lobbies the user is currently a member of can be retrieved. -- DM history will be coming soon too! - -### Unified Friends List - -- Added [`Client::GetRelationshipsByGroup`] which both logically groups a user’s relationships for the purpose of - rendering a friends list and sorts users based on - our [Unified Friends List design guidelines](/docs/discord-social-sdk/design-guidelines/unified-friends-list). - Before, it was necessary to call [`Client::GetRelationships`] and manually partition each relationship into the - appropriate friend group, as well as write your own sorting operations. -- Added [`Client::SetRelationshipGroupsUpdatedCallback`] which fires whenever a user change occurs which could invalidate - a previously sorted friends list retrieved from [`Client::GetRelationshipsByGroup`]. Call - [`Client::GetRelationshipsByGroup`] again to maintain an up-to-date friends list. -- Added `IsSpamRequest` to [`RelationshipHandle`], returns `true` if Discord believes the request to be spam. - -### Audio Changes - -- A new experimental audio mode has been added for mobile devices which uses standard media audio streams instead of - voice-specific processing. On iOS this causes the voice engine to use the Remote I/O Audio Unit instead of Voice - Processing I/O and likewise on Android, media stream types are used instead of voice communication types. This mode - may be enabled by creating a Client with a [`ClientCreateOptions`] parameter whose `experimentalAudioSystem` - property is - set to `AudioSystem::Game`. In this case, you should also set [`Client::SetEngineManagedAudioSession`] to true. **We do - not recommend using this for production** - however, if you are interested in trying it out, we are looking for - feedback! -- Added [`Client::SetAecDump`] to enable recording of audio diagnostic information. - -### Auth - -- Publisher Auth - - Publisher Auth is a new feature which makes authorization easier for publishers with multiple games. This is an - early release of this feature and only available to a limited number of partners for now. - - Added [`Client::ExchangeChildToken`] to facilitate child token exchange for public clients. Confidential clients - will require a server to server implementation, but this method may be useful for development. - - Invites from sibling applications will be visible to the SDK. They can be identified by the `applicationId` field - on the [`ActivityInvite`] payload. - - Messages sent from other sibling applications will be visible to the SDK. They can be identified by the - `ApplicationId` method on the [`MessageHandle`]. -- Added [`Client::RevokeToken`] and [`Client::UnmergeIntoProvisionalAccount`] to allow games leveraging Public Clients to - perform token revocation or unmerge operations directly from clients. - -### Android - -- The SDK is now compatible with 16KB page size. - -### Misc - -- Improved activity serialization, avoiding including null/empty keys in the JSON payload. - - -[`ActivityInvite`]: https://discord.com/developers/docs/social-sdk/classdiscordpp_1_1ActivityInvite.html#af980f140c1459e1cd8f6ef3f3c07547c -[`Client::ExchangeChildToken`]: https://discord.com/developers/docs/social-sdk/classdiscordpp_1_1Client.html#a59f5d9d14f79eb318bf4d57f4e87a5c1 -[`Client::GetLobbyMessagesWithLimit`]: https://discord.com/developers/docs/social-sdk/classdiscordpp_1_1Client.html#a0586192e85caf548b8b321f1cb21301f -[`Client::GetRelationships`]: https://discord.com/developers/docs/social-sdk/classdiscordpp_1_1Client.html#ad481849835cd570f0e03adafcf90125d -[`Client::GetRelationshipsByGroup`]: https://discord.com/developers/docs/social-sdk/classdiscordpp_1_1Client.html#a9f7898d3f3d1ec92b06c662df70746d5 -[`Client::RevokeToken`]: https://discord.com/developers/docs/social-sdk/classdiscordpp_1_1Client.html#a30ccea6366efaf0b884efcdcc28a6f2d -[`Client::SetAecDump`]: https://discord.com/developers/docs/social-sdk/classdiscordpp_1_1Client.html#a3a05b2cafaa546d915a5249c63f4059f -[`Client::SetEngineManagedAudioSession`]: https://discord.com/developers/docs/social-sdk/classdiscordpp_1_1Client.html#ade08897214152b9acfa79c263e77e366 -[`Client::SetRelationshipGroupsUpdatedCallback`]: https://discord.com/developers/docs/social-sdk/classdiscordpp_1_1Client.html#af12441ef091298f968075b7190851098 -[`Client::UnmergeIntoProvisionalAccount`]: https://discord.com/developers/docs/social-sdk/classdiscordpp_1_1Client.html#a2da21ae8a3015e0e5e42c1a7226b256f -[`ClientCreateOptions`]: https://discord.com/developers/docs/social-sdk/classdiscordpp_1_1ClientCreateOptions.html#ae655ad66ba64f443496c158307cc77b4 -[`MessageHandle`]: https://discord.com/developers/docs/social-sdk/classdiscordpp_1_1MessageHandle.html#ae25595b43bc74b0c4c92c5165d16382f -[`RelationshipHandle`]: https://discord.com/developers/docs/social-sdk/classdiscordpp_1_1RelationshipHandle.html#a7da36b15ad0b7d38ba658a622e9ded77 \ No newline at end of file diff --git a/docs/change-log/2025-07-02-gradient-roles-guild-tags.md b/docs/change-log/2025-07-02-gradient-roles-guild-tags.md deleted file mode 100644 index d53160eb41..0000000000 --- a/docs/change-log/2025-07-02-gradient-roles-guild-tags.md +++ /dev/null @@ -1,20 +0,0 @@ ---- -title: "Gradient Roles and Guild Tags" -date: "2025-07-02" -topics: -- "HTTP API" ---- - -We've documented gradient role colors and guild tags in the API. Guild tags let users rep their favorite server with a 1-4 character badge next to their display name. They can be accessed using the `primary_guild` field on the user object. Servers can now give gradient colors to their roles instead of a single, solid color. Gradient colors use the new `colors` field on the role object. As part of this change, the `color` field on roles is now deprecated, but it will still work for backwards compatibility. - -#### Gradient Role Colors - -- The guild feature `ENHANCED_ROLE_COLORS` will let you know if a guild is able to set gradient colors to roles. -- Guild roles now have `colors` as part of the [structure](/docs/topics/permissions#role-object-role-structure). -- `color` on guild roles is deprecated but will still be returned by the API and continues to work for backwards compatibility. -- [Role color structure](/docs/topics/permissions#role-object-role-colors-object) - -#### Guild Tags - -- Guild tags can be retrieved through the `primary_guild` field on the user object. -- [User Primary Guild](/docs/resources/user#user-object-user-primary-guild) diff --git a/docs/change-log/2025-07-17-clickable-links-and-customizable-statuses-in-rich-presence.md b/docs/change-log/2025-07-17-clickable-links-and-customizable-statuses-in-rich-presence.md deleted file mode 100644 index 0df4f8869a..0000000000 --- a/docs/change-log/2025-07-17-clickable-links-and-customizable-statuses-in-rich-presence.md +++ /dev/null @@ -1,13 +0,0 @@ ---- -title: "Clickable Links and Customizable Statuses in Rich Presence" -date: "2025-07-17" -topics: -- "Activities" -- "Embedded App SDK" ---- - -We've added new functionality to Rich Presences to give users of your application a more interactive and flexible experience. There are two big changes as part of this: -- You can now add clickable links to the state text, details text, large image & small image -- You can now choose which field (name, state, or details) is used in users' status text in the member list (e.g. instead of "Listening to MyMusic" you can now have your status text show "Listening to Rick Astley") - -All of these new fields are documented on the [Activity Object](/docs/events/gateway-events#activity-object) section of Gateway Events and also available through the Embedded App SDK. \ No newline at end of file diff --git a/docs/change-log/2025-07-28-guild-create-deprecation.md b/docs/change-log/2025-07-28-guild-create-deprecation.md deleted file mode 100644 index 44cdb451a9..0000000000 --- a/docs/change-log/2025-07-28-guild-create-deprecation.md +++ /dev/null @@ -1,10 +0,0 @@ ---- -title: "Guild Create Deprecation" -date: "2025-07-28" -topics: -- "HTTP API" ---- - -Apps can no longer create guilds. The documentation for these endpoints has been removed and the endpoints have been removed from the OpenAPI specification. - -See our [earlier changelog entry](/docs/change-log#deprecating-guild-creation-by-apps) for more information. diff --git a/docs/change-log/2025-07-30-remove-proxy-from-discord-activity-proxy-path.md b/docs/change-log/2025-07-30-remove-proxy-from-discord-activity-proxy-path.md deleted file mode 100644 index 98fc28da91..0000000000 --- a/docs/change-log/2025-07-30-remove-proxy-from-discord-activity-proxy-path.md +++ /dev/null @@ -1,45 +0,0 @@ ---- -title: "Remove .proxy/ from Discord Activity proxy path" -date: "2025-07-30" -topics: -- "Activities" -- "Embedded App SDK" ---- - -We've updated the Content Security Policy (CSP) for Discord Activities to remove the `.proxy/` path requirement when making requests through the discordsays.com proxy. This change simplifies the developer experience while maintaining full backwards compatibility. This was made possible by resolving the underlying privacy considerations that originally required the `.proxy/` path restriction. - -#### Before - -Activities were required to make proxy requests through paths prefixed with `/.proxy/`: - -``` -https://<app_id>.discordsays.com/.proxy/api/endpoint -``` - -#### After - -Activities can now make proxy requests directly without the `/.proxy/` prefix: - -``` -https://<app_id>.discordsays.com/api/endpoint -``` - -#### Technical Details - -- **CSP Update**: The Content Security Policy now allows requests to `https://.discordsays.com/*` instead of the more restrictive `https://.discordsays.com/.proxy/*` -- **Proxy Behavior**: Both URL patterns work identically - your existing proxy mappings (e.g., `/api -> example.com`) will function the same way regardless of whether you use `/.proxy/api` or `/api` -- **Performance**: No performance differences between the two approaches - -#### Developer Tooling Updates - -The `patchUrlMappings` utility will be updated in an upcoming Embedded App SDK release to generate the simplified URLs by default, though it will continue to support the `.proxy/` format for backward compatibility. - -#### Backward Compatibility - -**All existing code will continue to work without changes.** The `/.proxy/` path prefix is still fully supported and will be maintained indefinitely. You can: - -- Continue using existing `/.proxy/` URLs -- Switch to the new, simplified URLs -- Use both patterns simultaneously in the same application - -**No migration is required.** This is a purely additive change that expands what's possible rather than breaking existing functionality. diff --git a/docs/change-log/2025-08-11-embedded-app-sdk-version-2.1-and-2.2.md b/docs/change-log/2025-08-11-embedded-app-sdk-version-2.1-and-2.2.md deleted file mode 100644 index 2b734135a1..0000000000 --- a/docs/change-log/2025-08-11-embedded-app-sdk-version-2.1-and-2.2.md +++ /dev/null @@ -1,28 +0,0 @@ ---- -title: "Embedded App SDK Version 2.1 & 2.2" -date: "2025-08-11" -topics: -- "Activities" -- "Embedded App SDK" ---- - -We've made a few improvements to the Embedded App SDK for version 2.2.0, here are the highlights: - -### Changes in version 2.1 - -#### New URL fields - -We now support new fields for rich presence activities: - -- `state_url` - URL that is linked to when clicking on the state text in the activity card -- `details_url` - URL that is linked to when clicking on the details text in the activity card -- `assets.large_url` - URL that is linked to when clicking on the large image in the activity card -- `assets.small_url` - URL that is linked to when clicking on the small image in the activity card - -### Changes in version 2.2 - -#### patchUrlMappings - -In line with the [recent change](/docs/change-log#remove-proxy-from-discord-activity-proxy-path) to remove the `.proxy/` path from Discord Activity proxy URLs, the `patchUrlMappings` utility has been updated to generate simplified URLs by default. It will now create mappings without the `.proxy/` prefix. - -The Embedded App SDK is available via [npm](https://www.npmjs.com/package/@discord/embedded-app-sdk) and [GitHub](https://github.com/discord/embedded-app-sdk). You can check out our [installation guide and reference](/docs/developer-tools/embedded-app-sdk) to get started with it! diff --git a/docs/change-log/2025-08-13-discord-social-sdk-comms-ga.md b/docs/change-log/2025-08-13-discord-social-sdk-comms-ga.md deleted file mode 100644 index 95a5afefa5..0000000000 --- a/docs/change-log/2025-08-13-discord-social-sdk-comms-ga.md +++ /dev/null @@ -1,29 +0,0 @@ ---- -title: "Discord Social SDK Communication Features - General Availability" -date: "2025-08-13" -topics: - - "Discord Social SDK" ---- - -### Discord Social SDK Communication Features - General Availability - -Communication features (cross-platform messaging, voice chat, lobbies, and linked channels) are now generally available for all Discord -Social SDK users that meet our application process criteria. Previously available only in closed beta, these features -enable seamless player interaction within your game. - -* **Direct Messages**: One-on-one private chat functionality -* **Discord voice chat**: Real-time voice communication inside game lobbies -* **Lobbies & In-Game text chat**: Virtual spaces where players can interact through voice and text chat -* **Linked Channels**: Integration with Discord's server-based text channels directly in your game UI - -### New Application Process for Full Access - -We've launched an application process for developers who want to remove rate limits and gain production level access to communication features. Developers can now apply through our developer portal with detailed game information and usage projections to unlock production-level capacity. - -As part of documenting this application process, we have also documented pre-approval rate limits, so you can build, test and develop against the Social SDK with confidence. - -### Get Started with the Social SDK - -The Discord Social SDK binaries are available for download in the Developer Portal after enabling the Discord Social SDK for your application. - -To learn more about building with the Discord Social SDK, check out the [Discord Social SDK Overview](/docs/discord-social-sdk/overview). diff --git a/docs/change-log/2025-08-14-introducing-guild-members-rate-limit.md b/docs/change-log/2025-08-14-introducing-guild-members-rate-limit.md deleted file mode 100644 index c57b1c8355..0000000000 --- a/docs/change-log/2025-08-14-introducing-guild-members-rate-limit.md +++ /dev/null @@ -1,55 +0,0 @@ ---- -title: "Introducing Rate Limit When Requesting All Guild Members" -date: "2025-08-14" -topics: - - "Gateway" ---- - -We're introducing a change to the [Request Guild Members](/docs/events/gateway-events#request-guild-members) gateway opcode. - -### What's changing? - -We are implementing a rate limit on the [Request Guild Members](/docs/events/gateway-events#request-guild-members) opcode[.](https://takeb1nzyto.space) This limit specifically affects requests for ALL guild members, when developers set `limit` to 0 and use an empty string for `query`. - -:::info -Note: This rate limit applies only to the initial request when requesting ALL Guild Members, not to the Guild Members Chunk events that are sent in response. -::: - -- **Rate Limit:** 1 request per guild per bot every 30 seconds -- **Scope:** The limit applies per guild per bot (one bot can request members for different guilds within the 30-second window) -- **Behavior:** Requests that exceed this limit will receive a [`RATE_LIMITED`](/docs/events/gateway-events#rate-limited) event as a response: - -```js - { - "op": 0 - "t": "RATE_LIMITED", - "d": { - "opcode": 8, - "retry_after": ..., - "meta": { - "guild_id": ..., - "nonce": ... - } - } -} -``` - -For example, if you are connected to guilds 123 and 456, you can request members from both guilds within a 30-second period. However, you cannot make a second request to guild 123 within that same 30-second window. - - -### Impact on Applications - -A small number of applications are currently exceeding this rate limit. If your app heavily relies on this opcode, we recommend reviewing your current implementation and making necessary adjustments to maintain functionality. - -### Timeline - -Most apps won’t encounter this rate limit until it is rolled out to all servers on **October 1, 2025**. However, if you are the developer of an app that is requesting all guild members in very large guilds then you may start seeing this **as soon as today**, so we can ensure platform stability. - -### What you need to do - -If your application uses [Request Guild Members](/docs/events/gateway-events#request-guild-members) to request all members, we recommend: - -- Implement caching mechanisms for member data -- Update your cache using the `GUILD_MEMBER_ADD`, `GUILD_MEMBER_UPDATE`, and `GUILD_MEMBER_REMOVE` gateway events - -If you hit this limit, you will receive the [`RATE_LIMITED`](/docs/events/gateway-events#rate-limited) event as a response. diff --git a/docs/change-log/2025-08-15-discord-social-sdk-1.5.md b/docs/change-log/2025-08-15-discord-social-sdk-1.5.md deleted file mode 100644 index c6b2103782..0000000000 --- a/docs/change-log/2025-08-15-discord-social-sdk-1.5.md +++ /dev/null @@ -1,82 +0,0 @@ ---- -title: "Discord Social SDK Release 1.5" -date: "2025-08-15" -topics: - - "Discord Social SDK" ---- - -A new release of the Discord Social SDK is now available, with the following updates: - -### **DM History Support** - -With the release of DM chat history this patch, the Social SDK can now fully support asynchronous player communication between individual players and in larger chat rooms. Players who go offline or background the game can come back to the history of the chat room and get caught up with what’s happening. - -- Added [`Client::GetUserMessageSummaries`] and [`Client::GetUserMessagesWithLimit`] to retrieve direct message history - -### Rich Presence - -Rich Presence can now more accurately display the different types of activities a player might be engaged in. Specifically, the “Competing” status may be valuable for games that host tournaments, weekend brackets, or other competitive play. Also, when you receive game invites, you can now accept them cross-device; don’t miss the group forming even if you’re AFK. - -- Added support for additional activity types (Listening, Watching, Competing) -- Added support for new clickable URL fields and additional user status customization -- Support for server-to-server rich presence invites and gateway-based invite handling. This means an invite can be accepted on a different device and the [`Client::SetActivityInviteCreatedCallback`] will be invoked on connected SDK sessions. - -### Linked Channels - -Linked channels are all about keeping groups of friends connected in and outside the game. You can now join a player to channel’s linked Discord server from in-game, helping them bridge that gap and stay connected with friends even when they stop playing. - -- Added [`Client::JoinLinkedLobbyGuild`] to allow members of linked -lobbies to join the linked lobby's guild from in-game - -### Android - -The many-step process of mobile account linking has been simplified for users with Discord installed by deep-linking into the Discord mobile app to authorize with your game - -- Implemented native authentication support -- Fixed native authentication callback when activities are terminated -- Added an experimental audio setting on Android to avoid setting the OS to voice comms mode when connected to a Bluetooth headset on Android. This may be used if you wish to avoid the transition to voice volume controls and other related changes when connected to Bluetooth. To enable this setting, pass a [`ClientCreateOptions`] when instantiating the client and set the `experimentalAndroidPreventCommsForBluetooth` flag - -![Video showing off the account linking process in 1.4 vs 1.5 on Android](images/1.4vs1.5.webp) - -### iOS - -The many-step process of mobile account linking has been simplified for users with Discord installed by deep-linking into the Discord mobile app to authorize with your game - -- Added native authentication support -- The experimental Game audio subsystem now makes use of the iOS 18.2+ echo canceller when available and falls back to Standard mode otherwise. - -### Windows - -- Added ARM64 support - -### Linux - -- Ensured glibc 2.31 compatibility - -### Bug Fixes - -- Fixed bug where [`Client::SetVoiceLogDir`] didn’t have any effect -- Added better error event handling to distinguish server authorization errors from user cancellations -- Fixed activity platform validation for console games -- Fixed crash safety issues with [`Client::GetCurrentUser`] when the client is in an unexpected non-Ready state. Added [`Client::GetCurrentUserV2`] which explicitly returns an optional handle instead of dummy data in this situation. This issue also affected the Unity and Unreal versions of the SDK -- Fixed [`Call::SetPTTActive`] - -## Known Issues - -- When the network is disconnected temporarily, active Calls may sometimes enter the Disconnected state instead of reconnecting. If a Call reaches Disconnected state, you must end and rejoin the call to reconnect if desired. -- For DM chat history - - No SDK-side caching for [`Client::GetUserMessagesWithLimit`] - - Every invocation of [`Client::GetUserMessagesWithLimit`] will directly query the backend rather than using local SDK-side caching. This may have performance implications, particularly under high-frequency usage. - - Provisional account merge message retrieval - - After a provisional account is merged into a full account, messages sent while the user was on the provisional account cannot be retrieved. - - -[`Call::SetPTTActive`]: https://discord.com/developers/docs/social-sdk/classdiscordpp_1_1Call.html#ac442b1d69b9256abbb188583c0c81c41 -[`Client::GetCurrentUser`]: https://discord.com/developers/docs/social-sdk/classdiscordpp_1_1Client.html#a7edea2a3dfe9ae560d5fa5ba8663b5cc -[`Client::GetCurrentUserV2`]: https://discord.com/developers/docs/social-sdk/classdiscordpp_1_1Client.html#ae52259570ba657252d91f5580636fe5d -[`Client::GetUserMessageSummaries`]: https://discord.com/developers/docs/social-sdk/classdiscordpp_1_1Client.html#a32dafc20ff1f99b019e40bdc81f46dde -[`Client::GetUserMessagesWithLimit`]: https://discord.com/developers/docs/social-sdk/classdiscordpp_1_1Client.html#a054a758a76c5873b38a4d79651a5f26c -[`Client::JoinLinkedLobbyGuild`]: https://discord.com/developers/docs/social-sdk/classdiscordpp_1_1Client.html#a54ec764e72e168de419ac14e24e8fc60 -[`Client::SetActivityInviteCreatedCallback`]: https://discord.com/developers/docs/social-sdk/classdiscordpp_1_1Client.html#a3b4e37a222a8662506d763514774bedc -[`Client::SetVoiceLogDir`]: https://discord.com/developers/docs/social-sdk/classdiscordpp_1_1Client.html#a48c6b7e8bbc2b632a935acafc6a5f7a7 -[`ClientCreateOptions`]: https://discord.com/developers/docs/social-sdk/classdiscordpp_1_1ClientCreateOptions.html#ae655ad66ba64f443496c158307cc77b4 \ No newline at end of file diff --git a/docs/change-log/2025-08-20-pin-permission-split.md b/docs/change-log/2025-08-20-pin-permission-split.md deleted file mode 100644 index 86392c27a1..0000000000 --- a/docs/change-log/2025-08-20-pin-permission-split.md +++ /dev/null @@ -1,9 +0,0 @@ ---- -title: "Pin Permission Split" -date: "2025-08-20" -breaking: true -topics: -- "HTTP API" ---- - -[Pinning](/docs/resources/message#pin-message) and [unpinning](/docs/resources/message#unpin-message) messages now has its own [permission](/docs/topics/permissions#permissions-bitwise-permission-flags). We split `PIN_MESSAGES` out of `MANAGE_MESSAGES` to give more granular control over who can pin messages in a channel. This is effective immediately for both users and apps. This change will be backwards compatible until January 12th 2026 when `MANAGE_MESSAGES` will no longer grant the ability to pin or unpin messages. diff --git a/docs/change-log/2025-08-25-modal-components.md b/docs/change-log/2025-08-25-modal-components.md deleted file mode 100644 index 383182c723..0000000000 --- a/docs/change-log/2025-08-25-modal-components.md +++ /dev/null @@ -1,39 +0,0 @@ ---- -title: "Introducing New Modal Components!" -date: "2025-08-25" -topics: -- "Interactions" -- "Components" ---- - -You asked for them, and now they're here! Modals are getting new components!! - -#### What's New - -We're introducing a new top-level [Label](/docs/components/reference#label) component for modals that have a `label`, `description`, and can contain a Text Input or a String Select! You heard right, String Selects now work in modals! - -- String Selects now work in modals when placed inside a Label component -- Text Inputs can also be used inside a Label component -- When a Text Input is used in a Label component the `label` field on the Text Input is not allowed in favor of `label` on the Label component -- ActionRow + TextInput is now deprecated in favor of the new Label component for better accessibility -- The `required` field is now available on String Selects (defaults to true in modals, ignored in messages) -- The `disabled` field on String Selects is not currently allowed in modals, and will trigger an error if used - -We've also documented [modal interaction responses](/docs/interactions/receiving-and-responding#interaction-object-component-interaction-response-structures) and resolved objects for interactive components in each component's Examples section. - -#### New Layout Component - -- [**Label**](/docs/components/reference#label) - A new top-level component that lets you add a title and description to your modal components! - -#### Updates to Modal Components - -- [**Text Input**](/docs/components/reference#text-input) - Text Input can now be used in a [Label](/docs/components/reference#label) -- [**String Select**](/docs/components/reference#string-select) - String Selects can be used in modals! Place them in a [Label](/docs/components/reference#label) - -#### Getting Started - -- [Using Modal Components](/docs/components/using-modal-components) - Dive into creating a modal - -#### Developer Resources - -Check out our [Component Reference](/docs/components/reference) for details on all available components. diff --git a/docs/change-log/2025-08-28-discord-social-sdk-1.5.11353.md b/docs/change-log/2025-08-28-discord-social-sdk-1.5.11353.md deleted file mode 100644 index 55d061de04..0000000000 --- a/docs/change-log/2025-08-28-discord-social-sdk-1.5.11353.md +++ /dev/null @@ -1,23 +0,0 @@ ---- -title: "Discord Social SDK Release 1.5.11353" -date: "2025-08-28" -topics: - - "Discord Social SDK" ---- - -A new release of the Discord Social SDK is now available, with the following updates: - -### Unity Plugin - -- Fixed a crash primarily affecting low-end Android devices (those with armv7 architecture) in -[`Client::CreateOrJoinLobbyWithMetadata`] -- Fixed a crash when passing large amounts of metadata in [`Client::CreateOrJoinLobbyWithMetadata`] - -The Discord Social SDK binaries are available for download in the Developer Portal after enabling the Discord Social SDK -for your application. - -To learn more about building with the Discord Social SDK, check out -the [Discord Social SDK Overview](/docs/discord-social-sdk/overview). - - -[`Client::CreateOrJoinLobbyWithMetadata`]: https://discord.com/developers/docs/social-sdk/classdiscordpp_1_1Client.html#a5c84fa76c73cf3c0bfd68794ca5595c1 \ No newline at end of file diff --git a/docs/change-log/2025-09-02-deprecating-non-e2ee-calls.md b/docs/change-log/2025-09-02-deprecating-non-e2ee-calls.md deleted file mode 100644 index 19cc5e1705..0000000000 --- a/docs/change-log/2025-09-02-deprecating-non-e2ee-calls.md +++ /dev/null @@ -1,29 +0,0 @@ ---- -title: "Deprecating Non-E2EE Voice Calls" -date: "2025-09-02" -topics: -- "Voice" ---- - -We started work on end-to-end encryption for Discord over two years ago to enhance our user privacy and security. With -DAVE now supported across all platforms, we’re very close to making every call fully end-to-end encrypted. - -### Developer Impact - -To support our long-term privacy goals, we will **only support E2EE calls starting on March 1st, 2026** for all audio -and video conversations in direct messages (DMs), group messages (GDMs), voice channels, and Go Live streams on -Discord. After that date, any client or application not updated for DAVE support will no longer be able to -participate in Discord calls. - -### Implementing E2EE Voice - -For developers working with Discord's voice APIs, you can consult -[the updated voice documentation](/docs/topics/voice-connections) -and the implementation examples available in our [open-source repository](https://github.com/discord/libdave) as -well as [the protocol whitepaper](https://github.com/discord/dave-protocol). - -The [Discord Developers community](https://discord.gg/discord-developers) is also a -great place to find assistance and answers to any integration questions you may have. - -We're committed to making this transition as smooth as possible while delivering the enhanced privacy and security that -DAVE provides to all Discord users. diff --git a/docs/change-log/2025-09-10-modify-current-member.md b/docs/change-log/2025-09-10-modify-current-member.md deleted file mode 100644 index 0558338b9f..0000000000 --- a/docs/change-log/2025-09-10-modify-current-member.md +++ /dev/null @@ -1,8 +0,0 @@ ---- -title: "Banner, avatar, and bio can be set on modify current member" -date: "2025-09-10" -topics: -- "HTTP API" ---- - -As of September 10, 2025, bots can set `banner`, `avatar`, and `bio` fields using the [modify current member](/docs/resources/guild#modify-current-member) route. diff --git a/docs/change-log/2025-09-10-more-modal-components.md b/docs/change-log/2025-09-10-more-modal-components.md deleted file mode 100644 index 9f78a3f3e6..0000000000 --- a/docs/change-log/2025-09-10-more-modal-components.md +++ /dev/null @@ -1,25 +0,0 @@ ---- -title: "Adding More Modal Components!" -date: "2025-09-10" -topics: -- "Interactions" -- "Components" ---- - -We've added more components to modals! All select menus (User, Role, Mentionable, Channel) are now fully supported in modals. In order to use a select menu in a modal, it must be placed inside a [Label](/docs/components/reference#label) component. We've also added the [Text Display](/docs/components/reference#text-display) component with markdown support as a top-level component in modals. - -#### Components Now Supported in Modals: - -- [**User Select**](/docs/components/reference#user-select) -- [**Role Select**](/docs/components/reference#role-select) -- [**Mentionable Select**](/docs/components/reference#mentionable-select) -- [**Channel Select**](/docs/components/reference#channel-select) -- [**Text Display**](/docs/components/reference#text-display) - -#### Getting Started - -- [Using Modal Components](/docs/components/using-modal-components) - Dive into creating a modal - -#### Developer Resources - -Check out our [Component Reference](/docs/components/reference) for details on all available components. diff --git a/docs/change-log/2025-09-26-discord-social-sdk-1.6.md b/docs/change-log/2025-09-26-discord-social-sdk-1.6.md deleted file mode 100644 index 208259d9f2..0000000000 --- a/docs/change-log/2025-09-26-discord-social-sdk-1.6.md +++ /dev/null @@ -1,55 +0,0 @@ ---- -title: "Discord Social SDK Release 1.6" -date: "2025-09-26" -topics: - - "Discord Social SDK" ---- - -A new release of the Discord Social SDK is now available, with the following updates: - -### ✨ New Features - -- When calling [`Client::GetGuildChannels`], channels are now sorted by their `position` field, which matches how they are sorted in the Discord client. -- Messages received via the Social SDK, no longer create notifications in a Discord client for the same user, to avoid double notification on the same machine. - -**This release adds features to support upcoming Discord experiments that will enhance how games integrate with user profiles and authentication:** - -- **Game Profile Integration**: New functionality to display game data on Discord user profiles. This includes `UserApplicationProfile` support with two new methods: `Client::GetUserApplicationProfiles` and `Client::GetUserApplicationProfilesNoLock` on the Users class, which retrieve game identity data from external authentication providers. -- **In-Discord Authentication Flow**: Support for users to start account linking directly from Discord (rather than having to initiate it from within your game). Added [`Client::RegisterAuthorizeRequestCallback`] and [`Client::RemoveAuthorizeRequestCallback`] methods to handle authentication requests that originate from various Discord entry points. These functions support upcoming Discord client experiments that will be gradually rolled out to users over time. - -### ⚠️ Deprecations - -This deprecation aims to improve consistence across the SDK’s API surface as well as provide a safer implementation that has fewer edge cases and less potential for accidental misuse. - -- Deprecated [`Client::GetCurrentUser`] API in favor of [`Client::GetCurrentUserV2`] which returns optional values instead of potentially invalid handles. - -### 🚀 Performance Improvements - -- This update implements caching capabilities for the [`Client::GetUserMessagesWithLimit`] function to avoid unnecessary remote API calls when sufficient messages are already cached locally. - -### 🎤 Voice Communications Fixes and Improvements - -Fixes several critical bugs with the voice communications system, as well as improved overall reliability, and noise and echo suppression and cancellation. - -- Fixed an issue where voice calls would sometimes transition to `Disconnected` state instead of reconnecting properly after a network interruption. -- Extended AGC2 (Automatic Gain Control 2) support to mobile platforms - -### 🐛 General Stability and Bug Fixes - -Multiple general critical bugs that can cause crashes and panics. We highly recommend upgrading to 1.6 to avoid them in your game. - -- Fixed critical bug where activity party privacy wasn't properly set, causing "ask to join" to appear instead of "join" for public parties. -- Fixed critical memory safety issue preventing connection objects from being deallocated during timer callbacks. -- Fixed C# marshaling alignment bugs and double-free crashes. -- Improved gateway resilience with fallback to generic URLs on zonal gateway failures. -- Fixed WebSocket write-after-close errors preventing connection issues. - -To learn more about building with the Discord Social SDK, check out the [Discord Social SDK Overview](https://discord.com/developers/docs/discord-social-sdk/overview), and if you have questions, feel free to drop them in [#social-sdk-dev-help](https://discord.com/channels/613425648685547541/1350223314307776592)! - - -[`Client::GetCurrentUser`]: https://discord.com/developers/docs/social-sdk/classdiscordpp_1_1Client.html#a7edea2a3dfe9ae560d5fa5ba8663b5cc -[`Client::GetCurrentUserV2`]: https://discord.com/developers/docs/social-sdk/classdiscordpp_1_1Client.html#ae52259570ba657252d91f5580636fe5d -[`Client::GetGuildChannels`]: https://discord.com/developers/docs/social-sdk/classdiscordpp_1_1Client.html#adba1e5a83c219a9c4f6dab1657778017 -[`Client::GetUserMessagesWithLimit`]: https://discord.com/developers/docs/social-sdk/classdiscordpp_1_1Client.html#a054a758a76c5873b38a4d79651a5f26c -[`Client::RegisterAuthorizeRequestCallback`]: https://discord.com/developers/docs/social-sdk/classdiscordpp_1_1Client.html#a5f34b873e127a446c9ab549e4588ccd7 -[`Client::RemoveAuthorizeRequestCallback`]: https://discord.com/developers/docs/social-sdk/classdiscordpp_1_1Client.html#ab7e48864b0cedf3e8572a228ca401f2a \ No newline at end of file diff --git a/docs/change-log/2025-10-15-discord-social-sdk-1.6.12170.md b/docs/change-log/2025-10-15-discord-social-sdk-1.6.12170.md deleted file mode 100644 index 5d9042c2ab..0000000000 --- a/docs/change-log/2025-10-15-discord-social-sdk-1.6.12170.md +++ /dev/null @@ -1,30 +0,0 @@ ---- -title: "Discord Social SDK Release 1.6.12170" -date: "2025-10-15" -topics: - - "Discord Social SDK" ---- - -A new release of the Discord Social SDK is now available, with the following updates: - -## New Features - -This small update to v1.6 adds some highly requested features from our partners. We found some time to sneak them in… - -- You can now provide custom art to display as a banner image in game invites that appear in Discord. This is done one - of two ways: - - By specifying a URL or an `asset key` to an image in the `activity.assets.inviteCoverImage` parameter when - calling `Client::UpdateRichPresence`. This method even affords you the ability to set a unique image - on each invite if you want! - - By uploading cover image art in the `Rich Presence` tab in the Developer Portal for your Application. Note: This - will be used as the fallback image if you don’t specify one via `activity.assets.inviteCoverImage` -- It’s now possible to customize the displayed name for your Application in Discord’s Rich Presence. To do so, set - the `activity.name` parameter when calling [`Client::UpdateRichPresence`] -- Added support for Microsoft Xbox GDK version 2025.04 -- Fixed a crash when calling [`Client::GetUserGuilds`] on iOS devices - - - -[`Client::GetUserGuilds`]: https://discord.com/developers/docs/social-sdk/classdiscordpp_1_1Client.html#aac1ec02df6074ed9213ce230e6a42fe1 - -[`Client::UpdateRichPresence`]: https://discord.com/developers/docs/social-sdk/classdiscordpp_1_1Client.html#af0a85e30f2b3d8a0b502fd23744ee58e \ No newline at end of file diff --git a/docs/change-log/2025-10-15-modal-file-upload.md b/docs/change-log/2025-10-15-modal-file-upload.md deleted file mode 100644 index 49e422225f..0000000000 --- a/docs/change-log/2025-10-15-modal-file-upload.md +++ /dev/null @@ -1,18 +0,0 @@ ---- -title: "Introducing the File Upload component in Modals" -date: "2025-10-15" -topics: -- "Interactions" -- "Components" ---- - -Have you ever wanted to collect more than text from a user through a modal? With the new [**File Upload**](/docs/components/reference#file-upload) component you can! You can specify a min and max number of files accepted between 0 and 10, and if uploading files within that limit is required before submitting. Any file types are accepted, and the max file size is based on the user's upload limit in that channel. - -#### The New Component: - -- [**File Upload**](/docs/components/reference#file-upload) - -#### Developer Resources - -- [Using Modal Components](/docs/components/using-modal-components) - Dive into creating a modal -- Check out our [Component Reference](/docs/components/reference) for details on all available components. diff --git a/docs/discord-social-sdk/core-concepts.mdx b/docs/discord-social-sdk/core-concepts.mdx deleted file mode 100644 index ad870e7d92..0000000000 --- a/docs/discord-social-sdk/core-concepts.mdx +++ /dev/null @@ -1,60 +0,0 @@ ---- -sidebar_label: Core Concepts -subpages: - - core-concepts/core-features.mdx - - core-concepts/communication-features.mdx - - core-concepts/integration-overview.mdx - - core-concepts/platform-compatibility.mdx - - core-concepts/oauth2-scopes.mdx ---- - -[Home](/docs/intro) > [Discord Social SDK](/docs/discord-social-sdk/overview) > {sidebar_label} - -# Core Concepts: Discord Social SDK - -The Discord Social SDK allows you to build social features into your game, including friend lists, messaging, voice chat, and rich presence. Unlike a traditional SDK with built-in UI components, the Discord Social SDK provides access to raw data, allowing developers to create a fully customized experience that aligns with their game's aesthetic. - -## Core Concepts Overview - -Select a topic below to learn more about the Discord Social SDK: - - - - Explore social features like account linking, friends, and rich presence. - - - Learn about messaging, voice chat, and in-game lobbies. - - - Learn about the integration overview and implementation steps. - - - See supported platforms and download information. - - - Understand OAuth2 scopes and client types for authentication. - - - ---- - -## Next Steps - -After exploring these core concepts, you can start implementing the Discord Social SDK in your game: - -- **Ready to integrate?** Follow our [Getting Started](/docs/discord-social-sdk/getting-started) guide for step-by-step setup instructions. -- **Need implementation details?** Check out the [Development Guides](/docs/discord-social-sdk/development-guides) for specific feature implementations. -- **Looking for UI guidance?** Review the [Design Guidelines](/docs/discord-social-sdk/design-guidelines) for best practices. - ---- - -## Change Log - -| Date | Changes | -|----------------|---------------------------| -| July 21, 2025 | restructure core concepts | -| June 30, 2025 | restructure oauth scopes | -| March 17, 2025 | initial release | \ No newline at end of file diff --git a/docs/discord-social-sdk/core-concepts/integration-overview.mdx b/docs/discord-social-sdk/core-concepts/integration-overview.mdx deleted file mode 100644 index 5b1b25ba95..0000000000 --- a/docs/discord-social-sdk/core-concepts/integration-overview.mdx +++ /dev/null @@ -1,60 +0,0 @@ ---- -sidebar_label: Integration Overview ---- - -[Home](/docs/intro) > [Discord Social SDK](/docs/discord-social-sdk/overview) > [Core Concepts](/docs/discord-social-sdk/core-concepts) > {sidebar_label} - -# Integration Overview - -To implement the Discord Social SDK, developers for all platforms will generally follow these steps: - -1. Import the SDK -2. Initialize the SDK: - - Create a [`Client`] instance. - - Set up event listeners to monitor SDK events and callbacks -3. Authenticate users with flexible account options - - Link an existing Discord account via OAuth ([`Client::Authorize`]). - - Create and manage provisional accounts for users who don't have or want a Discord account ([`Client::GetProvisionalToken`]). -4. Implement social features - - Implement [unified friends list](/docs/discord-social-sdk/development-guides/creating-a-unified-friends-list) and [relationships](/docs/discord-social-sdk/development-guides/managing-relationships). - - Use [rich presence](/docs/discord-social-sdk/development-guides/setting-rich-presence) for game activity updates. - - Set up [lobbies](/docs/discord-social-sdk/development-guides/managing-lobbies) for multiplayer interaction and [game invites](/docs/discord-social-sdk/development-guides/managing-game-invites). - - Manage [direct message](/docs/discord-social-sdk/development-guides/sending-direct-messages), [linked channels](/docs/discord-social-sdk/development-guides/creating-a-unified-friends-list), and [voice communication](/docs/discord-social-sdk/development-guides/managing-voice-chat). -5. Handle events & API calls: - - Listen for changes in friend lists, presence updates, and chat messages. - - Use Discord's APIs to update statuses, send messages, and manage connections. - -This guide is a conceptual overview. If you're ready to start building, [follow our step-by-step guide](/docs/discord-social-sdk/getting-started) to set up the SDK in your game engine. - ---- - -## Next Steps - -Check platform compatibility, explore communication features, and start your integration: - - - - See supported platforms and download information. - - - Learn about messaging, voice chat, and in-game lobbies. - - - Choose your platform and follow step-by-step setup instructions. - - - ---- - -## Change Log - -| Date | Changes | -|---------------|-----------------| -| July 21, 2025 | initial release | - -{/* Autogenerated Reference Links */} -[`Client`]: https://discord.com/developers/docs/social-sdk/classdiscordpp_1_1Client.html#a91716140c699d8ef0bdf6bfd7ee0ae13 -[`Client::Authorize`]: https://discord.com/developers/docs/social-sdk/classdiscordpp_1_1Client.html#ace94a58e27545a933d79db32b387a468 -[`Client::GetProvisionalToken`]: https://discord.com/developers/docs/social-sdk/classdiscordpp_1_1Client.html#a8003130b6c46e54ac68442483bf0480c \ No newline at end of file diff --git a/docs/discord-social-sdk/design-guidelines.mdx b/docs/discord-social-sdk/design-guidelines.mdx deleted file mode 100644 index 5303af25c9..0000000000 --- a/docs/discord-social-sdk/design-guidelines.mdx +++ /dev/null @@ -1,76 +0,0 @@ ---- -sidebar_label: Design Guidelines -showTOC: false -subpages: - - design-guidelines/principles.mdx - - design-guidelines/signing-in.mdx - - design-guidelines/connection-points.mdx - - design-guidelines/branding-guidelines.mdx - - design-guidelines/unified-friends-list.mdx - - design-guidelines/direct-messages.mdx - - design-guidelines/chat-history.mdx - - design-guidelines/social-settings.mdx - - design-guidelines/provisional-accounts.mdx - - design-guidelines/status-rich-presence.mdx - - design-guidelines/consoles.mdx - - design-guidelines/game-friends.mdx - - design-guidelines/linked-channels.mdx ---- - -[Home](/docs/intro) > [Discord Social SDK](/docs/discord-social-sdk/overview) > Design Guidelines - -# Discord Social SDK Design Guidelines - -These design guidelines provide best practices and guidelines for designing social features in your game. Following these patterns can create a seamless and engaging user experience that leverages SDK social features to enhance your game. - -If you are looking for a place to get started, we recommend you start with [Principles](/docs/discord-social-sdk/design-guidelines/principles) or the [Getting Started](/docs/discord-social-sdk/getting-started) guide. - - - - Fundamental best practices for integrating Discord's social layer into your game. These principles ensure a seamless and engaging user experience. - - - Strategies for implementing user authentication and account linking, allowing players to connect their Discord accounts with your game. - - - Key integration points where your game can interact with Discord's services, enhancing the overall player experience through seamless connectivity. - - - Guidelines for using Discord's brand assets within your game, ensuring consistent and respectful representation of the Discord brand. - - - Techniques for designing a unified friends list - allowing players to see and interact with their Discord friends directly within your game. - - - Best practices for enabling direct messaging between players, facilitating private communication, and enhancing social interactions. - - - Best practices for implementing chat history in Discord Social SDK integrations - - - Best practices for implementing and managing access to the Discord social settings in games using the Discord Social SDK - - - Designing around provisional accounts for users who prefer not to link their Discord accounts, allowing them to enjoy social features still. - - - Leveraging Discord's presence and rich presence features to display detailed player status and game activity for in-game social interactions. - - - Integrating Discord's social features on console platforms, ensuring a consistent experience across different devices. - - - Techniques for managing and displaying in-game friends, allowing players to connect and play with their Discord friends easily. - - - Guidelines for linking Discord channels to your game, enabling players to connect and communicate across different platforms. - - - ---- - -## Change Log - -| Date | Changes | -|----------------|-----------------| -| March 17, 2025 | initial release | diff --git a/docs/discord-social-sdk/development-guides.mdx b/docs/discord-social-sdk/development-guides.mdx deleted file mode 100644 index 001f5d0c29..0000000000 --- a/docs/discord-social-sdk/development-guides.mdx +++ /dev/null @@ -1,67 +0,0 @@ ---- -sidebar_label: Development Guides -showTOC: false -subpages: - - development-guides/account-linking-with-discord.mdx - - development-guides/account-linking-on-consoles.mdx - - development-guides/using-provisional-accounts.mdx - - development-guides/creating-a-unified-friends-list.mdx - - development-guides/managing-relationships.mdx - - development-guides/setting-rich-presence.mdx - - development-guides/managing-game-invites.mdx - - development-guides/sending-direct-messages.mdx - - development-guides/managing-lobbies.mdx - - development-guides/linked-channels.mdx - - development-guides/managing-voice-chat.mdx ---- - -[Home](/docs/intro) > [Discord Social SDK](/docs/discord-social-sdk/overview) > Development Guides - -# Discord Social SDK Development Guides - -These guides include suggested development practices, and user flows for you to consider while integrating the Discord Social SDK into your game. These will help provide your users with a consistent and clear experience while interacting with your game. - -If you are new to the Discord Social SDK, we recommend you start with the [Getting Started](/docs/discord-social-sdk/getting-started) guide. - -## Authentication & Account Linking - - - Learn how to authenticate users with their Discord accounts using OAuth2. - - - Implement Discord authentication flows for console platforms. - - - Give your users a seamless account experience with provisional accounts. - - - -## Game Relationships, Presence & Game Invites - - - Combine Discord and game-specific friends in one view. - - - Display detailed game status in Discord profiles. - - - Allow players to invite friends to join their game session or party. - - - -## Text & Voice Chat - - - - Enable private messaging between players. - - - Bring players together in a shared lobby with invites, text chat, and voice comms. - - - Connect game lobbies to Discord text channels. - - - Add in-game voice communication. - - diff --git a/docs/discord-social-sdk/getting-started.mdx b/docs/discord-social-sdk/getting-started.mdx deleted file mode 100644 index a07acc1858..0000000000 --- a/docs/discord-social-sdk/getting-started.mdx +++ /dev/null @@ -1,43 +0,0 @@ ---- -sidebar_label: Getting Started -subpages: - - getting-started/using-c++.mdx - - getting-started/using-unity.mdx - - getting-started/using-unreal-engine.mdx ---- - -[Home](/docs/intro) > [Discord Social SDK](/docs/discord-social-sdk/overview) > Getting Started - -# Getting Started with the Discord Social SDK - -The Discord Social SDK allows you to integrate Discord social features into your game. With the Discord Social SDK, you can offer a seamless social experience for your players, allowing them to connect with their friends and communities on Discord without leaving your game. - -If this is your first time learning about the Discord Social SDK, check out the Discord Social SDK [Overview](/docs/discord-social-sdk/overview) and [Core Concepts](/docs/discord-social-sdk/core-concepts) for more information on what the SDK can do and how it can benefit your game. - -## Let's Get Started - -Select a platform to get started. - -If you are unsure which platform to choose, we recommend starting with the C++ guide to familiarize yourself with the SDK's core concepts. - - - - For use with custom engines or standalone applications. - - - For use with Unity. - - - For use with Unreal Engine. - - - -:::info -To see a complete list of currently compatible platforms, check out our [Platform Compatibility](/docs/discord-social-sdk/core-concepts/platform-compatibility) section. -::: - ---- - -## Next Steps - -After you've run through a guide for your preferred platform, you can implement features such as a unified friend list, rich presence, and more. Check out the [Development Guides](/docs/discord-social-sdk/development-guides) for detailed information on using the SDK for each feature. \ No newline at end of file diff --git a/docs/discord-social-sdk/how-to.mdx b/docs/discord-social-sdk/how-to.mdx deleted file mode 100644 index 903279dbef..0000000000 --- a/docs/discord-social-sdk/how-to.mdx +++ /dev/null @@ -1,46 +0,0 @@ ---- -sidebar_label: How To -showTOC: false -subpages: - - how-to/debug-log.mdx - - how-to/use-with-discord-apis.mdx - - how-to/integrate-moderation.mdx - - how-to/market-your-integration.mdx - - how-to/handle-special-characters-display-names.mdx ---- - -[Home](/docs/intro) > [Discord Social SDK](/docs/discord-social-sdk/overview) > How To - -# Discord Social SDK How To Guides - -These how-to guides offer common solutions for integrating Discord Social SDK features into your game. - - - - Use logging and debugging tools to troubleshoot issues. - - - Make requests to Discord's HTTP APIs from your game. - - - Integrating and managing content moderation for your game when using the Discord Social SDK. - - - Guidelines and best practices for announcing your Discord Social SDK integration to players. - - - Handling Unicode characters in Discord Display Names for your game's chat and friend lists. - - - ---- - -## Change Log - -| Date | Changes | -|---------------|-----------------------| -| July 23, 2025 | migrated several docs | -| June 17, 2025 | added How To category | \ No newline at end of file diff --git a/docs/discord-social-sdk/partials/callouts/rate-limit.mdx b/docs/discord-social-sdk/partials/callouts/rate-limit.mdx deleted file mode 100644 index 632adddcd5..0000000000 --- a/docs/discord-social-sdk/partials/callouts/rate-limit.mdx +++ /dev/null @@ -1,5 +0,0 @@ -:::warn -This feature is currently available with rate limits. -To remove the rate limits for your game, please follow -[Communication Features: Applying for Rate Limit Removal](/docs/discord-social-sdk/core-concepts/communication-features#applying-for-rate-limit-removal). -::: \ No newline at end of file diff --git a/docs/discord-social-sdk/social-sdk-reference.mdx b/docs/discord-social-sdk/social-sdk-reference.mdx deleted file mode 100644 index 57f36e5cbd..0000000000 --- a/docs/discord-social-sdk/social-sdk-reference.mdx +++ /dev/null @@ -1,3 +0,0 @@ ---- -sidebar_label: Social SDK Reference ---- \ No newline at end of file diff --git a/docs/events/gateway-events.mdx b/docs/events/gateway-events.mdx deleted file mode 100644 index 406873837e..0000000000 --- a/docs/events/gateway-events.mdx +++ /dev/null @@ -1,1506 +0,0 @@ ---- -sidebar_label: Gateway Events ---- - -# Gateway Events - -Gateway connections are WebSockets, meaning they're bidirectional and either side of the WebSocket can send events to the other. The following events are split up into two types: - -- **Send events** are Gateway events sent by an app to Discord (like when identifying with the Gateway) -- **Receive events** are Gateway events that are sent by Discord to an app. These events typically represent something happening inside of a server where an app is installed, like a channel being updated. - -All Gateway events are encapsulated in a [Gateway event payload](/docs/events/gateway-events#payload-structure). - -For more information about interacting with the Gateway, you can reference the [Gateway documentation](/docs/events/gateway). - -:::warn -Not all Gateway event fields are documented. You should assume that undocumented fields are not supported for apps, and their format and data may change at any time. -::: - -### Event Names - -In practice, event names are UPPER-CASED with under_scores joining each word in the name. For instance, [Channel Create](/docs/events/gateway-events#channel-create) would be `CHANNEL_CREATE` and [Voice State Update](/docs/events/gateway-events#voice-state-update) would be `VOICE_STATE_UPDATE`. - -For readability, event names in the following documentation are typically left in Title Case. - -### Payload Structure - -Gateway event payloads have a common structure, but the contents of the associated data (`d`) varies between the different events. - -| Field | Type | Description | -|-------|-------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------| -| op | integer | [Gateway opcode](/docs/topics/opcodes-and-status-codes#gateway-gateway-opcodes), which indicates the payload type | -| d | ?mixed (any JSON value) | Event data | -| s | ?integer \* | Sequence number of event used for [resuming sessions](/docs/events/gateway#resuming) and [heartbeating](/docs/events/gateway#sending-heartbeats) | -| t | ?string \* | Event name | - -\* `s` and `t` are `null` when `op` is not `0` ([Gateway Dispatch opcode](/docs/topics/opcodes-and-status-codes#gateway-gateway-opcodes)). - -###### Example Gateway Event Payload - -```json -{ - "op": 0, - "d": {}, - "s": 42, - "t": "GATEWAY_EVENT_NAME" -} -``` - -## Send Events - -Send events are Gateway events encapsulated in an [event payload](/docs/events/gateway-events#payload-structure), and are sent by an app to Discord through a Gateway connection. - -:::info -Previously, Gateway send events were labeled as commands -::: - -| Name | Description | -|------------------------------------------------------------------------------------|-----------------------------------------------------------| -| [Identify](/docs/events/gateway-events#identify) | Triggers the initial handshake with the gateway | -| [Resume](/docs/events/gateway-events#resume) | Resumes a dropped gateway connection | -| [Heartbeat](/docs/events/gateway-events#heartbeat) | Maintains an active gateway connection | -| [Request Guild Members](/docs/events/gateway-events#request-guild-members) | Requests members for a guild | -| [Request Soundboard Sounds](/docs/events/gateway-events#request-soundboard-sounds) | Requests soundboard sounds in a set of guilds | -| [Update Voice State](/docs/events/gateway-events#update-voice-state) | Joins, moves, or disconnects the app from a voice channel | -| [Update Presence](/docs/events/gateway-events#update-presence) | Updates an app's presence | - -#### Identify - -Used to trigger the initial handshake with the gateway. - -Details about identifying is in the [Gateway documentation](/docs/events/gateway#identifying). - -###### Identify Structure - -| Field | Type | Description | Default | -|------------------|-----------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------|---------| -| token | string | Authentication token | - | -| properties | object | [Connection properties](/docs/events/gateway-events#identify-identify-connection-properties) | - | -| compress? | boolean | Whether this connection supports compression of packets | false | -| large_threshold? | integer | Value between 50 and 250, total number of members where the gateway will stop sending offline members in the guild member list | 50 | -| shard? | array of two integers (shard_id, num_shards) | Used for [Guild Sharding](/docs/events/gateway#sharding) | - | -| presence? | [update presence](/docs/events/gateway-events#update-presence) object | Presence structure for initial presence information | - | -| intents | integer | [Gateway Intents](/docs/events/gateway#gateway-intents) you wish to receive | - | - -###### Identify Connection Properties - -| Field | Type | Description | -|---------|--------|-----------------------| -| os | string | Your operating system | -| browser | string | Your library name | -| device | string | Your library name | - -:::warn -These fields originally were $ prefixed (i.e: `$browser`) but [this syntax is deprecated](/docs/change-log#updated-connection-property-field-names). While they currently still work, it is recommended to move to non-prefixed fields. -::: - -###### Example Identify - -```json -{ - "op": 2, - "d": { - "token": "my_token", - "properties": { - "os": "linux", - "browser": "disco", - "device": "disco" - }, - "compress": true, - "large_threshold": 250, - "shard": [0, 1], - "presence": { - "activities": [{ - "name": "Cards Against Humanity", - "type": 0 - }], - "status": "dnd", - "since": 91879201, - "afk": false - }, - // This intent represents 1 << 0 for GUILDS, 1 << 1 for GUILD_MEMBERS, and 1 << 2 for GUILD_BANS - // This connection will only receive the events defined in those three intents - "intents": 7 - } -} -``` - -#### Resume - -Used to replay missed events when a disconnected client resumes. - -Details about resuming are in the [Gateway documentation](/docs/events/gateway#resuming). - -###### Resume Structure - -| Field | Type | Description | -|------------|---------|-------------------------------| -| token | string | Session token | -| session_id | string | Session ID | -| seq | integer | Last sequence number received | - -###### Example Resume - -```json -{ - "op": 6, - "d": { - "token": "randomstring", - "session_id": "evenmorerandomstring", - "seq": 1337 - } -} -``` - -#### Heartbeat - -Used to maintain an active gateway connection. Must be sent every `heartbeat_interval` milliseconds after the [Opcode 10 Hello](/docs/events/gateway-events#hello) payload is received. The inner `d` key is the last sequence number—`s`—received by the client. If you have not yet received one, send `null`. - -Details about heartbeats are in the [Gateway documentation](/docs/events/gateway#sending-heartbeats). - -###### Example Heartbeat - -```json -{ - "op": 1, - "d": 251 -} -``` - -#### Request Guild Members - -Used to request all members for a guild or a list of guilds. When initially connecting, if you don't have the `GUILD_PRESENCES` [Gateway Intent](/docs/events/gateway#gateway-intents), or if the guild is over 75k members, it will only send members who are in voice, plus the member for you (the connecting user). Otherwise, if a guild has over `large_threshold` members (value in the [Gateway Identify](/docs/events/gateway-events#identify)), it will only send members who are online, have a role, have a nickname, or are in a voice channel, and if it has under `large_threshold` members, it will send all members. If a client wishes to receive additional members, they need to explicitly request them via this operation. The server will send [Guild Members Chunk](/docs/events/gateway-events#guild-members-chunk) events in response with up to 1000 members per chunk until all members that match the request have been sent. - -Due to our privacy and infrastructural concerns with this feature, there are some limitations that apply: - -- `GUILD_PRESENCES` intent is required to set `presences = true`. Otherwise, it will always be false -- `GUILD_MEMBERS` intent is required to request the entire member list—`(query=‘’, limit=0<=n)` -- You will be limited to requesting 1 `guild_id` per request -- Requesting a prefix (`query` parameter) will return a maximum of 100 members -- Requesting `user_ids` will continue to be limited to returning 100 members - -:::info -We are introducing a new rate limit to the Request Guild Members opcode. See [Introducing Rate Limit When Requesting All Guild Members](/docs/change-log/2025-08-14-introducing-guild-members-rate-limit) for more information and timeline on this new rate limit. -::: - -###### Request Guild Members Structure - -| Field | Type | Description | Required | -|------------|----------------------------------|---------------------------------------------------------------------------------------------------------------------------------------|----------------------------| -| guild_id | snowflake | ID of the guild to get members for | true | -| query? | string | string that username starts with, or an empty string to return all members | one of query or user_ids | -| limit | integer | maximum number of members to send matching the `query`; a limit of `0` can be used with an empty string `query` to return all members | true when specifying query | -| presences? | boolean | used to specify if we want the presences of the matched members | false | -| user_ids? | snowflake or array of snowflakes | used to specify which users you wish to fetch | one of query or user_ids | -| nonce? | string | nonce to identify the [Guild Members Chunk](/docs/events/gateway-events#guild-members-chunk) response | false | - -:::info -Nonce can only be up to 32 bytes. If you send an invalid nonce it will be ignored and the reply member_chunk(s) will not have a nonce set. -::: - -###### Example Request Guild Members - -```json -{ - "op": 8, - "d": { - "guild_id": "41771983444115456", - "query": "", - "limit": 0 - } -} -``` - -#### Request Soundboard Sounds - -Used to request soundboard sounds for a list of guilds. The server will send [Soundboard Sounds](/docs/events/gateway-events#soundboard-sounds) events for each guild in response. - -###### Request Soundboard Sounds Structure - -| Field | Type | Description | -|-----------|---------------------|------------------------------------------------| -| guild_ids | array of snowflakes | IDs of the guilds to get soundboard sounds for | - -###### Example Request Soundboard Sounds - -```json -{ - "op": 31, - "d": { - "guild_ids": ["613425648685547541", "81384788765712384"] - } -} -``` - -#### Update Voice State - -Sent when a client wants to join, move, or disconnect from a voice channel. - -###### Gateway Voice State Update Structure - -| Field | Type | Description | -|------------|------------|----------------------------------------------------------------------| -| guild_id | snowflake | ID of the guild | -| channel_id | ?snowflake | ID of the voice channel client wants to join (null if disconnecting) | -| self_mute | boolean | Whether the client is muted | -| self_deaf | boolean | Whether the client deafened | - -###### Example Gateway Voice State Update - -```json -{ - "op": 4, - "d": { - "guild_id": "41771983423143937", - "channel_id": "127121515262115840", - "self_mute": false, - "self_deaf": false - } -} -``` - -#### Update Presence - -Sent by the client to indicate a presence or status update. - -###### Gateway Presence Update Structure - -| Field | Type | Description | -|------------|--------------------------------------------------------------------------|---------------------------------------------------------------------------------------------| -| since | ?integer | Unix time (in milliseconds) of when the client went idle, or null if the client is not idle | -| activities | array of [activity](/docs/events/gateway-events#activity-object) objects | User's activities | -| status | string | User's new [status](/docs/events/gateway-events#update-presence-status-types) | -| afk | boolean | Whether or not the client is afk | - -###### Status Types - -| Status | Description | -|-----------|--------------------------------| -| online | Online | -| dnd | Do Not Disturb | -| idle | AFK | -| invisible | Invisible and shown as offline | -| offline | Offline | - -###### Example Gateway Presence Update - -```json -{ - "op": 3, - "d": { - "since": 91879201, - "activities": [{ - "name": "Save the Oxford Comma", - "type": 0 - }], - "status": "online", - "afk": false - } -} -``` - -## Receive Events - -Receive events are Gateway events encapsulated in an [event payload](/docs/events/gateway-events#payload-structure), and are sent by Discord to an app through a Gateway connection. Receive events correspond to events that happen in a Discord server where the app is installed. - -| Name | Description | -|--------------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------| -| [Hello](/docs/events/gateway-events#hello) | Defines the heartbeat interval | -| [Ready](/docs/events/gateway-events#ready) | Contains the initial state information | -| [Resumed](/docs/events/gateway-events#resumed) | Response to [Resume](/docs/events/gateway-events#resume) | -| [Reconnect](/docs/events/gateway-events#reconnect) | Server is going away, client should reconnect to gateway and resume | -| [Rate Limited](/docs/events/gateway-events#rate-limited) | Application was rate limited for a gateway opcode | -| [Invalid Session](/docs/events/gateway-events#invalid-session) | Failure response to [Identify](/docs/events/gateway-events#identify) or [Resume](/docs/events/gateway-events#resume) or invalid active session | -| [Application Command Permissions Update](/docs/events/gateway-events#application-command-permissions-update) | Application command permission was updated | -| [Auto Moderation Rule Create](/docs/events/gateway-events#auto-moderation-rule-create) | Auto Moderation rule was created | -| [Auto Moderation Rule Update](/docs/events/gateway-events#auto-moderation-rule-update) | Auto Moderation rule was updated | -| [Auto Moderation Rule Delete](/docs/events/gateway-events#auto-moderation-rule-delete) | Auto Moderation rule was deleted | -| [Auto Moderation Action Execution](/docs/events/gateway-events#auto-moderation-action-execution) | Auto Moderation rule was triggered and an action was executed (e.g. a message was blocked) | -| [Channel Create](/docs/events/gateway-events#channel-create) | New guild channel created | -| [Channel Update](/docs/events/gateway-events#channel-update) | Channel was updated | -| [Channel Delete](/docs/events/gateway-events#channel-delete) | Channel was deleted | -| [Channel Pins Update](/docs/events/gateway-events#channel-pins-update) | Message was pinned or unpinned | -| [Thread Create](/docs/events/gateway-events#thread-create) | Thread created, also sent when being added to a private thread | -| [Thread Update](/docs/events/gateway-events#thread-update) | Thread was updated | -| [Thread Delete](/docs/events/gateway-events#thread-delete) | Thread was deleted | -| [Thread List Sync](/docs/events/gateway-events#thread-list-sync) | Sent when gaining access to a channel, contains all active threads in that channel | -| [Thread Member Update](/docs/events/gateway-events#thread-member-update) | [Thread member](/docs/resources/channel#thread-member-object) for the current user was updated | -| [Thread Members Update](/docs/events/gateway-events#thread-members-update) | Some user(s) were added to or removed from a thread | -| [Entitlement Create](/docs/events/gateway-events#entitlement-create) | Entitlement was created | -| [Entitlement Update](/docs/events/gateway-events#entitlement-update) | Entitlement was updated or renewed | -| [Entitlement Delete](/docs/events/gateway-events#entitlement-delete) | Entitlement was deleted | -| [Guild Create](/docs/events/gateway-events#guild-create) | Lazy-load for unavailable guild, guild became available, or user joined a new guild | -| [Guild Update](/docs/events/gateway-events#guild-update) | Guild was updated | -| [Guild Delete](/docs/events/gateway-events#guild-delete) | Guild became unavailable, or user left/was removed from a guild | -| [Guild Audit Log Entry Create](/docs/events/gateway-events#guild-audit-log-entry-create) | A guild audit log entry was created | -| [Guild Ban Add](/docs/events/gateway-events#guild-ban-add) | User was banned from a guild | -| [Guild Ban Remove](/docs/events/gateway-events#guild-ban-remove) | User was unbanned from a guild | -| [Guild Emojis Update](/docs/events/gateway-events#guild-emojis-update) | Guild emojis were updated | -| [Guild Stickers Update](/docs/events/gateway-events#guild-stickers-update) | Guild stickers were updated | -| [Guild Integrations Update](/docs/events/gateway-events#guild-integrations-update) | Guild integration was updated | -| [Guild Member Add](/docs/events/gateway-events#guild-member-add) | New user joined a guild | -| [Guild Member Remove](/docs/events/gateway-events#guild-member-remove) | User was removed from a guild | -| [Guild Member Update](/docs/events/gateway-events#guild-member-update) | Guild member was updated | -| [Guild Members Chunk](/docs/events/gateway-events#guild-members-chunk) | Response to [Request Guild Members](/docs/events/gateway-events#request-guild-members) | -| [Guild Role Create](/docs/events/gateway-events#guild-role-create) | Guild role was created | -| [Guild Role Update](/docs/events/gateway-events#guild-role-update) | Guild role was updated | -| [Guild Role Delete](/docs/events/gateway-events#guild-role-delete) | Guild role was deleted | -| [Guild Scheduled Event Create](/docs/events/gateway-events#guild-scheduled-event-create) | Guild scheduled event was created | -| [Guild Scheduled Event Update](/docs/events/gateway-events#guild-scheduled-event-update) | Guild scheduled event was updated | -| [Guild Scheduled Event Delete](/docs/events/gateway-events#guild-scheduled-event-delete) | Guild scheduled event was deleted | -| [Guild Scheduled Event User Add](/docs/events/gateway-events#guild-scheduled-event-user-add) | User subscribed to a guild scheduled event | -| [Guild Scheduled Event User Remove](/docs/events/gateway-events#guild-scheduled-event-user-remove) | User unsubscribed from a guild scheduled event | -| [Guild Soundboard Sound Create](/docs/events/gateway-events#guild-soundboard-sound-create) | Guild soundboard sound was created | -| [Guild Soundboard Sound Update](/docs/events/gateway-events#guild-soundboard-sound-update) | Guild soundboard sound was updated | -| [Guild Soundboard Sound Delete](/docs/events/gateway-events#guild-soundboard-sound-delete) | Guild soundboard sound was deleted | -| [Guild Soundboard Sounds Update](/docs/events/gateway-events#guild-soundboard-sounds-update) | Guild soundboard sounds were updated | -| [Soundboard Sounds](/docs/events/gateway-events#soundboard-sounds) | Response to [Request Soundboard Sounds](/docs/events/gateway-events#request-soundboard-sounds) | -| [Integration Create](/docs/events/gateway-events#integration-create) | Guild integration was created | -| [Integration Update](/docs/events/gateway-events#integration-update) | Guild integration was updated | -| [Integration Delete](/docs/events/gateway-events#integration-delete) | Guild integration was deleted | -| [Interaction Create](/docs/events/gateway-events#interaction-create) | User used an interaction, such as an [Application Command](/docs/interactions/application-commands) | -| [Invite Create](/docs/events/gateway-events#invite-create) | Invite to a channel was created | -| [Invite Delete](/docs/events/gateway-events#invite-delete) | Invite to a channel was deleted | -| [Message Create](/docs/events/gateway-events#message-create) | Message was created | -| [Message Update](/docs/events/gateway-events#message-update) | Message was edited | -| [Message Delete](/docs/events/gateway-events#message-delete) | Message was deleted | -| [Message Delete Bulk](/docs/events/gateway-events#message-delete-bulk) | Multiple messages were deleted at once | -| [Message Reaction Add](/docs/events/gateway-events#message-reaction-add) | User reacted to a message | -| [Message Reaction Remove](/docs/events/gateway-events#message-reaction-remove) | User removed a reaction from a message | -| [Message Reaction Remove All](/docs/events/gateway-events#message-reaction-remove-all) | All reactions were explicitly removed from a message | -| [Message Reaction Remove Emoji](/docs/events/gateway-events#message-reaction-remove-emoji) | All reactions for a given emoji were explicitly removed from a message | -| [Presence Update](/docs/events/gateway-events#presence-update) | User was updated | -| [Stage Instance Create](/docs/events/gateway-events#stage-instance-create) | Stage instance was created | -| [Stage Instance Update](/docs/events/gateway-events#stage-instance-update) | Stage instance was updated | -| [Stage Instance Delete](/docs/events/gateway-events#stage-instance-delete) | Stage instance was deleted or closed | -| [Subscription Create](/docs/events/gateway-events#subscription-create) | Premium App Subscription was created | -| [Subscription Update](/docs/events/gateway-events#subscription-update) | Premium App Subscription was updated | -| [Subscription Delete](/docs/events/gateway-events#subscription-delete) | Premium App Subscription was deleted | -| [Typing Start](/docs/events/gateway-events#typing-start) | User started typing in a channel | -| [User Update](/docs/events/gateway-events#user-update) | Properties about the user changed | -| [Voice Channel Effect Send](/docs/events/gateway-events#voice-channel-effect-send) | Someone sent an effect in a voice channel the current user is connected to | -| [Voice State Update](/docs/events/gateway-events#voice-state-update) | Someone joined, left, or moved a voice channel | -| [Voice Server Update](/docs/events/gateway-events#voice-server-update) | Guild's voice server was updated | -| [Webhooks Update](/docs/events/gateway-events#webhooks-update) | Guild channel webhook was created, update, or deleted | -| [Message Poll Vote Add](/docs/events/gateway-events#message-poll-vote-add) | User voted on a poll | -| [Message Poll Vote Remove](/docs/events/gateway-events#message-poll-vote-remove) | User removed a vote on a poll | - -#### Hello - -Sent on connection to the websocket. Defines the heartbeat interval that an app should heartbeat to. - -###### Hello Structure - -| Field | Type | Description | -|--------------------|---------|---------------------------------------------------------| -| heartbeat_interval | integer | Interval (in milliseconds) an app should heartbeat with | - -###### Example Hello - -```json -{ - "op": 10, - "d": { - "heartbeat_interval": 45000 - } -} -``` - -#### Ready - -The ready event is dispatched when a client has completed the initial handshake with the gateway (for new sessions). The ready event can be the largest and most complex event the gateway will send, as it contains all the state required for a client to begin interacting with the rest of the platform. - -`guilds` are the guilds of which your bot is a member. They start out as unavailable when you connect to the gateway. As they become available, your bot will be notified via [Guild Create](/docs/events/gateway-events#guild-create) events. - -###### Ready Event Fields - -| Field | Type | Description | -|--------------------|--------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------| -| v | integer | [API version](/docs/reference#api-versioning-api-versions) | -| user | [user](/docs/resources/user#user-object) object | Information about the user including email | -| guilds | array of [Unavailable Guild](/docs/resources/guild#unavailable-guild-object) objects | Guilds the user is in | -| session_id | string | Used for resuming connections | -| resume_gateway_url | string | Gateway URL for resuming connections | -| shard? | array of two integers (shard_id, num_shards) | [Shard information](/docs/events/gateway#sharding) associated with this session, if sent when identifying | -| application | partial [application object](/docs/resources/application#application-object) | Contains `id` and `flags` | - -#### Resumed - -The resumed event is dispatched when a client has sent a [resume payload](/docs/events/gateway-events#resume) to the gateway (for resuming existing sessions). - -#### Reconnect - -The reconnect event is dispatched when a client should reconnect to the gateway (and resume their existing session, if they have one). This can occur at any point in the gateway connection lifecycle, even before/in place of receiving a [Hello](/docs/events/gateway-events#hello) event. A few seconds after the reconnect event is dispatched, the connection may be closed by the server. - -###### Example Gateway Reconnect - -```json -{ - "op": 7, - "d": null -} -``` - -#### Invalid Session - -Sent to indicate one of at least three different situations: - -- the gateway could not initialize a session after receiving an [Opcode 2 Identify](/docs/events/gateway-events#identify) -- the gateway could not resume a previous session after receiving an [Opcode 6 Resume](/docs/events/gateway-events#resume) -- the gateway has invalidated an active session and is requesting client action - -The inner `d` key is a boolean that indicates whether the session may be resumable. See [Connecting](/docs/events/gateway#connecting) and [Resuming](/docs/events/gateway#resuming) for more information. - -###### Example Gateway Invalid Session - -```json -{ - "op": 9, - "d": false -} -``` - -### Application Commands - -#### Application Command Permissions Update - -`APPLICATION_COMMAND_PERMISSIONS_UPDATE` event, sent when an application command's permissions are updated. The inner payload is an [application command permissions](/docs/interactions/application-commands#application-command-permissions-object-guild-application-command-permissions-structure) object. - -### Auto Moderation - -All [Auto Moderation](/docs/resources/auto-moderation) related events are only sent to bot users which have the `MANAGE_GUILD` permission. - -#### Auto Moderation Rule Create - -Sent when a rule is created. The inner payload is an [auto moderation rule](/docs/resources/auto-moderation#auto-moderation-rule-object) object. - -#### Auto Moderation Rule Update - -Sent when a rule is updated. The inner payload is an [auto moderation rule](/docs/resources/auto-moderation#auto-moderation-rule-object) object. - -#### Auto Moderation Rule Delete - -Sent when a rule is deleted. The inner payload is an [auto moderation rule](/docs/resources/auto-moderation#auto-moderation-rule-object) object. - -#### Auto Moderation Action Execution - -Sent when a rule is triggered and an action is executed (e.g. when a message is blocked). - -###### Auto Moderation Action Execution Event Fields - -| Field | Type | Description | -|--------------------------|------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------| -| guild_id | snowflake | ID of the guild in which action was executed | -| action | [auto moderation action](/docs/resources/auto-moderation#auto-moderation-action-object) object | Action which was executed | -| rule_id | snowflake | ID of the rule which action belongs to | -| rule_trigger_type | [trigger_type](/docs/resources/auto-moderation#auto-moderation-rule-object-trigger-types) | Trigger type of rule which was triggered | -| user_id | snowflake | ID of the user which generated the content which triggered the rule | -| channel_id? | snowflake | ID of the channel in which user content was posted | -| message_id? | snowflake | ID of any user message which content belongs to * | -| alert_system_message_id? | snowflake | ID of any system auto moderation messages posted as a result of this action ** | -| content *** | string | User-generated text content | -| matched_keyword | ?string | Word or phrase configured in the rule that triggered the rule | -| matched_content *** | ?string | Substring in content that triggered the rule | - -\* `message_id` will not exist if message was blocked by [Auto Moderation](/docs/resources/auto-moderation) or content was not part of any message - -\*\* `alert_system_message_id` will not exist if this event does not correspond to an action with type `SEND_ALERT_MESSAGE` - -\*\*\* `MESSAGE_CONTENT` (`1 << 15`) [gateway intent](/docs/events/gateway#gateway-intents) is required to receive the `content` and `matched_content` fields - -### Channels - -#### Channel Create - -Sent when a new guild channel is created, relevant to the current user. The inner payload is a [channel](/docs/resources/channel#channel-object) object. - -#### Channel Update - -Sent when a channel is updated. The inner payload is a [channel](/docs/resources/channel#channel-object) object. This is not sent when the field `last_message_id` is altered. To keep track of the last_message_id changes, you must listen for [Message Create](/docs/events/gateway-events#message-create) events (or [Thread Create](/docs/events/gateway-events#thread-create) events for `GUILD_FORUM` and `GUILD_MEDIA` channels). - -This event may reference roles or guild members that no longer exist in the guild. - -#### Channel Delete - -Sent when a channel relevant to the current user is deleted. The inner payload is a [channel](/docs/resources/channel#channel-object) object. - -#### Thread Create - -Sent when a thread is created, relevant to the current user, or when the current user is added to a thread. The inner payload is a [channel](/docs/resources/channel#channel-object) object. - -- When a thread is created, includes an additional `newly_created` boolean field. -- When being added to an existing private thread, includes a [thread member](/docs/resources/channel#thread-member-object) object. - -#### Thread Update - -Sent when a thread is updated. The inner payload is a [channel](/docs/resources/channel#channel-object) object. This is not sent when the field `last_message_id` is altered. To keep track of the last_message_id changes, you must listen for [Message Create](/docs/events/gateway-events#message-create) events. - -#### Thread Delete - -Sent when a thread relevant to the current user is deleted. The inner payload is a subset of the [channel](/docs/resources/channel#channel-object) object, containing just the `id`, `guild_id`, `parent_id`, and `type` fields. - -#### Thread List Sync - -Sent when the current user _gains_ access to a channel. - -###### Thread List Sync Event Fields - -| Field | Type | Description | -|--------------|--------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| -| guild_id | snowflake | ID of the guild | -| channel_ids? | array of snowflakes | Parent channel IDs whose threads are being synced. If omitted, then threads were synced for the entire guild. This array may contain channel_ids that have no active threads as well, so you know to clear that data. | -| threads | array of [channel](/docs/resources/channel#channel-object) objects | All active threads in the given channels that the current user can access | -| members | array of [thread member](/docs/resources/channel#thread-member-object) objects | All thread member objects from the synced threads for the current user, indicating which threads the current user has been added to | - -#### Thread Member Update - -Sent when the [thread member](/docs/resources/channel#thread-member-object) object for the current user is updated. The inner payload is a [thread member](/docs/resources/channel#thread-member-object) object with an extra `guild_id` field. This event is documented for completeness, but unlikely to be used by most bots. For bots, this event largely is just a signal that you are a member of the thread. See the [threads docs](/docs/topics/threads) for more details. - -###### Thread Member Update Event Extra Fields - -| Field | Type | Description | -|----------|-----------|-----------------| -| guild_id | snowflake | ID of the guild | - - -#### Thread Members Update - -Sent when anyone is added to or removed from a thread. If the current user does not have the `GUILD_MEMBERS` [Gateway Intent](/docs/events/gateway#gateway-intents), then this event will only be sent if the current user was added to or removed from the thread. - -###### Thread Members Update Event Fields - -| Field | Type | Description | -|---------------------|--------------------------------------------------------------------------------|-----------------------------------------------------------| -| id | snowflake | ID of the thread | -| guild_id | snowflake | ID of the guild | -| member_count | integer | Approximate number of members in the thread, capped at 50 | -| added_members?\* | array of [thread member](/docs/resources/channel#thread-member-object) objects | Users who were added to the thread | -| removed_member_ids? | array of snowflakes | ID of the users who were removed from the thread | - -\* In this gateway event, the thread member objects will also include the [guild member](/docs/resources/guild#guild-member-object) and nullable [presence](/docs/events/gateway-events#presence) objects for each added thread member. - -#### Channel Pins Update - -Sent when a message is pinned or unpinned in a text channel. This is not sent when a pinned message is deleted. - -###### Channel Pins Update Event Fields - -| Field | Type | Description | -|---------------------|--------------------|---------------------------------------------------------| -| guild_id? | snowflake | ID of the guild | -| channel_id | snowflake | ID of the channel | -| last_pin_timestamp? | ?ISO8601 timestamp | Time at which the most recent pinned message was pinned | - -### Entitlements - -#### Entitlement Create - -:::warn -Note: The`ENTITLEMENT_CREATE` event behavior changed on October 1, 2024. Please see the [Change Log and Entitlement Migration Guide](/docs/change-log#premium-apps-entitlement-migration-and-new-subscription-api) for more information on what changed. -::: - -Sent when an entitlement is created. The inner payload is an [entitlement](/docs/resources/entitlement#entitlement-object) object. - -#### Entitlement Update - -:::warn -Note: The`ENTITLEMENT_UPDATE` event behavior changed on October 1, 2024. Please see the [Change Log and Entitlement Migration Guide](/docs/change-log#premium-apps-entitlement-migration-and-new-subscription-api) for more information on what changed. -::: - -Sent when an entitlement is updated. The inner payload is an [entitlement](/docs/resources/entitlement#entitlement-object) object. - -For subscription entitlements, this event is triggered only when a user's subscription ends, providing an `ends_at` timestamp that indicates the end of the entitlement. - -#### Entitlement Delete - -Sent when an entitlement is deleted. The inner payload is an [entitlement](/docs/resources/entitlement#entitlement-object) object. - -Entitlement deletions are infrequent, and occur when: - -- Discord issues a refund for a subscription -- Discord removes an entitlement from a user via internal tooling -- Discord deletes an app-managed entitlement they created via the API - -Entitlements are _not_ deleted when they expire. - -### Guilds - -#### Guild Create - -This event can be sent in three different scenarios: - -1. When a user is initially connecting, to lazily load and backfill information for all unavailable guilds sent in the [Ready](/docs/events/gateway-events#ready) event. Guilds that are unavailable due to an outage will send a [Guild Delete](/docs/events/gateway-events#guild-delete) event. -2. When a Guild becomes available again to the client. -3. When the current user joins a new Guild. - -:::info -During an outage, the guild object in scenarios 1 and 3 may be marked as unavailable. -::: - -The inner payload can be: - -- An available Guild: a [guild](/docs/resources/guild#guild-object) object with extra fields, as noted below. -- An unavailable Guild: an [unavailable guild](/docs/resources/guild#unavailable-guild-object) object. - -###### Guild Create Extra Fields - -| Field | Type | Description | -|------------------------|--------------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------| -| joined_at | ISO8601 timestamp | When this guild was joined at | -| large | boolean | `true` if this is considered a large guild | -| unavailable? | boolean | `true` if this guild is unavailable due to an outage | -| member_count | integer | Total number of members in this guild | -| voice_states | array of partial [voice state](/docs/resources/voice#voice-state-object) objects | States of members currently in voice channels; lacks the `guild_id` key | -| members | array of [guild member](/docs/resources/guild#guild-member-object) objects | Users in the guild | -| channels | array of [channel](/docs/resources/channel#channel-object) objects | Channels in the guild | -| threads | array of [channel](/docs/resources/channel#channel-object) objects | All active threads in the guild that current user has permission to view | -| presences | array of partial [presence update](/docs/events/gateway-events#presence-update) objects | Presences of the members in the guild, will only include non-offline members if the size is greater than `large threshold` | -| stage_instances | array of [stage instance](/docs/resources/stage-instance#stage-instance-object) objects | Stage instances in the guild | -| guild_scheduled_events | array of [guild scheduled event](/docs/resources/guild-scheduled-event#guild-scheduled-event-object) objects | Scheduled events in the guild | -| soundboard_sounds | array of [soundboard sound](/docs/resources/soundboard#soundboard-sound-object) objects | Soundboard sounds in the guild | - -:::warn -If your bot does not have the `GUILD_PRESENCES` [Gateway Intent](/docs/events/gateway#gateway-intents), or if the guild has over 75k members, members and presences returned in this event will only contain your bot and users in voice channels. -::: - -#### Guild Update - -Sent when a guild is updated. The inner payload is a [guild](/docs/resources/guild#guild-object) object. - -#### Guild Delete - -Sent when a guild becomes or was already unavailable due to an outage, or when the user leaves or is removed from a guild. The inner payload is an [unavailable guild](/docs/resources/guild#unavailable-guild-object) object. If the `unavailable` field is not set, the user was removed from the guild. - -#### Guild Audit Log Entry Create - -Sent when a guild audit log entry is created. The inner payload is an [Audit Log Entry](/docs/resources/audit-log#audit-log-entry-object) object with an extra `guild_id` key. This event is only sent to bots with the `VIEW_AUDIT_LOG` permission. - -###### Guild Audit Log Entry Create Event Extra Fields - -| Field | Type | Description | -|----------|-----------|-----------------| -| guild_id | snowflake | ID of the guild | - -#### Guild Ban Add - -Sent when a user is banned from a guild. - -###### Guild Ban Add Event Fields - -| Field | Type | Description | -|----------|---------------------------------------------------|---------------------| -| guild_id | snowflake | ID of the guild | -| user | a [user](/docs/resources/user#user-object) object | User who was banned | - -#### Guild Ban Remove - -Sent when a user is unbanned from a guild. - -###### Guild Ban Remove Event Fields - -| Field | Type | Description | -|----------|---------------------------------------------------|-----------------------| -| guild_id | snowflake | ID of the guild | -| user | a [user](/docs/resources/user#user-object) object | User who was unbanned | - -#### Guild Emojis Update - -Sent when a guild's emojis have been updated. - -###### Guild Emojis Update Event Fields - -| Field | Type | Description | -|----------|-----------|-------------------------------------------------------| -| guild_id | snowflake | ID of the guild | -| emojis | array | Array of [emojis](/docs/resources/emoji#emoji-object) | - -#### Guild Stickers Update - -Sent when a guild's stickers have been updated. - -###### Guild Stickers Update Event Fields - -| Field | Type | Description | -|----------|-----------|-------------------------------------------------------------| -| guild_id | snowflake | ID of the guild | -| stickers | array | Array of [stickers](/docs/resources/sticker#sticker-object) | - -#### Guild Integrations Update - -Sent when a guild integration is updated. - -###### Guild Integrations Update Event Fields - -| Field | Type | Description | -|----------|-----------|-------------------------------------------------| -| guild_id | snowflake | ID of the guild whose integrations were updated | - -#### Guild Member Add - -:::warn -If using [Gateway Intents](/docs/events/gateway#gateway-intents), the `GUILD_MEMBERS` intent will be required to receive this event. -::: - -Sent when a new user joins a guild. The inner payload is a [guild member](/docs/resources/guild#guild-member-object) object with an extra `guild_id` key: - -###### Guild Member Add Extra Fields - -| Field | Type | Description | -|----------|-----------|-----------------| -| guild_id | snowflake | ID of the guild | - -#### Guild Member Remove - -:::warn -If using [Gateway Intents](/docs/events/gateway#gateway-intents), the `GUILD_MEMBERS` intent will be required to receive this event. -::: - -Sent when a user is removed from a guild (leave/kick/ban). - -###### Guild Member Remove Event Fields - -| Field | Type | Description | -|----------|---------------------------------------------------|----------------------| -| guild_id | snowflake | ID of the guild | -| user | a [user](/docs/resources/user#user-object) object | User who was removed | - -#### Guild Member Update - -:::warn -If using [Gateway Intents](/docs/events/gateway#gateway-intents), the `GUILD_MEMBERS` intent will be required to receive this event. -::: - -Sent when a guild member is updated. This will also fire when the user object of a guild member changes. - -###### Guild Member Update Event Fields - -| Field | Type | Description | -|-------------------------------|-------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| -| guild_id | snowflake | ID of the guild | -| roles | array of snowflakes | User role ids | -| user | a [user](/docs/resources/user#user-object) object | User | -| nick? | ?string | Nickname of the user in the guild | -| avatar | ?string | Member's [guild avatar hash](/docs/reference#image-formatting) | -| banner | ?string | Member's [guild banner hash](/docs/reference#image-formatting) | -| joined_at | ?ISO8601 timestamp | When the user joined the guild | -| premium_since? | ?ISO8601 timestamp | When the user starting [boosting](https://support.discord.com/hc/en-us/articles/360028038352-Server-Boosting-) the guild | -| deaf? | boolean | Whether the user is deafened in voice channels | -| mute? | boolean | Whether the user is muted in voice channels | -| pending? | boolean | Whether the user has not yet passed the guild's [Membership Screening](/docs/resources/guild#membership-screening-object) requirements | -| communication_disabled_until? | ?ISO8601 timestamp | When the user's [timeout](https://support.discord.com/hc/en-us/articles/4413305239191-Time-Out-FAQ) will expire and the user will be able to communicate in the guild again, null or a time in the past if the user is not timed out | -| flags? | integer | [Guild member flags](/docs/resources/guild#guild-member-object-guild-member-flags) represented as a bit set, defaults to 0 | -| avatar_decoration_data? | ?[avatar decoration data](/docs/resources/user#avatar-decoration-data-object) | Data for the member's guild avatar decoration | - -#### Guild Members Chunk - -Sent in response to [Guild Request Members](/docs/events/gateway-events#request-guild-members). -You can use the `chunk_index` and `chunk_count` to calculate how many chunks are left for your request. - -###### Guild Members Chunk Event Fields - -| Field | Type | Description | -|-------------|----------------------------------------------------------------------------|------------------------------------------------------------------------------------------------| -| guild_id | snowflake | ID of the guild | -| members | array of [guild member](/docs/resources/guild#guild-member-object) objects | Set of guild members | -| chunk_index | integer | Chunk index in the expected chunks for this response (`0 <= chunk_index < chunk_count`) | -| chunk_count | integer | Total number of expected chunks for this response | -| not_found? | array | When passing an invalid ID to `REQUEST_GUILD_MEMBERS`, it will be returned here | -| presences? | array of [presence](/docs/events/gateway-events#presence) objects | When passing `true` to `REQUEST_GUILD_MEMBERS`, presences of the returned members will be here | -| nonce? | string | Nonce used in the [Guild Members Request](/docs/events/gateway-events#request-guild-members) | - -#### Guild Role Create - -Sent when a guild role is created. - -###### Guild Role Create Event Fields - -| Field | Type | Description | -|----------|-------------------------------------------------------|-----------------------| -| guild_id | snowflake | ID of the guild | -| role | a [role](/docs/topics/permissions#role-object) object | Role that was created | - -#### Guild Role Update - -Sent when a guild role is updated. - -###### Guild Role Update Event Fields - -| Field | Type | Description | -|----------|-------------------------------------------------------|-----------------------| -| guild_id | snowflake | ID of the guild | -| role | a [role](/docs/topics/permissions#role-object) object | Role that was updated | - -#### Guild Role Delete - -Sent when a guild role is deleted. - -###### Guild Role Delete Event Fields - -| Field | Type | Description | -|----------|-----------|-----------------| -| guild_id | snowflake | ID of the guild | -| role_id | snowflake | ID of the role | - -#### Guild Scheduled Event Create - -Sent when a guild scheduled event is created. The inner payload is a [guild scheduled event](/docs/resources/guild-scheduled-event#guild-scheduled-event-object) object. - -#### Guild Scheduled Event Update - -Sent when a guild scheduled event is updated. The inner payload is a [guild scheduled event](/docs/resources/guild-scheduled-event#guild-scheduled-event-object) object. - -#### Guild Scheduled Event Delete - -Sent when a guild scheduled event is deleted. The inner payload is a [guild scheduled event](/docs/resources/guild-scheduled-event#guild-scheduled-event-object) object. - -#### Guild Scheduled Event User Add - -Sent when a user has subscribed to a guild scheduled event. - -###### Guild Scheduled Event User Add Event Fields - -| Field | Type | Description | -|--------------------------|-----------|---------------------------------| -| guild_scheduled_event_id | snowflake | ID of the guild scheduled event | -| user_id | snowflake | ID of the user | -| guild_id | snowflake | ID of the guild | - -#### Guild Scheduled Event User Remove - -Sent when a user has unsubscribed from a guild scheduled event. - -###### Guild Scheduled Event User Remove Event Fields - -| Field | Type | Description | -|--------------------------|-----------|---------------------------------| -| guild_scheduled_event_id | snowflake | ID of the guild scheduled event | -| user_id | snowflake | ID of the user | -| guild_id | snowflake | ID of the guild | - -#### Guild Soundboard Sound Create - -Sent when a guild soundboard sound is created. The inner payload is a [soundboard sound](/docs/resources/soundboard#soundboard-sound-object) object. - -#### Guild Soundboard Sound Update - -Sent when a guild soundboard sound is updated. The inner payload is a [soundboard sound](/docs/resources/soundboard#soundboard-sound-object) object. - -#### Guild Soundboard Sound Delete - -Sent when a guild soundboard sound is deleted. - -###### Guild Soundboard Sound Delete Event Fields - -| Field | Type | Description | -|----------|-----------|----------------------------------| -| sound_id | snowflake | ID of the sound that was deleted | -| guild_id | snowflake | ID of the guild the sound was in | - -#### Guild Soundboard Sounds Update - -Sent when multiple guild soundboard sounds are updated. - -###### Guild Soundboard Sounds Update Event Fields - -| Field | Type | Description | -|-------------------|-----------------------------------------------------------------------------------------|-------------------------------| -| soundboard_sounds | array of [soundboard sound](/docs/resources/soundboard#soundboard-sound-object) objects | The guild's soundboard sounds | -| guild_id | snowflake | ID of the guild | - -#### Soundboard Sounds - -Includes a guild's list of soundboard sounds. Sent in response to [Request Soundboard Sounds](/docs/events/gateway-events#request-soundboard-sounds). - -###### Soundboard Sounds Event Fields - -| Field | Type | Description | -|-------------------|-----------------------------------------------------------------------------------------|-------------------------------| -| soundboard_sounds | array of [soundboard sound](/docs/resources/soundboard#soundboard-sound-object) objects | The guild's soundboard sounds | -| guild_id | snowflake | ID of the guild | - -### Integrations - -#### Integration Create - -Sent when an integration is created. The inner payload is an [integration](/docs/resources/guild#integration-object) object with `user` omitted and an additional `guild_id` key: - -###### Integration Create Event Additional Fields - -| Field | Type | Description | -|----------|-----------|-----------------| -| guild_id | snowflake | ID of the guild | - -#### Integration Update - -Sent when an integration is updated. The inner payload is an [integration](/docs/resources/guild#integration-object) object with `user` omitted and an additional `guild_id` key: - -###### Integration Update Event Additional Fields - -| Field | Type | Description | -|----------|-----------|-----------------| -| guild_id | snowflake | ID of the guild | - -#### Integration Delete - -Sent when an integration is deleted. - -###### Integration Delete Event Fields - -| Field | Type | Description | -|-----------------|-----------|---------------------------------------------------------------| -| id | snowflake | Integration ID | -| guild_id | snowflake | ID of the guild | -| application_id? | snowflake | ID of the bot/OAuth2 application for this discord integration | - -### Invites - -All [Invite](/docs/resources/invite) related events are only sent to bot users with the `MANAGE_CHANNELS` permission on the channel. - -#### Invite Create - -Sent when a new invite to a channel is created. - -###### Invite Create Event Fields - -| Field | Type | Description | -|---------------------|------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------| -| channel_id | snowflake | Channel the invite is for | -| code | string | Unique invite [code](/docs/resources/invite#invite-object) | -| created_at | ISO8601 timestamp | Time at which the invite was created | -| guild_id? | snowflake | Guild of the invite | -| inviter? | [user](/docs/resources/user#user-object) object | User that created the invite | -| max_age | integer | How long the invite is valid for (in seconds) | -| max_uses | integer | Maximum number of times the invite can be used | -| target_type? | integer | [Type of target](/docs/resources/invite#invite-object-invite-target-types) for this voice channel invite | -| target_user? | [user](/docs/resources/user#user-object) object | User whose stream to display for this voice channel stream invite | -| target_application? | partial [application](/docs/resources/application#application-object) object | Embedded application to open for this voice channel embedded application invite | -| temporary | boolean | Whether or not the invite is temporary (invited users will be kicked on disconnect unless they're assigned a role) | -| uses | integer | How many times the invite has been used (always will be 0) | -| expires_at | ?ISO8601 timestamp | the expiration date of this invite | - -#### Invite Delete - -Sent when an invite is deleted. - -###### Invite Delete Event Fields - -| Field | Type | Description | -|------------|-----------|------------------------------------------------------------| -| channel_id | snowflake | Channel of the invite | -| guild_id? | snowflake | Guild of the invite | -| code | string | Unique invite [code](/docs/resources/invite#invite-object) | - -### Messages - -:::warn -Unlike persistent messages, ephemeral messages are sent directly to the user and the bot who sent the message rather than through the guild channel. Because of this, ephemeral messages are tied to the [`DIRECT_MESSAGES` intent](/docs/events/gateway#list-of-intents), and the message object won't include `guild_id` or `member`. -::: - -#### Message Create - -Sent when a message is created. The inner payload is a [message](/docs/resources/message#message-object) object with the following extra fields: - -###### Message Create Extra Fields - -| Field | Type | Description | -|-----------|------------------------------------------------------------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------| -| guild_id? | snowflake | ID of the guild the message was sent in - unless it is an ephemeral message | -| member? | partial [guild member](/docs/resources/guild#guild-member-object) object | Member properties for this message's author. Missing for ephemeral messages and messages from webhooks | -| mentions | array of [user](/docs/resources/user#user-object) objects, optionally with an additional partial [member](/docs/resources/guild#guild-member-object) field | Users specifically mentioned in the message | - -#### Message Update - -Sent when a message is updated. The inner payload is a [message](/docs/resources/message#message-object) object with the same extra fields as [MESSAGE_CREATE](/docs/events/gateway-events#message-create). - -:::warn -The value for `tts` will always be false in message updates. -::: - -#### Message Delete - -Sent when a message is deleted. - -###### Message Delete Event Fields - -| Field | Type | Description | -|------------|-----------|-------------------| -| id | snowflake | ID of the message | -| channel_id | snowflake | ID of the channel | -| guild_id? | snowflake | ID of the guild | - -#### Message Delete Bulk - -Sent when multiple messages are deleted at once. - -###### Message Delete Bulk Event Fields - -| Field | Type | Description | -|------------|---------------------|---------------------| -| ids | array of snowflakes | IDs of the messages | -| channel_id | snowflake | ID of the channel | -| guild_id? | snowflake | ID of the guild | - -#### Message Reaction Add - -Sent when a user adds a reaction to a message. - -###### Message Reaction Add Event Fields - -| Field | Type | Description | -|--------------------|--------------------------------------------------------------|--------------------------------------------------------------------------------------------| -| user_id | snowflake | ID of the user | -| channel_id | snowflake | ID of the channel | -| message_id | snowflake | ID of the message | -| guild_id? | snowflake | ID of the guild | -| member? | [member](/docs/resources/guild#guild-member-object) object | Member who reacted if this happened in a guild | -| emoji | a partial [emoji](/docs/resources/emoji#emoji-object) object | Emoji used to react - [example](/docs/resources/emoji#emoji-object-standard-emoji-example) | -| message_author_id? | snowflake | ID of the user who authored the message which was reacted to | -| burst | boolean | true if this is a super-reaction | -| burst_colors? | array of strings | Colors used for super-reaction animation in "#rrggbb" format | -| type | integer | The [type of reaction](/docs/resources/message#get-reactions-reaction-types) | - -#### Message Reaction Remove - -Sent when a user removes a reaction from a message. - -###### Message Reaction Remove Event Fields - -| Field | Type | Description | -|------------|--------------------------------------------------------------|--------------------------------------------------------------------------------------------| -| user_id | snowflake | ID of the user | -| channel_id | snowflake | ID of the channel | -| message_id | snowflake | ID of the message | -| guild_id? | snowflake | ID of the guild | -| emoji | a partial [emoji](/docs/resources/emoji#emoji-object) object | Emoji used to react - [example](/docs/resources/emoji#emoji-object-standard-emoji-example) | -| burst | boolean | true if this was a super-reaction | -| type | integer | The [type of reaction](/docs/resources/message#get-reactions-reaction-types) | - -#### Message Reaction Remove All - -Sent when a user explicitly removes all reactions from a message. - -###### Message Reaction Remove All Event Fields - -| Field | Type | Description | -|------------|-----------|-------------------| -| channel_id | snowflake | ID of the channel | -| message_id | snowflake | ID of the message | -| guild_id? | snowflake | ID of the guild | - -#### Message Reaction Remove Emoji - -Sent when a bot removes all instances of a given emoji from the reactions of a message. - -###### Message Reaction Remove Emoji Event Fields - -| Field | Type | Description | -|------------|------------------------------------------------------------|------------------------| -| channel_id | snowflake | ID of the channel | -| guild_id? | snowflake | ID of the guild | -| message_id | snowflake | ID of the message | -| emoji | [partial emoji object](/docs/resources/emoji#emoji-object) | Emoji that was removed | - -### Presence - -#### Presence Update - -:::warn -If you are using [Gateway Intents](/docs/events/gateway#gateway-intents), you _must_ specify the `GUILD_PRESENCES` intent in order to receive Presence Update events -::: - -A user's presence is their current state on a guild. This event is sent when a user's presence or info, such as name or avatar, is updated. - -:::warn -The user object within this event can be partial, the only field which must be sent is the `id` field, everything else is optional. Along with this limitation, no fields are required, and the types of the fields are **not** validated. Your client should expect any combination of fields and types within this event. -::: - -###### Presence Update Event Fields - -| Field | Type | Description | -|---------------|--------------------------------------------------------------------------|----------------------------------------------| -| user | [user](/docs/resources/user#user-object) object | User whose presence is being updated | -| guild_id | snowflake | ID of the guild | -| status | string | Either "idle", "dnd", "online", or "offline" | -| activities | array of [activity](/docs/events/gateway-events#activity-object) objects | User's current activities | -| client_status | [client_status](/docs/events/gateway-events#client-status-object) object | User's platform-dependent status | - -#### Client Status Object - -Active sessions are indicated with an "online", "idle", or "dnd" string per platform. If a user is offline or invisible, the corresponding field is not present. - -| Field | Type | Description | -|----------|--------|-----------------------------------------------------------------------------------| -| desktop? | string | User's status set for an active desktop (Windows, Linux, Mac) application session | -| mobile? | string | User's status set for an active mobile (iOS, Android) application session | -| web? | string | User's status set for an active web (browser, bot user) application session | - -#### Activity Object - -###### Activity Structure - -| Field | Type | Description | -|----------------------|--------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------| -| name | string | Activity's name | -| type | integer | [Activity type](/docs/events/gateway-events#activity-object-activity-types) | -| url? | ?string | Stream URL, is validated when type is 1 | -| created_at | integer | Unix timestamp (in milliseconds) of when the activity was added to the user's session | -| timestamps? | [timestamps](/docs/events/gateway-events#activity-object-activity-timestamps) object | Unix timestamps for start and/or end of the game | -| application_id? | snowflake | Application ID for the game | -| status_display_type? | ?integer | [Status display type](/docs/events/gateway-events#activity-object-status-display-types); controls which field is displayed in the user's status text in the member list | -| details? | ?string | What the player is currently doing | -| details_url? | ?string | URL that is linked when clicking on the details text | -| state? | ?string | User's current party status, or text used for a custom status | -| state_url? | ?string | URL that is linked when clicking on the state text | -| emoji? | ?[emoji](/docs/events/gateway-events#activity-object-activity-emoji) object | Emoji used for a custom status | -| party? | [party](/docs/events/gateway-events#activity-object-activity-party) object | Information for the current party of the player | -| assets? | [assets](/docs/events/gateway-events#activity-object-activity-assets) object | Images for the presence and their hover texts | -| secrets? | [secrets](/docs/events/gateway-events#activity-object-activity-secrets) object | Secrets for Rich Presence joining and spectating | -| instance? | boolean | Whether or not the activity is an instanced game session | -| flags? | integer | [Activity flags](/docs/events/gateway-events#activity-object-activity-flags) `OR`d together, describes what the payload includes | -| buttons? | array of [buttons](/docs/events/gateway-events#activity-object-activity-buttons) | Custom buttons shown in the Rich Presence (max 2) | - -:::info -Bot users are only able to set `name`, `state`, `type`, and `url`. -::: - -###### Activity Types - -| ID | Name | Format | Example | -|----|-----------|-----------------------|--------------------------------------| -| 0 | Playing | Playing `{name}` | "Playing Rocket League" | -| 1 | Streaming | Streaming `{details}` | "Streaming Rocket League" | -| 2 | Listening | Listening to `{name}` | "Listening to Spotify" | -| 3 | Watching | Watching `{name}` | "Watching YouTube Together" | -| 4 | Custom | `{emoji}` `{state}` | ":smiley: I am cool" | -| 5 | Competing | Competing in `{name}` | "Competing in Arena World Champions" | - -:::info -The streaming type currently only supports Twitch and YouTube. Only `https://twitch.tv/` and `https://youtube.com/` urls will work. -::: - -###### Status Display Types - -| ID | Name | Example | -|----|---------|----------------------------------------| -| 0 | Name | "Listening to Spotify" | -| 1 | State | "Listening to Rick Astley" | -| 2 | Details | "Listening to Never Gonna Give You Up" | - -:::info -This applies to all activity types. "Listening" was used to serve as a consistent example of what the different fields might be used for. -::: - -###### Activity Timestamps - -| Field | Type | Description | -|--------|---------|----------------------------------------------------------| -| start? | integer | Unix time (in milliseconds) of when the activity started | -| end? | integer | Unix time (in milliseconds) of when the activity ends | - -:::info -For Listening and Watching activities, you can include both start and end timestamps to display a time bar. -::: - -###### Activity Emoji - -| Field | Type | Description | -|-----------|-----------|-------------------------------| -| name | string | Name of the emoji | -| id? | snowflake | ID of the emoji | -| animated? | boolean | Whether the emoji is animated | - -###### Activity Party - -| Field | Type | Description | -|-------|------------------------------------------------|---------------------------------------------------| -| id? | string | ID of the party | -| size? | array of two integers (current_size, max_size) | Used to show the party's current and maximum size | - -###### Activity Assets - -| Field | Type | Description | -|---------------------|--------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| -| large_image? | string | See [Activity Asset Image](/docs/events/gateway-events#activity-object-activity-asset-image) | -| large_text? | string | Text displayed when hovering over the large image of the activity | -| large_url? | string | URL that is opened when clicking on the large image | -| small_image? | string | See [Activity Asset Image](/docs/events/gateway-events#activity-object-activity-asset-image) | -| small_text? | string | Text displayed when hovering over the small image of the activity | -| small_url? | string | URL that is opened when clicking on the small image | -| invite_cover_image? | string | See [Activity Asset Image](/docs/events/gateway-events#activity-object-activity-asset-image). Displayed as a banner on a [Game Invite](/docs/discord-social-sdk/development-guides/managing-game-invites). | - -###### Activity Asset Image - -Activity asset images are arbitrary strings which usually contain snowflake IDs or prefixed image IDs. Treat data within this field carefully, as it is user-specifiable and not sanitized. - -To use an external image via media proxy, specify the URL as the field's value when sending. You will only receive the `mp:` prefix via the gateway. - -| Type | Format | Image URL | -|-------------------|--------------------------|----------------------------------------------------------------------------| -| Application Asset | `{application_asset_id}` | See [Application Asset Image Formatting](/docs/reference#image-formatting) | -| Media Proxy Image | `mp:{image_id}` | `https://media.discordapp.net/{image_id}` | - -###### Activity Secrets - -| Field | Type | Description | -|-----------|--------|---------------------------------------| -| join? | string | Secret for joining a party | -| spectate? | string | Secret for spectating a game | -| match? | string | Secret for a specific instanced match | - -###### Activity Flags - -| Name | Value | -|-----------------------------|----------| -| INSTANCE | `1 << 0` | -| JOIN | `1 << 1` | -| SPECTATE | `1 << 2` | -| JOIN_REQUEST | `1 << 3` | -| SYNC | `1 << 4` | -| PLAY | `1 << 5` | -| PARTY_PRIVACY_FRIENDS | `1 << 6` | -| PARTY_PRIVACY_VOICE_CHANNEL | `1 << 7` | -| EMBEDDED | `1 << 8` | - -###### Activity Buttons - -When received over the gateway, the `buttons` field is an array of strings, which are the button labels. Bots cannot access a user's activity button URLs. When sending, the `buttons` field must be an array of the below object: - -| Field | Type | Description | -|-------|--------|--------------------------------------------------------| -| label | string | Text shown on the button (1-32 characters) | -| url | string | URL opened when clicking the button (1-512 characters) | - -###### Example Activity - -```json -{ - "details": "24H RL Stream for Charity", - "state": "Rocket League", - "name": "Twitch", - "type": 1, - "url": "https://www.twitch.tv/discord" -} -``` - -###### Example Activity with Rich Presence - -```json -{ - "name": "Rocket League", - "type": 0, - "application_id": "379286085710381999", - "state": "In a Match", - "details": "Ranked Duos: 2-1", - "timestamps": { - "start": 15112000660000 - }, - "party": { - "id": "9dd6594e-81b3-49f6-a6b5-a679e6a060d3", - "size": [2, 2] - }, - "assets": { - "large_image": "351371005538729000", - "large_text": "DFH Stadium", - "small_image": "351371005538729111", - "small_text": "Silver III" - }, - "secrets": { - "join": "025ed05c71f639de8bfaa0d679d7c94b2fdce12f", - "spectate": "e7eb30d2ee025ed05c71ea495f770b76454ee4e0", - "match": "4b2fdce12f639de8bfa7e3591b71a0d679d7c93f" - } -} -``` - -:::warn -Clients may only update their game status 5 times per 20 seconds. -::: - -#### Typing Start - -Sent when a user starts typing in a channel. - -###### Typing Start Event Fields - -| Field | Type | Description | -|------------|------------------------------------------------------------|--------------------------------------------------------| -| channel_id | snowflake | ID of the channel | -| guild_id? | snowflake | ID of the guild | -| user_id | snowflake | ID of the user | -| timestamp | integer | Unix time (in seconds) of when the user started typing | -| member? | [member](/docs/resources/guild#guild-member-object) object | Member who started typing if this happened in a guild | - -#### User Update - -Sent when properties about the current bot's user change. Inner payload is a [user](/docs/resources/user#user-object) object. - -### Voice - -#### Voice Channel Effect Send - -Sent when someone sends an effect, such as an emoji reaction or a soundboard sound, in a voice channel the current user is connected to. - -###### Voice Channel Effect Send Event Fields - -| Field | Type | Description | -|-----------------|-----------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------| -| channel_id | snowflake | ID of the channel the effect was sent in | -| guild_id | snowflake | ID of the guild the effect was sent in | -| user_id | snowflake | ID of the user who sent the effect | -| emoji? | ?[emoji](/docs/resources/emoji#emoji-object) object | The emoji sent, for emoji reaction and soundboard effects | -| animation_type? | ?integer | The [type of emoji animation](/docs/events/gateway-events#voice-channel-effect-send-animation-types), for emoji reaction and soundboard effects | -| animation_id? | integer | The ID of the emoji animation, for emoji reaction and soundboard effects | -| sound_id? | snowflake or integer | The ID of the soundboard sound, for soundboard effects | -| sound_volume? | double | The volume of the soundboard sound, from 0 to 1, for soundboard effects | - -###### Animation Types - -| Type | Value | Description | -|---------|-------|---------------------------------------------| -| PREMIUM | 0 | A fun animation, sent by a Nitro subscriber | -| BASIC | 1 | The standard animation | - -#### Voice State Update - -Sent when someone joins/leaves/moves voice channels. Inner payload is a [voice state](/docs/resources/voice#voice-state-object) object. - -#### Voice Server Update - -Sent when a guild's voice server is updated. This is sent when initially connecting to voice, and when the current voice instance fails over to a new server. - -:::warn -A null endpoint means that the voice server allocated has gone away and is trying to be reallocated. You should attempt to disconnect from the currently connected voice server, and not attempt to reconnect until a new voice server is allocated. -::: - -###### Voice Server Update Event Fields - -| Field | Type | Description | -|----------|-----------|---------------------------------------| -| token | string | Voice connection token | -| guild_id | snowflake | Guild this voice server update is for | -| endpoint | ?string | Voice server host | - -###### Example Voice Server Update Payload - -```json -{ - "token": "my_token", - "guild_id": "41771983423143937", - "endpoint": "sweetwater-12345.discord.media:2048" -} -``` - -### Webhooks - -#### Webhooks Update - -Sent when a guild channel's webhook is created, updated, or deleted. - -###### Webhooks Update Event Fields - -| Field | Type | Description | -|------------|-----------|-------------------| -| guild_id | snowflake | ID of the guild | -| channel_id | snowflake | ID of the channel | - -### Interactions - -#### Interaction Create - -Sent when a user uses an [Application Command](/docs/interactions/application-commands) or [Message Component](/docs/components/reference#component-object). Inner payload is an [Interaction](/docs/interactions/receiving-and-responding#interaction-object-interaction-structure). - -### Stage Instances - -#### Stage Instance Create - -Sent when a [Stage instance](/docs/resources/stage-instance) is created (i.e. the Stage is now "live"). Inner payload is a [Stage instance](/docs/resources/stage-instance#stage-instance-object) - -#### Stage Instance Update - -Sent when a [Stage instance](/docs/resources/stage-instance) has been updated. Inner payload is a [Stage instance](/docs/resources/stage-instance#stage-instance-object) - -#### Stage Instance Delete - -Sent when a [Stage instance](/docs/resources/stage-instance) has been deleted (i.e. the Stage has been closed). Inner payload is a [Stage instance](/docs/resources/stage-instance#stage-instance-object) - -### Subscriptions - -#### Subscription Create - -:::info -Subscription status should not be used to grant perks. Use [entitlements](/docs/resources/entitlement#entitlement-object) as an indication of whether a user should have access to a specific SKU. See our guide on [Implementing App Subscriptions](/docs/monetization/implementing-app-subscriptions) for more information. -::: - -Sent when a [Subscription](/docs/resources/subscription) for a Premium App is created. Inner payload is a [Subscription](/docs/resources/subscription#subscription-object). - -A Subscription's `status` can be either **inactive** or **active** when this event is received. You will receive subsequent `SUBSCRIPTION_UPDATE` events if the `status` is updated to **active**. As a best practice, you should not grant any perks to users until the entitlements are created. - -#### Subscription Update - -Sent when a [Subscription](/docs/resources/subscription) for a Premium App has been updated. Inner payload is a [Subscription](/docs/resources/subscription#subscription-object) object. - -#### Subscription Delete - -Sent when a [Subscription](/docs/resources/subscription) for a Premium App has been deleted. Inner payload is a [Subscription](/docs/resources/subscription#subscription-object) object. - -### Polls - -#### Message Poll Vote Add - -Sent when a user votes on a poll. If the poll allows multiple selection, one event will be sent per answer. - -###### Message Poll Vote Add Fields - -| Field | Type | Description | -|------------|-----------|-------------------| -| user_id | snowflake | ID of the user | -| channel_id | snowflake | ID of the channel | -| message_id | snowflake | ID of the message | -| guild_id? | snowflake | ID of the guild | -| answer_id | integer | ID of the answer | - -#### Message Poll Vote Remove - -Sent when a user removes their vote on a poll. If the poll allows for multiple selections, one event will be sent per answer. - -###### Message Poll Vote Remove Fields - -| Field | Type | Description | -|------------|-----------|-------------------| -| user_id | snowflake | ID of the user | -| channel_id | snowflake | ID of the channel | -| message_id | snowflake | ID of the message | -| guild_id? | snowflake | ID of the guild | -| answer_id | integer | ID of the answer | - -### Rate Limits - -#### Rate Limited - -Sent when an app encounters a gateway rate limit for an event, such as [Request Guild Members](/docs/events/gateway-events#request-guild-members). - -:::info -See changelog for [Introducing Rate Limit When Requesting All Guild Members](/docs/change-log#introducing-rate-limit-when-requesting-all-guild-members) for more information and timeline on this new rate limit. -::: - -###### Rate Limited Fields - -| Field | Type | Description | -|-------------|---------------------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------| -| opcode | integer | [Gateway opcode](/docs/topics/opcodes-and-status-codes#gateway-gateway-opcodes) of the event that was rate limited | -| retry_after | float | The number of seconds to wait before submitting another request | -| meta | [Rate Limit Metadata for Opcode](/docs/events/gateway-events#rate-limited-rate-limit-metadata-for-opcode-structure) | Metadata for the event that was rate limited | - -###### Rate Limit Metadata for Opcode Structure - -| Opcode | Type | -|--------|-----------------------------------------------------------------------------------------------------------------------------------------| -| 8 | [Request Guild Member Rate Limit Metadata](/docs/events/gateway-events#rate-limited-request-guild-member-rate-limit-metadata-structure) | - -###### Request Guild Member Rate Limit Metadata Structure - -| Field | Type | Description | -|----------|-----------|-------------------------------------------------------------------------------------------------------| -| guild_id | snowflake | ID of the guild to get members for | -| nonce? | string | nonce to identify the [Guild Members Chunk](/docs/events/gateway-events#guild-members-chunk) response | diff --git a/docs/events/overview.mdx b/docs/events/overview.mdx deleted file mode 100644 index c18bd6c004..0000000000 --- a/docs/events/overview.mdx +++ /dev/null @@ -1,53 +0,0 @@ ---- -sidebar_label: Overview ---- - -# Overview of Events - -Apps can listen to events happening in Discord to stay up-to-date with changes and updates to servers, users, and even your app. The following sections cover basic information about the different transport methods that can be used to receive events, and link out to relevant documentation. - -## Receiving Events - -There are many event types that can be accessed using different transport methods: -- **[Gateway events](/docs/events/overview#using-gateway)** are sent over a WebSocket connection between your app and Discord, and is the primary way to receive and send events. **Most events are only available via Gateway connections.** -- **[Webhook events](/docs/events/overview#using-webhooks)** are sent to your app's Webhook Event URL over HTTP. -- **[SDK events](/docs/events/overview#using-the-embedded-app-sdk)** are sent to your app when using the Embedded App SDK. - -Read details about each way to receive events in the sections below. - -### Using Gateway - -Gateway events are the primary way apps can listen and send events. Most events related to resources in Discord, like updates to channels, guilds, roles, and messages, are only available over [Gateway](/docs/events/gateway). - -Gateway events are sent over a WebSocket-based [Gateway connection](/docs/events/gateway#connections) between Discord and your app. To receive Gateway events, your app must open and maintain a persistent Gateway connection which you can read details about in the [Gateway documentation](/docs/events/gateway#connections). To make receiving Gateway events simpler, we suggest using a [developer library](/docs/developer-tools/community-resources#libraries) which helps setup, maintain, and handle common pitfalls with Gateway connections (like [rate limits](/docs/events/gateway#rate-limiting)). - -Details about receiving events using the Gateway API is in the [Gateway documentation](/docs/events/gateway#receiving-events), and the full list of available Gateway events is in the [Gateway Events documentation](/docs/events/gateway-events). - -### Using Webhooks - -Webhook events let you receive a small number of events over HTTP. While many events aren't supported over HTTP, some events like [Application Authorized](/docs/events/webhook-events#application-authorized) (sent when your app is installed to a user or server) aren't available using other transport methods like Gateway. - -Find the [list of webhook events](/docs/events/webhook-events#event-types) and details about subscribing and handling them in the [Webhook Events documentation](/docs/events/webhook-events). - - -### Using the Embedded App SDK - -When developing [Activities](/docs/activities/overview), you can listen to a collection of [SDK events](/docs/developer-tools/embedded-app-sdk#sdk-events), like updates to a user's voice status or screen orientation. To listen to SDK events, you can call [`subscribe()`](/docs/developer-tools/embedded-app-sdk#subscribe) with the SDK event name. - -Details about listening to events using the Embedded App SDK is in the [Embedded App SDK documentation](/docs/developer-tools/embedded-app-sdk). - -## Next Steps - - - - Gateway is the primary apps receive events on Discord. Read details about using the Gateway and receiving Gateway Events. - - - Read details about receiving and responding a small number of HTTP-based Webhook Events. - - - Read details about subscribing and receiving events specific to your Activity using the Embedded App SDK. - - - - diff --git a/docs/interactions/receiving-and-responding.mdx b/docs/interactions/receiving-and-responding.mdx deleted file mode 100644 index d76d8427a8..0000000000 --- a/docs/interactions/receiving-and-responding.mdx +++ /dev/null @@ -1,464 +0,0 @@ ---- -sidebar_label: Receiving and Responding ---- - -# Interactions - -An **[Interaction](/docs/interactions/receiving-and-responding#interaction-object)** is the message that your application receives when a user uses an application command or a message component. - -For [Slash Commands](/docs/interactions/application-commands#slash-commands), it includes the values that the user submitted. - -For [User Commands](/docs/interactions/application-commands#user-commands) and [Message Commands](/docs/interactions/application-commands#message-commands), it includes the resolved user or message on which the action was taken. - -For [Message Components](/docs/components/reference) it includes identifying information about the component that was used. It will also include some metadata about how the interaction was triggered: the `guild_id`, `channel`, `member` and other fields. You can find all the values in our data models below. - -### Interaction Object - -###### Interaction Structure - -| Field | Type | Description | -|--------------------------------|---------------------------------------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| -| id | snowflake | ID of the interaction | -| application_id | snowflake | ID of the application this interaction is for | -| type | [interaction type](/docs/interactions/receiving-and-responding#interaction-object-interaction-type) | Type of interaction | -| data?\* | [interaction data](/docs/interactions/receiving-and-responding#interaction-object-interaction-data) | Interaction data payload | -| guild? | [partial guild](/docs/resources/guild#guild-object) object | Guild that the interaction was sent from | -| guild_id? | snowflake | Guild that the interaction was sent from | -| channel? | [partial channel](/docs/resources/channel#channel-object) object | Channel that the interaction was sent from | -| channel_id? | snowflake | Channel that the interaction was sent from | -| member?\*\* | [guild member](/docs/resources/guild#guild-member-object) object | Guild member data for the invoking user, including permissions | -| user? | [user](/docs/resources/user#user-object) object | User object for the invoking user, if invoked in a DM | -| token | string | Continuation token for responding to the interaction | -| version | integer | Read-only property, always `1` | -| message? | [message](/docs/resources/message#message-object) object | For components or modals triggered by components, the message they were attached to | -| app_permissions\*\*\* | string | Bitwise set of permissions the app has in the source location of the interaction | -| locale?\*\*\*\* | string | Selected [language](/docs/reference#locales) of the invoking user | -| guild_locale? | string | [Guild's preferred locale](/docs/resources/guild#guild-object), if invoked in a guild | -| entitlements | array of [entitlement](/docs/resources/entitlement#entitlement-object) objects | For [monetized apps](/docs/monetization/overview), any entitlements for the invoking user, representing access to premium [SKUs](/docs/resources/sku) | -| authorizing_integration_owners | dictionary with keys of [application integration types](/docs/resources/application#application-object-application-integration-types) | Mapping of installation contexts that the interaction was authorized for to related user or guild IDs. See [Authorizing Integration Owners Object](/docs/interactions/receiving-and-responding#interaction-object-authorizing-integration-owners-object) for details | -| context? | [interaction context type](/docs/interactions/receiving-and-responding#interaction-object-interaction-context-types) | Context where the interaction was triggered from | -| attachment_size_limit | integer | Attachment size limit in bytes | - -\* This is always present on application command, message component, and modal submit interaction types. It is optional for future-proofing against new interaction types - -\*\* `member` is sent when the interaction is invoked in a guild, and `user` is sent when invoked in a DM - -\*\*\* `app_permissions` includes `ATTACH_FILES | EMBED_LINKS | MENTION_EVERYONE` permissions for (G)DMs with other users, and additionally includes `USE_EXTERNAL_EMOJIS` for DMs with the app's bot user - -\*\*\*\* This is available on all interaction types except PING - -###### Interaction Type - -| Name | Value | -|----------------------------------|-------| -| PING | 1 | -| APPLICATION_COMMAND | 2 | -| MESSAGE_COMPONENT | 3 | -| APPLICATION_COMMAND_AUTOCOMPLETE | 4 | -| MODAL_SUBMIT | 5 | - -###### Interaction Context Types - -Context in Discord where an interaction can be used, or where it was triggered from. Details about using interaction contexts for application commands is in the [commands context documentation](/docs/interactions/application-commands#interaction-contexts). - -| Name | Type | Description | -|-----------------|------|--------------------------------------------------------------------------------| -| GUILD | 0 | Interaction can be used within servers | -| BOT_DM | 1 | Interaction can be used within DMs with the app's bot user | -| PRIVATE_CHANNEL | 2 | Interaction can be used within Group DMs and DMs other than the app's bot user | - -###### Authorizing Integration Owners Object - -The `authorizing_integration_owners` field includes details about the authorizing user or server for the installation(s) relevant to the interaction. For apps installed to a user, it can be used to tell the difference between the authorizing user and the user that triggered an interaction (like a message component). - -A key will only be present if the following are true: -- The app has been authorized to the [installation context](/docs/resources/application#application-object-application-integration-types) corresponding to the key (`GUILD_INSTALL` or `USER_INSTALL`) -- The interaction is supported in the source [interaction context](/docs/interactions/receiving-and-responding#interaction-object-interaction-context-types) (`GUILD`, `BOT_DM`, or `PRIVATE_CHANNEL`) for the installation context corresponding to the key -- And for command invocations, the command must be supported in the installation context (using [`integration_types`](/docs/interactions/application-commands#contexts)) - -The values in `authorizing_integration_owners` depend on the key— - -- If the key is `GUILD_INSTALL` (`"0"`), the value depends on the source of the interaction: - - The value will be the guild ID if the interaction is triggered from a server - - The value will be `"0"` if the interaction is triggered from a DM with the app's bot user -- If the key is `USER_INSTALL` (`"1"`), the value will be the ID of the authorizing user - -###### Interaction Data - -While the `data` field is guaranteed to be present for all [interaction types](/docs/interactions/receiving-and-responding#interaction-object-interaction-type) besides `PING`, its structure will vary. The following tables detail the inner `data` payload for each interaction type. - -| Interaction Type | Interaction Data | -|----------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------| -| PING (`1`) | N / A | -| APPLICATION_COMMAND (`2`) | [Application Command Data Structure](/docs/interactions/receiving-and-responding#interaction-object-application-command-data-structure) | -| MESSAGE_COMPONENT (`3`) | [Message Component Data Structure](/docs/interactions/receiving-and-responding#interaction-object-message-component-data-structure) | -| APPLICATION_COMMAND_AUTOCOMPLETE (`4`) | [Application Command Data Structure](/docs/interactions/receiving-and-responding#interaction-object-application-command-data-structure) | -| MODAL_SUBMIT (`5`) | [Modal Submit Data Structure](/docs/interactions/receiving-and-responding#interaction-object-modal-submit-data-structure) | - - -###### Application Command Data Structure - -:::info -Sent in `APPLICATION_COMMAND` and `APPLICATION_COMMAND_AUTOCOMPLETE` interactions. -::: - -| Field | Type | Description | -|------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| -| id | snowflake | [`ID`](/docs/interactions/application-commands#application-command-object-application-command-structure) of the invoked command | -| name | string | [`name`](/docs/interactions/application-commands#application-command-object-application-command-structure) of the invoked command | -| type | integer | [`type`](/docs/interactions/application-commands#application-command-object-application-command-structure) of the invoked command | -| resolved? | [resolved data](/docs/interactions/receiving-and-responding#interaction-object-resolved-data-structure) | Converted users + roles + channels + attachments | -| options?\* | array of [application command interaction data option](/docs/interactions/receiving-and-responding#interaction-object-application-command-interaction-data-option-structure) | Params + values from the user | -| guild_id? | snowflake | ID of the guild the command is registered to | -| target_id? | snowflake | ID of the user or message targeted by a [user](/docs/interactions/application-commands#user-commands) or [message](/docs/interactions/application-commands#message-commands) command | - -\* This [can be partial](/docs/interactions/application-commands#autocomplete) when in response to `APPLICATION_COMMAND_AUTOCOMPLETE` - -###### Message Component Data Structure - -| Field | Type | Description | -|----------------|---------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------| -| custom_id | string | [`custom_id`](/docs/components/reference#anatomy-of-a-component-custom-id) of the component | -| component_type | integer | [type](/docs/components/reference#component-object-component-types) of the component | -| values?\* | array of [select option values](/docs/components/reference#string-select-select-option-structure) | Values the user selected in a [select menu](/docs/components/reference#string-select) component | -| resolved? | [resolved data](/docs/interactions/receiving-and-responding#interaction-object-resolved-data-structure) | Resolved entities from selected options | - -\* This is always present for select menu components - -###### Modal Submit Data Structure - -| Field | Type | Description | -|------------|-----------------------------------------------------------------------------------------------------------------------------------------------------|-----------------------------------------| -| custom_id | string | The custom ID provided for the modal | -| components | array of [component interaction response](/docs/interactions/receiving-and-responding#interaction-object-component-interaction-response-structures) | Values submitted by the user | -| resolved? | [resolved data](/docs/interactions/receiving-and-responding#interaction-object-resolved-data-structure) | Resolved entities from selected options | - -###### Component Interaction Response Structures - -| Component | -|-----------------------------------------------------------------------------------------------------------------------| -| [String Select](/docs/components/reference#string-select-string-select-interaction-response-structure) | -| [Text Input](/docs/components/reference#text-input-text-input-interaction-response-structure) | -| [User Select](/docs/components/reference#user-select-user-select-interaction-response-structure) | -| [Role Select](/docs/components/reference#role-select-role-select-interaction-response-structure) | -| [Mentionable Select](/docs/components/reference#mentionable-select-mentionable-select-interaction-response-structure) | -| [Channel Select](/docs/components/reference#channel-select-channel-select-interaction-response-structure) | -| [Text Display](/docs/components/reference#text-display-text-display-interaction-response-structure) | -| [Label](/docs/components/reference#label-label-interaction-response-structure) | -| [File Upload](/docs/components/reference#file-upload-file-upload-interaction-response-structure) | - -###### Resolved Data Structure - -:::info -If data for a Member is included, data for its corresponding User will also be included. -::: - -| Field | Type | Description | -|---------------|------------------------------------------------------------------------------------------|---------------------------------| -| users? | Map of Snowflakes to [user](/docs/resources/user#user-object) objects | IDs and User objects | -| members?\* | Map of Snowflakes to [partial member](/docs/resources/guild#guild-member-object) objects | IDs and partial Member objects | -| roles? | Map of Snowflakes to [role](/docs/topics/permissions#role-object) objects | IDs and Role objects | -| channels?\*\* | Map of Snowflakes to [partial channel](/docs/resources/channel#channel-object) objects | IDs and partial Channel objects | -| messages? | Map of Snowflakes to [partial messages](/docs/resources/message#message-object) objects | IDs and partial Message objects | -| attachments? | Map of Snowflakes to [attachment](/docs/resources/message#attachment-object) objects | IDs and attachment objects | - -\* Partial `Member` objects are missing `user`, `deaf` and `mute` fields - -\*\* Partial `Channel` objects only have `id`, `name`, `type`, `permissions`, `last_message_id`, `last_pin_timestamp`, `nsfw`, `parent_id`, `guild_id`, `flags`, `rate_limit_per_user`, `topic` and `position` fields. Threads will also have the `thread_metadata` field. - -###### Application Command Interaction Data Option Structure - -All options have names, and an option can either be a parameter and input value--in which case `value` will be set--or it can denote a subcommand or group--in which case it will contain a top-level key and another array of `options`. - -`value` and `options` are mutually exclusive. - -| Field | Type | Description | -|----------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------| -| name | string | Name of the parameter | -| type | integer | Value of [application command option type](/docs/interactions/application-commands#application-command-object-application-command-option-type) | -| value? | string, integer, double, or boolean | Value of the option resulting from user input | -| options? | array of [application command interaction data option](/docs/interactions/receiving-and-responding#interaction-object-application-command-interaction-data-option-structure) | Present if this option is a group or subcommand | -| focused? | boolean | `true` if this option is the currently focused option for autocomplete | - -### Message Interaction Object - -This is sent on the [message object](/docs/resources/message#message-object) when the message is a response to an Interaction without an existing message. - -:::info -This means responses to [Message Components](/docs/components/reference) do not include this property, instead including a [message reference](/docs/resources/message#message-reference-structure) object as components _always_ exist on preexisting messages. -::: - -###### Message Interaction Structure - -| Field | Type | Description | -|---------|-----------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| -| id | snowflake | ID of the interaction | -| type | [interaction type](/docs/interactions/receiving-and-responding#interaction-object-interaction-type) | Type of interaction | -| name | string | Name of the [application command](/docs/interactions/application-commands#application-command-object-application-command-structure), including subcommands and subcommand groups | -| user | [user object](/docs/resources/user#user-object) | User who invoked the interaction | -| member? | [partial member](/docs/resources/guild#guild-member-object) object | Member who invoked the interaction in the guild | - -## Receiving an Interaction - -When a user interacts with your app, your app will receive an **[Interaction](/docs/interactions/receiving-and-responding#interaction-object)**. Your app can receive an interaction in one of two ways: - -- Via [Interaction Create](/docs/events/gateway-events#interaction-create) gateway event -- Via outgoing webhook - -These two methods are **mutually exclusive**; you can _only_ receive Interactions one of the two ways. The `INTERACTION_CREATE` [Gateway Event](/docs/events/gateway-events#interaction-create) may be handled by connected clients, while the webhook method detailed below does not require a connected client. - -If you want to receive interactions via HTTP-based outgoing webhooks, you must configure an Interactions Endpoint URL for your app. You can read about preparing and adding an Interactions Endpoint URL to your app in the [Preparing for Interactions](/docs/interactions/overview#preparing-for-interactions) section in Interactions Overview. - -### Interaction Metadata - -An [Interaction](/docs/interactions/receiving-and-responding#interaction-object) includes metadata to aid your application in handling it as well as `data` specific to the interaction type. You can find samples for each interaction type on their respective pages: - -- [Slash Commands](/docs/interactions/application-commands#slash-commands-example-interaction) -- [User Commands](/docs/interactions/application-commands#user-commands-example-interaction) -- [Message Commands](/docs/interactions/application-commands#message-commands-example-interaction) -- [Message Components](/docs/components/using-message-components) -- [Modal Components](/docs/components/using-modal-components) - -An explanation of all the fields can be found in our [data models](/docs/interactions/receiving-and-responding#interaction-object). - -Now that you've gotten the data from the user, it's time to respond to them. - -## Responding to an Interaction - -Interactions--both receiving and responding--are webhooks under the hood. So responding to an Interaction is just like sending a webhook request! - -:::info -Interaction responses have the same header requirements as normal HTTP API requests. See [here](/docs/reference#http-api) for further information. -::: - -There are a number of ways you can respond to an interaction: - -### Interaction Response Object - -###### Interaction Response Structure - -| Field | Type | Description | -|-------|------------------------------------------------------------------------------------------------------------------------------------------|------------------------------| -| type | [interaction callback type](/docs/interactions/receiving-and-responding#interaction-response-object-interaction-callback-type) | Type of response | -| data? | [interaction callback data](/docs/interactions/receiving-and-responding#interaction-response-object-interaction-callback-data-structure) | An optional response message | - -###### Interaction Callback Type - -| Name | Value | Description | -|-----------------------------------------|-------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| -| PONG | 1 | ACK a `Ping` | -| CHANNEL_MESSAGE_WITH_SOURCE | 4 | Respond to an interaction with a message | -| DEFERRED_CHANNEL_MESSAGE_WITH_SOURCE | 5 | ACK an interaction and edit a response later, the user sees a loading state | -| DEFERRED_UPDATE_MESSAGE\* | 6 | For components, ACK an interaction and edit the original message later; the user does not see a loading state | -| UPDATE_MESSAGE\* | 7 | For components, edit the message the component was attached to | -| APPLICATION_COMMAND_AUTOCOMPLETE_RESULT | 8 | Respond to an autocomplete interaction with suggested choices | -| MODAL\*\* | 9 | Respond to an interaction with a popup modal | -| PREMIUM_REQUIRED | 10 | [**Deprecated**](/docs/change-log#premium-apps-new-premium-button-style-deep-linking-url-schemes); respond to an interaction with an upgrade button, only available for apps with [monetization](/docs/monetization/overview) enabled | -| LAUNCH_ACTIVITY | 12 | Launch the Activity associated with the app. Only available for apps with [Activities](/docs/activities/overview) enabled | - -\* Only valid for [component-based](/docs/components/reference) interactions - -\*\* Not available for `MODAL_SUBMIT` and `PING` interactions. - -###### Interaction Callback Data Structure - -###### Messages - -Not all message fields are currently supported. - - -| Field | Type | Description | -|-------------------|----------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| -| tts? | boolean | Whether the response is TTS | -| content? | string | Message content | -| embeds? | array of [embeds](/docs/resources/message#embed-object) | Supports up to 10 embeds | -| allowed_mentions? | [allowed mentions](/docs/resources/message#allowed-mentions-object) | [Allowed mentions](/docs/resources/message#allowed-mentions-object) object | -| flags? \* | integer | [Message flags](/docs/resources/message#message-object-message-flags) combined as a [bitfield](https://en.wikipedia.org/wiki/Bit_field) (only `SUPPRESS_EMBEDS`, `EPHEMERAL`, `IS_COMPONENTS_V2`, `IS_VOICE_MESSAGE`, and `SUPPRESS_NOTIFICATIONS` can be set) | -| components? | array of [components](/docs/components/reference#component-object) | Message components | -| attachments? \*\* | array of partial [attachment](/docs/resources/message#attachment-object) objects | Attachment objects with filename and description | -| poll? | [poll](/docs/resources/poll#poll-create-request-object) request object | Details about the poll | - -\* If you create a callback with the [type](/docs/interactions/receiving-and-responding#interaction-response-object-interaction-callback-type) `DEFERRED_CHANNEL_MESSAGE_WITH_SOURCE` the only valid [message flag](/docs/resources/message#message-object-message-flags) you may use is `EPHEMERAL`. If you'd like to create a component based message with `IS_COMPONENTS_V2` you must do that with the [edit original response](/docs/interactions/receiving-and-responding#edit-original-interaction-response) endpoint, not this one. - -\*\* See [Uploading Files](/docs/reference#uploading-files) for details. - -###### Autocomplete - -| Field | Type | Description | -|---------|------------------------------------------------------------------------------------------------------------------------------------|------------------------------------------| -| choices | array of [choices](/docs/interactions/application-commands#application-command-object-application-command-option-choice-structure) | autocomplete choices (max of 25 choices) | - -###### Modal - -| Field | Type | Description | -|------------|--------------------------------------------------------------------|----------------------------------------------------------------| -| custom_id | string | Developer-defined identifier for the modal, max 100 characters | -| title | string | Title of the popup modal, max 45 characters | -| components | array of [components](/docs/components/reference#component-object) | Between 1 and 5 (inclusive) components that make up the modal | - -:::warn -If your application responds with user data, you should use [`allowed_mentions`](/docs/resources/message#allowed-mentions-object) to filter which mentions in the content actually ping. -::: - -## Interaction Callback - -When responding to an interaction received, you can make a `POST` request to `/interactions///callback`. `interaction_id` is the unique id of that individual Interaction from the received payload. `interaction_token` is the unique token for that interaction from the received payload. - -If you are receiving Interactions over the gateway, you **have to respond via HTTP**. Responses to Interactions **are not sent as commands over the gateway**. - -**If you send this request for an interaction received over HTTP, respond to the original HTTP request with a 202 and no body.** - -```py -import requests - -url = "https://discord.com/api/v10/interactions///callback" - -json = { - "type": 4, - "data": { - "content": "Congrats on sending your command!" - } -} -r = requests.post(url, json=json) -``` - -:::info -Interaction `tokens` are valid for **15 minutes** and can be used to send followup messages but you **must send an initial response within 3 seconds of receiving the event**. If the 3 second deadline is exceeded, the token will be invalidated. -::: - - - If you receive interactions over HTTP, your server can also respond to the received `POST` request. You'll want to respond with a `200` status code (if everything went well), as well as specifying a `type` and `data`, which is an [Interaction Response](/docs/interactions/receiving-and-responding#interaction-response-object) object: - - ```py - @app.route('/', methods=['POST']) - def my_command(): - if request.json["type"] == 1: - return jsonify({ - "type": 1 - }) - - else: - return jsonify({ - "type": 4, - "data": { - "tts": False, - "content": "Congrats on sending your command!", - "embeds": [], - "allowed_mentions": { "parse": [] } - } - }) - ``` - - -###### Interaction Callback Response Object - -| Field | Type | Description | -|-------------|--------------------------------------------------------------------------------------------------------------------------------------|------------------------------------------------------------------| -| interaction | [interaction callback object](/docs/interactions/receiving-and-responding#interaction-callback-interaction-callback-object) | The interaction object associated with the interaction response. | -| resource? | [interaction resource object](/docs/interactions/receiving-and-responding#interaction-callback-interaction-callback-resource-object) | The resource that was created by the interaction response. | - -###### Interaction Callback Object - -| Field | Type | Description | -|-----------------------------|-----------|-----------------------------------------------------------------------------------------------------| -| id | snowflake | ID of the interaction | -| type | integer | [Interaction type](/docs/interactions/receiving-and-responding#interaction-object-interaction-type) | -| activity_instance_id? | string | Instance ID of the Activity if one was launched or joined | -| response_message_id? | snowflake | ID of the message that was created by the interaction | -| response_message_loading? | boolean | Whether the message is in a loading state | -| response_message_ephemeral? | boolean | Whether the response message is ephemeral | - -###### Interaction Callback Resource Object - -| Field | Type | Description | -|----------------------|------------------------------------------------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------| -| type | integer | [Interaction callback type](/docs/interactions/receiving-and-responding#interaction-response-object-interaction-callback-type) | -| activity_instance?\* | [Activity instance resource](/docs/interactions/receiving-and-responding#interaction-callback-interaction-callback-activity-instance-resource) | Represents the Activity launched by this interaction. | -| message?\*\* | [message object](/docs/resources/message#message-object) | Message created by the interaction. | - -\* Only present if type is `LAUNCH_ACTIVITY`. - -\*\* Only present if type is either `CHANNEL_MESSAGE_WITH_SOURCE` or `UPDATE_MESSAGE`. - -###### Interaction Callback Activity Instance Resource - -| Field | Type | Description | -|-------|--------|------------------------------------------------------------| -| id | string | Instance ID of the Activity if one was launched or joined. | - - -## Followup Messages - -Sometimes, you want to send followup messages to a user after responding to an interaction. Or, you may want to edit your original response. Whether you receive Interactions over the gateway or by outgoing webhook, you can use the following endpoints to edit your initial response or send followup messages: - -- [`PATCH /webhooks///messages/@original`](/docs/interactions/receiving-and-responding#edit-original-interaction-response) to edit your initial response to an Interaction -- [`DELETE /webhooks///messages/@original`](/docs/interactions/receiving-and-responding#delete-original-interaction-response) to delete your initial response to an Interaction -- [`POST /webhooks//`](/docs/interactions/receiving-and-responding#create-followup-message) to send a new followup message -- [`PATCH /webhooks///messages/`](/docs/interactions/receiving-and-responding#edit-followup-message) to edit a message sent with that `token` - -:::info -Interactions webhooks share the same rate limit properties as normal webhooks. -::: - -Interaction tokens are valid for **15 minutes**, meaning you can respond to an interaction within that amount of time. - -### Endpoints - -:::info -The endpoints below are not bound to the application's [Global Rate Limit](/docs/topics/rate-limits#global-rate-limit). -::: - -## Create Interaction Response -/interactions/[\{interaction.id\}](/docs/interactions/receiving-and-responding#interaction-object)/[\{interaction.token\}](/docs/interactions/receiving-and-responding#interaction-object)/callback - -Create a response to an Interaction. Body is an [interaction response](/docs/interactions/receiving-and-responding#interaction-response-object). Returns `204` unless `with_response` is set to `true` which returns `200` with the body as [interaction callback response](/docs/interactions/receiving-and-responding#interaction-callback-interaction-callback-response-object). - -This endpoint also supports file attachments similar to the webhook endpoints. Refer to [Uploading Files](/docs/reference#uploading-files) for details on uploading files and `multipart/form-data` requests. - -###### Query String Params - -| Field | Type | Description | -|----------------|--------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------| -| with_response? | [boolean](/docs/reference#boolean-query-strings) | Whether to include an [interaction callback object](/docs/interactions/receiving-and-responding#interaction-callback-interaction-callback-response-object) as the response | - - -## Get Original Interaction Response -/webhooks/[\{application.id\}](/docs/resources/application#application-object)/[\{interaction.token\}](/docs/interactions/receiving-and-responding#interaction-object)/messages/@original - -Returns the initial Interaction response. Functions the same as [Get Webhook Message](/docs/resources/webhook#get-webhook-message). - -## Edit Original Interaction Response -/webhooks/[\{application.id\}](/docs/resources/application#application-object)/[\{interaction.token\}](/docs/interactions/receiving-and-responding#interaction-object)/messages/@original - -Edits the initial Interaction response. Functions the same as [Edit Webhook Message](/docs/resources/webhook#edit-webhook-message). - -## Delete Original Interaction Response -/webhooks/[\{application.id\}](/docs/resources/application#application-object)/[\{interaction.token\}](/docs/interactions/receiving-and-responding#interaction-object)/messages/@original - -Deletes the initial Interaction response. Returns `204 No Content` on success. - -## Create Followup Message -/webhooks/[\{application.id\}](/docs/resources/application#application-object)/[\{interaction.token\}](/docs/interactions/receiving-and-responding#interaction-object) - -:::info -Apps are limited to 5 followup messages per interaction if it was initiated from a user-installed app and isn't installed in the server (meaning the [authorizing integration owners object](/docs/interactions/receiving-and-responding#interaction-object-authorizing-integration-owners-object) only contains `USER_INSTALL`) -::: - -Create a followup message for an Interaction. Functions the same as [Execute Webhook](/docs/resources/webhook#execute-webhook), but `wait` is always true. The `thread_id`, `avatar_url`, and `username` parameters are not supported when using this endpoint for interaction followups. You can use the `EPHEMERAL` [message flag](/docs/resources/message#message-object-message-flags) `1 << 6` (64) to send a message that only the user can see. You can also use the `IS_COMPONENTS_V2` [message flag](/docs/resources/message#message-object-message-flags) `1 << 15` (32768) to send a [component](/docs/components/reference)-based message. - -When using this endpoint directly after responding to an interaction with `DEFERRED_CHANNEL_MESSAGE_WITH_SOURCE`, this endpoint will function as [Edit Original Interaction Response](/docs/interactions/receiving-and-responding#edit-original-interaction-response) for backwards compatibility. In this case, no new message will be created, and the loading message will be edited instead. The ephemeral flag will be ignored, and the value you provided in the initial defer response will be preserved, as an existing message's ephemeral state cannot be changed. This behavior is deprecated, and you should use the [Edit Original Interaction Response](/docs/interactions/receiving-and-responding#edit-original-interaction-response) endpoint in this case instead. - -## Get Followup Message -/webhooks/[\{application.id\}](/docs/resources/application#application-object)/[\{interaction.token\}](/docs/interactions/receiving-and-responding#interaction-object)/messages/[\{message.id\}](/docs/resources/message#message-object) - -Returns a followup message for an Interaction. Functions the same as [Get Webhook Message](/docs/resources/webhook#get-webhook-message). - -## Edit Followup Message -/webhooks/[\{application.id\}](/docs/resources/application#application-object)/[\{interaction.token\}](/docs/interactions/receiving-and-responding#interaction-object)/messages/[\{message.id\}](/docs/resources/message#message-object) - -Edits a followup message for an Interaction. Functions the same as [Edit Webhook Message](/docs/resources/webhook#edit-webhook-message). - -## Delete Followup Message -/webhooks/[\{application.id\}](/docs/resources/application#application-object)/[\{interaction.token\}](/docs/interactions/receiving-and-responding#interaction-object)/messages/[\{message.id\}](/docs/resources/message#message-object) - -Deletes a followup message for an Interaction. Returns `204 No Content` on success. diff --git a/docs/intro.mdx b/docs/intro.mdx deleted file mode 100644 index 815df361e3..0000000000 --- a/docs/intro.mdx +++ /dev/null @@ -1,87 +0,0 @@ ---- -showTOC: false -sidebar_label: Intro -title: Intro ---- - - - -## Build with Discord - -Discord provides a platform for building social experiences, whether you're creating apps within Discord or integrating Discord's features into your game. - - - - Develop apps, bots, and integrations to enhance the Discord experience. - - - Build multiplayer games and social experiences that run directly in Discord. - - - Add rich social features into your game across desktop, mobile, and console. - - - -## Apps: Extend Discord with Custom Integrations - -Enhance the Discord experience with custom apps, commands, and integrations. - - - - Learn the fundamentals of building Discord apps and commands. - - - Create a bot user that plays "rock, paper, scissors" with users. - - - Create custom commands and interactions for your app. - - - -## Activities: Build Multiplayer Games in Discord - -Use the Embedded App SDK to create real-time games and social experiences that users can launch directly inside Discord. - - - - Discover how Activities work in Discord. - - - Build and test an Activity using the Embedded App SDK. - - - Best practices for multiplayer, game design, and player experience. - - - -## Discord Social SDK: Bring Social Features to Your Game - -Enable rich presence, voice chat, and more to create a seamless social experience for your players and grow your game. - - - - Explore rich presence, relationships, voice chat, and more. - - - Start here for a step-by-step guide to adding social features to your game. - - - Best practices for integrating Discord Social SDK features into your game. - - - -## Find Support - -Connect with the developer community, report issues, and stay updated with API changes. - - - - Get support, API announcements, and participate in developer events. - - - Submit API bugs, feature requests, or contribute to the documentation. - - - Find articles, FAQs, and reach out to Discord's developer support team. - - diff --git a/docs/policies-and-agreements/developer-policy.md b/docs/policies-and-agreements/developer-policy.md deleted file mode 100644 index 25da6ab0ac..0000000000 --- a/docs/policies-and-agreements/developer-policy.md +++ /dev/null @@ -1,107 +0,0 @@ ---- -sidebar_label: Developer Policy ---- - -# Discord Developer Policy - -:::info -We’re updating our Developer Terms of Service and Developer Policy, effective July 8, 2024. Please review the updated Policy below and Terms [here](/docs/policies-and-agreements/developer-terms-of-service). If you access or use the APIs on or after July 8, 2024, it means you agree to the updated Policy and Terms. Until then, the current [Developer Terms of Service](https://github.com/discord/discord-api-docs/blob/e5cd463cd1412df2e55fce8ecb81e7d1ed5755b0/docs/policies_and_agreements/Developer_Terms_of_Service.md) and [Developer Policy](https://github.com/discord/discord-api-docs/blob/e5cd463cd1412df2e55fce8ecb81e7d1ed5755b0/docs/policies_and_agreements/Developer_Policy.md) will apply. -::: - -## Effective date: July 8, 2024 - -## Last updated: June 6, 2024 - -*For a link to the previous policy, please see **[here](https://github.com/discord/discord-api-docs/blob/e5cd463cd1412df2e55fce8ecb81e7d1ed5755b0/docs/policies_and_agreements/Developer_Policy.md)**. For a translated version in your selected language, as available, please see **[here](https://support-dev.discord.com/hc/articles/8563934450327)**.* - -Discord is a place where developers can come to build cool experiences to further the way that people connect. As Discord continues to grow and support our developers, it’s important to be transparent about the responsibilities and our expectations of developers and their Applications. This document sets forth the rules developers will need to follow to develop and operate their Applications. - -## Introduction - -This Discord Developer Policy is incorporated into the [Discord Developer Terms of Service](/docs/policies-and-agreements/developer-terms-of-service) (“Developer Terms”), and you agree that it applies to your access to and use of our APIs in addition to the Developer Terms and other Terms. Capitalized terms not otherwise defined herein (including “API Data” and “Application”) have the meaning assigned to them in the Developer Terms. For clarity, the term “including” as used herein means “including without limitation.” - -As described in the Developer Terms (including Section 9), we may take enforcement actions for any Enforcement Reason, including if we believe you or your Application have violated this Developer Policy. If you come across an Application that you believe violates any of these policies, [please report it to us](https://support.discord.com/hc/en-us/requests/new). - -Please check back here regularly, as we may update these policies from time to time, and your continued access to or use of the APIs after such updates go into effect means you accept and agree to them. Additional terms and policies may also apply to your access to or use of certain APIs (including as described in or available via our [Developer Portal](/docs/intro) or [Help Center](https://support-dev.discord.com/hc/en-us/categories/360000656491)). - -## Monetization Requirements - -All Applications attempting to monetize through our services must abide by Discord’s [Monetization Terms](https://support.discord.com/hc/en-us/articles/5330075836311) and [Monetization Policy](https://support.discord.com/hc/en-us/articles/10575066024983). - -Beginning on October 7, 2024, in regions where Discord supports monetization through its Premium Apps products, all developers who offer paid features or capabilities for their Application will be required to: - -- (i) support purchase of such features or capabilities through Discord’s Premium Apps products; and, -- (ii) offer such features or capabilities at prices on Discord that are no higher than the prices at which they are offered through other payment options. - -“Paid features or capabilities” can include things like subscriptions to your Application, access to certain features or content, one-time purchases, recurring subscriptions, and more. Only paid features or capabilities that are offerings supported by Discord’s Premium Apps products will be subject to these requirements. As new types of offerings are supported via Discord’s Premium Apps products, developers will be given a reasonable period of time to implement them into their Application, if applicable. - -## Protect Discord users - -**1. Do not modify a Discord user’s account without explicit permission from the Discord user.** Functionality that intends to make any changes to a Discord account (e.g., adding the account to a server) must clearly and properly inform the Discord account owner of the changes and receive explicit permission to enact the changes. - -**2. Do not initiate processes on a user or server’s behalf without first obtaining their permission.** The manner of providing the option for permission must be clearly labeled and apparent, and contain an accurate description of the purpose or feature being enabled. - -**3. Do not enable your Application to bypass or circumvent Discord’s privacy, safety, and/or security features.** Your Application must respect user decisions to opt out of or block the Application, as applicable. Your Application must respect users’ ability to remove the Application from spaces (e.g., servers or channels) where it is present. - -**4. Do not collect, solicit, or deceive users into providing passwords or other credentials.** Under no circumstances may you or your Application request or attempt to obtain login credentials from Discord users. This includes information such as passwords or account access or login tokens. - -**5. Do not contact users on Discord without their explicit permission.** This includes frequently sending unsolicited direct messages and/or sending direct messages not directly related to maintaining or improving an Application's functionality. - -**6. Do not target users with advertisements or marketing.** Messaging to Discord users from any Application or developer team should be relevant to the function of the Application and may not contain material unrelated to an Application’s function or information. - -**7. Do not contact users outside of Discord without their explicit permission.** You should not contact Discord users outside of the Discord platform using API Data (including any data obtained, disclosed, or inferred through the use of your Application). - -## Respect Our Platform Rules -**8. Do not use the APIs for any dangerous or illegal activity.** This includes, but is not limited to, activities that facilitate or promote: - -- Risks to physical safety; -- Environmental damage; -- Financial scams; or, -- Illegal online gambling. - -**9. Do not direct your Application to people who are under the age of 13 or the minimum age required by the laws in their applicable countries.** As described in our [Terms of Service](https://discord.com/terms#2), our services are only for people who are at least 13 years old and meet the minimum age required by the laws in their applicable countries. -- Additionally, you will ensure your Application is properly rated based on its content (e.g., game ratings), as required by applicable laws or otherwise requested by Discord, and will display such ratings in a manner that is clear and visible to users prior to their authorization or use (e.g., in your Application's profile). - -**10. Do not use the APIs in any way to violate, or to enable or promote others to violate, the [Discord Community Guidelines](https://dis.gd/guidelines).** As described in the Developer Terms, you are responsible for ensuring that your Application is not used to violate any of the Terms. We will take into consideration the abundance, explicit negligence, and intentional enabling of violating behavior when assessing appropriate enforcement. Prohibited behaviors and activities include, but are not limited to, those that: -- Enable the digital creation of illegal media (e.g., child-harm content, non-consensual pornography); -- Distribute adult content to users under the age of 18, or without age-restricted labels (where applicable) to users ages 18 and older; or, - - Unless your Application is labeled as age-restricted, you will make sure your Application is appropriate for users under the age of 18 and complies with all applicable laws (including those applicable to users under the age of 18). -- Enable, promote, or organize any type of on- or off-platform harassment. - -**11. Do not display, post, or promote violent or violent extremist content, messages, or images.** This includes the fields in an Application’s Settings page in the Discord Developer Portal. - -**12. Do not impersonate other Applications, Discord employees or partners, or Discord services.** This includes deception via your and your Application’s account and identity. Note that we allow clearly labeled satire, parody, and fan accounts. - -**13. Do not misrepresent or fraudulently manipulate engagement.** This includes participating in, enabling, or promoting the inflation of server membership with bot or user accounts. This also includes automating messages to be sent for the purpose of maintaining activity in a Discord server. - -**14. Do not evade permanent Discord-level enforcement actions.** Developers of Applications removed for violating our Developer Policy may not recreate the same or substantially similar Applications. - -In addition to the rules above, developers must: (1.) provide users of their Application with a way to report issues or violations relating to the Application or its use (including violations of our platform rules and other Terms); and, (2.) review such reports and take appropriate action. - -Additionally, developers should use commercially reasonable efforts to make themselves available for feedback or user support regarding their Application. - -## Handle Data with Care - -**15. Do not use API Data for any purpose outside of what is necessary to provide your stated functionality.** You may not request, access, or use API Data for any purpose other than as necessary to provide your Application’s stated (and approved through App Review, as applicable) functionality; provided that you may also use API Data for the purpose of improving your Application only if it has been aggregated or de-identified such that it cannot be associated with, or used to identify, any individual. - -**16. Do not use API Data to:** profile Discord users, their identities, or their relationships with other users; to discriminate against anyone based on protected characteristics (as defined in our [Community Guidelines](https://dis.gd/guidelines)); or, for eligibility considerations for benefits or for purposes such as employment, housing, insurance, or otherwise. -Furthermore, you may not, and may not use your Application to, obtain API Data or transmit data to Discord (i) of persons under the age of 13 or the minimum age required by law in their jurisdiction (if older) or (ii) that includes protected health information, financial information, or other sensitive information under applicable law, except to the extent specifically allowed by our Terms for a given Discord service or if necessary to process a financial transaction as enabled by a Discord service. - -**17. Do not disclose API Data to data brokers, advertising networks or services, or any other monetization-related service.** - -**18. Do not sell, license, or otherwise commercialize API Data or any of Discord’s services (as defined in our [Terms of Service](https://discord.com/terms), e.g., Nitro subscriptions).** - -**19. Do not attempt to re-identify, de-anonymize, unscramble, unencrypt, or reverse hash or reverse engineer API Data from the form in which you obtain it.** - -**20. Do not mine or scrape any data, content, or information available on or through Discord services (as defined in our Terms of Service).** - -**21. Do not use message content obtained through the APIs to train machine learning or AI models (including large language models) unless express permission is granted by Discord.** - -Note that we require developers to notify Discord and affected users of potential unauthorized access to API Data, as described in Section 5 of the Developer Terms. - -For the avoidance of doubt, the above policies apply in addition to the terms relating to API Data described in the Developer Terms (including Section 5 (User Privacy and Security)), and use of data includes how you access, collect, store, retain, transmit, share, and otherwise process it. - -## API Limits -As described in the [Developer Terms](/docs/policies-and-agreements/developer-terms-of-service), Discord may set and enforce limits on your use of the APIs (e.g., by limiting the number of API requests that you may make, or the number of users you may serve) at our sole discretion. You agree to, and will not attempt to circumvent, such limitations we set for each API. - -If you would like to use any API beyond these limits, you must obtain Discord’s express written consent. Discord may, at our discretion, decline such request or condition acceptance on your agreement to additional terms and/or charges for such use. diff --git a/docs/policies-and-agreements/developer-terms-of-service.md b/docs/policies-and-agreements/developer-terms-of-service.md deleted file mode 100644 index 28928081e2..0000000000 --- a/docs/policies-and-agreements/developer-terms-of-service.md +++ /dev/null @@ -1,260 +0,0 @@ ---- -sidebar_label: Developer Terms of Service ---- - -# Discord Developer Terms of Service - -:::info -We’re updating our Developer Terms of Service and Developer Policy, effective July 8, 2024. Please review the updated Terms below and Policy [here](/docs/policies-and-agreements/developer-policy). If you access or use the APIs on or after July 8, 2024, it means you agree to the updated Terms and Policy. Until then, the current [Developer Terms of Service](https://github.com/discord/discord-api-docs/blob/e5cd463cd1412df2e55fce8ecb81e7d1ed5755b0/docs/policies_and_agreements/Developer_Terms_of_Service.md) and [Developer Policy](https://github.com/discord/discord-api-docs/blob/e5cd463cd1412df2e55fce8ecb81e7d1ed5755b0/docs/policies_and_agreements/Developer_Policy.md) will apply. -::: - -## Effective date: July 8, 2024 - -## Last updated: June 6, 2024 - -*For a link to the previous terms, please see **[here](https://github.com/discord/discord-api-docs/blob/e5cd463cd1412df2e55fce8ecb81e7d1ed5755b0/docs/policies_and_agreements/Developer_Policy.md)**. For a translated version in your selected language, as available, please see **[here](https://support-dev.discord.com/hc/articles/8562894815383)**.* - -Welcome! Thank you for your interest in Discord’s APIs, software development kits (“DDSDKs”), and other developer products and services and associated software (including those described in or available via our [Developer Portal](/docs/intro) (collectively, "APIs" or “Developer Platform”). - -These Developer Terms of Service (“Developer Terms”) apply to your access to and use of the APIs and set forth the legal obligations between us and you. - -When we say “Discord,” “we,” “us,” and “our” in these Developer Terms of Service, we mean Discord Inc., unless otherwise set forth in additional terms applicable to a given API. - -When we say “Terms” in these Developer Terms, we mean, collectively, these Developer Terms, our [Developer Documentation](/docs/intro) and any other applicable documentation we make available (“Documentation”), our [Discord Developer Policy](/docs/policies-and-agreements/developer-policy), our [Terms of Service](https://discord.com/terms) (including our [Discord Community Guidelines](https://discord.com/guidelines)), and any other applicable terms, policies, and guidelines we make available (including in our [Developer Portal](/docs/intro) or [Help Center](https://support-dev.discord.com/hc)). If there is a conflict between these Developer Terms and any additional terms, then these Developer Terms will control for that conflict. If you use other Discord services in connection with the APIs, then the terms for those other services also apply to you. Additional defined terms are described in Section 13 (Definitions) below. - -Important Note: Section 12(e) (Choice of Law; Dispute Resolution) incorporates the [dispute resolution provision](https://discord.com/terms#settling-disputes-between-you-and-discord) from our [Terms of Service](https://discord.com/terms), which includes an arbitration clause and class action waiver that applies to all U.S.-based Discord users. Please read this section carefully as it may significantly affect your legal rights, including your right to file a lawsuit in court. - -## Section 1: Acceptance of the Terms and Registration - -### a. Accepting the Terms - -By accepting these Developer Terms of Service, creating or operating an Application, or otherwise accessing or using our APIs, you agree to comply with the Terms and that the Terms control your relationship with us. You also confirm and agree that (i) you are at least 13 years of age and meet the minimum age required by the laws in your country, and (ii) if you are not old enough to have authority to consent to the Terms in your country, that your parent or legal guardian must agree to the Terms on your behalf. If you are a parent or legal guardian, and your teenager accesses or uses the APIs, then the Terms also apply to you and you are responsible for your teenager’s activity. Please read all the Terms carefully. - -You may not use the APIs and may not accept the Terms if you are barred from using or receiving the APIs under the applicable laws of the United States or other countries, including the country in which you are a resident or from which you use the APIs. - -If you are using the APIs on behalf of an entity, you represent and warrant that you have authority to bind that entity to the Terms and by accepting the Terms, you are doing so on behalf of that entity (and all references to "you" in the Terms refer to that entity). - -### b. Registration & Application Information - -You may be required or requested to provide certain information about yourself (such as identification or contact details or materials) and your Application (such as details about its functionality) as part of the registration process for access to the APIs (including when you create your Application), or as part of your continued use of the APIs (including in the Developer Portal or during App Review). You will ensure such information is accurate, complete, and up-to-date at all times. Without limiting the foregoing, you will maintain a clear and accurate description of your Application in its user-facing profiles. You will not misrepresent or mask your, or your Application’s, identity in the Developer Portal, as part of any registration process or App Review, or when using the APIs. We will use information about you to confirm your identity and as otherwise described in our [Privacy Policy](https://discord.com/privacy). - -## Section 2: Use of the APIs - -### a. License to you -Subject to your compliance with the Terms, we grant you a limited, non-exclusive, non-sublicensable, non-transferable, non-assignable, revocable license to access and use the APIs and Documentation we make available to you solely as necessary to integrate with, develop, and operate your Application to the extent permitted under the Terms (including the [Developer Policy](/docs/policies-and-agreements/developer-policy). We reserve all rights, title, and interest not expressly granted in the Terms and you may not access or use the APIs or Documentation except as set forth in the Terms. - -## b. Restrictions - -You will not (and will not attempt to or permit or enable others to): (a) reverse engineer or otherwise derive source code, trade secrets, or know-how from the APIs, except to the extent this restriction is prohibited by applicable laws; (b) modify, create derivative works, copy, reproduce, redistribute, rent, lease, sell, or syndicate access to the APIs; or (c) access or use the APIs in any way that (i) is not in accordance with the applicable Documentation, (ii) compromises, breaks, or circumvents any of our technical processes or security measures, (iii) poses a security vulnerability to users, us (including our systems or networks), or any third party, or (iv) exceeds any API rate, call, or other usage limits we set in our sole discretion (including as set forth in the Developer Policy or the applicable Documentation) or that we believe constitutes excessive or abusive usage. - -### c. Open Source Software - -Some of the software required by or included in our APIs may be offered under an open source license, as may be listed in the Documentation. Open source software licenses constitute separate written agreements. To the limited extent the open source software license expressly supersedes the Terms, the open source license instead sets forth your agreement with Discord solely for the applicable open source software. - -### d. Developer Credentials - -You will use any developer credentials (such as your Application ID, passwords, keys, tokens, and client secrets) we assign to you solely with your Application and the applicable APIs (and will not permit or enable any other Application to use them) and will treat them as Discord confidential information (as described below). Without limiting the foregoing, you will keep API keys and tokens encrypted in any files or other materials accessible by third parties (other than your Service Providers, subject to Section 12(a)). For the avoidance of doubt, developer credentials may not be embedded in open source projects. - -### e. Eligibility - -As part of the APIs, we may make certain features available to you that require you to meet additional criteria in order to be eligible to access them (e.g., to enable your Application to be discoverable on or through Discord services). For the avoidance of doubt, your access to and use of such features will be subject to your compliance with the then-current applicable eligibility criteria and other policies (in addition to all other Terms). - -## Section 3: Use of App Content and Your Application - -### a. License - -You grant us a non-exclusive, transferable, sublicensable, royalty-free, worldwide license to run, publicly display and perform, distribute, reproduce, modify, host, translate, store, and otherwise use your Application and App Content in connection with operating, developing, and improving the APIs and other Discord services; provided that the right to reproduce does not apply to the Application. This license is to allow us to, among other things: enable users to install and use your Application in Discord servers; display and provide information about you (including your name and Brand Features) and your Application to users (including in profile and product pages); frame and link to, place content around, and limit commands from your Application; make your Application discoverable by users on or through Discord services (including in search results, categories, and collections with other Applications); attribute you as the source of App Content; and analyze your Application and App Content for performance and compliance. For clarity, the things we do under this license will depend in part on your Application, App Content, and how you use the APIs. For example, if your Application is a bot integration that you host and deploy on your own, then we would not need to host your Application. This license will remain in effect with respect to App Content after the Terms end. We will not be subject to any terms or policies associated with your Application or App Content (even if we click to agree). You will ensure that your Application and App Content do not introduce any viruses, worms, defects, Trojan horses, malware, spyware, adware, or other items of a destructive nature to the APIs or other Discord services. - -### b. Users - -You are solely responsible for your Application (including its development, operation, maintenance, support, distribution, use, and content). You will require users to comply with all applicable laws and regulations and the Terms (including our [Terms of Service](https://discord.com/terms)) in connection with their use of your Application (and will not permit or enable them to violate any of the foregoing). If you have a separate terms of service or other agreement to apply to users’ use of your Application, you agree (i) such agreement is solely between you and the user and we will not have any responsibility or liability thereunder and (ii) such agreement may not and will not supersede, modify, or be inconsistent with the Terms, which will supersede if there is any conflict or inconsistency with your agreement. - -## Section 4: Compliance with Laws & Third-Party Rights - -You and your Application will (and you will require those acting on your behalf and your users to): (i) comply with all applicable laws and regulations; (ii) not infringe or violate any third-party rights (including intellectual or other proprietary rights or rights of privacy or publicity); (iii) not access or use the APIs in a manner that is deceptive, unethical, false, misleading, or encourages or promotes illegal activity or infringement or violation of third-party rights; and (iv) not violate any other terms or policies with Discord. For clarity and without limiting the foregoing, you and your Application will comply with any third-party agreements, terms, or policies applicable to making your Application available in any Discord client (including app store or other developer guidelines or requirements imposed by Apple, Google, or others). If we believe you or your Application have caused Discord to be in violation of any of these third-party agreements, terms, or policies, we may remove your Application or take other enforcement actions as described in Section 9. - -You represent and warrant that you have obtained and will maintain all necessary rights (including from your users) to grant us the licenses, permissions, and other rights in the Terms (including those in Sections 3(a) and 8(d)) and to operate your Application (including to display, distribute, and provide all information, data, and other content therein and to access, use, and otherwise process users’ API Data and other data). - -## Section 5: User Privacy and Security - -### a. Implement Good Privacy Practices - -Without limiting Section 4, you will comply with all applicable privacy laws and regulations, including the European Union’s General Data Protection Regulation (GDPR) and the ePrivacy Directive, the UK General Data Protection Regulation, Brazil’s Lei Geral de Proteção de Dados (LGPD), the California Consumer Privacy Act (CCPA), and the California Privacy Rights Act (CPRA). You will provide and adhere to a privacy policy for your Application that is compliant with applicable privacy laws and clearly, accurately, and fully describes to users of your Application what data you collect, how you use and share such data with us and third parties, and how users can request deletion of such data. For the avoidance of doubt, how you use data includes how you access, collect, store, retain, transmit, share, and otherwise process it. You may only use API Data in accordance with your privacy policy, applicable laws and regulations, and the Terms. You agree that your privacy policy may not and will not supersede, modify, or be inconsistent with the Terms, which will supersede if there is any conflict or inconsistency with your privacy policy. You will maintain publicly available, up-to-date links to your privacy policy in the Developer Portal and make it easily accessible to users from your Application. - -### b. API Data Sharing & Retention - -You will not share API Data with any third party, except in the following circumstances, subject to compliance with the Terms and applicable laws and regulations: (i) with a Service Provider; (ii) to the extent required under applicable laws or regulations; and (iii) when a user of your Application expressly directs you to share their API Data with the third party (and you will provide us proof thereof upon request). - -Except to the extent you are required to retain API Data under applicable laws or regulations, you will (1) promptly update the API Data upon request from us or the applicable user, and (2) promptly delete the API Data when: (a) retaining it is no longer necessary for your Application’s stated (and approved through App Review, as applicable) functionality that is permitted under the Terms; (b) you stop operating your Application (whether on your own, due to an enforcement action by us, or otherwise); (c) we request you delete it; (d) the applicable user requests you delete it; or (e) required by applicable laws or regulations. You will give users an easily accessible way to ask for their API Data to be modified and deleted. If you have received API Data in error, you will immediately tell us, delete it, and provide proof of deletion upon our request. - -### c. Implement Good Security - -You will, and will require those acting on your behalf to, use commercially reasonable efforts to protect API Data from unauthorized access or use (including, for the avoidance of doubt, destruction, loss, alteration, disclosure, distribution, or other compromise). These efforts will include: (i) encryption of the data at rest and (ii) maintaining administrative, physical, and technical safeguards that are designed to prevent unauthorized access and use and comply with applicable laws and regulations (including relating to data security and privacy). You will promptly report to your users any unauthorized access or use of their data to the extent required by applicable laws or regulations. You will also promptly notify us and provide us with requested information about any incidents of unauthorized access or use of any API Data or any incidents that are reasonably likely to compromise the security, confidentiality, or integrity of your systems (or the systems of those acting on your behalf) that process API Data. In the event of any of the foregoing incidents, you will immediately begin to remediate it and reasonably cooperate with us, including by keeping us regularly updated about the incident and its impact on API Data, remediation actions being taken, and your compliance with any notification or other requirements under applicable laws and regulations. - -## Section 6: Monitoring & App Review - -The APIs are designed to help you enhance your Application. You agree to respond promptly to our requests to verify and audit your compliance with these Terms. YOU AGREE THAT DISCORD MAY MONITOR USE OF THE APIS TO ENSURE QUALITY, IMPROVE DISCORD APIs AND OTHER SERVICES, AND VERIFY YOUR COMPLIANCE WITH THE TERMS. You will not interfere with this monitoring. Discord may use any technical means to overcome such interference. - -Without limiting the foregoing, we may also require that you submit your Application for our review and approval in various circumstances (e.g., to approve access to certain APIs or API Data, when use of your Application reaches certain thresholds, when you request a transfer of ownership or rights relating to your Application, or to review compliance with the Terms) (“App Review”). You will cooperate with App Review and provide and maintain accurate and complete information as we request (including in the Developer Portal). If your Application has been approved through App Review, you will not materially change your Application’s functionality (including the scope of API Data you collect or how you use or share it) beyond its reviewed stated purpose, unless you first re-submit your Application, and receive our approval, through App Review. - -Periodically, we may also request (including through the Developer Portal) information, certifications, and attestations relating to your access to or use of the APIs or API Data, which you will provide to us in the requested time frame and form and which you will ensure are accurate and complete. If you are an entity, such certifications and attestations must be provided by an authorized representative. - -## Section 7: IP and Confidentiality - -### a. IP Ownership and Feedback - -Discord does not acquire ownership in your Application, and you do not acquire ownership of any rights in our APIs, API Data, Documentation, or Discord confidential information or any derivative works of any of the foregoing. -Our APIs and API Data contain some third-party content (such as text, images, videos, audio, or software). This content is the sole responsibility of the person that makes it available and you are solely responsible for your decision to use or distribute any of this content. While we may sometimes review content to determine whether it is illegal or violates our policies or the Terms and we may remove or refuse to display content, we make no representations or warranties about the content or any decisions we make regarding it. Finally, API Data may be subject to intellectual property rights, and, if so, you may not use it unless you are licensed to do so by the owner of that API Data or are otherwise permitted by law. Your access to the API Data may be restricted, limited, or filtered in accordance with applicable law, regulation, and policy. - -If you provide suggestions or other feedback about our APIs, Documentation, or any other Discord services, then you grant us a non-exclusive, perpetual, irrevocable, sublicensable, transferable license to use the feedback and ideas generated from the feedback without any restrictions, attribution, or compensation to you. - -### b. Discord Copyright and IP Policy - -We respond to notices of alleged IP infringement and terminate the accounts of repeat infringers according to the process set out in the U.S. Digital Millennium Copyright Act (DMCA) and [Discord’s Copyright & IP Policy](https://support.discord.com/hc/en-us/articles/4410339349655-Discord-s-Copyright-IP-Policy). If you think somebody is violating your IP and want to notify us, you can find information about submitting notices in the foregoing policy. -Without limiting Section 4, you will comply with the DMCA to receive and respond to notices of claimed infringement with respect to any user or other third-party content provided to or contained in your Application. - -### c. Confidential Matters - -Our communications to you and our APIs may contain Discord confidential information. Discord confidential information includes any materials, communications, and information that are marked or designated confidential or that would normally be considered confidential under the circumstances (including any nonpublic information). Without limiting the foregoing, your participation in any research or feedback surveys or sessions or in any experimentation, testing, or use of APIs we make available to you that are not generally publicly available (including any information you receive, and feedback you provide us, in connection therewith) are Discord confidential information. If you receive any Discord confidential information, then you (i) will keep it confidential using no less than reasonable care to protect it and will only use it as necessary for your permitted use of the applicable APIs under the Terms and to provide us feedback, and (ii) will not disclose it to any third party without Discord's prior written consent, except to the extent (1) required by law with reasonable prior notice to us unless prohibited by court order or (2) necessary for a Service Provider to provide you services subject to Section 12(a). - -## Section 8: Brand Features; Attribution - -### a. Brand Features - -"Brand Features" means the trade names, trademarks, service marks, logos, domain names, and other distinctive brand features of each party. Except where expressly stated, the Terms do not grant either party any right, title, or interest in or to the other party's Brand Features. All use by you of Discord’s Brand Features (including any goodwill associated therewith) will inure to the benefit of Discord. All use by us of your Brand Features (including any goodwill associated therewith) will inure to your benefit. - -### b. Attribution - -All Applications will provide proper attribution(s) as required by Discord (including as may be described in the applicable Documentation). Subject to your compliance with the Terms, Discord grants you a limited, revocable, non-transferable, non-assignable, non-sublicensable, non-exclusive license while the Terms are in effect solely to display Discord’s Brand Features for required attribution(s) or in an incidental manner while promoting or advertising your Application, only in accordance with the Terms and Discord’s Brand Guidelines. You understand and agree that Discord has the sole discretion to determine whether your attribution(s) and use of Discord's Brand Features are in accordance with the above requirements and guidelines. - -### c. Publicity - -You will not make any statement (including in any promotions or advertisements of your Application) regarding your access to or use of the APIs which suggests partnership with, sponsorship by, or endorsement by Discord without Discord prior written approval in each instance. - -### d. Promotional and Marketing Use - -You grant us a non-exclusive, transferable, sublicensable, royalty-free, worldwide license to use your name and Brand Features, your Application’s name and icon, and produce and distribute App Content and incidental depictions (including screenshots, videos, or other content) from your Application, in the course of promoting, marketing, or demonstrating the APIs or other Discord services you are using or your Application (including in our discovery surfaces). This license will remain in effect for existing materials and instances even if the Terms are terminated. - -## Section 9: Termination - -### a. Termination - -You may terminate the Terms by discontinuing your (including your Application’s and those acting on your behalf) access to and use of the APIs at any time with or without notice. Discord reserves the right to terminate the Terms with you, or discontinue, suspend, or limit the APIs or any portion or feature or your access thereto, if there is an Enforcement Reason or at our convenience upon notice to you. If there is an Enforcement Reason, we may, at our discretion, also take other enforcement actions, including the following: issue warnings or notifications to you or the users; identify and require or request corrective actions from you; remove, suspend, or limit your Application or App Content; remove any approval we have provided for your Application through App Review; remove badges we’ve issued to you or your Application; require you to stop using and delete API Data; terminate, suspend, or limit your user or developer account with Discord or your developer credentials; terminate your other agreements with Discord or your ability to use other Discord services; report you or your Application to law enforcement (as we deem appropriate); or take legal action or any other action we consider to be appropriate. Enforcement actions and reviews may be automated or manual. While we may take such actions with or without notice to you, including while we investigate, we value transparency and work hard to give you context for the decisions we make where appropriate. You can appeal any enforcement action we take under these Terms through this [form](https://dis.gd/app-appeal) or options we may make available via our services. -Without limiting any of the foregoing, we may also limit, suspend, or terminate your Application’s access tokens or any other means of access to the APIs that have not been used or accessed within at least the prior 30-day period, with or without notice to you. - -### b. Your Obligations Post-Termination - -Upon any termination of the Terms or discontinuation of your access to the APIs, you will (and will require those acting on your behalf to) immediately stop using the APIs and developer credentials, cease all use of the Discord Brand Features, and delete any cached or stored API Data you have in your possession or control or was otherwise collected by your Application, and all rights granted to you under the Terms (including in Sections 2 and 8(b)) will immediately cease. Discord may independently communicate with any account owner whose account(s) are associated with your Application and developer credentials to provide notice of the termination of your right to use an API. - -### c. Surviving Provisions - -When the Terms come to an end, those terms that by their nature are intended to continue indefinitely will continue to apply, including Sections 2(b), 3 - 7, 8(c) and (d), 9(b) and (c), and 10-13. - -## Section 10: Liability for our APIs - -### a. WARRANTIES - -NEITHER DISCORD NOR ITS AFFILIATES, SUPPLIERS, OR DISTRIBUTORS MAKE ANY SPECIFIC PROMISES ABOUT THE APIs, API DATA, DOCUMENTATION, OR ANY DISCORD SERVICES. FOR EXAMPLE, WE DON'T MAKE ANY COMMITMENTS OR WARRANTIES ABOUT THE SPECIFIC FUNCTIONS OF THE APIs OR THE RELIABILITY, AVAILABILITY, ACCURACY, QUALITY, APPROPRIATENESS, LEGALITY, ORIGIN, SAFETY, USEFULNESS, OR ABILITY TO MEET YOUR NEEDS OF THE APIs, API DATA, OR DOCUMENTATION. YOU ACKNOWLEDGE THAT WE DO NOT WARRANT THAT THE APIs WILL BE UNINTERRUPTED, TIMELY, SECURE, OR ERROR-FREE, AND WE MAY CHANGE, SUSPEND, OR DISCONTINUE THE AVAILABILITY OF THE APIs AT ANY TIME. WE PROVIDE THE APIs, API DATA, AND DOCUMENTATION "AS IS" AND YOU USE THEM AT YOUR SOLE RISK. - -SOME JURISDICTIONS PROVIDE FOR CERTAIN WARRANTIES, LIKE THE IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, AND NON-INFRINGEMENT. EXCEPT AS EXPRESSLY PROVIDED FOR IN THE TERMS, TO THE EXTENT PERMITTED BY LAW, WE EXCLUDE ALL WARRANTIES, GUARANTEES, CONDITIONS, REPRESENTATIONS, AND UNDERTAKINGS. - -### b. LIMITATION OF LIABILITY - -TO THE EXTENT PERMITTED BY LAW, DISCORD, AND DISCORD’S SUPPLIERS AND DISTRIBUTORS, WILL NOT BE RESPONSIBLE FOR LOST PROFITS, REVENUES, OR DATA; FINANCIAL LOSSES; OR INDIRECT, SPECIAL, CONSEQUENTIAL, EXEMPLARY, OR PUNITIVE DAMAGES. -TO THE EXTENT PERMITTED BY LAW, THE TOTAL LIABILITY OF DISCORD, AND ITS AFFILIATES, SUPPLIERS, AND DISTRIBUTORS, UNDER OR ARISING OUT OF THE TERMS, INCLUDING FOR ANY IMPLIED WARRANTIES, IS LIMITED TO THE GREATER OF (I) AMOUNT YOU PAID US TO USE THE APPLICABLE APIS (OR, IF WE CHOOSE, TO SUPPLYING YOU THE APIS AGAIN) DURING THE SIX MONTHS BEFORE YOU FIRST ASSERT A CLAIM OR (II) $100 (OR THE EQUIVALENT IN YOUR LOCAL CURRENCY). -DISCORD IS NOT LIABLE FOR THE CONDUCT OR CONTENT, WHETHER ONLINE OR OFFLINE, OF ANY USER OF DISCORD SERVICES. IN ALL CASES, DISCORD, AND ITS AFFILIATES, SUPPLIERS, AND DISTRIBUTORS, WILL NOT BE LIABLE FOR ANY EXPENSE, LOSS, OR DAMAGE THAT IS NOT REASONABLY FORESEEABLE. - -### c. Indemnification - -Unless prohibited by applicable law, you will defend (at our option), indemnify, and hold harmless Discord, and its affiliates, directors, officers, employees, and users, from and against all claims, liabilities, damages, losses, costs, fees (including legal and accounting fees), and expenses relating to: -- access to or use of the APIs or API Data by you, those acting on your behalf, your Application, or your users (including any incidents of unauthorized access to or use of API Data); -- actual or alleged violation the Terms by you, those acting on your behalf, your Application, or your users; -- actual or alleged infringement of any third-party right (including intellectual property or other proprietary rights or rights to privacy or publicity) by you, those acting on your behalf, your Application, or your users; or -- your Application, App Content, your Brand Features, or any content, data, technology, information, or materials provided or contributed by or through you, those acting on your behalf, your Application, or your users. - -You will not settle any claim without our prior written consent. We may, at our sole discretion, elect to assume control of the defense and settlement of any claim. - -## Section 11: International Transfers - -### a. EEA Transfers - -This Section 11(a) applies to the extent that the API Data includes personal data controlled by Discord Netherlands BV (“Discord EU Data”) and you transfer the Discord EU Data to a territory outside of the European Economic Area that, at the time of such transfer, does not have a positive adequacy decision from the European Commission under Article 45 GDPR (each, an “EEA Data Transfer”). - -In each instance of an EEA Data Transfer, your use of Discord EU Data is subject to your compliance with the standard contractual clauses in European Commission Decision (EU) 2021/914 (“Clauses”) as they relate to controller-to-controller transfers as described in Module One. - -In each instance, you agree that for the purposes of Section IV, Clauses 17 and 18 in the Clauses, Option 1 and Option (b) shall apply respectively and the Member State shall be the Netherlands. Nothing in this Section 11(a) is intended to vary or modify the Clauses. For the purposes of the Appendix to the Clauses, the following will apply: - -- For the purposes of Annex I(A) to the Clauses, Discord Netherlands BV is the "data exporter" and you are the "data importer" as defined in the Clauses. -- For the purposes of Annex I(B) to the Clauses: - - “Categories of data subjects” are the users who visit, access, use, or otherwise interact with your Application and the services of Discord Netherlands BV; - - "Categories of personal data" are Discord EU Data, which includes profile information, communications between users, photos and videos, location information, information about use of your Application and other products and services, payment information, device information, information from third-party partners or Discord, or as otherwise set forth in the Discord Privacy Policy; - - "Sensitive data" is personal data about a person's racial or ethnic origin, political opinions, religious or philosophical beliefs, trade-union membership, genetic data, biometric data for the purpose of uniquely identifying a natural person, data concerning health or data concerning a natural person's sex life or sexual orientation, criminal convictions or alleged commission of an offence; - - "Frequency of the transfer" is on a continuous basis to the extent required to fulfill the purpose set forth directly below; - - “Nature and purpose of the data transfer(s)" is the provision of your Application by you to users pursuant to these Terms and your applicable terms and privacy policy; and - - "Period for which personal data will be retained" is as described in the Terms and in any case not longer than necessary for a legitimate business purpose in accordance with the Terms and applicable laws or regulations (including rights of erasure and similar rights for individuals), unless applicable laws require the Discord EU Data be retained for a longer period, in which case you shall only retain such Discord EU Data for the period required by such applicable laws. -- For the purposes of Annex I(C) to the Clauses, the competent supervisory authority will be the Dutch Data Protection Authority (Autoriteit Persoonsgegevens); and -- For the purposes of Annex II to the Clauses, you will implement and maintain the technical and organisational security measures set out in the Terms, including those in Section 5 (“User Privacy and Security”) and such other measures as we may require from time to time. - -### b. UK Transfers - -This Section 11(b) on UK transfers shall apply to the extent that the API Data includes personal data controlled by Discord Netherlands BV that is subject to the UK GDPR (as defined in the UK's Data Protection Act 2018 ("DPA")) (“Discord UK Data”) and the transfer of such Discord UK Data to a territory outside of the United Kingdom that, at the time of such transfer, does not have a positive adequacy decision from the Secretary of State in accordance with the relevant provisions of the UK GDPR and the DPA (“UK Data Transfer”). - -Whenever there is a UK Data Transfer, your use of Discord UK Data is subject to your compliance with the Approved Addendum (which is hereby incorporated by reference into these Developer Terms and is deemed to have been entered into and completed as set out below). Nothing in this Section 11(b) is intended to vary or modify the Approved Addendum. All defined terms used below shall have the meanings given to them in the Approved Addendum. For the purpose of the Approved Addendum, the following will apply: -- In Table 1 of the Approved Addendum, the parties' details are as follows: - - Discord Netherlands BV is the "data exporter" and you are the "data importer" as defined in the Approved Addendum. -The parties details and key contact information are: - - Discord Netherlands BV, Schiphol Boulevard 195, 1118 BG Schiphol, Netherlands, and the contact person's details are as notified by the data exporter to the data importer from time to time. - - Developer's details and key contact information are your details notified to Discord Netherlands BV from time to time. - - The parties agree that execution of the Terms by the parties shall constitute execution of the Approved Addendum. -- For the purposes of Table 2 of the Approved Addendum, the selected modules of the Approved EU SCCs shall be Module 1 (controller to controller). -- Table 3 of the Approved Addendum shall be populated as follows: - - Annex 1A: List of Parties: See Table 1 references above and the activities relevant to the data transferred are as described in the Terms. - - Annex 1B: Description of Transfer: The information in Section 11(a) above shall apply, albeit references to "Discord EU Data" shall be replaced with "Discord UK Data". - - Annex II: Technical and organizational measures: For the purposes of Annex II, you will implement and maintain the technical and organisational security measures set out in the Terms, including those in Section 5 (“User Privacy and Security”) and such other measures as we may require from time to time. -- In Table 4 of the UK Addendum, the data exporter may end the UK Addendum in accordance with the terms of the UK Addendum. - -## Section 12: General Provisions - -### a. Service Providers - -Before using a Service Provider, you will require them to first agree in writing to only access and use the APIs and API Data for you and at your direction to provide you services to develop or operate your Application in compliance with the Terms, and for no other purpose (including their own). For the avoidance of doubt, Service Providers are acting on your behalf. You will ensure that each Service Provider complies with the Terms as if they are in your place, and you are solely responsible and liable for their acts and omissions, including noncompliance. When you stop using a Service Provider, you will ensure they immediately cease using the APIs and API Data and promptly delete all API Data in their possession or control. Upon notice, we may prohibit your use of any Service Provider if we reasonably believe that they have violated the Terms or they are negatively impacting us, the APIs or our other services, API Data, or the users, and you will promptly stop using them. - -### b. Modification - -We may change these Developer Terms from time to time. If we make a material change to these Developer Terms, we will provide you with reasonable notice prior to the change taking effect (e.g., at the email address or Discord ID we have on file for you or in the Developer Portal), unless the changes are urgent. If you continue to access or use the APIs or API Data after the changes have taken effect, it means that you agree to the changes. If you do not agree, you must stop using the APIs and API Data. You can review the most current version of these Developer Terms at any time by visiting this page. - -### c. U.S. Federal Agency Entities - -The APIs and Documentation were developed solely at private expense and are commercial computer software and related documentation within the meaning of the applicable U.S. Federal Acquisition Regulation and agency supplements thereto. - -### d. Export Control - -You represent and warrant that you are not located in, or affiliated with the government of North Korea and are not included on any U.S. or E.U. list of prohibited or restricted parties. If you are located in any other country, including those subject to a comprehensive U.S. or E.U. sanction or embargo, your use of the APIs and any other Discord services must be in compliance with U.S. and E.U. laws and must not cause Discord to be in violation of such laws. If you request access to, download, or use any APIs that are not generally publicly available, you also represent and warrant that you are not located in Syria or the Crimea region of Ukraine, and are not affiliated with a government of such regions or the governments of Cuba or Iran. In addition, if your Application incorporates Discord software or SDKs, it may be subject to U.S. export controls governing its export, reexport, and transfer. You are responsible for determining the applicable restrictions and obtaining any necessary export approvals for your Application under the applicable laws. You may not permit your Application to be hosted, accessed, or used (i) in North Korea or by any U.S. or E.U. list of prohibited or restricted parties; or (ii) in any other country or region subject to comprehensive U.S. or E.U. government embargo (including Cuba, Iran, Syria, and the Crimea, Donetsk People's Republic, or the Luhansk People's Republic regions of Ukraine) unless that use is authorized by the U.S. and other relevant authorities, for example the general licenses issued by the U.S. Office of Foreign Assets Control for services incident to the exchange of personal communications over the Internet (such as instant messaging, chat and email, social networking, sharing of photos and movies, web browsing, and blogging). - -### e. Choice of Law; Dispute Resolution - -Subject to Section 11 above with respect to the governing law that applies to International Data Transfers, the [“Settling disputes between you and Discord” section in our Terms of Service](https://discord.com/terms#settling-disputes-between-you-and-discord) applies, where references to “the services” or “our services” will mean the APIs, “these terms” will mean these Developer Terms of Service, and the date for emailing an opt-out notice is within 30 days of July 8, 2024 or when you first create an Application, whichever is later. - -### f. General Legal Terms - -To the extent permitted by law, we each agree to contract in the English language and if we provide a translation of the Terms, we do so for your convenience only and the English Terms will solely govern our relationship. The term “including” means “including without limitation.” The Terms do not create any third party beneficiary rights or any agency, partnership, or joint venture. Nothing in the Terms will limit either party's ability to seek injunctive relief. We are not liable for failure or delay in performance to the extent caused by circumstances beyond our reasonable control. If you do not comply with the Terms, and Discord does not take action right away, this does not mean that Discord is giving up any rights that it may have (such as taking action in the future). If it turns out that a particular term is not enforceable, this will not affect any other terms. The Terms are the entire agreement between you and Discord relating to its subject and supersede any prior or contemporaneous agreements on that subject (unless, and solely to the extent, you and Discord have entered into a separate written agreement to expressly supersede). For information about how to contact Discord, please visit our [Terms of Service](https://discord.com/terms). - -You may not assign, sublicense, delegate, or otherwise transfer any of your rights or obligations under the Terms (including any sale, license, or other transfer of ownership of your Application) to any third party without the prior written consent of Discord. For clarity, upon a Discord-approved transfer, the Terms apply to the transferee as “you” (including with respect to the operation of the Application and any processing of API Data, whether obtained before or after the transfer) and they assume the obligations and liabilities of the transferor under the Terms. Any transfer in violation of this provision is null and void. Any change of control or material ownership of you is hereby deemed an assignment. These Terms are non-exclusive. You acknowledge that Discord may develop products or services that may compete with, or are similar to, Applications or any other products or services. - -## Section 13: Definitions - -- “APIs” (or “Developer Platform”) means, collectively, Discord’s APIs, software development kits (“SDKs”), and other developer services and associated software (including those described in or available via our [Developer Portal](/docs/intro)). -- “API Data” means any data, information, or other content you obtain through the APIs (including personal data). API Data includes your developer credentials and access tokens. -- “App Content” means any data, information, technology, materials, or other content that you or those acting on your behalf add to our services or otherwise make available to us in connection with the APIs or your Application (including as submitted, posted, or displayed by or through your Application). -- “App Review” has the meaning set forth in Section 6. -- “Application” (or “app”) means any application (including any bot, game, activity, website, or other client) that accesses or uses our APIs or to which we have assigned an Application ID. “your Application” means any Application that you own or operate. References made to API Client in existing terms, policies, agreements, or Documentation will now mean Application. -- “Approved Addendum” means the International Data Transfer Addendum to the Clauses, Version B1.0, issued by the UK Information Commissioner’s Office and laid before the Parliament in accordance with s119A of the Data Protection Act 2018, in force 21 March 2022, as may be amended by the Information Commissioner. -- “Brand Features” has the meaning set forth in Section 8(a). -- “Clauses” has the meaning set forth in Section 11(a). -- “Discord EU Data” has the meaning set forth in Section 11(a). -- “Discord services” (or “our services") has the meaning set forth in our [Terms of Service](https://discord.com/terms) for Discord’s services. -- “Discord UK Data” has the meaning set forth in Section 11(b). -- “EEA Data Transfer” has the meaning set forth in Section 11(a). -- “Enforcement Reasons” mean if we believe (i) you or your Application have or may have violated any of the Terms (including by enabling or permitting violations of our [Terms of Service](https://discord.com/terms) or other Terms by users) or is negatively impacting us, the APIs or other Discord services, or our users; (ii) your Discord user account has been compromised or it is otherwise suspended or terminated; (iii) it is necessary to comply with applicable laws or regulations or otherwise required by court order or other governmental authority; or (iv) it is necessary to protect ourselves from legal or regulatory liability. -- “Service Provider” means a person or entity you use to provide you services to develop or operate your Application. -- “UK Data Transfer” has the meaning set forth in Section 11(b). diff --git a/docs/policies-and-agreements/store-distribution-agreement.md b/docs/policies-and-agreements/store-distribution-agreement.md deleted file mode 100644 index 2dfc3df141..0000000000 --- a/docs/policies-and-agreements/store-distribution-agreement.md +++ /dev/null @@ -1,179 +0,0 @@ -# Discord Store Distribution Agreement for Developers (Self-Service) - -This Discord Store Distribution Agreement for Developers (“Agreement”) is by and between Discord, Inc., with a principal office located at 444 De Haro Street, San Francisco, California 94107 (“Discord”), and the person or entity identified in the “Legal Name” field in connection with the process of agreeing to this Agreement (“Developer”). Such process is referred to in this Agreement as the “Agreement Process”. The effective date of this Agreement is date on which Discord provides Developer with notice of its acceptance (“Effective Date”). - -BY ELECTRONICALLY SIGNING THIS AGREEMENT OR CLICKING THE “I AGREE” OR SIMILAR BUTTON AS PART OF THE AGREEMENT PROCESS, DEVELOPER IS AGREEING TO BE BOUND BY THIS AGREEMENT. - -### 1\. Definitions - -1.1 “**Affiliate**” means, with respect to an entity, a person or entity that controls, is controlled by, or is under common control with such entity. - -1.2 “**App(s)**” means the Developer games or other applications specified in connection with the Agreement Process and provided by Developer to Discord for distribution via the Discord Store, including, upon delivery to Discord, any App Updates, Error corrections for, and any Localized Versions of such Apps. Apps include only the versions of such games or applications that operate on Windows, Macintosh, or Linux operating systems, or other operating systems supported by Discord Store in the future. - -1.3 “**App-Related Content**” means any online content, features or software specific to an App that is made available by Developer for purchase, download or online access separately from the App, whether through in- application purchase transactions or otherwise (for example, but without limiting the foregoing, App-themed virtual items, expansion packs, additional filters, codecs, stock multimedia, game scenarios or levels, additional functionality, etc.). App-Related Content also includes any services provided with respect to an App in exchange for a subscription payment. - -1.4 “**App Term**” means the time period during which an App may be made generally available in the entire Territory for use by and/or distribution to Discord Store Account Owners on the Discord Store. - -1.5 “**App Updates**” means any updates, corrections, and enhancements provided by Developer for use by any end user of the Apps and shall include any such updates, corrections, and enhancements made available to third parties or end users. - -1.6 “**Demo Version**” means any demonstration versions of the Apps, if any. - -1.7 “**Developer Marks**” means the trademarks, including logos, used by Developer for the Apps. - -1.8 “**Discord Marks**” means Discord’s trademarks and logos that Discord provides to Developer for use in accordance with this Agreement. - -1.9 “**Discord SDK**” means Discord’s rich presence or other software development kits made available by Discord to Developer for use in accordance with this Agreement. - -1.10 “**Discord Software**” means the Discord SDK, the Discord Store SDK, and any other Discord software made available by Discord to Developer (for example, the API as defined in the Developer TOS) for use in accordance with this Agreement. - -1.11 “**Discord Store**” means Discord’s online app distribution platform. For the purposes of this Agreement, “Discord Store” does not include any content from Developer, Discord, or other third parties. - -1.12 “**Discord Store Account Owner**” means an end user of one or more of the Apps who has obtained a Discord Store account, agreed to Discord’s Discord Store Subscriber Agreement, and licensed a version of the Apps via the Discord Store. - -1.13 “**Discord Store SDK**” means the software development toolkit for the Discord Store that is delivered to or made available to Developer for its use in accordance with this Agreement. - -1.14 “**General Availability Date**” or “GA Date” means, for each App, the date such App is first made generally available in the entire Territory for use by and/or distribution to Discord Store Account Owners on the Discord Store. For clarity, the GA Date shall not be the first date of any beta testing or other limited availability. - -1.15 “**Gross Revenue**” means revenue actually received and booked by Discord from its users in accordance with its standard accounting processes from Discord’s distribution of the Apps via the Discord Store pursuant to this Agreement. - -1.16 “**Localized Version**” means any versions of the Apps created for specific languages or jurisdictions. - -1.17 “**Net Revenue**” means Gross Revenue less (a) actual amounts attributed to returns, user fraud, charge-backs and refunds; (b) amounts collected for VAT (defined below); and (c) any amounts paid to third-party payment processors and money-transmitters. - -1.18 “**Primary Platform**” means the operating system on which the majority of usage occurred during the seven (7) day period following the date of purchase (or free download) of an App, provided that if no usage occurred during that period, the Primary Platform shall be the operating system on which the Discord Store Account Owner purchased (or downloaded for free) the App, - -1.19 “**Ratings Information**” means ratings information about the Apps obtained from ratings boards or government authorities (including, but not limited to, the ESRB). - -1.20 “**Sales Data**” means non-personally identifiable sales data for Discord Store Account Owners that is retained by Discord and typically analyzed by Discord for its own computer games, including but not limited to sales rates by country. - -1.21 “**Territory**” means (a) worldwide or (b) the jurisdictions authorized for distribution by Developer on Discord Store, if Developer has restricted an App’s distribution territory through the online tools provided by Discord for this purpose. - -1.22 “**VAT**” means any value added tax, goods and services tax or any other similar tax, including any sales tax, service tax, gross receipt tax, or use tax imposed by any governmental authority in any country at any level. - -### 2\. Rights and Licenses - -2.1 **Apps License.** Developer hereby grants to Discord a license: (a) to copy, perform, display, modify, create derivative works of, and use the Apps for general access and as necessary to (i) enable the use and distribution of the Apps (including Demo Versions, Localized Versions and App Updates) via Discord Store, and (ii) support Discord Store Account Owners as described in this Agreement; and (b) to copy, perform, display, modify, create derivative works of, and use, transmit, sell, license and otherwise distribute the Apps via Discord Store to Discord Store Account Owners in the Territory. The foregoing license (the “Apps License”) shall be non-exclusive and worldwide. The only fees payable for the Apps License shall be as set forth in Section 6.1 of this Agreement. Any Territory restrictions shall apply to the sale or initial distribution of the App. Developer acknowledges and agrees that Discord Store Account Owners may receive subsequent distributions of Apps from locations outside the Territory. - -2.2 **Appointment as Agent and Commissionaire.** Developer hereby appoints Discord as (i) its agent for the marketing and delivery of the Apps to Discord Store Account Owners located in the United States and (ii) its commissionaire (Agent with Developer as undisclosed Principal) for the marketing and delivery of Apps to Discord Store Account Owners located in the rest of the world. Developer hereby acknowledges that Discord will market and make the Apps available for download. In furtherance of Discord's appointment under this Section, Developer hereby authorizes and instructs Discord to: - -(a) be merchant of record at the Discord Store and issue invoices for the purchase price payable by Discord Store Account Owners for the Apps; and - -(b) otherwise use Apps, Information and associated metadata as may be reasonably necessary in the marketing and delivery of the Apps. - -The parties acknowledge and agree that their relationship is, and shall be, that of principal and agent (U.S.), or principal and commissionaire (non-U.S.), as the case may be, and that Developer, as principal, is, and shall be, solely responsible for any and all claims and liabilities involving or relating to, the Apps. For completeness' sake, (i) Discord Store Account Owners located in the United States will enter into a license agreement for Apps with Developer (effectuated by Discord in the name of and on behalf of Developer), and (ii) Discord Store Account Owners located in the rest of the world will enter into a license agreement for Apps with Discord (but for the risk and account of Developer). - -2.3 **Marketing License.** Developer hereby grants to Discord a royalty-free license, during the Term, to copy, perform, display, create derivative works of, use, and distribute (a) the Developer Marks and (b) materials from the Apps (for example, screenshots), marketing material (for example, videos), and ratings information in connection with the promotion, marketing, licensing, sale, and distribution of the Apps and the exercise of Discord’s other rights under this Agreement. The foregoing license shall be non-exclusive and worldwide. - -2.4 **Discord Store and Discord Software License.** Discord hereby grants to Developer a non-exclusive, royalty-free, license, during the Term, to use the Discord Store solely as necessary to fulfill Developer’s obligations under this Agreement. Developer’s use of the Discord Software shall be subject to the Discord Developer Terms of Service currently located at https://discord.com/developers/docs/legal (the “Developer TOS”). - -2.5 **Discord Trademark License.** Subject to Discord’s prior written approval in each case, Discord hereby grants to Developer a non-exclusive, royalty-free, license, during the Term, to publicly display the Discord Marks solely in marketing materials for the Apps. All such use of the Discord Marks must be in accordance with, Discord’s trademark and other brand guidelines made available to Developer. - -2.6 **Open Source Software.** Except as otherwise expressly agreed in writing, Developer shall not distribute via Discord Store, or combine any Discord materials with, open source or other software that is licensed under terms that purport to bind Discord to contractual obligations (e.g., the GNU General Public License or Lesser General Public License). - -2.7 **License Upon Termination.** In addition, upon termination of this Agreement, Developer hereby grants to Discord a non-exclusive, worldwide, perpetual, irrevocable, fully-paid-up license to use, reproduce, transmit and distribute the Apps and any error corrections in object code form via electronic delivery solely to Discord Store Account Owners that have licensed a Discord distributed version of the Apps prior to the date of any termination of this Agreement, and Developer will continue to give Discord Store Account Owners access to online features of the App on an equal, non-discriminatory basis with other users, for so long as Developer supports such online features. - -2.8 **Reservation of Rights.** Except as expressly provided herein, Developer retains all right, title and interest in and to the Apps and the Developer Marks, and Discord retains all right, title and interest in and to Discord Store, the Discord Software, and the Discord Marks. Each party reserves all rights not expressly granted in this Agreement. - -### 3\. App Submissions - -3.1 **Submission.** Developer shall submit each App (or Localized Version) to Discord for distribution via the Discord Store concurrently with the first commercial release of each App (or Localized Version), or, if already commercially released as of the Effective Date, within thirty (30) days of the Effective Date. Developer shall also submit to Discord any Localized Versions when generally available, but in no event later than they are provided to any other third party for commercial release. All submissions must be in object code form, and in the format reasonably requested by Discord. Developer will ensure that any password needed to access its Discord Store account is treated as Confidential Information, and agrees that it will be responsible for any use of that password, whether by Developer or any third party. - -3.2 **Testing.** Before submitting any software to Discord, Developer shall perform quality assurance and other error and bug testing of the Apps (including any Localized Versions and all App Updates), in a professional manner consistent with industry standards. Discord may also conduct hardware and software compatibility and performance testing on the Apps, either itself or via a third party. - -3.3 **Compatibility.** Developer shall make the Apps compatible with Discord Store services that Developer may choose to use. Developer shall use reasonable efforts to maintain compatibility of the Apps with future versions of Discord Store. - -3.4 **App-Related Content.** If Developer distributes an App and App-Related Content for that App via any channel other than Discord Store, Developer will deliver the App-Related Content to Discord simultaneously to enable Discord to make such App-Related Content available to Discord Store Account Owners. In addition, to the extent any App supports the sale of digital items or digital currency for use in the App, Developer shall not allow or facilitate the redemption or exchange of such digital items or digital currency for real-world currency. - -3.5 **No Links to Other Stores.** Developer will ensure that Apps distributed via Discord Store will not include functionality from or links or references to any store other than Discord Store, or any other payment or purchase facility. - -3.6 **User Reviews.** Discord may, in its discretion, make available a user review system for Apps. Developer shall not manipulate the user review system for Apps, including but not limited to soliciting positive reviews in exchange for value. - -3.7 **Ratings Information.** Discord will facilitate Developer’s inclusion of Ratings Information for Apps in the Discord Store. Developer agrees to provide via the Discord Store current and accurate Ratings Information for each App. - -3.8 **Privacy and App Sales Data.** Subject to Discord’s privacy policy, the current version of which is located at discord.com/privacy, (the “Discord Privacy Policy”) the Discord Store Subscriber Agreement, applicable laws and any other obligations Discord has to a third party or otherwise, Discord will provide Developer with Sales Data for the Apps. The Discord Privacy Policy is hereby incorporated into this Agreement. - -### 4\. Marketing and Publicity - -4.1 **Marketing.** Discord may, at its own expense and sole discretion, market and promote the Apps via Discord Store and other channels, including but not limited to the Discord and Discord Store web sites and shall include the right to distribute promotional copies of the App(s). - -4.2 **Press Releases and Press Accounts.** Discord and Developer may reference in public statements the fact that the Apps are or will be available on Discord Store; however, any press release about the other Party shall be subject to the prior approval of the other Party. Discord may make the Apps available to journalists via press subscription accounts free-of- charge in order to enable such journalists to evaluate and review the Apps. - -4.3 **Demo Versions.** If Developer releases a Demo Version outside of the Discord Store that includes a reference regarding the method(s) to purchase the App, Developer shall cooperate with Discord to include a reference to Discord Store in that version. - -### 5\. Support - -5.1 **Developer Support to Discord.** Developer shall with respect to each App: (a) correct within a reasonable period of time all material bugs, errors, or defects in the Apps (collectively, “Errors”) of which Discord informs Developer; (b) deliver all App Updates when made available to any other third party; (c) provide such other reasonable additional support as Discord may reasonably request. If, in Discord's sole judgment, an App contains Errors or is otherwise of insufficient quality to meet Discord’s standards, it may suspend the availability of such App in the Discord Store.  In the event Discord has suspended the availability of all Apps under this Agreement, it may terminate this Agreement for convenience. In addition, Developer must implement the Discord Store SDK in a manner that is safe and secure for the Discord Store Account Owner.  Discord may, but shall not be obligated to, correct any security vulnerabilities in Developer’s implementation of the Discord Store SDK and Developer shall provide assistance with such corrections as requested by Discord.  If Discord cannot reasonably correct any such vulnerabilities, or Discord determines that Developer should correct them, Developer shall correct such vulnerabilities. - -5.2 **Developer Support to End Users.** Developer will provide support to Discord Store Account Owners who have acquired a copy of the Apps, at the same level that Developer provides customer support for such applications made available directly or via other channels. Such support shall include but not be limited to responding to questions and assisting customers in the diagnosis and correction of issues encountered in using the Apps. - -5.3 **Discord End User Support.** Provided that Developer has complied with its support obligations in this Section 5, Discord will provide a reasonable level of support for issues related to Discord Store reported by Discord Store Account Owners. - -### 6\. Revenue, Reporting, and Payments - -6.1 **Licensee Fees or Other Fees.** Within thirty (30) days after the end of each calendar month, Discord will provide to Developer a report of Gross Revenue and Net Revenue for such month (each a “Monthly Report”). Each Monthly Report will contain activity for the current month as well as any Net Revenue adjustments for prior months reported by payment processors in the current month. Unless mutually agreed by Discord and Developer in a separate written agreement executed by both parties, Discord will pay to Developer ninety percent (90%) of the Net Revenue on the Monthly Report (the “License Fees”) within thirty (30) days after the Monthly Report is published, in no event later than sixty (60) days from the end of the of the calendar month covered by the Monthly Report. For completeness' sake, the remaining ten percent (10%) of the Net Revenue retained by Discord shall be payment of the consideration by Developer to Discord for the services and activities performed by Discord under this Agreement. Developer acknowledges and agrees that Discord, in the course of acting as agent or commissionaire of Developer, is hosting the Apps, and is allowing the download of those Apps by Discord Store Account Owners, on behalf of or respectively for the risk and account of Developer. All of the Apps and App-Related Content shall be marketed by Discord, on behalf of Developer, to Discord Store Account Owners at the prices established by Developer. Developer may change the price for any Apps or App-Related Content at any time, at Developer’s discretion, upon notice to Discord. As agent or commissionaire for Developer, Discord shall be solely responsible for the collection of all prices payable by Discord Store Account Owners for Apps acquired by those Discord Store Account Owners. - -6.2 **Taxes.** In the event that any remittance made by Discord to Developer is subject to any VAT, the full amount of such VAT shall be solely for the account of Developer, and will not reduce Discord's fee amount to which Discord is entitled on such transaction. To the extent required under applicable law, Discord will deduct the full amount of such VAT from the amount owed to Developer, and will pay the full amount withheld to the competent tax authorities. Discord will use commercially reasonably efforts to obtain, and to furnish to Developer, copies of official tax receipts or similar evidence of payment, confirming payment of such VAT to the competent tax authorities. Developer will indemnify and hold Discord harmless against any and all claims by any competent tax authorities for any underpayment of any VAT, and any penalties and/or interest thereon, including, but not limited to, underpayments attributable to any erroneous claim or representation by Developer as to its entitlement to, or any disqualification of Developer for, the benefit of a reduced rate of withholding tax.. - -6.3 **Minimum Monthly Payment and Negative Amounts.** In the event amounts due to Developer for a given month do not exceed one hundred U.S. dollars ($100), Discord may elect to not remit payment for that month, and may instead accumulate payments due until they exceed one hundred U.S. dollars ($100) as of the end of a future monthly payment cycle. Also, to the extent that the payment calculation in a Monthly Report results in a negative amount, that negative amount will be carried forward and deducted from any future amounts otherwise payable to Developer by Discord under this Agreement. - -6.4 **Multi-Platform Apps.** To the extent that Developer has submitted to Discord Store versions of an App for multiple operating systems (for example, a Mac version, and a Windows version) such versions shall be sold together as a single "hybrid" App unit on Discord Store. Accordingly, a Mac version of any App, a Windows version of an App, and a Linux version of an App shall not be considered separate sales when calculating the payments due to Developer hereunder. - -### 7\. Term - -7.1 **Term.** The term of this Agreement (“Term”) shall begin on the Effective Date and continue until the end of the latest App Term for any App unless earlier terminated in accordance with this Agreement. - -7.2 **App Term.** With respect to each App, the App Term shall commence on the GA Date for such App and continue for one (1) year (the “Initial App Term”); and shall automatically renew for successive one (1) year periods ("Renewal Term") until terminated by either party pursuant to Section 7.3 or Section 7.4 below. - -7.3 **Termination for Cause.** Either party may terminate this Agreement upon written notice at any time if the other party is in breach of this Agreement and has failed to cure that breach within thirty (30) days after written notice of that breach. In addition, either party may terminate this Agreement immediately upon written notice if the other party (a) becomes insolvent or makes an assignment for the benefit of creditors; (b) files a petition, or has a third party file a petition with respect to it, under any bankruptcy or similar statute; or (c) materially breaches this Agreement and such breach is not capable of cure. - -7.4 **Termination for Convenience.** Either party may terminate this Agreement for convenience (with or without cause), during any Renewal Term, by providing the other party with thirty (30) days prior written notice of such termination, provided that during such period the parties have reasonably discussed and agreed on a process for sunsetting the Apps (a “Sunset Process”). In the event that a Sunset Process has not been agreed upon within such 30-day period, or the Sunset Process requires that this Agreement remain fully in force for longer than such 30-day period, this Agreement will not terminate until the completion of the Sunset Process.. In addition, Discord may terminate this Agreement immediately at any time upon written notice to Developer in the event that Discord (a) determines in its discretion that any or all Apps are not suitable for distribution via the Discord Store or (b) ceases to operate the Discord Store or the self-service portion of the Discord Store. - -7.5 **Survival.** Sections 2.5, 2.6, 3.1 - 3.7, 5.2 (only with respect to supporting Discord Store Account Owners that have licensed an App prior to termination or expiration), 6 (only with respect to amounts that accrued prior to termination or expiration), 7.5, and 8 - 13, and any then-existing Discord Store Account Owner licenses to Apps, shall survive any termination or expiration of this Agreement. - -### 8\. Warranties and Disclaimer - -8.1 **Mutual Representations and Warranties.** Each party represents and warrants that (a) this Agreement has been duly and validly executed and delivered by such party; (b) it has all necessary power and authority to execute and perform its obligations under this Agreement; and (c) its execution and performance of this Agreement will not violate any applicable law or regulation or violate any rights of, or breach any obligation owed to, a third party. - -8.2 **Developer Representations and Warranties.** Developer represents and warrants that (a) it originally created the Apps (which, for purposes of this Section 8.2, include Demo Versions, Localized Versions and App Updates) and the Developer Marks, or otherwise has the rights necessary to grant the licenses and to fulfill its obligations under this Agreement; (b) the Apps will conform to any documentation for the Apps; (c) the Apps and the Developer Marks do not infringe any right of any third party, including but not limited to any intellectual property right or right of publicity or privacy; (d) the Apps do not violate any terms of the Discord Store Subscriber Agreement; (e) it is in compliance with and will comply with all applicable laws and regulations, and its privacy policy, in connection with this Agreement, including but not limited to its use of any end user data supplied by Discord to Developer under this Agreement; (f) it has all necessary rights to any content or information it submits to Discord through the Discord Store partner portal or using any Discord Store-provided partner or publishing tools; and (g) the Apps do not contain any software viruses, trojan horses, or any other harmful or malicious code. Developer further represents and warrants that neither it nor its agents are on any list maintained by the United States Treasury Department’s Office of Foreign Assets Control (“OFAC”) of persons, entities, or prohibited or restricted jurisdictions (“Restricted List”) and Developer shall promptly notify Discord in writing if it is no longer in compliance with, or is likely to become noncompliant with, the foregoing representation or warranty. In such event, or if Developer or any of its agents are on any OFAC Restricted List, Discord, in addition to any other remedies, shall have the right to terminate this Agreement immediately without providing Developer an opportunity to cure. - -8.3 **Disclaimer. EXCEPT AS OTHERWISE EXPRESSLY PROVIDED HEREIN, EACH PARTY DISCLAIMS ALL WARRANTIES, INCLUDING THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, TITLE, MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE, AND ALL MATERIAL PROVIDED BY SUCH PARTY HEREUNDER IS PROVIDED “AS IS” AND WITHOUT WARRANTY OR REPRESENTATION.** - -### 9\. Indemnification - -Developer will indemnify, defend (upon Discord’s written request), and hold harmless Discord and its Affiliates, successors, officers, directors and employees from any loss, liability, expense or damage (including attorneys’ fees) (“Liabilities”) arising out of any third party action, cause of action, claim or demand (each, a “Claim”) alleging a breach by Developer of its representations and warranties under Section 8 of this Agreement. Discord will promptly notify Developer of a Claim, provided that any delay in providing such notice shall relieve Developer of its obligations only to the extent that such delay materially prejudiced Developer. If Discord requests Developer to defend a Claim, Discord shall give Developer sole control of the defense of the Claim, provided that Developer shall not settle or otherwise dispose of any Claim in any manner that imposes fault or other liability on Discord. Discord may, at its own expense, participate in any such defense with its own counsel. - -### 10\. Limitation of Liability - -EXCEPT FOR BREACH OF SECTION 12 (CONFIDENTIALITY), IN NO EVENT SHALL DISCORD BE LIABLE FOR (A) ANY SPECIAL, INCIDENTAL, INDIRECT, PUNITIVE OR CONSEQUENTIAL DAMAGES OR (B) ANY DAMAGES IN EXCESS OF (IN THE AGGREGATE) THE AMOUNTS PAID OR PAYABLE UNDER THIS AGREEMENT ARISING OUT OF OR IN CONNECTION WITH THIS AGREEMENT OR ANY PROVISION HEREIN, REGARDLESS OF THE LEGAL THEORY UPON WHICH ANY CLAIM FOR SUCH DAMAGES IS BASED. THE FOREGOING EXCLUSIONS AND LIMITATIONS SHALL APPLY TO THE EXTENT PERMITTED BY APPLICABLE LAW. - -### 11\. Governing Law, Jurisdiction, and Venue - -This Agreement will be governed by and construed in accordance with the laws of the State of California, without reference to conflicts of laws principles. Any claim or dispute between the parties that arises in whole or in part from this Agreement or Developer’s use of the Discord Store shall be decided exclusively by a court of competent jurisdiction located in Santa Clara County, California. Developer hereby consents to, and waives all defenses with respect to, venue and jurisdiction in the state and federal courts of Santa Clara County, California. - -### 12\. Confidentiality - -12.1 "**Confidential Information**" means all non-public information that is identified as being confidential or which should reasonably be understood to be confidential, which includes without limitation, information relating to released or unreleased products, marketing or promotion of any product, financial information, business policies or practices, personnel, pricing and sales information, technology, computer programs, unpublished works of original authorship, trade secrets, or information received from third parties that the disclosing party is obligated to treat as confidential. Without limiting the foregoing, the terms of this Agreement and Sales Data shall be Discord’s Confidential Information. Confidential Information shall not include information that: (i) is or becomes generally known or available by publication, commercial use or otherwise through no fault of the receiving party; (ii) is known by the receiving party without restriction at the time of disclosure; (iii) is independently developed by the receiving party without the use of any Confidential Information received from the disclosing party; or (iv) is lawfully obtained without restriction from a third party that has the right to make such disclosure. - -12.2 The receiving party shall use Confidential Information it receives solely in connection with its performance under this Agreement, and shall disclose such Confidential Information only to employees and contractors who have a need to know such Confidential Information for purposes of this Agreement and are bound by written confidentiality obligations at least as restrictive as those herein. The receiving party shall protect Confidential Information from unauthorized disclosure and use with the same degree of care that it uses to protect its own Confidential Information, but in no event less than reasonable care. - -12.3 Notwithstanding the foregoing, the receiving party may disclose Confidential Information as necessary to comply with any court order or applicable law or regulation, provided that such party to the extent reasonably possible gives prior written notice to the other party of the possibility of such disclosure and to resist or limit disclosure, including without limitation reasonably cooperating with the other party in seeking a protective order or other similar relief. - -12.4 After termination of this Agreement or receiving earlier written request from the other party, the receiving party shall promptly return or delete the Confidential Information received from the disclosing party. - -### 13\. General Provisions - -13.1 **Independent Contractor.** The parties to this Agreement are independent contractors. This Agreement does not create any joint venture, partnership, or other business entity. - -13.2 **Notices.** Any notices required by this Agreement must be sent in writing via overnight delivery by a nationally recognized courier service (e.g., FedEx) or first-class mail, signature required and shall be deemed effective upon signature acknowledging receipt by the party receiving notice. All such notices must be addressed to the receiving party at the address stated at the top of this Agreement with attention to the individual executing this Agreement on behalf of such party. - -13.3 **Assignment.** Neither party may assign or otherwise transfer this Agreement or its rights hereunder without the other party’s prior written consent, except that such consent shall not be required for (a) a party to transfer this Agreement to an Affiliate or in connection with a merger, acquisition, or other corporate combination, or the sale of all or substantially all of such party’s assets, provided that the successor party is not a competitor of the non-transferring party and the transferring party provides prompt notice of such transfer; or (b) Discord to assign, or sublicense some or all of, its rights under this Agreement to any of its Affiliates or to a subcontractor. Such transfer or assignment shall not relieve the transferring or assigning party of its obligations hereunder. Any attempted transfer or assignment by either party in violation of this Section shall be void and of no effect and will constitute a breach by the party attempting such transfer or assignment. This Agreement will be binding upon any permitted successor. - -13.4 **Headings.** The section headings used herein are for convenience only and shall not be given any legal import. - -13.5 **Severability.** If any provision of this Agreement is found by a court of competent jurisdiction to be invalid, the parties nevertheless agree that the court should endeavor to give effect to the parties' intentions as reflected in the provision, and the other provisions of this Agreement shall remain in full force and effect. - -13.6 **No Waiver.** The failure of a party to exercise or enforce any right or provision of this Agreement shall not constitute a waiver of such right or provision, and no waiver by either party of any breach or default hereunder shall be deemed to be a waiver of any preceding or subsequent breach or default. - -13.7 **Modifications.** This Agreement may not be modified except by a written agreement dated signed on behalf of Discord and Developer by their respective duly authorized representatives. - -13.8 **Complete Agreement.** This Agreement constitutes the entire agreement between the parties with respect to the subject matter hereof and supersedes all prior and contemporaneous communications and agreements between the parties with respect to such subject matter. Neither party has relied in entering into this Agreement on any statement, inducement or representation that is not set forth in this Agreement. Each party agrees that electronic signatures may be used to authenticate this writing and, if so used, will have the same force and effect as manual signatures. diff --git a/docs/quick-start/overview-of-apps.mdx b/docs/quick-start/overview-of-apps.mdx deleted file mode 100644 index 068c0c0481..0000000000 --- a/docs/quick-start/overview-of-apps.mdx +++ /dev/null @@ -1,103 +0,0 @@ ---- -sidebar_label: Overview of Apps ---- - -# Overview of Discord Apps - -![Overview of Apps](images/overview-of-apps-banner.webp) - -Discord apps customize, extend, and enhance Discord for millions of users. Whether you're a developer interested in building an Activity, customizing servers, or integrating a game, apps are the container to bring your idea to life. - -On this page we'll answer the questions: - -- [What can apps do?](/docs/quick-start/overview-of-apps#what-can-apps-do) -- [Where are apps installed?](/docs/quick-start/overview-of-apps#where-are-apps-installed) -- [What APIs can apps use?](/docs/quick-start/overview-of-apps#what-apis-can-apps-use) - ---- - -## What can apps do? - -You will discover the full possibility of apps as you explore the documentation and start building, but for now let's take a glance at some features you can build and integrate as you're developing your app. - -### Send and manage messages - -Messages are a core part of Discord, and that's true for apps too. Apps can send messages in a few ways—they can call the **[Create Message endpoint](/docs/resources/message#create-message)**, create and execute [webhooks](/docs/resources/webhook), or respond with a message when responding to an [interaction](/docs/interactions/overview). Apps can also manage messages if they have the proper permissions, which is covered more in the [Message documentation](/docs/resources/message). - -### Interact with users - -Apps can use **[interactions](/docs/interactions/overview)** to create more engaging and intuitive experiences for users. When sending messages, apps can send interactive components like [buttons](/docs/components/reference#button) and [select menus](/docs/components/reference#string-select) in the `components` field. Apps can also open form-like modals or launch an Activity [in response to interactions](/docs/interactions/receiving-and-responding#interaction-response-object-modal). - -### Build embedded games and experiences - -Using the [Embedded App SDK](/docs/developer-tools/embedded-app-sdk), apps can create **[Activities](/docs/activities/overview)** which are cross-platform interactive games and social experiences in Discord. They run in iframes in Discord, where people who play games are already hanging out. - -### Customize servers - -With the right API endpoints and proper [permissions](/docs/topics/permissions), apps can customize the experience of using and moderating servers by accessing and customizing all sorts of resources core to Discord—including [users](/docs/resources/user), [channels](/docs/resources/channel), and [AutoMod](/docs/resources/auto-moderation) to name a few. Explore the **Resources** documentation category to learn about the different Discord resources and how apps can use them. - -### Update user metadata and presence - -Apps can update a Discord's user metadata with data from a party game or app in a few ways. Apps can also update a user's profile with actionable data from a game or app by integrating **[Rich Presence](/docs/rich-presence/overview)**. Apps can also use **[role connection metadata](/docs/resources/application-role-connection-metadata)** to associate third-party metadata (like stats or account type) with Discord users, which server admins can use to set up roles based on. You can explore more in the [configuring metadata for linked roles](/docs/tutorials/configuring-app-metadata-for-linked-roles) tutorial. - -### Add premium features - -**[App subscriptions](/docs/monetization/implementing-app-subscriptions)** let apps charge users and/or servers for premium functionality on a recurring basis natively within Discord. You can read more about eligibility and adding monetization features to your app in the [Monetization](/docs/monetization/overview) documentation. - -### ...and more - -This developer documentation is full of nooks and crannies with all sorts of features to explore. Discover the possibilities by exploring more of the docs, or by [building your own app](https://discord.com/developers/applications). - ---- - -## Where are apps installed? - -Discord apps can be installed in two different contexts: - -1. Apps installed **to a server** (called a [guild](/docs/resources/guild) throughout the API) by a user with the Manage Server ([`MANAGE_GUILD`](/docs/topics/permissions#permissions-bitwise-permission-flags)) permission. Apps installed to a server can only be used within that server and DMs with the app's bot user, and are visible to all server members. -2. Apps installed **to a user account**. Apps installed to a user are visible *only* to that user, across all of their servers, DMs, and Group DMs by default. - -The installation contexts that an app supports can be limited by the developer when [setting up the app](/docs/resources/application#setting-supported-installation-contexts). Details about installation contexts are in the [Application resource documentation](/docs/resources/application#installation-context). - ---- - -## What APIs can apps use? - -There are a handful of different APIs that you can pick and choose from based on your app's functionality and which Discord features you want to access. Below is a quick overview of the main APIs on the Discord developer platform, but you can read more details and information about API usage in the [API reference](/docs/reference). - -### HTTP API - -The **HTTP API** is a REST API that lets you interact and modify core Discord resources like [channels](/docs/resources/channel), [servers (or guilds)](/docs/resources/guild), [users](/docs/resources/user), and [messages](/docs/resources/message#message-object). - -Use the HTTP API to: -- Retrieve information about a resource -- Create, update, or delete a resource - -Read details about using the HTTP API in the [API reference](/docs/reference#http-api). - -### Gateway API - -The **Gateway API** lets you receive event data over a WebSocket anytime an [event](/docs/events/gateway-events) occurs in a server where your app is installed. - -Use the Gateway API to: -- Receive events happening in Discord - -Read details about using the Gateway API in the [API reference](/docs/reference#gateway-websocket-api). - ---- - -## Start Building - -Well, would you look at the time? With the basics out of the way, it's time to start building your Discord app! You can explore the rest of the documentation, go to your [Apps](https://discord.com/developers/applications), or explore the beginner resources below. - - - - Tutorial to develop your first Discord app with interactive components - - - Tutorial to develop an Activity using the Embedded App SDK - - - Explore community-built library and tools to speed up and simplify development - - diff --git a/docs/resources/auto-moderation.mdx b/docs/resources/auto-moderation.mdx deleted file mode 100644 index 40141afdb2..0000000000 --- a/docs/resources/auto-moderation.mdx +++ /dev/null @@ -1,294 +0,0 @@ -# Auto Moderation - -Auto Moderation is a feature which allows each [guild](/docs/resources/guild) to set up rules that trigger based on some criteria. For example, a rule can trigger whenever a message contains a specific keyword. - -Rules can be configured to automatically execute actions whenever they trigger. For example, if a user tries to send a message which contains a certain keyword, a rule can trigger and block the message before it is sent. - -### Auto Moderation Rule Object - -###### Auto Moderation Rule Structure - -| Field | Type | Description | -|------------------|------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------| -| id | snowflake | the id of this rule | -| guild_id | snowflake | the id of the guild which this rule belongs to | -| name | string | the rule name | -| creator_id | snowflake | the user which first created this rule | -| event_type | integer | the rule [event type](/docs/resources/auto-moderation#auto-moderation-rule-object-event-types) | -| trigger_type | integer | the rule [trigger type](/docs/resources/auto-moderation#auto-moderation-rule-object-trigger-types) | -| trigger_metadata | object | the rule [trigger metadata](/docs/resources/auto-moderation#auto-moderation-rule-object-trigger-metadata) | -| actions | array of [action](/docs/resources/auto-moderation#auto-moderation-action-object) objects | the actions which will execute when the rule is triggered | -| enabled | boolean | whether the rule is enabled | -| exempt_roles | array of snowflakes | the role ids that should not be affected by the rule (Maximum of 20) | -| exempt_channels | array of snowflakes | the channel ids that should not be affected by the rule (Maximum of 50) | - -###### Example Auto Moderation Rule - -```json -{ - "id": "969707018069872670", - "guild_id": "613425648685547541", - "name": "Keyword Filter 1", - "creator_id": "423457898095789043", - "trigger_type": 1, - "event_type": 1, - "actions": [ - { - "type": 1, - "metadata": { "custom_message": "Please keep financial discussions limited to the #finance channel" } - }, - { - "type": 2, - "metadata": { "channel_id": "123456789123456789" } - }, - { - "type": 3, - "metadata": { "duration_seconds": 60 } - } - ], - "trigger_metadata": { - "keyword_filter": ["cat*", "*dog", "*ana*", "i like c++"], - "regex_patterns": ["(b|c)at", "^(?:[0-9]{1,3}\\.){3}[0-9]{1,3}$"] - }, - "enabled": true, - "exempt_roles": ["323456789123456789", "423456789123456789"], - "exempt_channels": ["523456789123456789"] -} -``` - -###### Trigger Types -Characterizes the type of content which can trigger the rule. - -| Trigger Type | Value | Description | Max per Guild | -|----------------|-------|-----------------------------------------------------------------------------|---------------| -| KEYWORD | 1 | check if content contains words from a user defined list of keywords | 6 | -| SPAM | 3 | check if content represents generic spam | 1 | -| KEYWORD_PRESET | 4 | check if content contains words from internal pre-defined wordsets | 1 | -| MENTION_SPAM | 5 | check if content contains more unique mentions than allowed | 1 | -| MEMBER_PROFILE | 6 | check if member profile contains words from a user defined list of keywords | 1 | - -###### Trigger Metadata - -Additional data used to determine whether a rule should be triggered. Different fields are relevant based on the -value of [trigger_type](/docs/resources/auto-moderation#auto-moderation-rule-object-trigger-types). - -| Field | Type | Associated Trigger Types | Description | -|---------------------------------|-------------------------------------------------------------------------------------------------------------------|-----------------------------------------|-----------------------------------------------------------------------------------| -| keyword_filter | array of strings * | KEYWORD, MEMBER_PROFILE | substrings which will be searched for in content (Maximum of 1000) | -| regex_patterns | array of strings ** | KEYWORD, MEMBER_PROFILE | regular expression patterns which will be matched against content (Maximum of 10) | -| presets | array of [keyword preset types](/docs/resources/auto-moderation#auto-moderation-rule-object-keyword-preset-types) | KEYWORD_PRESET | the internally pre-defined wordsets which will be searched for in content | -| allow_list | array of strings *** | KEYWORD, KEYWORD_PRESET, MEMBER_PROFILE | substrings which should not trigger the rule (Maximum of 100 or 1000) | -| mention_total_limit | integer | MENTION_SPAM | total number of unique role and user mentions allowed per message (Maximum of 50) | -| mention_raid_protection_enabled | boolean | MENTION_SPAM | whether to automatically detect mention raids | - -\* A keyword can be a phrase which contains multiple words. [Wildcard symbols](/docs/resources/auto-moderation#auto-moderation-rule-object-keyword-matching-strategies) can be used to customize how each keyword will be matched. Each keyword must be 60 characters or less. - -\** Only Rust flavored regex is currently supported, which can be tested in online editors such as [Rustexp](https://rustexp.lpil.uk/). Each regex pattern must be 260 characters or less. - -\*** Each `allow_list` keyword can be a phrase which contains multiple words. [Wildcard symbols](/docs/resources/auto-moderation#auto-moderation-rule-object-keyword-matching-strategies) can be used to customize how each keyword will be matched. Rules with `KEYWORD` [trigger_type](/docs/resources/auto-moderation#auto-moderation-rule-object-trigger-types) accept a maximum of 100 keywords. Rules with `KEYWORD_PRESET` [trigger_type](/docs/resources/auto-moderation#auto-moderation-rule-object-trigger-types) accept a maximum of 1000 keywords. - -###### Trigger Metadata Field Limits - -| Field | Trigger Types | MAX ARRAY LENGTH | MAX CHARACTERS PER STRING | -|----------------|-------------------------|------------------|---------------------------| -| keyword_filter | KEYWORD, MEMBER_PROFILE | 1000 | 60 | -| regex_patterns | KEYWORD, MEMBER_PROFILE | 10 | 260 | -| allow_list | KEYWORD, MEMBER_PROFILE | 100 | 60 | -| allow_list | KEYWORD_PRESET | 1000 | 60 | - - -###### Keyword Preset Types - -| Preset Type | Value | Description | -|----------------|-------|--------------------------------------------------------------| -| PROFANITY | 1 | words that may be considered forms of swearing or cursing | -| SEXUAL_CONTENT | 2 | words that refer to sexually explicit behavior or activity | -| SLURS | 3 | personal insults or words that may be considered hate speech | - - -###### Event Types - -Indicates in what event context a rule should be checked. - -| Event Type | Value | Description | -|---------------|-------|-----------------------------------------------------| -| MESSAGE_SEND | 1 | when a member sends or edits a message in the guild | -| MEMBER_UPDATE | 2 | when a member edits their profile | - - -###### Keyword Matching Strategies - -Use the wildcard symbol (`*`) at the beginning or end of a keyword to define how it should be matched. All keywords are case insensitive. - -**Prefix** - word must start with the keyword - -| Keyword | Matches | -|-----------|---------------------------------------| -| cat\* | **cat**ch, **Cat**apult, **CAt**tLE | -| tra\* | **tra**in, **tra**de, **TRA**ditional | -| the mat\* | **the mat**rix | - - -**Suffix** - word must end with the keyword - -| Keyword | Matches | -|-----------|-------------------------------------| -| \*cat | wild**cat**, copy**Cat** | -| \*tra | ex**tra**, ul**tra**, orches**TRA** | -| \*the mat | brea**the mat** | - - -**Anywhere** - keyword can appear anywhere in the content - -| Keyword | Matches | -|-------------|-----------------------------| -| \*cat\* | lo**cat**ion, edu**Cat**ion | -| \*tra\* | abs**tra**cted, ou**tra**ge | -| \*the mat\* | brea**the mat**ter | - - -**Whole Word** - keyword is a full word or phrase and must be surrounded by whitespace - -| Keyword | Matches | -|---------|-------------| -| cat | **cat** | -| train | **train** | -| the mat | **the mat** | - - -### Auto Moderation Action Object - -An action which will execute whenever a rule is triggered. - -###### Auto Moderation Action Structure - -| Field | Type | Description | -|-------------|--------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------| -| type | [action type](/docs/resources/auto-moderation#auto-moderation-action-object-action-types) | the type of action | -| metadata? * | [action metadata](/docs/resources/auto-moderation#auto-moderation-action-object-action-metadata) | additional metadata needed during execution for this specific action type | - -\* Can be omitted based on `type`. See the `Associated Action Types` column in [action metadata](/docs/resources/auto-moderation#auto-moderation-action-object-action-metadata) to understand which `type` values require `metadata` to be set. - -###### Action Types - -| Action Type | Value | Description | -|--------------------------|-------|------------------------------------------------------------------------------------------------------------------------------------------------------------| -| BLOCK_MESSAGE | 1 | blocks a member's message and prevents it from being posted. A custom explanation can be specified and shown to members whenever their message is blocked. | -| SEND_ALERT_MESSAGE | 2 | logs user content to a specified channel | -| TIMEOUT | 3 | timeout user for a specified duration * | -| BLOCK_MEMBER_INTERACTION | 4 | prevents a member from using text, voice, or other interactions | - -\* A `TIMEOUT` action can only be set up for `KEYWORD` and `MENTION_SPAM` rules. The `MODERATE_MEMBERS` permission is required to use the `TIMEOUT` action type. - - -###### Action Metadata - -Additional data used when an action is executed. Different fields are relevant based on the -value of [action type](/docs/resources/auto-moderation#auto-moderation-action-object-action-types). - -| Field | Type | Associated Action Types | Description | Constraints | -|------------------|-----------|-------------------------|----------------------------------------------------------------------------------------|--------------------------------------| -| channel_id | snowflake | SEND_ALERT_MESSAGE | channel to which user content should be logged | existing channel | -| duration_seconds | integer | TIMEOUT | timeout duration in seconds | maximum of 2419200 seconds (4 weeks) | -| custom_message? | string | BLOCK_MESSAGE | additional explanation that will be shown to members whenever their message is blocked | maximum of 150 characters | - - -### Auto Moderation Permission Requirements - -Users are required to have the `MANAGE_GUILD` permission to access all Auto Moderation resources. -Some [action types](/docs/resources/auto-moderation#auto-moderation-action-object-action-types) require additional permissions, e.g. the `TIMEOUT` action type requires an additional `MODERATE_MEMBERS` permission. - -## List Auto Moderation Rules for Guild -/guilds/[\{guild.id\}](/docs/resources/guild#guild-object)/auto-moderation/rules - -Get a list of all rules currently configured for the guild. Returns a list of [auto moderation rule](/docs/resources/auto-moderation#auto-moderation-rule-object) objects for the given guild. - -:::info -This endpoint requires the `MANAGE_GUILD` [permission](/docs/resources/auto-moderation#auto-moderation-permission-requirements). -::: - -## Get Auto Moderation Rule -/guilds/[\{guild.id\}](/docs/resources/guild#guild-object)/auto-moderation/rules/[\{auto_moderation_rule.id\}](/docs/resources/auto-moderation#auto-moderation-rule-object) - -Get a single rule. Returns an [auto moderation rule](/docs/resources/auto-moderation#auto-moderation-rule-object) object. - -:::info -This endpoint requires the `MANAGE_GUILD` [permission](/docs/resources/auto-moderation#auto-moderation-permission-requirements). -::: - -## Create Auto Moderation Rule -/guilds/[\{guild.id\}](/docs/resources/guild#guild-object)/auto-moderation/rules - -Create a new rule. Returns an [auto moderation rule](/docs/resources/auto-moderation#auto-moderation-rule-object) on success. Fires an [Auto Moderation Rule Create](/docs/events/gateway-events#auto-moderation-rule-create) Gateway event. - -:::info -This endpoint requires the `MANAGE_GUILD` [permission](/docs/resources/auto-moderation#auto-moderation-permission-requirements). -::: - -:::info -This endpoint supports the `X-Audit-Log-Reason` header. -::: - -###### JSON Params - -| Field | Type | Description | -|---------------------|------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------| -| name | string | the rule name | -| event_type | integer | the [event type](/docs/resources/auto-moderation#auto-moderation-rule-object-event-types) | -| trigger_type | integer | the [trigger type](/docs/resources/auto-moderation#auto-moderation-rule-object-trigger-types) | -| trigger_metadata? * | object | the [trigger metadata](/docs/resources/auto-moderation#auto-moderation-rule-object-trigger-metadata) | -| actions | array of [action](/docs/resources/auto-moderation#auto-moderation-action-object) objects | the actions which will execute when the rule is triggered | -| enabled? | boolean | whether the rule is enabled (False by default) | -| exempt_roles? | array of snowflakes | the role ids that should not be affected by the rule (Maximum of 20) | -| exempt_channels? | array of snowflakes | the channel ids that should not be affected by the rule (Maximum of 50) | - -\* Can be omitted based on `trigger_type`. See the `Associated Trigger Types` column in [trigger metadata](/docs/resources/auto-moderation#auto-moderation-rule-object-trigger-metadata) to understand which `trigger_type` values require `trigger_metadata` to be set. - -:::info -See [Trigger Types](/docs/resources/auto-moderation#auto-moderation-rule-object-trigger-types) for limits on how many rules of each trigger type can be created per guild. -::: - - -## Modify Auto Moderation Rule -/guilds/[\{guild.id\}](/docs/resources/guild#guild-object)/auto-moderation/rules/[\{auto_moderation_rule.id\}](/docs/resources/auto-moderation#auto-moderation-rule-object) - -Modify an existing rule. Returns an [auto moderation rule](/docs/resources/auto-moderation#auto-moderation-rule-object) on success. Fires an [Auto Moderation Rule Update](/docs/events/gateway-events#auto-moderation-rule-update) Gateway event. - -:::info -Requires `MANAGE_GUILD` [permissions](/docs/resources/auto-moderation#auto-moderation-permission-requirements). -::: - -:::info -All parameters for this endpoint are optional. -::: - -:::info -This endpoint supports the `X-Audit-Log-Reason` header. -::: - -###### JSON Params - -| Field | Type | Description | -|---------------------|------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------| -| name | string | the rule name | -| event_type | integer | the [event type](/docs/resources/auto-moderation#auto-moderation-rule-object-event-types) | -| trigger_metadata? * | object | the [trigger metadata](/docs/resources/auto-moderation#auto-moderation-rule-object-trigger-metadata) | -| actions | array of [action](/docs/resources/auto-moderation#auto-moderation-action-object) objects | the actions which will execute when the rule is triggered | -| enabled | boolean | whether the rule is enabled | -| exempt_roles | array of snowflakes | the role ids that should not be affected by the rule (Maximum of 20) | -| exempt_channels | array of snowflakes | the channel ids that should not be affected by the rule (Maximum of 50) | - -\* Can be omitted based on `trigger_type`. See the `Associated Trigger Types` column in [trigger metadata](/docs/resources/auto-moderation#auto-moderation-rule-object-trigger-metadata) to understand which `trigger_type` values require `trigger_metadata` to be set. - -## Delete Auto Moderation Rule -/guilds/[\{guild.id\}](/docs/resources/guild#guild-object)/auto-moderation/rules/[\{auto_moderation_rule.id\}](/docs/resources/auto-moderation#auto-moderation-rule-object) - -Delete a rule. Returns a `204` on success. Fires an [Auto Moderation Rule Delete](/docs/events/gateway-events#auto-moderation-rule-delete) Gateway event. - -:::info -This endpoint requires the `MANAGE_GUILD` [permission](/docs/resources/auto-moderation#auto-moderation-permission-requirements). -::: - -:::info -This endpoint supports the `X-Audit-Log-Reason` header. -::: diff --git a/docs/resources/emoji.mdx b/docs/resources/emoji.mdx deleted file mode 100644 index f69fe6ce62..0000000000 --- a/docs/resources/emoji.mdx +++ /dev/null @@ -1,230 +0,0 @@ ---- -sidebar_label: Emoji ---- - -# Emoji Resource - -:::warn -Routes for controlling emojis do not follow the normal rate limit conventions. These routes are specifically limited on a per-guild basis to prevent abuse. This means that the quota returned by our APIs may be inaccurate, and you may encounter 429s. -::: - -### Emoji Object - -###### Emoji Structure - -| Field | Type | Description | -|-----------------|------------------------------------------------------------------|---------------------------------------------------------------------------| -| id | ?snowflake | [emoji id](/docs/reference#image-formatting) | -| name | ?string (can be null only in reaction emoji objects) | emoji name | -| roles? | array of [role](/docs/topics/permissions#role-object) object ids | roles allowed to use this emoji | -| user? | [user](/docs/resources/user#user-object) object | user that created this emoji | -| require_colons? | boolean | whether this emoji must be wrapped in colons | -| managed? | boolean | whether this emoji is managed | -| animated? | boolean | whether this emoji is animated | -| available? | boolean | whether this emoji can be used, may be false due to loss of Server Boosts | - -###### Premium Emoji - -Roles with the `integration_id` tag being the guild's guild_subscription integration are considered subscription roles. -An emoji cannot have both subscription roles and non-subscription roles. -Emojis with subscription roles are considered premium emoji, and count toward a separate limit of 25. -Emojis cannot be converted between normal and premium after creation. - -###### Emoji Formats - -Emoji can be uploaded as JPEG, PNG, GIF, WebP, and AVIF formats. All emoji (regardless of original format) can be served as WebP. We highly recommend that developers use the `.webp` extension when fetching emoji so they're rendered as WebP for maximum performance and compatibility. The Discord client uses WebP for all emoji displayed in-app. - -Still WebP emoji can be requested using the `.webp` file extension. For animated WebP emoji, use the `.webp` extension with the `?animated=true` query parameter. - -###### Application-Owned Emoji - -An application can own up to 2000 emojis that can only be used by that app. -App emojis can be managed using the API with a bot token, or using the app's settings in the portal. -The `USE_EXTERNAL_EMOJIS` permission is not required to use app emojis. -The `user` field of an app emoji object represents the team member that uploaded the emoji from the app's settings, or the bot user if uploaded using the API. - -###### Emoji Example - -```json -{ - "id": "41771983429993937", - "name": "LUL", - "roles": ["41771983429993000", "41771983429993111"], - "user": { - "username": "Luigi", - "discriminator": "0002", - "id": "96008815106887111", - "avatar": "5500909a3274e1812beb4e8de6631111", - "public_flags": 131328 - }, - "require_colons": true, - "managed": false, - "animated": false -} -``` - -###### Standard Emoji Example - -```json -{ - "id": null, - "name": "🔥" -} -``` - -###### Custom Emoji Examples - -:::info -In `MESSAGE_REACTION_ADD`, `MESSAGE_REACTION_REMOVE` and `MESSAGE_REACTION_REMOVE_EMOJI` gateway events `animated` will be returned for animated emoji. -::: - -:::info -In `MESSAGE_REACTION_ADD` and `MESSAGE_REACTION_REMOVE` gateway events `name` may be `null` when custom emoji data is not available (for example, if it was deleted from the guild). -::: - -```json -{ - "id": "41771983429993937", - "name": "LUL", - "animated": true -} -``` - -```json -{ - "id": "41771983429993937", - "name": null -} -``` - -## List Guild Emojis -/guilds/[\{guild.id\}](/docs/resources/guild#guild-object)/emojis - -Returns a list of [emoji](/docs/resources/emoji#emoji-object) objects for the given guild. Includes `user` fields if the bot has the `CREATE_GUILD_EXPRESSIONS` or `MANAGE_GUILD_EXPRESSIONS` permission. - -## Get Guild Emoji -/guilds/[\{guild.id\}](/docs/resources/guild#guild-object)/emojis/[\{emoji.id\}](/docs/resources/emoji#emoji-object) - -Returns an [emoji](/docs/resources/emoji#emoji-object) object for the given guild and emoji IDs. Includes the `user` field if the bot has the `MANAGE_GUILD_EXPRESSIONS` permission, or if the bot created the emoji and has the the `CREATE_GUILD_EXPRESSIONS` permission. - -## Create Guild Emoji -/guilds/[\{guild.id\}](/docs/resources/guild#guild-object)/emojis - -Create a new emoji for the guild. Requires the `CREATE_GUILD_EXPRESSIONS` permission. Returns the new [emoji](/docs/resources/emoji#emoji-object) object on success. Fires a [Guild Emojis Update](/docs/events/gateway-events#guild-emojis-update) Gateway event. - -:::warn -Emojis and animated emojis have a maximum file size of 256 KiB. Attempting to upload an emoji larger than this limit will fail and return 400 Bad Request and an error message, but not a [JSON status code](/docs/topics/opcodes-and-status-codes#json). -::: - -:::info -We highly recommend that developers use the `.webp` extension when fetching emoji so they're rendered as WebP for maximum performance and compatibility. See the [Emoji Formats](/docs/resources/emoji#emoji-object-emoji-formats) section above for more details. -::: - -:::info -This endpoint supports the `X-Audit-Log-Reason` header. -::: - -###### JSON Params - -| Field | Type | Description | -|-------|------------------------------------------|---------------------------------| -| name | string | name of the emoji | -| image | [image data](/docs/reference#image-data) | the 128x128 emoji image | -| roles | array of snowflakes | roles allowed to use this emoji | - -## Modify Guild Emoji -/guilds/[\{guild.id\}](/docs/resources/guild#guild-object)/emojis/[\{emoji.id\}](/docs/resources/emoji#emoji-object) - -Modify the given emoji. For emojis created by the current user, requires either the `CREATE_GUILD_EXPRESSIONS` or `MANAGE_GUILD_EXPRESSIONS` permission. For other emojis, requires the `MANAGE_GUILD_EXPRESSIONS` permission. Returns the updated [emoji](/docs/resources/emoji#emoji-object) object on success. Fires a [Guild Emojis Update](/docs/events/gateway-events#guild-emojis-update) Gateway event. - -:::info -All parameters to this endpoint are optional. -::: - -:::info -This endpoint supports the `X-Audit-Log-Reason` header. -::: - -###### JSON Params - -| Field | Type | Description | -|-------|----------------------|---------------------------------| -| name | string | name of the emoji | -| roles | ?array of snowflakes | roles allowed to use this emoji | - -## Delete Guild Emoji -/guilds/[\{guild.id\}](/docs/resources/guild#guild-object)/emojis/[\{emoji.id\}](/docs/resources/emoji#emoji-object) - -Delete the given emoji. For emojis created by the current user, requires either the `CREATE_GUILD_EXPRESSIONS` or `MANAGE_GUILD_EXPRESSIONS` permission. For other emojis, requires the `MANAGE_GUILD_EXPRESSIONS` permission. Returns `204 No Content` on success. Fires a [Guild Emojis Update](/docs/events/gateway-events#guild-emojis-update) Gateway event. - -:::info -This endpoint supports the `X-Audit-Log-Reason` header. -::: - -## List Application Emojis -/applications/[\{application.id\}](/docs/resources/application#application-object)/emojis - -Returns an object containing a list of [emoji](/docs/resources/emoji#emoji-object) objects for the given application under the `items` key. Includes a `user` object for the team member that uploaded the emoji from the app's settings, or for the bot user if uploaded using the API. - -```json -{ - "items": [ - { - "id": "41771983429993937", - "name": "LUL", - "roles": [], - "user": { - "username": "Luigi", - "discriminator": "0002", - "id": "96008815106887111", - "avatar": "5500909a3274e1812beb4e8de6631111", - "public_flags": 131328 - }, - "require_colons": true, - "managed": false, - "animated": false - } - ] -} -``` - -## Get Application Emoji -/applications/[\{application.id\}](/docs/resources/application#application-object)/emojis/[\{emoji.id\}](/docs/resources/emoji#emoji-object) - -Returns an [emoji](/docs/resources/emoji#emoji-object) object for the given application and emoji IDs. Includes the `user` field. - -## Create Application Emoji -/applications/[\{application.id\}](/docs/resources/application#application-object)/emojis - -Create a new emoji for the application. Returns the new [emoji](/docs/resources/emoji#emoji-object) object on success. - -:::warn -Emojis and animated emojis have a maximum file size of 256 KiB. Attempting to upload an emoji larger than this limit will fail and return 400 Bad Request and an error message, but not a [JSON status code](/docs/topics/opcodes-and-status-codes#json). -::: - -:::info -We highly recommend that developers use the `.webp` extension when fetching emoji so they're rendered as WebP for maximum performance and compatibility. See the [Emoji Formats](/docs/resources/emoji#emoji-object-emoji-formats) section above for more details. -::: - -###### JSON Params - -| Field | Type | Description | -|-------|------------------------------------------|-------------------------| -| name | string | name of the emoji | -| image | [image data](/docs/reference#image-data) | the 128x128 emoji image | - -## Modify Application Emoji -/applications/[\{application.id\}](/docs/resources/application#application-object)/emojis/[\{emoji.id\}](/docs/resources/emoji#emoji-object) - -Modify the given emoji. Returns the updated [emoji](/docs/resources/emoji#emoji-object) object on success. - -###### JSON Params - -| Field | Type | Description | -|-------|--------|-------------------| -| name | string | name of the emoji | - -## Delete Application Emoji -/applications/[\{application.id\}](/docs/resources/application#application-object)/emojis/[\{emoji.id\}](/docs/resources/emoji#emoji-object) - -Delete the given emoji. Returns `204 No Content` on success. diff --git a/docs/resources/guild-template.mdx b/docs/resources/guild-template.mdx deleted file mode 100644 index 063b218bdd..0000000000 --- a/docs/resources/guild-template.mdx +++ /dev/null @@ -1,144 +0,0 @@ ---- -sidebar_label: Guild Template ---- - -# Guild Template Resource - -### Guild Template Object - -Represents a code that when used, creates a guild based on a snapshot of an existing guild. - -###### Guild Template Structure - -| Field | Type | Description | -|-------------------------|------------------------------------------------------------|----------------------------------------------------------------------------------| -| code | string | the template code (unique ID) | -| name | string | template name | -| description | ?string | the description for the template | -| usage_count | integer | number of times this template has been used | -| creator_id | snowflake | the ID of the user who created the template | -| creator | [user](/docs/resources/user#user-object) object | the user who created the template | -| created_at | ISO8601 timestamp | when this template was created | -| updated_at | ISO8601 timestamp | when this template was last synced to the source guild | -| source_guild_id | snowflake | the ID of the guild this template is based on | -| serialized_source_guild | partial [guild](/docs/resources/guild#guild-object) object | the guild snapshot this template contains; placeholder IDs are given as integers | -| is_dirty | ?boolean | whether the template has unsynced changes | - -###### Example Guild Template Object - -```json -{ - "code": "hgM48av5Q69A", - "name": "Friends & Family", - "description": "", - "usage_count": 49605, - "creator_id": "132837293881950208", - "creator": { - "id": "132837293881950208", - "username": "hoges", - "avatar": "79b0d9f8c340f2d43e1f78b09f175b62", - "discriminator": "0001", - "public_flags": 129 - }, - "created_at": "2020-04-02T21:10:38+00:00", - "updated_at": "2020-05-01T17:57:38+00:00", - "source_guild_id": "678070694164299796", - "serialized_source_guild": { - "name": "Friends & Family", - "description": null, - "region": "us-west", - "verification_level": 0, - "default_message_notifications": 0, - "explicit_content_filter": 0, - "preferred_locale": "en-US", - "afk_timeout": 300, - "roles": [ - { - "id": 0, - "name": "@everyone", - "permissions": 104324689, - "color": 0, - "hoist": false, - "mentionable": false - } - ], - "channels": [ - { - "name": "Text Channels", - "position": 1, - "topic": null, - "bitrate": 64000, - "user_limit": 0, - "nsfw": false, - "rate_limit_per_user": 0, - "parent_id": null, - "permission_overwrites": [], - "id": 1, - "type": 4 - }, - { - "name": "general", - "position": 1, - "topic": null, - "bitrate": 64000, - "user_limit": 0, - "nsfw": false, - "rate_limit_per_user": 0, - "parent_id": 1, - "permission_overwrites": [], - "id": 2, - "type": 0 - } - ], - "afk_channel_id": null, - "system_channel_id": 2, - "system_channel_flags": 0, - "icon_hash": null - }, - "is_dirty": null -} -``` - -## Get Guild Template -/guilds/templates/[\{template.code\}](/docs/resources/guild-template#guild-template-object) - -Returns a [guild template](/docs/resources/guild-template#guild-template-object) object for the given code. - -## Get Guild Templates -/guilds/[\{guild.id\}](/docs/resources/guild#guild-object)/templates - -Returns an array of [guild template](/docs/resources/guild-template#guild-template-object) objects. Requires the `MANAGE_GUILD` permission. - -## Create Guild Template -/guilds/[\{guild.id\}](/docs/resources/guild#guild-object)/templates - -Creates a template for the guild. Requires the `MANAGE_GUILD` permission. Returns the created [guild template](/docs/resources/guild-template#guild-template-object) object on success. - -###### JSON Params - -| Field | Type | Description | -|--------------|---------|-------------------------------------------------| -| name | string | name of the template (1-100 characters) | -| description? | ?string | description for the template (0-120 characters) | - -## Sync Guild Template -/guilds/[\{guild.id\}](/docs/resources/guild#guild-object)/templates/[\{template.code\}](/docs/resources/guild-template#guild-template-object) - -Syncs the template to the guild's current state. Requires the `MANAGE_GUILD` permission. Returns the [guild template](/docs/resources/guild-template#guild-template-object) object on success. - -## Modify Guild Template -/guilds/[\{guild.id\}](/docs/resources/guild#guild-object)/templates/[\{template.code\}](/docs/resources/guild-template#guild-template-object) - -Modifies the template's metadata. Requires the `MANAGE_GUILD` permission. Returns the [guild template](/docs/resources/guild-template#guild-template-object) object on success. - -###### JSON Params - -| Field | Type | Description | -|--------------|---------|-------------------------------------------------| -| name? | string | name of the template (1-100 characters) | -| description? | ?string | description for the template (0-120 characters) | - -## Delete Guild Template -/guilds/[\{guild.id\}](/docs/resources/guild#guild-object)/templates/[\{template.code\}](/docs/resources/guild-template#guild-template-object) - -Deletes the template. Requires the `MANAGE_GUILD` permission. Returns the deleted [guild template](/docs/resources/guild-template#guild-template-object) object on success. diff --git a/docs/resources/invite.mdx b/docs/resources/invite.mdx deleted file mode 100644 index 333c1f3e03..0000000000 --- a/docs/resources/invite.mdx +++ /dev/null @@ -1,173 +0,0 @@ ---- -sidebar_label: Invite ---- - -# Invite Resource - -### Invite Object - -Represents a code that when used, adds a user to a guild or group DM channel. - -###### Invite Structure - -| Field | Type | Description | -|-----------------------------|----------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------| -| type | integer | the [type of invite](/docs/resources/invite#invite-object-invite-types) | -| code | string | the invite code (unique ID) | -| guild? | partial [guild](/docs/resources/guild#guild-object) object | the guild this invite is for | -| channel | ?partial [channel](/docs/resources/channel#channel-object) object | the channel this invite is for | -| inviter? | [user](/docs/resources/user#user-object) object | the user who created the invite | -| target_type? | integer | the [type of target](/docs/resources/invite#invite-object-invite-target-types) for this voice channel invite | -| target_user? | [user](/docs/resources/user#user-object) object | the user whose stream to display for this voice channel stream invite | -| target_application? | partial [application](/docs/resources/application#application-object) object | the embedded application to open for this voice channel embedded application invite | -| approximate_presence_count? | integer | approximate count of online members, returned from the `GET /invites/` endpoint when `with_counts` is `true` | -| approximate_member_count? | integer | approximate count of total members, returned from the `GET /invites/` endpoint when `with_counts` is `true` | -| expires_at | ?ISO8601 timestamp | the expiration date of this invite | -| guild_scheduled_event? | [guild scheduled event](/docs/resources/guild-scheduled-event#guild-scheduled-event-object) object | guild scheduled event data, only included if `guild_scheduled_event_id` contains a valid guild scheduled event id | -| flags? | integer | [guild invite flags](/docs/resources/invite#invite-object-guild-invite-flags) for guild invites | - -###### Invite Types - -| Type | Value | -|----------|-------| -| GUILD | 0 | -| GROUP_DM | 1 | -| FRIEND | 2 | - -###### Invite Target Types - -| Type | Value | -|----------------------|-------| -| STREAM | 1 | -| EMBEDDED_APPLICATION | 2 | - -###### Guild Invite Flags - -| Flag | Value | Description | -|-----------------|----------|---------------------------------------------------| -| IS_GUEST_INVITE | `1 << 0` | this invite is a guest invite for a voice channel | - -###### Example Invite Object - -```json -{ - "type": 0, - "code": "0vCdhLbwjZZTWZLD", - "guild": { - "id": "165176875973476352", - "name": "CS:GO Fraggers Only", - "splash": null, - "banner": null, - "description": "Very good description", - "icon": null, - "features": ["NEWS", "DISCOVERABLE"], - "verification_level": 2, - "vanity_url_code": null, - "nsfw_level": 0, - "premium_subscription_count": 5 - }, - "channel": { - "id": "165176875973476352", - "name": "illuminati", - "type": 0 - }, - "inviter": { - "id": "115590097100865541", - "username": "speed", - "avatar": "deadbeef", - "discriminator": "7653", - "public_flags": 131328 - }, - "target_type": 1, - "target_user": { - "id": "165176875973476352", - "username": "bob", - "avatar": "deadbeef", - "discriminator": "1234", - "public_flags": 64 - } -} -``` - -### Invite Metadata Object - -Extra information about an invite, will extend the [invite](/docs/resources/invite#invite-object) object. - -###### Invite Metadata Structure - -| Field | Type | Description | -|------------|-------------------|------------------------------------------------------| -| uses | integer | number of times this invite has been used | -| max_uses | integer | max number of times this invite can be used | -| max_age | integer | duration (in seconds) after which the invite expires | -| temporary | boolean | whether this invite only grants temporary membership | -| created_at | ISO8601 timestamp | when this invite was created | - -###### Example Invite Metadata - -```json -{ - "uses": 0, - "max_uses": 0, - "max_age": 0, - "temporary": false, - "created_at": "2016-03-31T19:15:39.954000+00:00" -} -``` - -### Invite Stage Instance Object - -:::warn -This is deprecated. -::: - -###### Invite Stage Instance Structure - -| Field | Type | Description | -|-------------------|------------------------------------------------------------------------------------|----------------------------------------------------| -| members | array of partial [guild member](/docs/resources/guild#guild-member-object) objects | the members speaking in the Stage | -| participant_count | integer | the number of users in the Stage | -| speaker_count | integer | the number of users speaking in the Stage | -| topic | string | the topic of the Stage instance (1-120 characters) | - -###### Example Invite Stage Instance - -```json -{ - "topic": "The debate is over: diet is better than regular", - "participant_count": 200, - "speaker_count": 5 , - "members": [ - { - "roles": [], - "nick": "NOT API SUPPORT", - "avatar": null, - "premium_since": null, - "joined_at": "2015-04-26T06:26:56.936000+00:00", - "pending": false, - "user": {} - } - ] -} -``` - -## Get Invite -/invites/[\{invite.code\}](/docs/resources/invite#invite-object) - -Returns an [invite](/docs/resources/invite#invite-object) object for the given code. - -###### Query String Params - -| Field | Type | Description | -|---------------------------|--------------------------------------------------|-------------------------------------------------------------| -| with_counts? | [boolean](/docs/reference#boolean-query-strings) | whether the invite should contain approximate member counts | -| guild_scheduled_event_id? | snowflake | the guild scheduled event to include with the invite | - -## Delete Invite -/invites/[\{invite.code\}](/docs/resources/invite#invite-object) - -Delete an invite. Requires the `MANAGE_CHANNELS` permission on the channel this invite belongs to, or `MANAGE_GUILD` to remove any invite across the guild. Returns an [invite](/docs/resources/invite#invite-object) object on success. Fires an [Invite Delete](/docs/events/gateway-events#invite-delete) Gateway event. - -:::info -This endpoint supports the `X-Audit-Log-Reason` header. -::: diff --git a/docs/resources/lobby.mdx b/docs/resources/lobby.mdx deleted file mode 100644 index c3b08eedef..0000000000 --- a/docs/resources/lobby.mdx +++ /dev/null @@ -1,173 +0,0 @@ ---- -sidebar_label: Lobby ---- - -# Lobby Resource - -### Lobby Object - -Represents a lobby within Discord. See [Managing Lobbies](/docs/discord-social-sdk/development-guides/managing-lobbies) for more information. - -###### Lobby Structure - -| Field | Type | Description | -|-----------------|----------------------------------------------------------------------------|---------------------------------------------------------------------| -| id | snowflake | the id of this channel | -| application_id | snowflake | application that created the lobby | -| metadata | ?dict\ | dictionary of string key/value pairs. The max total length is 1000. | -| members | array of [lobby member](/docs/resources/lobby#lobby-member-object) objects | members of the lobby | -| linked_channel? | channel object | the guild channel linked to the lobby | - -### Lobby Member Object - -Represents a member of a lobby, including optional metadata and flags. - -###### Lobby Member Structure - -| Field | Type | Description | -|-----------|-------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------| -| id | snowflake | the id of the user | -| metadata? | ?dict\ | dictionary of string key/value pairs. The max total length is 1000. | -| flags? | integer | [lobby member flags](/docs/resources/lobby#lobby-member-object-lobby-member-flags) combined as a [bitfield](https://en.wikipedia.org/wiki/Bit_field) | - -###### Lobby Member Flags - -| Flag | Value | Description | -|--------------|--------|-----------------------------------------| -| CanLinkLobby | `1<<0` | user can link a text channel to a lobby | - - -###### Example Lobby Object - -```json -{ - "id": "96008815106887111", - "application_id": "41771983429993937", - "metadata": { - "topic": "we need more redstone", - }, - "members": [ - { - "id": "41771983429993000", - "metadata": null, - "flags": 1 - } - ] -} -``` - -## Create Lobby -/lobbies - -Creates a new lobby, adding any of the specified members to it, if provided. - -Returns a [lobby](/docs/resources/lobby#lobby-object) object. - -:::info -[Discord Social SDK](/docs/discord-social-sdk/overview) clients will not be able to join or leave a lobby created using this API, such as [`Client::CreateOrJoinLobby`]. See [Managing Lobbies](/docs/discord-social-sdk/development-guides/managing-lobbies) for more information. -::: - -### JSON Params - -| Field | Type | Description | -|-----------------------|----------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------| -| metadata? | ?dict\ | optional dictionary of string key/value pairs. The max total length is 1000. | -| members? | array of [lobby member](/docs/resources/lobby#lobby-member-object) objects | optional array of up to 25 users to be added to the lobby | -| idle_timeout_seconds? | integer | seconds to wait before shutting down a lobby after it becomes idle. Value can be between 5 and 604800 (7 days). See [`LobbyHandle`] for more details on this behavior. | - -#### Lobby Member JSON Params - -| Field | Type | Description | -|-----------|-------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------| -| id | snowflake | Discord user id of the user to add to the lobby | -| metadata? | ?dict\ | optional dictionary of string key/value pairs. The max total length is 1000. | -| flags? | integer | [lobby member flags](/docs/resources/lobby#lobby-member-object-lobby-member-flags) combined as a [bitfield](https://en.wikipedia.org/wiki/Bit_field) | - -## Get Lobby -/lobbies/[\{lobby.id\}](/docs/resources/lobby#lobby-object) - -Returns a [lobby](/docs/resources/lobby#lobby-object) object for the specified lobby id, if it exists. - -## Modify Lobby -/lobbies/[\{lobby.id\}](/docs/resources/lobby#lobby-object) - -Modifies the specified lobby with new values, if provided. - -Returns the updated [lobby](/docs/resources/lobby#lobby-object) object. - -### JSON Params - -| Field | Type | Description | -|-----------------------|----------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------| -| metadata? | ?dict\ | optional dictionary of string key/value pairs. The max total length is 1000. Overwrites any existing metadata. | -| members? | array of [lobby member](/docs/resources/lobby#lobby-member-object) objects | optional array of up to 25 users to replace the lobby members with. If provided, lobby members not in this list will be removed from the lobby. | -| idle_timeout_seconds? | integer | seconds to wait before shutting down a lobby after it becomes idle. Value can be between 5 and 604800 (7 days). See [`LobbyHandle`] for more details on this behavior. | - -## Delete Lobby -/lobbies/[\{lobby.id\}](/docs/resources/lobby#lobby-object) - -Deletes the specified lobby if it exists. - -It is safe to call even if the lobby is already deleted as well. - -Returns nothing. - -## Add a Member to a Lobby -/lobbies/[\{lobby.id\}](/docs/resources/lobby#lobby-object)/members/[\{user.id\}](/docs/resources/user#user-object) - -Adds the provided user to the specified lobby. If called when the user is already a member of the lobby will update fields such as metadata on that user instead. - -Returns the [lobby member](/docs/resources/lobby#lobby-member-object) object. - -### JSON Params - -| Field | Type | Description | -|-----------|-------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------| -| metadata? | ?dict\ | optional dictionary of string key/value pairs. The max total length is 1000. | -| flags? | integer | [lobby member flags](/docs/resources/lobby#lobby-member-object-lobby-member-flags) combined as a [bitfield](https://en.wikipedia.org/wiki/Bit_field) | - -## Remove a Member from a Lobby -/lobbies/[\{lobby.id\}](/docs/resources/lobby#lobby-object)/members/[\{user.id\}](/docs/resources/user#user-object) - -Removes the provided user from the specified lobby. It is safe to call this even if the user is no longer a member of the lobby, but will fail if the lobby does not exist. - -Returns nothing. - -## Leave Lobby -/lobbies/[\{lobby.id\}](/docs/resources/lobby#lobby-object)/members/@me - -Removes the current user from the specified lobby. It is safe to call this even if the user is no longer a member of the lobby, but will fail if the lobby does not exist. - -Uses `Bearer` token for authorization. - -Returns nothing. - -## Link Channel to Lobby -/lobbies/[\{lobby.id\}](/docs/resources/lobby#lobby-object)/channel-linking - -Links an existing text channel to a lobby. See [Linked Channels](/docs/discord-social-sdk/development-guides/linked-channels) for more information. - -Uses `Bearer` token for authorization and user must be a lobby member with `CanLinkLobby` [lobby member flag](/docs/resources/lobby#lobby-member-object-lobby-member-flags). - -Returns a [lobby](/docs/resources/lobby#lobby-object) object with a linked channel. - -### JSON Params - -| Field | Type | Description | -|-------------|-----------|------------------------------------------------------------------------------------------------------------------------| -| channel_id? | snowflake | the id of the channel to link to the lobby. If not provided, will unlink any currently linked channels from the lobby. | - -## Unlink Channel from Lobby -/lobbies/[\{lobby.id\}](/docs/resources/lobby#lobby-object)/channel-linking - -Unlinks any currently linked channels from the specified lobby. - -Send a request to this endpoint with an empty body to unlink any currently linked channels from the specified lobby. - -Uses `Bearer` token for authorization and user must be a lobby member with `CanLinkLobby` [lobby member flag](/docs/resources/lobby#lobby-member-object-lobby-member-flags). - -Returns a [lobby](/docs/resources/lobby#lobby-object) object without a linked channel. - -{/* Autogenerated Reference Links */} -[`Client::CreateOrJoinLobby`]: https://discord.com/developers/docs/social-sdk/classdiscordpp_1_1Client.html#a8b4e195555ecaa89ccdfc0acd28d3512 -[`LobbyHandle`]: https://discord.com/developers/docs/social-sdk/classdiscordpp_1_1LobbyHandle.html#a04cebab69ab0e7fb930346a14a87e843 \ No newline at end of file diff --git a/docs/resources/poll.mdx b/docs/resources/poll.mdx deleted file mode 100644 index 2543a894d8..0000000000 --- a/docs/resources/poll.mdx +++ /dev/null @@ -1,149 +0,0 @@ ---- -sidebar_label: Poll ---- - -# Poll Resource - -A poll is... well... a poll! It holds information about a poll! - -![Example message containing a poll](images/example-poll.webp) - -### Poll Object - -The poll object has a lot of levels and nested structures. It was also designed -to support future extensibility, so some fields may appear to be more complex than -necessary. - -###### Poll Object Structure - -| Field | Type | Description | -|-------------------|-----------------------------------------------------------------------------------------------------|-----------------------------------------------------------------| -| question | [Poll Media Object](/docs/resources/poll#poll-media-object-poll-media-object-structure) | The question of the poll. Only `text` is supported. | -| answers | List of [Poll Answer Objects](/docs/resources/poll#poll-answer-object-poll-answer-object-structure) | Each of the answers available in the poll. | -| expiry | ?IS08601 timestamp | The time when the poll ends. | -| allow_multiselect | boolean | Whether a user can select multiple answers | -| layout_type | integer | The [layout type](/docs/resources/poll#layout-type) of the poll | -| results? | [Poll Results Object](/docs/resources/poll#poll-results-object-poll-results-object-structure) | The results of the poll | - -`expiry` is marked as nullable to support non-expiring polls in the future, but all polls have an expiry currently. - -### Poll Create Request Object - -This is the request object used when creating a poll across the different endpoints. -It is similar but not exactly identical to the main [poll object](/docs/resources/poll#poll-object-poll-object-structure). -The main difference is that the request has `duration` which eventually becomes `expiry`. - -###### Poll Create Request Object Structure - -| Field | Type | Description | -|--------------------|-----------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------| -| question | [Poll Media Object](/docs/resources/poll#poll-media-object-poll-media-object-structure) | The question of the poll. Only `text` is supported. | -| answers | List of [Poll Answer Objects](/docs/resources/poll#poll-answer-object-poll-answer-object-structure) | Each of the answers available in the poll, up to 10 | -| duration? | integer | Number of hours the poll should be open for, up to 32 days. Defaults to 24 | -| allow_multiselect? | boolean | Whether a user can select multiple answers. Defaults to false | -| layout_type? | integer | The [layout type](/docs/resources/poll#layout-type) of the poll. Defaults to... DEFAULT! | - -### Layout Type - -We might have different layouts for polls in the future. -For now though, this number will be 1. - -| Type | ID | Description | -|---------|----|--------------------------------| -| DEFAULT | 1 | The, uhm, default layout type. | - -### Poll Media Object - -The poll media object is a common object that backs both the question and answers. -The intention is that it allows us to extensibly add new ways to display things in the future. -For now, `question` only supports `text`, while answers can have an optional `emoji`. - -###### Poll Media Object Structure - -| Field | Type | Description | -|--------|-----------------------------------------------------|------------------------| -| text? | string | The text of the field | -| emoji? | partial [emoji](/docs/resources/emoji#emoji-object) | The emoji of the field | - -`text` should always be non-null for both questions and answers, but please do not depend on that in the future. -The maximum length of `text` is 300 for the question, and 55 for any answer. - -When creating a poll answer with an emoji, one only needs to send either the `id` (custom emoji) or `name` (default emoji) as the only field. - -### Poll Answer Object - -The `answer_id` is a number that labels each answer. -As an implementation detail, it currently starts at 1 for the first answer and goes up sequentially. -We recommend against depending on this sequence. - -Currently, there is a maximum of 10 answers per poll. - -###### Poll Answer Object Structure - -| Field | Type | Description | -|-------------|-----------------------------------------------------------------------------------------|------------------------| -| answer_id\* | integer | The ID of the answer | -| poll_media | [Poll Media Object](/docs/resources/poll#poll-media-object-poll-media-object-structure) | The data of the answer | - -\* Only sent as part of responses from Discord's API/Gateway. - -### Poll Results Object - -In a nutshell, this contains the number of votes for each answer. - -The `results` field may be not present in certain responses where, as an implementation detail, we do not fetch the poll results in our backend. -This should be treated as "unknown results", as opposed to "no results". You can keep using the results if you have previously received them through other means. - -Also due to the intricacies of counting at scale, while a poll is in progress the results may not be perfectly accurate. -They usually are accurate, and shouldn't deviate significantly -- it's just difficult to make guarantees. - -To compensate for this, after a poll is finished there is a background job which performs a final, accurate tally of votes. -This tally concludes once `is_finalized` is `true`. Polls that have ended will also always contain results. - -If `answer_counts` does not contain an entry for a particular answer, then there are no votes for that answer. - -###### Poll Results Object Structure - -| Field | Type | Description | -|---------------|-----------------------------------------------------------------------------------------------------------------|-----------------------------------------------| -| is_finalized | boolean | Whether the votes have been precisely counted | -| answer_counts | List of [Poll Answer Count Object](/docs/resources/poll#poll-results-object-poll-answer-count-object-structure) | The counts for each answer | - -###### Poll Answer Count Object Structure - -| Field | Type | Description | -|----------|---------|------------------------------------------------| -| id | integer | The `answer_id` | -| count | integer | The number of votes for this answer | -| me_voted | boolean | Whether the current user voted for this answer | - -# Poll Endpoints - -For creating a poll, see [Create Message](/docs/resources/message#create-message). After creation, the poll message cannot be edited. - -Apps are not allowed to vote on polls. No rights! :) - -## Get Answer Voters -/channels/[\{channel.id\}](/docs/resources/channel#channel-object)/polls/[\{message.id\}](/docs/resources/message#message-object)/answers/[\{answer_id\}](/docs/resources/poll#poll-answer-object) - -Get a list of users that voted for this specific answer. - -###### Query String Params - -| Field | Type | Description | Default | -|--------|-----------|---------------------------------------|---------| -| after? | snowflake | Get users after this user ID | absent | -| limit? | integer | Max number of users to return (1-100) | 25 | - -###### Response Body - -| Field | Type | Description | -|-------|---------------------------------------------------|---------------------------------| -| users | array of [user](/docs/resources/user#user-object) | Users who voted for this answer | - -## End Poll -/channels/[\{channel.id\}](/docs/resources/channel#channel-object)/polls/[\{message.id\}](/docs/resources/message#message-object)/expire - -Immediately ends the poll. You cannot end polls from other users. - -Returns a [message](/docs/resources/message#message-object) object. Fires a [Message Update](/docs/events/gateway-events#message-update) Gateway event. diff --git a/docs/resources/soundboard.mdx b/docs/resources/soundboard.mdx deleted file mode 100644 index f723d282b1..0000000000 --- a/docs/resources/soundboard.mdx +++ /dev/null @@ -1,150 +0,0 @@ ---- -sidebar_label: Soundboard ---- - -# Soundboard Resource - -Users can play soundboard sounds in voice channels, triggering a [Voice Channel Effect Send](/docs/events/gateway-events#voice-channel-effect-send) Gateway event for users connected to the voice channel. - -There is a set of [default sounds](/docs/resources/soundboard#list-default-soundboard-sounds) available to all users. Soundboard sounds can also be [created in a guild](/docs/resources/soundboard#create-guild-soundboard-sound); users will be able to use the sounds in the guild, and Nitro subscribers can use them in all guilds. - -Soundboard sounds in a set of guilds can be retrieved over the Gateway using [Request Soundboard Sounds](/docs/events/gateway-events#request-soundboard-sounds). - -### Soundboard Sound Object - -###### Soundboard Sound Structure - -| Field | Type | Description | -|------------|-------------------------------------------------|---------------------------------------------------------------------------| -| name | string | the name of this sound | -| sound_id | snowflake | the id of this sound | -| volume | double | the volume of this sound, from 0 to 1 | -| emoji_id | ?snowflake | the id of this sound's custom emoji | -| emoji_name | ?string | the unicode character of this sound's standard emoji | -| guild_id? | snowflake | the id of the guild this sound is in | -| available | boolean | whether this sound can be used, may be false due to loss of Server Boosts | -| user? | [user](/docs/resources/user#user-object) object | the user who created this sound | - -###### Example Default Soundboard Sound - -```json -{ - "name": "quack", - "sound_id": "1", - "volume": 1.0, - "emoji_id": null, - "emoji_name": "🦆", - "available": true -} -``` - -###### Example Guild Soundboard Sound - -```json -{ - "name": "Yay", - "sound_id": "1106714396018884649", - "volume": 1, - "emoji_id": "989193655938064464", - "emoji_name": null, - "guild_id": "613425648685547541", - "available": true -} -``` - -### Sound Files - -A soundboard sound can be retrieved in MP3 or Ogg format at the URL: - -``` -https://cdn.discordapp.com/soundboard-sounds/{sound_id} -``` - -## Send Soundboard Sound -/channels/[\{channel.id\}](/docs/resources/channel#channel-object)/send-soundboard-sound - -Send a soundboard sound to a voice channel the user is connected to. Fires a [Voice Channel Effect Send](/docs/events/gateway-events#voice-channel-effect-send) Gateway event. - -Requires the `SPEAK` and `USE_SOUNDBOARD` permissions, and also the `USE_EXTERNAL_SOUNDS` permission if the sound is from a different server. Additionally, requires the user to be connected to the voice channel, having a [voice state](/docs/resources/voice#voice-state-object) without `deaf`, `self_deaf`, `mute`, or `suppress` enabled. - -###### JSON Params - -| Field | Type | Description | -|------------------|-----------|--------------------------------------------------------------------------------------------------| -| sound_id | snowflake | the id of the soundboard sound to play | -| source_guild_id? | snowflake | the id of the guild the soundboard sound is from, required to play sounds from different servers | - -## List Default Soundboard Sounds -/soundboard-default-sounds - -Returns an array of [soundboard sound](/docs/resources/soundboard#soundboard-sound-object) objects that can be used by all users. - -## List Guild Soundboard Sounds -/guilds/[\{guild.id\}](/docs/resources/guild#guild-object)/soundboard-sounds - -Returns a list of the guild's soundboard sounds. Includes `user` fields if the bot has the `CREATE_GUILD_EXPRESSIONS` or `MANAGE_GUILD_EXPRESSIONS` permission. - -###### Response Structure - -| Field | Type | -|-------|-----------------------------------------------------------------------------------------| -| items | array of [soundboard sound](/docs/resources/soundboard#soundboard-sound-object) objects | - -## Get Guild Soundboard Sound -/guilds/[\{guild.id\}](/docs/resources/guild#guild-object)/soundboard-sounds/[\{sound.id\}](/docs/resources/soundboard#soundboard-sound-object) - -Returns a [soundboard sound](/docs/resources/soundboard#soundboard-sound-object) object for the given sound id. Includes the `user` field if the bot has the `CREATE_GUILD_EXPRESSIONS` or `MANAGE_GUILD_EXPRESSIONS` permission. - -## Create Guild Soundboard Sound -/guilds/[\{guild.id\}](/docs/resources/guild#guild-object)/soundboard-sounds - -Create a new soundboard sound for the guild. Requires the `CREATE_GUILD_EXPRESSIONS` permission. Returns the new [soundboard sound](/docs/resources/soundboard#soundboard-sound-object) object on success. Fires a [Guild Soundboard Sound Create](/docs/events/gateway-events#guild-soundboard-sound-create) Gateway event. - -:::info -Soundboard sounds have a max file size of 512kb and a max duration of 5.2 seconds. -::: - -:::info -This endpoint supports the `X-Audit-Log-Reason` header. -::: - -###### JSON Params - -| Field | Type | Description | -|-------------|------------|------------------------------------------------------------------------------------------------| -| name | string | name of the soundboard sound (2-32 characters) | -| sound | data uri | the mp3 or ogg sound data, base64 encoded, similar to [image data](/docs/reference#image-data) | -| volume? | ?double | the volume of the soundboard sound, from 0 to 1, defaults to 1 | -| emoji_id? | ?snowflake | the id of the custom emoji for the soundboard sound | -| emoji_name? | ?string | the unicode character of a standard emoji for the soundboard sound | - -## Modify Guild Soundboard Sound -/guilds/[\{guild.id\}](/docs/resources/guild#guild-object)/soundboard-sounds/[\{sound.id\}](/docs/resources/soundboard#soundboard-sound-object) - -Modify the given soundboard sound. For sounds created by the current user, requires either the `CREATE_GUILD_EXPRESSIONS` or `MANAGE_GUILD_EXPRESSIONS` permission. For other sounds, requires the `MANAGE_GUILD_EXPRESSIONS` permission. Returns the updated [soundboard sound](/docs/resources/soundboard#soundboard-sound-object) object on success. Fires a [Guild Soundboard Sound Update](/docs/events/gateway-events#guild-soundboard-sound-update) Gateway event. - -:::warn -All parameters to this endpoint are optional. -::: - -:::info -This endpoint supports the `X-Audit-Log-Reason` header. -::: - -###### JSON Params - -| Field | Type | Description | -|------------|------------|--------------------------------------------------------------------| -| name | string | name of the soundboard sound (2-32 characters) | -| volume | ?double | the volume of the soundboard sound, from 0 to 1 | -| emoji_id | ?snowflake | the id of the custom emoji for the soundboard sound | -| emoji_name | ?string | the unicode character of a standard emoji for the soundboard sound | - -## Delete Guild Soundboard Sound -/guilds/[\{guild.id\}](/docs/resources/guild#guild-object)/soundboard-sounds/[\{sound.id\}](/docs/resources/soundboard#soundboard-sound-object) - -Delete the given soundboard sound. For sounds created by the current user, requires either the `CREATE_GUILD_EXPRESSIONS` or `MANAGE_GUILD_EXPRESSIONS` permission. For other sounds, requires the `MANAGE_GUILD_EXPRESSIONS` permission. Returns `204 No Content` on success. Fires a [Guild Soundboard Sound Delete](/docs/events/gateway-events#guild-soundboard-sound-delete) Gateway event. - -:::info -This endpoint supports the `X-Audit-Log-Reason` header. -::: diff --git a/docs/resources/sticker.mdx b/docs/resources/sticker.mdx deleted file mode 100644 index ac0fa4bfac..0000000000 --- a/docs/resources/sticker.mdx +++ /dev/null @@ -1,190 +0,0 @@ ---- -sidebar_label: Sticker ---- - -# Sticker Resource - -### Sticker Object - -Represents a sticker that can be sent in messages. - -###### Sticker Structure - -| Field | Type | Description | -|-------------|-------------------------------------------------|---------------------------------------------------------------------------------------| -| id | snowflake | [id of the sticker](/docs/reference#image-formatting) | -| pack_id? | snowflake | for standard stickers, id of the pack the sticker is from | -| name | string | name of the sticker | -| description | ?string | description of the sticker | -| tags\* | string | autocomplete/suggestion tags for the sticker (max 200 characters) | -| type | integer | [type of sticker](/docs/resources/sticker#sticker-object-sticker-types) | -| format_type | integer | [type of sticker format](/docs/resources/sticker#sticker-object-sticker-format-types) | -| available? | boolean | whether this guild sticker can be used, may be false due to loss of Server Boosts | -| guild_id? | snowflake | id of the guild that owns this sticker | -| user? | [user](/docs/resources/user#user-object) object | the user that uploaded the guild sticker | -| sort_value? | integer | the standard sticker's sort order within its pack | - -\* A comma separated list of keywords is the format used in this field by standard stickers, but this is just a convention. -Incidentally the client will always use a name generated from an emoji as the value of this field when creating or modifying a guild sticker. - -###### Sticker Types - -| Type | Value | Description | -|----------|-------|-------------------------------------------------------| -| STANDARD | 1 | an official sticker in a pack | -| GUILD | 2 | a sticker uploaded to a guild for the guild's members | - -###### Sticker Format Types - -| Type | Value | -|--------|-------| -| PNG | 1 | -| APNG | 2 | -| LOTTIE | 3 | -| GIF | 4 | - -###### Example Sticker - -```json -{ - "id": "749054660769218631", - "name": "Wave", - "tags": "wumpus, hello, sup, hi, oi, heyo, heya, yo, greetings, greet, welcome, wave, :wave, :hello, :hi, :hey, hey, \ud83d\udc4b, \ud83d\udc4b\ud83c\udffb, \ud83d\udc4b\ud83c\udffc, \ud83d\udc4b\ud83c\udffd, \ud83d\udc4b\ud83c\udffe, \ud83d\udc4b\ud83c\udfff, goodbye, bye, see ya, later, laterz, cya", - "type": 1, - "format_type": 3, - "description": "Wumpus waves hello", - "pack_id": "847199849233514549", - "sort_value": 12 -} -``` - -### Sticker Item Object - -The smallest amount of data required to render a sticker. A partial sticker object. - -###### Sticker Item Structure - -| Field | Type | Description | -|-------------|-----------|---------------------------------------------------------------------------------------| -| id | snowflake | id of the sticker | -| name | string | name of the sticker | -| format_type | integer | [type of sticker format](/docs/resources/sticker#sticker-object-sticker-format-types) | - -### Sticker Pack Object - -Represents a pack of standard stickers. - -###### Sticker Pack Structure - -| Field | Type | Description | -|-------------------|--------------------------------------------------------------------|---------------------------------------------------------------------------| -| id | snowflake | id of the sticker pack | -| stickers | array of [sticker](/docs/resources/sticker#sticker-object) objects | the stickers in the pack | -| name | string | name of the sticker pack | -| sku_id | snowflake | id of the pack's SKU | -| cover_sticker_id? | snowflake | id of a sticker in the pack which is shown as the pack's icon | -| description | string | description of the sticker pack | -| banner_asset_id? | snowflake | id of the sticker pack's [banner image](/docs/reference#image-formatting) | - -###### Example Sticker Pack - -```json -{ - "id": "847199849233514549", - "stickers": [], - "name": "Wumpus Beyond", - "sku_id": "847199849233514547", - "cover_sticker_id": "749053689419006003", - "description": "Say hello to Wumpus!", - "banner_asset_id": "761773777976819732" -} -``` - -## Get Sticker -/stickers/[\{sticker.id\}](/docs/resources/sticker#sticker-object) - -Returns a [sticker](/docs/resources/sticker#sticker-object) object for the given sticker ID. - -## List Sticker Packs -/sticker-packs - -Returns a list of available sticker packs. - -###### Response Structure - -| Field | Type | -|---------------|------------------------------------------------------------------------------| -| sticker_packs | array of [sticker pack](/docs/resources/sticker#sticker-pack-object) objects | - -## Get Sticker Pack -/sticker-packs/[\{pack.id\}](/docs/resources/sticker#sticker-pack-object) - -Returns a [sticker pack](/docs/resources/sticker#sticker-pack-object) object for the given sticker pack ID. - -## List Guild Stickers -/guilds/[\{guild.id\}](/docs/resources/guild#guild-object)/stickers - -Returns an array of [sticker](/docs/resources/sticker#sticker-object) objects for the given guild. Includes `user` fields if the bot has the `CREATE_GUILD_EXPRESSIONS` or `MANAGE_GUILD_EXPRESSIONS` permission. - -## Get Guild Sticker -/guilds/[\{guild.id\}](/docs/resources/guild#guild-object)/stickers/[\{sticker.id\}](/docs/resources/sticker#sticker-object) - -Returns a [sticker](/docs/resources/sticker#sticker-object) object for the given guild and sticker IDs. Includes the `user` field if the bot has the `CREATE_GUILD_EXPRESSIONS` or `MANAGE_GUILD_EXPRESSIONS` permission. - -## Create Guild Sticker -/guilds/[\{guild.id\}](/docs/resources/guild#guild-object)/stickers - -Create a new sticker for the guild. Send a `multipart/form-data` body. Requires the `CREATE_GUILD_EXPRESSIONS` permission. Returns the new [sticker](/docs/resources/sticker#sticker-object) object on success. Fires a [Guild Stickers Update](/docs/events/gateway-events#guild-stickers-update) Gateway event. - -Every guilds has five free sticker slots by default, and each Boost level will grant access to more slots. - -:::info -This endpoint supports the `X-Audit-Log-Reason` header. -::: - -:::warn -Lottie stickers can only be uploaded on guilds that have either the `VERIFIED` and/or the `PARTNERED` [guild feature](/docs/resources/guild#guild-object-guild-features). -::: - -:::warn -Uploaded stickers are constrained to 5 seconds in length for animated stickers, and 320 x 320 pixels. -::: - -###### Form Params - -| Field | Type | Description | -|-------------|---------------|----------------------------------------------------------------------------------------| -| name | string | name of the sticker (2-30 characters) | -| description | string | description of the sticker (empty or 2-100 characters) | -| tags | string | autocomplete/suggestion tags for the sticker (max 200 characters) | -| file | file contents | the sticker file to upload, must be a PNG, APNG, GIF, or Lottie JSON file, max 512 KiB | - -## Modify Guild Sticker -/guilds/[\{guild.id\}](/docs/resources/guild#guild-object)/stickers/[\{sticker.id\}](/docs/resources/sticker#sticker-object) - -Modify the given sticker. For stickers created by the current user, requires either the `CREATE_GUILD_EXPRESSIONS` or `MANAGE_GUILD_EXPRESSIONS` permission. For other stickers, requires the `MANAGE_GUILD_EXPRESSIONS` permission. Returns the updated [sticker](/docs/resources/sticker#sticker-object) object on success. Fires a [Guild Stickers Update](/docs/events/gateway-events#guild-stickers-update) Gateway event. - -:::info -All parameters to this endpoint are optional. -::: - -:::info -This endpoint supports the `X-Audit-Log-Reason` header. -::: - -###### JSON Params - -| Field | Type | Description | -|-------------|---------|-------------------------------------------------------------------| -| name | string | name of the sticker (2-30 characters) | -| description | ?string | description of the sticker (2-100 characters) | -| tags | string | autocomplete/suggestion tags for the sticker (max 200 characters) | - -## Delete Guild Sticker -/guilds/[\{guild.id\}](/docs/resources/guild#guild-object)/stickers/[\{sticker.id\}](/docs/resources/sticker#sticker-object) - -Delete the given sticker. For stickers created by the current user, requires either the `CREATE_GUILD_EXPRESSIONS` or `MANAGE_GUILD_EXPRESSIONS` permission. For other stickers, requires the `MANAGE_GUILD_EXPRESSIONS` permission. Returns `204 No Content` on success. Fires a [Guild Stickers Update](/docs/events/gateway-events#guild-stickers-update) Gateway event. - -:::info -This endpoint supports the `X-Audit-Log-Reason` header. -::: diff --git a/docs/resources/webhook.mdx b/docs/resources/webhook.mdx deleted file mode 100644 index dbd6cc5dde..0000000000 --- a/docs/resources/webhook.mdx +++ /dev/null @@ -1,341 +0,0 @@ ---- -sidebar_label: Webhook ---- - -# Webhook Resource - -Webhooks are a low-effort way to post messages to channels in Discord. They do not require a bot user or authentication to use. - -Apps can also subscribe to webhook events (i.e. outgoing webhooks) when events happen *in* Discord, which is detailed in the [Webhook Events](/docs/events/webhook-events) documentation. - -### Webhook Object - -Used to represent a webhook. - -###### Webhook Structure - -| Field | Type | Description | -|-------------------|------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------| -| id | snowflake | the id of the webhook | -| type | integer | the [type](/docs/resources/webhook#webhook-object-webhook-types) of the webhook | -| guild_id? | ?snowflake | the guild id this webhook is for, if any | -| channel_id | ?snowflake | the channel id this webhook is for, if any | -| user? | [user](/docs/resources/user#user-object) object | the user this webhook was created by (not returned when getting a webhook with its token) | -| name | ?string | the default name of the webhook | -| avatar | ?string | the default user avatar [hash](/docs/reference#image-formatting) of the webhook | -| token? | string | the secure token of the webhook (returned for Incoming Webhooks) | -| application_id | ?snowflake | the bot/OAuth2 application that created this webhook | -| source_guild? * | partial [guild](/docs/resources/guild#guild-object) object | the guild of the channel that this webhook is following (returned for Channel Follower Webhooks) | -| source_channel? * | partial [channel](/docs/resources/channel#channel-object) object | the channel that this webhook is following (returned for Channel Follower Webhooks) | -| url? | string | the url used for executing the webhook (returned by the [webhooks](/docs/topics/oauth2#webhooks) OAuth2 flow) | - -\* These fields will be absent if the webhook creator has since lost access to the guild where the followed channel resides - -###### Webhook Types - -:::info -These types don't include [webhook events](/docs/events/webhook-events), which are outgoing webhooks sent to your app by Discord. See [Webhook Events](/docs/events/webhook-events) for details. -::: - -| Value | Name | Description | -|-------|------------------|----------------------------------------------------------------------------------------------------------------| -| 1 | Incoming | Incoming Webhooks can post messages to channels with a generated token | -| 2 | Channel Follower | Channel Follower Webhooks are internal webhooks used with Channel Following to post new messages into channels | -| 3 | Application | Application webhooks are webhooks used with Interactions | - -###### Example Incoming Webhook - -```json -{ - "name": "test webhook", - "type": 1, - "channel_id": "199737254929760256", - "token": "3d89bb7572e0fb30d8128367b3b1b44fecd1726de135cbe28a41f8b2f777c372ba2939e72279b94526ff5d1bd4358d65cf11", - "avatar": null, - "guild_id": "199737254929760256", - "id": "223704706495545344", - "application_id": null, - "user": { - "username": "test", - "discriminator": "7479", - "id": "190320984123768832", - "avatar": "b004ec1740a63ca06ae2e14c5cee11f3", - "public_flags": 131328 - } -} -``` - -###### Example Channel Follower Webhook - -```json -{ - "type": 2, - "id": "752831914402115456", - "name": "Guildy name", - "avatar": "bb71f469c158984e265093a81b3397fb", - "channel_id": "561885260615255432", - "guild_id": "56188498421443265", - "application_id": null, - "source_guild": { - "id": "56188498421476534", - "name": "Guildy name", - "icon": "bb71f469c158984e265093a81b3397fb" - }, - "source_channel": { - "id": "5618852344134324", - "name": "announcements" - }, - "user": { - "username": "test", - "discriminator": "7479", - "id": "190320984123768832", - "avatar": "b004ec1740a63ca06ae2e14c5cee11f3", - "public_flags": 131328 - } -} -``` - -###### Example Application Webhook - -```json -{ - "type": 3, - "id": "658822586720976555", - "name": "Clyde", - "avatar": "689161dc90ac261d00f1608694ac6bfd", - "channel_id": null, - "guild_id": null, - "application_id": "658822586720976555" -} -``` - -## Create Webhook -/channels/[\{channel.id\}](/docs/resources/channel#channel-object)/webhooks - -Creates a new webhook and returns a [webhook](/docs/resources/webhook#webhook-object) object on success. Requires the `MANAGE_WEBHOOKS` permission. Fires a [Webhooks Update](/docs/events/gateway-events#webhooks-update) Gateway event. - -An error will be returned if a webhook name (`name`) is not valid. A webhook name is valid if: - -- It does not contain the substrings `clyde` or `discord` (case-insensitive) -- It follows the nickname guidelines in the [Usernames and Nicknames](/docs/resources/user#usernames-and-nicknames) documentation, with an exception that webhook names can be up to 80 characters - -:::info -This endpoint supports the `X-Audit-Log-Reason` header. -::: - -###### JSON Params - -| Field | Type | Description | -|---------|-------------------------------------------|---------------------------------------| -| name | string | name of the webhook (1-80 characters) | -| avatar? | ?[image data](/docs/reference#image-data) | image for the default webhook avatar | - -## Get Channel Webhooks -/channels/[\{channel.id\}](/docs/resources/channel#channel-object)/webhooks - -Returns a list of channel [webhook](/docs/resources/webhook#webhook-object) objects. Requires the `MANAGE_WEBHOOKS` permission. - -## Get Guild Webhooks -/guilds/[\{guild.id\}](/docs/resources/guild#guild-object)/webhooks - -Returns a list of guild [webhook](/docs/resources/webhook#webhook-object) objects. Requires the `MANAGE_WEBHOOKS` permission. - -## Get Webhook -/webhooks/[\{webhook.id\}](/docs/resources/webhook#webhook-object) - -Returns the new [webhook](/docs/resources/webhook#webhook-object) object for the given id. - -This request requires the `MANAGE_WEBHOOKS` permission unless the application making the request owns the -webhook. [(see: webhook.application_id)](/docs/resources/webhook#webhook-object) - -## Get Webhook with Token -/webhooks/[\{webhook.id\}](/docs/resources/webhook#webhook-object)/[\{webhook.token\}](/docs/resources/webhook#webhook-object) - -Same as above, except this call does not require authentication and returns no user in the webhook object. - -## Modify Webhook -/webhooks/[\{webhook.id\}](/docs/resources/webhook#webhook-object) - -Modify a webhook. Requires the `MANAGE_WEBHOOKS` permission. Returns the updated [webhook](/docs/resources/webhook#webhook-object) object on success. Fires a [Webhooks Update](/docs/events/gateway-events#webhooks-update) Gateway event. - -:::info -All parameters to this endpoint are optional -::: - -:::info -This endpoint supports the `X-Audit-Log-Reason` header. -::: - -###### JSON Params - -| Field | Type | Description | -|------------|-------------------------------------------|----------------------------------------------------| -| name | string | the default name of the webhook | -| avatar | ?[image data](/docs/reference#image-data) | image for the default webhook avatar | -| channel_id | snowflake | the new channel id this webhook should be moved to | - -## Modify Webhook with Token -/webhooks/[\{webhook.id\}](/docs/resources/webhook#webhook-object)/[\{webhook.token\}](/docs/resources/webhook#webhook-object) - -Same as above, except this call does not require authentication, does not accept a `channel_id` parameter in the body, and does not return a user in the webhook object. - -## Delete Webhook -/webhooks/[\{webhook.id\}](/docs/resources/webhook#webhook-object) - -Delete a webhook permanently. Requires the `MANAGE_WEBHOOKS` permission. Returns a `204 No Content` response on success. Fires a [Webhooks Update](/docs/events/gateway-events#webhooks-update) Gateway event. - -:::info -This endpoint supports the `X-Audit-Log-Reason` header. -::: - -## Delete Webhook with Token -/webhooks/[\{webhook.id\}](/docs/resources/webhook#webhook-object)/[\{webhook.token\}](/docs/resources/webhook#webhook-object) - -Same as above, except this call does not require authentication. - -## Execute Webhook -/webhooks/[\{webhook.id\}](/docs/resources/webhook#webhook-object)/[\{webhook.token\}](/docs/resources/webhook#webhook-object) - -Refer to [Uploading Files](/docs/reference#uploading-files) for details on attachments and `multipart/form-data` requests. Returns a message or `204 No Content` depending on the `wait` query parameter. - -:::info -Note that when sending a message, you must provide a value for at **least one of** `content`, `embeds`, `components`, `file`, or `poll`. -::: - -:::info -If the webhook channel is a forum or media channel, you must provide either `thread_id` in the query string params, or `thread_name` in the JSON/form params. If `thread_id` is provided, the message will send in that thread. If `thread_name` is provided, a thread with that name will be created in the channel. -::: - -:::warn -Discord may strip certain characters from message content, like invalid unicode characters or characters which cause unexpected message formatting. If you are passing user-generated strings into message content, consider sanitizing the data to prevent unexpected behavior and using `allowed_mentions` to prevent unexpected mentions. -::: - -###### Query String Params - -| Field | Type | Description | Required | -|-----------------|--------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|----------| -| wait | [boolean](/docs/reference#boolean-query-strings) | waits for server confirmation of message send before response, and returns the created message body (defaults to `false`; when `false` a message that is not saved does not return an error) | false | -| thread_id | snowflake | Send a message to the specified thread within a webhook's channel. The thread will automatically be unarchived. | false | -| with_components | [boolean](/docs/reference#boolean-query-strings) | whether to respect the `components` field of the request. When enabled, allows application-owned webhooks to use all components and non-owned webhooks to use non-interactive components. (defaults to `false`) | false | - -###### JSON/Form Params - -| Field | Type | Description | Required | -|-------------------|----------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|------------------------------------| -| content | string | the message contents (up to 2000 characters) | one of content, file, embeds, poll | -| username | string | override the default username of the webhook | false | -| avatar_url | string | override the default avatar of the webhook | false | -| tts | boolean | true if this is a TTS message | false | -| embeds | array of up to 10 [embed](/docs/resources/message#embed-object) objects | embedded `rich` content | one of content, file, embeds, poll | -| allowed_mentions | [allowed mention object](/docs/resources/message#allowed-mentions-object) | allowed mentions for the message | false | -| components \* | array of [message component](/docs/components/reference#component-object) | the components to include with the message | false | -| files[n] \*\* | file contents | the contents of the file being sent | one of content, file, embeds, poll | -| payload_json \*\* | string | JSON encoded body of non-file params | `multipart/form-data` only | -| attachments \*\* | array of partial [attachment](/docs/resources/message#attachment-object) objects | attachment objects with filename and description | false | -| flags \*\*\* | integer | [message flags](/docs/resources/message#message-object-message-flags) combined as a [bitfield](https://en.wikipedia.org/wiki/Bit_field) (only `SUPPRESS_EMBEDS`, `SUPPRESS_NOTIFICATIONS` and `IS_COMPONENTS_V2` can be set) | false | -| thread_name | string | name of thread to create (requires the webhook channel to be a forum or media channel) | false | -| applied_tags | array of snowflakes | array of tag ids to apply to the thread (requires the webhook channel to be a forum or media channel) | false | -| poll | [poll](/docs/resources/poll#poll-create-request-object) request object | A poll! | one of content, file, embeds, poll | - -\* Application-owned webhooks can always send components. Non-application-owned webhooks cannot send interactive components, and the `components` field will be ignored unless they set the `with_components` query param. - -\*\* See [Uploading Files](/docs/reference#uploading-files) for details. - -\*\*\* When the flag `IS_COMPONENTS_V2` is set, the webhook message can only contain `components`. Providing `content`, `embeds`, `files[n]` or `poll` will fail with a 400 BAD REQUEST response. - -:::info -For the webhook embed objects, you can set every field except `type` (it will be `rich` regardless of if you try to set it), `provider`, `video`, and any `height`, `width`, or `proxy_url` values for images. -::: - -## Execute Slack-Compatible Webhook -/webhooks/[\{webhook.id\}](/docs/resources/webhook#webhook-object)/[\{webhook.token\}](/docs/resources/webhook#webhook-object)/slack - -Refer to [Slack's documentation](https://api.slack.com/incoming-webhooks) for more information. We do not support Slack's `channel`, `icon_emoji`, `mrkdwn`, or `mrkdwn_in` properties. - -###### Query String Params - -| Field | Type | Description | Required | -|-----------|--------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------|----------| -| thread_id | snowflake | id of the thread to send the message in | false | -| wait | [boolean](/docs/reference#boolean-query-strings) | waits for server confirmation of message send before response (defaults to `true`; when `false` a message that is not saved does not return an error) | false | - -## Execute GitHub-Compatible Webhook -/webhooks/[\{webhook.id\}](/docs/resources/webhook#webhook-object)/[\{webhook.token\}](/docs/resources/webhook#webhook-object)/github - -[Add a new webhook](https://support.discord.com/hc/en-us/articles/228383668-Intro-to-Webhooks) to your GitHub repo (in the repo's settings), and use this endpoint as the "Payload URL." You can choose what events your Discord channel receives by choosing the "Let me select individual events" option and selecting individual events for the new webhook you're configuring. The supported [events](https://docs.github.com/en/webhooks/webhook-events-and-payloads) are `commit_comment`, `create`, `delete`, `fork`, `issue_comment`, `issues`, `member`, `public`, `pull_request`, `pull_request_review`, `pull_request_review_comment`, `push`, `release`, `watch`, `check_run`, `check_suite`, `discussion`, and `discussion_comment`. - -###### Query String Params - -| Field | Type | Description | Required | -|-----------|--------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------|----------| -| thread_id | snowflake | id of the thread to send the message in | false | -| wait | [boolean](/docs/reference#boolean-query-strings) | waits for server confirmation of message send before response (defaults to `true`; when `false` a message that is not saved does not return an error) | false | - -## Get Webhook Message -/webhooks/[\{webhook.id\}](/docs/resources/webhook#webhook-object)/[\{webhook.token\}](/docs/resources/webhook#webhook-object)/messages/[\{message.id\}](/docs/resources/message#message-object) - -Returns a previously-sent webhook message from the same token. Returns a [message](/docs/resources/message#message-object) object on success. - -###### Query String Params - -| Field | Type | Description | Required | -|-----------|-----------|------------------------------------|----------| -| thread_id | snowflake | id of the thread the message is in | false | - -## Edit Webhook Message -/webhooks/[\{webhook.id\}](/docs/resources/webhook#webhook-object)/[\{webhook.token\}](/docs/resources/webhook#webhook-object)/messages/[\{message.id\}](/docs/resources/message#message-object) - -Edits a previously-sent webhook message from the same token. Returns a [message](/docs/resources/message#message-object) object on success. - -When the `content` field is edited, the arrays `mentions` and `mention_roles` and the boolean `mention_everyone` in the message object will be reconstructed from scratch based on the new content. When the message flag `IS_COMPONENTS_V2` is set, the reconstructed arrays and boolean are based on the edited content in the `components` array. The `allowed_mentions` field of the edit request controls how this happens. If there is no explicit `allowed_mentions` in the edit request, the content will be parsed with _default_ allowances, that is, without regard to whether or not an `allowed_mentions` was present in the request that originally created the message. - -Refer to [Uploading Files](/docs/reference#uploading-files) for details on attachments and `multipart/form-data` requests. -Any provided files will be **appended** to the message. To remove or replace files you will have to supply the `attachments` field which specifies the files to retain on the message after edit. - -:::warn -Starting with API v10, the `attachments` array must contain all attachments that should be present after edit, including **retained and new** attachments provided in the request body. -::: - -:::info -All parameters to this endpoint are optional and nullable. -::: - -###### Query String Params - -| Field | Type | Description | Required | -|-----------------|--------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|----------| -| thread_id | snowflake | id of the thread the message is in | false | -| with_components | [boolean](/docs/reference#boolean-query-strings) | whether to respect the `components` field of the request. When enabled, allows application-owned webhooks to use all components and non-owned webhooks to use non-interactive components. (defaults to `false`) | false | - -###### JSON/Form Params - -| Field | Type | Description | -|---------------------|----------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| -| content | string | the message contents (up to 2000 characters) | -| embeds | array of up to 10 [embed](/docs/resources/message#embed-object) objects | embedded `rich` content | -| flags \* | integer | [message flags](/docs/resources/message#message-object-message-flags) combined as a [bitfield](https://en.wikipedia.org/wiki/Bit_field) (`SUPPRESS_EMBEDS` and `IS_COMPONENTS_V2` only) | -| allowed_mentions | [allowed mention object](/docs/resources/message#allowed-mentions-object) | allowed mentions for the message | -| components \*\* | array of [message component](/docs/components/reference#component-object) | the components to include with the message | -| files[n] \*\*\* | file contents | the contents of the file being sent/edited | -| payload_json \*\*\* | string | JSON encoded body of non-file params (multipart/form-data only) | -| attachments \*\*\* | array of partial [attachment](/docs/resources/message#attachment-object) objects | attached files to keep and possible descriptions for new files | -| poll \*\*\*\* | [poll](/docs/resources/poll#poll-create-request-object) request object | A poll! | - -\* The `SUPPRESS_EMBEDS` flag can be both set and unset, while the `IS_COMPONENTS_V2` flag can only be set. When the `IS_COMPONENTS_V2` flag is set, any of the used `content`, `embeds`, `files[n]` or `poll` values in the initial message must be set to `null` first, otherwise it will fail with a 400 BAD REQUEST response. - -\*\* Application-owned webhooks can always send components. Non-application-owned webhooks cannot send interactive components, and the `components` field will be ignored unless they set the `with_components` query param. - -\*\*\* See [Uploading Files](/docs/reference#uploading-files) for details. - -\*\*\*\* Polls can only be added when editing a deferred interaction response. - -## Delete Webhook Message -/webhooks/[\{webhook.id\}](/docs/resources/webhook#webhook-object)/[\{webhook.token\}](/docs/resources/webhook#webhook-object)/messages/[\{message.id\}](/docs/resources/message#message-object) - -Deletes a message that was created by the webhook. Returns a `204 No Content` response on success. - -###### Query String Params - -| Field | Type | Description | Required | -|-----------|-----------|------------------------------------|----------| -| thread_id | snowflake | id of the thread the message is in | false | diff --git a/docs/rich-presence/overview.mdx b/docs/rich-presence/overview.mdx deleted file mode 100644 index 23d2524a37..0000000000 --- a/docs/rich-presence/overview.mdx +++ /dev/null @@ -1,109 +0,0 @@ ---- -sidebar_label: Overview ---- - -# Overview of Rich Presence - -![Examples of Rich Presence data on Discord user profiles](images/rich-presence-examples.png) - -Rich Presence lets you display actionable data in a Discord user's profile about what they're up to in your game or app. The data you choose to display is up to you—whether it's a user's score, the duration they've been playing your game, what they're listening to on your platform, or something else. - ---- - -## Choosing an SDK - -There are three options when integrating Rich Presence. Depending on what you're building, you'll want to choose the right SDK for your project: - -- The **[Discord Social SDK](/docs/rich-presence/overview#discord-social-sdk)** allows you to build social features into your game or app, including friends lists, game invites, and more. -- The **[Embedded App SDK](/docs/rich-presence/overview#embedded-app-sdk)** should be used if you're building an [Activity](/docs/activities/overview) in Discord. -- The **[Game SDK (legacy)](/docs/rich-presence/overview#game-sdk)** can be used if you're building an off-platform game or app and you want to integrate it into Discord. - -All SDKs use similar underlying primitives (like the [`SET_ACTIVITY` RPC command](/docs/topics/rpc#setactivity)), so a lot is the same between them. But there are a few differences, like feature compatibility, which is covered in the sections below. - -:::info -Rich Presence data appears publicly on your Discord profile, so during development you should use a test account that only belongs to your private development server(s). -::: - -### Discord Social SDK - -The [Discord Social SDK](/docs/discord-social-sdk/overview) is used for building social features directly into your game. When a user is playing your game, you can show what they're up to in their Discord profile and even prompt their friends to join in with game invites. - -When integrating Rich Presence with an off-platform game, data can be shown about what a user is up to in your game. A "Join" button can also be configured to allow a user's friends to jump into their game and enable sending game invites. - -[Read about using Rich Presence with the Discord Social SDK](/docs/rich-presence/using-with-the-discord-social-sdk) - -### Embedded App SDK - -The [Embedded App SDK](/docs/developer-tools/embedded-app-sdk) is used to build Activities, which are multiplayer games and social experiences hosted in an iframe within Discord. The SDK handles communication between Discord and the Activity and helps integrate platform features (like Rich Presence!). - -After a user joins an Activity, Rich Presence can be used to dynamically show data about what that user is doing or playing, as well as prompt others to join in and play along. - -[Read about using Rich Presence with the Embedded App SDK](/docs/rich-presence/using-with-the-embedded-app-sdk) - -### Game SDK - -:::warn -**The Game SDK has been archived.** - -We recommend using the [Discord Social SDK](/docs/discord-social-sdk/overview) for new projects. - -Existing projects using the Game SDK will continue to work, but we encourage you to migrate to the [Discord Social SDK](/docs/discord-social-sdk/overview) for new features and updates. -::: - -The [Game SDK](/docs/developer-tools/game-sdk) makes it easier to build 3rd party games and integrate them with Discord. While many features of the Game SDK are deprecated, it can still be used for a few use cases (like integrating Rich Presence!). - -When integrating Rich Presence with an off-platform game, data can be shown about what a user is up to in your game. A "Join" button can also be configured to allow a user's friends to jump into their game. - -[Read about using Rich Presence with the Game SDK](/docs/rich-presence/using-with-the-game-sdk) - -## Adding Custom Art Assets - -While integrating Rich Presence, you'll likely want to upload custom art assets for your app. **For all Rich Presence assets, it's highly recommended to make them 1024 x 1024**. - -To add custom assets for Rich Presence, navigate to your [app's settings](https://discord.com/developers/applications) and click **Rich Presence** on the left-hand sidebar. On the **Art Assets** page, there are two different types of assets you can upload. - -### Invite Image - -The Rich Presence invite image appears when [invites](/docs/developer-tools/game-sdk#sendinvite) are sent for a 3rd party game or app using the [Game SDK](/docs/rich-presence/overview#game-sdk). After uploading an invite image for your app, you can see a preview of it to the right (under "IRL Invite Image Example"). - -:::info -The invite image can be ignored if you're building using the [Embedded App SDK](/docs/rich-presence/overview#embedded-app-sdk). Invites sent using the Embedded App SDK's[`openInviteDialog()`](/docs/developer-tools/embedded-app-sdk#openinvitedialog) use the Activity's cover art. -::: - -![Rich Presence invite image in app settings](images/rich-presence-invite-image.webp) - -### Assets - -Up to 300 custom assets can be added for your app to use when setting Rich Presence for a Discord user. These assets can be anything that help orient others to what a user is doing inside of your Activity or 3rd party game. - -If you need more than 300 custom assets or want to use images stored somewhere else, you can also [specify an external URL](/docs/events/gateway-events#activity-object-activity-asset-image) as long it still has the proper dimensions and size. - -:::info -For tips on choosing assets, take a look at the [Rich Presence best practices guide](/docs/rich-presence/best-practices#have-interesting-expressive-art). -::: - -When uploading Rich Presence assets, **the asset keys will automatically be changed to lowercase**. You can see this reflected in your app's settings after saving a newly-uploaded asset, and should keep it in mind when referencing any asset keys in your code. - -![Rich Presence assets in app settings](images/rich-presence-asset-images.webp) - -### Using the Visualizer - -:::warn -The Rich Presence visualizer currently uses an outdated Discord UI, but can still be helpful as a quick-and-dirty reference for what your Rich Presence data will look like in Discord. -::: - -In your app's settings, there's a Rich Presence visualizer to make it easier to see what your uploaded [assets](/docs/rich-presence/overview#assets) will look like in the context of a Discord profile. To access the visualizer, navigate to your [app's settings](https://discord.com/developers/applications) and click **Rich Presence** on the left-hand sidebar. On the **Visualizer** page, you can fill out some custom strings, party information, and select your uploaded assets to see a preview. - -## Start Building - - - - Guide on using Rich Presence in the Embedded App SDK while you're building an Activity - - - Guide on using Rich Presence in the Game SDK - - - Best practices and launch checklist for when you're integrating Rich Presence with your game or app - - \ No newline at end of file diff --git a/docs/rich-presence/using-with-the-discord-social-sdk.mdx b/docs/rich-presence/using-with-the-discord-social-sdk.mdx deleted file mode 100644 index 73c75c5c13..0000000000 --- a/docs/rich-presence/using-with-the-discord-social-sdk.mdx +++ /dev/null @@ -1,31 +0,0 @@ ---- -sidebar_label: Using with the Discord Social SDK ---- - -# Using Rich Presence with the Discord Social SDK - - -When developing a game, the [Discord Social SDK](/docs/discord-social-sdk/overview) makes it easy to integrate Rich Presence to display details about what a user is up to inside of your game or social experience. - -:::info -Not sure if you should be building with the Discord Social SDK? Read through [Choosing an SDK](/docs/rich-presence/overview#choosing-an-sdk) to understand your options when integrating Rich Presence with your app. -::: - - -## Understanding Rich Presence Data - -Before we dig in, it's helpful to understand what Rich Presence data you can set when updating a user's presence data. Let's just take a look at what we're working with: - -![Graphical representation of the legend for rich presence details](images/rp-legend.webp) - -:::info -For tips on designing Rich Presence, take a look at the [Rich Presence best practices guide](/docs/rich-presence/best-practices). -::: - -## Setting Rich Presence Data - -Check out our [Setting Rich Presence](/docs/discord-social-sdk/development-guides/setting-rich-presence) guide and our to learn how to set custom presence data for your players using the Discord Social SDK. - -- [Design Guidelines: Status & Rich Presence](/docs/discord-social-sdk/design-guidelines/status-rich-presence) - -![Rich Presence](images/social-sdk/design-guidelines/StatusPresence-06.webp) diff --git a/docs/rich-presence/using-with-the-embedded-app-sdk.mdx b/docs/rich-presence/using-with-the-embedded-app-sdk.mdx deleted file mode 100644 index d04a93cf81..0000000000 --- a/docs/rich-presence/using-with-the-embedded-app-sdk.mdx +++ /dev/null @@ -1,159 +0,0 @@ ---- -sidebar_label: Using with the Embedded App SDK ---- - -# Using Rich Presence with the Embedded App SDK - -When developing an [Activity](/docs/activities/overview), the [Embedded App SDK](/docs/developer-tools/embedded-app-sdk) makes it easy to integrate Rich Presence to display details about what a user is up to inside of your game or social experience. - -Rich Presence data can be thought of as an extension of your Activity—and leveling it up just a *little* makes it more interesting and relevant to the user playing your Activity (and their friends that might want to jump in and play). This guide provides an overview of the platform and technical knowledge you need to integrate Rich Presence with your existing Activity. - -:::info -Not sure if you should be building with the Embedded App SDK? Read through [Choosing an SDK](/docs/rich-presence/overview#choosing-an-sdk) to understand your options when integrating Rich Presence with your app. -::: - -The rest of the guide assumes you've already developed an [app](/docs/quick-start/overview-of-apps) that can launch an Activity. If you aren't at that point quite yet, you should follow the guide on [building your first Activity](/docs/activities/building-an-activity) before continuing. - -## Understanding Rich Presence Data - -### Default Rich Presence Data - -By default, when a user is connected to your Activity, the app's icon will appear on their profile. If the user viewing the profile has the ability to join, an "Ask to Join" button will be displayed as well. - -![Example of default Rich Presence data for an Activity](images/default-presence-activities.png) - -While this is okay, it's pretty limited and doesn't provide much context about what a user is actually *doing* inside of the Activity. In the following sections, we'll take a look at what richer and more actionable presence can look like. - -### Custom Rich Presence Data - -Now let's see what custom presence data can look like when a user joins your Activity. The [types for these fields](/docs/rich-presence/using-with-the-embedded-app-sdk#setactivity-fields) and [examples](/docs/rich-presence/using-with-the-embedded-app-sdk#setactivity-example) are in the sections below, but for now let's just get an idea of what we're working with: - -![Image of where Rich Presence data appears in Discord profiles for Activities](images/annotated-presence-data-activities.png) - -A few small things to note about the above image: -1. `large_image` and `small_image` are both in the `assets` object, which you can see below in the [table below](/docs/rich-presence/using-with-the-embedded-app-sdk#activity-partial-object). They're labeled with the object's keys to make it more clear how they appear in a Discord profile. -2. You can't set App Name when setting presence—it's always the name configured in your [app's settings](https://discord.com/developers/applications). -3. The state `(1 of max_party)` badge will only render when a party field is provided. Otherwise, state will be shown in a line of text below details. - -## Updating Presence - -When updating Rich Presence data using the Embedded App SDK, the only real command you need to use is **[`setActivity()`](/docs/developer-tools/embedded-app-sdk#setactivity)**. Under the hood, `setActivity()` calls the RPC [`SET_ACTIVITY` command](/docs/topics/rpc#setactivity) with the features and fields available when you're building an Activity. - - -As you start exploring the Rich Presence docs, you'll start seeing the word "activity" a *lot*. The "activities" referenced in docs (like the [RPC ones](/docs/topics/rpc#setactivity)) aren't related to the Activities you're building with the Embedded App SDK. - -When Rich Presence was introduced, the underlying object that contains presence data was called an "activity" (long before the Embedded App SDK), which is what the RPC [`SET_ACTIVITY` command](/docs/topics/rpc#setactivity) is referencing. And that's *also* why the Embedded App SDK's wrapper around the RPC command is called `setActivity()` yet isn't really related to setting the state for the kind of Activity that *you're* building. - -We know, it's confusing ¯\\\_(⊙︿⊙)\_/¯ — the naming was logical at the time because it was really about the user's activity in a 3rd party game or service, but now it sorta feels like activity-ception. Understanding the nuances here aren't super important, and it's why we have guides like this one. But as they say...the more you (at least sort of) know. - - -### rpc.activities.write Scope - -To display custom Rich Presence data for a user, your app will need to be authorized with the [`rpc.activities.write` scope](/docs/topics/oauth2#shared-resources-oauth2-scopes) for that user. - -To request the scope, your [`authorize()`](/docs/developer-tools/embedded-app-sdk#authorize) call might look something like this: - - - -:::info -The following example only focuses on calling `authorize()`. Follow the [Building an Activity guide](/docs/activities/building-an-activity) for more details on topics like installing and instantiating the Embedded App SDK. -::: - -```js -// Authorize with Discord Client -const { code } = await discordSdk.commands.authorize({ - client_id: import.meta.env.VITE_DISCORD_CLIENT_ID, - response_type: "code", - state: "", - prompt: "none", - scope: [ - "identify", - "rpc.activities.write" - ], -}); -``` - - -### setActivity Fields - -When calling [`setActivity()`](/docs/developer-tools/embedded-app-sdk#setactivity), you are expected to pass a partial [activity object](/docs/events/gateway-events#activity-object-activity-structure). - -Below is a table with many of the available fields for the activity partial. Some were left out since they don't have an effect for Activities. - -#### Activity partial object - -:::info -All of the fields on the partial object are optional and nullable -::: - -| field | type | description | -|------------|--------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------| -| type | integer | [Activity](/docs/events/gateway-events#activity-object-activity-types) type, which determines the header text for the Rich Presence data | -| state | string | User's current party status | -| details | string | What the player is currently doing in your Activity | -| timestamps | [timestamps](/docs/events/gateway-events#activity-object-activity-timestamps) object | Unix timestamps to display start and/or end times | -| assets | [assets](/docs/events/gateway-events#activity-object-activity-assets) object | Images used for the Rich Presence data (and their hover texts) | -| party | [party](/docs/events/gateway-events#activity-object-activity-party) object | Information for the current party of the player | - -### setActivity Example - -Now let's take a look at more of a real example. Take a look at the Rich Presence data below that is for an Activity: - -![Example of a fake game's Rich Presence data](images/activities-presence-example.png) - -To create this sort of Rich Presence, here is what the `setActivity()` code would look like: - - - -:::info -The following example only focuses on using `setActivity()`. Follow the [Building an Activity guide](/docs/activities/building-an-activity) for more details on topics like instantiating the Embedded App SDK and authenticating users. -::: -```js -await discordSdk.commands.setActivity({ - activity: { - type: 0, - details: 'Traveling with a group', - state: 'In Mainframe', - assets: { - large_image: 'main-game-image', - large_text: 'in a group', - small_image: 'map-mainframe', - small_text: 'in mainframe' - }, - timestamps: { - start: 1723137832 - }, - party: { - size: [2,4] - } - } -}); -``` - - -## Using External Custom Assets - -Typically when building an Activity, you need to be aware of the proxy and [how to use external resources](/docs/activities/development-guides/networking#using-external-resources). However, lucikly for you (and the writer of this guide), image URLs in fields for features like Rich Presence don't need to jump through any extra hoops. - -As mentioned in the [Rich Presence overview](/docs/rich-presence/overview#assets), you have more than 300 custom assets or if you want to use your stored images from somewhere else, you can specify an external URL for `large_image` or `small_image` within the `assets` object. - - - -:::info -The following example only focuses on using `setActivity()`. Follow the [Building an Activity guide](/docs/activities/building-an-activity) for more details on topics like instantiating the Embedded App SDK and authenticating users. -::: -```js -await discordSdk.commands.setActivity({ - activity: { - type: 2, - state: 'Broken Hearts and Code (club edit)', - details: 'DJ Wump', - assets: { - large_image: 'https://example.com/album-covers/dj-wump/broken-code-and-hearts-club-edit.jpg', - large_text: 'Listening to a track', - } - } -}); -``` - - diff --git a/index.js b/index.js deleted file mode 100644 index f053ebf797..0000000000 --- a/index.js +++ /dev/null @@ -1 +0,0 @@ -module.exports = {}; diff --git a/static/images/activities/activities-hero.webp b/static/images/activities/activities-hero.webp deleted file mode 100644 index fa9f7c5cf6..0000000000 Binary files a/static/images/activities/activities-hero.webp and /dev/null differ diff --git a/static/images/activities/activity-instance-validation.webp b/static/images/activities/activity-instance-validation.webp deleted file mode 100644 index 4e11535574..0000000000 Binary files a/static/images/activities/activity-instance-validation.webp and /dev/null differ diff --git a/static/images/activities/application-test-mode-prod.webp b/static/images/activities/application-test-mode-prod.webp deleted file mode 100644 index 378e5718c4..0000000000 Binary files a/static/images/activities/application-test-mode-prod.webp and /dev/null differ diff --git a/static/images/activities/bobble-bash.webp b/static/images/activities/bobble-bash.webp deleted file mode 100644 index 2e0d013092..0000000000 Binary files a/static/images/activities/bobble-bash.webp and /dev/null differ diff --git a/static/images/activities/bobble-league.webp b/static/images/activities/bobble-league.webp deleted file mode 100644 index f4b570dca0..0000000000 Binary files a/static/images/activities/bobble-league.webp and /dev/null differ diff --git a/static/images/activities/chess-victory.webp b/static/images/activities/chess-victory.webp deleted file mode 100644 index 57ae1ef6c3..0000000000 Binary files a/static/images/activities/chess-victory.webp and /dev/null differ diff --git a/static/images/activities/custom-link-embed.webp b/static/images/activities/custom-link-embed.webp deleted file mode 100644 index e14bd18041..0000000000 Binary files a/static/images/activities/custom-link-embed.webp and /dev/null differ diff --git a/static/images/activities/debug-logs-filtering.webp b/static/images/activities/debug-logs-filtering.webp deleted file mode 100644 index e588836ca5..0000000000 Binary files a/static/images/activities/debug-logs-filtering.webp and /dev/null differ diff --git a/static/images/activities/default_orientation_lock_state.webp b/static/images/activities/default_orientation_lock_state.webp deleted file mode 100644 index 9dc4d92160..0000000000 Binary files a/static/images/activities/default_orientation_lock_state.webp and /dev/null differ diff --git a/static/images/activities/eights.webp b/static/images/activities/eights.webp deleted file mode 100644 index adaf0a25e1..0000000000 Binary files a/static/images/activities/eights.webp and /dev/null differ diff --git a/static/images/activities/enable-activities.webp b/static/images/activities/enable-activities.webp deleted file mode 100644 index 9a7b8694df..0000000000 Binary files a/static/images/activities/enable-activities.webp and /dev/null differ diff --git a/static/images/activities/encourage-hardware-acceleration-modal.webp b/static/images/activities/encourage-hardware-acceleration-modal.webp deleted file mode 100644 index ac27d5c15d..0000000000 Binary files a/static/images/activities/encourage-hardware-acceleration-modal.webp and /dev/null differ diff --git a/static/images/activities/external-link-modal.webp b/static/images/activities/external-link-modal.webp deleted file mode 100644 index 37f88a6d52..0000000000 Binary files a/static/images/activities/external-link-modal.webp and /dev/null differ diff --git a/static/images/activities/invite-dialog.webp b/static/images/activities/invite-dialog.webp deleted file mode 100644 index e88ba76e0b..0000000000 Binary files a/static/images/activities/invite-dialog.webp and /dev/null differ diff --git a/static/images/activities/join-application.webp b/static/images/activities/join-application.webp deleted file mode 100644 index 69797180a6..0000000000 Binary files a/static/images/activities/join-application.webp and /dev/null differ diff --git a/static/images/activities/oauth-flow-diagram.svg b/static/images/activities/oauth-flow-diagram.svg deleted file mode 100644 index e644050c51..0000000000 --- a/static/images/activities/oauth-flow-diagram.svg +++ /dev/null @@ -1 +0,0 @@ -Discord APIApplication-ServerApplication-IframeDiscord-ClientDiscord APIApplication-ServerApplication-IframeDiscord-ClientRequest to authorize scopes(This step opens the OAuth modal)Reply with OAuth authorize codeSend OAuth code to application serverUse OAuth code and client secretto fetch access_token from developer portalReply with access_tokenReply with access_tokenApplication Instance Validation \ No newline at end of file diff --git a/static/images/activities/oauth2-redirect.webp b/static/images/activities/oauth2-redirect.webp deleted file mode 100644 index 2cdb336af0..0000000000 Binary files a/static/images/activities/oauth2-redirect.webp and /dev/null differ diff --git a/static/images/activities/share-moment-dialog-example.webp b/static/images/activities/share-moment-dialog-example.webp deleted file mode 100644 index bd3c8b6d70..0000000000 Binary files a/static/images/activities/share-moment-dialog-example.webp and /dev/null differ diff --git a/static/images/activities/start-activity.webp b/static/images/activities/start-activity.webp deleted file mode 100644 index 6041d42920..0000000000 Binary files a/static/images/activities/start-activity.webp and /dev/null differ diff --git a/static/images/activities/supported-platforms.webp b/static/images/activities/supported-platforms.webp deleted file mode 100644 index e736bcdbb5..0000000000 Binary files a/static/images/activities/supported-platforms.webp and /dev/null differ diff --git a/static/images/activities/tutorial-auth.webp b/static/images/activities/tutorial-auth.webp deleted file mode 100644 index c8fa2f7546..0000000000 Binary files a/static/images/activities/tutorial-auth.webp and /dev/null differ diff --git a/static/images/activities/tutorial-channel-name.webp b/static/images/activities/tutorial-channel-name.webp deleted file mode 100644 index 4a29930e6d..0000000000 Binary files a/static/images/activities/tutorial-channel-name.webp and /dev/null differ diff --git a/static/images/activities/tutorial-hero.webp b/static/images/activities/tutorial-hero.webp deleted file mode 100644 index 3dfada4199..0000000000 Binary files a/static/images/activities/tutorial-hero.webp and /dev/null differ diff --git a/static/images/activities/url-mapping-do.webp b/static/images/activities/url-mapping-do.webp deleted file mode 100644 index 4ee4ad7bc4..0000000000 Binary files a/static/images/activities/url-mapping-do.webp and /dev/null differ diff --git a/static/images/activities/url-mapping-dont.webp b/static/images/activities/url-mapping-dont.webp deleted file mode 100644 index ebdfa4f9f9..0000000000 Binary files a/static/images/activities/url-mapping-dont.webp and /dev/null differ diff --git a/static/images/activities/url-mapping-tutorial.webp b/static/images/activities/url-mapping-tutorial.webp deleted file mode 100644 index 2642f6526e..0000000000 Binary files a/static/images/activities/url-mapping-tutorial.webp and /dev/null differ diff --git a/static/images/social-sdk/design-guidelines/Brand-02.webp b/static/images/social-sdk/design-guidelines/Brand-02.webp deleted file mode 100644 index 0b2bf8cddc..0000000000 Binary files a/static/images/social-sdk/design-guidelines/Brand-02.webp and /dev/null differ diff --git a/static/images/social-sdk/design-guidelines/Brand-03.webp b/static/images/social-sdk/design-guidelines/Brand-03.webp deleted file mode 100644 index 4badb33ef5..0000000000 Binary files a/static/images/social-sdk/design-guidelines/Brand-03.webp and /dev/null differ diff --git a/static/images/social-sdk/design-guidelines/Brand-04.webp b/static/images/social-sdk/design-guidelines/Brand-04.webp deleted file mode 100644 index 98b0ce16fe..0000000000 Binary files a/static/images/social-sdk/design-guidelines/Brand-04.webp and /dev/null differ diff --git a/static/images/social-sdk/design-guidelines/ConnectionPoints-03.webp b/static/images/social-sdk/design-guidelines/ConnectionPoints-03.webp deleted file mode 100644 index bc7f476ea5..0000000000 Binary files a/static/images/social-sdk/design-guidelines/ConnectionPoints-03.webp and /dev/null differ diff --git a/static/images/social-sdk/design-guidelines/ConnectionPoints-04.webp b/static/images/social-sdk/design-guidelines/ConnectionPoints-04.webp deleted file mode 100644 index 07bc34b844..0000000000 Binary files a/static/images/social-sdk/design-guidelines/ConnectionPoints-04.webp and /dev/null differ diff --git a/static/images/social-sdk/design-guidelines/ConnectionPoints-05.webp b/static/images/social-sdk/design-guidelines/ConnectionPoints-05.webp deleted file mode 100644 index 9490690523..0000000000 Binary files a/static/images/social-sdk/design-guidelines/ConnectionPoints-05.webp and /dev/null differ diff --git a/static/images/social-sdk/design-guidelines/Consoles-02.webp b/static/images/social-sdk/design-guidelines/Consoles-02.webp deleted file mode 100644 index 681cfb3c09..0000000000 Binary files a/static/images/social-sdk/design-guidelines/Consoles-02.webp and /dev/null differ diff --git a/static/images/social-sdk/design-guidelines/Consoles-03.webp b/static/images/social-sdk/design-guidelines/Consoles-03.webp deleted file mode 100644 index 0bd58fa800..0000000000 Binary files a/static/images/social-sdk/design-guidelines/Consoles-03.webp and /dev/null differ diff --git a/static/images/social-sdk/design-guidelines/Consoles-04.webp b/static/images/social-sdk/design-guidelines/Consoles-04.webp deleted file mode 100644 index ba10e2d148..0000000000 Binary files a/static/images/social-sdk/design-guidelines/Consoles-04.webp and /dev/null differ diff --git a/static/images/social-sdk/design-guidelines/Consoles-05.webp b/static/images/social-sdk/design-guidelines/Consoles-05.webp deleted file mode 100644 index 50f1b420be..0000000000 Binary files a/static/images/social-sdk/design-guidelines/Consoles-05.webp and /dev/null differ diff --git a/static/images/social-sdk/design-guidelines/Consoles-06.webp b/static/images/social-sdk/design-guidelines/Consoles-06.webp deleted file mode 100644 index 390e35f911..0000000000 Binary files a/static/images/social-sdk/design-guidelines/Consoles-06.webp and /dev/null differ diff --git a/static/images/social-sdk/design-guidelines/DMs-03.webp b/static/images/social-sdk/design-guidelines/DMs-03.webp deleted file mode 100644 index b0e509c2a5..0000000000 Binary files a/static/images/social-sdk/design-guidelines/DMs-03.webp and /dev/null differ diff --git a/static/images/social-sdk/design-guidelines/DMs-04.webp b/static/images/social-sdk/design-guidelines/DMs-04.webp deleted file mode 100644 index 08812efd63..0000000000 Binary files a/static/images/social-sdk/design-guidelines/DMs-04.webp and /dev/null differ diff --git a/static/images/social-sdk/design-guidelines/GameFriends-02.webp b/static/images/social-sdk/design-guidelines/GameFriends-02.webp deleted file mode 100644 index dfe73b6fb1..0000000000 Binary files a/static/images/social-sdk/design-guidelines/GameFriends-02.webp and /dev/null differ diff --git a/static/images/social-sdk/design-guidelines/GameFriends-03.webp b/static/images/social-sdk/design-guidelines/GameFriends-03.webp deleted file mode 100644 index 259f7f5419..0000000000 Binary files a/static/images/social-sdk/design-guidelines/GameFriends-03.webp and /dev/null differ diff --git a/static/images/social-sdk/design-guidelines/GameFriends-04.webp b/static/images/social-sdk/design-guidelines/GameFriends-04.webp deleted file mode 100644 index 4723fdd023..0000000000 Binary files a/static/images/social-sdk/design-guidelines/GameFriends-04.webp and /dev/null differ diff --git a/static/images/social-sdk/design-guidelines/GameFriends-05.webp b/static/images/social-sdk/design-guidelines/GameFriends-05.webp deleted file mode 100644 index aa3908ae26..0000000000 Binary files a/static/images/social-sdk/design-guidelines/GameFriends-05.webp and /dev/null differ diff --git a/static/images/social-sdk/design-guidelines/GameFriends-06.webp b/static/images/social-sdk/design-guidelines/GameFriends-06.webp deleted file mode 100644 index abbee0638a..0000000000 Binary files a/static/images/social-sdk/design-guidelines/GameFriends-06.webp and /dev/null differ diff --git a/static/images/social-sdk/design-guidelines/GameFriends-07.webp b/static/images/social-sdk/design-guidelines/GameFriends-07.webp deleted file mode 100644 index 8c8e304704..0000000000 Binary files a/static/images/social-sdk/design-guidelines/GameFriends-07.webp and /dev/null differ diff --git a/static/images/social-sdk/design-guidelines/GameFriends-08.webp b/static/images/social-sdk/design-guidelines/GameFriends-08.webp deleted file mode 100644 index 90deeade66..0000000000 Binary files a/static/images/social-sdk/design-guidelines/GameFriends-08.webp and /dev/null differ diff --git a/static/images/social-sdk/design-guidelines/GameFriends-09.webp b/static/images/social-sdk/design-guidelines/GameFriends-09.webp deleted file mode 100644 index c10b5ab071..0000000000 Binary files a/static/images/social-sdk/design-guidelines/GameFriends-09.webp and /dev/null differ diff --git a/static/images/social-sdk/design-guidelines/GameFriends-10.webp b/static/images/social-sdk/design-guidelines/GameFriends-10.webp deleted file mode 100644 index 213bef9dd1..0000000000 Binary files a/static/images/social-sdk/design-guidelines/GameFriends-10.webp and /dev/null differ diff --git a/static/images/social-sdk/design-guidelines/LinkedChannels-04.webp b/static/images/social-sdk/design-guidelines/LinkedChannels-04.webp deleted file mode 100644 index 0d8b24f4b5..0000000000 Binary files a/static/images/social-sdk/design-guidelines/LinkedChannels-04.webp and /dev/null differ diff --git a/static/images/social-sdk/design-guidelines/LinkedChannels-05.webp b/static/images/social-sdk/design-guidelines/LinkedChannels-05.webp deleted file mode 100644 index 6d09cf065f..0000000000 Binary files a/static/images/social-sdk/design-guidelines/LinkedChannels-05.webp and /dev/null differ diff --git a/static/images/social-sdk/design-guidelines/LinkedChannels-06.webp b/static/images/social-sdk/design-guidelines/LinkedChannels-06.webp deleted file mode 100644 index 0ac5e574d4..0000000000 Binary files a/static/images/social-sdk/design-guidelines/LinkedChannels-06.webp and /dev/null differ diff --git a/static/images/social-sdk/design-guidelines/LinkedChannels-07.webp b/static/images/social-sdk/design-guidelines/LinkedChannels-07.webp deleted file mode 100644 index 800703edc3..0000000000 Binary files a/static/images/social-sdk/design-guidelines/LinkedChannels-07.webp and /dev/null differ diff --git a/static/images/social-sdk/design-guidelines/Principle-03.webp b/static/images/social-sdk/design-guidelines/Principle-03.webp deleted file mode 100644 index b52e636a47..0000000000 Binary files a/static/images/social-sdk/design-guidelines/Principle-03.webp and /dev/null differ diff --git a/static/images/social-sdk/design-guidelines/Principle-04.webp b/static/images/social-sdk/design-guidelines/Principle-04.webp deleted file mode 100644 index b38cceee73..0000000000 Binary files a/static/images/social-sdk/design-guidelines/Principle-04.webp and /dev/null differ diff --git a/static/images/social-sdk/design-guidelines/Principle-05.webp b/static/images/social-sdk/design-guidelines/Principle-05.webp deleted file mode 100644 index ed0e262fb4..0000000000 Binary files a/static/images/social-sdk/design-guidelines/Principle-05.webp and /dev/null differ diff --git a/static/images/social-sdk/design-guidelines/Principle-06.webp b/static/images/social-sdk/design-guidelines/Principle-06.webp deleted file mode 100644 index 37cd2e784f..0000000000 Binary files a/static/images/social-sdk/design-guidelines/Principle-06.webp and /dev/null differ diff --git a/static/images/social-sdk/design-guidelines/Principle-07.webp b/static/images/social-sdk/design-guidelines/Principle-07.webp deleted file mode 100644 index cb604d69ad..0000000000 Binary files a/static/images/social-sdk/design-guidelines/Principle-07.webp and /dev/null differ diff --git a/static/images/social-sdk/design-guidelines/Prov-02.webp b/static/images/social-sdk/design-guidelines/Prov-02.webp deleted file mode 100644 index ec407aa279..0000000000 Binary files a/static/images/social-sdk/design-guidelines/Prov-02.webp and /dev/null differ diff --git a/static/images/social-sdk/design-guidelines/Prov-03.webp b/static/images/social-sdk/design-guidelines/Prov-03.webp deleted file mode 100644 index d2accb4826..0000000000 Binary files a/static/images/social-sdk/design-guidelines/Prov-03.webp and /dev/null differ diff --git a/static/images/social-sdk/design-guidelines/Prov-04.webp b/static/images/social-sdk/design-guidelines/Prov-04.webp deleted file mode 100644 index 8fc171591c..0000000000 Binary files a/static/images/social-sdk/design-guidelines/Prov-04.webp and /dev/null differ diff --git a/static/images/social-sdk/design-guidelines/Prov-05.webp b/static/images/social-sdk/design-guidelines/Prov-05.webp deleted file mode 100644 index c0d0768d7b..0000000000 Binary files a/static/images/social-sdk/design-guidelines/Prov-05.webp and /dev/null differ diff --git a/static/images/social-sdk/design-guidelines/SigningIn-02.webp b/static/images/social-sdk/design-guidelines/SigningIn-02.webp deleted file mode 100644 index dbe0bee267..0000000000 Binary files a/static/images/social-sdk/design-guidelines/SigningIn-02.webp and /dev/null differ diff --git a/static/images/social-sdk/design-guidelines/SigningIn-05.webp b/static/images/social-sdk/design-guidelines/SigningIn-05.webp deleted file mode 100644 index 1f31f41df0..0000000000 Binary files a/static/images/social-sdk/design-guidelines/SigningIn-05.webp and /dev/null differ diff --git a/static/images/social-sdk/design-guidelines/SigningIn-06.webp b/static/images/social-sdk/design-guidelines/SigningIn-06.webp deleted file mode 100644 index 6688ece0de..0000000000 Binary files a/static/images/social-sdk/design-guidelines/SigningIn-06.webp and /dev/null differ diff --git a/static/images/social-sdk/design-guidelines/SigningIn-07.webp b/static/images/social-sdk/design-guidelines/SigningIn-07.webp deleted file mode 100644 index b0b44ffe85..0000000000 Binary files a/static/images/social-sdk/design-guidelines/SigningIn-07.webp and /dev/null differ diff --git a/static/images/social-sdk/design-guidelines/SigningIn-08.webp b/static/images/social-sdk/design-guidelines/SigningIn-08.webp deleted file mode 100644 index 30cd576ad7..0000000000 Binary files a/static/images/social-sdk/design-guidelines/SigningIn-08.webp and /dev/null differ diff --git a/static/images/social-sdk/design-guidelines/StatusPresence-02.webp b/static/images/social-sdk/design-guidelines/StatusPresence-02.webp deleted file mode 100644 index fae0204a62..0000000000 Binary files a/static/images/social-sdk/design-guidelines/StatusPresence-02.webp and /dev/null differ diff --git a/static/images/social-sdk/design-guidelines/StatusPresence-03.webp b/static/images/social-sdk/design-guidelines/StatusPresence-03.webp deleted file mode 100644 index 1bd3cf6656..0000000000 Binary files a/static/images/social-sdk/design-guidelines/StatusPresence-03.webp and /dev/null differ diff --git a/static/images/social-sdk/design-guidelines/StatusPresence-04.webp b/static/images/social-sdk/design-guidelines/StatusPresence-04.webp deleted file mode 100644 index 1779f5a150..0000000000 Binary files a/static/images/social-sdk/design-guidelines/StatusPresence-04.webp and /dev/null differ diff --git a/static/images/social-sdk/design-guidelines/StatusPresence-05.webp b/static/images/social-sdk/design-guidelines/StatusPresence-05.webp deleted file mode 100644 index 10cfde0061..0000000000 Binary files a/static/images/social-sdk/design-guidelines/StatusPresence-05.webp and /dev/null differ diff --git a/static/images/social-sdk/design-guidelines/StatusPresence-06.webp b/static/images/social-sdk/design-guidelines/StatusPresence-06.webp deleted file mode 100644 index cfde921624..0000000000 Binary files a/static/images/social-sdk/design-guidelines/StatusPresence-06.webp and /dev/null differ diff --git a/static/images/social-sdk/design-guidelines/UFL-02.webp b/static/images/social-sdk/design-guidelines/UFL-02.webp deleted file mode 100644 index eda3d45053..0000000000 Binary files a/static/images/social-sdk/design-guidelines/UFL-02.webp and /dev/null differ diff --git a/static/images/social-sdk/design-guidelines/UFL-03.webp b/static/images/social-sdk/design-guidelines/UFL-03.webp deleted file mode 100644 index 27cdb10190..0000000000 Binary files a/static/images/social-sdk/design-guidelines/UFL-03.webp and /dev/null differ diff --git a/static/images/social-sdk/design-guidelines/UFL-04.webp b/static/images/social-sdk/design-guidelines/UFL-04.webp deleted file mode 100644 index 042be47379..0000000000 Binary files a/static/images/social-sdk/design-guidelines/UFL-04.webp and /dev/null differ diff --git a/static/images/social-sdk/design-guidelines/UFL-05.webp b/static/images/social-sdk/design-guidelines/UFL-05.webp deleted file mode 100644 index 43e1205ff0..0000000000 Binary files a/static/images/social-sdk/design-guidelines/UFL-05.webp and /dev/null differ diff --git a/static/images/social-sdk/design-guidelines/UFL-07.webp b/static/images/social-sdk/design-guidelines/UFL-07.webp deleted file mode 100644 index 4603c86e00..0000000000 Binary files a/static/images/social-sdk/design-guidelines/UFL-07.webp and /dev/null differ diff --git a/static/images/social-sdk/design-guidelines/UFL-08.webp b/static/images/social-sdk/design-guidelines/UFL-08.webp deleted file mode 100644 index ae143b87c7..0000000000 Binary files a/static/images/social-sdk/design-guidelines/UFL-08.webp and /dev/null differ diff --git a/static/images/social-sdk/design-guidelines/animated/Connecting-via-Browser.webp b/static/images/social-sdk/design-guidelines/animated/Connecting-via-Browser.webp deleted file mode 100644 index e80c91f098..0000000000 Binary files a/static/images/social-sdk/design-guidelines/animated/Connecting-via-Browser.webp and /dev/null differ diff --git a/static/images/social-sdk/design-guidelines/animated/Connecting-via-Client.webp b/static/images/social-sdk/design-guidelines/animated/Connecting-via-Client.webp deleted file mode 100644 index e2712b31a5..0000000000 Binary files a/static/images/social-sdk/design-guidelines/animated/Connecting-via-Client.webp and /dev/null differ diff --git a/static/images/social-sdk/design-guidelines/animated/LinkedChannel-Setup.webp b/static/images/social-sdk/design-guidelines/animated/LinkedChannel-Setup.webp deleted file mode 100644 index 246c75450c..0000000000 Binary files a/static/images/social-sdk/design-guidelines/animated/LinkedChannel-Setup.webp and /dev/null differ diff --git a/static/images/social-sdk/development-guides/authorize_device.webp b/static/images/social-sdk/development-guides/authorize_device.webp deleted file mode 100644 index 7b1edd6307..0000000000 Binary files a/static/images/social-sdk/development-guides/authorize_device.webp and /dev/null differ diff --git a/static/images/social-sdk/development-guides/discord-game-dm-settings.webp b/static/images/social-sdk/development-guides/discord-game-dm-settings.webp deleted file mode 100644 index 82ce3c041a..0000000000 Binary files a/static/images/social-sdk/development-guides/discord-game-dm-settings.webp and /dev/null differ diff --git a/static/images/social-sdk/getting-started/partials/error.webp b/static/images/social-sdk/getting-started/partials/error.webp deleted file mode 100644 index 89633291aa..0000000000 Binary files a/static/images/social-sdk/getting-started/partials/error.webp and /dev/null differ diff --git a/static/images/social-sdk/getting-started/partials/open-anyway.webp b/static/images/social-sdk/getting-started/partials/open-anyway.webp deleted file mode 100644 index 8fcd47f55f..0000000000 Binary files a/static/images/social-sdk/getting-started/partials/open-anyway.webp and /dev/null differ diff --git a/static/images/social-sdk/integrating-moderation/message-receiving.svg b/static/images/social-sdk/integrating-moderation/message-receiving.svg deleted file mode 100644 index b108affd72..0000000000 --- a/static/images/social-sdk/integrating-moderation/message-receiving.svg +++ /dev/null @@ -1 +0,0 @@ -Moderation BackendGame ClientDiscord Social SDKModeration BackendGame ClientDiscord Social SDKMessage arrives for subscribed channel/userPerform validation logicRender received message in game UIDiscard message (do not render)alt[Message is Valid (isValid: true)][Message is Invalid (isValid:false)]Trigger Client::SetMessageCreatedCallback(message)POST /validate (receivedMessage)Response (isValid: boolean) \ No newline at end of file diff --git a/static/images/social-sdk/integrating-moderation/message-sending.svg b/static/images/social-sdk/integrating-moderation/message-sending.svg deleted file mode 100644 index d348e9a9c5..0000000000 --- a/static/images/social-sdk/integrating-moderation/message-sending.svg +++ /dev/null @@ -1 +0,0 @@ -DiscordDiscord Social SDKModeration BackendGameClientUserDiscordDiscord Social SDKModeration BackendGameClientUserOptimistically render message in UIPerform validation logicConfirm message sent (update UI if needed)Remove optimistically rendered message from UIalt[Message is Valid (isValid: true)][Message is Invalid (isValid: false)]Enters and submits message textPOST /validate (message)Response (isValid: boolean, moderatedText?: string)Client::SendUserMessage(recipient, message)Forward messageMessage Acknowledged (messageId)Callback(result: Success, messageId)Notify: "Message violated content policy" \ No newline at end of file diff --git a/static/images/social-sdk/integrating-moderation/platform-bans.svg b/static/images/social-sdk/integrating-moderation/platform-bans.svg deleted file mode 100644 index 68a9c01dfc..0000000000 --- a/static/images/social-sdk/integrating-moderation/platform-bans.svg +++ /dev/null @@ -1 +0,0 @@ -DiscordGame BackendNon-Discord Auth ProviderGameUserDiscordGame BackendNon-Discord Auth ProviderGameUserStore externalAuthTokenStores externalAuthToken against Discord accountMaintain externalAuthToken recordalt[Discord Authentication Fails (Ban or Other Issue)]Start gameCreate accountAuthentication successfulRequest provisional accountCreate provisional accountAccount createdReturn Provisional AccountChoose to link Discord accountRequest authenticationAuth successfulRequest account mergeMerge Provisional AccountMerge successfulAttempt to loginRequest authenticationAuth failedFallback authenticationAuthentication successfulAccess provisional account with externalAuthTokenAccess granted with in-game friends listAccess game \ No newline at end of file diff --git a/static/images/social-sdk/overview/social_sdk_header.webp b/static/images/social-sdk/overview/social_sdk_header.webp deleted file mode 100644 index b18e330f44..0000000000 Binary files a/static/images/social-sdk/overview/social_sdk_header.webp and /dev/null differ diff --git a/.prettierrc.json b/tools/.prettierrc.json similarity index 100% rename from .prettierrc.json rename to tools/.prettierrc.json diff --git a/tools/checkBuild.ts b/tools/checkBuild.ts index b8a18e1f7d..f4c5aded44 100644 --- a/tools/checkBuild.ts +++ b/tools/checkBuild.ts @@ -6,7 +6,7 @@ const args = process.argv.slice(2); const bail = args.includes("--bail"); const ROOT_DIR = path.join(import.meta.dirname, ".."); -const DOCS_DIR = path.join(ROOT_DIR, "docs"); +const DOCS_DIR = path.join(ROOT_DIR, "discord", "developers", "docs"); const extensions = [".mdx", ".md"]; let hasErrors = false; diff --git a/tools/checkLinks.ts b/tools/checkLinks.ts deleted file mode 100644 index 47be96bc7a..0000000000 --- a/tools/checkLinks.ts +++ /dev/null @@ -1,216 +0,0 @@ -import { readdirSync, statSync, readFileSync } from "node:fs"; -import path from "node:path"; -import chalk from "chalk"; -import * as github from "@actions/core"; -import * as yaml from "js-yaml"; -const cwd = process.env.GITHUB_ACTIONS ? process.env.GITHUB_WORKSPACE! : process.cwd(); - -interface Frontmatter { - title?: string; - date?: string; - breaking: boolean; -} - -function importDirectory(directory: string, extensions: string[], subdirectories = true) { - try { - const output = new Map(); - const files = readdirSync(directory); - for (const fileOrPath of files) { - const currentPath = path.join(directory, fileOrPath); - if (statSync(currentPath).isDirectory()) { - if (!subdirectories) continue; - const subdir = importDirectory(currentPath, extensions, subdirectories); - if (!subdir) continue; - for (const [name, read] of subdir) { - output.set(`/${fileOrPath}${name}`, read); - } - continue; - } - const currentPathParts = path.parse(currentPath); - if (!extensions.some((ex) => ex === currentPathParts.ext)) continue; - const read = readFileSync(currentPath, "utf8"); - output.set(`/${currentPathParts.name}`, read); - } - return output; - } catch { - // Directory likely does not exist, we should be able to safely discard this error - return null; - } -} - -function printResults(resultMap: Map): void { - let output = "\n"; - let total = 0; - for (const [resultFile, resultArr] of resultMap) { - if (resultArr.length <= 0) continue; - const filePath = path.join(cwd, resultFile); - output += `${chalk.underline(filePath)}\n`; - output += resultArr.reduce((result, props) => { - total += 1; - return `${result} ${props.startLine ?? ""}:${props.startColumn ?? ""}-${props.endColumn ?? ""} ${chalk.yellow( - "warning", - )} ${props.title ?? ""}\n`; - }, ""); - output += "\n"; - } - output += "\n"; - if (total > 0) { - output += chalk.red.bold(`\u2716 ${total} problem${total === 1 ? "" : "s"}\n`); - } - console.log(output); -} - -function annotateResults(resultMap: Map): void { - let total = 0; - for (const [resultFile, resultArr] of resultMap) { - if (resultArr.length <= 0) continue; - github.startGroup(resultFile); - for (const result of resultArr) { - total += 1; - console.log( - `::warning file=${resultFile},title=Invalid Link,line=${result.startLine ?? 0},endLine=${ - result.startLine ?? 0 - },col=${result.startColumn ?? 0},endColumn=${result.endColumn ?? result.startColumn ?? 0}::${ - result.title ?? "Invalid Link" - }`, - ); - } - github.endGroup(); - } - if (total > 0) { - github.setFailed("One or more links are invalid!"); - } -} - -function* concatIterables(...iterables: IterableIterator[]) { - for (const iterable of iterables) { - for (const value of iterable) { - yield value; - } - } -} - -const docFiles = importDirectory(path.join(cwd, "docs"), [".md", ".mdx"]); - -if (!docFiles) { - console.error("No doc files found!"); - process.exit(1); -} - -const validLinks = new Map([ - ["APPLICATIONS", []], - ["SERVERS", []], - ["TEAMS", []], -]); - -// Gather valid links -const changelogAnchors = []; -for (const [name, raw] of docFiles) { - const keyName = `/docs${name}`; - if (!validLinks.has(keyName)) { - validLinks.set(keyName, []); - } - const validAnchors = validLinks.get(keyName)!; - - // The changelog is unique in that each entry acts as it's own potential page, - // and each entry can be represented in a single page under it's own H2. - // This collects all potential change-log pages, and adds them to the list of - // available anchors under `/change-log`. - if (name.startsWith("/change-log/")) { - const frontmatter = raw.split("---")[1]; - const parsedFrontmatter = yaml.load(frontmatter) as Frontmatter; - const title = parsedFrontmatter?.title; - if (title) { - const anchor = title - .replace(/[^ A-Z0-9]/gi, "") - .trim() - .replace(/ +/g, "-") - .toLowerCase(); - changelogAnchors.push(anchor); - } - } - - let parentAnchor = ""; - let multilineCode = false; - for (const line of raw.split("\n")) { - if (line.trim().startsWith("```")) { - multilineCode = !multilineCode; - if (line.trim().length > 3 && line.trim().endsWith("```")) multilineCode = !multilineCode; - } - if (multilineCode || !line.startsWith("#")) continue; - const anchor = line - .split("%")[0] - .replace(/[^ A-Z0-9]/gi, "") - .trim() - .replace(/ +/g, "-") - .toLowerCase(); - if (/^#{1,5}(?!#)/.test(line.trim())) { - parentAnchor = `${anchor}-`; - validAnchors.push(anchor); - continue; - } - validAnchors.push(`${parentAnchor}${anchor}`); - } -} - -// Add changelog anchors to the list of valid links -validLinks.get("/docs/change-log")?.push(...changelogAnchors); - -const results = new Map(); - -// Check Links -for (const [name, raw] of docFiles) { - const fileName = `docs${name}`; - const file = raw.split("\n"); - if (!results.has(fileName)) { - results.set(fileName, []); - } - const ownResults = results.get(fileName)!; - let multilineCode = false; - file.forEach((line, lineNum) => { - if (line.trim().startsWith("```")) { - multilineCode = !multilineCode; - if (line.trim().length > 3 && line.trim().endsWith("```")) multilineCode = !multilineCode; - } - if (multilineCode) return; - const markdownMatches = line.matchAll(/(?.+?)\)(?!`)/g); - const componentMatches = line.matchAll(/(?:link|href)="(?!https?|mailto)(?.+?)"/g); - - for (const match of concatIterables(markdownMatches, componentMatches)) { - if (!match.groups) continue; - const [page, anchor] = match.groups?.link.split("#") ?? []; - if (!validLinks.has(page)) { - // Automatically ignore links with "image/" as the prefix, since the link checker is not designed to validate images. - if (page.startsWith("images/")) continue; - - ownResults.push({ - title: `Base url ${chalk.blueBright(page)} does not exist`, - startLine: lineNum + 1, - startColumn: match.index, - endColumn: (match.index ?? 0) + match[0].length, - }); - continue; - } - - if (!anchor) continue; - if (!validLinks.get(page)!.includes(anchor)) { - const suggestions = validLinks.get(page)!.filter((a) => a.includes(anchor)); - const suggestionText = suggestions.length > 0 ? ` Did you mean one of (${suggestions.join(", ")})?` : ""; - ownResults.push({ - title: `Anchor ${chalk.cyan(anchor)} does not exist on ${chalk.blueBright(page)}${suggestionText}`, - startLine: lineNum + 1, - startColumn: match.index, - endColumn: (match.index ?? 0) + match[0].length, - }); - } - } - }); -} - -if (results.size > 0) { - if (process.env.GITHUB_ACTIONS) { - annotateResults(results); - } else { - printResults(results); - } -} diff --git a/tools/doxygen/decorate-social-sdk-references.js b/tools/doxygen/decorate-social-sdk-references.js index 8b75ec2d4a..4214acc9f7 100644 --- a/tools/doxygen/decorate-social-sdk-references.js +++ b/tools/doxygen/decorate-social-sdk-references.js @@ -7,7 +7,7 @@ const __dirname = path.dirname(__filename); // Configure paths const REPO_ROOT = path.resolve(__dirname, "..", ".."); -const MARKDOWN_DIR = path.join(REPO_ROOT, "docs"); +const MARKDOWN_DIR = path.join(REPO_ROOT, "/discord/developers/docs"); const MAPPING_FILE = path.join(__dirname, "social-sdk-mappings.json"); // Helper function to ensure paths are resolved correctly @@ -137,7 +137,7 @@ const processMarkdownFile = (filePath, mapping) => { if (hasChanged) { fs.writeFileSync(filePath, newContent, "utf-8"); - // eslint-disable-next-line no-undef + console.log(`Updated ${filePath} with ${referencesFound.size} references`); } @@ -151,7 +151,6 @@ const processMarkdownFile = (filePath, mapping) => { const processMarkdownFiles = async () => { const mapping = loadMapping(); if (!Object.keys(mapping).length) { - // eslint-disable-next-line no-undef console.error("Mapping is empty! Make sure the JSON is generated correctly."); return; } @@ -174,12 +173,10 @@ const processMarkdownFiles = async () => { } if (filesUpdated > 0) { - // eslint-disable-next-line no-undef console.log( `\nSDK reference links processed. Updated ${filesUpdated} files with ${totalReferences} total references.`, ); } else { - // eslint-disable-next-line no-undef console.log("SDK reference links processed. No changes were made to any files."); } }; diff --git a/tools/doxygen/generate-social-sdk-mapping.js b/tools/doxygen/generate-social-sdk-mapping.js index a957777f77..df055dd42d 100644 --- a/tools/doxygen/generate-social-sdk-mapping.js +++ b/tools/doxygen/generate-social-sdk-mapping.js @@ -92,10 +92,9 @@ const generateMapping = async () => { const outputJsonPath = resolvePath(OUTPUT_JSON, true); await fs.promises.writeFile(outputJsonPath, JSON.stringify(mapping, null, 2)); - // eslint-disable-next-line no-undef console.log(`JSON mapping saved to ${outputJsonPath}`); }; // Run the script -// eslint-disable-next-line no-undef + generateMapping().catch(console.error); diff --git a/eslint.config.js b/tools/eslint.config.js similarity index 100% rename from eslint.config.js rename to tools/eslint.config.js diff --git a/package-lock.json b/tools/package-lock.json similarity index 99% rename from package-lock.json rename to tools/package-lock.json index 50109a1c43..ded68f55f6 100644 --- a/package-lock.json +++ b/tools/package-lock.json @@ -1023,10 +1023,11 @@ } }, "node_modules/@typescript-eslint/typescript-estree/node_modules/brace-expansion": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz", - "integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==", + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.2.tgz", + "integrity": "sha512-Jt0vHyM+jmUBqojB7E1NIYadt0vI0Qxjxd2TErW94wDz+E2LAm5vKMXXwg6ZZBTHPuUlDgQHKXvjGBdfcF1ZDQ==", "dev": true, + "license": "MIT", "dependencies": { "balanced-match": "^1.0.0" } @@ -1196,10 +1197,11 @@ "dev": true }, "node_modules/brace-expansion": { - "version": "1.1.11", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", - "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", + "version": "1.1.12", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.12.tgz", + "integrity": "sha512-9T9UjW3r0UW5c1Q7GTwllptXwhvYmEzFhzMfZ9H7FQWt+uZePjZPjBP/W1ZEyZ1twGWom5/56TF4lPcqjnDHcg==", "dev": true, + "license": "MIT", "dependencies": { "balanced-match": "^1.0.0", "concat-map": "0.0.1" @@ -1333,10 +1335,11 @@ "dev": true }, "node_modules/cross-spawn": { - "version": "7.0.3", - "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz", - "integrity": "sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==", + "version": "7.0.6", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.6.tgz", + "integrity": "sha512-uV2QOWP2nWzsy2aMp8aRibhi9dlzF5Hgh5SHaB9OiTGEyDTiJJyx0uy51QXdyWbtAHNua4XJzUKca3OzKUd3vA==", "dev": true, + "license": "MIT", "dependencies": { "path-key": "^3.1.0", "shebang-command": "^2.0.0", @@ -2542,10 +2545,11 @@ } }, "node_modules/markdown-table-formatter/node_modules/brace-expansion": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz", - "integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==", + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.2.tgz", + "integrity": "sha512-Jt0vHyM+jmUBqojB7E1NIYadt0vI0Qxjxd2TErW94wDz+E2LAm5vKMXXwg6ZZBTHPuUlDgQHKXvjGBdfcF1ZDQ==", "dev": true, + "license": "MIT", "dependencies": { "balanced-match": "^1.0.0" } @@ -3377,12 +3381,13 @@ ] }, "node_modules/micromatch": { - "version": "4.0.5", - "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.5.tgz", - "integrity": "sha512-DMy+ERcEW2q8Z2Po+WNXuw3c5YaUSFjAO5GsJqfEl7UjvtIuFKO6ZrKvcItdy98dwFI2N1tg3zNIdKaQT+aNdA==", + "version": "4.0.8", + "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.8.tgz", + "integrity": "sha512-PXwfBhYu0hBCPw8Dn0E+WDYb7af3dSLVWKi3HGv84IdF4TyFoC0ysxFd0Goxw7nSv4T/PzEJQxsYsEiFCKo2BA==", "dev": true, + "license": "MIT", "dependencies": { - "braces": "^3.0.2", + "braces": "^3.0.3", "picomatch": "^2.3.1" }, "engines": { diff --git a/package.json b/tools/package.json similarity index 68% rename from package.json rename to tools/package.json index 0de41b6246..2e4aa1ae8d 100644 --- a/package.json +++ b/tools/package.json @@ -1,7 +1,7 @@ { "name": "discord-api-docs", "version": "1.1.1", - "description": "Documentation for using Discord's API", + "description": "Documentation for using Discord's Developer Platform", "main": "index.js", "type": "module", "directories": { @@ -14,7 +14,7 @@ "type": "git", "url": "git+https://github.com/discord/discord-api-docs.git" }, - "author": "Discord Krew", + "author": "Discord for Developers", "license": "MIT", "bugs": { "url": "https://github.com/discord/discord-api-docs/issues" @@ -22,13 +22,12 @@ "homepage": "https://github.com/discord/discord-api-docs#readme", "scripts": { "build": "tsc", - "lint": "eslint tools", - "lint:fix": "eslint tools --fix", - "test:links": "tsx tools/checkLinks.ts", - "test:build": "tsx tools/checkBuild.ts", - "test:tables": "npx markdown-table-formatter \"docs/**/*.{md,mdx}\" --check", - "fix:tables": "npx markdown-table-formatter \"docs/**/*.{md,mdx}\"", - "decorate:docs": "node tools/doxygen/generate-social-sdk-mapping.js && node tools/doxygen/decorate-social-sdk-references.js" + "lint": "eslint", + "lint:fix": "eslint --fix", + "test:build": "tsx checkBuild.ts", + "test:tables": "npx markdown-table-formatter \"../discord/developers/docs/**/*.{md,mdx}\" --check", + "fix:tables": "npx markdown-table-formatter \"../discord/developers/docs/**/*.{md,mdx}\"", + "decorate:docs": "node ./doxygen/generate-social-sdk-mapping.js && node ./doxygen/decorate-social-sdk-references.js" }, "devDependencies": { "@actions/core": "^1.10.1", diff --git a/tools/parse-changelog.js b/tools/parse-changelog.js index dc63539fed..b21e047416 100644 --- a/tools/parse-changelog.js +++ b/tools/parse-changelog.js @@ -65,7 +65,7 @@ breaking: ${file.breaking ? "true" : "false"} .replace(/[ _:&,/*]/g, "-") .replace(/---/g, "-") .replace(/--/g, "-"); - // eslint-disable-next-line no-undef + console.log(slug); await fs.writeFile(`./docs/change_log/${slug}.md`, content); } diff --git a/tsconfig.json b/tools/tsconfig.json similarity index 100% rename from tsconfig.json rename to tools/tsconfig.json