@discordjs/builders 1.7.0-dev.1699704223-5b0aa92c8 → 1.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.d.mts +81 -21
- package/dist/index.d.ts +81 -21
- package/dist/index.js +151 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +167 -5
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -3
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, APIActionRowComponentTypes, APIBaseComponent, ComponentType, APIButtonComponent, APISelectMenuComponent, APIChannelSelectComponent, APIMentionableSelectComponent, APIRoleSelectComponent, APIStringSelectComponent, APIUserSelectComponent, APITextInputComponent, TextInputStyle, APIMessageActionRowComponent, APIModalActionRowComponent, APIModalComponent, APIMessageComponent, APIModalInteractionResponseCallbackData, LocalizationMap, LocaleString, ApplicationCommandOptionType, APIApplicationCommandBasicOption, APIApplicationCommandAttachmentOption, APIApplicationCommandBooleanOption, APIApplicationCommandChannelOption, APIApplicationCommandOptionChoice, APIApplicationCommandIntegerOption, APIApplicationCommandMentionableOption, APIApplicationCommandNumberOption, APIApplicationCommandRoleOption, APIApplicationCommandStringOption, APIApplicationCommandUserOption, APIApplicationCommandSubcommandGroupOption, APIApplicationCommandSubcommandOption, Permissions, RESTPostAPIChatInputApplicationCommandsJSONBody, APIApplicationCommandOption, Locale, ApplicationCommandType, RESTPostAPIContextMenuApplicationCommandsJSONBody } from 'discord-api-types/v10';
|
|
2
|
+
import { APIEmbedField, APIEmbedAuthor, APIEmbedFooter, APIEmbedImage, APIEmbed, APISelectMenuOption, APIMessageComponentEmoji, ButtonStyle, ChannelType, APIActionRowComponent, APIActionRowComponentTypes, APIBaseComponent, ComponentType, APIButtonComponent, APISelectMenuComponent, APIChannelSelectComponent, Snowflake, APIMentionableSelectComponent, APISelectMenuDefaultValue, SelectMenuDefaultValueType, APIRoleSelectComponent, APIStringSelectComponent, APIUserSelectComponent, APITextInputComponent, TextInputStyle, APIMessageActionRowComponent, APIModalActionRowComponent, APIModalComponent, APIMessageComponent, APIModalInteractionResponseCallbackData, LocalizationMap, LocaleString, ApplicationCommandOptionType, APIApplicationCommandBasicOption, APIApplicationCommandAttachmentOption, APIApplicationCommandBooleanOption, APIApplicationCommandChannelOption, APIApplicationCommandOptionChoice, APIApplicationCommandIntegerOption, APIApplicationCommandMentionableOption, APIApplicationCommandNumberOption, APIApplicationCommandRoleOption, APIApplicationCommandStringOption, APIApplicationCommandUserOption, APIApplicationCommandSubcommandGroupOption, APIApplicationCommandSubcommandOption, Permissions, RESTPostAPIChatInputApplicationCommandsJSONBody, 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
|
|
|
@@ -96,10 +96,10 @@ declare namespace Assertions$5 {
|
|
|
96
96
|
/**
|
|
97
97
|
* Normalizes data that is a rest parameter or an array into an array with a depth of 1.
|
|
98
98
|
*
|
|
99
|
-
* @typeParam
|
|
99
|
+
* @typeParam ItemType - The data that must satisfy {@link RestOrArray}.
|
|
100
100
|
* @param arr - The (possibly variadic) data to normalize
|
|
101
101
|
*/
|
|
102
|
-
declare function normalizeArray<
|
|
102
|
+
declare function normalizeArray<ItemType>(arr: RestOrArray<ItemType>): ItemType[];
|
|
103
103
|
/**
|
|
104
104
|
* Represents data that may be an array or came from a rest parameter.
|
|
105
105
|
*
|
|
@@ -107,7 +107,7 @@ declare function normalizeArray<T>(arr: RestOrArray<T>): T[];
|
|
|
107
107
|
* This type is used throughout builders to ensure both an array and variadic arguments
|
|
108
108
|
* may be used. It is normalized with {@link normalizeArray}.
|
|
109
109
|
*/
|
|
110
|
-
type RestOrArray<
|
|
110
|
+
type RestOrArray<Type> = Type[] | [Type[]];
|
|
111
111
|
|
|
112
112
|
/**
|
|
113
113
|
* A tuple satisfying the RGB color model.
|
|
@@ -640,6 +640,18 @@ declare class ChannelSelectMenuBuilder extends BaseSelectMenuBuilder<APIChannelS
|
|
|
640
640
|
* @param types - The channel types to use
|
|
641
641
|
*/
|
|
642
642
|
setChannelTypes(...types: RestOrArray<ChannelType>): this;
|
|
643
|
+
/**
|
|
644
|
+
* Adds default channels to this auto populated select menu.
|
|
645
|
+
*
|
|
646
|
+
* @param channels - The channels to add
|
|
647
|
+
*/
|
|
648
|
+
addDefaultChannels(...channels: RestOrArray<Snowflake>): this;
|
|
649
|
+
/**
|
|
650
|
+
* Sets default channels to this auto populated select menu.
|
|
651
|
+
*
|
|
652
|
+
* @param channels - The channels to set
|
|
653
|
+
*/
|
|
654
|
+
setDefaultChannels(...channels: RestOrArray<Snowflake>): this;
|
|
643
655
|
/**
|
|
644
656
|
* {@inheritDoc BaseSelectMenuBuilder.toJSON}
|
|
645
657
|
*/
|
|
@@ -673,6 +685,30 @@ declare class MentionableSelectMenuBuilder extends BaseSelectMenuBuilder<APIMent
|
|
|
673
685
|
* ```
|
|
674
686
|
*/
|
|
675
687
|
constructor(data?: Partial<APIMentionableSelectComponent>);
|
|
688
|
+
/**
|
|
689
|
+
* Adds default roles to this auto populated select menu.
|
|
690
|
+
*
|
|
691
|
+
* @param roles - The roles to add
|
|
692
|
+
*/
|
|
693
|
+
addDefaultRoles(...roles: RestOrArray<Snowflake>): this;
|
|
694
|
+
/**
|
|
695
|
+
* Adds default users to this auto populated select menu.
|
|
696
|
+
*
|
|
697
|
+
* @param users - The users to add
|
|
698
|
+
*/
|
|
699
|
+
addDefaultUsers(...users: RestOrArray<Snowflake>): this;
|
|
700
|
+
/**
|
|
701
|
+
* Adds default values to this auto populated select menu.
|
|
702
|
+
*
|
|
703
|
+
* @param values - The values to add
|
|
704
|
+
*/
|
|
705
|
+
addDefaultValues(...values: RestOrArray<APISelectMenuDefaultValue<SelectMenuDefaultValueType.Role> | APISelectMenuDefaultValue<SelectMenuDefaultValueType.User>>): this;
|
|
706
|
+
/**
|
|
707
|
+
* Sets default values to this auto populated select menu.
|
|
708
|
+
*
|
|
709
|
+
* @param values - The values to set
|
|
710
|
+
*/
|
|
711
|
+
setDefaultValues(...values: RestOrArray<APISelectMenuDefaultValue<SelectMenuDefaultValueType.Role> | APISelectMenuDefaultValue<SelectMenuDefaultValueType.User>>): this;
|
|
676
712
|
}
|
|
677
713
|
|
|
678
714
|
/**
|
|
@@ -702,6 +738,18 @@ declare class RoleSelectMenuBuilder extends BaseSelectMenuBuilder<APIRoleSelectC
|
|
|
702
738
|
* ```
|
|
703
739
|
*/
|
|
704
740
|
constructor(data?: Partial<APIRoleSelectComponent>);
|
|
741
|
+
/**
|
|
742
|
+
* Adds default roles to this auto populated select menu.
|
|
743
|
+
*
|
|
744
|
+
* @param roles - The roles to add
|
|
745
|
+
*/
|
|
746
|
+
addDefaultRoles(...roles: RestOrArray<Snowflake>): this;
|
|
747
|
+
/**
|
|
748
|
+
* Sets default roles to this auto populated select menu.
|
|
749
|
+
*
|
|
750
|
+
* @param roles - The roles to set
|
|
751
|
+
*/
|
|
752
|
+
setDefaultRoles(...roles: RestOrArray<Snowflake>): this;
|
|
705
753
|
}
|
|
706
754
|
|
|
707
755
|
/**
|
|
@@ -817,6 +865,18 @@ declare class UserSelectMenuBuilder extends BaseSelectMenuBuilder<APIUserSelectC
|
|
|
817
865
|
* ```
|
|
818
866
|
*/
|
|
819
867
|
constructor(data?: Partial<APIUserSelectComponent>);
|
|
868
|
+
/**
|
|
869
|
+
* Adds default users to this auto populated select menu.
|
|
870
|
+
*
|
|
871
|
+
* @param users - The users to add
|
|
872
|
+
*/
|
|
873
|
+
addDefaultUsers(...users: RestOrArray<Snowflake>): this;
|
|
874
|
+
/**
|
|
875
|
+
* Sets default users to this auto populated select menu.
|
|
876
|
+
*
|
|
877
|
+
* @param users - The users to set
|
|
878
|
+
*/
|
|
879
|
+
setDefaultUsers(...users: RestOrArray<Snowflake>): this;
|
|
820
880
|
}
|
|
821
881
|
|
|
822
882
|
/**
|
|
@@ -930,13 +990,13 @@ type AnyComponentBuilder = MessageActionRowComponentBuilder | ModalActionRowComp
|
|
|
930
990
|
/**
|
|
931
991
|
* A builder that creates API-compatible JSON data for action rows.
|
|
932
992
|
*
|
|
933
|
-
* @typeParam
|
|
993
|
+
* @typeParam ComponentType - The types of components this action row holds
|
|
934
994
|
*/
|
|
935
|
-
declare class ActionRowBuilder<
|
|
995
|
+
declare class ActionRowBuilder<ComponentType extends AnyComponentBuilder> extends ComponentBuilder<APIActionRowComponent<APIMessageActionRowComponent | APIModalActionRowComponent>> {
|
|
936
996
|
/**
|
|
937
997
|
* The components within this action row.
|
|
938
998
|
*/
|
|
939
|
-
readonly components:
|
|
999
|
+
readonly components: ComponentType[];
|
|
940
1000
|
/**
|
|
941
1001
|
* Creates a new action row from API data.
|
|
942
1002
|
*
|
|
@@ -977,17 +1037,17 @@ declare class ActionRowBuilder<T extends AnyComponentBuilder> extends ComponentB
|
|
|
977
1037
|
*
|
|
978
1038
|
* @param components - The components to add
|
|
979
1039
|
*/
|
|
980
|
-
addComponents(...components: RestOrArray<
|
|
1040
|
+
addComponents(...components: RestOrArray<ComponentType>): this;
|
|
981
1041
|
/**
|
|
982
1042
|
* Sets components for this action row.
|
|
983
1043
|
*
|
|
984
1044
|
* @param components - The components to set
|
|
985
1045
|
*/
|
|
986
|
-
setComponents(...components: RestOrArray<
|
|
1046
|
+
setComponents(...components: RestOrArray<ComponentType>): this;
|
|
987
1047
|
/**
|
|
988
1048
|
* {@inheritDoc ComponentBuilder.toJSON}
|
|
989
1049
|
*/
|
|
990
|
-
toJSON(): APIActionRowComponent<ReturnType<
|
|
1050
|
+
toJSON(): APIActionRowComponent<ReturnType<ComponentType['toJSON']>>;
|
|
991
1051
|
}
|
|
992
1052
|
|
|
993
1053
|
/**
|
|
@@ -1030,19 +1090,19 @@ interface MappedComponentTypes {
|
|
|
1030
1090
|
/**
|
|
1031
1091
|
* Factory for creating components from API data.
|
|
1032
1092
|
*
|
|
1033
|
-
* @typeParam
|
|
1093
|
+
* @typeParam ComponentType - The type of component to use
|
|
1034
1094
|
* @param data - The API data to transform to a component class
|
|
1035
1095
|
*/
|
|
1036
|
-
declare function createComponentBuilder<
|
|
1037
|
-
type:
|
|
1038
|
-
}): MappedComponentTypes[
|
|
1096
|
+
declare function createComponentBuilder<ComponentType extends keyof MappedComponentTypes>(data: (APIModalComponent | APIMessageComponent) & {
|
|
1097
|
+
type: ComponentType;
|
|
1098
|
+
}): MappedComponentTypes[ComponentType];
|
|
1039
1099
|
/**
|
|
1040
1100
|
* Factory for creating components from API data.
|
|
1041
1101
|
*
|
|
1042
|
-
* @typeParam
|
|
1102
|
+
* @typeParam ComponentBuilder - The type of component to use
|
|
1043
1103
|
* @param data - The API data to transform to a component class
|
|
1044
1104
|
*/
|
|
1045
|
-
declare function createComponentBuilder<
|
|
1105
|
+
declare function createComponentBuilder<ComponentBuilder extends MessageComponentBuilder | ModalComponentBuilder>(data: ComponentBuilder): ComponentBuilder;
|
|
1046
1106
|
|
|
1047
1107
|
declare const textInputStyleValidator: _sapphire_shapeshift.NativeEnumValidator<typeof TextInputStyle>;
|
|
1048
1108
|
declare const minLengthValidator: _sapphire_shapeshift.NumberValidator<number>;
|
|
@@ -1329,11 +1389,11 @@ declare abstract class ApplicationCommandNumericOptionMinMaxValueMixin {
|
|
|
1329
1389
|
/**
|
|
1330
1390
|
* This mixin holds choices and autocomplete symbols used for options.
|
|
1331
1391
|
*/
|
|
1332
|
-
declare class ApplicationCommandOptionWithChoicesAndAutocompleteMixin<
|
|
1392
|
+
declare class ApplicationCommandOptionWithChoicesAndAutocompleteMixin<ChoiceType extends number | string> {
|
|
1333
1393
|
/**
|
|
1334
1394
|
* The choices of this option.
|
|
1335
1395
|
*/
|
|
1336
|
-
readonly choices?: APIApplicationCommandOptionChoice<
|
|
1396
|
+
readonly choices?: APIApplicationCommandOptionChoice<ChoiceType>[];
|
|
1337
1397
|
/**
|
|
1338
1398
|
* Whether this option utilizes autocomplete.
|
|
1339
1399
|
*/
|
|
@@ -1349,13 +1409,13 @@ declare class ApplicationCommandOptionWithChoicesAndAutocompleteMixin<T extends
|
|
|
1349
1409
|
*
|
|
1350
1410
|
* @param choices - The choices to add
|
|
1351
1411
|
*/
|
|
1352
|
-
addChoices(...choices: APIApplicationCommandOptionChoice<
|
|
1412
|
+
addChoices(...choices: APIApplicationCommandOptionChoice<ChoiceType>[]): this;
|
|
1353
1413
|
/**
|
|
1354
1414
|
* Sets multiple choices for this option.
|
|
1355
1415
|
*
|
|
1356
1416
|
* @param choices - The choices to set
|
|
1357
1417
|
*/
|
|
1358
|
-
setChoices<Input extends APIApplicationCommandOptionChoice<
|
|
1418
|
+
setChoices<Input extends APIApplicationCommandOptionChoice<ChoiceType>[]>(...choices: Input): this;
|
|
1359
1419
|
/**
|
|
1360
1420
|
* Whether this option uses autocomplete.
|
|
1361
1421
|
*
|
|
@@ -1754,7 +1814,7 @@ declare function validateRequiredParameters$1(name: string, description: string,
|
|
|
1754
1814
|
declare function validateDefaultPermission$1(value: unknown): asserts value is boolean;
|
|
1755
1815
|
declare function validateRequired(required: unknown): asserts required is boolean;
|
|
1756
1816
|
declare function validateChoicesLength(amountAdding: number, choices?: APIApplicationCommandOptionChoice[]): void;
|
|
1757
|
-
declare function assertReturnOfBuilder<
|
|
1817
|
+
declare function assertReturnOfBuilder<ReturnType extends ApplicationCommandOptionBase | SlashCommandSubcommandBuilder | SlashCommandSubcommandGroupBuilder>(input: unknown, ExpectedInstanceOf: new () => ReturnType): asserts input is ReturnType;
|
|
1758
1818
|
declare const localizationMapPredicate: _sapphire_shapeshift.UnionValidator<_sapphire_shapeshift.UndefinedToOptional<Partial<Record<"id" | "en-US" | "en-GB" | "bg" | "zh-CN" | "zh-TW" | "hr" | "cs" | "da" | "nl" | "fi" | "fr" | "de" | "el" | "hi" | "hu" | "it" | "ja" | "ko" | "lt" | "no" | "pl" | "pt-BR" | "ro" | "ru" | "es-ES" | "sv-SE" | "th" | "tr" | "uk" | "vi", string | null>>> | null | undefined>;
|
|
1759
1819
|
declare function validateLocalizationMap(value: unknown): asserts value is LocalizationMap;
|
|
1760
1820
|
declare function validateDMPermission$1(value: unknown): asserts value is boolean | null | undefined;
|
package/dist/index.d.ts
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, APIActionRowComponentTypes, APIBaseComponent, ComponentType, APIButtonComponent, APISelectMenuComponent, APIChannelSelectComponent, APIMentionableSelectComponent, APIRoleSelectComponent, APIStringSelectComponent, APIUserSelectComponent, APITextInputComponent, TextInputStyle, APIMessageActionRowComponent, APIModalActionRowComponent, APIModalComponent, APIMessageComponent, APIModalInteractionResponseCallbackData, LocalizationMap, LocaleString, ApplicationCommandOptionType, APIApplicationCommandBasicOption, APIApplicationCommandAttachmentOption, APIApplicationCommandBooleanOption, APIApplicationCommandChannelOption, APIApplicationCommandOptionChoice, APIApplicationCommandIntegerOption, APIApplicationCommandMentionableOption, APIApplicationCommandNumberOption, APIApplicationCommandRoleOption, APIApplicationCommandStringOption, APIApplicationCommandUserOption, APIApplicationCommandSubcommandGroupOption, APIApplicationCommandSubcommandOption, Permissions, RESTPostAPIChatInputApplicationCommandsJSONBody, APIApplicationCommandOption, Locale, ApplicationCommandType, RESTPostAPIContextMenuApplicationCommandsJSONBody } from 'discord-api-types/v10';
|
|
2
|
+
import { APIEmbedField, APIEmbedAuthor, APIEmbedFooter, APIEmbedImage, APIEmbed, APISelectMenuOption, APIMessageComponentEmoji, ButtonStyle, ChannelType, APIActionRowComponent, APIActionRowComponentTypes, APIBaseComponent, ComponentType, APIButtonComponent, APISelectMenuComponent, APIChannelSelectComponent, Snowflake, APIMentionableSelectComponent, APISelectMenuDefaultValue, SelectMenuDefaultValueType, APIRoleSelectComponent, APIStringSelectComponent, APIUserSelectComponent, APITextInputComponent, TextInputStyle, APIMessageActionRowComponent, APIModalActionRowComponent, APIModalComponent, APIMessageComponent, APIModalInteractionResponseCallbackData, LocalizationMap, LocaleString, ApplicationCommandOptionType, APIApplicationCommandBasicOption, APIApplicationCommandAttachmentOption, APIApplicationCommandBooleanOption, APIApplicationCommandChannelOption, APIApplicationCommandOptionChoice, APIApplicationCommandIntegerOption, APIApplicationCommandMentionableOption, APIApplicationCommandNumberOption, APIApplicationCommandRoleOption, APIApplicationCommandStringOption, APIApplicationCommandUserOption, APIApplicationCommandSubcommandGroupOption, APIApplicationCommandSubcommandOption, Permissions, RESTPostAPIChatInputApplicationCommandsJSONBody, 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
|
|
|
@@ -96,10 +96,10 @@ declare namespace Assertions$5 {
|
|
|
96
96
|
/**
|
|
97
97
|
* Normalizes data that is a rest parameter or an array into an array with a depth of 1.
|
|
98
98
|
*
|
|
99
|
-
* @typeParam
|
|
99
|
+
* @typeParam ItemType - The data that must satisfy {@link RestOrArray}.
|
|
100
100
|
* @param arr - The (possibly variadic) data to normalize
|
|
101
101
|
*/
|
|
102
|
-
declare function normalizeArray<
|
|
102
|
+
declare function normalizeArray<ItemType>(arr: RestOrArray<ItemType>): ItemType[];
|
|
103
103
|
/**
|
|
104
104
|
* Represents data that may be an array or came from a rest parameter.
|
|
105
105
|
*
|
|
@@ -107,7 +107,7 @@ declare function normalizeArray<T>(arr: RestOrArray<T>): T[];
|
|
|
107
107
|
* This type is used throughout builders to ensure both an array and variadic arguments
|
|
108
108
|
* may be used. It is normalized with {@link normalizeArray}.
|
|
109
109
|
*/
|
|
110
|
-
type RestOrArray<
|
|
110
|
+
type RestOrArray<Type> = Type[] | [Type[]];
|
|
111
111
|
|
|
112
112
|
/**
|
|
113
113
|
* A tuple satisfying the RGB color model.
|
|
@@ -640,6 +640,18 @@ declare class ChannelSelectMenuBuilder extends BaseSelectMenuBuilder<APIChannelS
|
|
|
640
640
|
* @param types - The channel types to use
|
|
641
641
|
*/
|
|
642
642
|
setChannelTypes(...types: RestOrArray<ChannelType>): this;
|
|
643
|
+
/**
|
|
644
|
+
* Adds default channels to this auto populated select menu.
|
|
645
|
+
*
|
|
646
|
+
* @param channels - The channels to add
|
|
647
|
+
*/
|
|
648
|
+
addDefaultChannels(...channels: RestOrArray<Snowflake>): this;
|
|
649
|
+
/**
|
|
650
|
+
* Sets default channels to this auto populated select menu.
|
|
651
|
+
*
|
|
652
|
+
* @param channels - The channels to set
|
|
653
|
+
*/
|
|
654
|
+
setDefaultChannels(...channels: RestOrArray<Snowflake>): this;
|
|
643
655
|
/**
|
|
644
656
|
* {@inheritDoc BaseSelectMenuBuilder.toJSON}
|
|
645
657
|
*/
|
|
@@ -673,6 +685,30 @@ declare class MentionableSelectMenuBuilder extends BaseSelectMenuBuilder<APIMent
|
|
|
673
685
|
* ```
|
|
674
686
|
*/
|
|
675
687
|
constructor(data?: Partial<APIMentionableSelectComponent>);
|
|
688
|
+
/**
|
|
689
|
+
* Adds default roles to this auto populated select menu.
|
|
690
|
+
*
|
|
691
|
+
* @param roles - The roles to add
|
|
692
|
+
*/
|
|
693
|
+
addDefaultRoles(...roles: RestOrArray<Snowflake>): this;
|
|
694
|
+
/**
|
|
695
|
+
* Adds default users to this auto populated select menu.
|
|
696
|
+
*
|
|
697
|
+
* @param users - The users to add
|
|
698
|
+
*/
|
|
699
|
+
addDefaultUsers(...users: RestOrArray<Snowflake>): this;
|
|
700
|
+
/**
|
|
701
|
+
* Adds default values to this auto populated select menu.
|
|
702
|
+
*
|
|
703
|
+
* @param values - The values to add
|
|
704
|
+
*/
|
|
705
|
+
addDefaultValues(...values: RestOrArray<APISelectMenuDefaultValue<SelectMenuDefaultValueType.Role> | APISelectMenuDefaultValue<SelectMenuDefaultValueType.User>>): this;
|
|
706
|
+
/**
|
|
707
|
+
* Sets default values to this auto populated select menu.
|
|
708
|
+
*
|
|
709
|
+
* @param values - The values to set
|
|
710
|
+
*/
|
|
711
|
+
setDefaultValues(...values: RestOrArray<APISelectMenuDefaultValue<SelectMenuDefaultValueType.Role> | APISelectMenuDefaultValue<SelectMenuDefaultValueType.User>>): this;
|
|
676
712
|
}
|
|
677
713
|
|
|
678
714
|
/**
|
|
@@ -702,6 +738,18 @@ declare class RoleSelectMenuBuilder extends BaseSelectMenuBuilder<APIRoleSelectC
|
|
|
702
738
|
* ```
|
|
703
739
|
*/
|
|
704
740
|
constructor(data?: Partial<APIRoleSelectComponent>);
|
|
741
|
+
/**
|
|
742
|
+
* Adds default roles to this auto populated select menu.
|
|
743
|
+
*
|
|
744
|
+
* @param roles - The roles to add
|
|
745
|
+
*/
|
|
746
|
+
addDefaultRoles(...roles: RestOrArray<Snowflake>): this;
|
|
747
|
+
/**
|
|
748
|
+
* Sets default roles to this auto populated select menu.
|
|
749
|
+
*
|
|
750
|
+
* @param roles - The roles to set
|
|
751
|
+
*/
|
|
752
|
+
setDefaultRoles(...roles: RestOrArray<Snowflake>): this;
|
|
705
753
|
}
|
|
706
754
|
|
|
707
755
|
/**
|
|
@@ -817,6 +865,18 @@ declare class UserSelectMenuBuilder extends BaseSelectMenuBuilder<APIUserSelectC
|
|
|
817
865
|
* ```
|
|
818
866
|
*/
|
|
819
867
|
constructor(data?: Partial<APIUserSelectComponent>);
|
|
868
|
+
/**
|
|
869
|
+
* Adds default users to this auto populated select menu.
|
|
870
|
+
*
|
|
871
|
+
* @param users - The users to add
|
|
872
|
+
*/
|
|
873
|
+
addDefaultUsers(...users: RestOrArray<Snowflake>): this;
|
|
874
|
+
/**
|
|
875
|
+
* Sets default users to this auto populated select menu.
|
|
876
|
+
*
|
|
877
|
+
* @param users - The users to set
|
|
878
|
+
*/
|
|
879
|
+
setDefaultUsers(...users: RestOrArray<Snowflake>): this;
|
|
820
880
|
}
|
|
821
881
|
|
|
822
882
|
/**
|
|
@@ -930,13 +990,13 @@ type AnyComponentBuilder = MessageActionRowComponentBuilder | ModalActionRowComp
|
|
|
930
990
|
/**
|
|
931
991
|
* A builder that creates API-compatible JSON data for action rows.
|
|
932
992
|
*
|
|
933
|
-
* @typeParam
|
|
993
|
+
* @typeParam ComponentType - The types of components this action row holds
|
|
934
994
|
*/
|
|
935
|
-
declare class ActionRowBuilder<
|
|
995
|
+
declare class ActionRowBuilder<ComponentType extends AnyComponentBuilder> extends ComponentBuilder<APIActionRowComponent<APIMessageActionRowComponent | APIModalActionRowComponent>> {
|
|
936
996
|
/**
|
|
937
997
|
* The components within this action row.
|
|
938
998
|
*/
|
|
939
|
-
readonly components:
|
|
999
|
+
readonly components: ComponentType[];
|
|
940
1000
|
/**
|
|
941
1001
|
* Creates a new action row from API data.
|
|
942
1002
|
*
|
|
@@ -977,17 +1037,17 @@ declare class ActionRowBuilder<T extends AnyComponentBuilder> extends ComponentB
|
|
|
977
1037
|
*
|
|
978
1038
|
* @param components - The components to add
|
|
979
1039
|
*/
|
|
980
|
-
addComponents(...components: RestOrArray<
|
|
1040
|
+
addComponents(...components: RestOrArray<ComponentType>): this;
|
|
981
1041
|
/**
|
|
982
1042
|
* Sets components for this action row.
|
|
983
1043
|
*
|
|
984
1044
|
* @param components - The components to set
|
|
985
1045
|
*/
|
|
986
|
-
setComponents(...components: RestOrArray<
|
|
1046
|
+
setComponents(...components: RestOrArray<ComponentType>): this;
|
|
987
1047
|
/**
|
|
988
1048
|
* {@inheritDoc ComponentBuilder.toJSON}
|
|
989
1049
|
*/
|
|
990
|
-
toJSON(): APIActionRowComponent<ReturnType<
|
|
1050
|
+
toJSON(): APIActionRowComponent<ReturnType<ComponentType['toJSON']>>;
|
|
991
1051
|
}
|
|
992
1052
|
|
|
993
1053
|
/**
|
|
@@ -1030,19 +1090,19 @@ interface MappedComponentTypes {
|
|
|
1030
1090
|
/**
|
|
1031
1091
|
* Factory for creating components from API data.
|
|
1032
1092
|
*
|
|
1033
|
-
* @typeParam
|
|
1093
|
+
* @typeParam ComponentType - The type of component to use
|
|
1034
1094
|
* @param data - The API data to transform to a component class
|
|
1035
1095
|
*/
|
|
1036
|
-
declare function createComponentBuilder<
|
|
1037
|
-
type:
|
|
1038
|
-
}): MappedComponentTypes[
|
|
1096
|
+
declare function createComponentBuilder<ComponentType extends keyof MappedComponentTypes>(data: (APIModalComponent | APIMessageComponent) & {
|
|
1097
|
+
type: ComponentType;
|
|
1098
|
+
}): MappedComponentTypes[ComponentType];
|
|
1039
1099
|
/**
|
|
1040
1100
|
* Factory for creating components from API data.
|
|
1041
1101
|
*
|
|
1042
|
-
* @typeParam
|
|
1102
|
+
* @typeParam ComponentBuilder - The type of component to use
|
|
1043
1103
|
* @param data - The API data to transform to a component class
|
|
1044
1104
|
*/
|
|
1045
|
-
declare function createComponentBuilder<
|
|
1105
|
+
declare function createComponentBuilder<ComponentBuilder extends MessageComponentBuilder | ModalComponentBuilder>(data: ComponentBuilder): ComponentBuilder;
|
|
1046
1106
|
|
|
1047
1107
|
declare const textInputStyleValidator: _sapphire_shapeshift.NativeEnumValidator<typeof TextInputStyle>;
|
|
1048
1108
|
declare const minLengthValidator: _sapphire_shapeshift.NumberValidator<number>;
|
|
@@ -1329,11 +1389,11 @@ declare abstract class ApplicationCommandNumericOptionMinMaxValueMixin {
|
|
|
1329
1389
|
/**
|
|
1330
1390
|
* This mixin holds choices and autocomplete symbols used for options.
|
|
1331
1391
|
*/
|
|
1332
|
-
declare class ApplicationCommandOptionWithChoicesAndAutocompleteMixin<
|
|
1392
|
+
declare class ApplicationCommandOptionWithChoicesAndAutocompleteMixin<ChoiceType extends number | string> {
|
|
1333
1393
|
/**
|
|
1334
1394
|
* The choices of this option.
|
|
1335
1395
|
*/
|
|
1336
|
-
readonly choices?: APIApplicationCommandOptionChoice<
|
|
1396
|
+
readonly choices?: APIApplicationCommandOptionChoice<ChoiceType>[];
|
|
1337
1397
|
/**
|
|
1338
1398
|
* Whether this option utilizes autocomplete.
|
|
1339
1399
|
*/
|
|
@@ -1349,13 +1409,13 @@ declare class ApplicationCommandOptionWithChoicesAndAutocompleteMixin<T extends
|
|
|
1349
1409
|
*
|
|
1350
1410
|
* @param choices - The choices to add
|
|
1351
1411
|
*/
|
|
1352
|
-
addChoices(...choices: APIApplicationCommandOptionChoice<
|
|
1412
|
+
addChoices(...choices: APIApplicationCommandOptionChoice<ChoiceType>[]): this;
|
|
1353
1413
|
/**
|
|
1354
1414
|
* Sets multiple choices for this option.
|
|
1355
1415
|
*
|
|
1356
1416
|
* @param choices - The choices to set
|
|
1357
1417
|
*/
|
|
1358
|
-
setChoices<Input extends APIApplicationCommandOptionChoice<
|
|
1418
|
+
setChoices<Input extends APIApplicationCommandOptionChoice<ChoiceType>[]>(...choices: Input): this;
|
|
1359
1419
|
/**
|
|
1360
1420
|
* Whether this option uses autocomplete.
|
|
1361
1421
|
*
|
|
@@ -1754,7 +1814,7 @@ declare function validateRequiredParameters$1(name: string, description: string,
|
|
|
1754
1814
|
declare function validateDefaultPermission$1(value: unknown): asserts value is boolean;
|
|
1755
1815
|
declare function validateRequired(required: unknown): asserts required is boolean;
|
|
1756
1816
|
declare function validateChoicesLength(amountAdding: number, choices?: APIApplicationCommandOptionChoice[]): void;
|
|
1757
|
-
declare function assertReturnOfBuilder<
|
|
1817
|
+
declare function assertReturnOfBuilder<ReturnType extends ApplicationCommandOptionBase | SlashCommandSubcommandBuilder | SlashCommandSubcommandGroupBuilder>(input: unknown, ExpectedInstanceOf: new () => ReturnType): asserts input is ReturnType;
|
|
1758
1818
|
declare const localizationMapPredicate: _sapphire_shapeshift.UnionValidator<_sapphire_shapeshift.UndefinedToOptional<Partial<Record<"id" | "en-US" | "en-GB" | "bg" | "zh-CN" | "zh-TW" | "hr" | "cs" | "da" | "nl" | "fi" | "fr" | "de" | "el" | "hi" | "hu" | "it" | "ja" | "ko" | "lt" | "no" | "pl" | "pt-BR" | "ro" | "ru" | "es-ES" | "sv-SE" | "th" | "tr" | "uk" | "vi", string | null>>> | null | undefined>;
|
|
1759
1819
|
declare function validateLocalizationMap(value: unknown): asserts value is LocalizationMap;
|
|
1760
1820
|
declare function validateDMPermission$1(value: unknown): asserts value is boolean | null | undefined;
|
package/dist/index.js
CHANGED
|
@@ -820,6 +820,37 @@ var ChannelSelectMenuBuilder = class extends BaseSelectMenuBuilder {
|
|
|
820
820
|
this.data.channel_types.splice(0, this.data.channel_types.length, ...channelTypesValidator.parse(normalizedTypes));
|
|
821
821
|
return this;
|
|
822
822
|
}
|
|
823
|
+
/**
|
|
824
|
+
* Adds default channels to this auto populated select menu.
|
|
825
|
+
*
|
|
826
|
+
* @param channels - The channels to add
|
|
827
|
+
*/
|
|
828
|
+
addDefaultChannels(...channels) {
|
|
829
|
+
const normalizedValues = normalizeArray(channels);
|
|
830
|
+
optionsLengthValidator.parse((this.data.default_values?.length ?? 0) + normalizedValues.length);
|
|
831
|
+
this.data.default_values ??= [];
|
|
832
|
+
this.data.default_values.push(
|
|
833
|
+
...normalizedValues.map((id) => ({
|
|
834
|
+
id,
|
|
835
|
+
type: import_v103.SelectMenuDefaultValueType.Channel
|
|
836
|
+
}))
|
|
837
|
+
);
|
|
838
|
+
return this;
|
|
839
|
+
}
|
|
840
|
+
/**
|
|
841
|
+
* Sets default channels to this auto populated select menu.
|
|
842
|
+
*
|
|
843
|
+
* @param channels - The channels to set
|
|
844
|
+
*/
|
|
845
|
+
setDefaultChannels(...channels) {
|
|
846
|
+
const normalizedValues = normalizeArray(channels);
|
|
847
|
+
optionsLengthValidator.parse(normalizedValues.length);
|
|
848
|
+
this.data.default_values = normalizedValues.map((id) => ({
|
|
849
|
+
id,
|
|
850
|
+
type: import_v103.SelectMenuDefaultValueType.Channel
|
|
851
|
+
}));
|
|
852
|
+
return this;
|
|
853
|
+
}
|
|
823
854
|
/**
|
|
824
855
|
* {@inheritDoc BaseSelectMenuBuilder.toJSON}
|
|
825
856
|
*/
|
|
@@ -862,6 +893,63 @@ var MentionableSelectMenuBuilder = class extends BaseSelectMenuBuilder {
|
|
|
862
893
|
constructor(data) {
|
|
863
894
|
super({ ...data, type: import_v104.ComponentType.MentionableSelect });
|
|
864
895
|
}
|
|
896
|
+
/**
|
|
897
|
+
* Adds default roles to this auto populated select menu.
|
|
898
|
+
*
|
|
899
|
+
* @param roles - The roles to add
|
|
900
|
+
*/
|
|
901
|
+
addDefaultRoles(...roles) {
|
|
902
|
+
const normalizedValues = normalizeArray(roles);
|
|
903
|
+
optionsLengthValidator.parse((this.data.default_values?.length ?? 0) + normalizedValues.length);
|
|
904
|
+
this.data.default_values ??= [];
|
|
905
|
+
this.data.default_values.push(
|
|
906
|
+
...normalizedValues.map((id) => ({
|
|
907
|
+
id,
|
|
908
|
+
type: import_v104.SelectMenuDefaultValueType.Role
|
|
909
|
+
}))
|
|
910
|
+
);
|
|
911
|
+
return this;
|
|
912
|
+
}
|
|
913
|
+
/**
|
|
914
|
+
* Adds default users to this auto populated select menu.
|
|
915
|
+
*
|
|
916
|
+
* @param users - The users to add
|
|
917
|
+
*/
|
|
918
|
+
addDefaultUsers(...users) {
|
|
919
|
+
const normalizedValues = normalizeArray(users);
|
|
920
|
+
optionsLengthValidator.parse((this.data.default_values?.length ?? 0) + normalizedValues.length);
|
|
921
|
+
this.data.default_values ??= [];
|
|
922
|
+
this.data.default_values.push(
|
|
923
|
+
...normalizedValues.map((id) => ({
|
|
924
|
+
id,
|
|
925
|
+
type: import_v104.SelectMenuDefaultValueType.User
|
|
926
|
+
}))
|
|
927
|
+
);
|
|
928
|
+
return this;
|
|
929
|
+
}
|
|
930
|
+
/**
|
|
931
|
+
* Adds default values to this auto populated select menu.
|
|
932
|
+
*
|
|
933
|
+
* @param values - The values to add
|
|
934
|
+
*/
|
|
935
|
+
addDefaultValues(...values) {
|
|
936
|
+
const normalizedValues = normalizeArray(values);
|
|
937
|
+
optionsLengthValidator.parse((this.data.default_values?.length ?? 0) + normalizedValues.length);
|
|
938
|
+
this.data.default_values ??= [];
|
|
939
|
+
this.data.default_values.push(...normalizedValues);
|
|
940
|
+
return this;
|
|
941
|
+
}
|
|
942
|
+
/**
|
|
943
|
+
* Sets default values to this auto populated select menu.
|
|
944
|
+
*
|
|
945
|
+
* @param values - The values to set
|
|
946
|
+
*/
|
|
947
|
+
setDefaultValues(...values) {
|
|
948
|
+
const normalizedValues = normalizeArray(values);
|
|
949
|
+
optionsLengthValidator.parse(normalizedValues.length);
|
|
950
|
+
this.data.default_values = normalizedValues.slice();
|
|
951
|
+
return this;
|
|
952
|
+
}
|
|
865
953
|
};
|
|
866
954
|
|
|
867
955
|
// src/components/selectMenu/RoleSelectMenu.ts
|
|
@@ -895,6 +983,37 @@ var RoleSelectMenuBuilder = class extends BaseSelectMenuBuilder {
|
|
|
895
983
|
constructor(data) {
|
|
896
984
|
super({ ...data, type: import_v105.ComponentType.RoleSelect });
|
|
897
985
|
}
|
|
986
|
+
/**
|
|
987
|
+
* Adds default roles to this auto populated select menu.
|
|
988
|
+
*
|
|
989
|
+
* @param roles - The roles to add
|
|
990
|
+
*/
|
|
991
|
+
addDefaultRoles(...roles) {
|
|
992
|
+
const normalizedValues = normalizeArray(roles);
|
|
993
|
+
optionsLengthValidator.parse((this.data.default_values?.length ?? 0) + normalizedValues.length);
|
|
994
|
+
this.data.default_values ??= [];
|
|
995
|
+
this.data.default_values.push(
|
|
996
|
+
...normalizedValues.map((id) => ({
|
|
997
|
+
id,
|
|
998
|
+
type: import_v105.SelectMenuDefaultValueType.Role
|
|
999
|
+
}))
|
|
1000
|
+
);
|
|
1001
|
+
return this;
|
|
1002
|
+
}
|
|
1003
|
+
/**
|
|
1004
|
+
* Sets default roles to this auto populated select menu.
|
|
1005
|
+
*
|
|
1006
|
+
* @param roles - The roles to set
|
|
1007
|
+
*/
|
|
1008
|
+
setDefaultRoles(...roles) {
|
|
1009
|
+
const normalizedValues = normalizeArray(roles);
|
|
1010
|
+
optionsLengthValidator.parse(normalizedValues.length);
|
|
1011
|
+
this.data.default_values = normalizedValues.map((id) => ({
|
|
1012
|
+
id,
|
|
1013
|
+
type: import_v105.SelectMenuDefaultValueType.Role
|
|
1014
|
+
}));
|
|
1015
|
+
return this;
|
|
1016
|
+
}
|
|
898
1017
|
};
|
|
899
1018
|
|
|
900
1019
|
// src/components/selectMenu/StringSelectMenu.ts
|
|
@@ -1050,6 +1169,37 @@ var UserSelectMenuBuilder = class extends BaseSelectMenuBuilder {
|
|
|
1050
1169
|
constructor(data) {
|
|
1051
1170
|
super({ ...data, type: import_v107.ComponentType.UserSelect });
|
|
1052
1171
|
}
|
|
1172
|
+
/**
|
|
1173
|
+
* Adds default users to this auto populated select menu.
|
|
1174
|
+
*
|
|
1175
|
+
* @param users - The users to add
|
|
1176
|
+
*/
|
|
1177
|
+
addDefaultUsers(...users) {
|
|
1178
|
+
const normalizedValues = normalizeArray(users);
|
|
1179
|
+
optionsLengthValidator.parse((this.data.default_values?.length ?? 0) + normalizedValues.length);
|
|
1180
|
+
this.data.default_values ??= [];
|
|
1181
|
+
this.data.default_values.push(
|
|
1182
|
+
...normalizedValues.map((id) => ({
|
|
1183
|
+
id,
|
|
1184
|
+
type: import_v107.SelectMenuDefaultValueType.User
|
|
1185
|
+
}))
|
|
1186
|
+
);
|
|
1187
|
+
return this;
|
|
1188
|
+
}
|
|
1189
|
+
/**
|
|
1190
|
+
* Sets default users to this auto populated select menu.
|
|
1191
|
+
*
|
|
1192
|
+
* @param users - The users to set
|
|
1193
|
+
*/
|
|
1194
|
+
setDefaultUsers(...users) {
|
|
1195
|
+
const normalizedValues = normalizeArray(users);
|
|
1196
|
+
optionsLengthValidator.parse(normalizedValues.length);
|
|
1197
|
+
this.data.default_values = normalizedValues.map((id) => ({
|
|
1198
|
+
id,
|
|
1199
|
+
type: import_v107.SelectMenuDefaultValueType.User
|
|
1200
|
+
}));
|
|
1201
|
+
return this;
|
|
1202
|
+
}
|
|
1053
1203
|
};
|
|
1054
1204
|
|
|
1055
1205
|
// src/components/textInput/TextInput.ts
|
|
@@ -2558,7 +2708,7 @@ function embedLength(data) {
|
|
|
2558
2708
|
__name(embedLength, "embedLength");
|
|
2559
2709
|
|
|
2560
2710
|
// src/index.ts
|
|
2561
|
-
var version = "1.7.0
|
|
2711
|
+
var version = "1.7.0";
|
|
2562
2712
|
// Annotate the CommonJS export names for ESM import in node:
|
|
2563
2713
|
0 && (module.exports = {
|
|
2564
2714
|
ActionRowBuilder,
|