dfx 0.0.1 → 0.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (136) hide show
  1. package/DiscordREST/types.js +6 -0
  2. package/DiscordREST/types.js.map +1 -0
  3. package/DiscordWS/index.js +2 -0
  4. package/DiscordWS/index.js.map +1 -0
  5. package/README.md +3 -0
  6. package/WS/index.js +71 -0
  7. package/WS/index.js.map +1 -0
  8. package/discord-api-docs/index.js +1 -0
  9. package/mod.js.map +1 -0
  10. package/package.json +6 -1
  11. package/types.js +1563 -0
  12. package/types.js.map +1 -0
  13. package/websocket.js +11 -0
  14. package/websocket.js.map +1 -0
  15. package/.gitmodules +0 -3
  16. package/.prettierrc.json +0 -4
  17. package/discord-api-docs/.eslintrc.json +0 -10
  18. package/discord-api-docs/.gitattributes +0 -11
  19. package/discord-api-docs/.github/ISSUE_TEMPLATE/api-bug-report.yml +0 -49
  20. package/discord-api-docs/.github/ISSUE_TEMPLATE/config.yml +0 -20
  21. package/discord-api-docs/.github/ISSUE_TEMPLATE/developer-site-bug-report.yml +0 -49
  22. package/discord-api-docs/.github/ISSUE_TEMPLATE/message-components-bug-report.yml +0 -49
  23. package/discord-api-docs/.github/ISSUE_TEMPLATE/slash-command-bug-report.yml +0 -49
  24. package/discord-api-docs/.github/workflows/test.yaml +0 -45
  25. package/discord-api-docs/.prettierignore +0 -1
  26. package/discord-api-docs/.prettierrc.json +0 -15
  27. package/discord-api-docs/CODE_OF_CONDUCT.md +0 -75
  28. package/discord-api-docs/CONTRIBUTING.md +0 -16
  29. package/discord-api-docs/README.md +0 -35
  30. package/discord-api-docs/docs/Change_Log.md +0 -474
  31. package/discord-api-docs/docs/Intro.md +0 -48
  32. package/discord-api-docs/docs/Legal.md +0 -154
  33. package/discord-api-docs/docs/Policy.md +0 -81
  34. package/discord-api-docs/docs/Reference.md +0 -476
  35. package/discord-api-docs/docs/Store_Distribution_Agreement.md +0 -179
  36. package/discord-api-docs/docs/dispatch/Branches_and_Builds.md +0 -654
  37. package/discord-api-docs/docs/dispatch/Dispatch_and_You.md +0 -17
  38. package/discord-api-docs/docs/dispatch/Error_Codes.md +0 -26
  39. package/discord-api-docs/docs/dispatch/Field_Values.md +0 -48
  40. package/discord-api-docs/docs/dispatch/List_of_Commands.md +0 -315
  41. package/discord-api-docs/docs/game_and_server_management/Alpha_and_Beta_Testing.md +0 -52
  42. package/discord-api-docs/docs/game_and_server_management/How_to_Get_Your_Game_on_Discord.md +0 -110
  43. package/discord-api-docs/docs/game_and_server_management/Special_Channels.md +0 -38
  44. package/discord-api-docs/docs/game_sdk/Achievements.md +0 -405
  45. package/discord-api-docs/docs/game_sdk/Activities.md +0 -561
  46. package/discord-api-docs/docs/game_sdk/Applications.md +0 -237
  47. package/discord-api-docs/docs/game_sdk/Discord.md +0 -443
  48. package/discord-api-docs/docs/game_sdk/Discord_Voice.md +0 -289
  49. package/discord-api-docs/docs/game_sdk/Images.md +0 -196
  50. package/discord-api-docs/docs/game_sdk/Lobbies.md +0 -1639
  51. package/discord-api-docs/docs/game_sdk/Networking.md +0 -377
  52. package/discord-api-docs/docs/game_sdk/Overlay.md +0 -195
  53. package/discord-api-docs/docs/game_sdk/Relationships.md +0 -234
  54. package/discord-api-docs/docs/game_sdk/SDK_Starter_Guide.md +0 -310
  55. package/discord-api-docs/docs/game_sdk/Storage.md +0 -312
  56. package/discord-api-docs/docs/game_sdk/Store.md +0 -555
  57. package/discord-api-docs/docs/game_sdk/Users.md +0 -178
  58. package/discord-api-docs/docs/interactions/Application_Commands.md +0 -1069
  59. package/discord-api-docs/docs/interactions/Message_Components.md +0 -454
  60. package/discord-api-docs/docs/interactions/Receiving_and_Responding.md +0 -372
  61. package/discord-api-docs/docs/interactions/Slash_Commands.md +0 -3
  62. package/discord-api-docs/docs/resources/Application.md +0 -82
  63. package/discord-api-docs/docs/resources/Audit_Log.md +0 -223
  64. package/discord-api-docs/docs/resources/Channel.md +0 -1267
  65. package/discord-api-docs/docs/resources/Emoji.md +0 -122
  66. package/discord-api-docs/docs/resources/Guild.md +0 -1157
  67. package/discord-api-docs/docs/resources/Guild_Scheduled_Event.md +0 -273
  68. package/discord-api-docs/docs/resources/Guild_Template.md +0 -148
  69. package/discord-api-docs/docs/resources/Invite.md +0 -150
  70. package/discord-api-docs/docs/resources/Stage_Instance.md +0 -106
  71. package/discord-api-docs/docs/resources/Sticker.md +0 -164
  72. package/discord-api-docs/docs/resources/User.md +0 -205
  73. package/discord-api-docs/docs/resources/Voice.md +0 -55
  74. package/discord-api-docs/docs/resources/Webhook.md +0 -281
  75. package/discord-api-docs/docs/rich_presence/Best_Practices.md +0 -88
  76. package/discord-api-docs/docs/rich_presence/FAQ.md +0 -45
  77. package/discord-api-docs/docs/rich_presence/How_To.md +0 -302
  78. package/discord-api-docs/docs/rich_presence/Launch_Checklist.md +0 -46
  79. package/discord-api-docs/docs/topics/Certified_Devices.md +0 -200
  80. package/discord-api-docs/docs/topics/Community_Resources.md +0 -98
  81. package/discord-api-docs/docs/topics/Gateway.md +0 -1600
  82. package/discord-api-docs/docs/topics/OAuth2.md +0 -427
  83. package/discord-api-docs/docs/topics/Opcodes_and_Status_Codes.md +0 -306
  84. package/discord-api-docs/docs/topics/Permissions.md +0 -229
  85. package/discord-api-docs/docs/topics/RPC.md +0 -1597
  86. package/discord-api-docs/docs/topics/Rate_Limits.md +0 -126
  87. package/discord-api-docs/docs/topics/Teams.md +0 -80
  88. package/discord-api-docs/docs/topics/Threads.md +0 -163
  89. package/discord-api-docs/docs/topics/Voice_Connections.md +0 -282
  90. package/discord-api-docs/images/API_center.gif +0 -0
  91. package/discord-api-docs/images/ask-to-join.gif +0 -0
  92. package/discord-api-docs/images/available-published.png +0 -0
  93. package/discord-api-docs/images/button-styles.png +0 -0
  94. package/discord-api-docs/images/certified-device.png +0 -0
  95. package/discord-api-docs/images/command-with-groups-subcommands-parameters.png +0 -0
  96. package/discord-api-docs/images/command-with-groups-subcommands.png +0 -0
  97. package/discord-api-docs/images/command.png +0 -0
  98. package/discord-api-docs/images/cpp-files-sdk.png +0 -0
  99. package/discord-api-docs/images/create-store-channel.png +0 -0
  100. package/discord-api-docs/images/deferred-example.png +0 -0
  101. package/discord-api-docs/images/desktop-select.png +0 -0
  102. package/discord-api-docs/images/game-overlay-sdk-invite.gif +0 -0
  103. package/discord-api-docs/images/game-overlay-sdk-voice-settings.png +0 -0
  104. package/discord-api-docs/images/game-overlay-sdk-voice-widget.png +0 -0
  105. package/discord-api-docs/images/gift-code-creation.png +0 -0
  106. package/discord-api-docs/images/lib-linked-sdk.png +0 -0
  107. package/discord-api-docs/images/message-command.png +0 -0
  108. package/discord-api-docs/images/mobile-select.png +0 -0
  109. package/discord-api-docs/images/previous-new-server-background.png +0 -0
  110. package/discord-api-docs/images/rp-actionable.png +0 -0
  111. package/discord-api-docs/images/rp-all-fields.png +0 -0
  112. package/discord-api-docs/images/rp-bad-art.png +0 -0
  113. package/discord-api-docs/images/rp-good-art.png +0 -0
  114. package/discord-api-docs/images/rp-legend.png +0 -0
  115. package/discord-api-docs/images/rp-long-strings.png +0 -0
  116. package/discord-api-docs/images/rp-non-actionable.png +0 -0
  117. package/discord-api-docs/images/rp-not-all-fields.png +0 -0
  118. package/discord-api-docs/images/rp-profile-example-1.png +0 -0
  119. package/discord-api-docs/images/rp-profile-example-2.png +0 -0
  120. package/discord-api-docs/images/rp-short-strings.png +0 -0
  121. package/discord-api-docs/images/server-banner-example.png +0 -0
  122. package/discord-api-docs/images/server-banner-margin-top.png +0 -0
  123. package/discord-api-docs/images/sku-management.png +0 -0
  124. package/discord-api-docs/images/snowflake.png +0 -0
  125. package/discord-api-docs/images/snowflake_original_size.png +0 -0
  126. package/discord-api-docs/images/spectate.gif +0 -0
  127. package/discord-api-docs/images/team-2fa.png +0 -0
  128. package/discord-api-docs/images/team-make-app.png +0 -0
  129. package/discord-api-docs/images/team-page.png +0 -0
  130. package/discord-api-docs/images/transfer-app-to-team.png +0 -0
  131. package/discord-api-docs/images/user-command.png +0 -0
  132. package/discord-api-docs/package-lock.json +0 -3186
  133. package/discord-api-docs/package.json +0 -38
  134. package/discord-api-docs/tsconfig.eslint.json +0 -4
  135. package/discord-api-docs/tsconfig.json +0 -19
  136. package/tsconfig.json +0 -24
@@ -1,302 +0,0 @@
1
- # Introducing Rich Presence
2
-
3
- > danger
4
- > The SDK that this documentation references, [Discord-RPC](https://github.com/discord/discord-rpc), has been deprecated in favor of our new [Discord GameSDK](#DOCS_GAME_SDK_SDK_STARTER_GUIDE/). Replacement functionality for the Rich Presence SDK can be found in the [Activity Manager](#DOCS_GAME_SDK_ACTIVITIES/) of that SDK. This documentation can be referenced for education but does not entirely reflect the new SDK.
5
-
6
- How easy is it for people to play your game together? With Rich Presence from Discord, it just got so easy, a ~~caveman~~ Junior Dev could do it.
7
-
8
- If you are testing a game integration with Rich Presence, other users will be able to see it. Please create a private test account and do not join any public servers while testing your integration.
9
-
10
- ## So, what is it?
11
-
12
- Rich Presence allows you to leverage the totally overhauled "Now Playing" section in a Discord user's profile to help people play your game together. Rich game data—including duration, score, current boss or map, and so much more—lives inside Discord. You can spectate a friend's game directly from their profile popout, or party up via beautiful chat embeds with real-time information about open party slots and the party's in-game status. No more exchanging usernames and friend codes, or wondering if there's room for you to join. Rich Presence is a living invitation to play together, or to watch your friends kick butt.
13
-
14
- ## Step 0: Get the SDK
15
-
16
- > warn
17
- > Please use our new Discord GameSDK. Read the documentation and get it [here](#DOCS_GAME_SDK_SDK_STARTER_GUIDE/).
18
-
19
- ## So, how does it work?
20
-
21
- We worked hard to make using Discord's Rich Presence system as easy as possible. All you need is our header file—what you will interact with—and our library—where we did all the hard work for you—and you are ready to roll!
22
-
23
- In the header file, you'll find six event-emitting callbacks:
24
-
25
- 1. `ready()`
26
- 2. `errored()`
27
- 3. `disconnected()`
28
- 4. `joinGame()`
29
- 5. `spectateGame()`
30
- 6. `joinRequest()`
31
-
32
- These six callbacks make up the entirety of what you need to implement. Behind the scenes, we do all the heavy lifting for you.
33
-
34
- The header file also contains the `Discord_RunCallbacks()` function. This invokes any pending callbacks from Discord on the calling thread (it's thread safe!).
35
-
36
- ## Initialization
37
-
38
- The first step in implementing Rich Presence is [creating an application](#APPLICATIONS). Once you've created your application, note and save your `Client ID`. You will need this to initialize the SDK; this value will be referred to throughout this documentation as both `client_id` and `application_id`. Next, scroll down to the bottom of your application's page and hit the button that says "Enable Rich Presence". This will allow you to upload assets to your dashboard for later use.
39
-
40
- To begin, you'll register your callback functions to the six `DiscordEventHandlers` and then call `Discord_Initialize()` with your `APPLICATION_ID`. If your game is distributed via Steam, you should also pass your application's Steam ID so Discord can launch your game through Steam:
41
-
42
- ###### SDK Initialization Example
43
-
44
- ```c
45
- void InitDiscord()
46
- {
47
- DiscordEventHandlers handlers;
48
- memset(&handlers, 0, sizeof(handlers));
49
- handlers.ready = handleDiscordReady;
50
- handlers.errored = handleDiscordError;
51
- handlers.disconnected = handleDiscordDisconnected;
52
- handlers.joinGame = handleDiscordJoinGame;
53
- handlers.spectateGame = handleDiscordSpectateGame;
54
- handlers.joinRequest = handleDiscordJoinRequest;
55
-
56
- // Discord_Initialize(const char* applicationId, DiscordEventHandlers* handlers, int autoRegister, const char* optionalSteamId)
57
- Discord_Initialize("418562325121990661", &handlers, 1, "1234");
58
- }
59
- ```
60
-
61
- A quick breakdown on the `Discord_Initialize()` function:
62
-
63
- - `applicationId`: your client_id/application_id
64
- - `handlers`: the callback functions you registered for each Discord event
65
- - `autoRegister`: whether or not to register an application protocol for your game on the player's computer—necessary to launch games from Discord
66
- - `optionalSteamId`: your game's Steam application id, if your game is distributed on Steam
67
-
68
- When you are ready to publish your integration, we recommend digging into the source code of the SDK and copying `discord_register.h`, `discord_register_win.cpp`, `discord_register_osx.m`, and `discord_register_linux.cpp` into your installation and update process. By registering your application protocols on installation and update, your players won't need to run the game before being able to interact with invites, Ask to Join, and spectating in Discord.
69
-
70
- ## Shutting Down
71
-
72
- Don't leave so soon! But when you _do_ shut down your application, don't forget to call `Discord_Shutdown()`. This properly terminates the thread and allows your application to shut down cleanly.
73
-
74
- If you don't want to register all your event handlers at initialization, you can do so dynamically with `Discord_UpdateHandlers()`; this will allow you to register a new set of event handlers. Be mindful that this will delete old handlers if they are not explicitly bound to your handlers struct when calling this function.
75
-
76
- ## Updating Presence
77
-
78
- > warn
79
- > Deprecated in favor of [Discord GameSDK ActivityManager.UpdateActivity()](#DOCS_GAME_SDK_ACTIVITIES/updateactivity)
80
-
81
- The core of Discord's Rich Presence SDK is the `Discord_UpdatePresence()` function. This is what sends your game data up to Discord to be seen and used by others. You should call `Discord_UpdatePresence()` any time something important in the presence payload changes.
82
-
83
- `Discord_UpdatePresence()` has a rate limit of one update per 15 seconds. Developers do not need to do anything to handle this rate limit. The SDK will queue up any presence updates sent in that window and send the newest one once the client is free to do so. If you are sending presence updates very frequently and wondering why you don't see your Discord presence changing, that's why!
84
-
85
- ###### Update Presence Example
86
-
87
- ```c
88
- void UpdatePresence()
89
- {
90
- char buffer[256];
91
- DiscordRichPresence discordPresence;
92
- memset(&discordPresence, 0, sizeof(discordPresence));
93
- discordPresence.state = "In a Group";
94
- sprintf(buffer, "Ranked | Mode: %d", GameEngine.GetMode());
95
- discordPresence.details = buffer;
96
- discordPresence.endTimestamp = time(0) + 5 * 60;
97
- discordPresence.largeImageKey = "canary-large";
98
- discordPresence.smallImageKey = "ptb-small";
99
- discordPresence.partyId = GameEngine.GetPartyId();
100
- discordPresence.partySize = 1;
101
- discordPresence.partyMax = 6;
102
- discordPresence.matchSecret = "4b2fdce12f639de8bfa7e3591b71a0d679d7c93f";
103
- discordPresence.spectateSecret = "e7eb30d2ee025ed05c71ea495f770b76454ee4e0";
104
- discordPresence.instance = 1;
105
- Discord_UpdatePresence(&discordPresence);
106
- }
107
- ```
108
-
109
- ###### Update Presence Payload
110
-
111
- ```c
112
- typedef struct DiscordRichPresence {
113
- const char* state; /* max 128 bytes */
114
- const char* details; /* max 128 bytes */
115
- int64_t startTimestamp;
116
- int64_t endTimestamp;
117
- const char* largeImageKey; /* max 32 bytes */
118
- const char* largeImageText; /* max 128 bytes */
119
- const char* smallImageKey; /* max 32 bytes */
120
- const char* smallImageText; /* max 128 bytes */
121
- const char* partyId; /* max 128 bytes */
122
- int partySize;
123
- int partyMax;
124
- const char* matchSecret; /* max 128 bytes */
125
- const char* joinSecret; /* max 128 bytes */
126
- const char* spectateSecret; /* max 128 bytes */
127
- int8_t instance;
128
- } DiscordRichPresence;
129
- ```
130
-
131
- ###### Update Presence Payload Fields
132
-
133
- | parameter | type | description | example |
134
- | -------------- | -------- | ---------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------- |
135
- | state | char\* | the user's current party status | "Looking to Play", "Playing Solo", "In a Group" |
136
- | details | char\* | what the player is currently doing | "Competitive - Captain's Mode", "In Queue", "Unranked PvP" |
137
- | startTimestamp | int64_t | epoch seconds for game start - including will show time as "elapsed" | 1507665886 |
138
- | endTimestamp | int64_t | epoch seconds for game end - including will show time as "remaining" | 1507665886 |
139
- | largeImageKey | char\* | name of the uploaded image for the large profile artwork | "default" |
140
- | largeImageText | char\* | tooltip for the largeImageKey | "Blade's Edge Arena", "Numbani", "Danger Zone" |
141
- | smallImageKey | char\* | name of the uploaded image for the small profile artwork | "rogue" |
142
- | smallImageText | char\* | tooltip for the smallImageKey | "Rogue - Level 100" |
143
- | partyId | char\* | id of the player's party, lobby, or group | "ae488379-351d-4a4f-ad32-2b9b01c91657" |
144
- | partySize | int | current size of the player's party, lobby, or group | 1 |
145
- | partyMax | int | maximum size of the player's party, lobby, or group | 5 |
146
- | matchSecret | char\* | (for future use) unique hashed string for a player's match | MmhuZToxMjMxMjM6cWl3amR3MWlqZA== |
147
- | spectateSecret | char\* | unique hashed string for Spectate button | MTIzNDV8MTIzNDV8MTMyNDU0 |
148
- | joinSecret | char\* | unique hashed string for chat invitations and Ask to Join | MTI4NzM0OjFpMmhuZToxMjMxMjM= |
149
- | instance | int8_t | (for future use) integer representing a boolean for if the player is in an instance (an in-progress match) | 1 |
150
-
151
- > info
152
- > Sending `endTimestamp` will **always** have the time displayed as "remaining" until the given time. Sending `startTimestamp` will show "elapsed" as long as there is no `endTimestamp` sent.
153
-
154
- Here's a handy image to see how these fields are actually displayed on a profile:
155
-
156
- ![Graphical representation of the legend for rich presence details](rp-legend.png)
157
-
158
- | location | field name | notes |
159
- | -------------------------------------- | ---------------------- | --------------------------------------------------------------------------- |
160
- | First row below title | details | |
161
- | Second row below title | state | |
162
- | Second row below title | partySize | In parenthesis next to the `state`, first number in the format `(1 of 10)` |
163
- | Second row below title | partyMax | In parenthesis next to the `state`, second number in the format `(1 of 10)` |
164
- | Third row below title | startTimestamp | Converted to a format such as `01:33 elapsed` |
165
- | First button at the bottom | joinSecret | Button has the text "Ask to join" |
166
- | Second button at the bottom | spectateSecret | Button has the text "Spectate" |
167
- | Large image to the left of any content | largeImageKey | Four rows high, includes the title but not the bottom buttons |
168
- | Small image to the left of any content | smallImageKey | Small icon inset on the bottom right of the `largeImageKey` |
169
-
170
- Note that this layout may be subject to change without warning. This information is only provided to help those with
171
- impaired eyesight to understand the potential layout of this information in a user interface.
172
-
173
- ## Joining
174
-
175
- > warn
176
- > Deprecated in favor of [Discord GameSDK ActivityManager.OnActivityJoin](#DOCS_GAME_SDK_ACTIVITIES/onactivityjoin) and [Discord GameSDK ActivityManager.OnActivityJoinRequest](#DOCS_GAME_SDK_ACTIVITIES/onactivityjoinrequest)
177
-
178
- #### Relevant Callbacks:
179
-
180
- `joinGame()`
181
- `joinRequest()`
182
-
183
- #### Relevant Payload Data:
184
-
185
- `partyId`
186
- `partySize`
187
- `partyMax`
188
- `joinSecret`
189
-
190
- When you send the relevant payload data in the `Discord_UpdatePresence()` call, your player can invite a Discord chat channel to play with them. This invite is tied to the player's party information; if their `partyId` changes, the invite will expire. If their `partySize` and `partyMax` changes, the invite will add, remove, and fill up slots dynamically.
191
-
192
- Other Discord users can click "Join" on the invitation. Their game will then launch, and the `joinGame()` callback will fire in their client with the inviting player's `joinSecret`. The client should reverse hash or otherwise unencrypt this secret and match the players together.
193
-
194
- ### Ask to Join
195
-
196
- When Player B clicks the Ask to Join button on Player A's profile, the `joinRequest()` callback fires for Player A, sending the following data:
197
-
198
- ###### Ask to Join Payload
199
-
200
- ```c
201
- typedef struct DiscordJoinRequest {
202
- char userId[32];
203
- char username[344];
204
- char discriminator[8];
205
- char avatar[128];
206
- } DiscordJoinRequest;
207
- ```
208
-
209
- ###### Ask to Join Payload Fields
210
-
211
- | parameter | type | description |
212
- | ------------- | --------- | ----------------------------------------------------------------------------------------------------------------------------------- |
213
- | userId | char[24] | the userId of the player asking to join |
214
- | username | char[344] | the username of the player asking to join |
215
- | discriminator | char[8] | the discriminator of the player asking to join |
216
- | avatar\* | char[128] | the avatar hash of the player asking to join—see [image formatting](#DOCS_REFERENCE/image-formatting) for how to retrieve the image |
217
-
218
- > warn
219
- > `avatar` can be an empty string if the user has not uploaded an avatar to Discord
220
-
221
- When it fires, your game should surface this data with a Yes or No choice for Player A to accept whether or not they wish to play with Player B. Then, call `Discord_Respond()` with Player B's `userId` and the appropriate response code:
222
-
223
- ###### Ask to Join Response Codes
224
-
225
- | code | value |
226
- | -------------------- | ----- |
227
- | DISCORD_REPLY_NO | 0 |
228
- | DISCORD_REPLY_YES | 1 |
229
- | DISCORD_REPLY_IGNORE | 2 |
230
-
231
- The Ask to Join request persists for 30 seconds after the request is received, regardless of whether you have called `Discord_RunCallbacks()` within that window. Therefore, keep these two points in mind:
232
-
233
- - Ensure you call `Discord_RunCallbacks()` as frequently as possible to ensure your game client is up to date with any data from Discord
234
- - 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 a `joinSecret` in the presence payload
235
-
236
- ## Spectating
237
-
238
- > warn
239
- > Deprecated in favor of [Discord GameSDK ActivityManager.OnActivitySpectate](#DOCS_GAME_SDK_ACTIVITIES/onactivityspectate)
240
-
241
- #### Relevant Callbacks:
242
-
243
- `spectateGame()`
244
-
245
- #### Relevant Payload Data:
246
-
247
- `spectateSecret`
248
-
249
- When you send the relevant payload data in the `Discord_UpdatePresence()` call, your player will gain the ability to invite a Discord chat channel to spectate their game. This invite is tied to the `matchSecret` and will expire when it changes.
250
-
251
- Other Discord users can click "Spectate" on the invitation. Their game will launch, and the `spectateGame()` callback will fire in their client with the original player's `spectateSecret`. The client should reverse hash or otherwise unencrypt this secret and spectate that player's game.
252
-
253
- ## Secrets
254
-
255
- Security is of the utmost importance to us here at Discord, and we know it is for you, too. That's why we want to make sure that you properly understand `matchSecret`, `joinSecret`, and `spectateSecret` so that your game data is safe and secure over the wire.
256
-
257
- To keep security on the up and up, Discord requires that you properly hash/encode/encrypt/put-a-padlock-on-and-swallow-the-key-but-wait-then-how-would-you-open-it your secrets.
258
-
259
- Secrets are obfuscated data of your choosing. They could be match ids, player ids, lobby ids, etc. You should send us data that someone else's game client would need to join or spectate their friend. If you can't or don't want to support those actions, you don't need to send us secrets.
260
-
261
- ## Rich Presence Field Requirements
262
-
263
- All fields in the `DiscordRichPresence` object are entirely optional. Anything you choose to omit simply won't be displayed; the UI will dynamically adapt from the full Rich Presence object all the way down to the basic presence view. We highly encourage you to include as many fields as you can to make your game as attractive and interactive for other players as possible. However, if you choose to be a bit more selective, here's a handy table for what each piece of Rich Presence requires:
264
-
265
- ###### Rich Presence Field Requirements
266
-
267
- | Field | Custom Artwork | Spectating | Joining | Ask to Join |
268
- | :------------: | :------------: | :--------: | :-----: | :---------: |
269
- | state | | | | |
270
- | details | | | | |
271
- | startTimestamp | | | | |
272
- | endTimestamp | | | | |
273
- | largeImageKey | x | | | |
274
- | smallImageKey | x | | | |
275
- | largeImageText | x | | | |
276
- | smallImageText | x | | | |
277
- | partyId | | | x | x |
278
- | partySize | | | x | x |
279
- | partyMax | | | x | x |
280
- | matchSecret | | | | |
281
- | joinSecret | | | x | x |
282
- | spectateSecret | | x | | |
283
- | instance | | | | |
284
-
285
- ## Your New Developer Dashboard
286
-
287
- Included with the launch of Rich Presence is an overhaul of Discord's Developer Dashboard. We want to make Rich Presence as easy as possible to use. Our first step is helping you ditch your CDN. You're welcome.
288
-
289
- OK, well, not entirely. But! Discord _will_ host any and all artwork that you need to have the very richest of presences. Upload an image, tag it with a key—preferably one you can remember—and **bam**. It's ready for Rich Presence use. Head over to your [applications page](#APPLICATIONS) to check it out!
290
-
291
- > warn
292
- > **Asset keys are automatically normalized to lowercase**. Be mindful of this when referring to them in your code.
293
-
294
- ## A note on testing and Game Detection
295
-
296
- If you don't see Rich Presence data in your profile while testing, make sure you don't have multiple instances of Discord running—if you do, your presence might be changing in one of those!
297
-
298
- If you're testing on your own, we recommend [downloading two separate release channels](https://discord.com/download) of the Discord desktop client. You can log into the stable, public test, and canary builds with separate credentials, making testing easier for a single developer.
299
-
300
- ## So, what now?
301
-
302
- Get to coding! We can't wait to see the awesome integration you come up with. If you need some quick questions answered, look no further than our [Rich Presence FAQ](#DOCS_RICH_PRESENCE_FAQ/). If you want to know how to make your integration the best it can be, read our [Best Practices Guide](#DOCS_RICH_PRESENCE_BEST_PRACTICES/). If you're ready to release, consult our [Launch Checklist](#DOCS_RICH_PRESENCE_LAUNCH_CHECKLIST/) and make sure you haven't missed anything!
@@ -1,46 +0,0 @@
1
- # Rich Presence Launch Checklist
2
-
3
- > danger
4
- > The SDK that this documentation references, [Discord-RPC](https://github.com/discord/discord-rpc), has been deprecated in favor of our new [Discord GameSDK](#DOCS_GAME_SDK_SDK_STARTER_GUIDE/). Replacement functionality for the Rich Presence SDK can be found in the [Activity Manager](#DOCS_GAME_SDK_ACTIVITIES/) of that SDK. This documentation can be referenced for education but does not entirely reflect the new SDK.
5
-
6
- Ready to launch a Rich Presence integration for your game? Did you read our [Best Practices](#DOCS_RICH_PRESENCE_BEST_PRACTICES/) guide? If so, we recommend looking over this checklist one last time to ensure that your integration is as great as it can be!
7
-
8
- > warn
9
- > Our precompiled libraries depend on the [Visual C++ Redistributable for Visual Studio 2015](https://www.microsoft.com/en-us/download/details.aspx?id=48145). If you distribute your game on Steam, make sure to check that box in your common redistributable settings.
10
-
11
- #### Profile Strings
12
-
13
- - Have you made use of all available fields where appropriate?
14
- - Do your strings fit on their own lines without line wrapping?
15
- - Did you check on the smaller profile pop out?
16
- - Do they clearly communicate:
17
- - What the player is currently doing?
18
- - If the player is in a group or playing alone?
19
- - If the player is in a state where they can party up?
20
-
21
- #### Artwork
22
-
23
- - Is your artwork high resolution?
24
- - Are your images at least 1024x1024 pixels?
25
- - Is it clean, interesting, and descriptive without being too highly detailed?
26
- - Do you have artwork for every different state? Don't forget your default state/main menu!
27
- - Did you make use of tooltips and the small image where appropriate?
28
-
29
- #### Joining
30
-
31
- - Have you successfully implemented join invites for your game if applicable?
32
- - Does the state of the invite properly represent the party/group in-game with regards to:
33
- - Size?
34
- - Open slots?
35
- - Discord _and_ non-Discord users in the party?
36
- - Are you able to post invites to Discord without any additional in-game setup or configuration?
37
- - Are you properly removing data from the presence payload when someone can no longer send invites?
38
- - A `joinSecret` should not be sent if the player can't invite anyone!
39
-
40
- #### Spectating
41
-
42
- - Have you successfully implemented spectate invites for your game if applicable?
43
- - Is your game's spectate mode true spectating?
44
- - We do _not_ allow using the Spectate button as a pseudo-Join button.
45
- - Are you properly removing data from the presence payload when someone can no longer spectate?
46
- - A `spectateSecret` should not be sent if the player can't be spectated!
@@ -1,200 +0,0 @@
1
- # Certified Devices
2
-
3
- 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!
4
-
5
- ## How's it work?
6
-
7
- I'm glad you asked!
8
-
9
- 1. [Create an application](#APPLICATIONS) for your hardware vendor—save the Client ID!
10
- 2. Talk to Discord via one simple HTTP or WebSocket call
11
- 3. Send us a [`SET_CERTIFIED_DEVICES`](#DOCS_TOPICS_RPC/setcertifieddevices) WebSocket payload or equivalent HTTP POST whenever the state of the device changes
12
-
13
- 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?
14
-
15
- ![An example of how a certified device may be shown for an example audio input and output device](certified-device.png)
16
-
17
- ## Connecting
18
-
19
- ###### Query String Params
20
-
21
- | Name | Value | Required |
22
- | --------- | -------------------- | --------- |
23
- | v | `1` | All |
24
- | client_id | your app's client id | All |
25
- | encoding | `json` | WebSocket |
26
-
27
- You can send event updates to the following URIs:
28
-
29
- ###### HTTP
30
-
31
- ```
32
- http://127.0.0.1:PORT/rpc?v=1&client_id=YOUR_CLIENT_ID
33
- ```
34
-
35
- ###### WebSocket
36
-
37
- ```
38
- ws://127.0.0.1:PORT?v=1&client_id=YOUR_CLIENT_ID&encoding=json
39
- ```
40
-
41
- `PORT` is a range of ports from `6463` to `6473`. You should iterate over these ports with your request until one returns a success response code or succeeds with a socket connection. Keep track of that port number for the rest of the session.
42
-
43
- To keep your hardware in sync with Discord, send updates any time the hardware mute is toggled, or one of the voice features like echo cancellation is enabled or disabled by the user. This lets Discord get out of the way of your optimization when you're in control, or help out when you're not, ensuring an awesome experience for anyone using your hardware.
44
-
45
- Each time you update, send a full array of `devices`, sorted by your preferred priority. That means if you want a specific headset to be the default that Discord will attempt to use, put it first in the array.
46
-
47
- ## Getting Device UUID
48
-
49
- 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}`.
50
-
51
- > info
52
- > On macOS, the `id` will be the name of the device.
53
-
54
- ###### Microphone Id Example
55
-
56
- ```cpp
57
- id = waveInMessage((HWAVEIN)IntToPtr(index),
58
- DRV_QUERYFUNCTIONINSTANCEID,
59
- (DWORD_PTR)pstrEndpointId,
60
- cbEndpointId);
61
- ```
62
-
63
- ###### Speaker Id Example
64
-
65
- ```cpp
66
- id = waveOutMessage((HWAVEIN)IntToPtr(index),
67
- DRV_QUERYFUNCTIONINSTANCEID,
68
- (DWORD_PTR)pstrEndpointId,
69
- cbEndpointId);
70
- ```
71
-
72
- ## HTTP Example
73
-
74
- ###### HTTP Request Example
75
-
76
- ```
77
- curl -X POST -H 'Content-Type: application/json' -d '
78
- {
79
- "nonce": "9b4e9711-97f3-4f35-b047-32c82a51978e",
80
- "cmd": "SET_CERTIFIED_DEVICES",
81
- "args": {
82
- "devices": [
83
- {
84
- "type": "audioinput",
85
- "id": "{0.0.1.00000000}.{6cff2b76-44a8-46b9-b528-262ad8609d9f}",
86
- "vendor": {
87
- "name": "SteelSeries",
88
- "url": "https://steelseries.com"
89
- },
90
- "model": {
91
- "name": "Arctis 7",
92
- "url": "https://steelseries.com/gaming-headsets/arctis-7"
93
- },
94
- "related": ["{0.0.1.00000000}.{6cff2b76-44a8-46b9-b528-262ad8609d9f}"],
95
- "echo_cancellation": true,
96
- "noise_suppression": true,
97
- "automatic_gain_control": true,
98
- "hardware_mute": false
99
- }
100
- ]
101
- }
102
- }
103
- ' http://127.0.0.1:PORT/rpc?v=1&client_id=YOUR_CLIENT_ID
104
- ```
105
-
106
- The socket will respond with a `200 OK` status code and the following JSON.
107
-
108
- ###### HTTP Response Example
109
-
110
- ```json
111
- {
112
- "cmd": "SET_CERTIFIED_DEVICES",
113
- "data": null,
114
- "evt": null,
115
- "nonce": "9b4e9711-97f3-4f35-b047-32c82a51978e"
116
- }
117
- ```
118
-
119
- ## WebSocket Example
120
-
121
- ###### RPC Command Example
122
-
123
- ```json
124
- {
125
- "nonce": "9b4e9711-97f3-4f35-b047-32c82a51978e",
126
- "cmd": "SET_CERTIFIED_DEVICES",
127
- "args": {
128
- "devices": [
129
- {
130
- "type": "audioinput",
131
- "id": "{0.0.1.00000000}.{6cff2b76-44a8-46b9-b528-262ad8609d9f}",
132
- "vendor": {
133
- "name": "SteelSeries",
134
- "url": "https://steelseries.com"
135
- },
136
- "model": {
137
- "name": "Arctis 7",
138
- "url": "https://steelseries.com/gaming-headsets/arctis-7"
139
- },
140
- "related": ["{0.0.1.00000000}.{6cff2b76-44a8-46b9-b528-262ad8609d9f}"],
141
- "echo_cancellation": true,
142
- "noise_suppression": true,
143
- "automatic_gain_control": true,
144
- "hardware_mute": false
145
- }
146
- ]
147
- }
148
- }
149
- ```
150
-
151
- ###### RPC Response Example
152
-
153
- ```json
154
- {
155
- "nonce": "9b4e9711-97f3-4f35-b047-32c82a51978e",
156
- "cmd": "SET_CERTIFIED_DEVICES",
157
- "data": null,
158
- "evt": null
159
- }
160
- ```
161
-
162
- ## Models
163
-
164
- ###### Device Object
165
-
166
- | Field | Type | Description |
167
- | ------------------------- | -------------------------------------------------------------------- | -------------------------------------------------------- |
168
- | type | [device type](#DOCS_TOPICS_CERTIFIED_DEVICES/models-device-type) | the type of device |
169
- | id | string | the device's Windows UUID |
170
- | vendor | [vendor](#DOCS_TOPICS_CERTIFIED_DEVICES/models-vendor-object) object | the hardware vendor |
171
- | model | [model](#DOCS_TOPICS_CERTIFIED_DEVICES/models-model-object) object | the model of the product |
172
- | related | array of strings | UUIDs of related devices |
173
- | echo_cancellation?\* | boolean | if the device's native echo cancellation is enabled |
174
- | noise_suppression?\* | boolean | if the device's native noise suppression is enabled |
175
- | automatic_gain_control?\* | boolean | if the device's native automatic gain control is enabled |
176
- | hardware_mute?\* | boolean | if the device is hardware muted |
177
-
178
- \*These fields are only applicable for `AUDIO_INPUT` device types
179
-
180
- ###### Vendor Object
181
-
182
- | Field | Type | Description |
183
- | ----- | ------ | ------------------ |
184
- | name | string | name of the vendor |
185
- | url | string | url for the vendor |
186
-
187
- ###### Model Object
188
-
189
- | Field | Type | Description |
190
- | ----- | ------ | ----------------- |
191
- | name | string | name of the model |
192
- | url | string | url for the model |
193
-
194
- ###### Device Type
195
-
196
- | Type | Value |
197
- | ------------ | ------------- |
198
- | AUDIO_INPUT | "audioinput" |
199
- | AUDIO_OUTPUT | "audiooutput" |
200
- | VIDEO_INPUT | "videoinput" |
@@ -1,98 +0,0 @@
1
- # Community Resources
2
-
3
- Discord has the best online community. At least, we like to think so, and this is our website, so our word is law, deal with it. Therefore it's a fact that our community is the best, and they make really awesome things that we want to share with developers to make their lives easier. From permissions calculators to embed visualizers to full libraries to interface with our API, there are so many great things that have come out of our community.
4
-
5
- ## Discord Developers
6
-
7
- The [Official Discord Developers server](https://discord.gg/discord-developers) is a developer ran, but community driven, support hub. If you need help with developing something on Discord or want official updates from the developers, this is the place to be.
8
-
9
- ## Libraries
10
-
11
- 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.
12
-
13
- ###### Discord Libraries
14
-
15
- | Name | Language |
16
- | ------------------------------------------------------------ | ---------- |
17
- | [Discord.Net](https://github.com/discord-net/Discord.Net) | C# |
18
- | [DSharpPlus](https://github.com/DSharpPlus/DSharpPlus) | C# |
19
- | [nyxx](https://github.com/l7ssha/Nyxx) | Dart |
20
- | [DiscordGo](https://github.com/bwmarrin/discordgo) | Go |
21
- | [Discord4J](https://discord4j.com/) | Java |
22
- | [Javacord](https://github.com/Javacord/Javacord) | Java |
23
- | [JDA](https://github.com/DV8FromTheWorld/JDA) | Java |
24
- | [discord.js](https://github.com/discordjs/discord.js) | JavaScript |
25
- | [Eris](https://github.com/abalabahaha/eris) | JavaScript |
26
- | [Discordia](https://github.com/SinisterRectus/Discordia) | Lua |
27
- | [DiscordPHP](https://github.com/discord-php/DiscordPHP) | PHP |
28
- | [discord.py](https://github.com/Rapptz/discord.py) | Python |
29
- | [disnake](https://github.com/DisnakeDev/disnake) | Python |
30
- | [hikari](https://github.com/hikari-py/hikari) | Python |
31
- | [nextcord](https://github.com/nextcord/nextcord) | Python |
32
- | [pycord](https://github.com/Pycord-Development/pycord) | Python |
33
- | [discordrb](https://github.com/shardlab/discordrb) | Ruby |
34
- | [Serenity](https://github.com/serenity-rs/serenity) | Rust |
35
-
36
- ## Interactions
37
-
38
- [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.
39
-
40
- - Clojure
41
- - [ring-discord-auth](https://github.com/JohnnyJayJay/ring-discord-auth)
42
- - Dart
43
- - [nyxx_interactions](https://github.com/l7ssha/Nyxx)
44
- - Go
45
- - [discord-interactions-go](https://github.com/bsdlp/discord-interactions-go)
46
- - Javascript
47
- - [discord-interactions-js](https://github.com/discord/discord-interactions-js)
48
- - [discord-slash-commands](https://github.com/MeguminSama/discord-slash-commands) and its [Deno fork](https://deno.land/x/discord_slash_commands)
49
- - [slash-create](https://github.com/Snazzah/slash-create)
50
- - Python
51
- - [discord-interactions-python](https://github.com/discord/discord-interactions-python)
52
- - [discord-interactions.py](https://github.com/LiBa001/discord-interactions.py)
53
- - [dispike](https://github.com/ms7m/dispike)
54
- - [flask-discord-interactions](https://github.com/Breq16/flask-discord-interactions)
55
- - PHP
56
- - [discord-interactions-php](https://github.com/discord/discord-interactions-php)
57
- - Other
58
- - [caddy-discord-interactions-verifier](https://github.com/CarsonHoffman/caddy-discord-interactions-verifier)
59
- - [Rauf's Slash Command Generator](https://rauf.wtf/slash)
60
- - [Autocode Slash Command Builder](https://autocode.com/tools/discord/command-builder/)
61
-
62
- ## Game SDK Tools
63
-
64
- Discord Game SDK's lobby and networking layer shares similarities with other gaming platforms (i.e. Valve's Steamworks SDK). The following open source library provides developers a uniform interface for these shared features and can simplify developing for multiple platforms. Note: this library is tailored for Unity3D development.
65
-
66
- - [HouraiNetworking](https://github.com/HouraiTeahouse/HouraiNetworking)
67
-
68
- ## Dispatch Tools
69
-
70
- Using Discord's [Dispatch](#DOCS_DISPATCH_DISPATCH_AND_YOU) tool for game developers publishing on Discord can sometimes involve using the same long commands multiple times. The following open-source tool helps shorten these commands for you. It will also provide webhook support for when you're pushing an update.
71
-
72
- - [JohnyTheCarrot's Dispatch CLI](https://github.com/JohnyTheCarrot/droops-dispatch)
73
-
74
- ## Permission Calculators
75
-
76
- [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:
77
-
78
- - [FiniteReality's Permissions Calculator](https://finitereality.github.io/permissions-calculator/?v=0)
79
- - [abalabahaha's Permissions Calculator](https://discordapi.com/permissions.html#0)
80
-
81
- ## Intent Calculators
82
-
83
- [Gateway Intents](#DOCS_TOPICS_GATEWAY/gateway-intents) are pretty confusing at first. If you're not sure what to send in your [identify payload](#DOCS_TOPICS_GATEWAY/identify), then these tools may be of help:
84
-
85
- - [ziad87's Intent Calculator](https://ziad87.net/intents/)
86
- - [Larko's Intent Calculator](https://discord-intents-calculator.vercel.app/)
87
-
88
- ## Embed Visualizer
89
-
90
- Webhooks and embeds might seem like black magic. That's because they are, but let us help you demystify them a bit. This sweet embed visualizer lets you play around with JSON data and see exactly how it will look embedded in Discord. It even includes a webhook mode!
91
-
92
- - [Autocode Embed Builder](https://autocode.com/tools/discord/embed-builder/)
93
-
94
- ## API Types
95
-
96
- If you're working on a project that interacts with our API, you might find an API types module useful as it provides type inspection/completion for the Discord API.
97
-
98
- - [discord.js API Types](https://github.com/discordjs/discord-api-types)