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,405 +0,0 @@
1
- # Achievements
2
-
3
- > info
4
- > Need help with the SDK? Talk to us in the [Discord Developers Server](https://discord.gg/discord-developers)!
5
-
6
- > danger
7
- > Selling SKUs on Discord is now deprecated, and will be discontinued on March 1, 2022. [Read here for more info.](https://support-dev.discord.com/hc/en-us/articles/4414590563479)
8
-
9
- There's no feeling quite like accomplishing a goal that you've set out to achieve. Is killing 1000 zombies in a game as great an achievement as climbing Mt. Everest? Of course it is, and I didn't even have to leave my house. So get off my back, society.
10
-
11
- Anyway—Discord has achievements! Show your players just how successful they are.
12
-
13
- Achievements are managed in the [Developer Portal](https://discord.com/developers/applications). Head over to your application --> `Achievements` to create and manage achievements for your game. You'll give them an icon, a name, and a description; then they'll be assigned an id.
14
-
15
- You can also mark achievements as `secret` and `secure`. "Secret" achievements will _not_ be shown to the user until they've unlocked them. "Secure" achievements can only be set via HTTP calls from your server, _not_ by a game client using the SDK. No cheaters here!
16
-
17
- ## Data Models
18
-
19
- ###### Achievement Struct
20
-
21
- | name | type | description |
22
- | -------------- | ------- | -------------------------------------------------------------------------------------------------------------------------------------------- |
23
- | application_id | Int64 | the unique id of the application |
24
- | name | object | the name of the achievement as an [achievement locale object](#DOCS_GAME_SDK_ACHIEVEMENTS/data-models-achievement-locale-object) |
25
- | description | object | the user-facing achievement description as an [achievement locale object](#DOCS_GAME_SDK_ACHIEVEMENTS/data-models-achievement-locale-object) |
26
- | secret | boolean | if the achievement is secret |
27
- | secure | boolean | if the achievement is secure |
28
- | id | Int64 | the unique id of the achievement |
29
- | icon_hash | string | [the hash of the icon](#DOCS_REFERENCE/image-formatting) |
30
-
31
- ###### Achievement Locale Object
32
-
33
- | Name | Description |
34
- | -------------- | ------------------------------------------------------------------------------------------------- |
35
- | default | the default locale for the achievement |
36
- | localizations? | object of [locales](#DOCS_REFERENCE/locales) as the key and achievement translations as the value |
37
-
38
- ###### User Achievement Struct
39
-
40
- | name | type | description |
41
- | --------------- | ------ | ------------------------------------------------------------------------------------------ |
42
- | UserId | Int64 | the unique id of the user working on the achievement |
43
- | AchievementId | Int64 | the unique id of the achievement |
44
- | PercentComplete | UInt8 | how far along the user is to completing the achievement (0-100) |
45
- | UnlockedAt | string | the timestamp at which the user completed the achievement (PercentComplete was set to 100) |
46
-
47
- ## SetUserAchievement
48
-
49
- Updates the current user's status for a given achievement. If `percentComplete` is set to `100`, the `UnlockedAt` field will be automatically updated with the current timestamp.
50
-
51
- Returns `Discord.Result` via callback.
52
-
53
- ###### Parameters
54
-
55
- | name | type | description |
56
- | --------------- | ----- | -------------------------------------- |
57
- | achievementId | Int64 | the id of the achievement to update |
58
- | percentComplete | UInt8 | the user's updated percentage progress |
59
-
60
- ###### Example
61
-
62
- ```cs
63
- achievementManager.SetUserAchievement(580159119969878046, 25, (res) =>
64
- {
65
- if (res == Discord.Result.Ok)
66
- {
67
- Console.WriteLine("Achievement updated for user");
68
- }
69
- });
70
- ```
71
-
72
- ## FetchUserAchievements
73
-
74
- Loads a stable list of the current user's achievements to iterate over. If the user has any achievements, do your iteration within the callback of this function.
75
-
76
- Returns `Discord.Result` via callback.
77
-
78
- > info
79
- > Remember to only iterate when there are results!
80
-
81
- ###### Parameters
82
-
83
- None.
84
-
85
- ###### Example
86
-
87
- ```cs
88
- achievementManager.FetchUserAchievements((res) =>
89
- {
90
- if (res == Discord.Result.Ok)
91
- {
92
- // Count()
93
- // for() loop
94
- }
95
- });
96
- ```
97
-
98
- ## CountUserAchievements
99
-
100
- Counts the list of a user's achievements for iteration.
101
-
102
- Returns `Int32`.
103
-
104
- ###### Parameters
105
-
106
- None
107
-
108
- ###### Example
109
-
110
- ```cs
111
- achievementManager.FetchUserAchievements((res) =>
112
- {
113
- if (res == Discord.Result.Ok)
114
- {
115
- Console.WriteLine("User has {0} achievements for this game", achievementManager.CountUserAchievements());
116
- }
117
- });
118
- ```
119
-
120
- ## GetUserAchievementAt
121
-
122
- Gets the user's achievement at a given index of their list of achievements.
123
-
124
- Returns `Discord.UserAchievement`
125
-
126
- ###### Parameters
127
-
128
- | name | type | description |
129
- | ----- | ----- | ----------------------------------------- |
130
- | index | Int32 | the index at which to get the achievement |
131
-
132
- ###### Example
133
-
134
- ```cs
135
- achievementManager.FetchUserAchievements((res) =>
136
- {
137
- if (res == Discord.Result.Ok)
138
- {
139
- for (int i = 0; i < achievementManager.CountUserAchievements(); i++)
140
- {
141
- var achievement = achievementManager.GetUserAchievementAt(i);
142
- Console.WriteLine("Achievement progress for {0} for user {1}: {2}",
143
- achievement.AchievementId,
144
- achievement.UserId,
145
- achievement.PercentComplete);
146
- }
147
- }
148
- });
149
- ```
150
-
151
- ## GetUserAchievement
152
-
153
- Gets the user achievement for the given achievement id. If you keep a hardcoded mapping of achievement <--> id in your codebase, this will be better than iterating over each achievement. Make sure to call `FetchUserAchievements()` first still!
154
-
155
- ###### Parameters
156
-
157
- | name | type | description |
158
- | ------------- | ----- | -------------------------------- |
159
- | achievementId | Int64 | the id of the achievement to get |
160
-
161
- ###### Example
162
-
163
- ```cs
164
- achievementManager.FetchUserAchievements((res) =>
165
- {
166
- if (res == Discord.Result.Ok)
167
- {
168
- var achievement = achievementManager.GetUserAchievement(580159119969878046);
169
- Console.WriteLine("Achievement progress for {0} for user {1}: {2}",
170
- achievement.AchievementId,
171
- achievement.UserId,
172
- achievement.PercentComplete);
173
- }
174
- });
175
- ```
176
-
177
- ## OnUserAchievementUpdate
178
-
179
- Fires when an achievement is updated for the currently connected user
180
-
181
- ###### Parameters
182
-
183
- | name | type | description |
184
- | ----------- | ------------------- | -------------------------------- |
185
- | achievement | ref UserAchievement | the achievement that was updated |
186
-
187
- ## The API Way
188
-
189
- Below are the API endpoints and the parameters they accept. If you choose to interface directly with the Discord API, you will need a "Bot token". This is a special authorization token with which your application can access Discord's HTTP API. Head on over to [your app's dashboard](https://discord.com/developers/), and hit the big "Add a Bot User" button. From there, mutter _abra kadabra_ and reveal the token. This token is used as an authorization header against our API like so:
190
-
191
- ```
192
- curl -x POST -h "Authorization: Bot <your token>" https://discord.com/api/some-route/that-does-a-thing
193
- ```
194
-
195
- > info
196
- > Make sure to prepend your token with "Bot"!
197
-
198
- ## Get Achievements
199
-
200
- `GET https://discord.com/api/v6/applications/<application_id>/achievements`
201
-
202
- Returns all achievements for the given application. This endpoint has a rate limit of 5 requests per 5 seconds per application.
203
-
204
- ###### Return Object
205
-
206
- ```json
207
- [
208
- {
209
- "application_id": "461618159171141643",
210
- "name": {
211
- "default": "Win the Game"
212
- },
213
- "description": {
214
- "default": "You won!"
215
- },
216
- "secret": false,
217
- "icon_hash": "52c1636444f64ad7cb5368b158847def",
218
- "id": "580159119969878046",
219
- "secure": false
220
- }
221
- ]
222
- ```
223
-
224
- ## Get Achievement
225
-
226
- `GET https://discord.com/api/v6/applications/<application_id>/achievements/<achievement_id>`
227
-
228
- Returns the given achievement for the given application. This endpoint has a rate limit of 5 requests per 5 seconds per application.
229
-
230
- ###### Return Object
231
-
232
- ```json
233
- {
234
- "application_id": "461618159171141643",
235
- "name": {
236
- "default": "Win the Game"
237
- },
238
- "description": {
239
- "default": "You won!"
240
- },
241
- "secret": false,
242
- "icon_hash": "52c1636444f64ad7cb5368b158847def",
243
- "id": "580159119969878046",
244
- "secure": false
245
- }
246
- ```
247
-
248
- ## Create Achievement
249
-
250
- `POST https://discord.com/api/v6/applications/<application_id>/achievements`
251
-
252
- Creates a new achievement for your application. Applications can have a maximum of 1000 achievements. This endpoint has a rate limit of 5 requests per 5 seconds per application.
253
-
254
- ###### Parameters
255
-
256
- | name | type | description |
257
- | ----------- | --------- | --------------------------------------- |
258
- | name | string | the name of the achievement |
259
- | description | string | the user-facing achievement description |
260
- | secret | bool | if the achievement is secret |
261
- | secure | bool | if the achievement is secure |
262
- | icon | ImageType | the icon for the achievement |
263
-
264
- ###### Example: Creating an Achievement
265
-
266
- ```json
267
- {
268
- "name": {
269
- "default": "Find the Secret"
270
- },
271
- "description": {
272
- "default": "You found it!"
273
- },
274
- "secret": true,
275
- "secure": false,
276
- "icon": "data:image/png;base64,base64_data_here"
277
- }
278
- ```
279
-
280
- ###### Return Object
281
-
282
- ```json
283
- {
284
- "application_id": "461618159171141643",
285
- "name": {
286
- "default": "Find the Secret"
287
- },
288
- "description": {
289
- "default": "You found it!"
290
- },
291
- "secret": true,
292
- "icon_hash": "52c1636444f64ad7cb5368b158847def",
293
- "id": "597763781871861018",
294
- "secure": false
295
- }
296
- ```
297
-
298
- ## Update Achievement
299
-
300
- `PATCH https://discord.com/api/v6/applications/<application_id>/achievements/<achievement_id>`
301
-
302
- Updates the achievement for **\_\_ALL USERS\_\_**. This is **NOT** to update a single user's achievement progress; this is to edit the UserAchievement itself. This endpoint has a rate limit of 5 requests per 5 seconds per application.
303
-
304
- ###### Parameters
305
-
306
- | name | type | description |
307
- | ----------- | --------- | --------------------------------------- |
308
- | name | string | the name of the achievement |
309
- | description | string | the user-facing achievement description |
310
- | secret | bool | if the achievement is secret |
311
- | secure | bool | if the achievement is secure |
312
- | icon | ImageType | the icon for the achievement |
313
-
314
- ###### Example: Updating an Achievement
315
-
316
- ```json
317
- {
318
- "name": {
319
- "default": "How do methods break up?"
320
- },
321
- "description": {
322
- "default": "They stop calling each other!"
323
- },
324
- "secret": false,
325
- "secure": false,
326
- "icon": "data:image/png;base64,base64_data_here"
327
- }
328
- ```
329
-
330
- ###### Return Object
331
-
332
- ```json
333
- {
334
- "application_id": "461618159171141643",
335
- "name": {
336
- "default": "How do methods break up?"
337
- },
338
- "description": {
339
- "default": "They stop calling each other!"
340
- },
341
- "secret": false,
342
- "icon_hash": "7d698b594c691e3d28c92e226b28293c",
343
- "id": "597638720379682816",
344
- "secure": false
345
- }
346
- ```
347
-
348
- ## Delete Achievement
349
-
350
- `DELETE https://discord.com/api/v6/applications/<application_id>/achievements/<achievement_id>`
351
-
352
- Deletes the given achievement from your application. This endpoint has a rate limit of 5 requests per 5 seconds per application.
353
-
354
- ###### Return Object
355
-
356
- ```json
357
- // 204 No Content
358
- ```
359
-
360
- ## Update User Achievement
361
-
362
- `PUT https://discord.com/api/v6/users/<user_id>/applications/<application_id>/achievements/<achievement_id>`
363
-
364
- Updates the UserAchievement record for a given user. Use this endpoint to update `secure` achievement progress for users. This endpoint has a rate limit of 5 requests per 5 seconds per application.
365
-
366
- ###### Parameters
367
-
368
- | name | type | description |
369
- | ---------------- | ---- | ------------------------------------------------------ |
370
- | percent_complete | int | the user's progress towards completing the achievement |
371
-
372
- ###### Return Object
373
-
374
- ```json
375
- {}
376
- ```
377
-
378
- ## Get User Achievements
379
-
380
- `GET https://discord.com/api/v6/users/@me/applications/<application_id>/achievements`
381
-
382
- Returns a list of achievements for the user whose token you're making the request with. This endpoint will **NOT** accept the Bearer token for your application generated via the [Client Crendentials Grant](#DOCS_TOPICS_OAUTH2/client-credentials-grant). You will need the _user's_ bearer token, gotten via either the [Authorization Code OAuth2 Grant](#DOCS_TOPICS_OAUTH2/authorization-code-grant) or via the SDK with [GetOAuth2Token](#DOCS_GAME_SDK_APPLICATIONS/getoauth2token). This endpoint has a rate limit of 2 requests per 5 seconds per application per user.
383
-
384
- > info
385
- > This endpoint will _not_ return any achievements marked as `secret` that the user has not yet completed.
386
-
387
- ###### Return Object
388
-
389
- ```json
390
- [
391
- {
392
- "application_id": "461618159171141643",
393
- "name": {
394
- "default": "Win the Game"
395
- },
396
- "description": {
397
- "default": "You won!"
398
- },
399
- "secret": false,
400
- "icon_hash": "52c1636444f64ad7cb5368b158847def",
401
- "id": "580159119969878046",
402
- "secure": false
403
- }
404
- ]
405
- ```