@discordjs/builders 1.12.0 → 1.12.2

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
@@ -1767,7 +1767,7 @@ declare class ModalBuilder implements JSONEncodable<APIModalInteractionResponseC
1767
1767
  /**
1768
1768
  * The components within this modal.
1769
1769
  */
1770
- readonly components: (ActionRowBuilder<ModalActionRowComponentBuilder> | LabelBuilder)[];
1770
+ readonly components: (ActionRowBuilder<ModalActionRowComponentBuilder> | LabelBuilder | TextDisplayBuilder)[];
1771
1771
  /**
1772
1772
  * Creates a new modal from API data.
1773
1773
  *
@@ -1790,15 +1790,21 @@ declare class ModalBuilder implements JSONEncodable<APIModalInteractionResponseC
1790
1790
  * Adds components to this modal.
1791
1791
  *
1792
1792
  * @param components - The components to add
1793
- * @deprecated Use {@link ModalBuilder.addLabelComponents} or {@link ModalBuilder.addActionRowComponents} instead
1793
+ * @deprecated Use {@link ModalBuilder.addLabelComponents} or {@link ModalBuilder.addTextDisplayComponents} instead
1794
1794
  */
1795
- addComponents(...components: RestOrArray<ActionRowBuilder<ModalActionRowComponentBuilder> | APIActionRowComponent<APIComponentInModalActionRow> | APILabelComponent | APITextInputComponent | LabelBuilder | TextInputBuilder>): this;
1795
+ addComponents(...components: RestOrArray<ActionRowBuilder<ModalActionRowComponentBuilder> | APIActionRowComponent<APIComponentInModalActionRow> | APILabelComponent | APITextDisplayComponent | APITextInputComponent | LabelBuilder | TextDisplayBuilder | TextInputBuilder>): this;
1796
1796
  /**
1797
1797
  * Adds label components to this modal.
1798
1798
  *
1799
1799
  * @param components - The components to add
1800
1800
  */
1801
1801
  addLabelComponents(...components: RestOrArray<APILabelComponent | LabelBuilder | ((builder: LabelBuilder) => LabelBuilder)>): this;
1802
+ /**
1803
+ * Adds text display components to this modal.
1804
+ *
1805
+ * @param components - The components to add
1806
+ */
1807
+ addTextDisplayComponents(...components: RestOrArray<APITextDisplayComponent | TextDisplayBuilder | ((builder: TextDisplayBuilder) => TextDisplayBuilder)>): this;
1802
1808
  /**
1803
1809
  * Adds action rows to this modal.
1804
1810
  *
@@ -1848,7 +1854,7 @@ declare class ModalBuilder implements JSONEncodable<APIModalInteractionResponseC
1848
1854
  * @param components - The components to set
1849
1855
  * @deprecated Use {@link ModalBuilder.setLabelComponents} instead
1850
1856
  */
1851
- setComponents(...components: RestOrArray<ActionRowBuilder<ModalActionRowComponentBuilder> | LabelBuilder>): this;
1857
+ setComponents(...components: RestOrArray<ActionRowBuilder<ModalActionRowComponentBuilder> | LabelBuilder | TextDisplayBuilder>): this;
1852
1858
  /**
1853
1859
  * {@inheritDoc ComponentBuilder.toJSON}
1854
1860
  */
@@ -1856,8 +1862,8 @@ declare class ModalBuilder implements JSONEncodable<APIModalInteractionResponseC
1856
1862
  }
1857
1863
 
1858
1864
  declare const titleValidator: _sapphire_shapeshift.StringValidator<string>;
1859
- declare const componentsValidator: _sapphire_shapeshift.ArrayValidator<[LabelBuilder | ActionRowBuilder<AnyComponentBuilder>, ...(LabelBuilder | ActionRowBuilder<AnyComponentBuilder>)[]], LabelBuilder | ActionRowBuilder<AnyComponentBuilder>>;
1860
- declare function validateRequiredParameters$2(customId?: string, title?: string, components?: (ActionRowBuilder<ModalActionRowComponentBuilder> | LabelBuilder)[]): void;
1865
+ declare const componentsValidator: _sapphire_shapeshift.ArrayValidator<[LabelBuilder | ActionRowBuilder<AnyComponentBuilder> | TextDisplayBuilder, ...(LabelBuilder | ActionRowBuilder<AnyComponentBuilder> | TextDisplayBuilder)[]], LabelBuilder | ActionRowBuilder<AnyComponentBuilder> | TextDisplayBuilder>;
1866
+ declare function validateRequiredParameters$2(customId?: string, title?: string, components?: (ActionRowBuilder<ModalActionRowComponentBuilder> | LabelBuilder | TextDisplayBuilder)[]): void;
1861
1867
 
1862
1868
  declare const Assertions$4_componentsValidator: typeof componentsValidator;
1863
1869
  declare const Assertions$4_titleValidator: typeof titleValidator;
@@ -1897,16 +1903,6 @@ declare const labelPredicate: _sapphire_shapeshift.ObjectValidator<{
1897
1903
  max_values: any;
1898
1904
  custom_id: any;
1899
1905
  disabled: any;
1900
- } & {
1901
- type: any;
1902
- default_values: any;
1903
- }> | _sapphire_shapeshift.UndefinedToOptional<{
1904
- id: any;
1905
- placeholder: any;
1906
- min_values: any;
1907
- max_values: any;
1908
- custom_id: any;
1909
- disabled: any;
1910
1906
  } & {
1911
1907
  type: any;
1912
1908
  options: any;
@@ -1943,16 +1939,6 @@ declare const labelPredicate: _sapphire_shapeshift.ObjectValidator<{
1943
1939
  max_values: any;
1944
1940
  custom_id: any;
1945
1941
  disabled: any;
1946
- } & {
1947
- type: any;
1948
- default_values: any;
1949
- }> | _sapphire_shapeshift.UndefinedToOptional<{
1950
- id: any;
1951
- placeholder: any;
1952
- min_values: any;
1953
- max_values: any;
1954
- custom_id: any;
1955
- disabled: any;
1956
1942
  } & {
1957
1943
  type: any;
1958
1944
  options: any;
package/dist/index.d.ts CHANGED
@@ -1767,7 +1767,7 @@ declare class ModalBuilder implements JSONEncodable<APIModalInteractionResponseC
1767
1767
  /**
1768
1768
  * The components within this modal.
1769
1769
  */
1770
- readonly components: (ActionRowBuilder<ModalActionRowComponentBuilder> | LabelBuilder)[];
1770
+ readonly components: (ActionRowBuilder<ModalActionRowComponentBuilder> | LabelBuilder | TextDisplayBuilder)[];
1771
1771
  /**
1772
1772
  * Creates a new modal from API data.
1773
1773
  *
@@ -1790,15 +1790,21 @@ declare class ModalBuilder implements JSONEncodable<APIModalInteractionResponseC
1790
1790
  * Adds components to this modal.
1791
1791
  *
1792
1792
  * @param components - The components to add
1793
- * @deprecated Use {@link ModalBuilder.addLabelComponents} or {@link ModalBuilder.addActionRowComponents} instead
1793
+ * @deprecated Use {@link ModalBuilder.addLabelComponents} or {@link ModalBuilder.addTextDisplayComponents} instead
1794
1794
  */
1795
- addComponents(...components: RestOrArray<ActionRowBuilder<ModalActionRowComponentBuilder> | APIActionRowComponent<APIComponentInModalActionRow> | APILabelComponent | APITextInputComponent | LabelBuilder | TextInputBuilder>): this;
1795
+ addComponents(...components: RestOrArray<ActionRowBuilder<ModalActionRowComponentBuilder> | APIActionRowComponent<APIComponentInModalActionRow> | APILabelComponent | APITextDisplayComponent | APITextInputComponent | LabelBuilder | TextDisplayBuilder | TextInputBuilder>): this;
1796
1796
  /**
1797
1797
  * Adds label components to this modal.
1798
1798
  *
1799
1799
  * @param components - The components to add
1800
1800
  */
1801
1801
  addLabelComponents(...components: RestOrArray<APILabelComponent | LabelBuilder | ((builder: LabelBuilder) => LabelBuilder)>): this;
1802
+ /**
1803
+ * Adds text display components to this modal.
1804
+ *
1805
+ * @param components - The components to add
1806
+ */
1807
+ addTextDisplayComponents(...components: RestOrArray<APITextDisplayComponent | TextDisplayBuilder | ((builder: TextDisplayBuilder) => TextDisplayBuilder)>): this;
1802
1808
  /**
1803
1809
  * Adds action rows to this modal.
1804
1810
  *
@@ -1848,7 +1854,7 @@ declare class ModalBuilder implements JSONEncodable<APIModalInteractionResponseC
1848
1854
  * @param components - The components to set
1849
1855
  * @deprecated Use {@link ModalBuilder.setLabelComponents} instead
1850
1856
  */
1851
- setComponents(...components: RestOrArray<ActionRowBuilder<ModalActionRowComponentBuilder> | LabelBuilder>): this;
1857
+ setComponents(...components: RestOrArray<ActionRowBuilder<ModalActionRowComponentBuilder> | LabelBuilder | TextDisplayBuilder>): this;
1852
1858
  /**
1853
1859
  * {@inheritDoc ComponentBuilder.toJSON}
1854
1860
  */
@@ -1856,8 +1862,8 @@ declare class ModalBuilder implements JSONEncodable<APIModalInteractionResponseC
1856
1862
  }
1857
1863
 
1858
1864
  declare const titleValidator: _sapphire_shapeshift.StringValidator<string>;
1859
- declare const componentsValidator: _sapphire_shapeshift.ArrayValidator<[LabelBuilder | ActionRowBuilder<AnyComponentBuilder>, ...(LabelBuilder | ActionRowBuilder<AnyComponentBuilder>)[]], LabelBuilder | ActionRowBuilder<AnyComponentBuilder>>;
1860
- declare function validateRequiredParameters$2(customId?: string, title?: string, components?: (ActionRowBuilder<ModalActionRowComponentBuilder> | LabelBuilder)[]): void;
1865
+ declare const componentsValidator: _sapphire_shapeshift.ArrayValidator<[LabelBuilder | ActionRowBuilder<AnyComponentBuilder> | TextDisplayBuilder, ...(LabelBuilder | ActionRowBuilder<AnyComponentBuilder> | TextDisplayBuilder)[]], LabelBuilder | ActionRowBuilder<AnyComponentBuilder> | TextDisplayBuilder>;
1866
+ declare function validateRequiredParameters$2(customId?: string, title?: string, components?: (ActionRowBuilder<ModalActionRowComponentBuilder> | LabelBuilder | TextDisplayBuilder)[]): void;
1861
1867
 
1862
1868
  declare const Assertions$4_componentsValidator: typeof componentsValidator;
1863
1869
  declare const Assertions$4_titleValidator: typeof titleValidator;
@@ -1897,16 +1903,6 @@ declare const labelPredicate: _sapphire_shapeshift.ObjectValidator<{
1897
1903
  max_values: any;
1898
1904
  custom_id: any;
1899
1905
  disabled: any;
1900
- } & {
1901
- type: any;
1902
- default_values: any;
1903
- }> | _sapphire_shapeshift.UndefinedToOptional<{
1904
- id: any;
1905
- placeholder: any;
1906
- min_values: any;
1907
- max_values: any;
1908
- custom_id: any;
1909
- disabled: any;
1910
1906
  } & {
1911
1907
  type: any;
1912
1908
  options: any;
@@ -1943,16 +1939,6 @@ declare const labelPredicate: _sapphire_shapeshift.ObjectValidator<{
1943
1939
  max_values: any;
1944
1940
  custom_id: any;
1945
1941
  disabled: any;
1946
- } & {
1947
- type: any;
1948
- default_values: any;
1949
- }> | _sapphire_shapeshift.UndefinedToOptional<{
1950
- id: any;
1951
- placeholder: any;
1952
- min_values: any;
1953
- max_values: any;
1954
- custom_id: any;
1955
- disabled: any;
1956
1942
  } & {
1957
1943
  type: any;
1958
1944
  options: any;
package/dist/index.js CHANGED
@@ -1458,7 +1458,7 @@ var selectMenuMentionablePredicate = selectMenuBasePredicate.extend({
1458
1458
  type: import_shapeshift4.s.literal(import_v1010.ComponentType.MentionableSelect),
1459
1459
  default_values: import_shapeshift4.s.object({
1460
1460
  id: import_shapeshift4.s.string(),
1461
- type: import_shapeshift4.s.literal([import_v1010.SelectMenuDefaultValueType.Role, import_v1010.SelectMenuDefaultValueType.User])
1461
+ type: import_shapeshift4.s.union([import_shapeshift4.s.literal(import_v1010.SelectMenuDefaultValueType.Role), import_shapeshift4.s.literal(import_v1010.SelectMenuDefaultValueType.User)])
1462
1462
  }).array().lengthLessThanOrEqual(25).optional()
1463
1463
  }).setValidationEnabled(isValidationEnabled);
1464
1464
  var selectMenuRolePredicate = selectMenuBasePredicate.extend({
@@ -2552,7 +2552,7 @@ __export(Assertions_exports6, {
2552
2552
  });
2553
2553
  var import_shapeshift7 = require("@sapphire/shapeshift");
2554
2554
  var titleValidator = import_shapeshift7.s.string().lengthGreaterThanOrEqual(1).lengthLessThanOrEqual(45).setValidationEnabled(isValidationEnabled);
2555
- var componentsValidator = import_shapeshift7.s.union([import_shapeshift7.s.instance(ActionRowBuilder), import_shapeshift7.s.instance(LabelBuilder)]).array().lengthGreaterThanOrEqual(1).setValidationEnabled(isValidationEnabled);
2555
+ var componentsValidator = import_shapeshift7.s.union([import_shapeshift7.s.instance(ActionRowBuilder), import_shapeshift7.s.instance(LabelBuilder), import_shapeshift7.s.instance(TextDisplayBuilder)]).array().lengthGreaterThanOrEqual(1).setValidationEnabled(isValidationEnabled);
2556
2556
  function validateRequiredParameters2(customId, title, components) {
2557
2557
  customIdValidator.parse(customId);
2558
2558
  titleValidator.parse(title);
@@ -2604,12 +2604,12 @@ var ModalBuilder = class {
2604
2604
  * Adds components to this modal.
2605
2605
  *
2606
2606
  * @param components - The components to add
2607
- * @deprecated Use {@link ModalBuilder.addLabelComponents} or {@link ModalBuilder.addActionRowComponents} instead
2607
+ * @deprecated Use {@link ModalBuilder.addLabelComponents} or {@link ModalBuilder.addTextDisplayComponents} instead
2608
2608
  */
2609
2609
  addComponents(...components) {
2610
2610
  this.components.push(
2611
2611
  ...normalizeArray(components).map((component, idx) => {
2612
- if (component instanceof ActionRowBuilder || component instanceof LabelBuilder) {
2612
+ if (component instanceof ActionRowBuilder || component instanceof LabelBuilder || component instanceof TextDisplayBuilder) {
2613
2613
  return component;
2614
2614
  }
2615
2615
  if (component instanceof TextInputBuilder) {
@@ -2622,6 +2622,9 @@ var ModalBuilder = class {
2622
2622
  if (component.type === import_v1023.ComponentType.Label) {
2623
2623
  return new LabelBuilder(component);
2624
2624
  }
2625
+ if (component.type === import_v1023.ComponentType.TextDisplay) {
2626
+ return new TextDisplayBuilder(component);
2627
+ }
2625
2628
  if (component.type === import_v1023.ComponentType.TextInput) {
2626
2629
  return new ActionRowBuilder().addComponents(
2627
2630
  new TextInputBuilder(component)
@@ -2644,6 +2647,17 @@ var ModalBuilder = class {
2644
2647
  this.components.push(...resolved);
2645
2648
  return this;
2646
2649
  }
2650
+ /**
2651
+ * Adds text display components to this modal.
2652
+ *
2653
+ * @param components - The components to add
2654
+ */
2655
+ addTextDisplayComponents(...components) {
2656
+ const normalized = normalizeArray(components);
2657
+ const resolved = normalized.map((row) => resolveBuilder(row, TextDisplayBuilder));
2658
+ this.components.push(...resolved);
2659
+ return this;
2660
+ }
2647
2661
  /**
2648
2662
  * Adds action rows to this modal.
2649
2663
  *
@@ -4008,7 +4022,7 @@ function embedLength(data) {
4008
4022
  __name(embedLength, "embedLength");
4009
4023
 
4010
4024
  // src/index.ts
4011
- var version = "1.12.0";
4025
+ var version = "1.12.2";
4012
4026
  // Annotate the CommonJS export names for ESM import in node:
4013
4027
  0 && (module.exports = {
4014
4028
  ActionRowBuilder,