@discordjs/core 2.5.0 → 2.7.0

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.
package/dist/index.mjs CHANGED
@@ -10,6 +10,7 @@ var ApplicationCommandsAPI = class {
10
10
  constructor(rest) {
11
11
  this.rest = rest;
12
12
  }
13
+ rest;
13
14
  static {
14
15
  __name(this, "ApplicationCommandsAPI");
15
16
  }
@@ -21,8 +22,9 @@ var ApplicationCommandsAPI = class {
21
22
  * @param query - The query options for fetching commands
22
23
  * @param options - The options for fetching commands
23
24
  */
24
- async getGlobalCommands(applicationId, query = {}, { signal } = {}) {
25
+ async getGlobalCommands(applicationId, query = {}, { locale, signal } = {}) {
25
26
  return this.rest.get(Routes.applicationCommands(applicationId), {
27
+ headers: locale ? { "X-Discord-Locale": locale } : {},
26
28
  query: makeURLSearchParams(query),
27
29
  signal
28
30
  });
@@ -103,8 +105,9 @@ var ApplicationCommandsAPI = class {
103
105
  * @param query - The data for fetching commands
104
106
  * @param options - The options for fetching commands
105
107
  */
106
- async getGuildCommands(applicationId, guildId, query = {}, { signal } = {}) {
108
+ async getGuildCommands(applicationId, guildId, query = {}, { locale, signal } = {}) {
107
109
  return this.rest.get(Routes.applicationGuildCommands(applicationId, guildId), {
110
+ headers: locale ? { "X-Discord-Locale": locale } : {},
108
111
  query: makeURLSearchParams(query),
109
112
  signal
110
113
  });
@@ -237,6 +240,7 @@ var ApplicationsAPI = class {
237
240
  constructor(rest) {
238
241
  this.rest = rest;
239
242
  }
243
+ rest;
240
244
  static {
241
245
  __name(this, "ApplicationsAPI");
242
246
  }
@@ -327,6 +331,19 @@ var ApplicationsAPI = class {
327
331
  async deleteEmoji(applicationId, emojiId, { signal } = {}) {
328
332
  await this.rest.delete(Routes2.applicationEmoji(applicationId, emojiId), { signal });
329
333
  }
334
+ /**
335
+ * Fetches an activity instance of an application
336
+ *
337
+ * @see {@link https://docs.discord.com/developers/resources/application#get-application-activity-instance}
338
+ * @param applicationId - The id of the application to fetch the activity instance of
339
+ * @param instanceId - The id of the activity instance to fetch
340
+ * @param options - The options for fetching the activity instance
341
+ */
342
+ async getActivityInstance(applicationId, instanceId, { signal } = {}) {
343
+ return this.rest.get(Routes2.applicationActivityInstance(applicationId, instanceId), {
344
+ signal
345
+ });
346
+ }
330
347
  };
331
348
 
332
349
  // src/api/channel.ts
@@ -338,6 +355,7 @@ var ChannelsAPI = class {
338
355
  constructor(rest) {
339
356
  this.rest = rest;
340
357
  }
358
+ rest;
341
359
  static {
342
360
  __name(this, "ChannelsAPI");
343
361
  }
@@ -614,10 +632,11 @@ var ChannelsAPI = class {
614
632
  * @param body - The data for creating the invite
615
633
  * @param options - The options for creating the invite
616
634
  */
617
- async createInvite(channelId, body, { reason, signal } = {}) {
635
+ async createInvite(channelId, { targetUsersFile, ...body }, { reason, signal } = {}) {
618
636
  return this.rest.post(Routes3.channelInvites(channelId), {
619
637
  reason,
620
638
  body,
639
+ files: targetUsersFile ? [{ key: "target_users_file", contentType: "text/csv", ...targetUsersFile }] : [],
621
640
  signal
622
641
  });
623
642
  }
@@ -762,7 +781,7 @@ var ChannelsAPI = class {
762
781
  * @param options - The options for sending the soundboard sound
763
782
  */
764
783
  async sendSoundboardSound(channelId, body, { signal } = {}) {
765
- return this.rest.post(Routes3.sendSoundboardSound(channelId), {
784
+ await this.rest.post(Routes3.sendSoundboardSound(channelId), {
766
785
  body,
767
786
  signal
768
787
  });
@@ -803,6 +822,7 @@ var GatewayAPI = class {
803
822
  constructor(rest) {
804
823
  this.rest = rest;
805
824
  }
825
+ rest;
806
826
  static {
807
827
  __name(this, "GatewayAPI");
808
828
  }
@@ -843,6 +863,7 @@ var VoiceAPI = class {
843
863
  constructor(rest) {
844
864
  this.rest = rest;
845
865
  }
866
+ rest;
846
867
  static {
847
868
  __name(this, "VoiceAPI");
848
869
  }
@@ -914,6 +935,7 @@ var GuildsAPI = class {
914
935
  constructor(rest) {
915
936
  this.rest = rest;
916
937
  }
938
+ rest;
917
939
  static {
918
940
  __name(this, "GuildsAPI");
919
941
  }
@@ -1957,6 +1979,18 @@ var GuildsAPI = class {
1957
1979
  signal
1958
1980
  });
1959
1981
  }
1982
+ /**
1983
+ * Fetches role member counts for a guild.
1984
+ *
1985
+ * @see {@link https://docs.discord.com/developers/resources/guild#get-guild-role-member-counts}
1986
+ * @param guildId - The id of the guild to fetch role member counts for
1987
+ * @param options - The options for fetching role member counts
1988
+ */
1989
+ async getRoleMemberCounts(guildId, { signal } = {}) {
1990
+ return this.rest.get(Routes6.guildRoleMemberCounts(guildId), {
1991
+ signal
1992
+ });
1993
+ }
1960
1994
  };
1961
1995
 
1962
1996
  // src/api/interactions.ts
@@ -1970,6 +2004,8 @@ var InteractionsAPI = class {
1970
2004
  this.rest = rest;
1971
2005
  this.webhooks = webhooks;
1972
2006
  }
2007
+ rest;
2008
+ webhooks;
1973
2009
  static {
1974
2010
  __name(this, "InteractionsAPI");
1975
2011
  }
@@ -2144,13 +2180,14 @@ var InvitesAPI = class {
2144
2180
  constructor(rest) {
2145
2181
  this.rest = rest;
2146
2182
  }
2183
+ rest;
2147
2184
  static {
2148
2185
  __name(this, "InvitesAPI");
2149
2186
  }
2150
2187
  /**
2151
2188
  * Fetches an invite
2152
2189
  *
2153
- * @see {@link https://discord.com/developers/docs/resources/invite#get-invite}
2190
+ * @see {@link https://docs.discord.com/developers/resources/invite#get-invite}
2154
2191
  * @param code - The invite code
2155
2192
  * @param query - The options for fetching the invite
2156
2193
  * @param options - The options for fetching the invite
@@ -2164,13 +2201,53 @@ var InvitesAPI = class {
2164
2201
  /**
2165
2202
  * Deletes an invite
2166
2203
  *
2167
- * @see {@link https://discord.com/developers/docs/resources/invite#delete-invite}
2204
+ * @see {@link https://docs.discord.com/developers/resources/invite#delete-invite}
2168
2205
  * @param code - The invite code
2169
2206
  * @param options - The options for deleting the invite
2170
2207
  */
2171
2208
  async delete(code, { reason, signal } = {}) {
2172
2209
  return this.rest.delete(Routes8.invite(code), { reason, signal });
2173
2210
  }
2211
+ /**
2212
+ * Fetches an invite's target users
2213
+ *
2214
+ * @see {@link https://docs.discord.com/developers/resources/invite#get-target-users}
2215
+ * @param code - The invite code
2216
+ * @param options - The options for fetching the invite target users
2217
+ * @returns
2218
+ */
2219
+ async getTargetUsers(code, { signal } = {}) {
2220
+ return this.rest.get(Routes8.inviteTargetUsers(code), { signal });
2221
+ }
2222
+ /**
2223
+ * Updates an invite's target users
2224
+ *
2225
+ * @see {@link https://docs.discord.com/developers/resources/invite#update-target-users}
2226
+ * @param code - The invite code
2227
+ * @param targetUsersFile - A CSV file with a single column of user ids
2228
+ * for all the users able to accept this invite
2229
+ * @param options - The options for updating the invite target users
2230
+ * @returns
2231
+ */
2232
+ async updateTargetUsers(code, targetUsersFile, { signal } = {}) {
2233
+ return this.rest.put(Routes8.inviteTargetUsers(code), {
2234
+ files: [{ key: "target_users_file", contentType: "text/csv", ...targetUsersFile }],
2235
+ signal
2236
+ });
2237
+ }
2238
+ /**
2239
+ * Fetches an invite's target users job status
2240
+ *
2241
+ * @see {@link https://docs.discord.com/developers/resources/invite#get-target-users-job-status}
2242
+ * @param code - The invite code
2243
+ * @param options - The options for fetching the invite target users job status
2244
+ * @returns
2245
+ */
2246
+ async getTargetUsersJobStatus(code, { signal } = {}) {
2247
+ return this.rest.get(Routes8.inviteTargetUsersJobStatus(code), {
2248
+ signal
2249
+ });
2250
+ }
2174
2251
  };
2175
2252
 
2176
2253
  // src/api/monetization.ts
@@ -2182,6 +2259,7 @@ var MonetizationAPI = class {
2182
2259
  constructor(rest) {
2183
2260
  this.rest = rest;
2184
2261
  }
2262
+ rest;
2185
2263
  static {
2186
2264
  __name(this, "MonetizationAPI");
2187
2265
  }
@@ -2297,6 +2375,7 @@ var OAuth2API = class {
2297
2375
  constructor(rest) {
2298
2376
  this.rest = rest;
2299
2377
  }
2378
+ rest;
2300
2379
  static {
2301
2380
  __name(this, "OAuth2API");
2302
2381
  }
@@ -2421,6 +2500,7 @@ var PollAPI = class {
2421
2500
  constructor(rest) {
2422
2501
  this.rest = rest;
2423
2502
  }
2503
+ rest;
2424
2504
  static {
2425
2505
  __name(this, "PollAPI");
2426
2506
  }
@@ -2463,6 +2543,7 @@ var RoleConnectionsAPI = class {
2463
2543
  constructor(rest) {
2464
2544
  this.rest = rest;
2465
2545
  }
2546
+ rest;
2466
2547
  static {
2467
2548
  __name(this, "RoleConnectionsAPI");
2468
2549
  }
@@ -2500,6 +2581,7 @@ var SoundboardSoundsAPI = class {
2500
2581
  constructor(rest) {
2501
2582
  this.rest = rest;
2502
2583
  }
2584
+ rest;
2503
2585
  static {
2504
2586
  __name(this, "SoundboardSoundsAPI");
2505
2587
  }
@@ -2524,6 +2606,7 @@ var StageInstancesAPI = class {
2524
2606
  constructor(rest) {
2525
2607
  this.rest = rest;
2526
2608
  }
2609
+ rest;
2527
2610
  static {
2528
2611
  __name(this, "StageInstancesAPI");
2529
2612
  }
@@ -2586,6 +2669,7 @@ var StickersAPI = class {
2586
2669
  constructor(rest) {
2587
2670
  this.rest = rest;
2588
2671
  }
2672
+ rest;
2589
2673
  static {
2590
2674
  __name(this, "StickersAPI");
2591
2675
  }
@@ -2638,6 +2722,7 @@ var ThreadsAPI = class {
2638
2722
  constructor(rest) {
2639
2723
  this.rest = rest;
2640
2724
  }
2725
+ rest;
2641
2726
  static {
2642
2727
  __name(this, "ThreadsAPI");
2643
2728
  }
@@ -2715,6 +2800,7 @@ var UsersAPI = class {
2715
2800
  constructor(rest) {
2716
2801
  this.rest = rest;
2717
2802
  }
2803
+ rest;
2718
2804
  static {
2719
2805
  __name(this, "UsersAPI");
2720
2806
  }
@@ -2854,6 +2940,7 @@ var WebhooksAPI = class {
2854
2940
  constructor(rest) {
2855
2941
  this.rest = rest;
2856
2942
  }
2943
+ rest;
2857
2944
  static {
2858
2945
  __name(this, "WebhooksAPI");
2859
2946
  }
@@ -3036,6 +3123,7 @@ var API = class {
3036
3123
  this.webhooks = new WebhooksAPI(rest);
3037
3124
  this.interactions = new InteractionsAPI(rest, this.webhooks);
3038
3125
  }
3126
+ rest;
3039
3127
  static {
3040
3128
  __name(this, "API");
3041
3129
  }
@@ -3319,7 +3407,7 @@ __name(withFiles, "withFiles");
3319
3407
  // src/index.ts
3320
3408
  export * from "discord-api-types/v10";
3321
3409
  import { GatewayRateLimitError as GatewayRateLimitError2 } from "@discordjs/util";
3322
- var version = "2.5.0";
3410
+ var version = "2.7.0";
3323
3411
  export {
3324
3412
  API,
3325
3413
  ApplicationCommandsAPI,