@discordjs/builders 2.0.0-dev.1728043483-12e510671 → 2.0.0-dev.1728259953-8ab4124ef
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 +11 -1
- package/dist/index.d.ts +11 -1
- package/dist/index.js +39 -65
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +38 -65
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -1
package/dist/index.d.mts
CHANGED
|
@@ -8178,6 +8178,16 @@ declare function disableValidators(): boolean;
|
|
|
8178
8178
|
* Checks whether validation is occurring.
|
|
8179
8179
|
*/
|
|
8180
8180
|
declare function isValidationEnabled(): boolean;
|
|
8181
|
+
/**
|
|
8182
|
+
* Parses a value with a given validator, accounting for wether validation is enabled.
|
|
8183
|
+
*
|
|
8184
|
+
* @param validator - The zod validator to use
|
|
8185
|
+
* @param value - The value to parse
|
|
8186
|
+
* @param validationOverride - Force validation to run/not run regardless of your global preference
|
|
8187
|
+
* @returns The result from parsing
|
|
8188
|
+
* @internal
|
|
8189
|
+
*/
|
|
8190
|
+
declare function validate<Validator extends z.ZodTypeAny>(validator: Validator, value: unknown, validationOverride?: boolean): z.output<Validator>;
|
|
8181
8191
|
|
|
8182
8192
|
declare const customIdPredicate: z.ZodString;
|
|
8183
8193
|
declare const memberPermissionsPredicate: z.ZodBigInt;
|
|
@@ -8258,4 +8268,4 @@ declare const refineURLPredicate: (allowedProtocols: string[]) => (value: string
|
|
|
8258
8268
|
*/
|
|
8259
8269
|
declare const version: string;
|
|
8260
8270
|
|
|
8261
|
-
export { ActionRowBuilder, type ActionRowBuilderData, type AnyAPIActionRowComponent, type AnyActionRowComponentBuilder, type ApplicationCommandNumericOptionMinMaxValueData, ApplicationCommandNumericOptionMinMaxValueMixin, ApplicationCommandOptionAllowedChannelTypes, ApplicationCommandOptionBase, type ApplicationCommandOptionBaseData, type ApplicationCommandOptionChannelTypesData, ApplicationCommandOptionChannelTypesMixin, type ApplicationCommandOptionWithAutocompleteData, ApplicationCommandOptionWithAutocompleteMixin, type ApplicationCommandOptionWithChoicesData, ApplicationCommandOptionWithChoicesMixin, type AutocompletableOptions, BaseButtonBuilder, BaseSelectMenuBuilder, type ButtonBuilder, ChannelSelectMenuBuilder, ChatInputCommandAttachmentOption, ChatInputCommandBooleanOption, ChatInputCommandBuilder, ChatInputCommandChannelOption, ChatInputCommandIntegerOption, ChatInputCommandMentionableOption, ChatInputCommandNumberOption, ChatInputCommandRoleOption, ChatInputCommandStringOption, ChatInputCommandSubcommandBuilder, ChatInputCommandSubcommandGroupBuilder, type ChatInputCommandSubcommandGroupData, ChatInputCommandUserOption, CommandBuilder, type CommandData, ComponentBuilder, ContextMenuCommandBuilder, type ContextMenuCommandType, CustomIdButtonBuilder, type CustomIdButtonStyle, DangerButtonBuilder, EmbedAuthorBuilder, EmbedBuilder, type EmbedBuilderData, EmbedFieldBuilder, EmbedFooterBuilder, type EmojiOrLabelButtonData, EmojiOrLabelButtonMixin, LinkButtonBuilder, type MappedComponentTypes, MentionableSelectMenuBuilder, type MessageActionRowComponentBuilder, type MessageComponentBuilder, MessageContextCommandBuilder, type ModalActionRowComponentBuilder, ModalBuilder, type ModalBuilderData, type ModalComponentBuilder, PremiumButtonBuilder, PrimaryButtonBuilder, type RestOrArray, RoleSelectMenuBuilder, SecondaryButtonBuilder, SharedChatInputCommandOptions, type SharedChatInputCommandOptionsData, SharedChatInputCommandSubcommands, type SharedChatInputCommandSubcommandsData, SharedName, SharedNameAndDescription, type SharedNameAndDescriptionData, type SharedNameData, StringSelectMenuBuilder, type StringSelectMenuData, StringSelectMenuOptionBuilder, SuccessButtonBuilder, TextInputBuilder, UserContextCommandBuilder, UserSelectMenuBuilder, actionRowPredicate, basicOptionPredicate, buttonPredicate, channelOptionPredicate, chatInputCommandPredicate, chatInputCommandSubcommandGroupPredicate, chatInputCommandSubcommandPredicate, createComponentBuilder, customIdPredicate, disableValidators, embedAuthorPredicate, embedFieldPredicate, embedFooterPredicate, embedLength, embedPredicate, emojiPredicate, enableValidators, integerOptionPredicate, isValidationEnabled, localeMapPredicate, memberPermissionsPredicate, messageCommandPredicate, modalPredicate, normalizeArray, numberOptionPredicate, refineURLPredicate, selectMenuChannelPredicate, selectMenuMentionablePredicate, selectMenuRolePredicate, selectMenuStringOptionPredicate, selectMenuStringPredicate, selectMenuUserPredicate, stringOptionPredicate, textInputPredicate, userCommandPredicate, version };
|
|
8271
|
+
export { ActionRowBuilder, type ActionRowBuilderData, type AnyAPIActionRowComponent, type AnyActionRowComponentBuilder, type ApplicationCommandNumericOptionMinMaxValueData, ApplicationCommandNumericOptionMinMaxValueMixin, ApplicationCommandOptionAllowedChannelTypes, ApplicationCommandOptionBase, type ApplicationCommandOptionBaseData, type ApplicationCommandOptionChannelTypesData, ApplicationCommandOptionChannelTypesMixin, type ApplicationCommandOptionWithAutocompleteData, ApplicationCommandOptionWithAutocompleteMixin, type ApplicationCommandOptionWithChoicesData, ApplicationCommandOptionWithChoicesMixin, type AutocompletableOptions, BaseButtonBuilder, BaseSelectMenuBuilder, type ButtonBuilder, ChannelSelectMenuBuilder, ChatInputCommandAttachmentOption, ChatInputCommandBooleanOption, ChatInputCommandBuilder, ChatInputCommandChannelOption, ChatInputCommandIntegerOption, ChatInputCommandMentionableOption, ChatInputCommandNumberOption, ChatInputCommandRoleOption, ChatInputCommandStringOption, ChatInputCommandSubcommandBuilder, ChatInputCommandSubcommandGroupBuilder, type ChatInputCommandSubcommandGroupData, ChatInputCommandUserOption, CommandBuilder, type CommandData, ComponentBuilder, ContextMenuCommandBuilder, type ContextMenuCommandType, CustomIdButtonBuilder, type CustomIdButtonStyle, DangerButtonBuilder, EmbedAuthorBuilder, EmbedBuilder, type EmbedBuilderData, EmbedFieldBuilder, EmbedFooterBuilder, type EmojiOrLabelButtonData, EmojiOrLabelButtonMixin, LinkButtonBuilder, type MappedComponentTypes, MentionableSelectMenuBuilder, type MessageActionRowComponentBuilder, type MessageComponentBuilder, MessageContextCommandBuilder, type ModalActionRowComponentBuilder, ModalBuilder, type ModalBuilderData, type ModalComponentBuilder, PremiumButtonBuilder, PrimaryButtonBuilder, type RestOrArray, RoleSelectMenuBuilder, SecondaryButtonBuilder, SharedChatInputCommandOptions, type SharedChatInputCommandOptionsData, SharedChatInputCommandSubcommands, type SharedChatInputCommandSubcommandsData, SharedName, SharedNameAndDescription, type SharedNameAndDescriptionData, type SharedNameData, StringSelectMenuBuilder, type StringSelectMenuData, StringSelectMenuOptionBuilder, SuccessButtonBuilder, TextInputBuilder, UserContextCommandBuilder, UserSelectMenuBuilder, actionRowPredicate, basicOptionPredicate, buttonPredicate, channelOptionPredicate, chatInputCommandPredicate, chatInputCommandSubcommandGroupPredicate, chatInputCommandSubcommandPredicate, createComponentBuilder, customIdPredicate, disableValidators, embedAuthorPredicate, embedFieldPredicate, embedFooterPredicate, embedLength, embedPredicate, emojiPredicate, enableValidators, integerOptionPredicate, isValidationEnabled, localeMapPredicate, memberPermissionsPredicate, messageCommandPredicate, modalPredicate, normalizeArray, numberOptionPredicate, refineURLPredicate, selectMenuChannelPredicate, selectMenuMentionablePredicate, selectMenuRolePredicate, selectMenuStringOptionPredicate, selectMenuStringPredicate, selectMenuUserPredicate, stringOptionPredicate, textInputPredicate, userCommandPredicate, validate, version };
|
package/dist/index.d.ts
CHANGED
|
@@ -8178,6 +8178,16 @@ declare function disableValidators(): boolean;
|
|
|
8178
8178
|
* Checks whether validation is occurring.
|
|
8179
8179
|
*/
|
|
8180
8180
|
declare function isValidationEnabled(): boolean;
|
|
8181
|
+
/**
|
|
8182
|
+
* Parses a value with a given validator, accounting for wether validation is enabled.
|
|
8183
|
+
*
|
|
8184
|
+
* @param validator - The zod validator to use
|
|
8185
|
+
* @param value - The value to parse
|
|
8186
|
+
* @param validationOverride - Force validation to run/not run regardless of your global preference
|
|
8187
|
+
* @returns The result from parsing
|
|
8188
|
+
* @internal
|
|
8189
|
+
*/
|
|
8190
|
+
declare function validate<Validator extends z.ZodTypeAny>(validator: Validator, value: unknown, validationOverride?: boolean): z.output<Validator>;
|
|
8181
8191
|
|
|
8182
8192
|
declare const customIdPredicate: z.ZodString;
|
|
8183
8193
|
declare const memberPermissionsPredicate: z.ZodBigInt;
|
|
@@ -8258,4 +8268,4 @@ declare const refineURLPredicate: (allowedProtocols: string[]) => (value: string
|
|
|
8258
8268
|
*/
|
|
8259
8269
|
declare const version: string;
|
|
8260
8270
|
|
|
8261
|
-
export { ActionRowBuilder, type ActionRowBuilderData, type AnyAPIActionRowComponent, type AnyActionRowComponentBuilder, type ApplicationCommandNumericOptionMinMaxValueData, ApplicationCommandNumericOptionMinMaxValueMixin, ApplicationCommandOptionAllowedChannelTypes, ApplicationCommandOptionBase, type ApplicationCommandOptionBaseData, type ApplicationCommandOptionChannelTypesData, ApplicationCommandOptionChannelTypesMixin, type ApplicationCommandOptionWithAutocompleteData, ApplicationCommandOptionWithAutocompleteMixin, type ApplicationCommandOptionWithChoicesData, ApplicationCommandOptionWithChoicesMixin, type AutocompletableOptions, BaseButtonBuilder, BaseSelectMenuBuilder, type ButtonBuilder, ChannelSelectMenuBuilder, ChatInputCommandAttachmentOption, ChatInputCommandBooleanOption, ChatInputCommandBuilder, ChatInputCommandChannelOption, ChatInputCommandIntegerOption, ChatInputCommandMentionableOption, ChatInputCommandNumberOption, ChatInputCommandRoleOption, ChatInputCommandStringOption, ChatInputCommandSubcommandBuilder, ChatInputCommandSubcommandGroupBuilder, type ChatInputCommandSubcommandGroupData, ChatInputCommandUserOption, CommandBuilder, type CommandData, ComponentBuilder, ContextMenuCommandBuilder, type ContextMenuCommandType, CustomIdButtonBuilder, type CustomIdButtonStyle, DangerButtonBuilder, EmbedAuthorBuilder, EmbedBuilder, type EmbedBuilderData, EmbedFieldBuilder, EmbedFooterBuilder, type EmojiOrLabelButtonData, EmojiOrLabelButtonMixin, LinkButtonBuilder, type MappedComponentTypes, MentionableSelectMenuBuilder, type MessageActionRowComponentBuilder, type MessageComponentBuilder, MessageContextCommandBuilder, type ModalActionRowComponentBuilder, ModalBuilder, type ModalBuilderData, type ModalComponentBuilder, PremiumButtonBuilder, PrimaryButtonBuilder, type RestOrArray, RoleSelectMenuBuilder, SecondaryButtonBuilder, SharedChatInputCommandOptions, type SharedChatInputCommandOptionsData, SharedChatInputCommandSubcommands, type SharedChatInputCommandSubcommandsData, SharedName, SharedNameAndDescription, type SharedNameAndDescriptionData, type SharedNameData, StringSelectMenuBuilder, type StringSelectMenuData, StringSelectMenuOptionBuilder, SuccessButtonBuilder, TextInputBuilder, UserContextCommandBuilder, UserSelectMenuBuilder, actionRowPredicate, basicOptionPredicate, buttonPredicate, channelOptionPredicate, chatInputCommandPredicate, chatInputCommandSubcommandGroupPredicate, chatInputCommandSubcommandPredicate, createComponentBuilder, customIdPredicate, disableValidators, embedAuthorPredicate, embedFieldPredicate, embedFooterPredicate, embedLength, embedPredicate, emojiPredicate, enableValidators, integerOptionPredicate, isValidationEnabled, localeMapPredicate, memberPermissionsPredicate, messageCommandPredicate, modalPredicate, normalizeArray, numberOptionPredicate, refineURLPredicate, selectMenuChannelPredicate, selectMenuMentionablePredicate, selectMenuRolePredicate, selectMenuStringOptionPredicate, selectMenuStringPredicate, selectMenuUserPredicate, stringOptionPredicate, textInputPredicate, userCommandPredicate, version };
|
|
8271
|
+
export { ActionRowBuilder, type ActionRowBuilderData, type AnyAPIActionRowComponent, type AnyActionRowComponentBuilder, type ApplicationCommandNumericOptionMinMaxValueData, ApplicationCommandNumericOptionMinMaxValueMixin, ApplicationCommandOptionAllowedChannelTypes, ApplicationCommandOptionBase, type ApplicationCommandOptionBaseData, type ApplicationCommandOptionChannelTypesData, ApplicationCommandOptionChannelTypesMixin, type ApplicationCommandOptionWithAutocompleteData, ApplicationCommandOptionWithAutocompleteMixin, type ApplicationCommandOptionWithChoicesData, ApplicationCommandOptionWithChoicesMixin, type AutocompletableOptions, BaseButtonBuilder, BaseSelectMenuBuilder, type ButtonBuilder, ChannelSelectMenuBuilder, ChatInputCommandAttachmentOption, ChatInputCommandBooleanOption, ChatInputCommandBuilder, ChatInputCommandChannelOption, ChatInputCommandIntegerOption, ChatInputCommandMentionableOption, ChatInputCommandNumberOption, ChatInputCommandRoleOption, ChatInputCommandStringOption, ChatInputCommandSubcommandBuilder, ChatInputCommandSubcommandGroupBuilder, type ChatInputCommandSubcommandGroupData, ChatInputCommandUserOption, CommandBuilder, type CommandData, ComponentBuilder, ContextMenuCommandBuilder, type ContextMenuCommandType, CustomIdButtonBuilder, type CustomIdButtonStyle, DangerButtonBuilder, EmbedAuthorBuilder, EmbedBuilder, type EmbedBuilderData, EmbedFieldBuilder, EmbedFooterBuilder, type EmojiOrLabelButtonData, EmojiOrLabelButtonMixin, LinkButtonBuilder, type MappedComponentTypes, MentionableSelectMenuBuilder, type MessageActionRowComponentBuilder, type MessageComponentBuilder, MessageContextCommandBuilder, type ModalActionRowComponentBuilder, ModalBuilder, type ModalBuilderData, type ModalComponentBuilder, PremiumButtonBuilder, PrimaryButtonBuilder, type RestOrArray, RoleSelectMenuBuilder, SecondaryButtonBuilder, SharedChatInputCommandOptions, type SharedChatInputCommandOptionsData, SharedChatInputCommandSubcommands, type SharedChatInputCommandSubcommandsData, SharedName, SharedNameAndDescription, type SharedNameAndDescriptionData, type SharedNameData, StringSelectMenuBuilder, type StringSelectMenuData, StringSelectMenuOptionBuilder, SuccessButtonBuilder, TextInputBuilder, UserContextCommandBuilder, UserSelectMenuBuilder, actionRowPredicate, basicOptionPredicate, buttonPredicate, channelOptionPredicate, chatInputCommandPredicate, chatInputCommandSubcommandGroupPredicate, chatInputCommandSubcommandPredicate, createComponentBuilder, customIdPredicate, disableValidators, embedAuthorPredicate, embedFieldPredicate, embedFooterPredicate, embedLength, embedPredicate, emojiPredicate, enableValidators, integerOptionPredicate, isValidationEnabled, localeMapPredicate, memberPermissionsPredicate, messageCommandPredicate, modalPredicate, normalizeArray, numberOptionPredicate, refineURLPredicate, selectMenuChannelPredicate, selectMenuMentionablePredicate, selectMenuRolePredicate, selectMenuStringOptionPredicate, selectMenuStringPredicate, selectMenuUserPredicate, stringOptionPredicate, textInputPredicate, userCommandPredicate, validate, version };
|
package/dist/index.js
CHANGED
|
@@ -106,6 +106,7 @@ __export(src_exports, {
|
|
|
106
106
|
stringOptionPredicate: () => stringOptionPredicate,
|
|
107
107
|
textInputPredicate: () => textInputPredicate,
|
|
108
108
|
userCommandPredicate: () => userCommandPredicate,
|
|
109
|
+
validate: () => validate,
|
|
109
110
|
version: () => version
|
|
110
111
|
});
|
|
111
112
|
module.exports = __toCommonJS(src_exports);
|
|
@@ -150,19 +151,31 @@ var EmojiOrLabelButtonMixin = class {
|
|
|
150
151
|
};
|
|
151
152
|
|
|
152
153
|
// src/util/validation.ts
|
|
153
|
-
var
|
|
154
|
+
var import_zod_validation_error = require("zod-validation-error");
|
|
155
|
+
var validationEnabled = true;
|
|
154
156
|
function enableValidators() {
|
|
155
|
-
return
|
|
157
|
+
return validationEnabled = true;
|
|
156
158
|
}
|
|
157
159
|
__name(enableValidators, "enableValidators");
|
|
158
160
|
function disableValidators() {
|
|
159
|
-
return
|
|
161
|
+
return validationEnabled = false;
|
|
160
162
|
}
|
|
161
163
|
__name(disableValidators, "disableValidators");
|
|
162
164
|
function isValidationEnabled() {
|
|
163
|
-
return
|
|
165
|
+
return validationEnabled;
|
|
164
166
|
}
|
|
165
167
|
__name(isValidationEnabled, "isValidationEnabled");
|
|
168
|
+
function validate(validator, value, validationOverride) {
|
|
169
|
+
if (validationOverride === false || !isValidationEnabled()) {
|
|
170
|
+
return value;
|
|
171
|
+
}
|
|
172
|
+
const result = validator.safeParse(value);
|
|
173
|
+
if (!result.success) {
|
|
174
|
+
throw (0, import_zod_validation_error.fromZodError)(result.error);
|
|
175
|
+
}
|
|
176
|
+
return result.data;
|
|
177
|
+
}
|
|
178
|
+
__name(validate, "validate");
|
|
166
179
|
|
|
167
180
|
// src/components/Assertions.ts
|
|
168
181
|
var import_v102 = require("discord-api-types/v10");
|
|
@@ -318,9 +331,7 @@ var BaseButtonBuilder = class extends ComponentBuilder {
|
|
|
318
331
|
*/
|
|
319
332
|
toJSON(validationOverride) {
|
|
320
333
|
const clone = structuredClone(this.data);
|
|
321
|
-
|
|
322
|
-
buttonPredicate.parse(clone);
|
|
323
|
-
}
|
|
334
|
+
validate(buttonPredicate, clone, validationOverride);
|
|
324
335
|
return clone;
|
|
325
336
|
}
|
|
326
337
|
};
|
|
@@ -592,9 +603,7 @@ var ChannelSelectMenuBuilder = class extends BaseSelectMenuBuilder {
|
|
|
592
603
|
*/
|
|
593
604
|
toJSON(validationOverride) {
|
|
594
605
|
const clone = structuredClone(this.data);
|
|
595
|
-
|
|
596
|
-
selectMenuChannelPredicate.parse(clone);
|
|
597
|
-
}
|
|
606
|
+
validate(selectMenuChannelPredicate, clone, validationOverride);
|
|
598
607
|
return clone;
|
|
599
608
|
}
|
|
600
609
|
};
|
|
@@ -690,9 +699,7 @@ var MentionableSelectMenuBuilder = class extends BaseSelectMenuBuilder {
|
|
|
690
699
|
*/
|
|
691
700
|
toJSON(validationOverride) {
|
|
692
701
|
const clone = structuredClone(this.data);
|
|
693
|
-
|
|
694
|
-
selectMenuMentionablePredicate.parse(clone);
|
|
695
|
-
}
|
|
702
|
+
validate(selectMenuMentionablePredicate, clone, validationOverride);
|
|
696
703
|
return clone;
|
|
697
704
|
}
|
|
698
705
|
};
|
|
@@ -764,9 +771,7 @@ var RoleSelectMenuBuilder = class extends BaseSelectMenuBuilder {
|
|
|
764
771
|
*/
|
|
765
772
|
toJSON(validationOverride) {
|
|
766
773
|
const clone = structuredClone(this.data);
|
|
767
|
-
|
|
768
|
-
selectMenuRolePredicate.parse(clone);
|
|
769
|
-
}
|
|
774
|
+
validate(selectMenuRolePredicate, clone, validationOverride);
|
|
770
775
|
return clone;
|
|
771
776
|
}
|
|
772
777
|
};
|
|
@@ -885,9 +890,7 @@ var StringSelectMenuOptionBuilder = class {
|
|
|
885
890
|
*/
|
|
886
891
|
toJSON(validationOverride) {
|
|
887
892
|
const clone = structuredClone(this.data);
|
|
888
|
-
|
|
889
|
-
selectMenuStringOptionPredicate.parse(clone);
|
|
890
|
-
}
|
|
893
|
+
validate(selectMenuStringOptionPredicate, clone, validationOverride);
|
|
891
894
|
return clone;
|
|
892
895
|
}
|
|
893
896
|
};
|
|
@@ -1005,9 +1008,7 @@ var StringSelectMenuBuilder = class extends BaseSelectMenuBuilder {
|
|
|
1005
1008
|
// selectMenuStringPredicate covers the validation of options
|
|
1006
1009
|
options: options.map((option) => option.toJSON(false))
|
|
1007
1010
|
};
|
|
1008
|
-
|
|
1009
|
-
selectMenuStringPredicate.parse(data);
|
|
1010
|
-
}
|
|
1011
|
+
validate(selectMenuStringPredicate, data, validationOverride);
|
|
1011
1012
|
return data;
|
|
1012
1013
|
}
|
|
1013
1014
|
};
|
|
@@ -1079,9 +1080,7 @@ var UserSelectMenuBuilder = class extends BaseSelectMenuBuilder {
|
|
|
1079
1080
|
*/
|
|
1080
1081
|
toJSON(validationOverride) {
|
|
1081
1082
|
const clone = structuredClone(this.data);
|
|
1082
|
-
|
|
1083
|
-
selectMenuUserPredicate.parse(clone);
|
|
1084
|
-
}
|
|
1083
|
+
validate(selectMenuUserPredicate, clone, validationOverride);
|
|
1085
1084
|
return clone;
|
|
1086
1085
|
}
|
|
1087
1086
|
};
|
|
@@ -1242,9 +1241,7 @@ var TextInputBuilder = class extends ComponentBuilder {
|
|
|
1242
1241
|
*/
|
|
1243
1242
|
toJSON(validationOverride) {
|
|
1244
1243
|
const clone = structuredClone(this.data);
|
|
1245
|
-
|
|
1246
|
-
textInputPredicate.parse(clone);
|
|
1247
|
-
}
|
|
1244
|
+
validate(textInputPredicate, clone, validationOverride);
|
|
1248
1245
|
return clone;
|
|
1249
1246
|
}
|
|
1250
1247
|
};
|
|
@@ -1521,9 +1518,7 @@ var ActionRowBuilder = class extends ComponentBuilder {
|
|
|
1521
1518
|
...structuredClone(rest),
|
|
1522
1519
|
components: components.map((component) => component.toJSON(validationOverride))
|
|
1523
1520
|
};
|
|
1524
|
-
|
|
1525
|
-
actionRowPredicate.parse(data);
|
|
1526
|
-
}
|
|
1521
|
+
validate(actionRowPredicate, data, validationOverride);
|
|
1527
1522
|
return data;
|
|
1528
1523
|
}
|
|
1529
1524
|
};
|
|
@@ -1893,9 +1888,7 @@ var ApplicationCommandOptionBase = class extends SharedNameAndDescription {
|
|
|
1893
1888
|
*/
|
|
1894
1889
|
toJSON(validationOverride) {
|
|
1895
1890
|
const clone = structuredClone(this.data);
|
|
1896
|
-
|
|
1897
|
-
this.constructor.predicate.parse(clone);
|
|
1898
|
-
}
|
|
1891
|
+
validate(this.constructor.predicate, clone, validationOverride);
|
|
1899
1892
|
return clone;
|
|
1900
1893
|
}
|
|
1901
1894
|
};
|
|
@@ -2218,9 +2211,7 @@ var ChatInputCommandSubcommandGroupBuilder = class extends SharedNameAndDescript
|
|
|
2218
2211
|
type: import_v1026.ApplicationCommandOptionType.SubcommandGroup,
|
|
2219
2212
|
options: options?.map((option) => option.toJSON(validationOverride)) ?? []
|
|
2220
2213
|
};
|
|
2221
|
-
|
|
2222
|
-
chatInputCommandSubcommandGroupPredicate.parse(data);
|
|
2223
|
-
}
|
|
2214
|
+
validate(chatInputCommandSubcommandGroupPredicate, data, validationOverride);
|
|
2224
2215
|
return data;
|
|
2225
2216
|
}
|
|
2226
2217
|
};
|
|
@@ -2242,9 +2233,7 @@ var ChatInputCommandSubcommandBuilder = class extends (0, import_ts_mixer7.Mixin
|
|
|
2242
2233
|
type: import_v1026.ApplicationCommandOptionType.Subcommand,
|
|
2243
2234
|
options: options?.map((option) => option.toJSON(validationOverride)) ?? []
|
|
2244
2235
|
};
|
|
2245
|
-
|
|
2246
|
-
chatInputCommandSubcommandPredicate.parse(data);
|
|
2247
|
-
}
|
|
2236
|
+
validate(chatInputCommandSubcommandPredicate, data, validationOverride);
|
|
2248
2237
|
return data;
|
|
2249
2238
|
}
|
|
2250
2239
|
};
|
|
@@ -2357,9 +2346,7 @@ var ChatInputCommandBuilder = class extends (0, import_ts_mixer8.Mixin)(
|
|
|
2357
2346
|
type: import_v1027.ApplicationCommandType.ChatInput,
|
|
2358
2347
|
options: options?.map((option) => option.toJSON(validationOverride))
|
|
2359
2348
|
};
|
|
2360
|
-
|
|
2361
|
-
chatInputCommandPredicate.parse(data);
|
|
2362
|
-
}
|
|
2349
|
+
validate(chatInputCommandPredicate, data, validationOverride);
|
|
2363
2350
|
return data;
|
|
2364
2351
|
}
|
|
2365
2352
|
};
|
|
@@ -2412,9 +2399,7 @@ var MessageContextCommandBuilder = class extends ContextMenuCommandBuilder {
|
|
|
2412
2399
|
*/
|
|
2413
2400
|
toJSON(validationOverride) {
|
|
2414
2401
|
const data = { ...structuredClone(this.data), type: import_v1029.ApplicationCommandType.Message };
|
|
2415
|
-
|
|
2416
|
-
messageCommandPredicate.parse(data);
|
|
2417
|
-
}
|
|
2402
|
+
validate(messageCommandPredicate, data, validationOverride);
|
|
2418
2403
|
return data;
|
|
2419
2404
|
}
|
|
2420
2405
|
};
|
|
@@ -2430,9 +2415,7 @@ var UserContextCommandBuilder = class extends ContextMenuCommandBuilder {
|
|
|
2430
2415
|
*/
|
|
2431
2416
|
toJSON(validationOverride) {
|
|
2432
2417
|
const data = { ...structuredClone(this.data), type: import_v1030.ApplicationCommandType.User };
|
|
2433
|
-
|
|
2434
|
-
userCommandPredicate.parse(data);
|
|
2435
|
-
}
|
|
2418
|
+
validate(userCommandPredicate, data, validationOverride);
|
|
2436
2419
|
return data;
|
|
2437
2420
|
}
|
|
2438
2421
|
};
|
|
@@ -2562,9 +2545,7 @@ var ModalBuilder = class {
|
|
|
2562
2545
|
...structuredClone(rest),
|
|
2563
2546
|
components: components.map((component) => component.toJSON(validationOverride))
|
|
2564
2547
|
};
|
|
2565
|
-
|
|
2566
|
-
modalPredicate.parse(data);
|
|
2567
|
-
}
|
|
2548
|
+
validate(modalPredicate, data, validationOverride);
|
|
2568
2549
|
return data;
|
|
2569
2550
|
}
|
|
2570
2551
|
};
|
|
@@ -2687,9 +2668,7 @@ var EmbedAuthorBuilder = class {
|
|
|
2687
2668
|
*/
|
|
2688
2669
|
toJSON(validationOverride) {
|
|
2689
2670
|
const clone = structuredClone(this.data);
|
|
2690
|
-
|
|
2691
|
-
embedAuthorPredicate.parse(clone);
|
|
2692
|
-
}
|
|
2671
|
+
validate(embedAuthorPredicate, clone, validationOverride);
|
|
2693
2672
|
return clone;
|
|
2694
2673
|
}
|
|
2695
2674
|
};
|
|
@@ -2744,9 +2723,7 @@ var EmbedFieldBuilder = class {
|
|
|
2744
2723
|
*/
|
|
2745
2724
|
toJSON(validationOverride) {
|
|
2746
2725
|
const clone = structuredClone(this.data);
|
|
2747
|
-
|
|
2748
|
-
embedFieldPredicate.parse(clone);
|
|
2749
|
-
}
|
|
2726
|
+
validate(embedFieldPredicate, clone, validationOverride);
|
|
2750
2727
|
return clone;
|
|
2751
2728
|
}
|
|
2752
2729
|
};
|
|
@@ -2799,9 +2776,7 @@ var EmbedFooterBuilder = class {
|
|
|
2799
2776
|
*/
|
|
2800
2777
|
toJSON(validationOverride) {
|
|
2801
2778
|
const clone = structuredClone(this.data);
|
|
2802
|
-
|
|
2803
|
-
embedFooterPredicate.parse(clone);
|
|
2804
|
-
}
|
|
2779
|
+
validate(embedFooterPredicate, clone, validationOverride);
|
|
2805
2780
|
return clone;
|
|
2806
2781
|
}
|
|
2807
2782
|
};
|
|
@@ -3090,15 +3065,13 @@ var EmbedBuilder = class {
|
|
|
3090
3065
|
fields: this.data.fields?.map((field) => field.toJSON(false)),
|
|
3091
3066
|
footer: this.data.footer?.toJSON(false)
|
|
3092
3067
|
};
|
|
3093
|
-
|
|
3094
|
-
embedPredicate.parse(data);
|
|
3095
|
-
}
|
|
3068
|
+
validate(embedPredicate, data, validationOverride);
|
|
3096
3069
|
return data;
|
|
3097
3070
|
}
|
|
3098
3071
|
};
|
|
3099
3072
|
|
|
3100
3073
|
// src/index.ts
|
|
3101
|
-
var version = "2.0.0-dev.
|
|
3074
|
+
var version = "2.0.0-dev.1728259953-8ab4124ef";
|
|
3102
3075
|
// Annotate the CommonJS export names for ESM import in node:
|
|
3103
3076
|
0 && (module.exports = {
|
|
3104
3077
|
ActionRowBuilder,
|
|
@@ -3186,6 +3159,7 @@ var version = "2.0.0-dev.1728043483-12e510671";
|
|
|
3186
3159
|
stringOptionPredicate,
|
|
3187
3160
|
textInputPredicate,
|
|
3188
3161
|
userCommandPredicate,
|
|
3162
|
+
validate,
|
|
3189
3163
|
version
|
|
3190
3164
|
});
|
|
3191
3165
|
//# sourceMappingURL=index.js.map
|