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
Social SDK: Clarify that Game Invites are powered by Rich Presence (#7747)
Restructure the Game Invites guide to emphasize that invites are not a
standalone feature but are entirely powered by Rich Presence configuration.
Add clear explanations of the prerequisite Rich Presence setup including
party information, join secrets, and/or supported platforms needed to enable
invite functionality.
This was a point of friction I ran into when onboarding with the Social
SDK and creating invites.
Copy file name to clipboardExpand all lines: docs/discord-social-sdk/development-guides/managing-game-invites.mdx
+76-47Lines changed: 76 additions & 47 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -10,33 +10,41 @@ import SupportCallout from '../partials/callouts/support.mdx';
10
10
11
11
## Overview
12
12
13
-
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.
13
+
Game Invites allow users to invite others to join their game session or party. This feature is available on the
14
+
Discord client and the Social SDK.
15
+
16
+
:::info
17
+
**Game Invites are not a standalone feature** - they are **powered entirely by Rich Presence**. When you configure Rich
18
+
Presence with party information, a join secret, and/or supported platforms, Discord automatically enables invite
19
+
functionality. This guide shows you how to configure Rich Presence to unlock game invites.
20
+
:::
14
21
15
22
### Prerequisites
16
23
17
24
Before you begin, make sure you have:
18
25
26
+
- Completed the [Setting Rich Presence](/docs/discord-social-sdk/development-guides/setting-rich-presence) guide
27
+
- Understanding that without an active Rich Presence with party data, invites will not work
19
28
- Set up the Discord Social SDK with our [Getting Started guide](/docs/discord-social-sdk/getting-started)
20
-
- Familiarized yourself with [Setting Rich Presence](/docs/discord-social-sdk/development-guides/setting-rich-presence)
21
-
22
-
:::info
23
-
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.
24
-
:::
25
29
26
30
---
27
31
28
-
## Configuring Game Invites
32
+
## Configuring Rich Presence to Enable Game Invites
29
33
30
-
Game invites, or activity invites, are powered by rich presence.
34
+
Game invites, or activity invites, are **powered by rich presence**.
31
35
32
36
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.
33
37
38
+
:::info
39
+
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.
40
+
:::
41
+
34
42
### Setting Up Rich Presence
35
43
36
-
Below is an example of setting up rich presence in your game.
44
+
Below is an example of setting up rich presence in your game to be used with game invites.
37
45
38
46
```cpp
39
-
// Create discordpp::Activity
47
+
// Create discordpp::Activity - This Rich Presence Activity is your invite configuration
// Note: Invites are NOT yet enabled - we need party info and join secret
51
60
} else {
52
61
std::cerr<<"❌ Rich Presence update failed";
53
62
}
@@ -63,17 +72,18 @@ You must set up your rich presence [`Activity`] with party information and a joi
63
72
```cpp
64
73
// rest of the code
65
74
66
-
// Set the party information
67
75
// Create discordpp::ActivityParty
68
76
discordpp::ActivityParty party;
69
77
party.SetId("party1234");
70
78
// current party size
71
-
party.SetCurrentSize(1);
79
+
party.SetCurrentSize(1);
72
80
// max party size
73
-
party.SetMaxSize(5);
81
+
party.SetMaxSize(5);
82
+
// Set the party information in the Activity, to inform the invite about the party size and how many players can join
74
83
activity.SetParty(party);
75
84
76
85
// Update Rich Presence
86
+
// Still not enough for invites - we need the join secret!
77
87
```
78
88
79
89
If we run our game, the Discord client will show that we are "In Competitive Match" on "Valhalla" with more information about the party.
@@ -82,7 +92,7 @@ We're almost there! Let's add the join secret next so we can send and receive ga
82
92
83
93
### Adding Join Secret & Supported Platforms
84
94
85
-
The last step is to add a join secret to your rich presence activity.
95
+
The last step is to add a join secret to your rich presence activity.
86
96
87
97
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.
88
98
@@ -93,20 +103,21 @@ You will also need to set the supported platforms for joining the game so that t
93
103
94
104
// Create ActivitySecrets
95
105
discordpp::ActivitySecrets secrets;
96
-
secrets.SetJoin("joinsecret1234");
106
+
secrets.SetJoin("joinsecret1234");// Rich Presence secret will be in the invite payload
97
107
activity.SetSecrets(secrets);
98
108
99
109
// Set supported platforms that can join the game
100
110
// See discordpp::ActivityGamePlatforms for available platforms
// ✅ Rich Presence updated = Game invites now available!
140
150
} else {
141
151
std::cerr<<"❌ Rich Presence update failed";
152
+
// ❌ No Rich Presence = No invites possible
142
153
}
143
154
});
144
155
```
@@ -154,11 +165,11 @@ Before we send a game invite, let's make sure that the Discord client knows abou
154
165
When a user accepts a game invite for your game within Discord, the Discord client needs to know how to launch the game for that user. We have two ways to do this:
155
166
156
167
- Register a launch command for your game
157
-
- Register a Steam Game ID
168
+
- Register a Steam Game ID
158
169
159
170
For desktop games, you should run one of these commands when the SDK starts up so that if the user tries to join from Discord, the game can be launched for them.
160
171
161
-
### Registering a Launch Command
172
+
### Registering a Launch Command
162
173
163
174
[`Client::RegisterLaunchCommand`] allows you to register a command that Discord will run to launch your game.
164
175
@@ -191,11 +202,19 @@ Users can send game invites directly through the Discord client. This feature is
191
202
192
203
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`].
193
204
205
+
:::warn
206
+
[`Client::SendActivityInvite`] only works if Rich Presence is active with proper configuration
Use [`Client::SetActivityJoinCallback`] to monitor for a user accepting a game invite, either in-game or in Discord. Use the join secret to connect the players in your game.
240
260
241
261
```cpp
262
+
// This fires when a user clicks "Join" on someone's Rich Presence
0 commit comments