disgroove 1.3.3 → 1.3.4-dev.7ed5475

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 (88) hide show
  1. package/dist/lib/Client.d.ts +11 -3
  2. package/dist/lib/Client.js +4 -4
  3. package/dist/lib/Client.js.map +1 -1
  4. package/dist/lib/constants.d.ts +2 -2
  5. package/dist/lib/constants.js +36 -36
  6. package/dist/lib/constants.js.map +1 -1
  7. package/dist/lib/gateway/Shard.js +2 -2
  8. package/dist/lib/rest/RequestsManager.d.ts +1 -1
  9. package/dist/lib/rest/RequestsManager.js +3 -4
  10. package/dist/lib/rest/RequestsManager.js.map +1 -1
  11. package/dist/lib/structures/Application.d.ts +13 -13
  12. package/dist/lib/structures/ApplicationCommand.d.ts +5 -5
  13. package/dist/lib/structures/ApplicationCommand.js.map +1 -1
  14. package/dist/lib/structures/ClientApplication.d.ts +13 -13
  15. package/dist/lib/structures/Guild.d.ts +14 -14
  16. package/dist/lib/structures/Guild.js +2 -3
  17. package/dist/lib/structures/Guild.js.map +1 -1
  18. package/dist/lib/structures/User.d.ts +3 -3
  19. package/dist/lib/types/application-command.d.ts +11 -11
  20. package/dist/lib/types/application-role-connection-metadata.d.ts +5 -5
  21. package/dist/package.json +1 -2
  22. package/package.json +1 -2
  23. package/lib/Client.ts +0 -616
  24. package/lib/constants.ts +0 -1173
  25. package/lib/gateway/Shard.ts +0 -704
  26. package/lib/gateway/ShardsManager.ts +0 -11
  27. package/lib/gateway/index.ts +0 -2
  28. package/lib/index.ts +0 -7
  29. package/lib/rest/CDN.ts +0 -56
  30. package/lib/rest/Endpoints.ts +0 -241
  31. package/lib/rest/REST.ts +0 -45
  32. package/lib/rest/RequestsManager.ts +0 -134
  33. package/lib/rest/index.ts +0 -4
  34. package/lib/structures/Application.ts +0 -599
  35. package/lib/structures/ApplicationCommand.ts +0 -187
  36. package/lib/structures/AuditLog.ts +0 -112
  37. package/lib/structures/AutoModerationRule.ts +0 -127
  38. package/lib/structures/Base.ts +0 -39
  39. package/lib/structures/Channel.ts +0 -921
  40. package/lib/structures/ClientApplication.ts +0 -515
  41. package/lib/structures/Emoji.ts +0 -95
  42. package/lib/structures/Entitlement.ts +0 -65
  43. package/lib/structures/Guild.ts +0 -1842
  44. package/lib/structures/GuildMember.ts +0 -193
  45. package/lib/structures/GuildScheduledEvent.ts +0 -164
  46. package/lib/structures/GuildTemplate.ts +0 -103
  47. package/lib/structures/Integration.ts +0 -136
  48. package/lib/structures/Interaction.ts +0 -506
  49. package/lib/structures/Invite.ts +0 -108
  50. package/lib/structures/Message.ts +0 -421
  51. package/lib/structures/Role.ts +0 -116
  52. package/lib/structures/SKU.ts +0 -63
  53. package/lib/structures/StageInstance.ts +0 -74
  54. package/lib/structures/Sticker.ts +0 -100
  55. package/lib/structures/Team.ts +0 -41
  56. package/lib/structures/TestEntitlement.ts +0 -78
  57. package/lib/structures/UnavailableGuild.ts +0 -27
  58. package/lib/structures/User.ts +0 -233
  59. package/lib/structures/VoiceState.ts +0 -72
  60. package/lib/structures/Webhook.ts +0 -341
  61. package/lib/structures/index.ts +0 -27
  62. package/lib/types/application-command.ts +0 -118
  63. package/lib/types/application-role-connection-metadata.ts +0 -23
  64. package/lib/types/application.ts +0 -77
  65. package/lib/types/audit-log.ts +0 -105
  66. package/lib/types/auto-moderation.ts +0 -78
  67. package/lib/types/channel.ts +0 -534
  68. package/lib/types/emoji.ts +0 -24
  69. package/lib/types/entitlements.ts +0 -34
  70. package/lib/types/gateway-events.ts +0 -970
  71. package/lib/types/guild-scheduled-event.ts +0 -67
  72. package/lib/types/guild-template.ts +0 -30
  73. package/lib/types/guild.ts +0 -388
  74. package/lib/types/index.ts +0 -23
  75. package/lib/types/interaction.ts +0 -224
  76. package/lib/types/invite.ts +0 -78
  77. package/lib/types/message-components.ts +0 -127
  78. package/lib/types/role.ts +0 -51
  79. package/lib/types/sku.ts +0 -32
  80. package/lib/types/stage-instance.ts +0 -22
  81. package/lib/types/sticker.ts +0 -67
  82. package/lib/types/team.ts +0 -34
  83. package/lib/types/user.ts +0 -93
  84. package/lib/types/voice.ts +0 -51
  85. package/lib/types/webhook.ts +0 -40
  86. package/lib/utils/Util.ts +0 -600
  87. package/lib/utils/errors.ts +0 -23
  88. package/lib/utils/index.ts +0 -2
@@ -1,599 +0,0 @@
1
- import {
2
- Base,
3
- User,
4
- ApplicationCommand,
5
- Team,
6
- Guild,
7
- TestEntitlement,
8
- Entitlement,
9
- SKU,
10
- } from ".";
11
- import type {
12
- JSONInstallParams,
13
- JSONGuildApplicationCommandPermissions,
14
- RawApplication,
15
- RawGuildApplicationCommandPermissions,
16
- RawApplicationCommand,
17
- JSONApplication,
18
- JSONApplicationRoleConnectionMetadata,
19
- RawApplicationRoleConnectionMetadata,
20
- RawSKU,
21
- RawEntitlement,
22
- JSONApplicationCommandOption,
23
- } from "../types";
24
- import type { Client } from "../Client";
25
- import { Endpoints } from "../rest";
26
- import type {
27
- ApplicationCommandTypes,
28
- ApplicationFlags,
29
- Locale,
30
- } from "../constants";
31
-
32
- /** https://discord.com/developers/docs/resources/application */
33
- export class Application extends Base {
34
- protected override raw: RawApplication;
35
- name: string;
36
- icon: string | null;
37
- description: string;
38
- rpcOrigins?: Array<string>;
39
- botPublic: boolean;
40
- botRequireCodeGrant: boolean;
41
- termsOfServiceURL?: string;
42
- privacyPolicyURL?: string;
43
- owner?: User;
44
- verifyKey: string;
45
- team: Team | null;
46
- guildId?: string;
47
- guild?: Guild;
48
- primarySKUId?: string;
49
- slug?: string;
50
- coverImage?: string;
51
- flags?: ApplicationFlags;
52
- approximateGuildCount?: number;
53
- redirectURIs?: Array<string>;
54
- interactionsEndpointURL?: string;
55
- roleConnectionsVerificationURL?: string;
56
- tags?: Array<string>;
57
- installParams?: JSONInstallParams;
58
- customInstallURL?: string;
59
-
60
- constructor(data: RawApplication, client: Client) {
61
- super(data.id, client);
62
-
63
- this.raw = data;
64
- this.name = data.name;
65
- this.icon = data.icon;
66
- this.description = data.description;
67
- this.botPublic = data.bot_public;
68
- this.botRequireCodeGrant = data.bot_require_code_grant;
69
- this.verifyKey = data.verify_key;
70
- this.team = null;
71
-
72
- this.patch(data);
73
- }
74
-
75
- protected override patch(data: RawApplication) {
76
- if (data.rpc_origins !== undefined) this.rpcOrigins = data.rpc_origins;
77
- if (data.terms_of_service_url !== undefined)
78
- this.termsOfServiceURL = data.terms_of_service_url;
79
- if (data.owner !== undefined)
80
- this.owner = new User(data.owner, this.client);
81
- if (data.team !== undefined)
82
- this.team = data.team !== null ? new Team(data.team, this.client) : null;
83
- if (data.guild_id !== undefined) this.guildId = data.guild_id;
84
- if (data.guild !== undefined)
85
- this.guild = new Guild(data.guild, this.client);
86
- if (data.primary_sku_id !== undefined)
87
- this.primarySKUId = data.primary_sku_id;
88
- if (data.slug !== undefined) this.slug = data.slug;
89
- if (data.cover_image !== undefined) this.coverImage = data.cover_image;
90
- if (data.flags !== undefined) this.flags = data.flags;
91
- if (data.approximate_guild_count !== undefined)
92
- this.approximateGuildCount = data.approximate_guild_count;
93
- if (data.redirect_uris !== undefined)
94
- this.redirectURIs = data.redirect_uris;
95
- if (data.interactions_endpoint_url !== undefined)
96
- this.interactionsEndpointURL = data.interactions_endpoint_url;
97
- if (data.role_connections_verification_url !== undefined)
98
- this.roleConnectionsVerificationURL =
99
- data.role_connections_verification_url;
100
- if (data.tags !== undefined) this.tags = data.tags;
101
- if (data.install_params !== undefined)
102
- this.installParams = data.install_params;
103
- if (data.custom_install_url !== undefined)
104
- this.customInstallURL = data.custom_install_url;
105
- }
106
-
107
- /** https://discord.com/developers/docs/interactions/application-commands#create-global-application-command */
108
- async createGlobalApplicationCommand(options: {
109
- name: string;
110
- nameLocalizations?: Partial<Record<Locale, string>> | null;
111
- description?: string;
112
- descriptionLocalizations?: Partial<Record<Locale, string>> | null;
113
- options?: Array<JSONApplicationCommandOption>;
114
- defaultMemberPermissions?: string | null;
115
- dmPermission?: boolean;
116
- defaultPermission?: boolean | null;
117
- type?: ApplicationCommandTypes;
118
- nsfw?: boolean;
119
- }): Promise<ApplicationCommand> {
120
- return new ApplicationCommand(
121
- await this.client.rest.post<RawApplicationCommand>(
122
- Endpoints.applicationCommands(this.id),
123
- {
124
- json: this.client.util.applicationCommandToRaw(options),
125
- }
126
- ),
127
- this.client
128
- );
129
- }
130
-
131
- /** https://discord.com/developers/docs/interactions/application-commands#create-guild-application-command */
132
- async createGuildApplicationCommand(
133
- guildId: string,
134
- options: {
135
- name: string;
136
- nameLocalizations?: Partial<Record<Locale, string>> | null;
137
- description?: string;
138
- descriptionLocalizations?: Partial<Record<Locale, string>> | null;
139
- options?: Array<JSONApplicationCommandOption>;
140
- defaultMemberPermissions?: string | null;
141
- dmPermission?: boolean;
142
- defaultPermission?: boolean | null;
143
- type?: ApplicationCommandTypes;
144
- nsfw?: boolean;
145
- }
146
- ): Promise<ApplicationCommand> {
147
- return new ApplicationCommand(
148
- await this.client.rest.post<RawApplicationCommand>(
149
- Endpoints.applicationGuildCommands(this.id, guildId),
150
- {
151
- json: this.client.util.applicationCommandToRaw(options),
152
- }
153
- ),
154
- this.client
155
- );
156
- }
157
-
158
- /** https://discord.com/developers/docs/monetization/entitlements#create-test-entitlement */
159
- async createTestEntitlement(options: {
160
- skuId: string;
161
- ownerId: string;
162
- ownerType: number;
163
- }): Promise<TestEntitlement> {
164
- return new TestEntitlement(
165
- await this.client.rest.post<
166
- Omit<RawEntitlement, "starts_at" | "ends_at" | "subscription_id">
167
- >(Endpoints.applicationEntitlements(this.id), {
168
- json: {
169
- sku_id: options.skuId,
170
- owner_id: options.ownerId,
171
- owner_type: options.ownerType,
172
- },
173
- }),
174
- this.client
175
- );
176
- }
177
-
178
- /** https://discord.com/developers/docs/interactions/application-commands#delete-global-application-command */
179
- deleteGlobalApplicationCommand(commandId: string): void {
180
- this.client.rest.delete(Endpoints.applicationCommand(this.id, commandId));
181
- }
182
-
183
- /** https://discord.com/developers/docs/interactions/application-commands#delete-guild-application-command */
184
- deleteGuildApplicationCommand(guildId: string, commandId: string): void {
185
- this.client.rest.delete(
186
- Endpoints.applicationGuildCommand(this.id, guildId, commandId)
187
- );
188
- }
189
-
190
- /** https://discord.com/developers/docs/monetization/entitlements#delete-test-entitlement */
191
- deleteTestEntitlement(entitlementId: string): void {
192
- this.client.rest.delete(
193
- Endpoints.applicationEntitlement(this.id, entitlementId)
194
- );
195
- }
196
-
197
- /** https://discord.com/developers/docs/resources/application#edit-current-application */
198
- async edit(options: {
199
- customInstallURL?: string;
200
- description?: string;
201
- roleConnectionsVerificationURL?: string;
202
- installParams?: JSONInstallParams;
203
- flags?: ApplicationFlags;
204
- icon?: string;
205
- coverImage?: string;
206
- interactionsEndpointURL?: string;
207
- tags?: Array<string>;
208
- }): Promise<Application> {
209
- return new Application(
210
- await this.client.rest.patch<RawApplication>(
211
- Endpoints.applicationCurrentUser(),
212
- {
213
- json: {
214
- custom_install_url: options.customInstallURL,
215
- description: options.description,
216
- role_connections_verification_url:
217
- options.roleConnectionsVerificationURL,
218
- install_params: options.installParams,
219
- flags: options.flags,
220
- icon: options.icon,
221
- cover_image: options.coverImage,
222
- interactions_endpoint_url: options.interactionsEndpointURL,
223
- tags: options.tags,
224
- },
225
- }
226
- ),
227
- this.client
228
- );
229
- }
230
-
231
- /** https://discord.com/developers/docs/interactions/application-commands#edit-application-command-permissions */
232
- async editApplicationCommandPermissions(
233
- guildId: string,
234
- commandId: string,
235
- options: {
236
- permissions: Array<JSONGuildApplicationCommandPermissions>;
237
- }
238
- ): Promise<JSONGuildApplicationCommandPermissions> {
239
- return this.client.rest
240
- .put<RawGuildApplicationCommandPermissions>(
241
- Endpoints.applicationCommandPermissions(this.id, guildId, commandId),
242
- {
243
- json: {
244
- permissions: options.permissions.map((option) => ({
245
- id: option.id,
246
- application_id: option.applicationId,
247
- guild_id: option.guildId,
248
- permissions: option.permissions.map((permission) => ({
249
- id: permission.id,
250
- type: permission.type,
251
- permission: permission.permission,
252
- })),
253
- })),
254
- },
255
- }
256
- )
257
- .then((response) => ({
258
- id: response.id,
259
- applicationId: response.application_id,
260
- guildId: response.guild_id,
261
- permissions: response.permissions.map((permission) => ({
262
- id: permission.id,
263
- type: permission.type,
264
- permission: permission.permission,
265
- })),
266
- }));
267
- }
268
-
269
- /** https://discord.com/developers/docs/interactions/application-commands#edit-global-application-command */
270
- async editGlobalApplicationCommand(
271
- commandId: string,
272
- options: {
273
- name?: string;
274
- nameLocalizations?: Partial<Record<Locale, string>> | null;
275
- description?: string;
276
- descriptionLocalizations?: Partial<Record<Locale, string>> | null;
277
- options?: Array<JSONApplicationCommandOption>;
278
- defaultMemberPermissions?: string | null;
279
- defaultPermission?: boolean | null;
280
- dmPermission?: boolean;
281
- nsfw?: boolean;
282
- }
283
- ): Promise<ApplicationCommand> {
284
- return new ApplicationCommand(
285
- await this.client.rest.patch<RawApplicationCommand>(
286
- Endpoints.applicationCommand(this.id, commandId),
287
- {
288
- json: this.client.util.applicationCommandToRaw(options),
289
- }
290
- ),
291
- this.client
292
- );
293
- }
294
-
295
- /** https://discord.com/developers/docs/interactions/application-commands#edit-guild-application-command */
296
- async editGuildApplicationCommand(
297
- guildId: string,
298
- commandId: string,
299
- options: {
300
- name?: string;
301
- nameLocalizations?: Partial<Record<Locale, string>> | null;
302
- description?: string;
303
- descriptionLocalizations?: Partial<Record<Locale, string>> | null;
304
- options?: Array<JSONApplicationCommandOption>;
305
- defaultMemberPermissions?: string | null;
306
- defaultPermission?: boolean | null;
307
- dmPermission?: boolean;
308
- nsfw?: boolean;
309
- }
310
- ): Promise<ApplicationCommand> {
311
- return new ApplicationCommand(
312
- await this.client.rest.patch<RawApplicationCommand>(
313
- Endpoints.applicationGuildCommand(this.id, guildId, commandId),
314
- {
315
- json: this.client.util.applicationCommandToRaw(options),
316
- }
317
- ),
318
- this.client
319
- );
320
- }
321
-
322
- /** https://discord.com/developers/docs/interactions/application-commands#get-application-command-permissions */
323
- async getApplicationCommandPermissions(
324
- guildId: string,
325
- commandId: string
326
- ): Promise<Array<JSONGuildApplicationCommandPermissions>> {
327
- return this.client.rest
328
- .get<Array<RawGuildApplicationCommandPermissions>>(
329
- Endpoints.applicationCommandPermissions(this.id, guildId, commandId)
330
- )
331
- .then((response) =>
332
- response.map((permissions: RawGuildApplicationCommandPermissions) => ({
333
- id: permissions.id,
334
- applicationId: permissions.application_id,
335
- guildId: permissions.guild_id,
336
- permissions: permissions.permissions.map((permission) => ({
337
- id: permission.id,
338
- type: permission.type,
339
- permission: permission.permission,
340
- })),
341
- }))
342
- );
343
- }
344
-
345
- /** https://discord.com/developers/docs/monetization/entitlements#list-entitlements */
346
- async getEntitlements(options?: {
347
- userId?: string;
348
- skuIds?: Array<string>;
349
- before?: string;
350
- after?: string;
351
- limit?: number;
352
- guildId?: string;
353
- excludeEnded?: boolean;
354
- }): Promise<Array<Entitlement>> {
355
- return this.client.rest
356
- .get<Array<RawEntitlement>>(Endpoints.applicationEntitlements(this.id), {
357
- query: {
358
- user_id: options?.userId,
359
- sku_ids: options?.skuIds,
360
- before: options?.before,
361
- after: options?.after,
362
- limit: options?.limit,
363
- guild_id: options?.guildId,
364
- exclude_ended: options?.excludeEnded,
365
- },
366
- })
367
- .then((response) =>
368
- response.map((data) => new Entitlement(data, this.client))
369
- );
370
- }
371
-
372
- /** https://discord.com/developers/docs/interactions/application-commands#get-global-application-command */
373
- async getGlobalApplicationCommand(
374
- commandId: string
375
- ): Promise<ApplicationCommand> {
376
- return new ApplicationCommand(
377
- await this.client.rest.get<RawApplicationCommand>(
378
- Endpoints.applicationCommand(this.id, commandId)
379
- ),
380
- this.client
381
- );
382
- }
383
-
384
- /** https://discord.com/developers/docs/interactions/application-commands#get-global-application-commands */
385
- async getGlobalApplicationCommands(options: {
386
- withLocalizations?: boolean;
387
- }): Promise<Array<ApplicationCommand>> {
388
- return this.client.rest
389
- .get<Array<RawApplicationCommand>>(
390
- Endpoints.applicationCommands(this.id),
391
- {
392
- query: {
393
- with_localizations: options.withLocalizations,
394
- },
395
- }
396
- )
397
- .then((response) =>
398
- response.map((data) => new ApplicationCommand(data, this.client))
399
- );
400
- }
401
-
402
- /** https://discord.com/developers/docs/interactions/application-commands#get-guild-application-command */
403
- async getGuildApplicationCommand(
404
- guildId: string,
405
- commandId: string
406
- ): Promise<ApplicationCommand> {
407
- return new ApplicationCommand(
408
- await this.client.rest.get<RawApplicationCommand>(
409
- Endpoints.applicationGuildCommand(this.id, guildId, commandId)
410
- ),
411
- this.client
412
- );
413
- }
414
-
415
- /** https://discord.com/developers/docs/interactions/application-commands#get-guild-application-commands */
416
- async getGuildApplicationCommands(
417
- guildId: string,
418
- options?: {
419
- withLocalizations?: boolean;
420
- }
421
- ): Promise<Array<ApplicationCommand>> {
422
- return this.client.rest
423
- .get<Array<RawApplicationCommand>>(
424
- Endpoints.applicationGuildCommands(this.id, guildId),
425
- {
426
- query: {
427
- with_localizations: options?.withLocalizations,
428
- },
429
- }
430
- )
431
- .then((response) =>
432
- response.map((data) => new ApplicationCommand(data, this.client))
433
- );
434
- }
435
-
436
- /** https://discord.com/developers/docs/interactions/application-commands#get-guild-application-command-permissions */
437
- async getGuildApplicationCommandPermissions(
438
- guildId: string
439
- ): Promise<Array<JSONGuildApplicationCommandPermissions>> {
440
- return this.client.rest
441
- .get<Array<RawGuildApplicationCommandPermissions>>(
442
- Endpoints.guildApplicationCommandsPermissions(this.id, guildId)
443
- )
444
- .then((response) =>
445
- response.map((permissions: RawGuildApplicationCommandPermissions) => ({
446
- id: permissions.id,
447
- applicationId: permissions.application_id,
448
- guildId: permissions.guild_id,
449
- permissions: permissions.permissions.map((permission) => ({
450
- id: permission.id,
451
- type: permission.type,
452
- permission: permission.permission,
453
- })),
454
- }))
455
- );
456
- }
457
-
458
- /** https://discord.com/developers/docs/resources/application-role-connection-metadata#get-application-role-connection-metadata-records */
459
- async getApplicationRoleConnectionMetadataRecords(): Promise<
460
- Array<JSONApplicationRoleConnectionMetadata>
461
- > {
462
- return this.client.rest
463
- .get<Array<RawApplicationRoleConnectionMetadata>>(
464
- Endpoints.applicationRoleConnectionMetadata(this.id)
465
- )
466
- .then((response) =>
467
- response.map((data) => ({
468
- type: data.type,
469
- key: data.key,
470
- name: data.name,
471
- nameLocalizations: data.name_localizations,
472
- description: data.description,
473
- descriptionLocalizations: data.description_localizations,
474
- }))
475
- );
476
- }
477
-
478
- /** https://discord.com/developers/docs/monetization/skus#list-skus */
479
- async getSKUs(): Promise<Array<SKU>> {
480
- return this.client.rest
481
- .get<Array<RawSKU>>(Endpoints.applicationSKUs(this.id))
482
- .then((response) => response.map((data) => new SKU(data, this.client)));
483
- }
484
-
485
- /** https://discord.com/developers/docs/interactions/application-commands#bulk-overwrite-global-application-commands */
486
- async setGlobalApplicationCommands(
487
- commands: Array<{
488
- id?: string;
489
- name: string;
490
- nameLocalizations?: Partial<Record<Locale, string>> | null;
491
- description?: string;
492
- descriptionLocalizations?: Partial<Record<Locale, string>> | null;
493
- options?: Array<JSONApplicationCommandOption>;
494
- defaultMemberPermissions?: string | null;
495
- dmPermission?: boolean;
496
- defaultPermission?: boolean | null;
497
- type?: ApplicationCommandTypes;
498
- nsfw?: boolean;
499
- }>
500
- ): Promise<Array<ApplicationCommand>> {
501
- return this.client.rest
502
- .put<Array<RawApplicationCommand>>(
503
- Endpoints.applicationCommands(this.id),
504
- {
505
- json: commands.map((command) =>
506
- this.client.util.applicationCommandToRaw(command)
507
- ),
508
- }
509
- )
510
- .then((response) =>
511
- response.map((data) => new ApplicationCommand(data, this.client))
512
- );
513
- }
514
-
515
- /** https://discord.com/developers/docs/interactions/application-commands#bulk-overwrite-guild-application-commands */
516
- async setGuildApplicationCommands(
517
- guildId: string,
518
- commands: Array<{
519
- id?: string;
520
- name: string;
521
- nameLocalizations?: Partial<Record<Locale, string>> | null;
522
- description?: string;
523
- descriptionLocalizations?: Partial<Record<Locale, string>> | null;
524
- options?: Array<JSONApplicationCommandOption>;
525
- defaultMemberPermissions?: string | null;
526
- dmPermission?: boolean;
527
- defaultPermission?: boolean | null;
528
- type: ApplicationCommandTypes;
529
- nsfw?: boolean;
530
- }>
531
- ): Promise<Array<ApplicationCommand>> {
532
- return this.client.rest
533
- .put<Array<RawApplicationCommand>>(
534
- Endpoints.applicationGuildCommands(this.id, guildId),
535
- {
536
- json: commands.map((command) =>
537
- this.client.util.applicationCommandToRaw(command)
538
- ),
539
- }
540
- )
541
- .then((response) =>
542
- response.map((data) => new ApplicationCommand(data, this.client))
543
- );
544
- }
545
-
546
- /** https://discord.com/developers/docs/resources/application-role-connection-metadata#update-application-role-connection-metadata-records */
547
- async updateApplicationRoleConnectionMetadataRecords(): Promise<
548
- Array<JSONApplicationRoleConnectionMetadata>
549
- > {
550
- return this.client.rest
551
- .put<Array<RawApplicationRoleConnectionMetadata>>(
552
- Endpoints.applicationRoleConnectionMetadata(this.id)
553
- )
554
- .then((response) =>
555
- response.map((data) => ({
556
- type: data.type,
557
- key: data.key,
558
- name: data.name,
559
- nameLocalizations: data.name_localizations,
560
- description: data.description,
561
- descriptionLocalizations: data.description_localizations,
562
- }))
563
- );
564
- }
565
-
566
- override toRaw(): RawApplication {
567
- return this.raw;
568
- }
569
-
570
- override toJSON(): JSONApplication {
571
- return {
572
- ...super.toJSON(),
573
- name: this.name,
574
- icon: this.icon,
575
- description: this.description,
576
- rpcOrigins: this.rpcOrigins,
577
- botPublic: this.botPublic,
578
- botRequireCodeGrant: this.botRequireCodeGrant,
579
- termsOfServiceURL: this.termsOfServiceURL,
580
- privacyPolicyURL: this.privacyPolicyURL,
581
- owner: this.owner?.toJSON(),
582
- verifyKey: this.verifyKey,
583
- team: this.team?.toJSON() ?? null,
584
- guildId: this.guildId,
585
- guild: this.guild?.toJSON(),
586
- primarySKUId: this.primarySKUId,
587
- slug: this.slug,
588
- coverImage: this.coverImage,
589
- flags: this.flags,
590
- approximateGuildCount: this.approximateGuildCount,
591
- redirectURIs: this.redirectURIs,
592
- interactionsEndpointURL: this.interactionsEndpointURL,
593
- roleConnectionsVerificationURL: this.roleConnectionsVerificationURL,
594
- tags: this.tags,
595
- installParams: this.installParams,
596
- customInstallURL: this.customInstallURL,
597
- };
598
- }
599
- }