@discordjs/builders 1.2.1-dev.1663546265-6d43e26.0 → 1.2.1-dev.1663589061-145eb2f.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.d.ts CHANGED
@@ -539,6 +539,28 @@ declare function isJSONEncodable(maybeEncodable: unknown): maybeEncodable is JSO
539
539
  */
540
540
  declare class SelectMenuOptionBuilder implements JSONEncodable<APISelectMenuOption> {
541
541
  data: Partial<APISelectMenuOption>;
542
+ /**
543
+ * Creates a new select menu option from API data
544
+ *
545
+ * @param data - The API data to create this select menu option with
546
+ * @example
547
+ * Creating a select menu option from an API data object
548
+ * ```ts
549
+ * const selectMenuOption = new SelectMenuOptionBuilder({
550
+ * label: 'catchy label',
551
+ * value: '1',
552
+ * });
553
+ * ```
554
+ * @example
555
+ * Creating a select menu option using setters and API data
556
+ * ```ts
557
+ * const selectMenuOption = new SelectMenuOptionBuilder({
558
+ * default: true,
559
+ * value: '1',
560
+ * })
561
+ * .setLabel('woah')
562
+ * ```
563
+ */
542
564
  constructor(data?: Partial<APISelectMenuOption>);
543
565
  /**
544
566
  * Sets the label of this option
@@ -694,24 +716,24 @@ declare class ButtonBuilder extends ComponentBuilder<APIButtonComponent> {
694
716
  * Creating a button from an API data object
695
717
  * ```ts
696
718
  * const button = new ButtonBuilder({
697
- * style: 'primary',
719
+ * custom_id: 'a cool button',
720
+ * style: ButtonStyle.Primary,
698
721
  * label: 'Click Me',
699
722
  * emoji: {
700
- * name: ':smile:',
701
- * id: '12345678901234567890123456789012',
723
+ * name: 'smile',
724
+ * id: '123456789012345678',
702
725
  * },
703
- * custom_id: '12345678901234567890123456789012',
704
726
  * });
705
727
  * ```
706
728
  * @example
707
729
  * Creating a button using setters and API data
708
730
  * ```ts
709
731
  * const button = new ButtonBuilder({
710
- * style: 'primary',
732
+ * style: ButtonStyle.Secondary,
711
733
  * label: 'Click Me',
712
734
  * })
713
- * .setEmoji({ name: ':smile:', id: '12345678901234567890123456789012' })
714
- * .setCustomId('12345678901234567890123456789012');
735
+ * .setEmoji({ name: '🙂' })
736
+ * .setCustomId('another cool button');
715
737
  * ```
716
738
  */
717
739
  constructor(data?: Partial<APIButtonComponent>);
@@ -770,6 +792,37 @@ declare class SelectMenuBuilder extends ComponentBuilder<APISelectMenuComponent>
770
792
  * The options within this select menu
771
793
  */
772
794
  readonly options: SelectMenuOptionBuilder[];
795
+ /**
796
+ * Creates a new select menu from API data
797
+ *
798
+ * @param data - The API data to create this select menu with
799
+ * @example
800
+ * Creating a select menu from an API data object
801
+ * ```ts
802
+ * const selectMenu = new SelectMenuBuilder({
803
+ * custom_id: 'a cool select menu',
804
+ * placeholder: 'select an option',
805
+ * max_values: 2,
806
+ * options: [
807
+ * { label: 'option 1', value: '1' },
808
+ * { label: 'option 2', value: '2' },
809
+ * { label: 'option 3', value: '3' },
810
+ * ],
811
+ * });
812
+ * ```
813
+ * @example
814
+ * Creating a select menu using setters and API data
815
+ * ```ts
816
+ * const selectMenu = new SelectMenuBuilder({
817
+ * custom_id: 'a cool select menu',
818
+ * })
819
+ * .setMinValues(1)
820
+ * .addOptions({
821
+ * label: 'Catchy',
822
+ * value: 'catch',
823
+ * });
824
+ * ```
825
+ */
773
826
  constructor(data?: Partial<APISelectMenuComponent>);
774
827
  /**
775
828
  * Sets the placeholder for this select menu
@@ -840,6 +893,29 @@ interface Equatable<T> {
840
893
  declare function isEquatable(maybeEquatable: unknown): maybeEquatable is Equatable<unknown>;
841
894
 
842
895
  declare class TextInputBuilder extends ComponentBuilder<APITextInputComponent> implements Equatable<APITextInputComponent | JSONEncodable<APITextInputComponent>> {
896
+ /**
897
+ * Creates a new text input from API data
898
+ *
899
+ * @param data - The API data to create this text input with
900
+ * @example
901
+ * Creating a select menu option from an API data object
902
+ * ```ts
903
+ * const textInput = new TextInputBuilder({
904
+ * custom_id: 'a cool select menu',
905
+ * label: 'Type something',
906
+ * style: TextInputStyle.Short,
907
+ * });
908
+ * ```
909
+ * @example
910
+ * Creating a select menu option using setters and API data
911
+ * ```ts
912
+ * const textInput = new TextInputBuilder({
913
+ * label: 'Type something else',
914
+ * })
915
+ * .setCustomId('woah')
916
+ * .setStyle(TextInputStyle.Paragraph);
917
+ * ```
918
+ */
843
919
  constructor(data?: APITextInputComponent & {
844
920
  type?: ComponentType.TextInput;
845
921
  });
@@ -916,6 +992,40 @@ declare class ActionRowBuilder<T extends AnyComponentBuilder> extends ComponentB
916
992
  * The components within this action row
917
993
  */
918
994
  readonly components: T[];
995
+ /**
996
+ * Creates a new action row from API data
997
+ *
998
+ * @param data - The API data to create this action row with
999
+ * @example
1000
+ * Creating an action row from an API data object
1001
+ * ```ts
1002
+ * const actionRow = new ActionRowBuilder({
1003
+ * components: [
1004
+ * {
1005
+ * custom_id: "custom id",
1006
+ * label: "Type something",
1007
+ * style: TextInputStyle.Short,
1008
+ * type: ComponentType.TextInput,
1009
+ * },
1010
+ * ],
1011
+ * });
1012
+ * ```
1013
+ * @example
1014
+ * Creating an action row using setters and API data
1015
+ * ```ts
1016
+ * const actionRow = new ActionRowBuilder({
1017
+ * components: [
1018
+ * {
1019
+ * custom_id: "custom id",
1020
+ * label: "Click me",
1021
+ * style: ButtonStyle.Primary,
1022
+ * type: ComponentType.Button,
1023
+ * },
1024
+ * ],
1025
+ * })
1026
+ * .addComponents(button2, button3);
1027
+ * ```
1028
+ */
919
1029
  constructor({ components, ...data }?: Partial<APIActionRowComponent<APIActionRowComponentTypes>>);
920
1030
  /**
921
1031
  * Adds components to this action row.