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,1597 +0,0 @@
1
- # RPC
2
-
3
- > danger
4
- > For now, RPC is in a private beta. We are not currently accepting any new developers into the program at this time.
5
-
6
- All Discord clients have an RPC server running on localhost that allows control over local Discord clients.
7
-
8
- ###### RPC Versions
9
-
10
- | Version | Out of Service |
11
- | ------- | -------------- |
12
- | 1 | no |
13
-
14
- ## Restrictions
15
-
16
- For connections to the RPC server, a [list of approved testers](#DOCS_TOPICS_RPC/authorize) is used to restrict access while you're still developing. You can invite up to 50 people.
17
-
18
- For applications/games not approved, we limit you to creating 10 guilds and 10 channels. This limit is raised to virtually unlimited after approval.
19
-
20
- ## Payloads
21
-
22
- ###### Payload Structure
23
-
24
- | Field | Type | Description | Present |
25
- | ----- | ------ | --------------------------------------------------------------------- | -------------------------------------------------------- |
26
- | cmd | enum | [payload command](#DOCS_TOPICS_RPC/commands-and-events-rpc-commands) | Always |
27
- | nonce | string | unique string used once for replies from the server | In responses to commands (not subscribed events) |
28
- | evt | enum | [subscription event](#DOCS_TOPICS_RPC/commands-and-events-rpc-events) | In subscribed events, errors, and (un)subscribing events |
29
- | data | object | event data | In responses from the server |
30
- | args | object | command arguments | In commands sent to the server |
31
-
32
- ## Connecting
33
-
34
- The local RPC server runs on localhost (`127.0.0.1`) and is set up to process WebSocket connections and proxy API requests.
35
-
36
- For WebSocket connections, the connection is always `ws://127.0.0.1:PORT/?v=VERSION&client_id=CLIENT_ID&encoding=ENCODING`:
37
-
38
- - `CLIENT_ID` is the client ID of the application accessing the RPC Server.
39
- - `VERSION` is the version of the RPC Server.
40
- - `PORT` is the port of the RPC Server.
41
- - `ENCODING` is the type of encoding for this connection to use. `json` and `etf` are supported.
42
-
43
- To begin, you'll need to create an app. Head to [your apps](#APPLICATIONS) and click the big plus button. When you create an app on our Developers site, you must specify an "RPC Origin" and "Redirect URI" from which to permit connections and authorizations. **The origin you send when connecting and the redirect uri you send when exchanging an authorization code for an access token must match one of the ones entered on the Developers site.**
44
-
45
- When establishing a WebSocket connection, we verify the Origin header on connection to prevent client ID spoofing. You will be instantly disconnected if the Origin does not match.
46
-
47
- If you're connecting to the RPC server from within a browser, RPC origins are usually in the form `SCHEME://HOST[:PORT]`, where `SCHEME` is typically https or http, `HOST` is your domain or ip, and `PORT` is the port of the webserver from which the user will be connecting (omitted for ports 80 and 443). For example, `https://discord.com` would be used if the user were connecting from `https://discord.com/some/page/url`.
48
-
49
- If you're connecting to the RPC server from within a non-browser application (like a game), you just need to make sure that the origin is sent with the upgrade request when connecting to the WebSocket. For local testing, we recommend testing with an origin like `https://localhost`. For production apps, we recommend setting the origin to your company/game's domain, for example `https://discord.com`.
50
-
51
- ### RPC Server Ports
52
-
53
- The port range for Discord's local RPC server is [6463, 6472]. Since the RPC server runs locally, there's a chance it might not be able to obtain its preferred port when it tries to bind to one. For this reason, the local RPC server will pick one port out of a range of these 10 ports, trying sequentially until it can bind to one. When implementing your client, you should perform the same sequential checking to find the correct port to connect to.
54
-
55
- ## Authenticating
56
-
57
- In order to call any commands over RPC, you must be authenticated or you will receive a code `4006` error response. Thankfully, we've removed the oppressive nature of a couple commands that will let you `AUTHORIZE` and `AUTHENTICATE` new users. First, call [AUTHORIZE](#DOCS_TOPICS_RPC/authorize):
58
-
59
- ###### RPC Authorize Example
60
-
61
- ```json
62
- {
63
- "nonce": "f48f6176-4afb-4c03-b1b8-d960861f5216",
64
- "args": {
65
- "client_id": "192741864418312192",
66
- "scopes": ["rpc", "identify"]
67
- },
68
- "cmd": "AUTHORIZE"
69
- }
70
- ```
71
-
72
- The user will then be prompted to authorize your app to access RPC on Discord. The `AUTHORIZE` command returns a `code` that you can exchange with a POST to `https://discord.com/api/oauth2/token` containing the [standard OAuth2 body parameters](https://tools.ietf.org/html/rfc6749#section-4.1.3) for the token exchange. The token endpoint on our API will return an `access_token` that can be sent with [AUTHENTICATE](#DOCS_TOPICS_RPC/authenticate):
73
-
74
- ###### RPC Authenticate Example
75
-
76
- ```json
77
- {
78
- "nonce": "5bb10a43-1fdc-4391-9512-0c8f4aa203d4",
79
- "args": {
80
- "access_token": "CZhtkLDpNYXgPH9Ml6shqh2OwykChw"
81
- },
82
- "cmd": "AUTHENTICATE"
83
- }
84
- ```
85
-
86
- You can now call RPC commands on behalf of the authorized user!
87
-
88
- ## Commands and Events
89
-
90
- Commands are requests made to the RPC socket by a client.
91
-
92
- ###### RPC Commands
93
-
94
- | Name | Description |
95
- | ---------------------------------------------------------------------- | --------------------------------------------------------------- |
96
- | [DISPATCH](#DOCS_TOPICS_RPC/commands-and-events-rpc-events) | event dispatch |
97
- | [AUTHORIZE](#DOCS_TOPICS_RPC/authorize) | used to authorize a new client with your app |
98
- | [AUTHENTICATE](#DOCS_TOPICS_RPC/authenticate) | used to authenticate an existing client with your app |
99
- | [GET_GUILD](#DOCS_TOPICS_RPC/getguild) | used to retrieve guild information from the client |
100
- | [GET_GUILDS](#DOCS_TOPICS_RPC/getguilds) | used to retrieve a list of guilds from the client |
101
- | [GET_CHANNEL](#DOCS_TOPICS_RPC/getchannel) | used to retrieve channel information from the client |
102
- | [GET_CHANNELS](#DOCS_TOPICS_RPC/getchannels) | used to retrieve a list of channels for a guild from the client |
103
- | [SUBSCRIBE](#DOCS_TOPICS_RPC/subscribe) | used to subscribe to an RPC event |
104
- | [UNSUBSCRIBE](#DOCS_TOPICS_RPC/unsubscribe) | used to unsubscribe from an RPC event |
105
- | [SET_USER_VOICE_SETTINGS](#DOCS_TOPICS_RPC/setuservoicesettings) | used to change voice settings of users in voice channels |
106
- | [SELECT_VOICE_CHANNEL](#DOCS_TOPICS_RPC/selectvoicechannel) | used to join or leave a voice channel, group dm, or dm |
107
- | [GET_SELECTED_VOICE_CHANNEL](#DOCS_TOPICS_RPC/getselectedvoicechannel) | used to get the current voice channel the client is in |
108
- | [SELECT_TEXT_CHANNEL](#DOCS_TOPICS_RPC/selecttextchannel) | used to join or leave a text channel, group dm, or dm |
109
- | [GET_VOICE_SETTINGS](#DOCS_TOPICS_RPC/getvoicesettings) | used to retrieve the client's voice settings |
110
- | [SET_VOICE_SETTINGS](#DOCS_TOPICS_RPC/setvoicesettings) | used to set the client's voice settings |
111
- | [SET_CERTIFIED_DEVICES](#DOCS_TOPICS_RPC/setcertifieddevices) | used to send info about certified hardware devices |
112
- | [SET_ACTIVITY](#DOCS_TOPICS_RPC/setactivity) | used to update a user's Rich Presence |
113
- | [SEND_ACTIVITY_JOIN_INVITE](#DOCS_TOPICS_RPC/sendactivityjoininvite) | used to consent to a Rich Presence Ask to Join request |
114
- | [CLOSE_ACTIVITY_REQUEST](#DOCS_TOPICS_RPC/closeactivityrequest) | used to reject a Rich Presence Ask to Join request |
115
-
116
- Events are payloads sent over the socket to a client that correspond to events in Discord.
117
-
118
- ###### RPC Events
119
-
120
- | Name | Description |
121
- | --------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- |
122
- | [READY](#DOCS_TOPICS_RPC/ready) | non-subscription event sent immediately after connecting, contains server information |
123
- | [ERROR](#DOCS_TOPICS_RPC/error) | non-subscription event sent when there is an error, including command responses |
124
- | [GUILD_STATUS](#DOCS_TOPICS_RPC/guildstatus) | sent when a subscribed server's state changes |
125
- | [GUILD_CREATE](#DOCS_TOPICS_RPC/guildcreate) | sent when a guild is created/joined on the client |
126
- | [CHANNEL_CREATE](#DOCS_TOPICS_RPC/channelcreate) | sent when a channel is created/joined on the client |
127
- | [VOICE_CHANNEL_SELECT](#DOCS_TOPICS_RPC/voicechannelselect) | sent when the client joins a voice channel |
128
- | [VOICE_STATE_CREATE](#DOCS_TOPICS_RPC/voicestatecreatevoicestateupdatevoicestatedelete) | sent when a user joins a subscribed voice channel |
129
- | [VOICE_STATE_UPDATE](#DOCS_TOPICS_RPC/voicestatecreatevoicestateupdatevoicestatedelete) | sent when a user's voice state changes in a subscribed voice channel (mute, volume, etc.) |
130
- | [VOICE_STATE_DELETE](#DOCS_TOPICS_RPC/voicestatecreatevoicestateupdatevoicestatedelete) | sent when a user parts a subscribed voice channel |
131
- | [VOICE_SETTINGS_UPDATE](#DOCS_TOPICS_RPC/voicesettingsupdate) | sent when the client's voice settings update |
132
- | [VOICE_CONNECTION_STATUS](#DOCS_TOPICS_RPC/voiceconnectionstatus) | sent when the client's voice connection status changes |
133
- | [SPEAKING_START](#DOCS_TOPICS_RPC/speakingstartspeakingstop) | sent when a user in a subscribed voice channel speaks |
134
- | [SPEAKING_STOP](#DOCS_TOPICS_RPC/speakingstartspeakingstop) | sent when a user in a subscribed voice channel stops speaking |
135
- | [MESSAGE_CREATE](#DOCS_TOPICS_RPC/messagecreatemessageupdatemessagedelete) | sent when a message is created in a subscribed text channel |
136
- | [MESSAGE_UPDATE](#DOCS_TOPICS_RPC/messagecreatemessageupdatemessagedelete) | sent when a message is updated in a subscribed text channel |
137
- | [MESSAGE_DELETE](#DOCS_TOPICS_RPC/messagecreatemessageupdatemessagedelete) | sent when a message is deleted in a subscribed text channel |
138
- | [NOTIFICATION_CREATE](#DOCS_TOPICS_RPC/notificationcreate) | sent when the client receives a notification (mention or new message in eligible channels) |
139
- | [ACTIVITY_JOIN](#DOCS_TOPICS_RPC/activityjoin) | sent when the user clicks a Rich Presence join invite in chat to join a game |
140
- | [ACTIVITY_SPECTATE](#DOCS_TOPICS_RPC/activityspectate) | sent when the user clicks a Rich Presence spectate invite in chat to spectate a game |
141
- | [ACTIVITY_JOIN_REQUEST](#DOCS_TOPICS_RPC/activityjoinrequest) | sent when the user receives a Rich Presence Ask to Join request |
142
-
143
- #### AUTHORIZE
144
-
145
- Used to authenticate a new client with your app. By default this pops up a modal in-app that asks the user to authorize access to your app.
146
-
147
- **We currently do not allow access to RPC for unapproved apps without being on the game's list of testers**. We grant 50 testing spots, which should be ample for development. After approval, this restriction is removed and your app will be accessible to anyone.
148
-
149
- We also have an RPC token system to bypass the user authorization modal. This is usable by approved games as well as by users on a game's list of testers, and also disallows use of the `messages.read` scope. If you have been granted access, you can send a POST request to `https://discord.com/api/oauth2/token/rpc` with your application's `client_id` and `client_secret` in the body (sent as a url-encoded body, **not JSON**). You can then pass the returned `rpc_token` value to the `rpc_token` field in your RPC authorize request (documented below).
150
-
151
- ###### Authorize Argument Structure
152
-
153
- | Field | Type | Description |
154
- | --------- | ---------------------------------------------------------------------------- | ------------------------------------------------------------------------- |
155
- | scopes | array of [OAuth2 scopes](#DOCS_TOPICS_OAUTH2/shared-resources-oauth2-scopes) | scopes to authorize |
156
- | client_id | string | OAuth2 application id |
157
- | rpc_token | string | one-time use RPC token |
158
- | username | string | username to create a guest account with if the user does not have Discord |
159
-
160
- ###### Authorize Response Structure
161
-
162
- | Field | Type | Description |
163
- | ----- | ------ | ------------------------- |
164
- | code | string | OAuth2 authorization code |
165
-
166
- ###### Example Authorize Command Payload
167
-
168
- ```json
169
- {
170
- "nonce": "f48f6176-4afb-4c03-b1b8-d960861f5216",
171
- "args": {
172
- "client_id": "192741864418312192",
173
- "scopes": ["rpc", "identify"]
174
- },
175
- "cmd": "AUTHORIZE"
176
- }
177
- ```
178
-
179
- ###### Example Authorize Response Payload
180
-
181
- ```json
182
- {
183
- "cmd": "AUTHORIZE",
184
- "data": {
185
- "code": "O62Q9JzFe8BEOUzIfsAndOjNd2V4sJ"
186
- },
187
- "nonce": "f48f6176-4afb-4c03-b1b8-d960861f5216"
188
- }
189
- ```
190
-
191
- #### AUTHENTICATE
192
-
193
- Used to authenticate an existing client with your app.
194
-
195
- ###### Authenticate Argument Structure
196
-
197
- | Field | Type | Description |
198
- | ------------ | ------ | ------------------- |
199
- | access_token | string | OAuth2 access token |
200
-
201
- ###### Authenticate Response Structure
202
-
203
- | Field | Type | Description |
204
- | ----------- | --------------------------------------------------------------------------------------- | ------------------------------- |
205
- | user | partial [user](#DOCS_RESOURCES_USER/user-object) object | the authed user |
206
- | scopes | array of [OAuth2 scopes](#DOCS_TOPICS_OAUTH2/shared-resources-oauth2-scopes) | authorized scopes |
207
- | expires | date | expiration date of OAuth2 token |
208
- | application | [OAuth2 application](#DOCS_TOPICS_RPC/authenticate-oauth2-application-structure) object | application the user authorized |
209
-
210
- ###### OAuth2 Application Structure
211
-
212
- | Field | Type | Description |
213
- | ----------- | ---------------- | ------------------------ |
214
- | description | string | application description |
215
- | icon | string | hash of the icon |
216
- | id | snowflake | application client id |
217
- | rpc_origins | array of strings | array of rpc origin urls |
218
- | name | string | application name |
219
-
220
- ###### Example Authenticate Command Payload
221
-
222
- ```json
223
- {
224
- "nonce": "5bb10a43-1fdc-4391-9512-0c8f4aa203d4",
225
- "args": {
226
- "access_token": "CZhtkLDpNYXgPH9Ml6shqh2OwykChw"
227
- },
228
- "cmd": "AUTHENTICATE"
229
- }
230
- ```
231
-
232
- ###### Example Authenticate Response Payload
233
-
234
- ```json
235
- {
236
- "cmd": "AUTHENTICATE",
237
- "data": {
238
- "application": {
239
- "description": "test app description",
240
- "icon": "d6b51c21c48482d5b64aa4832d92fe14",
241
- "id": "192741864418312192",
242
- "rpc_origins": ["http://localhost:3344"],
243
- "name": "test app"
244
- },
245
- "expires": "2017-06-29T19:09:52.361000+00:00",
246
- "user": {
247
- "username": "test user",
248
- "discriminator": "7479",
249
- "id": "190320984123768832",
250
- "avatar": "b004ec1740a63ca06ae2e14c5cee11f3"
251
- },
252
- "scopes": ["rpc", "identify"]
253
- },
254
- "nonce": "5bb10a43-1fdc-4391-9512-0c8f4aa203d4"
255
- }
256
- ```
257
-
258
- #### GET_GUILDS
259
-
260
- Used to get a list of guilds the client is in.
261
-
262
- ###### Get Guilds Response Structure
263
-
264
- | Field | Type | Description |
265
- | ------ | -------------------------------------------------------------------- | ------------------------- |
266
- | guilds | array of partial [guild](#DOCS_RESOURCES_GUILD/guild-object) objects | the guilds the user is in |
267
-
268
- ###### Example Get Guilds Command Payload
269
-
270
- ```json
271
- {
272
- "nonce": "e16fcbed-8bfa-4fd4-ba09-73b72e809833",
273
- "args": {},
274
- "cmd": "GET_GUILDS"
275
- }
276
- ```
277
-
278
- ###### Example Get Guilds Response Payload
279
-
280
- ```json
281
- {
282
- "cmd": "GET_GUILDS",
283
- "data": {
284
- "guilds": [
285
- {
286
- "id": "199737254929760256",
287
- "name": "test"
288
- }
289
- ]
290
- },
291
- "nonce": "e16fcbed-8bfa-4fd4-ba09-73b72e809833"
292
- }
293
- ```
294
-
295
- #### GET_GUILD
296
-
297
- Used to get a guild the client is in.
298
-
299
- ###### Get Guild Argument Structure
300
-
301
- | Field | Type | Description |
302
- | -------- | ------- | ------------------------------------------------------------ |
303
- | guild_id | string | id of the guild to get |
304
- | timeout | integer | asynchronously get guild with time to wait before timing out |
305
-
306
- ###### Get Guild Response Structure
307
-
308
- | Field | Type | Description |
309
- | -------- | -------------------------------------------------------------------------- | ----------------------------------------------------- |
310
- | id | string | guild id |
311
- | name | string | guild name |
312
- | icon_url | string | guild icon url |
313
- | members | array of [guild member](#DOCS_RESOURCES_GUILD/guild-member-object) objects | members of the guild (deprecated; always empty array) |
314
-
315
- ###### Example Get Guild Command Payload
316
-
317
- ```json
318
- {
319
- "nonce": "9524922c-3d32-413a-bdaa-0804f4332588",
320
- "args": {
321
- "guild_id": "199737254929760256"
322
- },
323
- "cmd": "GET_GUILD"
324
- }
325
- ```
326
-
327
- ###### Example Get Guild Response Payload
328
-
329
- ```json
330
- {
331
- "cmd": "GET_GUILD",
332
- "data": {
333
- "id": "199737254929760256",
334
- "name": "test",
335
- "icon_url": null,
336
- "members": []
337
- },
338
- "nonce": "9524922c-3d32-413a-bdaa-0804f4332588"
339
- }
340
- ```
341
-
342
- #### GET_CHANNEL
343
-
344
- Used to get a channel the client is in.
345
-
346
- ###### Get Channel Argument Structure
347
-
348
- | Field | Type | Description |
349
- | ---------- | ------ | ------------------------ |
350
- | channel_id | string | id of the channel to get |
351
-
352
- ###### Get Channel Response Structure
353
-
354
- | Field | Type | Description |
355
- | ------------ | ------------------------------------------------------------------------ | ---------------------------------------------------------------- |
356
- | id | string | channel id |
357
- | guild_id | string | channel's guild id |
358
- | name | string | channel name |
359
- | type | integer | channel type (guild text: 0, guild voice: 2, dm: 1, group dm: 3) |
360
- | topic | string | (text) channel topic |
361
- | bitrate | integer | (voice) bitrate of voice channel |
362
- | user_limit | integer | (voice) user limit of voice channel (0 for none) |
363
- | position | integer | position of channel in channel list |
364
- | voice_states | array of [voice state](#DOCS_RESOURCES_VOICE/voice-state-object) objects | (voice) channel's voice states |
365
- | messages | array of [message](#DOCS_RESOURCES_CHANNEL/message-object) objects | (text) channel's messages |
366
-
367
- ###### Example Get Channel Command Payload
368
-
369
- ```json
370
- {
371
- "nonce": "f682697e-d257-4a17-ac0a-7e4b84e66663",
372
- "args": {
373
- "channel_id": "199737254929760257"
374
- },
375
- "cmd": "GET_CHANNEL"
376
- }
377
- ```
378
-
379
- ###### Example Get Channel Response Payload
380
-
381
- ```json
382
- {
383
- "cmd": "GET_CHANNEL",
384
- "data": {
385
- "id": "199737254929760257",
386
- "name": "General",
387
- "type": 2,
388
- "bitrate": 64000,
389
- "user_limit": 0,
390
- "guild_id": "199737254929760256",
391
- "position": 0,
392
- "voice_states": [
393
- {
394
- "voice_state": {
395
- "mute": false,
396
- "deaf": false,
397
- "self_mute": false,
398
- "self_deaf": false,
399
- "suppress": false
400
- },
401
- "user": {
402
- "id": "190320984123768832",
403
- "username": "test 2",
404
- "discriminator": "7479",
405
- "avatar": "b004ec1740a63ca06ae2e14c5cee11f3",
406
- "bot": false
407
- },
408
- "nick": "test user 2",
409
- "volume": 110,
410
- "mute": false,
411
- "pan": {
412
- "left": 1.0,
413
- "right": 1.0
414
- }
415
- }
416
- ]
417
- },
418
- "nonce": "f682697e-d257-4a17-ac0a-7e4b84e66663"
419
- }
420
- ```
421
-
422
- #### GET_CHANNELS
423
-
424
- Used to get a guild's channels the client is in.
425
-
426
- ###### Get Channels Argument Structure
427
-
428
- | Field | Type | Description |
429
- | -------- | ------ | ----------------------------------- |
430
- | guild_id | string | id of the guild to get channels for |
431
-
432
- ###### Get Channels Response Structure
433
-
434
- | Field | Type | Description |
435
- | -------- | -------------------------------------------------------------------------- | ----------------------------- |
436
- | channels | array of partial [channel](#DOCS_RESOURCES_CHANNEL/channel-object) objects | guild channels the user is in |
437
-
438
- ###### Example Get Channels Command Payload
439
-
440
- ```json
441
- {
442
- "nonce": "0dee7bd4-8f62-4ecc-9e0f-1b1839a4fa93",
443
- "args": {
444
- "guild_id": "199737254929760256"
445
- },
446
- "cmd": "GET_CHANNELS"
447
- }
448
- ```
449
-
450
- ###### Example Get Channels Response Payload
451
-
452
- ```json
453
- {
454
- "cmd": "GET_CHANNELS",
455
- "data": {
456
- "channels": [
457
- {
458
- "id": "199737254929760256",
459
- "name": "general",
460
- "type": 0
461
- },
462
- {
463
- "id": "199737254929760257",
464
- "name": "General",
465
- "type": 2
466
- }
467
- ]
468
- },
469
- "nonce": "0dee7bd4-8f62-4ecc-9e0f-1b1839a4fa93"
470
- }
471
- ```
472
-
473
- #### SET_USER_VOICE_SETTINGS
474
-
475
- Used to change voice settings of users in voice channels
476
-
477
- ###### Set User Voice Settings Argument and Response Structure
478
-
479
- | Field | Type | Description |
480
- | ------- | -------------------------------------------------------------- | -------------------------------------------------------- |
481
- | user_id | string | user id |
482
- | pan? | [pan](#DOCS_TOPICS_RPC/setuservoicesettings-pan-object) object | set the pan of the user |
483
- | volume? | integer | set the volume of user (defaults to 100, min 0, max 200) |
484
- | mute? | boolean | set the mute state of the user |
485
-
486
- > info
487
- > In the current release, we only support a single modifier of voice settings at a time over RPC.
488
- > If an app changes voice settings, it will lock voice settings so that other apps connected simultaneously
489
- > lose the ability to change voice settings. Settings reset to what they were before being changed after the
490
- > controlling app disconnects. When an app that has previously set voice settings connects, the client will swap
491
- > to that app's configured voice settings and lock voice settings again. This is a temporary situation that will
492
- > be changed in the future.
493
-
494
- ###### Pan Object
495
-
496
- | Field | Type | Description |
497
- | ----- | ----- | -------------------------------------- |
498
- | left | float | left pan of user (min: 0.0, max: 1.0) |
499
- | right | float | right pan of user (min: 0.0, max: 1.0) |
500
-
501
- ###### Example Set User Voice Settings Command Payload
502
-
503
- ```json
504
- {
505
- "nonce": "eafc8152-2248-4478-9827-8457b7900cb4",
506
- "args": {
507
- "user_id": "192731515703001088",
508
- "pan": {
509
- "left": 1.0,
510
- "right": 1.0
511
- },
512
- "volume": 120,
513
- "mute": false
514
- },
515
- "cmd": "SET_USER_VOICE_SETTINGS"
516
- }
517
- ```
518
-
519
- ###### Example Set User Voice Settings Response Payload
520
-
521
- ```json
522
- {
523
- "cmd": "SET_USER_VOICE_SETTINGS",
524
- "data": {
525
- "user_id": "192731515703001088",
526
- "pan": {
527
- "left": 1.0,
528
- "right": 1.0
529
- },
530
- "volume": 120,
531
- "mute": false
532
- },
533
- "nonce": "eafc8152-2248-4478-9827-8457b7900cb4"
534
- }
535
- ```
536
-
537
- #### SELECT_VOICE_CHANNEL
538
-
539
- Used to join and leave voice channels, group dms, or dms. Returns the [Get Channel](#DOCS_TOPICS_RPC/getchannel) response, `null` if none.
540
-
541
- ###### Select Voice Channel Argument Structure
542
-
543
- | Field | Type | Description |
544
- | ---------- | ------- | --------------------------------------------------------------- |
545
- | channel_id | string | channel id to join (or `null` to leave) |
546
- | timeout | integer | asynchronously join channel with time to wait before timing out |
547
- | force | boolean | forces a user to join a voice channel |
548
-
549
- > warn
550
- > When trying to join the user to a voice channel, you will receive a `5003` error coded response if the user is already in a voice channel. The `force` parameter should only be specified in response to the case where a user is already in a voice channel and they have **approved** to be moved by your app to a new voice channel.
551
-
552
- ###### Example Select Voice Channel Command Payload
553
-
554
- ```json
555
- {
556
- "nonce": "5d9df76d-6408-46a1-9368-33dca74fa423",
557
- "args": {
558
- "channel_id": "199737254929760257"
559
- },
560
- "cmd": "SELECT_VOICE_CHANNEL"
561
- }
562
- ```
563
-
564
- ###### Example Select Voice Channel Response Payload
565
-
566
- ```json
567
- {
568
- "cmd": "SELECT_VOICE_CHANNEL",
569
- "data": {
570
- "id": "199737254929760257",
571
- "name": "General",
572
- "type": 2,
573
- "bitrate": 64000,
574
- "user_limit": 0,
575
- "guild_id": "199737254929760256",
576
- "position": 0,
577
- "voice_states": [
578
- {
579
- "voice_state": {
580
- "mute": false,
581
- "deaf": false,
582
- "self_mute": false,
583
- "self_deaf": false,
584
- "suppress": false
585
- },
586
- "user": {
587
- "id": "190320984123768832",
588
- "username": "test 2",
589
- "discriminator": "7479",
590
- "avatar": "b004ec1740a63ca06ae2e14c5cee11f3",
591
- "bot": false
592
- },
593
- "nick": "test user 2",
594
- "mute": false,
595
- "volume": 110,
596
- "pan": {
597
- "left": 1.0,
598
- "right": 1.0
599
- }
600
- }
601
- ]
602
- },
603
- "nonce": "5d9df76d-6408-46a1-9368-33dca74fa423"
604
- }
605
- ```
606
-
607
- #### GET_SELECTED_VOICE_CHANNEL
608
-
609
- Used to get the client's current voice channel. There are no arguments for this command. Returns the [Get Channel](#DOCS_TOPICS_RPC/getchannel) response, or `null` if none.
610
-
611
- #### SELECT_TEXT_CHANNEL
612
-
613
- Used to join and leave text channels, group dms, or dms. Returns the [Get Channel](#DOCS_TOPICS_RPC/getchannel) response, or `null` if none.
614
-
615
- ###### Select Text Channel Argument Structure
616
-
617
- | Field | Type | Description |
618
- | ---------- | ------- | --------------------------------------------------------------- |
619
- | channel_id | string | channel id to join (or `null` to leave) |
620
- | timeout | integer | asynchronously join channel with time to wait before timing out |
621
-
622
- #### GET_VOICE_SETTINGS
623
-
624
- ###### Get Voice Settings Response Structure
625
-
626
- | Field | Type | Description |
627
- | ---------------------- | ---------------------------------------------------------------------------------------------- | --------------------------------- |
628
- | input | [voice settings input](#DOCS_TOPICS_RPC/getvoicesettings-voice-settings-input-object) object | input settings |
629
- | output | [voice settings output](#DOCS_TOPICS_RPC/getvoicesettings-voice-settings-output-object) object | output settings |
630
- | mode | [voice settings mode](#DOCS_TOPICS_RPC/getvoicesettings-voice-settings-mode-object) object | voice mode settings |
631
- | automatic_gain_control | boolean | state of automatic gain control |
632
- | echo_cancellation | boolean | state of echo cancellation |
633
- | noise_suppression | boolean | state of noise suppression |
634
- | qos | boolean | state of voice quality of service |
635
- | silence_warning | boolean | state of silence warning notice |
636
- | deaf | boolean | state of self-deafen |
637
- | mute | boolean | state of self-mute |
638
-
639
- ###### Voice Settings Input Object
640
-
641
- | Field | Type | Description |
642
- | ----------------- | ---------------- | -------------------------------------------------------------------------- |
643
- | device_id | string | device id |
644
- | volume | float | input voice level (min: 0, max: 100) |
645
- | available_devices | array of objects | array of _read-only_ device objects containing `id` and `name` string keys |
646
-
647
- ###### Voice Settings Output Object
648
-
649
- | Field | Type | Description |
650
- | ----------------- | ---------------- | -------------------------------------------------------------------------- |
651
- | device_id | string | device id |
652
- | volume | float | output voice level (min: 0, max: 200) |
653
- | available_devices | array of objects | array of _read-only_ device objects containing `id` and `name` string keys |
654
-
655
- ###### Voice Settings Mode Object
656
-
657
- | Field | Type | Description |
658
- | -------------- | ---------------------------------------------------------------------------------------- | ------------------------------------------------------------------- |
659
- | type | string | voice setting mode type (can be `PUSH_TO_TALK` or `VOICE_ACTIVITY`) |
660
- | auto_threshold | boolean | voice activity threshold automatically sets its threshold |
661
- | threshold | float | threshold for voice activity (in dB) (min: -100, max: 0) |
662
- | shortcut | [shortcut key combo](#DOCS_TOPICS_RPC/getvoicesettings-shortcut-key-combo-object) object | shortcut key combos for PTT |
663
- | delay | float | the PTT release delay (in ms) (min: 0, max: 2000) |
664
-
665
- ###### Shortcut Key Combo Object
666
-
667
- | Field | Type | Description |
668
- | ----- | ------- | ------------------------------------------------------------ |
669
- | type | integer | see [key types](#DOCS_TOPICS_RPC/getvoicesettings-key-types) |
670
- | code | integer | key code |
671
- | name | string | key name |
672
-
673
- ###### Key Types
674
-
675
- | Type | Id |
676
- | --------------------- | --- |
677
- | KEYBOARD_KEY | 0 |
678
- | MOUSE_BUTTON | 1 |
679
- | KEYBOARD_MODIFIER_KEY | 2 |
680
- | GAMEPAD_BUTTON | 3 |
681
-
682
- ###### Example Get Voice Settings Response Payload
683
-
684
- ```json
685
- {
686
- "cmd": "GET_VOICE_SETTINGS",
687
- "data": {
688
- "input": {
689
- "available_devices": [
690
- {
691
- "id": "default",
692
- "name": "Default"
693
- },
694
- {
695
- "id": "Built-in Microphone",
696
- "name": "Built-in Microphone"
697
- }
698
- ],
699
- "device_id": "default",
700
- "volume": 49.803921580314636
701
- },
702
- "output": {
703
- "available_devices": [
704
- {
705
- "id": "default",
706
- "name": "Default"
707
- },
708
- {
709
- "id": "Built-in Output",
710
- "name": "Built-in Output"
711
- }
712
- ],
713
- "device_id": "default",
714
- "volume": 93.00000071525574
715
- },
716
- "mode": {
717
- "type": "VOICE_ACTIVITY",
718
- "auto_threshold": true,
719
- "threshold": -46.92622950819673,
720
- "shortcut": [{ "type": 0, "code": 12, "name": "i" }],
721
- "delay": 98.36065573770492
722
- },
723
- "automatic_gain_control": false,
724
- "echo_cancellation": false,
725
- "noise_suppression": false,
726
- "qos": false,
727
- "silence_warning": false,
728
- "deaf": false,
729
- "mute": false
730
- },
731
- "nonce": "fa07c532-bb03-4f75-8b9a-397f5109afb6"
732
- }
733
- ```
734
-
735
- #### SET_VOICE_SETTINGS
736
-
737
- > info
738
- > In the current release, we only support a single modifier of voice settings at a time over RPC.
739
- > If an app changes voice settings, it will lock voice settings so that other apps connected simultaneously
740
- > lose the ability to change voice settings. Settings reset to what they were before being changed after the
741
- > controlling app disconnects. When an app that has previously set voice settings connects, the client will swap
742
- > to that app's configured voice settings and lock voice settings again. This is a temporary situation that will
743
- > be changed in the future.
744
-
745
- When setting voice settings, all fields are optional. Only passed fields are updated.
746
-
747
- ###### Set Voice Settings Argument and Response Structure
748
-
749
- | Field | Type | Description |
750
- | ---------------------- | ---------------------------------------------------------------------------------------------- | --------------------------------- |
751
- | input | [voice settings input](#DOCS_TOPICS_RPC/getvoicesettings-voice-settings-input-object) object | input settings |
752
- | output | [voice settings output](#DOCS_TOPICS_RPC/getvoicesettings-voice-settings-output-object) object | output settings |
753
- | mode | [voice settings mode](#DOCS_TOPICS_RPC/getvoicesettings-voice-settings-mode-object) object | voice mode settings |
754
- | automatic_gain_control | boolean | state of automatic gain control |
755
- | echo_cancellation | boolean | state of echo cancellation |
756
- | noise_suppression | boolean | state of noise suppression |
757
- | qos | boolean | state of voice quality of service |
758
- | silence_warning | boolean | state of silence warning notice |
759
- | deaf | boolean | state of self-deafen |
760
- | mute | boolean | state of self-mute |
761
-
762
- ###### Example Set Voice Settings Command Payload
763
-
764
- ```json
765
- {
766
- "nonce": "3d64ed55-ef6e-4bd5-99c9-677533babc22",
767
- "args": {
768
- "input": {
769
- "volume": 90.5
770
- }
771
- },
772
- "cmd": "SET_VOICE_SETTINGS"
773
- }
774
- ```
775
-
776
- ###### Example Set Voice Settings Response Payload
777
-
778
- ```json
779
- {
780
- "cmd": "SET_VOICE_SETTINGS",
781
- "data": {
782
- "input": {
783
- "available_devices": [
784
- {
785
- "id": "default",
786
- "name": "Default"
787
- },
788
- {
789
- "id": "Built-in Microphone",
790
- "name": "Built-in Microphone"
791
- }
792
- ],
793
- "device_id": "default",
794
- "volume": 90.5
795
- },
796
- "output": {
797
- "available_devices": [
798
- {
799
- "id": "default",
800
- "name": "Default"
801
- },
802
- {
803
- "id": "Built-in Output",
804
- "name": "Built-in Output"
805
- }
806
- ],
807
- "device_id": "default",
808
- "volume": 93.00000071525574
809
- },
810
- "mode": {
811
- "type": "VOICE_ACTIVITY",
812
- "auto_threshold": true,
813
- "threshold": -46.92622950819673,
814
- "shortcut": [{ "type": 0, "code": 12, "name": "i" }],
815
- "delay": 98.36065573770492
816
- },
817
- "automatic_gain_control": false,
818
- "echo_cancellation": false,
819
- "noise_suppression": false,
820
- "qos": false,
821
- "silence_warning": false,
822
- "deaf": false,
823
- "mute": false
824
- },
825
- "nonce": "3d64ed55-ef6e-4bd5-99c9-677533babc22"
826
- }
827
- ```
828
-
829
- #### SUBSCRIBE
830
-
831
- Used to subscribe to events. `evt` of the payload should be set to the event being subscribed to. `args` of the payload should be set to the args needed for the event.
832
-
833
- ###### Subscribe Response Structure
834
-
835
- | Field | Type | Description |
836
- | ----- | ------ | ---------------------------- |
837
- | evt | string | event name now subscribed to |
838
-
839
- ###### Example Subscribe Command Payload
840
-
841
- ```json
842
- {
843
- "nonce": "be9a6de3-31d0-4767-a8e9-4818c5690015",
844
- "args": {
845
- "guild_id": "199737254929760256"
846
- },
847
- "evt": "GUILD_STATUS",
848
- "cmd": "SUBSCRIBE"
849
- }
850
- ```
851
-
852
- ###### Example Subscribe Response Payload
853
-
854
- ```json
855
- {
856
- "cmd": "SUBSCRIBE",
857
- "data": {
858
- "evt": "GUILD_STATUS"
859
- },
860
- "nonce": "be9a6de3-31d0-4767-a8e9-4818c5690015"
861
- }
862
- ```
863
-
864
- #### UNSUBSCRIBE
865
-
866
- Used to unsubscribe from events. `evt` of the payload should be set to the event that was subscribed to. `args` of the payload should be set to the args needed for the previously subscribed event.
867
-
868
- ###### Unsubscribe Response Structure
869
-
870
- | Field | Type | Description |
871
- | ----- | ------ | -------------------------------- |
872
- | evt | string | event name now unsubscribed from |
873
-
874
- ###### Example Unsubscribe Command Payload
875
-
876
- ```json
877
- {
878
- "nonce": "647d814a-4cf8-4fbb-948f-898aad24f55b",
879
- "args": {
880
- "guild_id": "199737254929760256"
881
- },
882
- "evt": "GUILD_STATUS",
883
- "cmd": "UNSUBSCRIBE"
884
- }
885
- ```
886
-
887
- ###### Example Unsubscribe Response Payload
888
-
889
- ```json
890
- {
891
- "cmd": "UNSUBSCRIBE",
892
- "data": {
893
- "evt": "GUILD_STATUS"
894
- },
895
- "nonce": "647d814a-4cf8-4fbb-948f-898aad24f55b"
896
- }
897
- ```
898
-
899
- #### SET_CERTIFIED_DEVICES
900
-
901
- Used by hardware manufacturers to send information about the current state of their certified devices that are connected to Discord.
902
-
903
- ###### Set Certified Devices Argument Strucure
904
-
905
- | Field | Type | Description |
906
- | ------- | ----------------------------------------------------------------------------------------- | ------------------------------------------------------------- |
907
- | devices | array of [certified device](#DOCS_TOPICS_RPC/setcertifieddevices-device-object) objects | a list of devices for your manufacturer, in order of priority |
908
-
909
- ###### Device Object
910
-
911
- | Field | Type | Description |
912
- | ------------------------- | --------------------------------------------------------------------- | -------------------------------------------------------- |
913
- | type | [device type](#DOCS_TOPICS_RPC/setcertifieddevices-device-type) | the type of device |
914
- | id | string | the device's Windows UUID |
915
- | vendor | [vendor](#DOCS_TOPICS_RPC/setcertifieddevices-vendor-object) object | the hardware vendor |
916
- | model | [model](#DOCS_TOPICS_RPC/setcertifieddevices-model-object) object | the model of the product |
917
- | related | array of strings | UUIDs of related devices |
918
- | echo_cancellation?\* | boolean | if the device's native echo cancellation is enabled |
919
- | noise_suppression?\* | boolean | if the device's native noise suppression is enabled |
920
- | automatic_gain_control?\* | boolean | if the device's native automatic gain control is enabled |
921
- | hardware_mute?\* | boolean | if the device is hardware muted |
922
-
923
- \*These fields are only applicable for `AUDIO_INPUT` device types
924
-
925
- ###### Vendor Object
926
-
927
- | Field | Type | Description |
928
- | ----- | ------ | ------------------ |
929
- | name | string | name of the vendor |
930
- | url | string | url for the vendor |
931
-
932
- ###### Model Object
933
-
934
- | Field | Type | Description |
935
- | ----- | ------ | ----------------- |
936
- | name | string | name of the model |
937
- | url | string | url for the model |
938
-
939
- ###### Device Type
940
-
941
- | Type | Value |
942
- | ------------ | ------------- |
943
- | AUDIO_INPUT | "audioinput" |
944
- | AUDIO_OUTPUT | "audiooutput" |
945
- | VIDEO_INPUT | "videoinput" |
946
-
947
- ###### Example Set Certified Devices Command Payload
948
-
949
- ```json
950
- {
951
- "nonce": "9b4e9711-97f3-4f35-b047-32c82a51978e",
952
- "cmd": "SET_CERTIFIED_DEVICES",
953
- "args": {
954
- "devices": [
955
- {
956
- "type": "audioinput",
957
- "id": "aafc2003-da0e-42a3-b982-6a17a2812510",
958
- "vendor": {
959
- "name": "SteelSeries",
960
- "url": "https://steelseries.com"
961
- },
962
- "model": {
963
- "name": "Arctis 7",
964
- "url": "https://steelseries.com/gaming-headsets/arctis-7"
965
- },
966
- "related": ["aafc2003-da0e-42a3-b982-6a17a2819999"],
967
- "echo_cancellation": true,
968
- "noise_suppression": true,
969
- "automatic_gain_control": true,
970
- "hardware_mute": false
971
- }
972
- ]
973
- }
974
- }
975
- ```
976
-
977
- ###### Example Set Certified Devices Response Payload
978
-
979
- ```json
980
- {
981
- "nonce": "9b4e9711-97f3-4f35-b047-32c82a51978e",
982
- "cmd": "SET_CERTIFIED_DEVICES",
983
- "data": null,
984
- "evt": null
985
- }
986
- ```
987
-
988
- #### SET_ACTIVITY
989
-
990
- Used to update a user's Rich Presence.
991
-
992
- ###### Set Activity Argument Structure
993
-
994
- | Field | Type | Description |
995
- | -------- | ------------------------------------------------------- | --------------------------------------- |
996
- | pid | integer | the application's process id |
997
- | activity | [activity](#DOCS_TOPICS_GATEWAY/activity-object) object | the rich presence to assign to the user |
998
-
999
- ###### Example Set Activity Payload
1000
-
1001
- ```json
1002
- {
1003
- "cmd": "SET_ACTIVITY",
1004
- "args": {
1005
- "pid": 9999,
1006
- "activity": {
1007
- "state": "In a Group",
1008
- "details": "Competitive | In a Match",
1009
- "timestamps": {
1010
- "start": time(nullptr),
1011
- "end": time(nullptr) + (60 * 5 + 23)
1012
- },
1013
- "assets": {
1014
- "large_image": "numbani_map",
1015
- "large_text": "Numbani",
1016
- "small_image": "pharah_profile",
1017
- "small_text": "Pharah"
1018
- },
1019
- "party": {
1020
- "id": GameEngine.GetPartyId(),
1021
- "size": [3, 6]
1022
- },
1023
- "secrets": {
1024
- "join": "025ed05c71f639de8bfaa0d679d7c94b2fdce12f",
1025
- "spectate": "e7eb30d2ee025ed05c71ea495f770b76454ee4e0",
1026
- "match": "4b2fdce12f639de8bfa7e3591b71a0d679d7c93f"
1027
- },
1028
- "instance": true
1029
- }
1030
- },
1031
- "nonce": "647d814a-4cf8-4fbb-948f-898abd24f55b"
1032
- }
1033
- ```
1034
-
1035
- #### SEND_ACTIVITY_JOIN_INVITE
1036
-
1037
- Used to accept an Ask to Join request.
1038
-
1039
- ###### Send Activity Join Invite Argument Structure
1040
-
1041
- | Field | Type | Description |
1042
- | ------- | --------- | ----------------------------- |
1043
- | user_id | snowflake | the id of the requesting user |
1044
-
1045
- ###### Example Send Activity Join Invite Payload
1046
-
1047
- ```json
1048
- {
1049
- "nonce": "5dc0c062-98c6-47a0-8922-15aerg126",
1050
- "cmd": "SEND_ACTIVITY_JOIN_INVITE",
1051
- "args": {
1052
- "user_id": "53908232506183680"
1053
- }
1054
- }
1055
- ```
1056
-
1057
- #### CLOSE_ACTIVITY_REQUEST
1058
-
1059
- Used to reject an Ask to Join request.
1060
-
1061
- ###### Close Activity Request Argument Structure
1062
-
1063
- | Field | Type | Description |
1064
- | ------- | --------- | ----------------------------- |
1065
- | user_id | snowflake | the id of the requesting user |
1066
-
1067
- ###### Example Close Activity Request Payload
1068
-
1069
- ```json
1070
- {
1071
- "nonce": "5dc0c062-98c6-47a0-8922-15aerg126",
1072
- "cmd": "CLOSE_ACTIVITY_REQUEST",
1073
- "args": {
1074
- "user_id": "53908232506183680"
1075
- }
1076
- }
1077
- ```
1078
-
1079
- #### READY
1080
-
1081
- ###### Ready Dispatch Data Structure
1082
-
1083
- | Field | Type | Description |
1084
- | ------ | ----------------------------------------------------------------------------------------- | ---------------------------------- |
1085
- | v | integer | RPC version |
1086
- | config | [rpc server configuration](#DOCS_TOPICS_RPC/ready-rpc-server-configuration-object) object | server configuration |
1087
- | user | partial [user](#DOCS_RESOURCES_USER/user-object) object | the user to whom you are connected |
1088
-
1089
- ###### RPC Server Configuration Object
1090
-
1091
- | Field | Type | Description |
1092
- | ------------ | ------ | --------------------- |
1093
- | cdn_host | string | server's cdn |
1094
- | api_endpoint | string | server's api endpoint |
1095
- | environment | string | server's environment |
1096
-
1097
- ###### Example Ready Dispatch Payload
1098
-
1099
- ```json
1100
- {
1101
- "cmd": "DISPATCH",
1102
- "data": {
1103
- "v": 1,
1104
- "config": {
1105
- "cdn_host": "cdn.discordapp.com",
1106
- "api_endpoint": "//discord.com/api",
1107
- "environment": "production"
1108
- },
1109
- "user": {
1110
- "id": "53908232506183680",
1111
- "username": "Mason",
1112
- "discriminator": "1337",
1113
- "avatar": null
1114
- }
1115
- },
1116
- "evt": "READY"
1117
- }
1118
- ```
1119
-
1120
- #### ERROR
1121
-
1122
- ###### Error Data Structure
1123
-
1124
- | Field | Type | Description |
1125
- | ------- | ------- | ----------------- |
1126
- | code | integer | RPC Error Code |
1127
- | message | string | Error description |
1128
-
1129
- ###### Example Error Payload
1130
-
1131
- ```json
1132
- {
1133
- "cmd": "AUTHORIZE",
1134
- "data": {
1135
- "code": 4007,
1136
- "message": "No client id provided"
1137
- },
1138
- "evt": "ERROR",
1139
- "nonce": "5102b6f0-c769-4f37-8cca-25fb0ab22628"
1140
- }
1141
- ```
1142
-
1143
- #### GUILD_STATUS
1144
-
1145
- ###### Guild Status Argument Structure
1146
-
1147
- | Field | Type | Description |
1148
- | -------- | ------ | ----------------------------------- |
1149
- | guild_id | string | id of guild to listen to updates of |
1150
-
1151
- ###### Guild Status Dispatch Data Structure
1152
-
1153
- | Field | Type | Description |
1154
- | ------ | ---------------------------------------------------------- | ------------------------------------------------------ |
1155
- | guild | partial [guild](#DOCS_RESOURCES_GUILD/guild-object) object | guild with requested id |
1156
- | online | integer | number of online users in guild (deprecated; always 0) |
1157
-
1158
- ###### Example Guild Status Dispatch Payload
1159
-
1160
- ```json
1161
- {
1162
- "cmd": "DISPATCH",
1163
- "data": {
1164
- "guild": {
1165
- "id": "199737254929760256",
1166
- "name": "test",
1167
- "icon_url": null
1168
- },
1169
- "online": 0
1170
- },
1171
- "evt": "GUILD_STATUS"
1172
- }
1173
- ```
1174
-
1175
- #### GUILD_CREATE
1176
-
1177
- No arguments
1178
-
1179
- ###### Guild Create Dispatch Data Structure
1180
-
1181
- | Field | Type | Description |
1182
- | ----- | ------ | ----------------- |
1183
- | id | string | guild id |
1184
- | name | string | name of the guild |
1185
-
1186
- ###### Example Guild Create Dispatch Payload
1187
-
1188
- ```json
1189
- {
1190
- "cmd": "DISPATCH",
1191
- "data": {
1192
- "id": "199737254929767562",
1193
- "name": "Test Server"
1194
- },
1195
- "evt": "GUILD_CREATE"
1196
- }
1197
- ```
1198
-
1199
- #### CHANNEL_CREATE
1200
-
1201
- No arguments
1202
-
1203
- ###### Channel Create Dispatch Data Structure
1204
-
1205
- | Field | Type | Description |
1206
- | ----- | ------- | ---------------------------------------------------------------- |
1207
- | id | string | channel id |
1208
- | name | string | name of the channel |
1209
- | type | integer | channel type (guild text: 0, guild voice: 2, dm: 1, group dm: 3) |
1210
-
1211
- ###### Example Channel Create Dispatch Payload
1212
-
1213
- ```json
1214
- {
1215
- "cmd": "DISPATCH",
1216
- "data": {
1217
- "id": "199737254929760257",
1218
- "name": "General",
1219
- "type": 0
1220
- },
1221
- "evt": "CHANNEL_CREATE"
1222
- }
1223
- ```
1224
-
1225
- #### VOICE_CHANNEL_SELECT
1226
-
1227
- No arguments
1228
-
1229
- ###### Voice Channel Select Dispatch Data Structure
1230
-
1231
- | Field | Type | Description |
1232
- | ---------- | ------ | ------------------------------ |
1233
- | channel_id | string | id of channel (`null` if none) |
1234
- | guild_id | string | id of guild (`null` if none) |
1235
-
1236
- ###### Example Voice Channel Select Dispatch Payload
1237
-
1238
- ```json
1239
- {
1240
- "cmd": "DISPATCH",
1241
- "data": {
1242
- "channel_id": "199737254929760257",
1243
- "guild_id": "199737254929760256"
1244
- },
1245
- "evt": "VOICE_CHANNEL_SELECT"
1246
- }
1247
- ```
1248
-
1249
- #### VOICE_SETTINGS_UPDATE
1250
-
1251
- ###### Voice Settings Argument Structure
1252
-
1253
- No arguments. Dispatches the [Get Voice Settings](#DOCS_TOPICS_RPC/getvoicesettings) response.
1254
-
1255
- ###### Example Voice Settings Dispatch Payload
1256
-
1257
- ```json
1258
- {
1259
- "cmd": "DISPATCH",
1260
- "data": {
1261
- "input": {
1262
- "available_devices": [
1263
- {
1264
- "id": "default",
1265
- "name": "Default"
1266
- },
1267
- {
1268
- "id": "Built-in Microphone",
1269
- "name": "Built-in Microphone"
1270
- }
1271
- ],
1272
- "device_id": "default",
1273
- "volume": 49.803921580314636
1274
- },
1275
- "output": {
1276
- "available_devices": [
1277
- {
1278
- "id": "default",
1279
- "name": "Default"
1280
- },
1281
- {
1282
- "id": "Built-in Output",
1283
- "name": "Built-in Output"
1284
- }
1285
- ],
1286
- "device_id": "default",
1287
- "volume": 93.00000071525574
1288
- },
1289
- "mode": {
1290
- "type": "VOICE_ACTIVITY",
1291
- "auto_threshold": true,
1292
- "threshold": -46.92622950819673,
1293
- "shortcut": [{ "type": 0, "code": 12, "name": "i" }],
1294
- "delay": 98.36065573770492
1295
- },
1296
- "automatic_gain_control": false,
1297
- "echo_cancellation": false,
1298
- "noise_suppression": false,
1299
- "qos": false,
1300
- "silence_warning": false
1301
- },
1302
- "evt": "VOICE_SETTINGS_UPDATE"
1303
- }
1304
- ```
1305
-
1306
- #### VOICE_STATE_CREATE/VOICE_STATE_UPDATE/VOICE_STATE_DELETE
1307
-
1308
- Dispatches channel voice state objects
1309
-
1310
- ###### Voice State Argument Structure
1311
-
1312
- | Field | Type | Description |
1313
- | ---------- | ------ | ------------------------------------- |
1314
- | channel_id | string | id of channel to listen to updates of |
1315
-
1316
- ###### Example Voice State Dispatch Payload
1317
-
1318
- ```json
1319
- {
1320
- "cmd": "DISPATCH",
1321
- "evt": "VOICE_STATE_CREATE",
1322
- "data": {
1323
- "voice_state": {
1324
- "mute": false,
1325
- "deaf": false,
1326
- "self_mute": false,
1327
- "self_deaf": false,
1328
- "suppress": false
1329
- },
1330
- "user": {
1331
- "id": "190320984123768832",
1332
- "username": "test 2",
1333
- "discriminator": "7479",
1334
- "avatar": "b004ec1740a63ca06ae2e14c5cee11f3",
1335
- "bot": false
1336
- },
1337
- "nick": "test user 2",
1338
- "volume": 110,
1339
- "mute": false,
1340
- "pan": {
1341
- "left": 1.0,
1342
- "right": 1.0
1343
- }
1344
- }
1345
- }
1346
- ```
1347
-
1348
- #### VOICE_CONNECTION_STATUS
1349
-
1350
- No arguments
1351
-
1352
- ###### Voice Connection Status Dispatch Data Structure
1353
-
1354
- | Field | Type | Description |
1355
- | ------------ | ----------------- | ----------------------------------------------- |
1356
- | state | string | one of the voice connection states listed below |
1357
- | hostname | string | hostname of the connected voice server |
1358
- | pings | array of integers | last 20 pings (in ms) |
1359
- | average_ping | integer | average ping (in ms) |
1360
- | last_ping | integer | last ping (in ms) |
1361
-
1362
- ###### Voice Connection States
1363
-
1364
- | Field | Description |
1365
- | ------------------ | --------------------------------- |
1366
- | DISCONNECTED | TCP disconnected |
1367
- | AWAITING_ENDPOINT | Waiting for voice endpoint |
1368
- | AUTHENTICATING | TCP authenticating |
1369
- | CONNECTING | TCP connecting |
1370
- | CONNECTED | TCP connected |
1371
- | VOICE_DISCONNECTED | TCP connected, Voice disconnected |
1372
- | VOICE_CONNECTING | TCP connected, Voice connecting |
1373
- | VOICE_CONNECTED | TCP connected, Voice connected |
1374
- | NO_ROUTE | No route to host |
1375
- | ICE_CHECKING | WebRTC ice checking |
1376
-
1377
- ###### Example Voice Connection Status Dispatch Payload
1378
-
1379
- ```json
1380
- {
1381
- "cmd": "DISPATCH",
1382
- "evt": "VOICE_CONNECTION_STATUS",
1383
- "data": {
1384
- "state": "VOICE_CONNECTED",
1385
- "hostname": "some-server.discord.gg",
1386
- "pings": [20, 13.37],
1387
- "average_ping": 13.37,
1388
- "last_ping": 20
1389
- }
1390
- }
1391
- ```
1392
-
1393
- #### MESSAGE_CREATE/MESSAGE_UPDATE/MESSAGE_DELETE
1394
-
1395
- Dispatches message objects, with the exception of deletions, which only contains the id in the message object.
1396
-
1397
- ###### Message Argument Structure
1398
-
1399
- | Field | Type | Description |
1400
- | ---------- | ------ | ------------------------------------- |
1401
- | channel_id | string | id of channel to listen to updates of |
1402
-
1403
- ###### Example Message Dispatch Payload
1404
-
1405
- ```json
1406
- {
1407
- "cmd": "DISPATCH",
1408
- "data": {
1409
- "channel_id": "199737254929760256",
1410
- "message": {
1411
- "id": "199743874640379904",
1412
- "blocked": false,
1413
- "content": "test",
1414
- "content_parsed": [
1415
- {
1416
- "content": "test",
1417
- "type": "text"
1418
- }
1419
- ],
1420
- "author_color": "#ffffff",
1421
- "edited_timestamp": null,
1422
- "timestamp": "2016-07-05T04:30:50.776Z",
1423
- "tts": false,
1424
- "mentions": [],
1425
- "mention_roles": [],
1426
- "mention_everyone": false,
1427
- "embeds": [],
1428
- "attachments": [],
1429
- "type": 0,
1430
- "pinned": false,
1431
- "author": {
1432
- "id": "190320984123768832",
1433
- "username": "test user 2",
1434
- "discriminator": "7479",
1435
- "avatar": "b004ec1740a63ca06ae2e14c5cee11f3",
1436
- "bot": false
1437
- }
1438
- }
1439
- },
1440
- "evt": "MESSAGE_CREATE"
1441
- }
1442
- ```
1443
-
1444
- #### SPEAKING_START/SPEAKING_STOP
1445
-
1446
- ###### Speaking Argument Structure
1447
-
1448
- | Field | Type | Description |
1449
- | ---------- | ------ | ------------------------------------- |
1450
- | channel_id | string | id of channel to listen to updates of |
1451
-
1452
- ###### Speaking Dispatch Data Structure
1453
-
1454
- | Field | Type | Description |
1455
- | ------- | ------ | --------------------------------------- |
1456
- | user_id | string | id of user who started/stopped speaking |
1457
-
1458
- ###### Example Speaking Dispatch Payload
1459
-
1460
- ```json
1461
- {
1462
- "cmd": "DISPATCH",
1463
- "data": {
1464
- "user_id": "190320984123768832"
1465
- },
1466
- "evt": "SPEAKING_STOP"
1467
- }
1468
- ```
1469
-
1470
- #### NOTIFICATION_CREATE
1471
-
1472
- No arguments. This event requires the `rpc.notifications.read` [OAuth2 scope](#DOCS_TOPICS_OAUTH2/shared-resources-oauth2-scopes).
1473
-
1474
- ###### Notification Create Dispatch Data Structure
1475
-
1476
- | Field | Type | Description |
1477
- | ---------- | -------------------------------------------------------- | ----------------------------------------- |
1478
- | channel_id | string | id of channel where notification occurred |
1479
- | message | [message](#DOCS_RESOURCES_CHANNEL/message-object) object | message that generated this notification |
1480
- | icon_url | string | icon url of the notification |
1481
- | title | string | title of the notification |
1482
- | body | string | body of the notification |
1483
-
1484
- ###### Example Notification Create Dispatch Payload
1485
-
1486
- ```json
1487
- {
1488
- "cmd": "DISPATCH",
1489
- "data": {
1490
- "channel_id": "199737254929760256",
1491
- "message": {
1492
- "id": "199743874640379904",
1493
- "blocked": false,
1494
- "content": "test",
1495
- "content_parsed": [
1496
- {
1497
- "content": "test",
1498
- "type": "text"
1499
- }
1500
- ],
1501
- "author_color": "#ffffff",
1502
- "edited_timestamp": null,
1503
- "timestamp": "2016-07-05T04:30:50.776Z",
1504
- "tts": false,
1505
- "mentions": [],
1506
- "mention_roles": [],
1507
- "mention_everyone": false,
1508
- "embeds": [],
1509
- "attachments": [],
1510
- "type": 0,
1511
- "pinned": false,
1512
- "author": {
1513
- "id": "190320984123768832",
1514
- "username": "test user 2",
1515
- "discriminator": "7479",
1516
- "avatar": "b004ec1740a63ca06ae2e14c5cee11f3",
1517
- "bot": false
1518
- }
1519
- },
1520
- "icon_url": "https://cdn.discordapp.com/avatars/155607406007681024/8ab559b8286e48270c04471ae382cd9d.jpg",
1521
- "title": "test_user (#general)",
1522
- "body": "test message"
1523
- },
1524
- "evt": "NOTIFICATION_CREATE"
1525
- }
1526
- ```
1527
-
1528
- #### ACTIVITY_JOIN
1529
-
1530
- No arguments
1531
-
1532
- ###### Activity Join Dispatch Data Structure
1533
-
1534
- | Field | Type | Description |
1535
- | ------ | ------ | --------------------------------------------------------------------------------------------------------------------- |
1536
- | secret | string | the [`join_secret`](#DOCS_RICH_PRESENCE_HOW_TO/updating-presence-update-presence-payload-fields) for the given invite |
1537
-
1538
- ###### Example Activity Join Dispatch Payload
1539
-
1540
- ```json
1541
- {
1542
- "cmd": "DISPATCH",
1543
- "data": {
1544
- "secret": "025ed05c71f639de8bfaa0d679d7c94b2fdce12f"
1545
- },
1546
- "evt": "ACTIVITY_JOIN"
1547
- }
1548
- ```
1549
-
1550
- #### ACTIVITY_SPECTATE
1551
-
1552
- No arguments
1553
-
1554
- ###### Activity Spectate Dispatch Data Structure
1555
-
1556
- | Field | Type | Description |
1557
- | ------ | ------ | ------------------------------------------------------------------------------------------------------------------------- |
1558
- | secret | string | the [`spectate_secret`](#DOCS_RICH_PRESENCE_HOW_TO/updating-presence-update-presence-payload-fields) for the given invite |
1559
-
1560
- ###### Example Activity Spectate Dispatch Payload
1561
-
1562
- ```json
1563
- {
1564
- "cmd": "DISPATCH",
1565
- "data": {
1566
- "secret": "e7eb30d2ee025ed05c71ea495f770b76454ee4e0"
1567
- },
1568
- "evt": "ACTIVITY_SPECTATE"
1569
- }
1570
- ```
1571
-
1572
- #### ACTIVITY_JOIN_REQUEST
1573
-
1574
- No arguments
1575
-
1576
- ###### Activity Join Request Data Structure
1577
-
1578
- | Field | Type | Description |
1579
- | ----- | ------------------------------------------------------- | --------------------------------------------- |
1580
- | user | partial [user](#DOCS_RESOURCES_USER/user-object) object | information about the user requesting to join |
1581
-
1582
- ###### Example Activity Join Request Dispatch Payload
1583
-
1584
- ```json
1585
- {
1586
- "cmd": "DISPATCH",
1587
- "data": {
1588
- "user": {
1589
- "id": "53908232506183680",
1590
- "username": "Mason",
1591
- "discriminator": "1337",
1592
- "avatar": "a_bab14f271d565501444b2ca3be944b25"
1593
- }
1594
- },
1595
- "evt": "ACTIVITY_JOIN_REQUEST"
1596
- }
1597
- ```