Skip to content

Commit 9275cb7

Browse files
use directives for help messages (#7482)
1 parent aa79300 commit 9275cb7

File tree

99 files changed

+1392
-934
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

99 files changed

+1392
-934
lines changed

CONTRIBUTING.md

+4-2
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,11 @@ Links between docs can be achieved by using a hash symbol (#), plus the markdown
4040

4141
Alert boxes are created using a block quote that has one of 'warn', 'danger', 'info', or 'preview' on the first line.
4242
For example:
43+
4344
```
44-
> warn
45-
> Something that requires warning here
45+
:::warn
46+
Something that requires warning here
47+
:::
4648
```
4749

4850
![Alert options](static/images/alerts.png)

docs/activities/building-an-activity.mdx

+34-22
Original file line numberDiff line numberDiff line change
@@ -111,8 +111,9 @@ With our project set up, let's create our app and configure the Activity. Create
111111

112112
Enter a name for your app, select a development team, then press **Create**.
113113

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+
:::
116117

117118
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.
118119

@@ -158,15 +159,17 @@ In the root of your project, there is an `example.env` file. From the root of yo
158159
cp example.env .env
159160
```
160161

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+
:::
163165

164166
Back in your app's settings, click on **OAuth2** on the sidebar:
165167
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.
166168
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.
167169

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).
172+
:::
170173

171174
<Collapsible title="Step 2 Checkpoint" icon="list" open>
172175

@@ -181,8 +184,9 @@ With our project and app set up, we're going to install and configure the [Embed
181184

182185
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).
183186

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.
189+
:::
186190

187191
### Install the SDK
188192

@@ -234,8 +238,9 @@ document.querySelector('#app').innerHTML = `
234238
235239
</Collapsible>
236240
237-
> warn
238-
> **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.
243+
:::
239244
240245
<Collapsible title="Step 3 Checkpoint" icon="list" open>
241246
@@ -330,8 +335,9 @@ Clicking on your app will launch your locally running app from inside Discord!
330335
331336
![Running your activity](images/activities/start-activity.png)
332337
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+
:::
335341
336342
We're looking pretty good so far, but we haven't wired up any Discord functionality yet. Let's do that next.
337343
@@ -441,18 +447,21 @@ We can now run our server and client-side apps in separate terminal windows. You
441447
442448
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.
443449
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+
:::
446453
447454
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).
448455
449456
### Calling your backend server from your client
450457
451458
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.
452459
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+
:::
456465
457466
<Collapsible title="Calling the backend server" description="Code for authorizing and authenticating" icon="code" open>
458467
@@ -531,9 +540,11 @@ Now if we relaunch our app, we'll be prompted to authorize with Discord using th
531540
532541
![Prompt to authorize Activity](images/activities/tutorial-auth.png)
533542
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.
547+
:::
537548
538549
<Collapsible title="Step 5 Checkpoint" icon="list" open>
539550
@@ -612,8 +623,9 @@ In the following code block, we will:
612623
2. Iterate over each guild to find the guild we are in based on the `guildId` defined in discordSdk
613624
3. Create a new HTML image element with the guild avatar and append it to our frontend
614625
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+
:::
617629
618630
<Collapsible title="Fetching information about the current server" icon="code" open>
619631

docs/activities/design-patterns.mdx

+3-2
Original file line numberDiff line numberDiff line change
@@ -114,8 +114,9 @@ Discord is a social platform where users talk to each other. Sharing and invites
114114

115115
### Monetization Considerations
116116

117-
> preview
118-
> Monetization in Activities will be available soon. Keep the following considerations in mind as you design your Activity.
117+
:::preview
118+
Monetization in Activities will be available soon. Keep the following considerations in mind as you design your Activity.
119+
:::
119120

120121
- Avoid prohibitive gates in front of participation (e.g. login wall / paywall), especially early in the user journey.
121122
- Avoid monetized unlocks that give unfair advantage to other non-paying players or users (i.e. "pay to win").

docs/activities/development-guides.mdx

+18-12
Original file line numberDiff line numberDiff line change
@@ -154,8 +154,9 @@ Although it is possible to test your application locally, we recommend developin
154154
4. Locally, spin up your web server.
155155
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.
156156

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+
:::
159160

160161
If using cloudflared, you will run the following command, replace `3000` with your web server's port.
161162

@@ -174,8 +175,9 @@ In the Discord Developer Portal, update the Application URL mapping for `/` url
174175

175176
![Configuring your URL Mapping](images/activities/url-mapping-tutorial.png)
176177

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+
:::
179181

180182
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.
181183

@@ -588,8 +590,9 @@ discordSdk.subscribe('THERMAL_STATE_UPDATE', handleThermalStateUpdate);
588590

589591
Discord will publish the current thermal state upon event subscription, and it will also publish any thermal state changes that happen afterward.
590592

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+
:::
593596

594597
---
595598

@@ -747,8 +750,9 @@ async function setupApp() {
747750
}
748751
```
749752

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+
:::
752756

753757
---
754758

@@ -1016,8 +1020,9 @@ Once you're satisfied with your changes you can click on the copy icon on the ro
10161020
1. Click on the trash icon on the row of the link you're trying to delete.
10171021
2. You'll have a confirm dialog pop up.
10181022

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+
:::
10211026
10221027
#### Best Practices
10231028
@@ -1109,8 +1114,9 @@ To update your app's metadata in the Discord Developer Portal, navigate to the `
11091114
- Leaving this field empty defaults to `Unlimited participants`.
11101115
- Max Participants is also displayed under the name in the 2-up view.
11111116
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.
1119+
:::
11141120
11151121
---
11161122

docs/activities/how-activities-work.md

+3-2
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,9 @@ This SDK is intended for use by a single-page application. We recognize develope
1919

2020
## Sample Code and Activity Lifecycle Diagram
2121

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.
24+
:::
2425

2526
```javascript
2627
import {DiscordSDK} from '@discord/embedded-app-sdk';

docs/change-log/2022-06-29-changes-to-bot-permissions-for-interactions-and-webhooks.md

+3-2
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,9 @@ breaking: true
66

77
#### Upcoming Changes
88

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+
:::
1112

1213
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:
1314

docs/change-log/2022-08-09-session-specific-gateway-resume-urls.md

+3-2
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,9 @@ title: "Session-specific Gateway Resume URLs"
33
date: "2022-08-09"
44
---
55

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.
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+
:::
89

910
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.
1011

docs/change-log/2022-11-17-upcoming-application-command-permission-changes.md

+9-6
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,17 @@ Based on feedback, we’re updating permissions for [application commands](/docs
88

99
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**.
1010

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+
:::
1314

1415
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.
1516

1617
#### Types of command permission configurations
1718

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+
:::
2022

2123
Discord’s clients determine whether a user can see or invoke a command based on three different permission configurations:
2224

@@ -102,8 +104,9 @@ else:
102104
# Use new permissions behaviors when interacting with endpoint
103105
```
104106

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).
109+
:::
107110

108111
**2. Modify the behavior based on your use case**
109112

docs/change-log/2022-12-12-add-application-connections-metadata-and-linked-roles.md

+3-2
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,6 @@ Introducing [linked roles](https://discord.com/blog/connected-accounts-functiona
1111
* New [`role_connections.write`](/docs/topics/oauth2#shared-resources-oauth2-scopes) OAuth2 scope required to authenticate the below requests.
1212
* 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.
1313

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).
16+
:::

docs/change-log/2023-05-03-unique-usernames-on-discord.md

+3-2
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,9 @@ title: "Unique usernames on Discord"
33
date: "2023-05-03"
44
---
55

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+
:::
89

910
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).
1011

0 commit comments

Comments
 (0)