@discordjs/core 2.6.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
@@ -22,8 +22,9 @@ var ApplicationCommandsAPI = class {
22
22
  * @param query - The query options for fetching commands
23
23
  * @param options - The options for fetching commands
24
24
  */
25
- async getGlobalCommands(applicationId, query = {}, { signal } = {}) {
25
+ async getGlobalCommands(applicationId, query = {}, { locale, signal } = {}) {
26
26
  return this.rest.get(Routes.applicationCommands(applicationId), {
27
+ headers: locale ? { "X-Discord-Locale": locale } : {},
27
28
  query: makeURLSearchParams(query),
28
29
  signal
29
30
  });
@@ -104,8 +105,9 @@ var ApplicationCommandsAPI = class {
104
105
  * @param query - The data for fetching commands
105
106
  * @param options - The options for fetching commands
106
107
  */
107
- async getGuildCommands(applicationId, guildId, query = {}, { signal } = {}) {
108
+ async getGuildCommands(applicationId, guildId, query = {}, { locale, signal } = {}) {
108
109
  return this.rest.get(Routes.applicationGuildCommands(applicationId, guildId), {
110
+ headers: locale ? { "X-Discord-Locale": locale } : {},
109
111
  query: makeURLSearchParams(query),
110
112
  signal
111
113
  });
@@ -630,10 +632,11 @@ var ChannelsAPI = class {
630
632
  * @param body - The data for creating the invite
631
633
  * @param options - The options for creating the invite
632
634
  */
633
- async createInvite(channelId, body, { reason, signal } = {}) {
635
+ async createInvite(channelId, { targetUsersFile, ...body }, { reason, signal } = {}) {
634
636
  return this.rest.post(Routes3.channelInvites(channelId), {
635
637
  reason,
636
638
  body,
639
+ files: targetUsersFile ? [{ key: "target_users_file", contentType: "text/csv", ...targetUsersFile }] : [],
637
640
  signal
638
641
  });
639
642
  }
@@ -2184,7 +2187,7 @@ var InvitesAPI = class {
2184
2187
  /**
2185
2188
  * Fetches an invite
2186
2189
  *
2187
- * @see {@link https://discord.com/developers/docs/resources/invite#get-invite}
2190
+ * @see {@link https://docs.discord.com/developers/resources/invite#get-invite}
2188
2191
  * @param code - The invite code
2189
2192
  * @param query - The options for fetching the invite
2190
2193
  * @param options - The options for fetching the invite
@@ -2198,13 +2201,53 @@ var InvitesAPI = class {
2198
2201
  /**
2199
2202
  * Deletes an invite
2200
2203
  *
2201
- * @see {@link https://discord.com/developers/docs/resources/invite#delete-invite}
2204
+ * @see {@link https://docs.discord.com/developers/resources/invite#delete-invite}
2202
2205
  * @param code - The invite code
2203
2206
  * @param options - The options for deleting the invite
2204
2207
  */
2205
2208
  async delete(code, { reason, signal } = {}) {
2206
2209
  return this.rest.delete(Routes8.invite(code), { reason, signal });
2207
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
+ }
2208
2251
  };
2209
2252
 
2210
2253
  // src/api/monetization.ts
@@ -3364,7 +3407,7 @@ __name(withFiles, "withFiles");
3364
3407
  // src/index.ts
3365
3408
  export * from "discord-api-types/v10";
3366
3409
  import { GatewayRateLimitError as GatewayRateLimitError2 } from "@discordjs/util";
3367
- var version = "2.6.0";
3410
+ var version = "2.7.0";
3368
3411
  export {
3369
3412
  API,
3370
3413
  ApplicationCommandsAPI,