@discordjs/builders 1.11.3 → 1.12.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.mts +338 -63
- package/dist/index.d.ts +338 -63
- package/dist/index.js +530 -200
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +495 -167
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
package/dist/index.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as _sapphire_shapeshift from '@sapphire/shapeshift';
|
|
2
|
-
import { APIEmbedField, APIEmbedAuthor, APIEmbedFooter, APIEmbedImage, APIEmbed, APISelectMenuOption, APIMessageComponentEmoji, ButtonStyle, ChannelType, APIActionRowComponent, APIComponentInActionRow, APIMessageComponent, APIBaseComponent, ComponentType, APIButtonComponent, Snowflake, APISelectMenuComponent, APIChannelSelectComponent, APIMentionableSelectComponent, APISelectMenuDefaultValue, SelectMenuDefaultValueType, APIRoleSelectComponent, APIStringSelectComponent, APIUserSelectComponent, APITextInputComponent, TextInputStyle, APIComponentInMessageActionRow, APIComponentInModalActionRow, APIFileComponent, APISeparatorComponent, SeparatorSpacingSize, APITextDisplayComponent, APIContainerComponent, APIMediaGalleryComponent, APISectionComponent, APIComponentInContainer, APIMediaGalleryItem, APIThumbnailComponent,
|
|
2
|
+
import { APIEmbedField, APIEmbedAuthor, APIEmbedFooter, APIEmbedImage, APIEmbed, APISelectMenuOption, APIMessageComponentEmoji, ButtonStyle, ChannelType, APIActionRowComponent, APIComponentInActionRow, APIMessageComponent, APIModalComponent, APIBaseComponent, ComponentType, APIButtonComponent, Snowflake, APISelectMenuComponent, APIChannelSelectComponent, APIMentionableSelectComponent, APISelectMenuDefaultValue, SelectMenuDefaultValueType, APIRoleSelectComponent, APIStringSelectComponent, APIUserSelectComponent, APITextInputComponent, TextInputStyle, APIComponentInMessageActionRow, APIComponentInModalActionRow, APILabelComponent, APIFileComponent, APISeparatorComponent, SeparatorSpacingSize, APITextDisplayComponent, APIContainerComponent, APIMediaGalleryComponent, APISectionComponent, APIComponentInContainer, APIMediaGalleryItem, APIThumbnailComponent, APIModalInteractionResponseCallbackData, LocalizationMap, LocaleString, InteractionContextType, Permissions, ApplicationIntegrationType, RESTPostAPIChatInputApplicationCommandsJSONBody, ApplicationCommandOptionType, APIApplicationCommandBasicOption, APIApplicationCommandAttachmentOption, APIApplicationCommandBooleanOption, APIApplicationCommandChannelOption, APIApplicationCommandOptionChoice, APIApplicationCommandIntegerOption, APIApplicationCommandMentionableOption, APIApplicationCommandNumberOption, APIApplicationCommandRoleOption, APIApplicationCommandStringOption, APIApplicationCommandUserOption, APIApplicationCommandSubcommandGroupOption, APIApplicationCommandSubcommandOption, APIApplicationCommandOption, Locale, ApplicationCommandType, RESTPostAPIContextMenuApplicationCommandsJSONBody } from 'discord-api-types/v10';
|
|
3
3
|
export * from '@discordjs/formatters';
|
|
4
4
|
import { JSONEncodable, Equatable } from '@discordjs/util';
|
|
5
5
|
|
|
@@ -52,25 +52,25 @@ declare const embedFooterPredicate: _sapphire_shapeshift.ObjectValidator<{
|
|
|
52
52
|
declare const timestampPredicate: _sapphire_shapeshift.UnionValidator<number | Date | null>;
|
|
53
53
|
declare const titlePredicate: _sapphire_shapeshift.UnionValidator<string | null>;
|
|
54
54
|
|
|
55
|
-
declare const Assertions$
|
|
56
|
-
declare const Assertions$
|
|
57
|
-
declare const Assertions$
|
|
58
|
-
declare const Assertions$
|
|
59
|
-
declare const Assertions$
|
|
60
|
-
declare const Assertions$
|
|
61
|
-
declare const Assertions$
|
|
62
|
-
declare const Assertions$
|
|
63
|
-
declare const Assertions$
|
|
64
|
-
declare const Assertions$
|
|
65
|
-
declare const Assertions$
|
|
66
|
-
declare const Assertions$
|
|
67
|
-
declare const Assertions$
|
|
68
|
-
declare const Assertions$
|
|
69
|
-
declare const Assertions$
|
|
70
|
-
declare const Assertions$
|
|
71
|
-
declare const Assertions$
|
|
72
|
-
declare namespace Assertions$
|
|
73
|
-
export { Assertions$
|
|
55
|
+
declare const Assertions$7_RGBPredicate: typeof RGBPredicate;
|
|
56
|
+
declare const Assertions$7_authorNamePredicate: typeof authorNamePredicate;
|
|
57
|
+
declare const Assertions$7_colorPredicate: typeof colorPredicate;
|
|
58
|
+
declare const Assertions$7_embedAuthorPredicate: typeof embedAuthorPredicate;
|
|
59
|
+
declare const Assertions$7_embedFieldPredicate: typeof embedFieldPredicate;
|
|
60
|
+
declare const Assertions$7_embedFieldsArrayPredicate: typeof embedFieldsArrayPredicate;
|
|
61
|
+
declare const Assertions$7_embedFooterPredicate: typeof embedFooterPredicate;
|
|
62
|
+
declare const Assertions$7_fieldInlinePredicate: typeof fieldInlinePredicate;
|
|
63
|
+
declare const Assertions$7_fieldLengthPredicate: typeof fieldLengthPredicate;
|
|
64
|
+
declare const Assertions$7_fieldNamePredicate: typeof fieldNamePredicate;
|
|
65
|
+
declare const Assertions$7_fieldValuePredicate: typeof fieldValuePredicate;
|
|
66
|
+
declare const Assertions$7_footerTextPredicate: typeof footerTextPredicate;
|
|
67
|
+
declare const Assertions$7_imageURLPredicate: typeof imageURLPredicate;
|
|
68
|
+
declare const Assertions$7_timestampPredicate: typeof timestampPredicate;
|
|
69
|
+
declare const Assertions$7_titlePredicate: typeof titlePredicate;
|
|
70
|
+
declare const Assertions$7_urlPredicate: typeof urlPredicate;
|
|
71
|
+
declare const Assertions$7_validateFieldLength: typeof validateFieldLength;
|
|
72
|
+
declare namespace Assertions$7 {
|
|
73
|
+
export { Assertions$7_RGBPredicate as RGBPredicate, Assertions$7_authorNamePredicate as authorNamePredicate, Assertions$7_colorPredicate as colorPredicate, descriptionPredicate$1 as descriptionPredicate, Assertions$7_embedAuthorPredicate as embedAuthorPredicate, Assertions$7_embedFieldPredicate as embedFieldPredicate, Assertions$7_embedFieldsArrayPredicate as embedFieldsArrayPredicate, Assertions$7_embedFooterPredicate as embedFooterPredicate, Assertions$7_fieldInlinePredicate as fieldInlinePredicate, Assertions$7_fieldLengthPredicate as fieldLengthPredicate, Assertions$7_fieldNamePredicate as fieldNamePredicate, Assertions$7_fieldValuePredicate as fieldValuePredicate, Assertions$7_footerTextPredicate as footerTextPredicate, Assertions$7_imageURLPredicate as imageURLPredicate, Assertions$7_timestampPredicate as timestampPredicate, Assertions$7_titlePredicate as titlePredicate, Assertions$7_urlPredicate as urlPredicate, Assertions$7_validateFieldLength as validateFieldLength };
|
|
74
74
|
}
|
|
75
75
|
|
|
76
76
|
/**
|
|
@@ -393,32 +393,32 @@ declare const channelTypesValidator: _sapphire_shapeshift.ArrayValidator<Channel
|
|
|
393
393
|
declare const urlValidator: _sapphire_shapeshift.StringValidator<string>;
|
|
394
394
|
declare function validateRequiredButtonParameters(style?: ButtonStyle, label?: string, emoji?: APIMessageComponentEmoji, customId?: string, skuId?: string, url?: string): void;
|
|
395
395
|
|
|
396
|
-
declare const Assertions$
|
|
397
|
-
declare const Assertions$
|
|
398
|
-
declare const Assertions$
|
|
399
|
-
declare const Assertions$
|
|
400
|
-
declare const Assertions$
|
|
401
|
-
declare const Assertions$
|
|
402
|
-
declare const Assertions$
|
|
403
|
-
declare const Assertions$
|
|
404
|
-
declare const Assertions$
|
|
405
|
-
declare const Assertions$
|
|
406
|
-
declare const Assertions$
|
|
407
|
-
declare const Assertions$
|
|
408
|
-
declare const Assertions$
|
|
409
|
-
declare const Assertions$
|
|
410
|
-
declare const Assertions$
|
|
411
|
-
declare const Assertions$
|
|
412
|
-
declare const Assertions$
|
|
413
|
-
declare const Assertions$
|
|
414
|
-
declare namespace Assertions$
|
|
415
|
-
export { Assertions$
|
|
396
|
+
declare const Assertions$6_buttonLabelValidator: typeof buttonLabelValidator;
|
|
397
|
+
declare const Assertions$6_buttonStyleValidator: typeof buttonStyleValidator;
|
|
398
|
+
declare const Assertions$6_channelTypesValidator: typeof channelTypesValidator;
|
|
399
|
+
declare const Assertions$6_customIdValidator: typeof customIdValidator;
|
|
400
|
+
declare const Assertions$6_defaultValidator: typeof defaultValidator;
|
|
401
|
+
declare const Assertions$6_disabledValidator: typeof disabledValidator;
|
|
402
|
+
declare const Assertions$6_emojiValidator: typeof emojiValidator;
|
|
403
|
+
declare const Assertions$6_idValidator: typeof idValidator;
|
|
404
|
+
declare const Assertions$6_jsonOptionValidator: typeof jsonOptionValidator;
|
|
405
|
+
declare const Assertions$6_labelValueDescriptionValidator: typeof labelValueDescriptionValidator;
|
|
406
|
+
declare const Assertions$6_minMaxValidator: typeof minMaxValidator;
|
|
407
|
+
declare const Assertions$6_optionValidator: typeof optionValidator;
|
|
408
|
+
declare const Assertions$6_optionsLengthValidator: typeof optionsLengthValidator;
|
|
409
|
+
declare const Assertions$6_optionsValidator: typeof optionsValidator;
|
|
410
|
+
declare const Assertions$6_urlValidator: typeof urlValidator;
|
|
411
|
+
declare const Assertions$6_validateRequiredButtonParameters: typeof validateRequiredButtonParameters;
|
|
412
|
+
declare const Assertions$6_validateRequiredSelectMenuOptionParameters: typeof validateRequiredSelectMenuOptionParameters;
|
|
413
|
+
declare const Assertions$6_validateRequiredSelectMenuParameters: typeof validateRequiredSelectMenuParameters;
|
|
414
|
+
declare namespace Assertions$6 {
|
|
415
|
+
export { Assertions$6_buttonLabelValidator as buttonLabelValidator, Assertions$6_buttonStyleValidator as buttonStyleValidator, Assertions$6_channelTypesValidator as channelTypesValidator, Assertions$6_customIdValidator as customIdValidator, Assertions$6_defaultValidator as defaultValidator, Assertions$6_disabledValidator as disabledValidator, Assertions$6_emojiValidator as emojiValidator, Assertions$6_idValidator as idValidator, Assertions$6_jsonOptionValidator as jsonOptionValidator, Assertions$6_labelValueDescriptionValidator as labelValueDescriptionValidator, Assertions$6_minMaxValidator as minMaxValidator, Assertions$6_optionValidator as optionValidator, Assertions$6_optionsLengthValidator as optionsLengthValidator, Assertions$6_optionsValidator as optionsValidator, placeholderValidator$1 as placeholderValidator, Assertions$6_urlValidator as urlValidator, Assertions$6_validateRequiredButtonParameters as validateRequiredButtonParameters, Assertions$6_validateRequiredSelectMenuOptionParameters as validateRequiredSelectMenuOptionParameters, Assertions$6_validateRequiredSelectMenuParameters as validateRequiredSelectMenuParameters };
|
|
416
416
|
}
|
|
417
417
|
|
|
418
418
|
/**
|
|
419
419
|
* Any action row component data represented as an object.
|
|
420
420
|
*/
|
|
421
|
-
type AnyAPIActionRowComponent = APIActionRowComponent<APIComponentInActionRow> | APIComponentInActionRow | APIMessageComponent;
|
|
421
|
+
type AnyAPIActionRowComponent = APIActionRowComponent<APIComponentInActionRow> | APIComponentInActionRow | APIMessageComponent | APIModalComponent;
|
|
422
422
|
/**
|
|
423
423
|
* The base component builder that contains common symbols for all sorts of components.
|
|
424
424
|
*
|
|
@@ -578,6 +578,13 @@ declare abstract class BaseSelectMenuBuilder<SelectMenuType extends APISelectMen
|
|
|
578
578
|
* @param disabled - Whether this select menu is disabled
|
|
579
579
|
*/
|
|
580
580
|
setDisabled(disabled?: boolean): this;
|
|
581
|
+
/**
|
|
582
|
+
* Sets whether this select menu is required.
|
|
583
|
+
*
|
|
584
|
+
* @remarks Only for use in modals.
|
|
585
|
+
* @param required - Whether this select menu is required
|
|
586
|
+
*/
|
|
587
|
+
setRequired(required?: boolean): this;
|
|
581
588
|
/**
|
|
582
589
|
* {@inheritDoc ComponentBuilder.toJSON}
|
|
583
590
|
*/
|
|
@@ -876,7 +883,7 @@ declare class TextInputBuilder extends ComponentBuilder<APITextInputComponent> i
|
|
|
876
883
|
* ```ts
|
|
877
884
|
* const textInput = new TextInputBuilder({
|
|
878
885
|
* custom_id: 'a cool text input',
|
|
879
|
-
*
|
|
886
|
+
* placeholder: 'Type something',
|
|
880
887
|
* style: TextInputStyle.Short,
|
|
881
888
|
* });
|
|
882
889
|
* ```
|
|
@@ -884,7 +891,7 @@ declare class TextInputBuilder extends ComponentBuilder<APITextInputComponent> i
|
|
|
884
891
|
* Creating a text input using setters and API data:
|
|
885
892
|
* ```ts
|
|
886
893
|
* const textInput = new TextInputBuilder({
|
|
887
|
-
*
|
|
894
|
+
* placeholder: 'Type something else',
|
|
888
895
|
* })
|
|
889
896
|
* .setCustomId('woah')
|
|
890
897
|
* .setStyle(TextInputStyle.Paragraph);
|
|
@@ -903,6 +910,7 @@ declare class TextInputBuilder extends ComponentBuilder<APITextInputComponent> i
|
|
|
903
910
|
* Sets the label for this text input.
|
|
904
911
|
*
|
|
905
912
|
* @param label - The label to use
|
|
913
|
+
* @deprecated Use a label builder to create a label (and optionally a description) instead.
|
|
906
914
|
*/
|
|
907
915
|
setLabel(label: string): this;
|
|
908
916
|
/**
|
|
@@ -1030,6 +1038,97 @@ declare class ActionRowBuilder<ComponentType extends AnyComponentBuilder> extend
|
|
|
1030
1038
|
toJSON(): APIActionRowComponent<ReturnType<ComponentType['toJSON']>>;
|
|
1031
1039
|
}
|
|
1032
1040
|
|
|
1041
|
+
interface LabelBuilderData extends Partial<Omit<APILabelComponent, 'component'>> {
|
|
1042
|
+
component?: ChannelSelectMenuBuilder | MentionableSelectMenuBuilder | RoleSelectMenuBuilder | StringSelectMenuBuilder | TextInputBuilder | UserSelectMenuBuilder;
|
|
1043
|
+
}
|
|
1044
|
+
/**
|
|
1045
|
+
* A builder that creates API-compatible JSON data for labels.
|
|
1046
|
+
*/
|
|
1047
|
+
declare class LabelBuilder extends ComponentBuilder<LabelBuilderData> {
|
|
1048
|
+
/**
|
|
1049
|
+
* @internal
|
|
1050
|
+
*/
|
|
1051
|
+
readonly data: LabelBuilderData;
|
|
1052
|
+
/**
|
|
1053
|
+
* Creates a new label.
|
|
1054
|
+
*
|
|
1055
|
+
* @param data - The API data to create this label with
|
|
1056
|
+
* @example
|
|
1057
|
+
* Creating a label from an API data object:
|
|
1058
|
+
* ```ts
|
|
1059
|
+
* const label = new LabelBuilder({
|
|
1060
|
+
* label: "label",
|
|
1061
|
+
* component,
|
|
1062
|
+
* });
|
|
1063
|
+
* ```
|
|
1064
|
+
* @example
|
|
1065
|
+
* Creating a label using setters and API data:
|
|
1066
|
+
* ```ts
|
|
1067
|
+
* const label = new LabelBuilder({
|
|
1068
|
+
* label: 'label',
|
|
1069
|
+
* component,
|
|
1070
|
+
* }).setLabel('new text');
|
|
1071
|
+
* ```
|
|
1072
|
+
*/
|
|
1073
|
+
constructor(data?: Partial<APILabelComponent>);
|
|
1074
|
+
/**
|
|
1075
|
+
* Sets the label for this label.
|
|
1076
|
+
*
|
|
1077
|
+
* @param label - The label to use
|
|
1078
|
+
*/
|
|
1079
|
+
setLabel(label: string): this;
|
|
1080
|
+
/**
|
|
1081
|
+
* Sets the description for this label.
|
|
1082
|
+
*
|
|
1083
|
+
* @param description - The description to use
|
|
1084
|
+
*/
|
|
1085
|
+
setDescription(description: string): this;
|
|
1086
|
+
/**
|
|
1087
|
+
* Clears the description for this label.
|
|
1088
|
+
*/
|
|
1089
|
+
clearDescription(): this;
|
|
1090
|
+
/**
|
|
1091
|
+
* Sets a string select menu component to this label.
|
|
1092
|
+
*
|
|
1093
|
+
* @param input - A function that returns a component builder or an already built builder
|
|
1094
|
+
*/
|
|
1095
|
+
setStringSelectMenuComponent(input: APIStringSelectComponent | StringSelectMenuBuilder | ((builder: StringSelectMenuBuilder) => StringSelectMenuBuilder)): this;
|
|
1096
|
+
/**
|
|
1097
|
+
* Sets a user select menu component to this label.
|
|
1098
|
+
*
|
|
1099
|
+
* @param input - A function that returns a component builder or an already built builder
|
|
1100
|
+
*/
|
|
1101
|
+
setUserSelectMenuComponent(input: APIUserSelectComponent | UserSelectMenuBuilder | ((builder: UserSelectMenuBuilder) => UserSelectMenuBuilder)): this;
|
|
1102
|
+
/**
|
|
1103
|
+
* Sets a role select menu component to this label.
|
|
1104
|
+
*
|
|
1105
|
+
* @param input - A function that returns a component builder or an already built builder
|
|
1106
|
+
*/
|
|
1107
|
+
setRoleSelectMenuComponent(input: APIRoleSelectComponent | RoleSelectMenuBuilder | ((builder: RoleSelectMenuBuilder) => RoleSelectMenuBuilder)): this;
|
|
1108
|
+
/**
|
|
1109
|
+
* Sets a mentionable select menu component to this label.
|
|
1110
|
+
*
|
|
1111
|
+
* @param input - A function that returns a component builder or an already built builder
|
|
1112
|
+
*/
|
|
1113
|
+
setMentionableSelectMenuComponent(input: APIMentionableSelectComponent | MentionableSelectMenuBuilder | ((builder: MentionableSelectMenuBuilder) => MentionableSelectMenuBuilder)): this;
|
|
1114
|
+
/**
|
|
1115
|
+
* Sets a channel select menu component to this label.
|
|
1116
|
+
*
|
|
1117
|
+
* @param input - A function that returns a component builder or an already built builder
|
|
1118
|
+
*/
|
|
1119
|
+
setChannelSelectMenuComponent(input: APIChannelSelectComponent | ChannelSelectMenuBuilder | ((builder: ChannelSelectMenuBuilder) => ChannelSelectMenuBuilder)): this;
|
|
1120
|
+
/**
|
|
1121
|
+
* Sets a text input component to this label.
|
|
1122
|
+
*
|
|
1123
|
+
* @param input - A function that returns a component builder or an already built builder
|
|
1124
|
+
*/
|
|
1125
|
+
setTextInputComponent(input: APITextInputComponent | TextInputBuilder | ((builder: TextInputBuilder) => TextInputBuilder)): this;
|
|
1126
|
+
/**
|
|
1127
|
+
* {@inheritDoc ComponentBuilder.toJSON}
|
|
1128
|
+
*/
|
|
1129
|
+
toJSON(): APILabelComponent;
|
|
1130
|
+
}
|
|
1131
|
+
|
|
1033
1132
|
declare class FileBuilder extends ComponentBuilder<APIFileComponent> {
|
|
1034
1133
|
/**
|
|
1035
1134
|
* Creates a new file from API data.
|
|
@@ -1592,6 +1691,10 @@ interface MappedComponentTypes {
|
|
|
1592
1691
|
* The media gallery component type is associated with a {@link MediaGalleryBuilder}.
|
|
1593
1692
|
*/
|
|
1594
1693
|
[ComponentType.MediaGallery]: MediaGalleryBuilder;
|
|
1694
|
+
/**
|
|
1695
|
+
* The label component type is associated with a {@link LabelBuilder}.
|
|
1696
|
+
*/
|
|
1697
|
+
[ComponentType.Label]: LabelBuilder;
|
|
1595
1698
|
}
|
|
1596
1699
|
/**
|
|
1597
1700
|
* Factory for creating components from API data.
|
|
@@ -1618,17 +1721,39 @@ declare const requiredValidator: _sapphire_shapeshift.BooleanValidator<boolean>;
|
|
|
1618
1721
|
declare const valueValidator: _sapphire_shapeshift.StringValidator<string>;
|
|
1619
1722
|
declare const placeholderValidator: _sapphire_shapeshift.StringValidator<string>;
|
|
1620
1723
|
declare const labelValidator: _sapphire_shapeshift.StringValidator<string>;
|
|
1621
|
-
declare
|
|
1622
|
-
|
|
1623
|
-
|
|
1624
|
-
|
|
1625
|
-
|
|
1626
|
-
|
|
1627
|
-
|
|
1628
|
-
|
|
1629
|
-
|
|
1630
|
-
|
|
1631
|
-
|
|
1724
|
+
declare const textInputPredicate: _sapphire_shapeshift.ObjectValidator<{
|
|
1725
|
+
type: ComponentType;
|
|
1726
|
+
custom_id: string;
|
|
1727
|
+
style: TextInputStyle;
|
|
1728
|
+
id: number | undefined;
|
|
1729
|
+
min_length: number | undefined;
|
|
1730
|
+
max_length: number | undefined;
|
|
1731
|
+
placeholder: string | undefined;
|
|
1732
|
+
value: string | undefined;
|
|
1733
|
+
required: boolean | undefined;
|
|
1734
|
+
}, _sapphire_shapeshift.UndefinedToOptional<{
|
|
1735
|
+
type: ComponentType;
|
|
1736
|
+
custom_id: string;
|
|
1737
|
+
style: TextInputStyle;
|
|
1738
|
+
id: number | undefined;
|
|
1739
|
+
min_length: number | undefined;
|
|
1740
|
+
max_length: number | undefined;
|
|
1741
|
+
placeholder: string | undefined;
|
|
1742
|
+
value: string | undefined;
|
|
1743
|
+
required: boolean | undefined;
|
|
1744
|
+
}>>;
|
|
1745
|
+
declare function validateRequiredParameters$3(customId?: string, style?: TextInputStyle): void;
|
|
1746
|
+
|
|
1747
|
+
declare const Assertions$5_labelValidator: typeof labelValidator;
|
|
1748
|
+
declare const Assertions$5_maxLengthValidator: typeof maxLengthValidator;
|
|
1749
|
+
declare const Assertions$5_minLengthValidator: typeof minLengthValidator;
|
|
1750
|
+
declare const Assertions$5_placeholderValidator: typeof placeholderValidator;
|
|
1751
|
+
declare const Assertions$5_requiredValidator: typeof requiredValidator;
|
|
1752
|
+
declare const Assertions$5_textInputPredicate: typeof textInputPredicate;
|
|
1753
|
+
declare const Assertions$5_textInputStyleValidator: typeof textInputStyleValidator;
|
|
1754
|
+
declare const Assertions$5_valueValidator: typeof valueValidator;
|
|
1755
|
+
declare namespace Assertions$5 {
|
|
1756
|
+
export { Assertions$5_labelValidator as labelValidator, Assertions$5_maxLengthValidator as maxLengthValidator, Assertions$5_minLengthValidator as minLengthValidator, Assertions$5_placeholderValidator as placeholderValidator, Assertions$5_requiredValidator as requiredValidator, Assertions$5_textInputPredicate as textInputPredicate, Assertions$5_textInputStyleValidator as textInputStyleValidator, validateRequiredParameters$3 as validateRequiredParameters, Assertions$5_valueValidator as valueValidator };
|
|
1632
1757
|
}
|
|
1633
1758
|
|
|
1634
1759
|
/**
|
|
@@ -1642,7 +1767,7 @@ declare class ModalBuilder implements JSONEncodable<APIModalInteractionResponseC
|
|
|
1642
1767
|
/**
|
|
1643
1768
|
* The components within this modal.
|
|
1644
1769
|
*/
|
|
1645
|
-
readonly components: ActionRowBuilder<ModalActionRowComponentBuilder>[];
|
|
1770
|
+
readonly components: (ActionRowBuilder<ModalActionRowComponentBuilder> | LabelBuilder)[];
|
|
1646
1771
|
/**
|
|
1647
1772
|
* Creates a new modal from API data.
|
|
1648
1773
|
*
|
|
@@ -1665,14 +1790,65 @@ declare class ModalBuilder implements JSONEncodable<APIModalInteractionResponseC
|
|
|
1665
1790
|
* Adds components to this modal.
|
|
1666
1791
|
*
|
|
1667
1792
|
* @param components - The components to add
|
|
1793
|
+
* @deprecated Use {@link ModalBuilder.addLabelComponents} or {@link ModalBuilder.addActionRowComponents} instead
|
|
1794
|
+
*/
|
|
1795
|
+
addComponents(...components: RestOrArray<ActionRowBuilder<ModalActionRowComponentBuilder> | APIActionRowComponent<APIComponentInModalActionRow> | APILabelComponent | APITextInputComponent | LabelBuilder | TextInputBuilder>): this;
|
|
1796
|
+
/**
|
|
1797
|
+
* Adds label components to this modal.
|
|
1798
|
+
*
|
|
1799
|
+
* @param components - The components to add
|
|
1800
|
+
*/
|
|
1801
|
+
addLabelComponents(...components: RestOrArray<APILabelComponent | LabelBuilder | ((builder: LabelBuilder) => LabelBuilder)>): this;
|
|
1802
|
+
/**
|
|
1803
|
+
* Adds action rows to this modal.
|
|
1804
|
+
*
|
|
1805
|
+
* @param components - The components to add
|
|
1806
|
+
* @deprecated Use {@link ModalBuilder.addLabelComponents} instead
|
|
1807
|
+
*/
|
|
1808
|
+
addActionRowComponents(...components: RestOrArray<ActionRowBuilder<ModalActionRowComponentBuilder> | APIActionRowComponent<APIComponentInModalActionRow> | ((builder: ActionRowBuilder<ModalActionRowComponentBuilder>) => ActionRowBuilder<ModalActionRowComponentBuilder>)>): this;
|
|
1809
|
+
/**
|
|
1810
|
+
* Sets the labels for this modal.
|
|
1811
|
+
*
|
|
1812
|
+
* @param components - The components to set
|
|
1813
|
+
*/
|
|
1814
|
+
setLabelComponents(...components: RestOrArray<APILabelComponent | LabelBuilder | ((builder: LabelBuilder) => LabelBuilder)>): this;
|
|
1815
|
+
/**
|
|
1816
|
+
* Removes, replaces, or inserts labels for this modal.
|
|
1817
|
+
*
|
|
1818
|
+
* @remarks
|
|
1819
|
+
* This method behaves similarly
|
|
1820
|
+
* to {@link https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array/splice | Array.prototype.splice()}.
|
|
1821
|
+
* The maximum amount of labels that can be added is 5.
|
|
1822
|
+
*
|
|
1823
|
+
* It's useful for modifying and adjusting order of the already-existing labels of a modal.
|
|
1824
|
+
* @example
|
|
1825
|
+
* Remove the first label:
|
|
1826
|
+
* ```ts
|
|
1827
|
+
* modal.spliceLabelComponents(0, 1);
|
|
1828
|
+
* ```
|
|
1829
|
+
* @example
|
|
1830
|
+
* Remove the first n labels:
|
|
1831
|
+
* ```ts
|
|
1832
|
+
* const n = 4;
|
|
1833
|
+
* modal.spliceLabelComponents(0, n);
|
|
1834
|
+
* ```
|
|
1835
|
+
* @example
|
|
1836
|
+
* Remove the last label:
|
|
1837
|
+
* ```ts
|
|
1838
|
+
* modal.spliceLabelComponents(-1, 1);
|
|
1839
|
+
* ```
|
|
1840
|
+
* @param index - The index to start at
|
|
1841
|
+
* @param deleteCount - The number of labels to remove
|
|
1842
|
+
* @param labels - The replacing label objects
|
|
1668
1843
|
*/
|
|
1669
|
-
|
|
1844
|
+
spliceLabelComponents(index: number, deleteCount: number, ...labels: (APILabelComponent | LabelBuilder | ((builder: LabelBuilder) => LabelBuilder))[]): this;
|
|
1670
1845
|
/**
|
|
1671
1846
|
* Sets components for this modal.
|
|
1672
1847
|
*
|
|
1673
1848
|
* @param components - The components to set
|
|
1849
|
+
* @deprecated Use {@link ModalBuilder.setLabelComponents} instead
|
|
1674
1850
|
*/
|
|
1675
|
-
setComponents(...components: RestOrArray<ActionRowBuilder<ModalActionRowComponentBuilder
|
|
1851
|
+
setComponents(...components: RestOrArray<ActionRowBuilder<ModalActionRowComponentBuilder> | LabelBuilder>): this;
|
|
1676
1852
|
/**
|
|
1677
1853
|
* {@inheritDoc ComponentBuilder.toJSON}
|
|
1678
1854
|
*/
|
|
@@ -1680,13 +1856,112 @@ declare class ModalBuilder implements JSONEncodable<APIModalInteractionResponseC
|
|
|
1680
1856
|
}
|
|
1681
1857
|
|
|
1682
1858
|
declare const titleValidator: _sapphire_shapeshift.StringValidator<string>;
|
|
1683
|
-
declare const componentsValidator: _sapphire_shapeshift.ArrayValidator<[ActionRowBuilder<AnyComponentBuilder>, ...ActionRowBuilder<AnyComponentBuilder>[]], ActionRowBuilder<AnyComponentBuilder>>;
|
|
1684
|
-
declare function validateRequiredParameters$2(customId?: string, title?: string, components?: ActionRowBuilder<ModalActionRowComponentBuilder>[]): void;
|
|
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;
|
|
1861
|
+
|
|
1862
|
+
declare const Assertions$4_componentsValidator: typeof componentsValidator;
|
|
1863
|
+
declare const Assertions$4_titleValidator: typeof titleValidator;
|
|
1864
|
+
declare namespace Assertions$4 {
|
|
1865
|
+
export { Assertions$4_componentsValidator as componentsValidator, Assertions$4_titleValidator as titleValidator, validateRequiredParameters$2 as validateRequiredParameters };
|
|
1866
|
+
}
|
|
1867
|
+
|
|
1868
|
+
declare const labelPredicate: _sapphire_shapeshift.ObjectValidator<{
|
|
1869
|
+
id: number | undefined;
|
|
1870
|
+
type: ComponentType;
|
|
1871
|
+
label: string;
|
|
1872
|
+
description: string | undefined;
|
|
1873
|
+
component: _sapphire_shapeshift.UndefinedToOptional<{
|
|
1874
|
+
type: any;
|
|
1875
|
+
custom_id: any;
|
|
1876
|
+
style: any;
|
|
1877
|
+
id: any;
|
|
1878
|
+
min_length: any;
|
|
1879
|
+
max_length: any;
|
|
1880
|
+
placeholder: any;
|
|
1881
|
+
value: any;
|
|
1882
|
+
required: any;
|
|
1883
|
+
}> | _sapphire_shapeshift.UndefinedToOptional<{
|
|
1884
|
+
id: any;
|
|
1885
|
+
placeholder: any;
|
|
1886
|
+
min_values: any;
|
|
1887
|
+
max_values: any;
|
|
1888
|
+
custom_id: any;
|
|
1889
|
+
disabled: any;
|
|
1890
|
+
} & {
|
|
1891
|
+
type: any;
|
|
1892
|
+
default_values: any;
|
|
1893
|
+
}> | _sapphire_shapeshift.UndefinedToOptional<{
|
|
1894
|
+
id: any;
|
|
1895
|
+
placeholder: any;
|
|
1896
|
+
min_values: any;
|
|
1897
|
+
max_values: any;
|
|
1898
|
+
custom_id: any;
|
|
1899
|
+
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
|
+
} & {
|
|
1911
|
+
type: any;
|
|
1912
|
+
options: any;
|
|
1913
|
+
}>;
|
|
1914
|
+
}, _sapphire_shapeshift.UndefinedToOptional<{
|
|
1915
|
+
id: number | undefined;
|
|
1916
|
+
type: ComponentType;
|
|
1917
|
+
label: string;
|
|
1918
|
+
description: string | undefined;
|
|
1919
|
+
component: _sapphire_shapeshift.UndefinedToOptional<{
|
|
1920
|
+
type: any;
|
|
1921
|
+
custom_id: any;
|
|
1922
|
+
style: any;
|
|
1923
|
+
id: any;
|
|
1924
|
+
min_length: any;
|
|
1925
|
+
max_length: any;
|
|
1926
|
+
placeholder: any;
|
|
1927
|
+
value: any;
|
|
1928
|
+
required: any;
|
|
1929
|
+
}> | _sapphire_shapeshift.UndefinedToOptional<{
|
|
1930
|
+
id: any;
|
|
1931
|
+
placeholder: any;
|
|
1932
|
+
min_values: any;
|
|
1933
|
+
max_values: any;
|
|
1934
|
+
custom_id: any;
|
|
1935
|
+
disabled: any;
|
|
1936
|
+
} & {
|
|
1937
|
+
type: any;
|
|
1938
|
+
default_values: any;
|
|
1939
|
+
}> | _sapphire_shapeshift.UndefinedToOptional<{
|
|
1940
|
+
id: any;
|
|
1941
|
+
placeholder: any;
|
|
1942
|
+
min_values: any;
|
|
1943
|
+
max_values: any;
|
|
1944
|
+
custom_id: any;
|
|
1945
|
+
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
|
+
} & {
|
|
1957
|
+
type: any;
|
|
1958
|
+
options: any;
|
|
1959
|
+
}>;
|
|
1960
|
+
}>>;
|
|
1685
1961
|
|
|
1686
|
-
declare const Assertions$
|
|
1687
|
-
declare const Assertions$3_titleValidator: typeof titleValidator;
|
|
1962
|
+
declare const Assertions$3_labelPredicate: typeof labelPredicate;
|
|
1688
1963
|
declare namespace Assertions$3 {
|
|
1689
|
-
export { Assertions$
|
|
1964
|
+
export { Assertions$3_labelPredicate as labelPredicate };
|
|
1690
1965
|
}
|
|
1691
1966
|
|
|
1692
1967
|
declare const unfurledMediaItemPredicate: _sapphire_shapeshift.ObjectValidator<{
|
|
@@ -2608,4 +2883,4 @@ declare function isValidationEnabled(): boolean;
|
|
|
2608
2883
|
*/
|
|
2609
2884
|
declare const version: string;
|
|
2610
2885
|
|
|
2611
|
-
export { ActionRowBuilder, type AnyAPIActionRowComponent, type AnyComponentBuilder, ApplicationCommandNumericOptionMinMaxValueMixin, type ApplicationCommandOptionAllowedChannelTypes, ApplicationCommandOptionBase, ApplicationCommandOptionChannelTypesMixin, ApplicationCommandOptionWithAutocompleteMixin, ApplicationCommandOptionWithChoicesMixin, BaseSelectMenuBuilder, ButtonBuilder, ChannelSelectMenuBuilder, Assertions$
|
|
2886
|
+
export { ActionRowBuilder, type AnyAPIActionRowComponent, type AnyComponentBuilder, ApplicationCommandNumericOptionMinMaxValueMixin, type ApplicationCommandOptionAllowedChannelTypes, ApplicationCommandOptionBase, ApplicationCommandOptionChannelTypesMixin, ApplicationCommandOptionWithAutocompleteMixin, ApplicationCommandOptionWithChoicesMixin, BaseSelectMenuBuilder, ButtonBuilder, ChannelSelectMenuBuilder, Assertions$6 as ComponentAssertions, ComponentBuilder, Assertions$2 as ComponentsV2Assertions, ContainerBuilder, type ContainerComponentBuilder, Assertions as ContextMenuCommandAssertions, ContextMenuCommandBuilder, type ContextMenuCommandType, Assertions$7 as EmbedAssertions, type EmbedAuthorData, type EmbedAuthorOptions, EmbedBuilder, type EmbedFooterData, type EmbedFooterOptions, type EmbedImageData, FileBuilder, type IconData, Assertions$3 as LabelAssertions, LabelBuilder, type LabelBuilderData, type MappedComponentTypes, MediaGalleryBuilder, MediaGalleryItemBuilder, MentionableSelectMenuBuilder, type MessageActionRowComponentBuilder, type MessageComponentBuilder, type ModalActionRowComponentBuilder, Assertions$4 as ModalAssertions, ModalBuilder, type ModalComponentBuilder, type RGBTuple, type RestOrArray, RoleSelectMenuBuilder, SectionBuilder, StringSelectMenuBuilder as SelectMenuBuilder, StringSelectMenuOptionBuilder as SelectMenuOptionBuilder, SeparatorBuilder, SharedNameAndDescription, SharedSlashCommand, SharedSlashCommandOptions, SharedSlashCommandSubcommands, Assertions$1 as SlashCommandAssertions, SlashCommandAttachmentOption, SlashCommandBooleanOption, SlashCommandBuilder, SlashCommandChannelOption, SlashCommandIntegerOption, SlashCommandMentionableOption, SlashCommandNumberOption, type SlashCommandOptionsOnlyBuilder, SlashCommandRoleOption, SlashCommandStringOption, SlashCommandSubcommandBuilder, SlashCommandSubcommandGroupBuilder, type SlashCommandSubcommandsOnlyBuilder, SlashCommandUserOption, StringSelectMenuBuilder, StringSelectMenuOptionBuilder, TextDisplayBuilder, Assertions$5 as TextInputAssertions, TextInputBuilder, ThumbnailBuilder, type ToAPIApplicationCommandOptions, UserSelectMenuBuilder, createComponentBuilder, disableValidators, embedLength, enableValidators, isValidationEnabled, normalizeArray, resolveBuilder, version };
|