@discordjs/builders 1.8.0-dev.1710979856-6cc5fa28e → 1.8.0-dev.1711930261-980a2b71c

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.d.mts CHANGED
@@ -1294,7 +1294,7 @@ declare class ApplicationCommandOptionChannelTypesMixin {
1294
1294
  *
1295
1295
  * @param channelTypes - The channel types
1296
1296
  */
1297
- addChannelTypes(...channelTypes: ApplicationCommandOptionAllowedChannelTypes[]): this;
1297
+ addChannelTypes(...channelTypes: RestOrArray<ApplicationCommandOptionAllowedChannelTypes>): this;
1298
1298
  }
1299
1299
 
1300
1300
  /**
@@ -1380,13 +1380,13 @@ declare class ApplicationCommandOptionWithChoicesMixin<ChoiceType extends number
1380
1380
  *
1381
1381
  * @param choices - The choices to add
1382
1382
  */
1383
- addChoices(...choices: APIApplicationCommandOptionChoice<ChoiceType>[]): this;
1383
+ addChoices(...choices: RestOrArray<APIApplicationCommandOptionChoice<ChoiceType>>): this;
1384
1384
  /**
1385
1385
  * Sets multiple choices for this option.
1386
1386
  *
1387
1387
  * @param choices - The choices to set
1388
1388
  */
1389
- setChoices<Input extends APIApplicationCommandOptionChoice<ChoiceType>[]>(...choices: Input): this;
1389
+ setChoices<Input extends APIApplicationCommandOptionChoice<ChoiceType>>(...choices: RestOrArray<Input>): this;
1390
1390
  }
1391
1391
 
1392
1392
  /**
package/dist/index.d.ts CHANGED
@@ -1294,7 +1294,7 @@ declare class ApplicationCommandOptionChannelTypesMixin {
1294
1294
  *
1295
1295
  * @param channelTypes - The channel types
1296
1296
  */
1297
- addChannelTypes(...channelTypes: ApplicationCommandOptionAllowedChannelTypes[]): this;
1297
+ addChannelTypes(...channelTypes: RestOrArray<ApplicationCommandOptionAllowedChannelTypes>): this;
1298
1298
  }
1299
1299
 
1300
1300
  /**
@@ -1380,13 +1380,13 @@ declare class ApplicationCommandOptionWithChoicesMixin<ChoiceType extends number
1380
1380
  *
1381
1381
  * @param choices - The choices to add
1382
1382
  */
1383
- addChoices(...choices: APIApplicationCommandOptionChoice<ChoiceType>[]): this;
1383
+ addChoices(...choices: RestOrArray<APIApplicationCommandOptionChoice<ChoiceType>>): this;
1384
1384
  /**
1385
1385
  * Sets multiple choices for this option.
1386
1386
  *
1387
1387
  * @param choices - The choices to set
1388
1388
  */
1389
- setChoices<Input extends APIApplicationCommandOptionChoice<ChoiceType>[]>(...choices: Input): this;
1389
+ setChoices<Input extends APIApplicationCommandOptionChoice<ChoiceType>>(...choices: RestOrArray<Input>): this;
1390
1390
  }
1391
1391
 
1392
1392
  /**
package/dist/index.js CHANGED
@@ -1868,7 +1868,7 @@ var ApplicationCommandOptionChannelTypesMixin = class {
1868
1868
  if (this.channel_types === void 0) {
1869
1869
  Reflect.set(this, "channel_types", []);
1870
1870
  }
1871
- this.channel_types.push(...channelTypesPredicate.parse(channelTypes));
1871
+ this.channel_types.push(...channelTypesPredicate.parse(normalizeArray(channelTypes)));
1872
1872
  return this;
1873
1873
  }
1874
1874
  };
@@ -1974,15 +1974,16 @@ var ApplicationCommandOptionWithChoicesMixin = class {
1974
1974
  * @param choices - The choices to add
1975
1975
  */
1976
1976
  addChoices(...choices) {
1977
- if (choices.length > 0 && "autocomplete" in this && this.autocomplete) {
1977
+ const normalizedChoices = normalizeArray(choices);
1978
+ if (normalizedChoices.length > 0 && "autocomplete" in this && this.autocomplete) {
1978
1979
  throw new RangeError("Autocomplete and choices are mutually exclusive to each other.");
1979
1980
  }
1980
- choicesPredicate.parse(choices);
1981
+ choicesPredicate.parse(normalizedChoices);
1981
1982
  if (this.choices === void 0) {
1982
1983
  Reflect.set(this, "choices", []);
1983
1984
  }
1984
- validateChoicesLength(choices.length, this.choices);
1985
- for (const { name, name_localizations, value } of choices) {
1985
+ validateChoicesLength(normalizedChoices.length, this.choices);
1986
+ for (const { name, name_localizations, value } of normalizedChoices) {
1986
1987
  if (this.type === import_v1017.ApplicationCommandOptionType.String) {
1987
1988
  stringPredicate.parse(value);
1988
1989
  } else {
@@ -1998,12 +1999,13 @@ var ApplicationCommandOptionWithChoicesMixin = class {
1998
1999
  * @param choices - The choices to set
1999
2000
  */
2000
2001
  setChoices(...choices) {
2001
- if (choices.length > 0 && "autocomplete" in this && this.autocomplete) {
2002
+ const normalizedChoices = normalizeArray(choices);
2003
+ if (normalizedChoices.length > 0 && "autocomplete" in this && this.autocomplete) {
2002
2004
  throw new RangeError("Autocomplete and choices are mutually exclusive to each other.");
2003
2005
  }
2004
- choicesPredicate.parse(choices);
2006
+ choicesPredicate.parse(normalizedChoices);
2005
2007
  Reflect.set(this, "choices", []);
2006
- this.addChoices(...choices);
2008
+ this.addChoices(normalizedChoices);
2007
2009
  return this;
2008
2010
  }
2009
2011
  };
@@ -2742,7 +2744,7 @@ function embedLength(data) {
2742
2744
  __name(embedLength, "embedLength");
2743
2745
 
2744
2746
  // src/index.ts
2745
- var version = "1.8.0-dev.1710979856-6cc5fa28e";
2747
+ var version = "1.8.0-dev.1711930261-980a2b71c";
2746
2748
  // Annotate the CommonJS export names for ESM import in node:
2747
2749
  0 && (module.exports = {
2748
2750
  ActionRowBuilder,