You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/activities/building-an-activity.mdx
+34-22
Original file line number
Diff line number
Diff line change
@@ -111,8 +111,9 @@ With our project set up, let's create our app and configure the Activity. Create
111
111
112
112
Enter a name for your app, select a development team, then press **Create**.
113
113
114
-
> info
115
-
> **Development Team Access** <br />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.
114
+
:::info
115
+
**Development Team Access** <br />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.
116
+
:::
116
117
117
118
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.
118
119
@@ -158,15 +159,17 @@ In the root of your project, there is an `example.env` file. From the root of yo
158
159
cp example.env .env
159
160
```
160
161
161
-
> warn
162
-
> **Secure Your Secrets**<br /> 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.
162
+
:::warn
163
+
**Secure Your Secrets**<br /> 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.
164
+
:::
163
165
164
166
Back in your app's settings, click on **OAuth2** on the sidebar:
165
167
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.
166
168
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.
167
169
168
-
> info
169
-
> **Why is there a VITE_ prefix before our Client ID?**<br />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).
170
+
:::info
171
+
**Why is there a VITE_ prefix before our Client ID?**<br />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).
@@ -181,8 +184,9 @@ With our project and app set up, we're going to install and configure the [Embed
181
184
182
185
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).
183
186
184
-
> info
185
-
> 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.
187
+
:::info
188
+
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.
> **Time to leave your browser behind**<br />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.
241
+
:::warn
242
+
**Time to leave your browser behind**<br />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.
@@ -330,8 +335,9 @@ Clicking on your app will launch your locally running app from inside Discord!
330
335
331
336

332
337
333
-
> info
334
-
> **Customizing your Activity** <br/> If you'd like to set images for your Activity, you can learn how to do that [here](/docs/activities/development-guides#setting-up-activity-metadata).
338
+
:::info
339
+
**Customizing your Activity** <br/> If you'd like to set images for your Activity, you can learn how to do that [here](/docs/activities/development-guides#setting-up-activity-metadata).
340
+
:::
335
341
336
342
We're looking pretty good so far, but we haven't wired up any Discord functionality yet. Let's do that next.
337
343
@@ -441,18 +447,21 @@ We can now run our server and client-side apps in separate terminal windows. You
441
447
442
448
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.
443
449
444
-
> info
445
-
> For this tutorial, we are going to prefix the API call to `/api/token/` with `/.proxy`, but you can also use the SDK's `patchUrlMappings()` method to automatically prefix calls to your external resources for the proxy.
450
+
:::info
451
+
For this tutorial, we are going to prefix the API call to `/api/token/` with `/.proxy`, but you can also use the SDK's `patchUrlMappings()` method to automatically prefix calls to your external resources for the proxy.
452
+
:::
446
453
447
454
Learn more about this topic in the guides for [Constructing a Full URL](/docs/activities/development-guides#construct-a-full-url) and [Using External Resources](/docs/activities/development-guides#using-external-resources).
448
455
449
456
### Calling your backend server from your client
450
457
451
458
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.
452
459
453
-
> info
454
-
> **What is vite.config.js?**<br />
455
-
> 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/).
460
+
:::info
461
+
**What is vite.config.js?**
462
+
463
+
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/).
464
+
:::
456
465
457
466
<Collapsible title="Calling the backend server" description="Code for authorizing and authenticating" icon="code" open>
458
467
@@ -531,9 +540,11 @@ Now if we relaunch our app, we'll be prompted to authorize with Discord using th
531
540
532
541

533
542
534
-
> warn
535
-
> **Safe storage of tokens**<br />
536
-
> 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.
543
+
:::warn
544
+
**Safe storage of tokens**
545
+
546
+
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.
@@ -612,8 +623,9 @@ In the following code block, we will:
612
623
2. Iterate over each guild to find the guild we are in based on the `guildId` defined in discordSdk
613
624
3. Create a new HTML image element with the guild avatar and append it to our frontend
614
625
615
-
> info
616
-
> 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.
626
+
:::info
627
+
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.
628
+
:::
617
629
618
630
<Collapsible title="Fetching information about the current server" icon="code" open>
Copy file name to clipboardExpand all lines: docs/activities/development-guides.mdx
+18-12
Original file line number
Diff line number
Diff line change
@@ -154,8 +154,9 @@ Although it is possible to test your application locally, we recommend developin
154
154
4. Locally, spin up your web server.
155
155
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.
156
156
157
-
> info
158
-
> Your web server can be HTTP and your network tunnel can upgrade the connection to HTTPS.
157
+
:::info
158
+
Your web server can be HTTP and your network tunnel can upgrade the connection to HTTPS.
159
+
:::
159
160
160
161
If using cloudflared, you will run the following command, replace `3000` with your web server's port.
161
162
@@ -174,8 +175,9 @@ In the Discord Developer Portal, update the Application URL mapping for `/` url
174
175
175
176

176
177
177
-
> warn
178
-
> 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.
178
+
:::warn
179
+
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.
180
+
:::
179
181
180
182
Follow the instructions for [Launching your Application from the Discord Client](/docs/activities/development-guides#launch-your-application-from-the-discord-client). Application URL Override should not be enabled.
Discord will publish the current thermal state upon event subscription, and it will also publish any thermal state changes that happen afterward.
590
592
591
-
> info
592
-
> On Android devices, the thermal state updates will only be available on Android 10 and higher.
593
+
:::info
594
+
On Android devices, the thermal state updates will only be available on Android 10 and higher.
595
+
:::
593
596
594
597
---
595
598
@@ -747,8 +750,9 @@ async function setupApp() {
747
750
}
748
751
```
749
752
750
-
> info
751
-
> 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.
753
+
:::info
754
+
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.
755
+
:::
752
756
753
757
---
754
758
@@ -1016,8 +1020,9 @@ Once you're satisfied with your changes you can click on the copy icon on the ro
1016
1020
1. Click on the trash icon on the row of the link you're trying to delete.
1017
1021
2. You'll have a confirm dialog pop up.
1018
1022
1019
-
> warn
1020
-
> 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.
1023
+
:::warn
1024
+
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.
1025
+
:::
1021
1026
1022
1027
#### Best Practices
1023
1028
@@ -1109,8 +1114,9 @@ To update your app's metadata in the Discord Developer Portal, navigate to the `
1109
1114
- Leaving this field empty defaults to `Unlimited participants`.
1110
1115
- Max Participants is also displayed under the name in the 2-up view.
1111
1116
1112
-
> info
1113
-
> 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.
1117
+
:::info
1118
+
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.
Copy file name to clipboardExpand all lines: docs/activities/how-activities-work.md
+3-2
Original file line number
Diff line number
Diff line change
@@ -19,8 +19,9 @@ This SDK is intended for use by a single-page application. We recognize develope
19
19
20
20
## Sample Code and Activity Lifecycle Diagram
21
21
22
-
> info
23
-
> 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.
22
+
:::info
23
+
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.
Copy file name to clipboardExpand all lines: docs/change-log/2022-06-29-changes-to-bot-permissions-for-interactions-and-webhooks.md
+3-2
Original file line number
Diff line number
Diff line change
@@ -6,8 +6,9 @@ breaking: true
6
6
7
7
#### Upcoming Changes
8
8
9
-
> warn
10
-
> `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.
9
+
:::warn
10
+
`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.
11
+
:::
11
12
12
13
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:
> 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.
6
+
:::warn
7
+
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.
8
+
:::
8
9
9
10
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.
Copy file name to clipboardExpand all lines: docs/change-log/2022-11-17-upcoming-application-command-permission-changes.md
+9-6
Original file line number
Diff line number
Diff line change
@@ -8,15 +8,17 @@ Based on feedback, we’re updating permissions for [application commands](/docs
8
8
9
9
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**.
10
10
11
-
> info
12
-
> 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)
11
+
:::info
12
+
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)
13
+
:::
13
14
14
15
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/<application_id>/guilds/<guild_id>/commands/<command_id>/permissions`), you may need to make updates and should read these changes carefully.
15
16
16
17
#### Types of command permission configurations
17
18
18
-
> info
19
-
> The following information isn’t changing, but it’s helpful context to understand the changes.
19
+
:::info
20
+
The following information isn’t changing, but it’s helpful context to understand the changes.
21
+
:::
20
22
21
23
Discord’s clients determine whether a user can see or invoke a command based on three different permission configurations:
22
24
@@ -102,8 +104,9 @@ else:
102
104
# Use new permissions behaviors when interacting with endpoint
103
105
```
104
106
105
-
> info
106
-
> If you don’t have access to guild features already through Gateway events, you can fetch that information using the [`GET /guilds/<guild_id>` endpoint](/docs/resources/guild#get-guild).
107
+
:::info
108
+
If you don’t have access to guild features already through Gateway events, you can fetch that information using the [`GET /guilds/<guild_id>` endpoint](/docs/resources/guild#get-guild).
* New [`role_connections.write`](/docs/topics/oauth2#shared-resources-oauth2-scopes) OAuth2 scope required to authenticate the below requests.
12
12
* 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.
13
13
14
-
> info
15
-
> For a quick rundown on how to get started using linked roles, refer to the [tutorial](/docs/tutorials/configuring-app-metadata-for-linked-roles).
14
+
:::info
15
+
For a quick rundown on how to get started using linked roles, refer to the [tutorial](/docs/tutorials/configuring-app-metadata-for-linked-roles).
Copy file name to clipboardExpand all lines: docs/change-log/2023-05-03-unique-usernames-on-discord.md
+3-2
Original file line number
Diff line number
Diff line change
@@ -3,8 +3,9 @@ title: "Unique usernames on Discord"
3
3
date: "2023-05-03"
4
4
---
5
5
6
-
> warn
7
-
> 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).
6
+
:::warn
7
+
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).
8
+
:::
8
9
9
10
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).
0 commit comments