@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/http-only.js CHANGED
@@ -53,6 +53,7 @@ var ApplicationCommandsAPI = class {
53
53
  constructor(rest) {
54
54
  this.rest = rest;
55
55
  }
56
+ rest;
56
57
  static {
57
58
  __name(this, "ApplicationCommandsAPI");
58
59
  }
@@ -64,8 +65,9 @@ var ApplicationCommandsAPI = class {
64
65
  * @param query - The query options for fetching commands
65
66
  * @param options - The options for fetching commands
66
67
  */
67
- async getGlobalCommands(applicationId, query = {}, { signal } = {}) {
68
+ async getGlobalCommands(applicationId, query = {}, { locale, signal } = {}) {
68
69
  return this.rest.get(import_v10.Routes.applicationCommands(applicationId), {
70
+ headers: locale ? { "X-Discord-Locale": locale } : {},
69
71
  query: (0, import_rest.makeURLSearchParams)(query),
70
72
  signal
71
73
  });
@@ -146,8 +148,9 @@ var ApplicationCommandsAPI = class {
146
148
  * @param query - The data for fetching commands
147
149
  * @param options - The options for fetching commands
148
150
  */
149
- async getGuildCommands(applicationId, guildId, query = {}, { signal } = {}) {
151
+ async getGuildCommands(applicationId, guildId, query = {}, { locale, signal } = {}) {
150
152
  return this.rest.get(import_v10.Routes.applicationGuildCommands(applicationId, guildId), {
153
+ headers: locale ? { "X-Discord-Locale": locale } : {},
151
154
  query: (0, import_rest.makeURLSearchParams)(query),
152
155
  signal
153
156
  });
@@ -278,6 +281,7 @@ var ApplicationsAPI = class {
278
281
  constructor(rest) {
279
282
  this.rest = rest;
280
283
  }
284
+ rest;
281
285
  static {
282
286
  __name(this, "ApplicationsAPI");
283
287
  }
@@ -368,6 +372,19 @@ var ApplicationsAPI = class {
368
372
  async deleteEmoji(applicationId, emojiId, { signal } = {}) {
369
373
  await this.rest.delete(import_v102.Routes.applicationEmoji(applicationId, emojiId), { signal });
370
374
  }
375
+ /**
376
+ * Fetches an activity instance of an application
377
+ *
378
+ * @see {@link https://docs.discord.com/developers/resources/application#get-application-activity-instance}
379
+ * @param applicationId - The id of the application to fetch the activity instance of
380
+ * @param instanceId - The id of the activity instance to fetch
381
+ * @param options - The options for fetching the activity instance
382
+ */
383
+ async getActivityInstance(applicationId, instanceId, { signal } = {}) {
384
+ return this.rest.get(import_v102.Routes.applicationActivityInstance(applicationId, instanceId), {
385
+ signal
386
+ });
387
+ }
371
388
  };
372
389
 
373
390
  // src/api/channel.ts
@@ -377,6 +394,7 @@ var ChannelsAPI = class {
377
394
  constructor(rest) {
378
395
  this.rest = rest;
379
396
  }
397
+ rest;
380
398
  static {
381
399
  __name(this, "ChannelsAPI");
382
400
  }
@@ -653,10 +671,11 @@ var ChannelsAPI = class {
653
671
  * @param body - The data for creating the invite
654
672
  * @param options - The options for creating the invite
655
673
  */
656
- async createInvite(channelId, body, { reason, signal } = {}) {
674
+ async createInvite(channelId, { targetUsersFile, ...body }, { reason, signal } = {}) {
657
675
  return this.rest.post(import_v103.Routes.channelInvites(channelId), {
658
676
  reason,
659
677
  body,
678
+ files: targetUsersFile ? [{ key: "target_users_file", contentType: "text/csv", ...targetUsersFile }] : [],
660
679
  signal
661
680
  });
662
681
  }
@@ -801,7 +820,7 @@ var ChannelsAPI = class {
801
820
  * @param options - The options for sending the soundboard sound
802
821
  */
803
822
  async sendSoundboardSound(channelId, body, { signal } = {}) {
804
- return this.rest.post(import_v103.Routes.sendSoundboardSound(channelId), {
823
+ await this.rest.post(import_v103.Routes.sendSoundboardSound(channelId), {
805
824
  body,
806
825
  signal
807
826
  });
@@ -842,6 +861,7 @@ var GatewayAPI = class {
842
861
  constructor(rest) {
843
862
  this.rest = rest;
844
863
  }
864
+ rest;
845
865
  static {
846
866
  __name(this, "GatewayAPI");
847
867
  }
@@ -878,6 +898,7 @@ var VoiceAPI = class {
878
898
  constructor(rest) {
879
899
  this.rest = rest;
880
900
  }
901
+ rest;
881
902
  static {
882
903
  __name(this, "VoiceAPI");
883
904
  }
@@ -949,6 +970,7 @@ var GuildsAPI = class {
949
970
  constructor(rest) {
950
971
  this.rest = rest;
951
972
  }
973
+ rest;
952
974
  static {
953
975
  __name(this, "GuildsAPI");
954
976
  }
@@ -1992,6 +2014,18 @@ var GuildsAPI = class {
1992
2014
  signal
1993
2015
  });
1994
2016
  }
2017
+ /**
2018
+ * Fetches role member counts for a guild.
2019
+ *
2020
+ * @see {@link https://docs.discord.com/developers/resources/guild#get-guild-role-member-counts}
2021
+ * @param guildId - The id of the guild to fetch role member counts for
2022
+ * @param options - The options for fetching role member counts
2023
+ */
2024
+ async getRoleMemberCounts(guildId, { signal } = {}) {
2025
+ return this.rest.get(import_v106.Routes.guildRoleMemberCounts(guildId), {
2026
+ signal
2027
+ });
2028
+ }
1995
2029
  };
1996
2030
 
1997
2031
  // src/api/interactions.ts
@@ -2002,6 +2036,8 @@ var InteractionsAPI = class {
2002
2036
  this.rest = rest;
2003
2037
  this.webhooks = webhooks;
2004
2038
  }
2039
+ rest;
2040
+ webhooks;
2005
2041
  static {
2006
2042
  __name(this, "InteractionsAPI");
2007
2043
  }
@@ -2174,13 +2210,14 @@ var InvitesAPI = class {
2174
2210
  constructor(rest) {
2175
2211
  this.rest = rest;
2176
2212
  }
2213
+ rest;
2177
2214
  static {
2178
2215
  __name(this, "InvitesAPI");
2179
2216
  }
2180
2217
  /**
2181
2218
  * Fetches an invite
2182
2219
  *
2183
- * @see {@link https://discord.com/developers/docs/resources/invite#get-invite}
2220
+ * @see {@link https://docs.discord.com/developers/resources/invite#get-invite}
2184
2221
  * @param code - The invite code
2185
2222
  * @param query - The options for fetching the invite
2186
2223
  * @param options - The options for fetching the invite
@@ -2194,13 +2231,53 @@ var InvitesAPI = class {
2194
2231
  /**
2195
2232
  * Deletes an invite
2196
2233
  *
2197
- * @see {@link https://discord.com/developers/docs/resources/invite#delete-invite}
2234
+ * @see {@link https://docs.discord.com/developers/resources/invite#delete-invite}
2198
2235
  * @param code - The invite code
2199
2236
  * @param options - The options for deleting the invite
2200
2237
  */
2201
2238
  async delete(code, { reason, signal } = {}) {
2202
2239
  return this.rest.delete(import_v108.Routes.invite(code), { reason, signal });
2203
2240
  }
2241
+ /**
2242
+ * Fetches an invite's target users
2243
+ *
2244
+ * @see {@link https://docs.discord.com/developers/resources/invite#get-target-users}
2245
+ * @param code - The invite code
2246
+ * @param options - The options for fetching the invite target users
2247
+ * @returns
2248
+ */
2249
+ async getTargetUsers(code, { signal } = {}) {
2250
+ return this.rest.get(import_v108.Routes.inviteTargetUsers(code), { signal });
2251
+ }
2252
+ /**
2253
+ * Updates an invite's target users
2254
+ *
2255
+ * @see {@link https://docs.discord.com/developers/resources/invite#update-target-users}
2256
+ * @param code - The invite code
2257
+ * @param targetUsersFile - A CSV file with a single column of user ids
2258
+ * for all the users able to accept this invite
2259
+ * @param options - The options for updating the invite target users
2260
+ * @returns
2261
+ */
2262
+ async updateTargetUsers(code, targetUsersFile, { signal } = {}) {
2263
+ return this.rest.put(import_v108.Routes.inviteTargetUsers(code), {
2264
+ files: [{ key: "target_users_file", contentType: "text/csv", ...targetUsersFile }],
2265
+ signal
2266
+ });
2267
+ }
2268
+ /**
2269
+ * Fetches an invite's target users job status
2270
+ *
2271
+ * @see {@link https://docs.discord.com/developers/resources/invite#get-target-users-job-status}
2272
+ * @param code - The invite code
2273
+ * @param options - The options for fetching the invite target users job status
2274
+ * @returns
2275
+ */
2276
+ async getTargetUsersJobStatus(code, { signal } = {}) {
2277
+ return this.rest.get(import_v108.Routes.inviteTargetUsersJobStatus(code), {
2278
+ signal
2279
+ });
2280
+ }
2204
2281
  };
2205
2282
 
2206
2283
  // src/api/monetization.ts
@@ -2210,6 +2287,7 @@ var MonetizationAPI = class {
2210
2287
  constructor(rest) {
2211
2288
  this.rest = rest;
2212
2289
  }
2290
+ rest;
2213
2291
  static {
2214
2292
  __name(this, "MonetizationAPI");
2215
2293
  }
@@ -2322,6 +2400,7 @@ var OAuth2API = class {
2322
2400
  constructor(rest) {
2323
2401
  this.rest = rest;
2324
2402
  }
2403
+ rest;
2325
2404
  static {
2326
2405
  __name(this, "OAuth2API");
2327
2406
  }
@@ -2444,6 +2523,7 @@ var PollAPI = class {
2444
2523
  constructor(rest) {
2445
2524
  this.rest = rest;
2446
2525
  }
2526
+ rest;
2447
2527
  static {
2448
2528
  __name(this, "PollAPI");
2449
2529
  }
@@ -2484,6 +2564,7 @@ var RoleConnectionsAPI = class {
2484
2564
  constructor(rest) {
2485
2565
  this.rest = rest;
2486
2566
  }
2567
+ rest;
2487
2568
  static {
2488
2569
  __name(this, "RoleConnectionsAPI");
2489
2570
  }
@@ -2521,6 +2602,7 @@ var SoundboardSoundsAPI = class {
2521
2602
  constructor(rest) {
2522
2603
  this.rest = rest;
2523
2604
  }
2605
+ rest;
2524
2606
  static {
2525
2607
  __name(this, "SoundboardSoundsAPI");
2526
2608
  }
@@ -2543,6 +2625,7 @@ var StageInstancesAPI = class {
2543
2625
  constructor(rest) {
2544
2626
  this.rest = rest;
2545
2627
  }
2628
+ rest;
2546
2629
  static {
2547
2630
  __name(this, "StageInstancesAPI");
2548
2631
  }
@@ -2603,6 +2686,7 @@ var StickersAPI = class {
2603
2686
  constructor(rest) {
2604
2687
  this.rest = rest;
2605
2688
  }
2689
+ rest;
2606
2690
  static {
2607
2691
  __name(this, "StickersAPI");
2608
2692
  }
@@ -2653,6 +2737,7 @@ var ThreadsAPI = class {
2653
2737
  constructor(rest) {
2654
2738
  this.rest = rest;
2655
2739
  }
2740
+ rest;
2656
2741
  static {
2657
2742
  __name(this, "ThreadsAPI");
2658
2743
  }
@@ -2728,6 +2813,7 @@ var UsersAPI = class {
2728
2813
  constructor(rest) {
2729
2814
  this.rest = rest;
2730
2815
  }
2816
+ rest;
2731
2817
  static {
2732
2818
  __name(this, "UsersAPI");
2733
2819
  }
@@ -2865,6 +2951,7 @@ var WebhooksAPI = class {
2865
2951
  constructor(rest) {
2866
2952
  this.rest = rest;
2867
2953
  }
2954
+ rest;
2868
2955
  static {
2869
2956
  __name(this, "WebhooksAPI");
2870
2957
  }
@@ -3047,6 +3134,7 @@ var API = class {
3047
3134
  this.webhooks = new WebhooksAPI(rest);
3048
3135
  this.interactions = new InteractionsAPI(rest, this.webhooks);
3049
3136
  }
3137
+ rest;
3050
3138
  static {
3051
3139
  __name(this, "API");
3052
3140
  }
@@ -3089,7 +3177,7 @@ __name(withFiles, "withFiles");
3089
3177
 
3090
3178
  // src/http-only/index.ts
3091
3179
  __reExport(http_only_exports, require("discord-api-types/v10"), module.exports);
3092
- var version = "2.5.0";
3180
+ var version = "2.7.0";
3093
3181
  // Annotate the CommonJS export names for ESM import in node:
3094
3182
  0 && (module.exports = {
3095
3183
  API,