@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.js CHANGED
@@ -55,6 +55,7 @@ var ApplicationCommandsAPI = class {
55
55
  constructor(rest) {
56
56
  this.rest = rest;
57
57
  }
58
+ rest;
58
59
  static {
59
60
  __name(this, "ApplicationCommandsAPI");
60
61
  }
@@ -66,8 +67,9 @@ var ApplicationCommandsAPI = class {
66
67
  * @param query - The query options for fetching commands
67
68
  * @param options - The options for fetching commands
68
69
  */
69
- async getGlobalCommands(applicationId, query = {}, { signal } = {}) {
70
+ async getGlobalCommands(applicationId, query = {}, { locale, signal } = {}) {
70
71
  return this.rest.get(import_v10.Routes.applicationCommands(applicationId), {
72
+ headers: locale ? { "X-Discord-Locale": locale } : {},
71
73
  query: (0, import_rest.makeURLSearchParams)(query),
72
74
  signal
73
75
  });
@@ -148,8 +150,9 @@ var ApplicationCommandsAPI = class {
148
150
  * @param query - The data for fetching commands
149
151
  * @param options - The options for fetching commands
150
152
  */
151
- async getGuildCommands(applicationId, guildId, query = {}, { signal } = {}) {
153
+ async getGuildCommands(applicationId, guildId, query = {}, { locale, signal } = {}) {
152
154
  return this.rest.get(import_v10.Routes.applicationGuildCommands(applicationId, guildId), {
155
+ headers: locale ? { "X-Discord-Locale": locale } : {},
153
156
  query: (0, import_rest.makeURLSearchParams)(query),
154
157
  signal
155
158
  });
@@ -280,6 +283,7 @@ var ApplicationsAPI = class {
280
283
  constructor(rest) {
281
284
  this.rest = rest;
282
285
  }
286
+ rest;
283
287
  static {
284
288
  __name(this, "ApplicationsAPI");
285
289
  }
@@ -370,6 +374,19 @@ var ApplicationsAPI = class {
370
374
  async deleteEmoji(applicationId, emojiId, { signal } = {}) {
371
375
  await this.rest.delete(import_v102.Routes.applicationEmoji(applicationId, emojiId), { signal });
372
376
  }
377
+ /**
378
+ * Fetches an activity instance of an application
379
+ *
380
+ * @see {@link https://docs.discord.com/developers/resources/application#get-application-activity-instance}
381
+ * @param applicationId - The id of the application to fetch the activity instance of
382
+ * @param instanceId - The id of the activity instance to fetch
383
+ * @param options - The options for fetching the activity instance
384
+ */
385
+ async getActivityInstance(applicationId, instanceId, { signal } = {}) {
386
+ return this.rest.get(import_v102.Routes.applicationActivityInstance(applicationId, instanceId), {
387
+ signal
388
+ });
389
+ }
373
390
  };
374
391
 
375
392
  // src/api/channel.ts
@@ -379,6 +396,7 @@ var ChannelsAPI = class {
379
396
  constructor(rest) {
380
397
  this.rest = rest;
381
398
  }
399
+ rest;
382
400
  static {
383
401
  __name(this, "ChannelsAPI");
384
402
  }
@@ -655,10 +673,11 @@ var ChannelsAPI = class {
655
673
  * @param body - The data for creating the invite
656
674
  * @param options - The options for creating the invite
657
675
  */
658
- async createInvite(channelId, body, { reason, signal } = {}) {
676
+ async createInvite(channelId, { targetUsersFile, ...body }, { reason, signal } = {}) {
659
677
  return this.rest.post(import_v103.Routes.channelInvites(channelId), {
660
678
  reason,
661
679
  body,
680
+ files: targetUsersFile ? [{ key: "target_users_file", contentType: "text/csv", ...targetUsersFile }] : [],
662
681
  signal
663
682
  });
664
683
  }
@@ -803,7 +822,7 @@ var ChannelsAPI = class {
803
822
  * @param options - The options for sending the soundboard sound
804
823
  */
805
824
  async sendSoundboardSound(channelId, body, { signal } = {}) {
806
- return this.rest.post(import_v103.Routes.sendSoundboardSound(channelId), {
825
+ await this.rest.post(import_v103.Routes.sendSoundboardSound(channelId), {
807
826
  body,
808
827
  signal
809
828
  });
@@ -844,6 +863,7 @@ var GatewayAPI = class {
844
863
  constructor(rest) {
845
864
  this.rest = rest;
846
865
  }
866
+ rest;
847
867
  static {
848
868
  __name(this, "GatewayAPI");
849
869
  }
@@ -880,6 +900,7 @@ var VoiceAPI = class {
880
900
  constructor(rest) {
881
901
  this.rest = rest;
882
902
  }
903
+ rest;
883
904
  static {
884
905
  __name(this, "VoiceAPI");
885
906
  }
@@ -951,6 +972,7 @@ var GuildsAPI = class {
951
972
  constructor(rest) {
952
973
  this.rest = rest;
953
974
  }
975
+ rest;
954
976
  static {
955
977
  __name(this, "GuildsAPI");
956
978
  }
@@ -1994,6 +2016,18 @@ var GuildsAPI = class {
1994
2016
  signal
1995
2017
  });
1996
2018
  }
2019
+ /**
2020
+ * Fetches role member counts for a guild.
2021
+ *
2022
+ * @see {@link https://docs.discord.com/developers/resources/guild#get-guild-role-member-counts}
2023
+ * @param guildId - The id of the guild to fetch role member counts for
2024
+ * @param options - The options for fetching role member counts
2025
+ */
2026
+ async getRoleMemberCounts(guildId, { signal } = {}) {
2027
+ return this.rest.get(import_v106.Routes.guildRoleMemberCounts(guildId), {
2028
+ signal
2029
+ });
2030
+ }
1997
2031
  };
1998
2032
 
1999
2033
  // src/api/interactions.ts
@@ -2004,6 +2038,8 @@ var InteractionsAPI = class {
2004
2038
  this.rest = rest;
2005
2039
  this.webhooks = webhooks;
2006
2040
  }
2041
+ rest;
2042
+ webhooks;
2007
2043
  static {
2008
2044
  __name(this, "InteractionsAPI");
2009
2045
  }
@@ -2176,13 +2212,14 @@ var InvitesAPI = class {
2176
2212
  constructor(rest) {
2177
2213
  this.rest = rest;
2178
2214
  }
2215
+ rest;
2179
2216
  static {
2180
2217
  __name(this, "InvitesAPI");
2181
2218
  }
2182
2219
  /**
2183
2220
  * Fetches an invite
2184
2221
  *
2185
- * @see {@link https://discord.com/developers/docs/resources/invite#get-invite}
2222
+ * @see {@link https://docs.discord.com/developers/resources/invite#get-invite}
2186
2223
  * @param code - The invite code
2187
2224
  * @param query - The options for fetching the invite
2188
2225
  * @param options - The options for fetching the invite
@@ -2196,13 +2233,53 @@ var InvitesAPI = class {
2196
2233
  /**
2197
2234
  * Deletes an invite
2198
2235
  *
2199
- * @see {@link https://discord.com/developers/docs/resources/invite#delete-invite}
2236
+ * @see {@link https://docs.discord.com/developers/resources/invite#delete-invite}
2200
2237
  * @param code - The invite code
2201
2238
  * @param options - The options for deleting the invite
2202
2239
  */
2203
2240
  async delete(code, { reason, signal } = {}) {
2204
2241
  return this.rest.delete(import_v108.Routes.invite(code), { reason, signal });
2205
2242
  }
2243
+ /**
2244
+ * Fetches an invite's target users
2245
+ *
2246
+ * @see {@link https://docs.discord.com/developers/resources/invite#get-target-users}
2247
+ * @param code - The invite code
2248
+ * @param options - The options for fetching the invite target users
2249
+ * @returns
2250
+ */
2251
+ async getTargetUsers(code, { signal } = {}) {
2252
+ return this.rest.get(import_v108.Routes.inviteTargetUsers(code), { signal });
2253
+ }
2254
+ /**
2255
+ * Updates an invite's target users
2256
+ *
2257
+ * @see {@link https://docs.discord.com/developers/resources/invite#update-target-users}
2258
+ * @param code - The invite code
2259
+ * @param targetUsersFile - A CSV file with a single column of user ids
2260
+ * for all the users able to accept this invite
2261
+ * @param options - The options for updating the invite target users
2262
+ * @returns
2263
+ */
2264
+ async updateTargetUsers(code, targetUsersFile, { signal } = {}) {
2265
+ return this.rest.put(import_v108.Routes.inviteTargetUsers(code), {
2266
+ files: [{ key: "target_users_file", contentType: "text/csv", ...targetUsersFile }],
2267
+ signal
2268
+ });
2269
+ }
2270
+ /**
2271
+ * Fetches an invite's target users job status
2272
+ *
2273
+ * @see {@link https://docs.discord.com/developers/resources/invite#get-target-users-job-status}
2274
+ * @param code - The invite code
2275
+ * @param options - The options for fetching the invite target users job status
2276
+ * @returns
2277
+ */
2278
+ async getTargetUsersJobStatus(code, { signal } = {}) {
2279
+ return this.rest.get(import_v108.Routes.inviteTargetUsersJobStatus(code), {
2280
+ signal
2281
+ });
2282
+ }
2206
2283
  };
2207
2284
 
2208
2285
  // src/api/monetization.ts
@@ -2212,6 +2289,7 @@ var MonetizationAPI = class {
2212
2289
  constructor(rest) {
2213
2290
  this.rest = rest;
2214
2291
  }
2292
+ rest;
2215
2293
  static {
2216
2294
  __name(this, "MonetizationAPI");
2217
2295
  }
@@ -2324,6 +2402,7 @@ var OAuth2API = class {
2324
2402
  constructor(rest) {
2325
2403
  this.rest = rest;
2326
2404
  }
2405
+ rest;
2327
2406
  static {
2328
2407
  __name(this, "OAuth2API");
2329
2408
  }
@@ -2446,6 +2525,7 @@ var PollAPI = class {
2446
2525
  constructor(rest) {
2447
2526
  this.rest = rest;
2448
2527
  }
2528
+ rest;
2449
2529
  static {
2450
2530
  __name(this, "PollAPI");
2451
2531
  }
@@ -2486,6 +2566,7 @@ var RoleConnectionsAPI = class {
2486
2566
  constructor(rest) {
2487
2567
  this.rest = rest;
2488
2568
  }
2569
+ rest;
2489
2570
  static {
2490
2571
  __name(this, "RoleConnectionsAPI");
2491
2572
  }
@@ -2523,6 +2604,7 @@ var SoundboardSoundsAPI = class {
2523
2604
  constructor(rest) {
2524
2605
  this.rest = rest;
2525
2606
  }
2607
+ rest;
2526
2608
  static {
2527
2609
  __name(this, "SoundboardSoundsAPI");
2528
2610
  }
@@ -2545,6 +2627,7 @@ var StageInstancesAPI = class {
2545
2627
  constructor(rest) {
2546
2628
  this.rest = rest;
2547
2629
  }
2630
+ rest;
2548
2631
  static {
2549
2632
  __name(this, "StageInstancesAPI");
2550
2633
  }
@@ -2605,6 +2688,7 @@ var StickersAPI = class {
2605
2688
  constructor(rest) {
2606
2689
  this.rest = rest;
2607
2690
  }
2691
+ rest;
2608
2692
  static {
2609
2693
  __name(this, "StickersAPI");
2610
2694
  }
@@ -2655,6 +2739,7 @@ var ThreadsAPI = class {
2655
2739
  constructor(rest) {
2656
2740
  this.rest = rest;
2657
2741
  }
2742
+ rest;
2658
2743
  static {
2659
2744
  __name(this, "ThreadsAPI");
2660
2745
  }
@@ -2730,6 +2815,7 @@ var UsersAPI = class {
2730
2815
  constructor(rest) {
2731
2816
  this.rest = rest;
2732
2817
  }
2818
+ rest;
2733
2819
  static {
2734
2820
  __name(this, "UsersAPI");
2735
2821
  }
@@ -2867,6 +2953,7 @@ var WebhooksAPI = class {
2867
2953
  constructor(rest) {
2868
2954
  this.rest = rest;
2869
2955
  }
2956
+ rest;
2870
2957
  static {
2871
2958
  __name(this, "WebhooksAPI");
2872
2959
  }
@@ -3049,6 +3136,7 @@ var API = class {
3049
3136
  this.webhooks = new WebhooksAPI(rest);
3050
3137
  this.interactions = new InteractionsAPI(rest, this.webhooks);
3051
3138
  }
3139
+ rest;
3052
3140
  static {
3053
3141
  __name(this, "API");
3054
3142
  }
@@ -3329,7 +3417,7 @@ __name(withFiles, "withFiles");
3329
3417
  // src/index.ts
3330
3418
  __reExport(index_exports, require("discord-api-types/v10"), module.exports);
3331
3419
  var import_util2 = require("@discordjs/util");
3332
- var version = "2.5.0";
3420
+ var version = "2.7.0";
3333
3421
  // Annotate the CommonJS export names for ESM import in node:
3334
3422
  0 && (module.exports = {
3335
3423
  API,