Skip to content

Commit 69208de

Browse files
Merge branch 'discord:main' into main
2 parents 4bcbf8a + d42695f commit 69208de

File tree

560 files changed

+7724
-3815
lines changed

Some content is hidden

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

560 files changed

+7724
-3815
lines changed

.github/workflows/docs.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,10 @@ jobs:
1515
runs-on: ubuntu-latest
1616
steps:
1717
- name: Checkout repository
18-
uses: actions/checkout@v4
18+
uses: actions/checkout@v5
1919

2020
- name: Install Node v20
21-
uses: actions/setup-node@v4
21+
uses: actions/setup-node@v5
2222
with:
2323
node-version: 20
2424
cache: npm

.github/workflows/test.yaml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ jobs:
1414
name: Lint
1515
runs-on: ubuntu-latest
1616
steps:
17-
- uses: actions/checkout@v4
18-
- uses: actions/setup-node@v4
17+
- uses: actions/checkout@v5
18+
- uses: actions/setup-node@v5
1919
with:
2020
node-version: 20
2121
cache: npm
@@ -26,8 +26,8 @@ jobs:
2626
name: Check Links
2727
runs-on: ubuntu-latest
2828
steps:
29-
- uses: actions/checkout@v4
30-
- uses: actions/setup-node@v4
29+
- uses: actions/checkout@v5
30+
- uses: actions/setup-node@v5
3131
with:
3232
node-version: 20
3333
cache: npm
@@ -37,8 +37,8 @@ jobs:
3737
name: Validate mdx
3838
runs-on: ubuntu-latest
3939
steps:
40-
- uses: actions/checkout@v4
41-
- uses: actions/setup-node@v4
40+
- uses: actions/checkout@v5
41+
- uses: actions/setup-node@v5
4242
with:
4343
node-version: 20
4444
cache: npm

CONTRIBUTING.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ Something that requires warning here
4848

4949
Currently the following types are available: `info`, `warn`, `danger` and `preview`
5050

51-
![Available alert types](static/images/alerts.png)
51+
![Available alert types](static/images/alerts.webp)
5252

5353
### MDX Components
5454

@@ -68,7 +68,7 @@ Available options for `icon`:
6868

6969
###### Example
7070

71-
![Collapsible MDX Component with the list icon](static/images/mdx-collapsible.png)
71+
![Collapsible MDX Component with the list icon](static/images/mdx-collapsible.webp)
7272

7373
```markdown
7474
<Collapsible title="Title" description="Description text" icon="list">
@@ -82,10 +82,10 @@ Buttons are simply... clickable buttons. They take `href` and `color` as argumen
8282

8383
###### Example
8484

85-
![Button MDX Component](static/images/mdx-button.png)
85+
![Button MDX Component](static/images/mdx-button.webp)
8686

8787
```markdown
88-
<LinkButton to="https://discord.com/developers/docs/getting-started" color="brand">click the button!</LinkButton>
88+
<LinkButton to="https://discord.com/developers/docs/getting-started" color="brand" text="click the button!" />
8989
```
9090

9191
#### Cards
@@ -94,7 +94,7 @@ Cards let you display links in a card format. They accept two arguments, `title`
9494

9595
###### Example
9696

97-
![Card MDX Component](static/images/mdx-card.png)
97+
![Card MDX Component](static/images/mdx-card.webp)
9898

9999
```markdown
100100
<Card title="Card Title" link="https://discord.com/developers/docs/getting-started">

docs/activities/building-an-activity.mdx

Lines changed: 14 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ It assumes an understanding of [JavaScript](https://developer.mozilla.org/en-US/
1616

1717
<Collapsible title="What we'll be building" icon="view">
1818

19-
![Building Your First Activity Tutorial](images/activities/tutorial-hero.png)
19+
![Building Your First Activity Tutorial](images/activities/tutorial-hero.webp)
2020

2121
</Collapsible>
2222

@@ -88,7 +88,7 @@ npm install
8888
npm run dev
8989
```
9090

91-
If you visit http://localhost:3000/ you should see a vanilla JS frontend template running with [Vite](https://vitejs.dev/).
91+
If you visit http://localhost:5173/ you should see a vanilla JS frontend template running with [Vite](https://vitejs.dev/).
9292

9393
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.
9494

@@ -107,7 +107,7 @@ By the end of Step 1, you should have:
107107

108108
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:
109109

110-
<LinkButton to="https://discord.com/developers/applications?new_application=true" color="brand">Create App</LinkButton>
110+
<LinkButton to="https://discord.com/developers/applications?new_application=true" color="brand" text="Create App" />
111111

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

@@ -145,7 +145,7 @@ You can learn more about the OAuth flow and redirect URIs in the [OAuth2 documen
145145

146146
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**.
147147

148-
![Redirect URI in Activity Settings](images/activities/oauth2-redirect.png)
148+
![Redirect URI in Activity Settings](images/activities/oauth2-redirect.webp)
149149

150150
### Fetch Your OAuth2 Credentials
151151

@@ -278,7 +278,7 @@ Your app should start and you should see output similar to the following:
278278
```
279279
VITE v5.0.12 ready in 100 ms
280280

281-
➜ Local: http://localhost:3000/
281+
➜ Local: http://localhost:5173/
282282
➜ Network: use --host to expose
283283
➜ press h + enter to show help
284284
```
@@ -289,10 +289,10 @@ We'll use the Local URL as our publicly-accessible URL in the next step.
289289
290290
Next, we'll need to set up the public endpoint that serves the Activity's frontend. To do that, we'll create a tunnel with a reverse proxy. While we'll be using [`cloudflared`](https://developers.cloudflare.com/cloudflare-one/connections/connect-networks/) in this guide, you can use [ngrok](https://ngrok.com/docs) or another reverse proxy solution if you prefer.
291291
292-
While your app is still running, open another terminal window and start a network tunnel that listens to the port from the last step (in this case, port `3000`):
292+
While your app is still running, open another terminal window and start a network tunnel that listens to the port from the last step (in this case, port `5173`):
293293
294294
```
295-
cloudflared tunnel --url http://localhost:3000
295+
cloudflared tunnel --url http://localhost:5173
296296
```
297297
298298
When you run `cloudflared`, the tunnel will generate a public URL and you'll see output similar to the following:
@@ -310,7 +310,7 @@ Because Activities are in a sandbox enviornment and go through the Discord proxy
310310
311311
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.
312312
313-
![Configuring your URL Mapping](images/activities/url-mapping-tutorial.png)
313+
![Configuring your URL Mapping](images/activities/url-mapping-tutorial.webp)
314314
315315
| PREFIX | TARGET |
316316
|--------|-----------------------------------------|
@@ -324,7 +324,7 @@ Next, we'll need to enable Activities for your app. On the left hand sidebar und
324324
325325
Find the first checkbox, labeled `Enable Activities`. Turn it on 🎉
326326
327-
![Enabling Activities in Settings](images/activities/enable-activities.png)
327+
![Enabling Activities in Settings](images/activities/enable-activities.webp)
328328
329329
#### Default Entry Point Command
330330
@@ -341,7 +341,7 @@ Navigate to your Discord test server and, in any voice and or text channel, open
341341
342342
Clicking on your app will launch your locally running app from inside Discord!
343343
344-
![Running your activity](images/activities/start-activity.png)
344+
![Running your activity](images/activities/start-activity.webp)
345345
346346
:::info
347347
**Customizing your Activity**
@@ -457,10 +457,6 @@ We can now run our server and client-side apps in separate terminal windows. You
457457
458458
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.
459459
460-
:::info
461-
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.
462-
:::
463-
464460
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).
465461
466462
### Calling your backend server from your client
@@ -513,10 +509,7 @@ async function setupDiscordSdk() {
513509
});
514510
515511
// Retrieve an access_token from your activity's server
516-
// Note: We need to prefix our backend `/api/token` route with `/.proxy` to stay compliant with the CSP.
517-
// Read more about constructing a full URL and using external resources at
518-
// https://discord.com/developers/docs/activities/development-guides/networking#construct-a-full-url
519-
const response = await fetch("/.proxy/api/token", {
512+
const response = await fetch("/api/token", {
520513
method: "POST",
521514
headers: {
522515
"Content-Type": "application/json",
@@ -548,7 +541,7 @@ document.querySelector('#app').innerHTML = `
548541
549542
Now if we relaunch our app, we'll be prompted to authorize with Discord using the `identify`, `guilds`, and `applications.commands` scopes.
550543
551-
![Prompt to authorize Activity](images/activities/tutorial-auth.png)
544+
![Prompt to authorize Activity](images/activities/tutorial-auth.webp)
552545
553546
:::warn
554547
**Safe storage of tokens**
@@ -613,7 +606,7 @@ setupDiscordSdk().then(() => {
613606
614607
If you close and rejoin the Activity, you should now see the name of the current channel.
615608
616-
![Discord Activities](images/activities/tutorial-channel-name.png)
609+
![Discord Activities](images/activities/tutorial-channel-name.webp)
617610
618611
<Collapsible title="Step 6 Checkpoint" icon="list" open>
619612
@@ -687,7 +680,7 @@ setupDiscordSdk().then(() => {
687680
688681
If we relaunch our Activity, we will see the current server's avatar render in our Activity.
689682
690-
![Discord Activities](images/activities/tutorial-hero.png)
683+
![Discord Activities](images/activities/tutorial-hero.webp)
691684
692685
<Collapsible title="Step 7 Checkpoint" icon="list" open>
693686

docs/activities/design-patterns.mdx

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ When in an Activity with others, make the actions and presence of the others vis
4949
- If a user has customized their server nickname or avatar, use their server nickname or avatar in game.
5050
- Show when a user is speaking in the voice call, or whether they're active or inactive.
5151

52-
![Speech bubbles in Bobble League](images/activities/bobble-bash.png)
52+
![Speech bubbles in Bobble League](images/activities/bobble-bash.webp)
5353

5454

5555
### Respect user privacy
@@ -67,7 +67,7 @@ Make your app fast, easy to join, and maximize fun to launch a crowd favorite.
6767
- Surprise and delight is about caring about the small details of how a person experiences your work.
6868
- Put the right emotion in when they least expect it to deliver the magic.
6969

70-
![Bobble League](images/activities/bobble-league.png)
70+
![Bobble League](images/activities/bobble-league.webp)
7171

7272
### Keep load times as low as possible
7373
- This allows for easier drop-in drop-out behavior for the large portion of mobile users on Discord.
@@ -80,7 +80,7 @@ Make your app fast, easy to join, and maximize fun to launch a crowd favorite.
8080
- 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.
8181
- 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.
8282

83-
![Support drop-in, drop-out behavior in your Activity](images/activities/eights.png)
83+
![Support drop-in, drop-out behavior in your Activity](images/activities/eights.webp)
8484

8585
### Make your app as available as possible
8686

@@ -105,7 +105,7 @@ Discord is a social platform where users talk to each other. Sharing and invites
105105
- 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.
106106
- 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.
107107

108-
![Shared Moment from Chess in the Park](images/activities/chess-victory.png)
108+
![Shared Moment from Chess in the Park](images/activities/chess-victory.webp)
109109

110110
#### Activities in Text Channels
111111
- 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.
@@ -141,8 +141,7 @@ Monetization in Activities will be available soon. Keep the following considerat
141141

142142
### Activities close when the last participant in the Activity leaves it
143143
- 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.
144-
- Note: This behavior will change in 2024, when we release persistent instances.
145-
144+
146145
### If a game is launched, what % of the time do users reach different phases of the game?
147146
- 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).
148147
- This also includes various check points in the game, including what % of sessions that start a game reach the end of that game!
@@ -151,10 +150,10 @@ Monetization in Activities will be available soon. Keep the following considerat
151150
- If drop-off is really high at a certain point, see if you can figure out why or change flows.
152151

153152
### How many games are played in a session?
154-
- 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.
153+
- 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.
155154
- If you expect to see a lot of repeat plays per session and don’t, it can be worth digging in to understand more.
156155

157-
### How does the group size impact various key metrics?
156+
### How does the group size impact various key metrics?
158157
- For example, are larger sessions more or less likely to reach the end of a game? To replay? Etc.
159158
- 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.
160159
- Not every Activity needs to be built for robust group sizes, but if you have the option to play with X # of players, it’s good practice to make sure that experience is enjoyable for all involved!

docs/activities/development-guides/growth-and-referrals.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ Deleting is irreversible and immediate. Ensure that your link isn't in active us
140140

141141
#### User Experience
142142

143-
![custom-link-embed](images/activities/custom-link-embed.png)
143+
![custom-link-embed](images/activities/custom-link-embed.webp)
144144

145145
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.
146146

docs/activities/development-guides/layout.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ discordSdk.commands.setOrientationLockState({
3434

3535
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.
3636

37-
![default-orientation-lock-state](images/activities/default_orientation_lock_state.png)
37+
![default-orientation-lock-state](images/activities/default_orientation_lock_state.webp)
3838

3939
#### Subscribing to Screen Orientation Updates
4040

docs/activities/development-guides/local-development.mdx

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ https://funky-jogging-bunny.trycloudflare.com
4141

4242
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.
4343

44-
![Configuring your URL Mapping](images/activities/url-mapping-tutorial.png)
44+
![Configuring your URL Mapping](images/activities/url-mapping-tutorial.webp)
4545

4646
:::warn
4747
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.
@@ -59,7 +59,7 @@ The flow for setting up your production application is very similar:
5959
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.
6060

6161
This application now uses the same configuration it will use once it is fully published ✨.
62-
![application-test-mode-prod](images/activities/application-test-mode-prod.gif)
62+
![application-test-mode-prod](images/activities/application-test-mode-prod.webp)
6363

6464

6565
---
@@ -96,7 +96,7 @@ Because your application is "sandboxed", it will be unable to make network reque
9696

9797
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.
9898

99-
![Configuring your URL Mapping](images/activities/url-mapping-tutorial.png)
99+
![Configuring your URL Mapping](images/activities/url-mapping-tutorial.webp)
100100

101101
#### Prefix/Target formatting rules
102102

@@ -108,10 +108,10 @@ To add or modify your application's URL mappings, click on `Activities -> URL Ma
108108
- Targets must point to a directory; setting a target to a file (e.g. `example.com/index.html`) is unsupported and may lead to unexpected behavior.
109109
- Because of how URL globbing works, if you have multiple prefix urls with the same initial path, you must place the shortest of the prefix paths last in order for each url mapping to be reachable. For example, if you have `/foo` and `/foo/bar`, you must place the url `/foo/bar` before `/foo` or else the mapping for `/foo/bar` will never be reached.
110110

111-
| ✅ DO | ❌ DON'T |
112-
|-------------------------------------------------------------|-----------------------------------------------------------------|
113-
| Requests mapped correctly | Requests to /foo/bar will incorrectly be sent to `foo.com` |
114-
| ![url-mapping-do.png](images/activities/url-mapping-do.png) | ![url-mapping-dont.png](images/activities/url-mapping-dont.png) |
111+
| ✅ DO | ❌ DON'T |
112+
|--------------------------------------------------------------|------------------------------------------------------------------|
113+
| Requests mapped correctly | Requests to /foo/bar will incorrectly be sent to `foo.com` |
114+
| ![url-mapping-do.png](images/activities/url-mapping-do.webp) | ![url-mapping-dont.png](images/activities/url-mapping-dont.webp) |
115115

116116
#### Exceptions
117117

@@ -161,7 +161,7 @@ The first section of Debug Logs are not your application logs but Discord specif
161161

162162
When you scroll down the page, your application logs should be visible.
163163

164-
![debug-logs-filtering](images/activities/debug-logs-filtering.gif)
164+
![debug-logs-filtering](images/activities/debug-logs-filtering.webp)
165165

166166
#### Sharing Application Logs from Mobile
167167

docs/activities/development-guides/mobile.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ By default, your Activity will be launchable on web/desktop. To enable or disabl
1515
- Select `Activities` -> `Settings` in the left-side of the developer portal, or visit `https://discord.com/developers/<your app id>/embedded/settings`
1616
- From check the appropriate checkboxes in the developer portal, and save your changes
1717

18-
![supported-platforms](images/activities/supported-platforms.png)
18+
![supported-platforms](images/activities/supported-platforms.webp)
1919

2020
---
2121

0 commit comments

Comments
 (0)