@discordjs/builders 1.13.0 → 1.14.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/README.md +2 -1
- package/dist/index.d.mts +13532 -141
- package/dist/index.d.ts +13532 -141
- package/dist/index.js +920 -303
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +841 -231
- package/dist/index.mjs.map +1 -1
- package/package.json +10 -10
package/dist/index.mjs
CHANGED
|
@@ -153,7 +153,7 @@ var EmbedBuilder = class {
|
|
|
153
153
|
*
|
|
154
154
|
* @remarks
|
|
155
155
|
* This method behaves similarly
|
|
156
|
-
* to {@link https://developer.mozilla.org/
|
|
156
|
+
* to {@link https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array/splice | Array.prototype.splice()}.
|
|
157
157
|
* The maximum amount of fields that can be added is 25.
|
|
158
158
|
*
|
|
159
159
|
* It's useful for modifying and adjusting order of the already-existing fields of an embed.
|
|
@@ -498,7 +498,7 @@ __name(validateRequiredButtonParameters, "validateRequiredButtonParameters");
|
|
|
498
498
|
|
|
499
499
|
// src/components/ActionRow.ts
|
|
500
500
|
import {
|
|
501
|
-
ComponentType as
|
|
501
|
+
ComponentType as ComponentType26
|
|
502
502
|
} from "discord-api-types/v10";
|
|
503
503
|
|
|
504
504
|
// src/components/Component.ts
|
|
@@ -537,7 +537,7 @@ var ComponentBuilder = class {
|
|
|
537
537
|
};
|
|
538
538
|
|
|
539
539
|
// src/components/Components.ts
|
|
540
|
-
import { ComponentType as
|
|
540
|
+
import { ComponentType as ComponentType25 } from "discord-api-types/v10";
|
|
541
541
|
|
|
542
542
|
// src/components/button/Button.ts
|
|
543
543
|
import {
|
|
@@ -665,23 +665,580 @@ var ButtonBuilder = class extends ComponentBuilder {
|
|
|
665
665
|
}
|
|
666
666
|
};
|
|
667
667
|
|
|
668
|
-
// src/components/
|
|
668
|
+
// src/components/checkbox/Checkbox.ts
|
|
669
669
|
import { ComponentType as ComponentType3 } from "discord-api-types/v10";
|
|
670
670
|
|
|
671
|
-
// src/components/
|
|
671
|
+
// src/components/checkbox/Assertions.ts
|
|
672
672
|
var Assertions_exports3 = {};
|
|
673
673
|
__export(Assertions_exports3, {
|
|
674
|
-
|
|
674
|
+
checkboxGroupOptionPredicate: () => checkboxGroupOptionPredicate,
|
|
675
|
+
checkboxGroupPredicate: () => checkboxGroupPredicate,
|
|
676
|
+
checkboxPredicate: () => checkboxPredicate,
|
|
677
|
+
radioGroupOptionPredicate: () => radioGroupOptionPredicate,
|
|
678
|
+
radioGroupPredicate: () => radioGroupPredicate
|
|
675
679
|
});
|
|
676
|
-
import { s as s3 } from "@sapphire/shapeshift";
|
|
680
|
+
import { Result, s as s3 } from "@sapphire/shapeshift";
|
|
677
681
|
import { ComponentType as ComponentType2 } from "discord-api-types/v10";
|
|
678
|
-
var
|
|
679
|
-
type: s3.literal(ComponentType2.
|
|
682
|
+
var checkboxPredicate = s3.object({
|
|
683
|
+
type: s3.literal(ComponentType2.Checkbox),
|
|
684
|
+
custom_id: customIdValidator,
|
|
685
|
+
id: idValidator.optional(),
|
|
686
|
+
default: s3.boolean().optional()
|
|
687
|
+
}).setValidationEnabled(isValidationEnabled);
|
|
688
|
+
var checkboxGroupOptionPredicate = s3.object({
|
|
689
|
+
label: s3.string().lengthGreaterThanOrEqual(1).lengthLessThanOrEqual(100),
|
|
690
|
+
value: s3.string().lengthGreaterThanOrEqual(1).lengthLessThanOrEqual(100),
|
|
691
|
+
description: s3.string().lengthLessThanOrEqual(100).optional(),
|
|
692
|
+
default: s3.boolean().optional()
|
|
693
|
+
}).setValidationEnabled(isValidationEnabled);
|
|
694
|
+
var checkboxGroupPredicate = s3.object({
|
|
695
|
+
type: s3.literal(ComponentType2.CheckboxGroup),
|
|
696
|
+
custom_id: customIdValidator,
|
|
680
697
|
id: idValidator.optional(),
|
|
698
|
+
options: s3.array(checkboxGroupOptionPredicate).lengthGreaterThanOrEqual(1).lengthLessThanOrEqual(10),
|
|
699
|
+
min_values: s3.number().int().greaterThanOrEqual(0).lessThanOrEqual(10).optional(),
|
|
700
|
+
max_values: s3.number().int().greaterThanOrEqual(1).lessThanOrEqual(10).optional(),
|
|
701
|
+
required: s3.boolean().optional()
|
|
702
|
+
}).reshape((data) => {
|
|
703
|
+
if (data.min_values !== void 0 && data.max_values !== void 0 && data.min_values > data.max_values) {
|
|
704
|
+
return Result.err(new RangeError("min_values cannot be greater than max_values"));
|
|
705
|
+
}
|
|
706
|
+
if (data.max_values !== void 0 && data.max_values > data.options.length) {
|
|
707
|
+
return Result.err(new RangeError("max_values cannot be greater than the number of options"));
|
|
708
|
+
}
|
|
709
|
+
if (data.min_values !== void 0 && data.min_values > data.options.length) {
|
|
710
|
+
return Result.err(new RangeError("min_values cannot be greater than the number of options"));
|
|
711
|
+
}
|
|
712
|
+
if (data.required === true && data.min_values === 0) {
|
|
713
|
+
return Result.err(new RangeError("If required is true, min_values must be at least 1"));
|
|
714
|
+
}
|
|
715
|
+
const defaultCount = data.options.filter((option) => option.default === true).length;
|
|
716
|
+
if (data.max_values !== void 0 && defaultCount > data.max_values) {
|
|
717
|
+
return Result.err(new RangeError("The number of default options cannot be greater than max_values"));
|
|
718
|
+
}
|
|
719
|
+
const values = data.options.map((option) => option.value);
|
|
720
|
+
const uniqueValues = new Set(values);
|
|
721
|
+
if (uniqueValues.size !== values.length) {
|
|
722
|
+
return Result.err(new RangeError("Each option in a checkbox group must have a unique value"));
|
|
723
|
+
}
|
|
724
|
+
return Result.ok(data);
|
|
725
|
+
}).setValidationEnabled(isValidationEnabled);
|
|
726
|
+
var radioGroupOptionPredicate = checkboxGroupOptionPredicate;
|
|
727
|
+
var radioGroupPredicate = s3.object({
|
|
728
|
+
type: s3.literal(ComponentType2.RadioGroup),
|
|
681
729
|
custom_id: customIdValidator,
|
|
682
|
-
|
|
683
|
-
|
|
730
|
+
id: idValidator.optional(),
|
|
731
|
+
options: s3.array(radioGroupOptionPredicate).lengthGreaterThanOrEqual(2).lengthLessThanOrEqual(10),
|
|
684
732
|
required: s3.boolean().optional()
|
|
733
|
+
}).reshape((data) => {
|
|
734
|
+
const defaultCount = data.options.filter((option) => option.default === true).length;
|
|
735
|
+
if (defaultCount > 1) {
|
|
736
|
+
return Result.err(new RangeError("There can be at most one default option in a radio group"));
|
|
737
|
+
}
|
|
738
|
+
const values = data.options.map((option) => option.value);
|
|
739
|
+
const uniqueValues = new Set(values);
|
|
740
|
+
if (uniqueValues.size !== values.length) {
|
|
741
|
+
return Result.err(new RangeError("Each option in a radio group must have a unique value"));
|
|
742
|
+
}
|
|
743
|
+
return Result.ok(data);
|
|
744
|
+
}).setValidationEnabled(isValidationEnabled);
|
|
745
|
+
|
|
746
|
+
// src/components/checkbox/Checkbox.ts
|
|
747
|
+
var CheckboxBuilder = class extends ComponentBuilder {
|
|
748
|
+
static {
|
|
749
|
+
__name(this, "CheckboxBuilder");
|
|
750
|
+
}
|
|
751
|
+
/**
|
|
752
|
+
* Creates a new checkbox from API data.
|
|
753
|
+
*
|
|
754
|
+
* @param data - The API data to create this checkbox with
|
|
755
|
+
* @example
|
|
756
|
+
* Creating a checkbox from an API data object:
|
|
757
|
+
* ```ts
|
|
758
|
+
* const checkbox = new CheckboxBuilder({
|
|
759
|
+
* custom_id: 'accept_terms',
|
|
760
|
+
* default: false,
|
|
761
|
+
* });
|
|
762
|
+
* ```
|
|
763
|
+
* @example
|
|
764
|
+
* Creating a checkbox using setters and API data:
|
|
765
|
+
* ```ts
|
|
766
|
+
* const checkbox = new CheckboxBuilder()
|
|
767
|
+
* .setCustomId('subscribe_newsletter')
|
|
768
|
+
* .setDefault(true);
|
|
769
|
+
* ```
|
|
770
|
+
*/
|
|
771
|
+
constructor(data) {
|
|
772
|
+
super({ type: ComponentType3.Checkbox, ...data });
|
|
773
|
+
}
|
|
774
|
+
/**
|
|
775
|
+
* Sets the custom id of this checkbox.
|
|
776
|
+
*
|
|
777
|
+
* @param customId - The custom id to use
|
|
778
|
+
*/
|
|
779
|
+
setCustomId(customId) {
|
|
780
|
+
this.data.custom_id = customId;
|
|
781
|
+
return this;
|
|
782
|
+
}
|
|
783
|
+
/**
|
|
784
|
+
* Sets whether this checkbox is checked by default.
|
|
785
|
+
*
|
|
786
|
+
* @param isDefault - Whether the checkbox should be checked by default
|
|
787
|
+
*/
|
|
788
|
+
setDefault(isDefault) {
|
|
789
|
+
this.data.default = isDefault;
|
|
790
|
+
return this;
|
|
791
|
+
}
|
|
792
|
+
/**
|
|
793
|
+
* {@inheritDoc ComponentBuilder.toJSON}
|
|
794
|
+
*/
|
|
795
|
+
toJSON() {
|
|
796
|
+
checkboxPredicate.parse(this.data);
|
|
797
|
+
return {
|
|
798
|
+
...this.data
|
|
799
|
+
};
|
|
800
|
+
}
|
|
801
|
+
};
|
|
802
|
+
|
|
803
|
+
// src/components/checkbox/CheckboxGroup.ts
|
|
804
|
+
import { ComponentType as ComponentType4 } from "discord-api-types/v10";
|
|
805
|
+
|
|
806
|
+
// src/components/checkbox/CheckboxGroupOption.ts
|
|
807
|
+
var CheckboxGroupOptionBuilder = class {
|
|
808
|
+
/**
|
|
809
|
+
* Creates a new checkbox group option from API data.
|
|
810
|
+
*
|
|
811
|
+
* @param data - The API data to create this checkbox group option with
|
|
812
|
+
* @example
|
|
813
|
+
* Creating a checkbox group option from an API data object:
|
|
814
|
+
* ```ts
|
|
815
|
+
* const option = new CheckboxGroupOptionBuilder({
|
|
816
|
+
* label: 'Option 1',
|
|
817
|
+
* value: 'option_1',
|
|
818
|
+
* });
|
|
819
|
+
* ```
|
|
820
|
+
* @example
|
|
821
|
+
* Creating a checkbox group option using setters and API data:
|
|
822
|
+
* ```ts
|
|
823
|
+
* const option = new CheckboxGroupOptionBuilder()
|
|
824
|
+
* .setLabel('Option 2')
|
|
825
|
+
* .setValue('option_2');
|
|
826
|
+
* ```
|
|
827
|
+
*/
|
|
828
|
+
constructor(data = {}) {
|
|
829
|
+
this.data = data;
|
|
830
|
+
}
|
|
831
|
+
static {
|
|
832
|
+
__name(this, "CheckboxGroupOptionBuilder");
|
|
833
|
+
}
|
|
834
|
+
/**
|
|
835
|
+
* Sets the label for this option.
|
|
836
|
+
*
|
|
837
|
+
* @param label - The label to use
|
|
838
|
+
*/
|
|
839
|
+
setLabel(label) {
|
|
840
|
+
this.data.label = label;
|
|
841
|
+
return this;
|
|
842
|
+
}
|
|
843
|
+
/**
|
|
844
|
+
* Sets the value for this option.
|
|
845
|
+
*
|
|
846
|
+
* @param value - The value to use
|
|
847
|
+
*/
|
|
848
|
+
setValue(value) {
|
|
849
|
+
this.data.value = value;
|
|
850
|
+
return this;
|
|
851
|
+
}
|
|
852
|
+
/**
|
|
853
|
+
* Sets the description for this option.
|
|
854
|
+
*
|
|
855
|
+
* @param description - The description to use
|
|
856
|
+
*/
|
|
857
|
+
setDescription(description) {
|
|
858
|
+
this.data.description = description;
|
|
859
|
+
return this;
|
|
860
|
+
}
|
|
861
|
+
/**
|
|
862
|
+
* Sets whether this option is selected by default.
|
|
863
|
+
*
|
|
864
|
+
* @param isDefault - Whether the option should be selected by default
|
|
865
|
+
*/
|
|
866
|
+
setDefault(isDefault) {
|
|
867
|
+
this.data.default = isDefault;
|
|
868
|
+
return this;
|
|
869
|
+
}
|
|
870
|
+
/**
|
|
871
|
+
* {@inheritDoc ComponentBuilder.toJSON}
|
|
872
|
+
*/
|
|
873
|
+
toJSON() {
|
|
874
|
+
checkboxGroupOptionPredicate.parse(this.data);
|
|
875
|
+
return {
|
|
876
|
+
...this.data
|
|
877
|
+
};
|
|
878
|
+
}
|
|
879
|
+
};
|
|
880
|
+
|
|
881
|
+
// src/components/checkbox/CheckboxGroup.ts
|
|
882
|
+
var CheckboxGroupBuilder = class extends ComponentBuilder {
|
|
883
|
+
static {
|
|
884
|
+
__name(this, "CheckboxGroupBuilder");
|
|
885
|
+
}
|
|
886
|
+
/**
|
|
887
|
+
* The options within this checkbox group.
|
|
888
|
+
*/
|
|
889
|
+
options;
|
|
890
|
+
/**
|
|
891
|
+
* Creates a new checkbox group from API data.
|
|
892
|
+
*
|
|
893
|
+
* @param data - The API data to create this checkbox group with
|
|
894
|
+
* @example
|
|
895
|
+
* Creating a checkbox group from an API data object:
|
|
896
|
+
* ```ts
|
|
897
|
+
* const checkboxGroup = new CheckboxGroupBuilder({
|
|
898
|
+
* custom_id: 'select_options',
|
|
899
|
+
* options: [
|
|
900
|
+
* { label: 'Option 1', value: 'option_1' },
|
|
901
|
+
* { label: 'Option 2', value: 'option_2' },
|
|
902
|
+
* ],
|
|
903
|
+
* });
|
|
904
|
+
* ```
|
|
905
|
+
* @example
|
|
906
|
+
* Creating a checkbox group using setters and API data:
|
|
907
|
+
* ```ts
|
|
908
|
+
* const checkboxGroup = new CheckboxGroupBuilder()
|
|
909
|
+
* .setCustomId('choose_items')
|
|
910
|
+
* .setOptions([
|
|
911
|
+
* { label: 'Item A', value: 'item_a' },
|
|
912
|
+
* { label: 'Item B', value: 'item_b' },
|
|
913
|
+
* ])
|
|
914
|
+
* .setMinValues(1)
|
|
915
|
+
* .setMaxValues(2);
|
|
916
|
+
* ```
|
|
917
|
+
*/
|
|
918
|
+
constructor(data) {
|
|
919
|
+
const { options, ...initData } = data ?? {};
|
|
920
|
+
super({ ...initData, type: ComponentType4.CheckboxGroup });
|
|
921
|
+
this.options = options?.map((option) => new CheckboxGroupOptionBuilder(option)) ?? [];
|
|
922
|
+
}
|
|
923
|
+
/**
|
|
924
|
+
* Sets the custom id of this checkbox group.
|
|
925
|
+
*
|
|
926
|
+
* @param customId - The custom id to use
|
|
927
|
+
*/
|
|
928
|
+
setCustomId(customId) {
|
|
929
|
+
this.data.custom_id = customId;
|
|
930
|
+
return this;
|
|
931
|
+
}
|
|
932
|
+
/**
|
|
933
|
+
* Adds options to this checkbox group.
|
|
934
|
+
*
|
|
935
|
+
* @param options - The options to add
|
|
936
|
+
*/
|
|
937
|
+
addOptions(...options) {
|
|
938
|
+
const normalizedOptions = normalizeArray(options);
|
|
939
|
+
this.options.push(
|
|
940
|
+
...normalizedOptions.map((normalizedOption) => {
|
|
941
|
+
const json = "toJSON" in normalizedOption ? normalizedOption.toJSON() : normalizedOption;
|
|
942
|
+
const option = new CheckboxGroupOptionBuilder(json);
|
|
943
|
+
checkboxGroupOptionPredicate.parse(option.toJSON());
|
|
944
|
+
return option;
|
|
945
|
+
})
|
|
946
|
+
);
|
|
947
|
+
return this;
|
|
948
|
+
}
|
|
949
|
+
/**
|
|
950
|
+
* Sets the options for this checkbox group.
|
|
951
|
+
*
|
|
952
|
+
* @param options - The options to use
|
|
953
|
+
*/
|
|
954
|
+
setOptions(options) {
|
|
955
|
+
return this.spliceOptions(0, this.options.length, ...options);
|
|
956
|
+
}
|
|
957
|
+
/**
|
|
958
|
+
* Removes, replaces, or inserts options for this checkbox group.
|
|
959
|
+
*
|
|
960
|
+
* @remarks
|
|
961
|
+
* This method behaves similarly
|
|
962
|
+
* to {@link https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array/splice | Array.prototype.splice()}.
|
|
963
|
+
* It's useful for modifying and adjusting the order of existing options.
|
|
964
|
+
* @param index - The index to start at
|
|
965
|
+
* @param deleteCount - The number of options to remove
|
|
966
|
+
* @param options - The replacing option objects or builders
|
|
967
|
+
*/
|
|
968
|
+
spliceOptions(index, deleteCount, ...options) {
|
|
969
|
+
const normalizedOptions = normalizeArray(options);
|
|
970
|
+
const clone = [...this.options];
|
|
971
|
+
clone.splice(
|
|
972
|
+
index,
|
|
973
|
+
deleteCount,
|
|
974
|
+
...normalizedOptions.map((normalizedOption) => {
|
|
975
|
+
const json = "toJSON" in normalizedOption ? normalizedOption.toJSON() : normalizedOption;
|
|
976
|
+
const option = new CheckboxGroupOptionBuilder(json);
|
|
977
|
+
checkboxGroupOptionPredicate.parse(option.toJSON());
|
|
978
|
+
return option;
|
|
979
|
+
})
|
|
980
|
+
);
|
|
981
|
+
this.options.splice(0, this.options.length, ...clone);
|
|
982
|
+
return this;
|
|
983
|
+
}
|
|
984
|
+
/**
|
|
985
|
+
* Sets the minimum number of options that must be selected.
|
|
986
|
+
*
|
|
987
|
+
* @param minValues - The minimum number of options that must be selected
|
|
988
|
+
*/
|
|
989
|
+
setMinValues(minValues) {
|
|
990
|
+
this.data.min_values = minValues;
|
|
991
|
+
return this;
|
|
992
|
+
}
|
|
993
|
+
/**
|
|
994
|
+
* Sets the maximum number of options that can be selected.
|
|
995
|
+
*
|
|
996
|
+
* @param maxValues - The maximum number of options that can be selected
|
|
997
|
+
*/
|
|
998
|
+
setMaxValues(maxValues) {
|
|
999
|
+
this.data.max_values = maxValues;
|
|
1000
|
+
return this;
|
|
1001
|
+
}
|
|
1002
|
+
/**
|
|
1003
|
+
* Sets whether selecting options is required.
|
|
1004
|
+
*
|
|
1005
|
+
* @param required - Whether selecting options is required
|
|
1006
|
+
*/
|
|
1007
|
+
setRequired(required) {
|
|
1008
|
+
this.data.required = required;
|
|
1009
|
+
return this;
|
|
1010
|
+
}
|
|
1011
|
+
/**
|
|
1012
|
+
* {@inheritDoc ComponentBuilder.toJSON}
|
|
1013
|
+
*/
|
|
1014
|
+
toJSON() {
|
|
1015
|
+
const data = {
|
|
1016
|
+
...this.data,
|
|
1017
|
+
options: this.options.map((option) => option.toJSON())
|
|
1018
|
+
};
|
|
1019
|
+
checkboxGroupPredicate.parse(data);
|
|
1020
|
+
return data;
|
|
1021
|
+
}
|
|
1022
|
+
};
|
|
1023
|
+
|
|
1024
|
+
// src/components/checkbox/RadioGroup.ts
|
|
1025
|
+
import { ComponentType as ComponentType5 } from "discord-api-types/v10";
|
|
1026
|
+
|
|
1027
|
+
// src/components/checkbox/RadioGroupOption.ts
|
|
1028
|
+
var RadioGroupOptionBuilder = class {
|
|
1029
|
+
/**
|
|
1030
|
+
* Creates a new radio group option from API data.
|
|
1031
|
+
*
|
|
1032
|
+
* @param data - The API data to create this radio group option with
|
|
1033
|
+
* @example
|
|
1034
|
+
* Creating a radio group option from an API data object:
|
|
1035
|
+
* ```ts
|
|
1036
|
+
* const option = new RadioGroupOptionBuilder({
|
|
1037
|
+
* label: 'Option 1',
|
|
1038
|
+
* value: 'option_1',
|
|
1039
|
+
* });
|
|
1040
|
+
* ```
|
|
1041
|
+
* @example
|
|
1042
|
+
* Creating a radio group option using setters and API data:
|
|
1043
|
+
* ```ts
|
|
1044
|
+
* const option = new RadioGroupOptionBuilder()
|
|
1045
|
+
* .setLabel('Option 2')
|
|
1046
|
+
* .setValue('option_2');
|
|
1047
|
+
* ```
|
|
1048
|
+
*/
|
|
1049
|
+
constructor(data = {}) {
|
|
1050
|
+
this.data = data;
|
|
1051
|
+
}
|
|
1052
|
+
static {
|
|
1053
|
+
__name(this, "RadioGroupOptionBuilder");
|
|
1054
|
+
}
|
|
1055
|
+
/**
|
|
1056
|
+
* Sets the label for this option.
|
|
1057
|
+
*
|
|
1058
|
+
* @param label - The label to use
|
|
1059
|
+
*/
|
|
1060
|
+
setLabel(label) {
|
|
1061
|
+
this.data.label = label;
|
|
1062
|
+
return this;
|
|
1063
|
+
}
|
|
1064
|
+
/**
|
|
1065
|
+
* Sets the value for this option.
|
|
1066
|
+
*
|
|
1067
|
+
* @param value - The value to use
|
|
1068
|
+
*/
|
|
1069
|
+
setValue(value) {
|
|
1070
|
+
this.data.value = value;
|
|
1071
|
+
return this;
|
|
1072
|
+
}
|
|
1073
|
+
/**
|
|
1074
|
+
* Sets the description for this option.
|
|
1075
|
+
*
|
|
1076
|
+
* @param description - The description to use
|
|
1077
|
+
*/
|
|
1078
|
+
setDescription(description) {
|
|
1079
|
+
this.data.description = description;
|
|
1080
|
+
return this;
|
|
1081
|
+
}
|
|
1082
|
+
/**
|
|
1083
|
+
* Sets whether this option is selected by default.
|
|
1084
|
+
*
|
|
1085
|
+
* @param isDefault - Whether the option should be selected by default
|
|
1086
|
+
*/
|
|
1087
|
+
setDefault(isDefault) {
|
|
1088
|
+
this.data.default = isDefault;
|
|
1089
|
+
return this;
|
|
1090
|
+
}
|
|
1091
|
+
/**
|
|
1092
|
+
* {@inheritDoc ComponentBuilder.toJSON}
|
|
1093
|
+
*/
|
|
1094
|
+
toJSON() {
|
|
1095
|
+
radioGroupOptionPredicate.parse(this.data);
|
|
1096
|
+
return {
|
|
1097
|
+
...this.data
|
|
1098
|
+
};
|
|
1099
|
+
}
|
|
1100
|
+
};
|
|
1101
|
+
|
|
1102
|
+
// src/components/checkbox/RadioGroup.ts
|
|
1103
|
+
var RadioGroupBuilder = class extends ComponentBuilder {
|
|
1104
|
+
static {
|
|
1105
|
+
__name(this, "RadioGroupBuilder");
|
|
1106
|
+
}
|
|
1107
|
+
/**
|
|
1108
|
+
* The options within this radio group.
|
|
1109
|
+
*/
|
|
1110
|
+
options;
|
|
1111
|
+
/**
|
|
1112
|
+
* Creates a new radio group from API data.
|
|
1113
|
+
*
|
|
1114
|
+
* @param data - The API data to create this radio group with
|
|
1115
|
+
* @example
|
|
1116
|
+
* Creating a radio group from an API data object:
|
|
1117
|
+
* ```ts
|
|
1118
|
+
* const radioGroup = new RadioGroupBuilder({
|
|
1119
|
+
* custom_id: 'select_options',
|
|
1120
|
+
* options: [
|
|
1121
|
+
* { label: 'Option 1', value: 'option_1' },
|
|
1122
|
+
* { label: 'Option 2', value: 'option_2' },
|
|
1123
|
+
* ],
|
|
1124
|
+
* });
|
|
1125
|
+
* ```
|
|
1126
|
+
* @example
|
|
1127
|
+
* Creating a radio group using setters and API data:
|
|
1128
|
+
* ```ts
|
|
1129
|
+
* const radioGroup = new RadioGroupBuilder()
|
|
1130
|
+
* .setCustomId('choose_items')
|
|
1131
|
+
* .setOptions([
|
|
1132
|
+
* { label: 'Item A', value: 'item_a' },
|
|
1133
|
+
* { label: 'Item B', value: 'item_b' },
|
|
1134
|
+
* ])
|
|
1135
|
+
* ```
|
|
1136
|
+
*/
|
|
1137
|
+
constructor(data) {
|
|
1138
|
+
const { options, ...initData } = data ?? {};
|
|
1139
|
+
super({ ...initData, type: ComponentType5.RadioGroup });
|
|
1140
|
+
this.options = options?.map((option) => new RadioGroupOptionBuilder(option)) ?? [];
|
|
1141
|
+
}
|
|
1142
|
+
/**
|
|
1143
|
+
* Sets the custom id of this radio group.
|
|
1144
|
+
*
|
|
1145
|
+
* @param customId - The custom id to use
|
|
1146
|
+
*/
|
|
1147
|
+
setCustomId(customId) {
|
|
1148
|
+
this.data.custom_id = customId;
|
|
1149
|
+
return this;
|
|
1150
|
+
}
|
|
1151
|
+
/**
|
|
1152
|
+
* Adds options to this radio group.
|
|
1153
|
+
*
|
|
1154
|
+
* @param options - The options to add
|
|
1155
|
+
*/
|
|
1156
|
+
addOptions(...options) {
|
|
1157
|
+
const normalizedOptions = normalizeArray(options);
|
|
1158
|
+
this.options.push(
|
|
1159
|
+
...normalizedOptions.map((normalizedOption) => {
|
|
1160
|
+
const json = "toJSON" in normalizedOption ? normalizedOption.toJSON() : normalizedOption;
|
|
1161
|
+
const option = new RadioGroupOptionBuilder(json);
|
|
1162
|
+
radioGroupOptionPredicate.parse(option.toJSON());
|
|
1163
|
+
return option;
|
|
1164
|
+
})
|
|
1165
|
+
);
|
|
1166
|
+
return this;
|
|
1167
|
+
}
|
|
1168
|
+
/**
|
|
1169
|
+
* Sets the options for this radio group.
|
|
1170
|
+
*
|
|
1171
|
+
* @param options - The options to use
|
|
1172
|
+
*/
|
|
1173
|
+
setOptions(options) {
|
|
1174
|
+
return this.spliceOptions(0, this.options.length, ...options);
|
|
1175
|
+
}
|
|
1176
|
+
/**
|
|
1177
|
+
* Removes, replaces, or inserts options for this radio group.
|
|
1178
|
+
*
|
|
1179
|
+
* @remarks
|
|
1180
|
+
* This method behaves similarly
|
|
1181
|
+
* to {@link https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array/splice | Array.prototype.splice()}.
|
|
1182
|
+
* It's useful for modifying and adjusting the order of existing options.
|
|
1183
|
+
* @param index - The index to start at
|
|
1184
|
+
* @param deleteCount - The number of options to remove
|
|
1185
|
+
* @param options - The replacing option objects or builders
|
|
1186
|
+
*/
|
|
1187
|
+
spliceOptions(index, deleteCount, ...options) {
|
|
1188
|
+
const normalizedOptions = normalizeArray(options);
|
|
1189
|
+
const clone = [...this.options];
|
|
1190
|
+
clone.splice(
|
|
1191
|
+
index,
|
|
1192
|
+
deleteCount,
|
|
1193
|
+
...normalizedOptions.map((normalizedOption) => {
|
|
1194
|
+
const json = "toJSON" in normalizedOption ? normalizedOption.toJSON() : normalizedOption;
|
|
1195
|
+
const option = new RadioGroupOptionBuilder(json);
|
|
1196
|
+
radioGroupOptionPredicate.parse(option.toJSON());
|
|
1197
|
+
return option;
|
|
1198
|
+
})
|
|
1199
|
+
);
|
|
1200
|
+
this.options.splice(0, this.options.length, ...clone);
|
|
1201
|
+
return this;
|
|
1202
|
+
}
|
|
1203
|
+
/**
|
|
1204
|
+
* Sets whether selecting options is required.
|
|
1205
|
+
*
|
|
1206
|
+
* @param required - Whether selecting options is required
|
|
1207
|
+
*/
|
|
1208
|
+
setRequired(required) {
|
|
1209
|
+
this.data.required = required;
|
|
1210
|
+
return this;
|
|
1211
|
+
}
|
|
1212
|
+
/**
|
|
1213
|
+
* {@inheritDoc ComponentBuilder.toJSON}
|
|
1214
|
+
*/
|
|
1215
|
+
toJSON() {
|
|
1216
|
+
const data = {
|
|
1217
|
+
...this.data,
|
|
1218
|
+
options: this.options.map((option) => option.toJSON())
|
|
1219
|
+
};
|
|
1220
|
+
radioGroupPredicate.parse(data);
|
|
1221
|
+
return data;
|
|
1222
|
+
}
|
|
1223
|
+
};
|
|
1224
|
+
|
|
1225
|
+
// src/components/fileUpload/FileUpload.ts
|
|
1226
|
+
import { ComponentType as ComponentType7 } from "discord-api-types/v10";
|
|
1227
|
+
|
|
1228
|
+
// src/components/fileUpload/Assertions.ts
|
|
1229
|
+
var Assertions_exports4 = {};
|
|
1230
|
+
__export(Assertions_exports4, {
|
|
1231
|
+
fileUploadPredicate: () => fileUploadPredicate
|
|
1232
|
+
});
|
|
1233
|
+
import { s as s4 } from "@sapphire/shapeshift";
|
|
1234
|
+
import { ComponentType as ComponentType6 } from "discord-api-types/v10";
|
|
1235
|
+
var fileUploadPredicate = s4.object({
|
|
1236
|
+
type: s4.literal(ComponentType6.FileUpload),
|
|
1237
|
+
id: idValidator.optional(),
|
|
1238
|
+
custom_id: customIdValidator,
|
|
1239
|
+
min_values: s4.number().greaterThanOrEqual(0).lessThanOrEqual(10).optional(),
|
|
1240
|
+
max_values: s4.number().greaterThanOrEqual(1).lessThanOrEqual(10).optional(),
|
|
1241
|
+
required: s4.boolean().optional()
|
|
685
1242
|
});
|
|
686
1243
|
|
|
687
1244
|
// src/components/fileUpload/FileUpload.ts
|
|
@@ -713,7 +1270,7 @@ var FileUploadBuilder = class extends ComponentBuilder {
|
|
|
713
1270
|
* ```
|
|
714
1271
|
*/
|
|
715
1272
|
constructor(data = {}) {
|
|
716
|
-
super({ type:
|
|
1273
|
+
super({ type: ComponentType7.FileUpload, ...data });
|
|
717
1274
|
}
|
|
718
1275
|
/**
|
|
719
1276
|
* Sets the custom id for this file upload.
|
|
@@ -743,7 +1300,7 @@ var FileUploadBuilder = class extends ComponentBuilder {
|
|
|
743
1300
|
/**
|
|
744
1301
|
* Sets the maximum number of file uploads required.
|
|
745
1302
|
*
|
|
746
|
-
* @param maxValues - The maximum values that
|
|
1303
|
+
* @param maxValues - The maximum values that can be uploaded
|
|
747
1304
|
*/
|
|
748
1305
|
setMaxValues(maxValues) {
|
|
749
1306
|
this.data.max_values = maxValues;
|
|
@@ -775,17 +1332,17 @@ var FileUploadBuilder = class extends ComponentBuilder {
|
|
|
775
1332
|
};
|
|
776
1333
|
|
|
777
1334
|
// src/components/label/Label.ts
|
|
778
|
-
import { ComponentType as
|
|
1335
|
+
import { ComponentType as ComponentType17 } from "discord-api-types/v10";
|
|
779
1336
|
|
|
780
1337
|
// src/components/selectMenu/ChannelSelectMenu.ts
|
|
781
1338
|
import {
|
|
782
|
-
ComponentType as
|
|
1339
|
+
ComponentType as ComponentType9,
|
|
783
1340
|
SelectMenuDefaultValueType
|
|
784
1341
|
} from "discord-api-types/v10";
|
|
785
1342
|
|
|
786
1343
|
// src/components/textInput/Assertions.ts
|
|
787
|
-
var
|
|
788
|
-
__export(
|
|
1344
|
+
var Assertions_exports5 = {};
|
|
1345
|
+
__export(Assertions_exports5, {
|
|
789
1346
|
labelValidator: () => labelValidator,
|
|
790
1347
|
maxLengthValidator: () => maxLengthValidator,
|
|
791
1348
|
minLengthValidator: () => minLengthValidator,
|
|
@@ -796,17 +1353,17 @@ __export(Assertions_exports4, {
|
|
|
796
1353
|
validateRequiredParameters: () => validateRequiredParameters,
|
|
797
1354
|
valueValidator: () => valueValidator
|
|
798
1355
|
});
|
|
799
|
-
import { s as
|
|
800
|
-
import { ComponentType as
|
|
801
|
-
var textInputStyleValidator =
|
|
802
|
-
var minLengthValidator =
|
|
803
|
-
var maxLengthValidator =
|
|
804
|
-
var requiredValidator =
|
|
805
|
-
var valueValidator =
|
|
806
|
-
var placeholderValidator2 =
|
|
807
|
-
var labelValidator =
|
|
808
|
-
var textInputPredicate =
|
|
809
|
-
type:
|
|
1356
|
+
import { s as s5 } from "@sapphire/shapeshift";
|
|
1357
|
+
import { ComponentType as ComponentType8, TextInputStyle } from "discord-api-types/v10";
|
|
1358
|
+
var textInputStyleValidator = s5.nativeEnum(TextInputStyle).setValidationEnabled(isValidationEnabled);
|
|
1359
|
+
var minLengthValidator = s5.number().int().greaterThanOrEqual(0).lessThanOrEqual(4e3).setValidationEnabled(isValidationEnabled);
|
|
1360
|
+
var maxLengthValidator = s5.number().int().greaterThanOrEqual(1).lessThanOrEqual(4e3).setValidationEnabled(isValidationEnabled);
|
|
1361
|
+
var requiredValidator = s5.boolean().setValidationEnabled(isValidationEnabled);
|
|
1362
|
+
var valueValidator = s5.string().lengthLessThanOrEqual(4e3).setValidationEnabled(isValidationEnabled);
|
|
1363
|
+
var placeholderValidator2 = s5.string().lengthLessThanOrEqual(100).setValidationEnabled(isValidationEnabled);
|
|
1364
|
+
var labelValidator = s5.string().lengthGreaterThanOrEqual(1).lengthLessThanOrEqual(45).setValidationEnabled(isValidationEnabled);
|
|
1365
|
+
var textInputPredicate = s5.object({
|
|
1366
|
+
type: s5.literal(ComponentType8.TextInput),
|
|
810
1367
|
custom_id: customIdValidator,
|
|
811
1368
|
style: textInputStyleValidator,
|
|
812
1369
|
id: idValidator.optional(),
|
|
@@ -846,9 +1403,9 @@ var BaseSelectMenuBuilder = class extends ComponentBuilder {
|
|
|
846
1403
|
return this;
|
|
847
1404
|
}
|
|
848
1405
|
/**
|
|
849
|
-
* Sets the maximum values that
|
|
1406
|
+
* Sets the maximum values that can be selected in the select menu.
|
|
850
1407
|
*
|
|
851
|
-
* @param maxValues - The maximum values that
|
|
1408
|
+
* @param maxValues - The maximum values that can be selected
|
|
852
1409
|
*/
|
|
853
1410
|
setMaxValues(maxValues) {
|
|
854
1411
|
this.data.max_values = minMaxValidator.parse(maxValues);
|
|
@@ -922,7 +1479,7 @@ var ChannelSelectMenuBuilder = class extends BaseSelectMenuBuilder {
|
|
|
922
1479
|
* ```
|
|
923
1480
|
*/
|
|
924
1481
|
constructor(data) {
|
|
925
|
-
super({ ...data, type:
|
|
1482
|
+
super({ ...data, type: ComponentType9.ChannelSelect });
|
|
926
1483
|
}
|
|
927
1484
|
/**
|
|
928
1485
|
* Adds channel types to this select menu.
|
|
@@ -990,7 +1547,7 @@ var ChannelSelectMenuBuilder = class extends BaseSelectMenuBuilder {
|
|
|
990
1547
|
|
|
991
1548
|
// src/components/selectMenu/MentionableSelectMenu.ts
|
|
992
1549
|
import {
|
|
993
|
-
ComponentType as
|
|
1550
|
+
ComponentType as ComponentType10,
|
|
994
1551
|
SelectMenuDefaultValueType as SelectMenuDefaultValueType2
|
|
995
1552
|
} from "discord-api-types/v10";
|
|
996
1553
|
var MentionableSelectMenuBuilder = class extends BaseSelectMenuBuilder {
|
|
@@ -1020,7 +1577,7 @@ var MentionableSelectMenuBuilder = class extends BaseSelectMenuBuilder {
|
|
|
1020
1577
|
* ```
|
|
1021
1578
|
*/
|
|
1022
1579
|
constructor(data) {
|
|
1023
|
-
super({ ...data, type:
|
|
1580
|
+
super({ ...data, type: ComponentType10.MentionableSelect });
|
|
1024
1581
|
}
|
|
1025
1582
|
/**
|
|
1026
1583
|
* Adds default roles to this auto populated select menu.
|
|
@@ -1083,7 +1640,7 @@ var MentionableSelectMenuBuilder = class extends BaseSelectMenuBuilder {
|
|
|
1083
1640
|
|
|
1084
1641
|
// src/components/selectMenu/RoleSelectMenu.ts
|
|
1085
1642
|
import {
|
|
1086
|
-
ComponentType as
|
|
1643
|
+
ComponentType as ComponentType11,
|
|
1087
1644
|
SelectMenuDefaultValueType as SelectMenuDefaultValueType3
|
|
1088
1645
|
} from "discord-api-types/v10";
|
|
1089
1646
|
var RoleSelectMenuBuilder = class extends BaseSelectMenuBuilder {
|
|
@@ -1113,7 +1670,7 @@ var RoleSelectMenuBuilder = class extends BaseSelectMenuBuilder {
|
|
|
1113
1670
|
* ```
|
|
1114
1671
|
*/
|
|
1115
1672
|
constructor(data) {
|
|
1116
|
-
super({ ...data, type:
|
|
1673
|
+
super({ ...data, type: ComponentType11.RoleSelect });
|
|
1117
1674
|
}
|
|
1118
1675
|
/**
|
|
1119
1676
|
* Adds default roles to this auto populated select menu.
|
|
@@ -1149,7 +1706,71 @@ var RoleSelectMenuBuilder = class extends BaseSelectMenuBuilder {
|
|
|
1149
1706
|
};
|
|
1150
1707
|
|
|
1151
1708
|
// src/components/selectMenu/StringSelectMenu.ts
|
|
1152
|
-
import { ComponentType as
|
|
1709
|
+
import { ComponentType as ComponentType13 } from "discord-api-types/v10";
|
|
1710
|
+
|
|
1711
|
+
// src/components/selectMenu/Assertions.ts
|
|
1712
|
+
var Assertions_exports6 = {};
|
|
1713
|
+
__export(Assertions_exports6, {
|
|
1714
|
+
selectMenuChannelPredicate: () => selectMenuChannelPredicate,
|
|
1715
|
+
selectMenuMentionablePredicate: () => selectMenuMentionablePredicate,
|
|
1716
|
+
selectMenuRolePredicate: () => selectMenuRolePredicate,
|
|
1717
|
+
selectMenuStringOptionPredicate: () => selectMenuStringOptionPredicate,
|
|
1718
|
+
selectMenuStringPredicate: () => selectMenuStringPredicate,
|
|
1719
|
+
selectMenuUserPredicate: () => selectMenuUserPredicate
|
|
1720
|
+
});
|
|
1721
|
+
import { Result as Result2, s as s6 } from "@sapphire/shapeshift";
|
|
1722
|
+
import { ChannelType as ChannelType2, ComponentType as ComponentType12, SelectMenuDefaultValueType as SelectMenuDefaultValueType4 } from "discord-api-types/v10";
|
|
1723
|
+
var selectMenuBasePredicate = s6.object({
|
|
1724
|
+
id: idValidator.optional(),
|
|
1725
|
+
placeholder: s6.string().lengthLessThanOrEqual(150).optional(),
|
|
1726
|
+
min_values: s6.number().greaterThanOrEqual(0).lessThanOrEqual(25).optional(),
|
|
1727
|
+
max_values: s6.number().greaterThanOrEqual(0).lessThanOrEqual(25).optional(),
|
|
1728
|
+
custom_id: customIdValidator,
|
|
1729
|
+
disabled: s6.boolean().optional()
|
|
1730
|
+
});
|
|
1731
|
+
var selectMenuChannelPredicate = selectMenuBasePredicate.extend({
|
|
1732
|
+
type: s6.literal(ComponentType12.ChannelSelect),
|
|
1733
|
+
channel_types: s6.nativeEnum(ChannelType2).array().optional(),
|
|
1734
|
+
default_values: s6.object({ id: s6.string(), type: s6.literal(SelectMenuDefaultValueType4.Channel) }).array().lengthLessThanOrEqual(25).optional()
|
|
1735
|
+
}).setValidationEnabled(isValidationEnabled);
|
|
1736
|
+
var selectMenuMentionablePredicate = selectMenuBasePredicate.extend({
|
|
1737
|
+
type: s6.literal(ComponentType12.MentionableSelect),
|
|
1738
|
+
default_values: s6.object({
|
|
1739
|
+
id: s6.string(),
|
|
1740
|
+
type: s6.union([s6.literal(SelectMenuDefaultValueType4.Role), s6.literal(SelectMenuDefaultValueType4.User)])
|
|
1741
|
+
}).array().lengthLessThanOrEqual(25).optional()
|
|
1742
|
+
}).setValidationEnabled(isValidationEnabled);
|
|
1743
|
+
var selectMenuRolePredicate = selectMenuBasePredicate.extend({
|
|
1744
|
+
type: s6.literal(ComponentType12.RoleSelect),
|
|
1745
|
+
default_values: s6.object({ id: s6.string(), type: s6.literal(SelectMenuDefaultValueType4.Role) }).array().lengthLessThanOrEqual(25).optional()
|
|
1746
|
+
}).setValidationEnabled(isValidationEnabled);
|
|
1747
|
+
var selectMenuUserPredicate = selectMenuBasePredicate.extend({
|
|
1748
|
+
type: s6.literal(ComponentType12.UserSelect),
|
|
1749
|
+
default_values: s6.object({ id: s6.string(), type: s6.literal(SelectMenuDefaultValueType4.User) }).array().lengthLessThanOrEqual(25).optional()
|
|
1750
|
+
}).setValidationEnabled(isValidationEnabled);
|
|
1751
|
+
var selectMenuStringOptionPredicate = s6.object({
|
|
1752
|
+
label: s6.string().lengthGreaterThanOrEqual(1).lengthLessThanOrEqual(100),
|
|
1753
|
+
value: s6.string().lengthGreaterThanOrEqual(1).lengthLessThanOrEqual(100),
|
|
1754
|
+
description: s6.string().lengthGreaterThanOrEqual(1).lengthLessThanOrEqual(100).optional(),
|
|
1755
|
+
emoji: emojiValidator.optional(),
|
|
1756
|
+
default: s6.boolean().optional()
|
|
1757
|
+
}).setValidationEnabled(isValidationEnabled);
|
|
1758
|
+
var selectMenuStringPredicate = selectMenuBasePredicate.extend({
|
|
1759
|
+
type: s6.literal(ComponentType12.StringSelect),
|
|
1760
|
+
options: selectMenuStringOptionPredicate.array().lengthGreaterThanOrEqual(1).lengthLessThanOrEqual(25)
|
|
1761
|
+
}).reshape((value) => {
|
|
1762
|
+
if (value.min_values !== void 0 && value.options.length < value.min_values) {
|
|
1763
|
+
return Result2.err(new RangeError(`The number of options must be greater than or equal to min_values`));
|
|
1764
|
+
}
|
|
1765
|
+
if (value.min_values !== void 0 && value.max_values !== void 0 && value.min_values > value.max_values) {
|
|
1766
|
+
return Result2.err(
|
|
1767
|
+
new RangeError(`The maximum amount of options must be greater than or equal to the minimum amount of options`)
|
|
1768
|
+
);
|
|
1769
|
+
}
|
|
1770
|
+
return Result2.ok(value);
|
|
1771
|
+
}).setValidationEnabled(isValidationEnabled);
|
|
1772
|
+
|
|
1773
|
+
// src/components/selectMenu/StringSelectMenu.ts
|
|
1153
1774
|
var StringSelectMenuBuilder = class extends BaseSelectMenuBuilder {
|
|
1154
1775
|
static {
|
|
1155
1776
|
__name(this, "StringSelectMenuBuilder");
|
|
@@ -1191,7 +1812,7 @@ var StringSelectMenuBuilder = class extends BaseSelectMenuBuilder {
|
|
|
1191
1812
|
*/
|
|
1192
1813
|
constructor(data) {
|
|
1193
1814
|
const { options, ...initData } = data ?? {};
|
|
1194
|
-
super({ ...initData, type:
|
|
1815
|
+
super({ ...initData, type: ComponentType13.StringSelect });
|
|
1195
1816
|
this.options = options?.map((option) => new StringSelectMenuOptionBuilder(option)) ?? [];
|
|
1196
1817
|
}
|
|
1197
1818
|
/**
|
|
@@ -1204,7 +1825,7 @@ var StringSelectMenuBuilder = class extends BaseSelectMenuBuilder {
|
|
|
1204
1825
|
optionsLengthValidator.parse(this.options.length + normalizedOptions.length);
|
|
1205
1826
|
this.options.push(
|
|
1206
1827
|
...normalizedOptions.map(
|
|
1207
|
-
(normalizedOption) => normalizedOption instanceof StringSelectMenuOptionBuilder ? normalizedOption : new StringSelectMenuOptionBuilder(
|
|
1828
|
+
(normalizedOption) => normalizedOption instanceof StringSelectMenuOptionBuilder ? normalizedOption : new StringSelectMenuOptionBuilder(selectMenuStringOptionPredicate.parse(normalizedOption))
|
|
1208
1829
|
)
|
|
1209
1830
|
);
|
|
1210
1831
|
return this;
|
|
@@ -1222,7 +1843,7 @@ var StringSelectMenuBuilder = class extends BaseSelectMenuBuilder {
|
|
|
1222
1843
|
*
|
|
1223
1844
|
* @remarks
|
|
1224
1845
|
* This method behaves similarly
|
|
1225
|
-
* to {@link https://developer.mozilla.org/
|
|
1846
|
+
* to {@link https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array/splice | Array.prototype.splice()}.
|
|
1226
1847
|
* It's useful for modifying and adjusting the order of existing options.
|
|
1227
1848
|
* @example
|
|
1228
1849
|
* Remove the first option:
|
|
@@ -1251,7 +1872,7 @@ var StringSelectMenuBuilder = class extends BaseSelectMenuBuilder {
|
|
|
1251
1872
|
index,
|
|
1252
1873
|
deleteCount,
|
|
1253
1874
|
...normalizedOptions.map(
|
|
1254
|
-
(normalizedOption) => normalizedOption instanceof StringSelectMenuOptionBuilder ? normalizedOption : new StringSelectMenuOptionBuilder(
|
|
1875
|
+
(normalizedOption) => normalizedOption instanceof StringSelectMenuOptionBuilder ? normalizedOption : new StringSelectMenuOptionBuilder(selectMenuStringOptionPredicate.parse(normalizedOption))
|
|
1255
1876
|
)
|
|
1256
1877
|
);
|
|
1257
1878
|
optionsLengthValidator.parse(clone.length);
|
|
@@ -1272,8 +1893,8 @@ var StringSelectMenuBuilder = class extends BaseSelectMenuBuilder {
|
|
|
1272
1893
|
|
|
1273
1894
|
// src/components/selectMenu/UserSelectMenu.ts
|
|
1274
1895
|
import {
|
|
1275
|
-
ComponentType as
|
|
1276
|
-
SelectMenuDefaultValueType as
|
|
1896
|
+
ComponentType as ComponentType14,
|
|
1897
|
+
SelectMenuDefaultValueType as SelectMenuDefaultValueType5
|
|
1277
1898
|
} from "discord-api-types/v10";
|
|
1278
1899
|
var UserSelectMenuBuilder = class extends BaseSelectMenuBuilder {
|
|
1279
1900
|
static {
|
|
@@ -1302,7 +1923,7 @@ var UserSelectMenuBuilder = class extends BaseSelectMenuBuilder {
|
|
|
1302
1923
|
* ```
|
|
1303
1924
|
*/
|
|
1304
1925
|
constructor(data) {
|
|
1305
|
-
super({ ...data, type:
|
|
1926
|
+
super({ ...data, type: ComponentType14.UserSelect });
|
|
1306
1927
|
}
|
|
1307
1928
|
/**
|
|
1308
1929
|
* Adds default users to this auto populated select menu.
|
|
@@ -1316,7 +1937,7 @@ var UserSelectMenuBuilder = class extends BaseSelectMenuBuilder {
|
|
|
1316
1937
|
this.data.default_values.push(
|
|
1317
1938
|
...normalizedValues.map((id) => ({
|
|
1318
1939
|
id,
|
|
1319
|
-
type:
|
|
1940
|
+
type: SelectMenuDefaultValueType5.User
|
|
1320
1941
|
}))
|
|
1321
1942
|
);
|
|
1322
1943
|
return this;
|
|
@@ -1331,7 +1952,7 @@ var UserSelectMenuBuilder = class extends BaseSelectMenuBuilder {
|
|
|
1331
1952
|
optionsLengthValidator.parse(normalizedValues.length);
|
|
1332
1953
|
this.data.default_values = normalizedValues.map((id) => ({
|
|
1333
1954
|
id,
|
|
1334
|
-
type:
|
|
1955
|
+
type: SelectMenuDefaultValueType5.User
|
|
1335
1956
|
}));
|
|
1336
1957
|
return this;
|
|
1337
1958
|
}
|
|
@@ -1339,7 +1960,7 @@ var UserSelectMenuBuilder = class extends BaseSelectMenuBuilder {
|
|
|
1339
1960
|
|
|
1340
1961
|
// src/components/textInput/TextInput.ts
|
|
1341
1962
|
import { isJSONEncodable } from "@discordjs/util";
|
|
1342
|
-
import { ComponentType as
|
|
1963
|
+
import { ComponentType as ComponentType15 } from "discord-api-types/v10";
|
|
1343
1964
|
import isEqual from "fast-deep-equal";
|
|
1344
1965
|
var TextInputBuilder = class extends ComponentBuilder {
|
|
1345
1966
|
static {
|
|
@@ -1369,7 +1990,7 @@ var TextInputBuilder = class extends ComponentBuilder {
|
|
|
1369
1990
|
* ```
|
|
1370
1991
|
*/
|
|
1371
1992
|
constructor(data) {
|
|
1372
|
-
super({ type:
|
|
1993
|
+
super({ type: ComponentType15.TextInput, ...data });
|
|
1373
1994
|
}
|
|
1374
1995
|
/**
|
|
1375
1996
|
* Sets the custom id for this text input.
|
|
@@ -1465,80 +2086,28 @@ var TextInputBuilder = class extends ComponentBuilder {
|
|
|
1465
2086
|
};
|
|
1466
2087
|
|
|
1467
2088
|
// src/components/label/Assertions.ts
|
|
1468
|
-
var
|
|
1469
|
-
__export(
|
|
2089
|
+
var Assertions_exports7 = {};
|
|
2090
|
+
__export(Assertions_exports7, {
|
|
1470
2091
|
labelPredicate: () => labelPredicate
|
|
1471
2092
|
});
|
|
1472
|
-
import { s as
|
|
1473
|
-
import { ComponentType as
|
|
1474
|
-
|
|
1475
|
-
// src/components/selectMenu/Assertions.ts
|
|
1476
|
-
import { Result, s as s5 } from "@sapphire/shapeshift";
|
|
1477
|
-
import { ChannelType as ChannelType2, ComponentType as ComponentType11, SelectMenuDefaultValueType as SelectMenuDefaultValueType5 } from "discord-api-types/v10";
|
|
1478
|
-
var selectMenuBasePredicate = s5.object({
|
|
1479
|
-
id: idValidator.optional(),
|
|
1480
|
-
placeholder: s5.string().lengthLessThanOrEqual(150).optional(),
|
|
1481
|
-
min_values: s5.number().greaterThanOrEqual(0).lessThanOrEqual(25).optional(),
|
|
1482
|
-
max_values: s5.number().greaterThanOrEqual(0).lessThanOrEqual(25).optional(),
|
|
1483
|
-
custom_id: customIdValidator,
|
|
1484
|
-
disabled: s5.boolean().optional()
|
|
1485
|
-
});
|
|
1486
|
-
var selectMenuChannelPredicate = selectMenuBasePredicate.extend({
|
|
1487
|
-
type: s5.literal(ComponentType11.ChannelSelect),
|
|
1488
|
-
channel_types: s5.nativeEnum(ChannelType2).array().optional(),
|
|
1489
|
-
default_values: s5.object({ id: s5.string(), type: s5.literal(SelectMenuDefaultValueType5.Channel) }).array().lengthLessThanOrEqual(25).optional()
|
|
1490
|
-
}).setValidationEnabled(isValidationEnabled);
|
|
1491
|
-
var selectMenuMentionablePredicate = selectMenuBasePredicate.extend({
|
|
1492
|
-
type: s5.literal(ComponentType11.MentionableSelect),
|
|
1493
|
-
default_values: s5.object({
|
|
1494
|
-
id: s5.string(),
|
|
1495
|
-
type: s5.union([s5.literal(SelectMenuDefaultValueType5.Role), s5.literal(SelectMenuDefaultValueType5.User)])
|
|
1496
|
-
}).array().lengthLessThanOrEqual(25).optional()
|
|
1497
|
-
}).setValidationEnabled(isValidationEnabled);
|
|
1498
|
-
var selectMenuRolePredicate = selectMenuBasePredicate.extend({
|
|
1499
|
-
type: s5.literal(ComponentType11.RoleSelect),
|
|
1500
|
-
default_values: s5.object({ id: s5.string(), type: s5.literal(SelectMenuDefaultValueType5.Role) }).array().lengthLessThanOrEqual(25).optional()
|
|
1501
|
-
}).setValidationEnabled(isValidationEnabled);
|
|
1502
|
-
var selectMenuUserPredicate = selectMenuBasePredicate.extend({
|
|
1503
|
-
type: s5.literal(ComponentType11.UserSelect),
|
|
1504
|
-
default_values: s5.object({ id: s5.string(), type: s5.literal(SelectMenuDefaultValueType5.User) }).array().lengthLessThanOrEqual(25).optional()
|
|
1505
|
-
}).setValidationEnabled(isValidationEnabled);
|
|
1506
|
-
var selectMenuStringOptionPredicate = s5.object({
|
|
1507
|
-
label: labelValidator,
|
|
1508
|
-
value: s5.string().lengthGreaterThanOrEqual(1).lengthLessThanOrEqual(100),
|
|
1509
|
-
description: s5.string().lengthGreaterThanOrEqual(1).lengthLessThanOrEqual(100).optional(),
|
|
1510
|
-
emoji: emojiValidator.optional(),
|
|
1511
|
-
default: s5.boolean().optional()
|
|
1512
|
-
}).setValidationEnabled(isValidationEnabled);
|
|
1513
|
-
var selectMenuStringPredicate = selectMenuBasePredicate.extend({
|
|
1514
|
-
type: s5.literal(ComponentType11.StringSelect),
|
|
1515
|
-
options: selectMenuStringOptionPredicate.array().lengthGreaterThanOrEqual(1).lengthLessThanOrEqual(25)
|
|
1516
|
-
}).reshape((value) => {
|
|
1517
|
-
if (value.min_values !== void 0 && value.options.length < value.min_values) {
|
|
1518
|
-
return Result.err(new RangeError(`The number of options must be greater than or equal to min_values`));
|
|
1519
|
-
}
|
|
1520
|
-
if (value.min_values !== void 0 && value.max_values !== void 0 && value.min_values > value.max_values) {
|
|
1521
|
-
return Result.err(
|
|
1522
|
-
new RangeError(`The maximum amount of options must be greater than or equal to the minimum amount of options`)
|
|
1523
|
-
);
|
|
1524
|
-
}
|
|
1525
|
-
return Result.ok(value);
|
|
1526
|
-
}).setValidationEnabled(isValidationEnabled);
|
|
1527
|
-
|
|
1528
|
-
// src/components/label/Assertions.ts
|
|
1529
|
-
var labelPredicate = s6.object({
|
|
2093
|
+
import { s as s7 } from "@sapphire/shapeshift";
|
|
2094
|
+
import { ComponentType as ComponentType16 } from "discord-api-types/v10";
|
|
2095
|
+
var labelPredicate = s7.object({
|
|
1530
2096
|
id: idValidator.optional(),
|
|
1531
|
-
type:
|
|
1532
|
-
label:
|
|
1533
|
-
description:
|
|
1534
|
-
component:
|
|
2097
|
+
type: s7.literal(ComponentType16.Label),
|
|
2098
|
+
label: s7.string().lengthGreaterThanOrEqual(1).lengthLessThanOrEqual(45),
|
|
2099
|
+
description: s7.string().lengthGreaterThanOrEqual(1).lengthLessThanOrEqual(100).optional(),
|
|
2100
|
+
component: s7.union([
|
|
1535
2101
|
textInputPredicate,
|
|
1536
2102
|
selectMenuUserPredicate,
|
|
1537
2103
|
selectMenuRolePredicate,
|
|
1538
2104
|
selectMenuMentionablePredicate,
|
|
1539
2105
|
selectMenuChannelPredicate,
|
|
1540
2106
|
selectMenuStringPredicate,
|
|
1541
|
-
fileUploadPredicate
|
|
2107
|
+
fileUploadPredicate,
|
|
2108
|
+
checkboxPredicate,
|
|
2109
|
+
checkboxGroupPredicate,
|
|
2110
|
+
radioGroupPredicate
|
|
1542
2111
|
])
|
|
1543
2112
|
}).setValidationEnabled(isValidationEnabled);
|
|
1544
2113
|
|
|
@@ -1573,12 +2142,12 @@ var LabelBuilder = class extends ComponentBuilder {
|
|
|
1573
2142
|
* ```
|
|
1574
2143
|
*/
|
|
1575
2144
|
constructor(data = {}) {
|
|
1576
|
-
super({ type:
|
|
2145
|
+
super({ type: ComponentType17.Label });
|
|
1577
2146
|
const { component, ...rest } = data;
|
|
1578
2147
|
this.data = {
|
|
1579
2148
|
...rest,
|
|
1580
2149
|
component: component ? createComponentBuilder(component) : void 0,
|
|
1581
|
-
type:
|
|
2150
|
+
type: ComponentType17.Label
|
|
1582
2151
|
};
|
|
1583
2152
|
}
|
|
1584
2153
|
/**
|
|
@@ -1669,6 +2238,33 @@ var LabelBuilder = class extends ComponentBuilder {
|
|
|
1669
2238
|
this.data.component = resolveBuilder(input, FileUploadBuilder);
|
|
1670
2239
|
return this;
|
|
1671
2240
|
}
|
|
2241
|
+
/**
|
|
2242
|
+
* Sets a checkbox component to this label.
|
|
2243
|
+
*
|
|
2244
|
+
* @param input - A function that returns a component builder or an already built builder
|
|
2245
|
+
*/
|
|
2246
|
+
setCheckboxComponent(input) {
|
|
2247
|
+
this.data.component = resolveBuilder(input, CheckboxBuilder);
|
|
2248
|
+
return this;
|
|
2249
|
+
}
|
|
2250
|
+
/**
|
|
2251
|
+
* Sets a checkbox group component to this label.
|
|
2252
|
+
*
|
|
2253
|
+
* @param input - A function that returns a component builder or an already built builder
|
|
2254
|
+
*/
|
|
2255
|
+
setCheckboxGroupComponent(input) {
|
|
2256
|
+
this.data.component = resolveBuilder(input, CheckboxGroupBuilder);
|
|
2257
|
+
return this;
|
|
2258
|
+
}
|
|
2259
|
+
/**
|
|
2260
|
+
* Sets a radio group component to this label.
|
|
2261
|
+
*
|
|
2262
|
+
* @param input - A function that returns a component builder or an already built builder
|
|
2263
|
+
*/
|
|
2264
|
+
setRadioGroupComponent(input) {
|
|
2265
|
+
this.data.component = resolveBuilder(input, RadioGroupBuilder);
|
|
2266
|
+
return this;
|
|
2267
|
+
}
|
|
1672
2268
|
/**
|
|
1673
2269
|
* {@inheritDoc ComponentBuilder.toJSON}
|
|
1674
2270
|
*/
|
|
@@ -1685,11 +2281,11 @@ var LabelBuilder = class extends ComponentBuilder {
|
|
|
1685
2281
|
};
|
|
1686
2282
|
|
|
1687
2283
|
// src/components/v2/Container.ts
|
|
1688
|
-
import { ComponentType as
|
|
2284
|
+
import { ComponentType as ComponentType22 } from "discord-api-types/v10";
|
|
1689
2285
|
|
|
1690
2286
|
// src/components/v2/Assertions.ts
|
|
1691
|
-
var
|
|
1692
|
-
__export(
|
|
2287
|
+
var Assertions_exports8 = {};
|
|
2288
|
+
__export(Assertions_exports8, {
|
|
1693
2289
|
accessoryPredicate: () => accessoryPredicate,
|
|
1694
2290
|
assertReturnOfBuilder: () => assertReturnOfBuilder,
|
|
1695
2291
|
containerColorPredicate: () => containerColorPredicate,
|
|
@@ -1702,11 +2298,11 @@ __export(Assertions_exports6, {
|
|
|
1702
2298
|
unfurledMediaItemPredicate: () => unfurledMediaItemPredicate,
|
|
1703
2299
|
validateComponentArray: () => validateComponentArray
|
|
1704
2300
|
});
|
|
1705
|
-
import { s as
|
|
2301
|
+
import { s as s8 } from "@sapphire/shapeshift";
|
|
1706
2302
|
import { SeparatorSpacingSize } from "discord-api-types/v10";
|
|
1707
2303
|
|
|
1708
2304
|
// src/components/v2/Thumbnail.ts
|
|
1709
|
-
import { ComponentType as
|
|
2305
|
+
import { ComponentType as ComponentType18 } from "discord-api-types/v10";
|
|
1710
2306
|
var ThumbnailBuilder = class extends ComponentBuilder {
|
|
1711
2307
|
static {
|
|
1712
2308
|
__name(this, "ThumbnailBuilder");
|
|
@@ -1738,7 +2334,7 @@ var ThumbnailBuilder = class extends ComponentBuilder {
|
|
|
1738
2334
|
*/
|
|
1739
2335
|
constructor(data = {}) {
|
|
1740
2336
|
super({
|
|
1741
|
-
type:
|
|
2337
|
+
type: ComponentType18.Thumbnail,
|
|
1742
2338
|
...data,
|
|
1743
2339
|
media: data.media ? { url: data.media.url } : void 0
|
|
1744
2340
|
});
|
|
@@ -1787,33 +2383,33 @@ var ThumbnailBuilder = class extends ComponentBuilder {
|
|
|
1787
2383
|
};
|
|
1788
2384
|
|
|
1789
2385
|
// src/components/v2/Assertions.ts
|
|
1790
|
-
var unfurledMediaItemPredicate =
|
|
1791
|
-
url:
|
|
2386
|
+
var unfurledMediaItemPredicate = s8.object({
|
|
2387
|
+
url: s8.string().url(
|
|
1792
2388
|
{ allowedProtocols: ["http:", "https:", "attachment:"] },
|
|
1793
2389
|
{ message: "Invalid protocol for media URL. Must be http:, https:, or attachment:" }
|
|
1794
2390
|
)
|
|
1795
2391
|
}).setValidationEnabled(isValidationEnabled);
|
|
1796
|
-
var descriptionPredicate2 =
|
|
1797
|
-
var filePredicate =
|
|
1798
|
-
url:
|
|
2392
|
+
var descriptionPredicate2 = s8.string().lengthGreaterThanOrEqual(1).lengthLessThanOrEqual(1024).setValidationEnabled(isValidationEnabled);
|
|
2393
|
+
var filePredicate = s8.object({
|
|
2394
|
+
url: s8.string().url({ allowedProtocols: ["attachment:"] }, { message: "Invalid protocol for file URL. Must be attachment:" })
|
|
1799
2395
|
}).setValidationEnabled(isValidationEnabled);
|
|
1800
|
-
var spoilerPredicate =
|
|
1801
|
-
var dividerPredicate =
|
|
1802
|
-
var spacingPredicate =
|
|
1803
|
-
var textDisplayContentPredicate =
|
|
1804
|
-
var accessoryPredicate =
|
|
2396
|
+
var spoilerPredicate = s8.boolean();
|
|
2397
|
+
var dividerPredicate = s8.boolean();
|
|
2398
|
+
var spacingPredicate = s8.nativeEnum(SeparatorSpacingSize);
|
|
2399
|
+
var textDisplayContentPredicate = s8.string().lengthGreaterThanOrEqual(1).lengthLessThanOrEqual(4e3).setValidationEnabled(isValidationEnabled);
|
|
2400
|
+
var accessoryPredicate = s8.instance(ButtonBuilder).or(s8.instance(ThumbnailBuilder)).setValidationEnabled(isValidationEnabled);
|
|
1805
2401
|
var containerColorPredicate = colorPredicate.nullish();
|
|
1806
2402
|
function assertReturnOfBuilder(input, ExpectedInstanceOf) {
|
|
1807
|
-
|
|
2403
|
+
s8.instance(ExpectedInstanceOf).setValidationEnabled(isValidationEnabled).parse(input);
|
|
1808
2404
|
}
|
|
1809
2405
|
__name(assertReturnOfBuilder, "assertReturnOfBuilder");
|
|
1810
2406
|
function validateComponentArray(input, min, max, ExpectedInstanceOf) {
|
|
1811
|
-
(ExpectedInstanceOf ?
|
|
2407
|
+
(ExpectedInstanceOf ? s8.instance(ExpectedInstanceOf) : s8.instance(ComponentBuilder)).array().lengthGreaterThanOrEqual(min).lengthLessThanOrEqual(max).setValidationEnabled(isValidationEnabled).parse(input);
|
|
1812
2408
|
}
|
|
1813
2409
|
__name(validateComponentArray, "validateComponentArray");
|
|
1814
2410
|
|
|
1815
2411
|
// src/components/v2/File.ts
|
|
1816
|
-
import { ComponentType as
|
|
2412
|
+
import { ComponentType as ComponentType19 } from "discord-api-types/v10";
|
|
1817
2413
|
var FileBuilder = class extends ComponentBuilder {
|
|
1818
2414
|
static {
|
|
1819
2415
|
__name(this, "FileBuilder");
|
|
@@ -1844,7 +2440,7 @@ var FileBuilder = class extends ComponentBuilder {
|
|
|
1844
2440
|
* ```
|
|
1845
2441
|
*/
|
|
1846
2442
|
constructor(data = {}) {
|
|
1847
|
-
super({ type:
|
|
2443
|
+
super({ type: ComponentType19.File, ...data, file: data.file ? { url: data.file.url } : void 0 });
|
|
1848
2444
|
}
|
|
1849
2445
|
/**
|
|
1850
2446
|
* Sets the spoiler status of this file.
|
|
@@ -1874,7 +2470,7 @@ var FileBuilder = class extends ComponentBuilder {
|
|
|
1874
2470
|
};
|
|
1875
2471
|
|
|
1876
2472
|
// src/components/v2/Separator.ts
|
|
1877
|
-
import { ComponentType as
|
|
2473
|
+
import { ComponentType as ComponentType20 } from "discord-api-types/v10";
|
|
1878
2474
|
var SeparatorBuilder = class extends ComponentBuilder {
|
|
1879
2475
|
static {
|
|
1880
2476
|
__name(this, "SeparatorBuilder");
|
|
@@ -1902,7 +2498,7 @@ var SeparatorBuilder = class extends ComponentBuilder {
|
|
|
1902
2498
|
*/
|
|
1903
2499
|
constructor(data = {}) {
|
|
1904
2500
|
super({
|
|
1905
|
-
type:
|
|
2501
|
+
type: ComponentType20.Separator,
|
|
1906
2502
|
...data
|
|
1907
2503
|
});
|
|
1908
2504
|
}
|
|
@@ -1940,7 +2536,7 @@ var SeparatorBuilder = class extends ComponentBuilder {
|
|
|
1940
2536
|
};
|
|
1941
2537
|
|
|
1942
2538
|
// src/components/v2/TextDisplay.ts
|
|
1943
|
-
import { ComponentType as
|
|
2539
|
+
import { ComponentType as ComponentType21 } from "discord-api-types/v10";
|
|
1944
2540
|
var TextDisplayBuilder = class extends ComponentBuilder {
|
|
1945
2541
|
static {
|
|
1946
2542
|
__name(this, "TextDisplayBuilder");
|
|
@@ -1967,7 +2563,7 @@ var TextDisplayBuilder = class extends ComponentBuilder {
|
|
|
1967
2563
|
*/
|
|
1968
2564
|
constructor(data = {}) {
|
|
1969
2565
|
super({
|
|
1970
|
-
type:
|
|
2566
|
+
type: ComponentType21.TextDisplay,
|
|
1971
2567
|
...data
|
|
1972
2568
|
});
|
|
1973
2569
|
}
|
|
@@ -2025,11 +2621,12 @@ var ContainerBuilder = class extends ComponentBuilder {
|
|
|
2025
2621
|
* },
|
|
2026
2622
|
* ],
|
|
2027
2623
|
* })
|
|
2028
|
-
*
|
|
2624
|
+
* .addSeparatorComponents(separator)
|
|
2625
|
+
* .addSectionComponents(section);
|
|
2029
2626
|
* ```
|
|
2030
2627
|
*/
|
|
2031
2628
|
constructor({ components, ...data } = {}) {
|
|
2032
|
-
super({ type:
|
|
2629
|
+
super({ type: ComponentType22.Container, ...data });
|
|
2033
2630
|
this.components = components?.map((component) => createComponentBuilder(component)) ?? [];
|
|
2034
2631
|
}
|
|
2035
2632
|
/**
|
|
@@ -2152,7 +2749,7 @@ var ContainerBuilder = class extends ComponentBuilder {
|
|
|
2152
2749
|
};
|
|
2153
2750
|
|
|
2154
2751
|
// src/components/v2/MediaGallery.ts
|
|
2155
|
-
import { ComponentType as
|
|
2752
|
+
import { ComponentType as ComponentType23 } from "discord-api-types/v10";
|
|
2156
2753
|
|
|
2157
2754
|
// src/components/v2/MediaGalleryItem.ts
|
|
2158
2755
|
var MediaGalleryItemBuilder = class {
|
|
@@ -2282,7 +2879,7 @@ var MediaGalleryBuilder = class extends ComponentBuilder {
|
|
|
2282
2879
|
* ```
|
|
2283
2880
|
*/
|
|
2284
2881
|
constructor({ items, ...data } = {}) {
|
|
2285
|
-
super({ type:
|
|
2882
|
+
super({ type: ComponentType23.MediaGallery, ...data });
|
|
2286
2883
|
this.items = items?.map((item) => new MediaGalleryItemBuilder(item)) ?? [];
|
|
2287
2884
|
}
|
|
2288
2885
|
/**
|
|
@@ -2332,7 +2929,7 @@ var MediaGalleryBuilder = class extends ComponentBuilder {
|
|
|
2332
2929
|
};
|
|
2333
2930
|
|
|
2334
2931
|
// src/components/v2/Section.ts
|
|
2335
|
-
import { ComponentType as
|
|
2932
|
+
import { ComponentType as ComponentType24 } from "discord-api-types/v10";
|
|
2336
2933
|
var SectionBuilder = class extends ComponentBuilder {
|
|
2337
2934
|
static {
|
|
2338
2935
|
__name(this, "SectionBuilder");
|
|
@@ -2381,7 +2978,7 @@ var SectionBuilder = class extends ComponentBuilder {
|
|
|
2381
2978
|
* ```
|
|
2382
2979
|
*/
|
|
2383
2980
|
constructor({ components, accessory, ...data } = {}) {
|
|
2384
|
-
super({ type:
|
|
2981
|
+
super({ type: ComponentType24.Section, ...data });
|
|
2385
2982
|
this.components = components?.map((component) => createComponentBuilder(component)) ?? [];
|
|
2386
2983
|
this.accessory = accessory ? createComponentBuilder(accessory) : void 0;
|
|
2387
2984
|
}
|
|
@@ -2456,40 +3053,46 @@ function createComponentBuilder(data) {
|
|
|
2456
3053
|
return data;
|
|
2457
3054
|
}
|
|
2458
3055
|
switch (data.type) {
|
|
2459
|
-
case
|
|
3056
|
+
case ComponentType25.ActionRow:
|
|
2460
3057
|
return new ActionRowBuilder(data);
|
|
2461
|
-
case
|
|
3058
|
+
case ComponentType25.Button:
|
|
2462
3059
|
return new ButtonBuilder(data);
|
|
2463
|
-
case
|
|
3060
|
+
case ComponentType25.StringSelect:
|
|
2464
3061
|
return new StringSelectMenuBuilder(data);
|
|
2465
|
-
case
|
|
3062
|
+
case ComponentType25.TextInput:
|
|
2466
3063
|
return new TextInputBuilder(data);
|
|
2467
|
-
case
|
|
3064
|
+
case ComponentType25.UserSelect:
|
|
2468
3065
|
return new UserSelectMenuBuilder(data);
|
|
2469
|
-
case
|
|
3066
|
+
case ComponentType25.RoleSelect:
|
|
2470
3067
|
return new RoleSelectMenuBuilder(data);
|
|
2471
|
-
case
|
|
3068
|
+
case ComponentType25.MentionableSelect:
|
|
2472
3069
|
return new MentionableSelectMenuBuilder(data);
|
|
2473
|
-
case
|
|
3070
|
+
case ComponentType25.ChannelSelect:
|
|
2474
3071
|
return new ChannelSelectMenuBuilder(data);
|
|
2475
|
-
case
|
|
3072
|
+
case ComponentType25.File:
|
|
2476
3073
|
return new FileBuilder(data);
|
|
2477
|
-
case
|
|
3074
|
+
case ComponentType25.Container:
|
|
2478
3075
|
return new ContainerBuilder(data);
|
|
2479
|
-
case
|
|
3076
|
+
case ComponentType25.Section:
|
|
2480
3077
|
return new SectionBuilder(data);
|
|
2481
|
-
case
|
|
3078
|
+
case ComponentType25.Separator:
|
|
2482
3079
|
return new SeparatorBuilder(data);
|
|
2483
|
-
case
|
|
3080
|
+
case ComponentType25.TextDisplay:
|
|
2484
3081
|
return new TextDisplayBuilder(data);
|
|
2485
|
-
case
|
|
3082
|
+
case ComponentType25.Thumbnail:
|
|
2486
3083
|
return new ThumbnailBuilder(data);
|
|
2487
|
-
case
|
|
3084
|
+
case ComponentType25.MediaGallery:
|
|
2488
3085
|
return new MediaGalleryBuilder(data);
|
|
2489
|
-
case
|
|
3086
|
+
case ComponentType25.Label:
|
|
2490
3087
|
return new LabelBuilder(data);
|
|
2491
|
-
case
|
|
3088
|
+
case ComponentType25.FileUpload:
|
|
2492
3089
|
return new FileUploadBuilder(data);
|
|
3090
|
+
case ComponentType25.Checkbox:
|
|
3091
|
+
return new CheckboxBuilder(data);
|
|
3092
|
+
case ComponentType25.CheckboxGroup:
|
|
3093
|
+
return new CheckboxGroupBuilder(data);
|
|
3094
|
+
case ComponentType25.RadioGroup:
|
|
3095
|
+
return new RadioGroupBuilder(data);
|
|
2493
3096
|
default:
|
|
2494
3097
|
throw new Error(`Cannot properly serialize component type: ${data.type}`);
|
|
2495
3098
|
}
|
|
@@ -2554,7 +3157,7 @@ var ActionRowBuilder = class extends ComponentBuilder {
|
|
|
2554
3157
|
* ```
|
|
2555
3158
|
*/
|
|
2556
3159
|
constructor({ components, ...data } = {}) {
|
|
2557
|
-
super({ type:
|
|
3160
|
+
super({ type: ComponentType26.ActionRow, ...data });
|
|
2558
3161
|
this.components = components?.map((component) => createComponentBuilder(component)) ?? [];
|
|
2559
3162
|
}
|
|
2560
3163
|
/**
|
|
@@ -2587,18 +3190,18 @@ var ActionRowBuilder = class extends ComponentBuilder {
|
|
|
2587
3190
|
};
|
|
2588
3191
|
|
|
2589
3192
|
// src/interactions/modals/Modal.ts
|
|
2590
|
-
import { ComponentType as
|
|
3193
|
+
import { ComponentType as ComponentType27 } from "discord-api-types/v10";
|
|
2591
3194
|
|
|
2592
3195
|
// src/interactions/modals/Assertions.ts
|
|
2593
|
-
var
|
|
2594
|
-
__export(
|
|
3196
|
+
var Assertions_exports9 = {};
|
|
3197
|
+
__export(Assertions_exports9, {
|
|
2595
3198
|
componentsValidator: () => componentsValidator,
|
|
2596
3199
|
titleValidator: () => titleValidator,
|
|
2597
3200
|
validateRequiredParameters: () => validateRequiredParameters2
|
|
2598
3201
|
});
|
|
2599
|
-
import { s as
|
|
2600
|
-
var titleValidator =
|
|
2601
|
-
var componentsValidator =
|
|
3202
|
+
import { s as s9 } from "@sapphire/shapeshift";
|
|
3203
|
+
var titleValidator = s9.string().lengthGreaterThanOrEqual(1).lengthLessThanOrEqual(45).setValidationEnabled(isValidationEnabled);
|
|
3204
|
+
var componentsValidator = s9.union([s9.instance(ActionRowBuilder), s9.instance(LabelBuilder), s9.instance(TextDisplayBuilder)]).array().lengthGreaterThanOrEqual(1).setValidationEnabled(isValidationEnabled);
|
|
2602
3205
|
function validateRequiredParameters2(customId, title, components) {
|
|
2603
3206
|
customIdValidator.parse(customId);
|
|
2604
3207
|
titleValidator.parse(title);
|
|
@@ -2662,16 +3265,16 @@ var ModalBuilder = class {
|
|
|
2662
3265
|
return new ActionRowBuilder().addComponents(component);
|
|
2663
3266
|
}
|
|
2664
3267
|
if ("type" in component) {
|
|
2665
|
-
if (component.type ===
|
|
3268
|
+
if (component.type === ComponentType27.ActionRow) {
|
|
2666
3269
|
return new ActionRowBuilder(component);
|
|
2667
3270
|
}
|
|
2668
|
-
if (component.type ===
|
|
3271
|
+
if (component.type === ComponentType27.Label) {
|
|
2669
3272
|
return new LabelBuilder(component);
|
|
2670
3273
|
}
|
|
2671
|
-
if (component.type ===
|
|
3274
|
+
if (component.type === ComponentType27.TextDisplay) {
|
|
2672
3275
|
return new TextDisplayBuilder(component);
|
|
2673
3276
|
}
|
|
2674
|
-
if (component.type ===
|
|
3277
|
+
if (component.type === ComponentType27.TextInput) {
|
|
2675
3278
|
return new ActionRowBuilder().addComponents(
|
|
2676
3279
|
new TextInputBuilder(component)
|
|
2677
3280
|
);
|
|
@@ -2783,8 +3386,8 @@ var ModalBuilder = class {
|
|
|
2783
3386
|
};
|
|
2784
3387
|
|
|
2785
3388
|
// src/interactions/slashCommands/Assertions.ts
|
|
2786
|
-
var
|
|
2787
|
-
__export(
|
|
3389
|
+
var Assertions_exports10 = {};
|
|
3390
|
+
__export(Assertions_exports10, {
|
|
2788
3391
|
assertReturnOfBuilder: () => assertReturnOfBuilder2,
|
|
2789
3392
|
contextsPredicate: () => contextsPredicate,
|
|
2790
3393
|
integrationTypesPredicate: () => integrationTypesPredicate,
|
|
@@ -2802,24 +3405,24 @@ __export(Assertions_exports8, {
|
|
|
2802
3405
|
validateRequired: () => validateRequired,
|
|
2803
3406
|
validateRequiredParameters: () => validateRequiredParameters3
|
|
2804
3407
|
});
|
|
2805
|
-
import { s as
|
|
3408
|
+
import { s as s10 } from "@sapphire/shapeshift";
|
|
2806
3409
|
import {
|
|
2807
3410
|
ApplicationIntegrationType,
|
|
2808
3411
|
InteractionContextType,
|
|
2809
3412
|
Locale
|
|
2810
3413
|
} from "discord-api-types/v10";
|
|
2811
|
-
var namePredicate =
|
|
3414
|
+
var namePredicate = s10.string().lengthGreaterThanOrEqual(1).lengthLessThanOrEqual(32).regex(/^[\p{Ll}\p{Lm}\p{Lo}\p{N}\p{sc=Devanagari}\p{sc=Thai}_-]+$/u).setValidationEnabled(isValidationEnabled);
|
|
2812
3415
|
function validateName(name) {
|
|
2813
3416
|
namePredicate.parse(name);
|
|
2814
3417
|
}
|
|
2815
3418
|
__name(validateName, "validateName");
|
|
2816
|
-
var descriptionPredicate3 =
|
|
2817
|
-
var localePredicate =
|
|
3419
|
+
var descriptionPredicate3 = s10.string().lengthGreaterThanOrEqual(1).lengthLessThanOrEqual(100).setValidationEnabled(isValidationEnabled);
|
|
3420
|
+
var localePredicate = s10.nativeEnum(Locale);
|
|
2818
3421
|
function validateDescription(description) {
|
|
2819
3422
|
descriptionPredicate3.parse(description);
|
|
2820
3423
|
}
|
|
2821
3424
|
__name(validateDescription, "validateDescription");
|
|
2822
|
-
var maxArrayLengthPredicate =
|
|
3425
|
+
var maxArrayLengthPredicate = s10.unknown().array().lengthLessThanOrEqual(25).setValidationEnabled(isValidationEnabled);
|
|
2823
3426
|
function validateLocale(locale) {
|
|
2824
3427
|
return localePredicate.parse(locale);
|
|
2825
3428
|
}
|
|
@@ -2834,7 +3437,7 @@ function validateRequiredParameters3(name, description, options) {
|
|
|
2834
3437
|
validateMaxOptionsLength(options);
|
|
2835
3438
|
}
|
|
2836
3439
|
__name(validateRequiredParameters3, "validateRequiredParameters");
|
|
2837
|
-
var booleanPredicate =
|
|
3440
|
+
var booleanPredicate = s10.boolean();
|
|
2838
3441
|
function validateDefaultPermission(value) {
|
|
2839
3442
|
booleanPredicate.parse(value);
|
|
2840
3443
|
}
|
|
@@ -2843,29 +3446,29 @@ function validateRequired(required) {
|
|
|
2843
3446
|
booleanPredicate.parse(required);
|
|
2844
3447
|
}
|
|
2845
3448
|
__name(validateRequired, "validateRequired");
|
|
2846
|
-
var choicesLengthPredicate =
|
|
3449
|
+
var choicesLengthPredicate = s10.number().lessThanOrEqual(25).setValidationEnabled(isValidationEnabled);
|
|
2847
3450
|
function validateChoicesLength(amountAdding, choices) {
|
|
2848
3451
|
choicesLengthPredicate.parse((choices?.length ?? 0) + amountAdding);
|
|
2849
3452
|
}
|
|
2850
3453
|
__name(validateChoicesLength, "validateChoicesLength");
|
|
2851
3454
|
function assertReturnOfBuilder2(input, ExpectedInstanceOf) {
|
|
2852
|
-
|
|
3455
|
+
s10.instance(ExpectedInstanceOf).parse(input);
|
|
2853
3456
|
}
|
|
2854
3457
|
__name(assertReturnOfBuilder2, "assertReturnOfBuilder");
|
|
2855
|
-
var localizationMapPredicate =
|
|
3458
|
+
var localizationMapPredicate = s10.object(Object.fromEntries(Object.values(Locale).map((locale) => [locale, s10.string().nullish()]))).strict().nullish().setValidationEnabled(isValidationEnabled);
|
|
2856
3459
|
function validateLocalizationMap(value) {
|
|
2857
3460
|
localizationMapPredicate.parse(value);
|
|
2858
3461
|
}
|
|
2859
3462
|
__name(validateLocalizationMap, "validateLocalizationMap");
|
|
2860
|
-
var dmPermissionPredicate =
|
|
3463
|
+
var dmPermissionPredicate = s10.boolean().nullish();
|
|
2861
3464
|
function validateDMPermission(value) {
|
|
2862
3465
|
dmPermissionPredicate.parse(value);
|
|
2863
3466
|
}
|
|
2864
3467
|
__name(validateDMPermission, "validateDMPermission");
|
|
2865
|
-
var memberPermissionPredicate =
|
|
2866
|
-
|
|
2867
|
-
|
|
2868
|
-
|
|
3468
|
+
var memberPermissionPredicate = s10.union([
|
|
3469
|
+
s10.bigint().transform((value) => value.toString()),
|
|
3470
|
+
s10.number().safeInt().transform((value) => value.toString()),
|
|
3471
|
+
s10.string().regex(/^\d+$/)
|
|
2869
3472
|
]).nullish();
|
|
2870
3473
|
function validateDefaultMemberPermissions(permissions) {
|
|
2871
3474
|
return memberPermissionPredicate.parse(permissions);
|
|
@@ -2875,11 +3478,11 @@ function validateNSFW(value) {
|
|
|
2875
3478
|
booleanPredicate.parse(value);
|
|
2876
3479
|
}
|
|
2877
3480
|
__name(validateNSFW, "validateNSFW");
|
|
2878
|
-
var contextsPredicate =
|
|
2879
|
-
|
|
3481
|
+
var contextsPredicate = s10.array(
|
|
3482
|
+
s10.nativeEnum(InteractionContextType).setValidationEnabled(isValidationEnabled)
|
|
2880
3483
|
);
|
|
2881
|
-
var integrationTypesPredicate =
|
|
2882
|
-
|
|
3484
|
+
var integrationTypesPredicate = s10.array(
|
|
3485
|
+
s10.nativeEnum(ApplicationIntegrationType).setValidationEnabled(isValidationEnabled)
|
|
2883
3486
|
);
|
|
2884
3487
|
|
|
2885
3488
|
// src/interactions/slashCommands/SlashCommandBuilder.ts
|
|
@@ -3189,7 +3792,7 @@ import { ApplicationCommandOptionType as ApplicationCommandOptionType3 } from "d
|
|
|
3189
3792
|
import { mix } from "ts-mixer";
|
|
3190
3793
|
|
|
3191
3794
|
// src/interactions/slashCommands/mixins/ApplicationCommandOptionChannelTypesMixin.ts
|
|
3192
|
-
import { s as
|
|
3795
|
+
import { s as s11 } from "@sapphire/shapeshift";
|
|
3193
3796
|
import { ChannelType as ChannelType3 } from "discord-api-types/v10";
|
|
3194
3797
|
var allowedChannelTypes = [
|
|
3195
3798
|
ChannelType3.GuildText,
|
|
@@ -3203,7 +3806,7 @@ var allowedChannelTypes = [
|
|
|
3203
3806
|
ChannelType3.GuildForum,
|
|
3204
3807
|
ChannelType3.GuildMedia
|
|
3205
3808
|
];
|
|
3206
|
-
var channelTypesPredicate =
|
|
3809
|
+
var channelTypesPredicate = s11.array(s11.union(allowedChannelTypes.map((type) => s11.literal(type))));
|
|
3207
3810
|
var ApplicationCommandOptionChannelTypesMixin = class {
|
|
3208
3811
|
static {
|
|
3209
3812
|
__name(this, "ApplicationCommandOptionChannelTypesMixin");
|
|
@@ -3246,7 +3849,7 @@ SlashCommandChannelOption = __decorateClass([
|
|
|
3246
3849
|
], SlashCommandChannelOption);
|
|
3247
3850
|
|
|
3248
3851
|
// src/interactions/slashCommands/options/integer.ts
|
|
3249
|
-
import { s as
|
|
3852
|
+
import { s as s14 } from "@sapphire/shapeshift";
|
|
3250
3853
|
import { ApplicationCommandOptionType as ApplicationCommandOptionType5 } from "discord-api-types/v10";
|
|
3251
3854
|
import { mix as mix2 } from "ts-mixer";
|
|
3252
3855
|
|
|
@@ -3266,8 +3869,8 @@ var ApplicationCommandNumericOptionMinMaxValueMixin = class {
|
|
|
3266
3869
|
};
|
|
3267
3870
|
|
|
3268
3871
|
// src/interactions/slashCommands/mixins/ApplicationCommandOptionWithAutocompleteMixin.ts
|
|
3269
|
-
import { s as
|
|
3270
|
-
var booleanPredicate2 =
|
|
3872
|
+
import { s as s12 } from "@sapphire/shapeshift";
|
|
3873
|
+
var booleanPredicate2 = s12.boolean();
|
|
3271
3874
|
var ApplicationCommandOptionWithAutocompleteMixin = class {
|
|
3272
3875
|
static {
|
|
3273
3876
|
__name(this, "ApplicationCommandOptionWithAutocompleteMixin");
|
|
@@ -3298,14 +3901,14 @@ var ApplicationCommandOptionWithAutocompleteMixin = class {
|
|
|
3298
3901
|
};
|
|
3299
3902
|
|
|
3300
3903
|
// src/interactions/slashCommands/mixins/ApplicationCommandOptionWithChoicesMixin.ts
|
|
3301
|
-
import { s as
|
|
3904
|
+
import { s as s13 } from "@sapphire/shapeshift";
|
|
3302
3905
|
import { ApplicationCommandOptionType as ApplicationCommandOptionType4 } from "discord-api-types/v10";
|
|
3303
|
-
var stringPredicate =
|
|
3304
|
-
var numberPredicate =
|
|
3305
|
-
var choicesPredicate =
|
|
3906
|
+
var stringPredicate = s13.string().lengthGreaterThanOrEqual(1).lengthLessThanOrEqual(100);
|
|
3907
|
+
var numberPredicate = s13.number().greaterThan(Number.NEGATIVE_INFINITY).lessThan(Number.POSITIVE_INFINITY);
|
|
3908
|
+
var choicesPredicate = s13.object({
|
|
3306
3909
|
name: stringPredicate,
|
|
3307
3910
|
name_localizations: localizationMapPredicate,
|
|
3308
|
-
value:
|
|
3911
|
+
value: s13.union([stringPredicate, numberPredicate])
|
|
3309
3912
|
}).array();
|
|
3310
3913
|
var ApplicationCommandOptionWithChoicesMixin = class {
|
|
3311
3914
|
static {
|
|
@@ -3364,7 +3967,7 @@ var ApplicationCommandOptionWithChoicesMixin = class {
|
|
|
3364
3967
|
};
|
|
3365
3968
|
|
|
3366
3969
|
// src/interactions/slashCommands/options/integer.ts
|
|
3367
|
-
var numberValidator =
|
|
3970
|
+
var numberValidator = s14.number().int();
|
|
3368
3971
|
var SlashCommandIntegerOption = class extends ApplicationCommandOptionBase {
|
|
3369
3972
|
/**
|
|
3370
3973
|
* The type of this option.
|
|
@@ -3426,10 +4029,10 @@ var SlashCommandMentionableOption = class extends ApplicationCommandOptionBase {
|
|
|
3426
4029
|
};
|
|
3427
4030
|
|
|
3428
4031
|
// src/interactions/slashCommands/options/number.ts
|
|
3429
|
-
import { s as
|
|
4032
|
+
import { s as s15 } from "@sapphire/shapeshift";
|
|
3430
4033
|
import { ApplicationCommandOptionType as ApplicationCommandOptionType7 } from "discord-api-types/v10";
|
|
3431
4034
|
import { mix as mix3 } from "ts-mixer";
|
|
3432
|
-
var numberValidator2 =
|
|
4035
|
+
var numberValidator2 = s15.number();
|
|
3433
4036
|
var SlashCommandNumberOption = class extends ApplicationCommandOptionBase {
|
|
3434
4037
|
/**
|
|
3435
4038
|
* The type of this option.
|
|
@@ -3491,11 +4094,11 @@ var SlashCommandRoleOption = class extends ApplicationCommandOptionBase {
|
|
|
3491
4094
|
};
|
|
3492
4095
|
|
|
3493
4096
|
// src/interactions/slashCommands/options/string.ts
|
|
3494
|
-
import { s as
|
|
4097
|
+
import { s as s16 } from "@sapphire/shapeshift";
|
|
3495
4098
|
import { ApplicationCommandOptionType as ApplicationCommandOptionType9 } from "discord-api-types/v10";
|
|
3496
4099
|
import { mix as mix4 } from "ts-mixer";
|
|
3497
|
-
var minLengthValidator2 =
|
|
3498
|
-
var maxLengthValidator2 =
|
|
4100
|
+
var minLengthValidator2 = s16.number().greaterThanOrEqual(0).lessThanOrEqual(6e3);
|
|
4101
|
+
var maxLengthValidator2 = s16.number().greaterThanOrEqual(1).lessThanOrEqual(6e3);
|
|
3499
4102
|
var SlashCommandStringOption = class extends ApplicationCommandOptionBase {
|
|
3500
4103
|
/**
|
|
3501
4104
|
* The type of this option.
|
|
@@ -3844,8 +4447,8 @@ SlashCommandBuilder = __decorateClass([
|
|
|
3844
4447
|
], SlashCommandBuilder);
|
|
3845
4448
|
|
|
3846
4449
|
// src/interactions/contextMenuCommands/Assertions.ts
|
|
3847
|
-
var
|
|
3848
|
-
__export(
|
|
4450
|
+
var Assertions_exports11 = {};
|
|
4451
|
+
__export(Assertions_exports11, {
|
|
3849
4452
|
contextsPredicate: () => contextsPredicate2,
|
|
3850
4453
|
integrationTypesPredicate: () => integrationTypesPredicate2,
|
|
3851
4454
|
validateDMPermission: () => validateDMPermission2,
|
|
@@ -3855,11 +4458,11 @@ __export(Assertions_exports9, {
|
|
|
3855
4458
|
validateRequiredParameters: () => validateRequiredParameters4,
|
|
3856
4459
|
validateType: () => validateType
|
|
3857
4460
|
});
|
|
3858
|
-
import { s as
|
|
4461
|
+
import { s as s17 } from "@sapphire/shapeshift";
|
|
3859
4462
|
import { ApplicationCommandType as ApplicationCommandType2, ApplicationIntegrationType as ApplicationIntegrationType2, InteractionContextType as InteractionContextType2 } from "discord-api-types/v10";
|
|
3860
|
-
var namePredicate2 =
|
|
3861
|
-
var typePredicate =
|
|
3862
|
-
var booleanPredicate3 =
|
|
4463
|
+
var namePredicate2 = s17.string().lengthGreaterThanOrEqual(1).lengthLessThanOrEqual(32).regex(/\S/).setValidationEnabled(isValidationEnabled);
|
|
4464
|
+
var typePredicate = s17.union([s17.literal(ApplicationCommandType2.User), s17.literal(ApplicationCommandType2.Message)]).setValidationEnabled(isValidationEnabled);
|
|
4465
|
+
var booleanPredicate3 = s17.boolean();
|
|
3863
4466
|
function validateDefaultPermission2(value) {
|
|
3864
4467
|
booleanPredicate3.parse(value);
|
|
3865
4468
|
}
|
|
@@ -3877,25 +4480,25 @@ function validateRequiredParameters4(name, type) {
|
|
|
3877
4480
|
validateType(type);
|
|
3878
4481
|
}
|
|
3879
4482
|
__name(validateRequiredParameters4, "validateRequiredParameters");
|
|
3880
|
-
var dmPermissionPredicate2 =
|
|
4483
|
+
var dmPermissionPredicate2 = s17.boolean().nullish();
|
|
3881
4484
|
function validateDMPermission2(value) {
|
|
3882
4485
|
dmPermissionPredicate2.parse(value);
|
|
3883
4486
|
}
|
|
3884
4487
|
__name(validateDMPermission2, "validateDMPermission");
|
|
3885
|
-
var memberPermissionPredicate2 =
|
|
3886
|
-
|
|
3887
|
-
|
|
3888
|
-
|
|
4488
|
+
var memberPermissionPredicate2 = s17.union([
|
|
4489
|
+
s17.bigint().transform((value) => value.toString()),
|
|
4490
|
+
s17.number().safeInt().transform((value) => value.toString()),
|
|
4491
|
+
s17.string().regex(/^\d+$/)
|
|
3889
4492
|
]).nullish();
|
|
3890
4493
|
function validateDefaultMemberPermissions2(permissions) {
|
|
3891
4494
|
return memberPermissionPredicate2.parse(permissions);
|
|
3892
4495
|
}
|
|
3893
4496
|
__name(validateDefaultMemberPermissions2, "validateDefaultMemberPermissions");
|
|
3894
|
-
var contextsPredicate2 =
|
|
3895
|
-
|
|
4497
|
+
var contextsPredicate2 = s17.array(
|
|
4498
|
+
s17.nativeEnum(InteractionContextType2).setValidationEnabled(isValidationEnabled)
|
|
3896
4499
|
);
|
|
3897
|
-
var integrationTypesPredicate2 =
|
|
3898
|
-
|
|
4500
|
+
var integrationTypesPredicate2 = s17.array(
|
|
4501
|
+
s17.nativeEnum(ApplicationIntegrationType2).setValidationEnabled(isValidationEnabled)
|
|
3899
4502
|
);
|
|
3900
4503
|
|
|
3901
4504
|
// src/interactions/contextMenuCommands/ContextMenuCommandBuilder.ts
|
|
@@ -4076,7 +4679,7 @@ function embedLength(data) {
|
|
|
4076
4679
|
__name(embedLength, "embedLength");
|
|
4077
4680
|
|
|
4078
4681
|
// src/index.ts
|
|
4079
|
-
var version = "1.
|
|
4682
|
+
var version = "1.14.0";
|
|
4080
4683
|
export {
|
|
4081
4684
|
ActionRowBuilder,
|
|
4082
4685
|
ApplicationCommandNumericOptionMinMaxValueMixin,
|
|
@@ -4087,26 +4690,33 @@ export {
|
|
|
4087
4690
|
BaseSelectMenuBuilder,
|
|
4088
4691
|
ButtonBuilder,
|
|
4089
4692
|
ChannelSelectMenuBuilder,
|
|
4693
|
+
Assertions_exports3 as CheckboxAssertions,
|
|
4694
|
+
CheckboxBuilder,
|
|
4695
|
+
CheckboxGroupBuilder,
|
|
4696
|
+
CheckboxGroupOptionBuilder,
|
|
4090
4697
|
Assertions_exports2 as ComponentAssertions,
|
|
4091
4698
|
ComponentBuilder,
|
|
4092
|
-
|
|
4699
|
+
Assertions_exports8 as ComponentsV2Assertions,
|
|
4093
4700
|
ContainerBuilder,
|
|
4094
|
-
|
|
4701
|
+
Assertions_exports11 as ContextMenuCommandAssertions,
|
|
4095
4702
|
ContextMenuCommandBuilder,
|
|
4096
4703
|
Assertions_exports as EmbedAssertions,
|
|
4097
4704
|
EmbedBuilder,
|
|
4098
4705
|
FileBuilder,
|
|
4099
|
-
|
|
4706
|
+
Assertions_exports4 as FileUploadAssertions,
|
|
4100
4707
|
FileUploadBuilder,
|
|
4101
|
-
|
|
4708
|
+
Assertions_exports7 as LabelAssertions,
|
|
4102
4709
|
LabelBuilder,
|
|
4103
4710
|
MediaGalleryBuilder,
|
|
4104
4711
|
MediaGalleryItemBuilder,
|
|
4105
4712
|
MentionableSelectMenuBuilder,
|
|
4106
|
-
|
|
4713
|
+
Assertions_exports9 as ModalAssertions,
|
|
4107
4714
|
ModalBuilder,
|
|
4715
|
+
RadioGroupBuilder,
|
|
4716
|
+
RadioGroupOptionBuilder,
|
|
4108
4717
|
RoleSelectMenuBuilder,
|
|
4109
4718
|
SectionBuilder,
|
|
4719
|
+
Assertions_exports6 as SelectMenuAssertions,
|
|
4110
4720
|
StringSelectMenuBuilder as SelectMenuBuilder,
|
|
4111
4721
|
StringSelectMenuOptionBuilder as SelectMenuOptionBuilder,
|
|
4112
4722
|
SeparatorBuilder,
|
|
@@ -4114,7 +4724,7 @@ export {
|
|
|
4114
4724
|
SharedSlashCommand,
|
|
4115
4725
|
SharedSlashCommandOptions,
|
|
4116
4726
|
SharedSlashCommandSubcommands,
|
|
4117
|
-
|
|
4727
|
+
Assertions_exports10 as SlashCommandAssertions,
|
|
4118
4728
|
SlashCommandAttachmentOption,
|
|
4119
4729
|
SlashCommandBooleanOption,
|
|
4120
4730
|
SlashCommandBuilder,
|
|
@@ -4130,7 +4740,7 @@ export {
|
|
|
4130
4740
|
StringSelectMenuBuilder,
|
|
4131
4741
|
StringSelectMenuOptionBuilder,
|
|
4132
4742
|
TextDisplayBuilder,
|
|
4133
|
-
|
|
4743
|
+
Assertions_exports5 as TextInputAssertions,
|
|
4134
4744
|
TextInputBuilder,
|
|
4135
4745
|
ThumbnailBuilder,
|
|
4136
4746
|
UserSelectMenuBuilder,
|