@discordjs/builders 2.0.0-dev.1757808111-126529f46 → 2.0.0-dev.1758499311-7886d9b09
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 +355 -235
- package/dist/index.d.ts +355 -235
- package/dist/index.js +76 -33
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +76 -33
- package/dist/index.mjs.map +1 -1
- package/package.json +4 -4
package/dist/index.js
CHANGED
|
@@ -605,6 +605,16 @@ var BaseSelectMenuBuilder = class extends ComponentBuilder {
|
|
|
605
605
|
this.data.disabled = disabled;
|
|
606
606
|
return this;
|
|
607
607
|
}
|
|
608
|
+
/**
|
|
609
|
+
* Sets whether this select menu is required.
|
|
610
|
+
*
|
|
611
|
+
* @remarks Only for use in modals.
|
|
612
|
+
* @param required - Whether this string select menu is required
|
|
613
|
+
*/
|
|
614
|
+
setRequired(required = true) {
|
|
615
|
+
this.data.required = required;
|
|
616
|
+
return this;
|
|
617
|
+
}
|
|
608
618
|
};
|
|
609
619
|
|
|
610
620
|
// src/components/selectMenu/ChannelSelectMenu.ts
|
|
@@ -1076,16 +1086,6 @@ var StringSelectMenuBuilder = class extends BaseSelectMenuBuilder {
|
|
|
1076
1086
|
this.data.options.splice(index, deleteCount, ...resolved);
|
|
1077
1087
|
return this;
|
|
1078
1088
|
}
|
|
1079
|
-
/**
|
|
1080
|
-
* Sets whether this string select menu is required.
|
|
1081
|
-
*
|
|
1082
|
-
* @remarks Only for use in modals.
|
|
1083
|
-
* @param required - Whether this string select menu is required
|
|
1084
|
-
*/
|
|
1085
|
-
setRequired(required = true) {
|
|
1086
|
-
this.data.required = required;
|
|
1087
|
-
return this;
|
|
1088
|
-
}
|
|
1089
1089
|
/**
|
|
1090
1090
|
* {@inheritDoc ComponentBuilder.toJSON}
|
|
1091
1091
|
*/
|
|
@@ -2504,7 +2504,14 @@ var labelPredicate2 = import_zod6.z.object({
|
|
|
2504
2504
|
type: import_zod6.z.literal(import_v1023.ComponentType.Label),
|
|
2505
2505
|
label: import_zod6.z.string().min(1).max(45),
|
|
2506
2506
|
description: import_zod6.z.string().min(1).max(100).optional(),
|
|
2507
|
-
component: import_zod6.z.union([
|
|
2507
|
+
component: import_zod6.z.union([
|
|
2508
|
+
selectMenuStringPredicate,
|
|
2509
|
+
textInputPredicate,
|
|
2510
|
+
selectMenuUserPredicate,
|
|
2511
|
+
selectMenuRolePredicate,
|
|
2512
|
+
selectMenuMentionablePredicate,
|
|
2513
|
+
selectMenuChannelPredicate
|
|
2514
|
+
])
|
|
2508
2515
|
});
|
|
2509
2516
|
|
|
2510
2517
|
// src/components/label/Label.ts
|
|
@@ -2542,7 +2549,6 @@ var LabelBuilder = class extends ComponentBuilder {
|
|
|
2542
2549
|
const { component, ...rest } = data;
|
|
2543
2550
|
this.data = {
|
|
2544
2551
|
...structuredClone(rest),
|
|
2545
|
-
// @ts-expect-error https://github.com/discordjs/discord.js/pull/11078
|
|
2546
2552
|
component: component ? createComponentBuilder(component) : void 0,
|
|
2547
2553
|
type: import_v1024.ComponentType.Label
|
|
2548
2554
|
};
|
|
@@ -2581,6 +2587,42 @@ var LabelBuilder = class extends ComponentBuilder {
|
|
|
2581
2587
|
this.data.component = resolveBuilder(input, StringSelectMenuBuilder);
|
|
2582
2588
|
return this;
|
|
2583
2589
|
}
|
|
2590
|
+
/**
|
|
2591
|
+
* Sets a user select menu component to this label.
|
|
2592
|
+
*
|
|
2593
|
+
* @param input - A function that returns a component builder or an already built builder
|
|
2594
|
+
*/
|
|
2595
|
+
setUserSelectMenuComponent(input) {
|
|
2596
|
+
this.data.component = resolveBuilder(input, UserSelectMenuBuilder);
|
|
2597
|
+
return this;
|
|
2598
|
+
}
|
|
2599
|
+
/**
|
|
2600
|
+
* Sets a role select menu component to this label.
|
|
2601
|
+
*
|
|
2602
|
+
* @param input - A function that returns a component builder or an already built builder
|
|
2603
|
+
*/
|
|
2604
|
+
setRoleSelectMenuComponent(input) {
|
|
2605
|
+
this.data.component = resolveBuilder(input, RoleSelectMenuBuilder);
|
|
2606
|
+
return this;
|
|
2607
|
+
}
|
|
2608
|
+
/**
|
|
2609
|
+
* Sets a mentionable select menu component to this label.
|
|
2610
|
+
*
|
|
2611
|
+
* @param input - A function that returns a component builder or an already built builder
|
|
2612
|
+
*/
|
|
2613
|
+
setMentionableSelectMenuComponent(input) {
|
|
2614
|
+
this.data.component = resolveBuilder(input, MentionableSelectMenuBuilder);
|
|
2615
|
+
return this;
|
|
2616
|
+
}
|
|
2617
|
+
/**
|
|
2618
|
+
* Sets a channel select menu component to this label.
|
|
2619
|
+
*
|
|
2620
|
+
* @param input - A function that returns a component builder or an already built builder
|
|
2621
|
+
*/
|
|
2622
|
+
setChannelSelectMenuComponent(input) {
|
|
2623
|
+
this.data.component = resolveBuilder(input, ChannelSelectMenuBuilder);
|
|
2624
|
+
return this;
|
|
2625
|
+
}
|
|
2584
2626
|
/**
|
|
2585
2627
|
* Sets a text input component to this label.
|
|
2586
2628
|
*
|
|
@@ -2597,6 +2639,7 @@ var LabelBuilder = class extends ComponentBuilder {
|
|
|
2597
2639
|
const { component, ...rest } = this.data;
|
|
2598
2640
|
const data = {
|
|
2599
2641
|
...structuredClone(rest),
|
|
2642
|
+
// The label predicate validates the component.
|
|
2600
2643
|
component: component?.toJSON(false)
|
|
2601
2644
|
};
|
|
2602
2645
|
validate(labelPredicate2, data, validationOverride);
|
|
@@ -3588,7 +3631,8 @@ var modalPredicate = import_zod9.z.object({
|
|
|
3588
3631
|
type: import_zod9.z.literal(import_v1041.ComponentType.ActionRow),
|
|
3589
3632
|
components: import_zod9.z.object({ type: import_zod9.z.literal(import_v1041.ComponentType.TextInput) }).array().length(1)
|
|
3590
3633
|
}),
|
|
3591
|
-
labelPredicate2
|
|
3634
|
+
labelPredicate2,
|
|
3635
|
+
textDisplayPredicate
|
|
3592
3636
|
]).array().min(1).max(5)
|
|
3593
3637
|
});
|
|
3594
3638
|
|
|
@@ -3616,7 +3660,6 @@ var ModalBuilder = class {
|
|
|
3616
3660
|
const { components = [], ...rest } = data;
|
|
3617
3661
|
this.data = {
|
|
3618
3662
|
...structuredClone(rest),
|
|
3619
|
-
// @ts-expect-error https://github.com/discordjs/discord.js/pull/11078
|
|
3620
3663
|
components: components.map((component) => createComponentBuilder(component))
|
|
3621
3664
|
};
|
|
3622
3665
|
}
|
|
@@ -3650,47 +3693,47 @@ var ModalBuilder = class {
|
|
|
3650
3693
|
return this;
|
|
3651
3694
|
}
|
|
3652
3695
|
/**
|
|
3653
|
-
*
|
|
3696
|
+
* Adds text display components to this modal.
|
|
3654
3697
|
*
|
|
3655
|
-
* @param components - The components to
|
|
3698
|
+
* @param components - The components to add
|
|
3656
3699
|
*/
|
|
3657
|
-
|
|
3700
|
+
addTextDisplayComponents(...components) {
|
|
3658
3701
|
const normalized = normalizeArray(components);
|
|
3659
|
-
|
|
3702
|
+
const resolved = normalized.map((row) => resolveBuilder(row, TextDisplayBuilder));
|
|
3703
|
+
this.data.components.push(...resolved);
|
|
3660
3704
|
return this;
|
|
3661
3705
|
}
|
|
3662
3706
|
/**
|
|
3663
|
-
* Removes, replaces, or inserts
|
|
3707
|
+
* Removes, replaces, or inserts components for this modal.
|
|
3664
3708
|
*
|
|
3665
3709
|
* @remarks
|
|
3666
3710
|
* This method behaves similarly
|
|
3667
3711
|
* to {@link https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array/splice | Array.prototype.splice()}.
|
|
3668
|
-
* The maximum amount of
|
|
3712
|
+
* The maximum amount of components that can be added is 5.
|
|
3669
3713
|
*
|
|
3670
|
-
* It's useful for modifying and adjusting order of the already-existing
|
|
3714
|
+
* It's useful for modifying and adjusting order of the already-existing components of a modal.
|
|
3671
3715
|
* @example
|
|
3672
|
-
* Remove the first
|
|
3716
|
+
* Remove the first component:
|
|
3673
3717
|
* ```ts
|
|
3674
|
-
* modal.
|
|
3718
|
+
* modal.spliceComponents(0, 1);
|
|
3675
3719
|
* ```
|
|
3676
3720
|
* @example
|
|
3677
|
-
* Remove the first n
|
|
3721
|
+
* Remove the first n components:
|
|
3678
3722
|
* ```ts
|
|
3679
3723
|
* const n = 4;
|
|
3680
|
-
* modal.
|
|
3724
|
+
* modal.spliceComponents(0, n);
|
|
3681
3725
|
* ```
|
|
3682
3726
|
* @example
|
|
3683
|
-
* Remove the last
|
|
3727
|
+
* Remove the last component:
|
|
3684
3728
|
* ```ts
|
|
3685
|
-
* modal.
|
|
3729
|
+
* modal.spliceComponents(-1, 1);
|
|
3686
3730
|
* ```
|
|
3687
3731
|
* @param index - The index to start at
|
|
3688
|
-
* @param deleteCount - The number of
|
|
3689
|
-
* @param
|
|
3732
|
+
* @param deleteCount - The number of components to remove
|
|
3733
|
+
* @param components - The replacing components
|
|
3690
3734
|
*/
|
|
3691
|
-
|
|
3692
|
-
|
|
3693
|
-
this.data.components.splice(index, deleteCount, ...resolved);
|
|
3735
|
+
spliceComponents(index, deleteCount, ...components) {
|
|
3736
|
+
this.data.components.splice(index, deleteCount, ...components);
|
|
3694
3737
|
return this;
|
|
3695
3738
|
}
|
|
3696
3739
|
/**
|
|
@@ -5553,7 +5596,7 @@ var MessageBuilder = class {
|
|
|
5553
5596
|
};
|
|
5554
5597
|
|
|
5555
5598
|
// src/index.ts
|
|
5556
|
-
var version = "2.0.0-dev.
|
|
5599
|
+
var version = "2.0.0-dev.1758499311-7886d9b09";
|
|
5557
5600
|
// Annotate the CommonJS export names for ESM import in node:
|
|
5558
5601
|
0 && (module.exports = {
|
|
5559
5602
|
ActionRowBuilder,
|