@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.js
CHANGED
|
@@ -38,8 +38,8 @@ var __decorateClass = (decorators, target, key, kind) => {
|
|
|
38
38
|
};
|
|
39
39
|
|
|
40
40
|
// src/index.ts
|
|
41
|
-
var
|
|
42
|
-
__export(
|
|
41
|
+
var index_exports = {};
|
|
42
|
+
__export(index_exports, {
|
|
43
43
|
ActionRowBuilder: () => ActionRowBuilder,
|
|
44
44
|
ApplicationCommandNumericOptionMinMaxValueMixin: () => ApplicationCommandNumericOptionMinMaxValueMixin,
|
|
45
45
|
ApplicationCommandOptionBase: () => ApplicationCommandOptionBase,
|
|
@@ -49,26 +49,33 @@ __export(src_exports, {
|
|
|
49
49
|
BaseSelectMenuBuilder: () => BaseSelectMenuBuilder,
|
|
50
50
|
ButtonBuilder: () => ButtonBuilder,
|
|
51
51
|
ChannelSelectMenuBuilder: () => ChannelSelectMenuBuilder,
|
|
52
|
+
CheckboxAssertions: () => Assertions_exports3,
|
|
53
|
+
CheckboxBuilder: () => CheckboxBuilder,
|
|
54
|
+
CheckboxGroupBuilder: () => CheckboxGroupBuilder,
|
|
55
|
+
CheckboxGroupOptionBuilder: () => CheckboxGroupOptionBuilder,
|
|
52
56
|
ComponentAssertions: () => Assertions_exports2,
|
|
53
57
|
ComponentBuilder: () => ComponentBuilder,
|
|
54
|
-
ComponentsV2Assertions: () =>
|
|
58
|
+
ComponentsV2Assertions: () => Assertions_exports8,
|
|
55
59
|
ContainerBuilder: () => ContainerBuilder,
|
|
56
|
-
ContextMenuCommandAssertions: () =>
|
|
60
|
+
ContextMenuCommandAssertions: () => Assertions_exports11,
|
|
57
61
|
ContextMenuCommandBuilder: () => ContextMenuCommandBuilder,
|
|
58
62
|
EmbedAssertions: () => Assertions_exports,
|
|
59
63
|
EmbedBuilder: () => EmbedBuilder,
|
|
60
64
|
FileBuilder: () => FileBuilder,
|
|
61
|
-
FileUploadAssertions: () =>
|
|
65
|
+
FileUploadAssertions: () => Assertions_exports4,
|
|
62
66
|
FileUploadBuilder: () => FileUploadBuilder,
|
|
63
|
-
LabelAssertions: () =>
|
|
67
|
+
LabelAssertions: () => Assertions_exports7,
|
|
64
68
|
LabelBuilder: () => LabelBuilder,
|
|
65
69
|
MediaGalleryBuilder: () => MediaGalleryBuilder,
|
|
66
70
|
MediaGalleryItemBuilder: () => MediaGalleryItemBuilder,
|
|
67
71
|
MentionableSelectMenuBuilder: () => MentionableSelectMenuBuilder,
|
|
68
|
-
ModalAssertions: () =>
|
|
72
|
+
ModalAssertions: () => Assertions_exports9,
|
|
69
73
|
ModalBuilder: () => ModalBuilder,
|
|
74
|
+
RadioGroupBuilder: () => RadioGroupBuilder,
|
|
75
|
+
RadioGroupOptionBuilder: () => RadioGroupOptionBuilder,
|
|
70
76
|
RoleSelectMenuBuilder: () => RoleSelectMenuBuilder,
|
|
71
77
|
SectionBuilder: () => SectionBuilder,
|
|
78
|
+
SelectMenuAssertions: () => Assertions_exports6,
|
|
72
79
|
SelectMenuBuilder: () => StringSelectMenuBuilder,
|
|
73
80
|
SelectMenuOptionBuilder: () => StringSelectMenuOptionBuilder,
|
|
74
81
|
SeparatorBuilder: () => SeparatorBuilder,
|
|
@@ -76,7 +83,7 @@ __export(src_exports, {
|
|
|
76
83
|
SharedSlashCommand: () => SharedSlashCommand,
|
|
77
84
|
SharedSlashCommandOptions: () => SharedSlashCommandOptions,
|
|
78
85
|
SharedSlashCommandSubcommands: () => SharedSlashCommandSubcommands,
|
|
79
|
-
SlashCommandAssertions: () =>
|
|
86
|
+
SlashCommandAssertions: () => Assertions_exports10,
|
|
80
87
|
SlashCommandAttachmentOption: () => SlashCommandAttachmentOption,
|
|
81
88
|
SlashCommandBooleanOption: () => SlashCommandBooleanOption,
|
|
82
89
|
SlashCommandBuilder: () => SlashCommandBuilder,
|
|
@@ -92,7 +99,7 @@ __export(src_exports, {
|
|
|
92
99
|
StringSelectMenuBuilder: () => StringSelectMenuBuilder,
|
|
93
100
|
StringSelectMenuOptionBuilder: () => StringSelectMenuOptionBuilder,
|
|
94
101
|
TextDisplayBuilder: () => TextDisplayBuilder,
|
|
95
|
-
TextInputAssertions: () =>
|
|
102
|
+
TextInputAssertions: () => Assertions_exports5,
|
|
96
103
|
TextInputBuilder: () => TextInputBuilder,
|
|
97
104
|
ThumbnailBuilder: () => ThumbnailBuilder,
|
|
98
105
|
UserSelectMenuBuilder: () => UserSelectMenuBuilder,
|
|
@@ -105,7 +112,7 @@ __export(src_exports, {
|
|
|
105
112
|
resolveBuilder: () => resolveBuilder,
|
|
106
113
|
version: () => version
|
|
107
114
|
});
|
|
108
|
-
module.exports = __toCommonJS(
|
|
115
|
+
module.exports = __toCommonJS(index_exports);
|
|
109
116
|
|
|
110
117
|
// src/messages/embed/Assertions.ts
|
|
111
118
|
var Assertions_exports = {};
|
|
@@ -246,7 +253,7 @@ var EmbedBuilder = class {
|
|
|
246
253
|
*
|
|
247
254
|
* @remarks
|
|
248
255
|
* This method behaves similarly
|
|
249
|
-
* to {@link https://developer.mozilla.org/
|
|
256
|
+
* to {@link https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array/splice | Array.prototype.splice()}.
|
|
250
257
|
* The maximum amount of fields that can be added is 25.
|
|
251
258
|
*
|
|
252
259
|
* It's useful for modifying and adjusting order of the already-existing fields of an embed.
|
|
@@ -407,7 +414,7 @@ var EmbedBuilder = class {
|
|
|
407
414
|
};
|
|
408
415
|
|
|
409
416
|
// src/index.ts
|
|
410
|
-
__reExport(
|
|
417
|
+
__reExport(index_exports, require("@discordjs/formatters"), module.exports);
|
|
411
418
|
|
|
412
419
|
// src/components/Assertions.ts
|
|
413
420
|
var Assertions_exports2 = {};
|
|
@@ -590,7 +597,7 @@ function validateRequiredButtonParameters(style, label, emoji, customId, skuId,
|
|
|
590
597
|
__name(validateRequiredButtonParameters, "validateRequiredButtonParameters");
|
|
591
598
|
|
|
592
599
|
// src/components/ActionRow.ts
|
|
593
|
-
var
|
|
600
|
+
var import_v1028 = require("discord-api-types/v10");
|
|
594
601
|
|
|
595
602
|
// src/components/Component.ts
|
|
596
603
|
var ComponentBuilder = class {
|
|
@@ -628,7 +635,7 @@ var ComponentBuilder = class {
|
|
|
628
635
|
};
|
|
629
636
|
|
|
630
637
|
// src/components/Components.ts
|
|
631
|
-
var
|
|
638
|
+
var import_v1027 = require("discord-api-types/v10");
|
|
632
639
|
|
|
633
640
|
// src/components/button/Button.ts
|
|
634
641
|
var import_v102 = require("discord-api-types/v10");
|
|
@@ -710,67 +717,624 @@ var ButtonBuilder = class extends ComponentBuilder {
|
|
|
710
717
|
return this;
|
|
711
718
|
}
|
|
712
719
|
/**
|
|
713
|
-
* Sets the emoji to display on this button.
|
|
720
|
+
* Sets the emoji to display on this button.
|
|
721
|
+
*
|
|
722
|
+
* @param emoji - The emoji to use
|
|
723
|
+
*/
|
|
724
|
+
setEmoji(emoji) {
|
|
725
|
+
this.data.emoji = emojiValidator.parse(emoji);
|
|
726
|
+
return this;
|
|
727
|
+
}
|
|
728
|
+
/**
|
|
729
|
+
* Sets whether this button is disabled.
|
|
730
|
+
*
|
|
731
|
+
* @param disabled - Whether to disable this button
|
|
732
|
+
*/
|
|
733
|
+
setDisabled(disabled = true) {
|
|
734
|
+
this.data.disabled = disabledValidator.parse(disabled);
|
|
735
|
+
return this;
|
|
736
|
+
}
|
|
737
|
+
/**
|
|
738
|
+
* Sets the label for this button.
|
|
739
|
+
*
|
|
740
|
+
* @param label - The label to use
|
|
741
|
+
*/
|
|
742
|
+
setLabel(label) {
|
|
743
|
+
this.data.label = buttonLabelValidator.parse(label);
|
|
744
|
+
return this;
|
|
745
|
+
}
|
|
746
|
+
/**
|
|
747
|
+
* {@inheritDoc ComponentBuilder.toJSON}
|
|
748
|
+
*/
|
|
749
|
+
toJSON() {
|
|
750
|
+
validateRequiredButtonParameters(
|
|
751
|
+
this.data.style,
|
|
752
|
+
this.data.label,
|
|
753
|
+
this.data.emoji,
|
|
754
|
+
this.data.custom_id,
|
|
755
|
+
this.data.sku_id,
|
|
756
|
+
this.data.url
|
|
757
|
+
);
|
|
758
|
+
return {
|
|
759
|
+
...this.data
|
|
760
|
+
};
|
|
761
|
+
}
|
|
762
|
+
};
|
|
763
|
+
|
|
764
|
+
// src/components/checkbox/Checkbox.ts
|
|
765
|
+
var import_v104 = require("discord-api-types/v10");
|
|
766
|
+
|
|
767
|
+
// src/components/checkbox/Assertions.ts
|
|
768
|
+
var Assertions_exports3 = {};
|
|
769
|
+
__export(Assertions_exports3, {
|
|
770
|
+
checkboxGroupOptionPredicate: () => checkboxGroupOptionPredicate,
|
|
771
|
+
checkboxGroupPredicate: () => checkboxGroupPredicate,
|
|
772
|
+
checkboxPredicate: () => checkboxPredicate,
|
|
773
|
+
radioGroupOptionPredicate: () => radioGroupOptionPredicate,
|
|
774
|
+
radioGroupPredicate: () => radioGroupPredicate
|
|
775
|
+
});
|
|
776
|
+
var import_shapeshift3 = require("@sapphire/shapeshift");
|
|
777
|
+
var import_v103 = require("discord-api-types/v10");
|
|
778
|
+
var checkboxPredicate = import_shapeshift3.s.object({
|
|
779
|
+
type: import_shapeshift3.s.literal(import_v103.ComponentType.Checkbox),
|
|
780
|
+
custom_id: customIdValidator,
|
|
781
|
+
id: idValidator.optional(),
|
|
782
|
+
default: import_shapeshift3.s.boolean().optional()
|
|
783
|
+
}).setValidationEnabled(isValidationEnabled);
|
|
784
|
+
var checkboxGroupOptionPredicate = import_shapeshift3.s.object({
|
|
785
|
+
label: import_shapeshift3.s.string().lengthGreaterThanOrEqual(1).lengthLessThanOrEqual(100),
|
|
786
|
+
value: import_shapeshift3.s.string().lengthGreaterThanOrEqual(1).lengthLessThanOrEqual(100),
|
|
787
|
+
description: import_shapeshift3.s.string().lengthLessThanOrEqual(100).optional(),
|
|
788
|
+
default: import_shapeshift3.s.boolean().optional()
|
|
789
|
+
}).setValidationEnabled(isValidationEnabled);
|
|
790
|
+
var checkboxGroupPredicate = import_shapeshift3.s.object({
|
|
791
|
+
type: import_shapeshift3.s.literal(import_v103.ComponentType.CheckboxGroup),
|
|
792
|
+
custom_id: customIdValidator,
|
|
793
|
+
id: idValidator.optional(),
|
|
794
|
+
options: import_shapeshift3.s.array(checkboxGroupOptionPredicate).lengthGreaterThanOrEqual(1).lengthLessThanOrEqual(10),
|
|
795
|
+
min_values: import_shapeshift3.s.number().int().greaterThanOrEqual(0).lessThanOrEqual(10).optional(),
|
|
796
|
+
max_values: import_shapeshift3.s.number().int().greaterThanOrEqual(1).lessThanOrEqual(10).optional(),
|
|
797
|
+
required: import_shapeshift3.s.boolean().optional()
|
|
798
|
+
}).reshape((data) => {
|
|
799
|
+
if (data.min_values !== void 0 && data.max_values !== void 0 && data.min_values > data.max_values) {
|
|
800
|
+
return import_shapeshift3.Result.err(new RangeError("min_values cannot be greater than max_values"));
|
|
801
|
+
}
|
|
802
|
+
if (data.max_values !== void 0 && data.max_values > data.options.length) {
|
|
803
|
+
return import_shapeshift3.Result.err(new RangeError("max_values cannot be greater than the number of options"));
|
|
804
|
+
}
|
|
805
|
+
if (data.min_values !== void 0 && data.min_values > data.options.length) {
|
|
806
|
+
return import_shapeshift3.Result.err(new RangeError("min_values cannot be greater than the number of options"));
|
|
807
|
+
}
|
|
808
|
+
if (data.required === true && data.min_values === 0) {
|
|
809
|
+
return import_shapeshift3.Result.err(new RangeError("If required is true, min_values must be at least 1"));
|
|
810
|
+
}
|
|
811
|
+
const defaultCount = data.options.filter((option) => option.default === true).length;
|
|
812
|
+
if (data.max_values !== void 0 && defaultCount > data.max_values) {
|
|
813
|
+
return import_shapeshift3.Result.err(new RangeError("The number of default options cannot be greater than max_values"));
|
|
814
|
+
}
|
|
815
|
+
const values = data.options.map((option) => option.value);
|
|
816
|
+
const uniqueValues = new Set(values);
|
|
817
|
+
if (uniqueValues.size !== values.length) {
|
|
818
|
+
return import_shapeshift3.Result.err(new RangeError("Each option in a checkbox group must have a unique value"));
|
|
819
|
+
}
|
|
820
|
+
return import_shapeshift3.Result.ok(data);
|
|
821
|
+
}).setValidationEnabled(isValidationEnabled);
|
|
822
|
+
var radioGroupOptionPredicate = checkboxGroupOptionPredicate;
|
|
823
|
+
var radioGroupPredicate = import_shapeshift3.s.object({
|
|
824
|
+
type: import_shapeshift3.s.literal(import_v103.ComponentType.RadioGroup),
|
|
825
|
+
custom_id: customIdValidator,
|
|
826
|
+
id: idValidator.optional(),
|
|
827
|
+
options: import_shapeshift3.s.array(radioGroupOptionPredicate).lengthGreaterThanOrEqual(2).lengthLessThanOrEqual(10),
|
|
828
|
+
required: import_shapeshift3.s.boolean().optional()
|
|
829
|
+
}).reshape((data) => {
|
|
830
|
+
const defaultCount = data.options.filter((option) => option.default === true).length;
|
|
831
|
+
if (defaultCount > 1) {
|
|
832
|
+
return import_shapeshift3.Result.err(new RangeError("There can be at most one default option in a radio group"));
|
|
833
|
+
}
|
|
834
|
+
const values = data.options.map((option) => option.value);
|
|
835
|
+
const uniqueValues = new Set(values);
|
|
836
|
+
if (uniqueValues.size !== values.length) {
|
|
837
|
+
return import_shapeshift3.Result.err(new RangeError("Each option in a radio group must have a unique value"));
|
|
838
|
+
}
|
|
839
|
+
return import_shapeshift3.Result.ok(data);
|
|
840
|
+
}).setValidationEnabled(isValidationEnabled);
|
|
841
|
+
|
|
842
|
+
// src/components/checkbox/Checkbox.ts
|
|
843
|
+
var CheckboxBuilder = class extends ComponentBuilder {
|
|
844
|
+
static {
|
|
845
|
+
__name(this, "CheckboxBuilder");
|
|
846
|
+
}
|
|
847
|
+
/**
|
|
848
|
+
* Creates a new checkbox from API data.
|
|
849
|
+
*
|
|
850
|
+
* @param data - The API data to create this checkbox with
|
|
851
|
+
* @example
|
|
852
|
+
* Creating a checkbox from an API data object:
|
|
853
|
+
* ```ts
|
|
854
|
+
* const checkbox = new CheckboxBuilder({
|
|
855
|
+
* custom_id: 'accept_terms',
|
|
856
|
+
* default: false,
|
|
857
|
+
* });
|
|
858
|
+
* ```
|
|
859
|
+
* @example
|
|
860
|
+
* Creating a checkbox using setters and API data:
|
|
861
|
+
* ```ts
|
|
862
|
+
* const checkbox = new CheckboxBuilder()
|
|
863
|
+
* .setCustomId('subscribe_newsletter')
|
|
864
|
+
* .setDefault(true);
|
|
865
|
+
* ```
|
|
866
|
+
*/
|
|
867
|
+
constructor(data) {
|
|
868
|
+
super({ type: import_v104.ComponentType.Checkbox, ...data });
|
|
869
|
+
}
|
|
870
|
+
/**
|
|
871
|
+
* Sets the custom id of this checkbox.
|
|
872
|
+
*
|
|
873
|
+
* @param customId - The custom id to use
|
|
874
|
+
*/
|
|
875
|
+
setCustomId(customId) {
|
|
876
|
+
this.data.custom_id = customId;
|
|
877
|
+
return this;
|
|
878
|
+
}
|
|
879
|
+
/**
|
|
880
|
+
* Sets whether this checkbox is checked by default.
|
|
881
|
+
*
|
|
882
|
+
* @param isDefault - Whether the checkbox should be checked by default
|
|
883
|
+
*/
|
|
884
|
+
setDefault(isDefault) {
|
|
885
|
+
this.data.default = isDefault;
|
|
886
|
+
return this;
|
|
887
|
+
}
|
|
888
|
+
/**
|
|
889
|
+
* {@inheritDoc ComponentBuilder.toJSON}
|
|
890
|
+
*/
|
|
891
|
+
toJSON() {
|
|
892
|
+
checkboxPredicate.parse(this.data);
|
|
893
|
+
return {
|
|
894
|
+
...this.data
|
|
895
|
+
};
|
|
896
|
+
}
|
|
897
|
+
};
|
|
898
|
+
|
|
899
|
+
// src/components/checkbox/CheckboxGroup.ts
|
|
900
|
+
var import_v105 = require("discord-api-types/v10");
|
|
901
|
+
|
|
902
|
+
// src/components/checkbox/CheckboxGroupOption.ts
|
|
903
|
+
var CheckboxGroupOptionBuilder = class {
|
|
904
|
+
/**
|
|
905
|
+
* Creates a new checkbox group option from API data.
|
|
906
|
+
*
|
|
907
|
+
* @param data - The API data to create this checkbox group option with
|
|
908
|
+
* @example
|
|
909
|
+
* Creating a checkbox group option from an API data object:
|
|
910
|
+
* ```ts
|
|
911
|
+
* const option = new CheckboxGroupOptionBuilder({
|
|
912
|
+
* label: 'Option 1',
|
|
913
|
+
* value: 'option_1',
|
|
914
|
+
* });
|
|
915
|
+
* ```
|
|
916
|
+
* @example
|
|
917
|
+
* Creating a checkbox group option using setters and API data:
|
|
918
|
+
* ```ts
|
|
919
|
+
* const option = new CheckboxGroupOptionBuilder()
|
|
920
|
+
* .setLabel('Option 2')
|
|
921
|
+
* .setValue('option_2');
|
|
922
|
+
* ```
|
|
923
|
+
*/
|
|
924
|
+
constructor(data = {}) {
|
|
925
|
+
this.data = data;
|
|
926
|
+
}
|
|
927
|
+
static {
|
|
928
|
+
__name(this, "CheckboxGroupOptionBuilder");
|
|
929
|
+
}
|
|
930
|
+
/**
|
|
931
|
+
* Sets the label for this option.
|
|
932
|
+
*
|
|
933
|
+
* @param label - The label to use
|
|
934
|
+
*/
|
|
935
|
+
setLabel(label) {
|
|
936
|
+
this.data.label = label;
|
|
937
|
+
return this;
|
|
938
|
+
}
|
|
939
|
+
/**
|
|
940
|
+
* Sets the value for this option.
|
|
941
|
+
*
|
|
942
|
+
* @param value - The value to use
|
|
943
|
+
*/
|
|
944
|
+
setValue(value) {
|
|
945
|
+
this.data.value = value;
|
|
946
|
+
return this;
|
|
947
|
+
}
|
|
948
|
+
/**
|
|
949
|
+
* Sets the description for this option.
|
|
950
|
+
*
|
|
951
|
+
* @param description - The description to use
|
|
952
|
+
*/
|
|
953
|
+
setDescription(description) {
|
|
954
|
+
this.data.description = description;
|
|
955
|
+
return this;
|
|
956
|
+
}
|
|
957
|
+
/**
|
|
958
|
+
* Sets whether this option is selected by default.
|
|
959
|
+
*
|
|
960
|
+
* @param isDefault - Whether the option should be selected by default
|
|
961
|
+
*/
|
|
962
|
+
setDefault(isDefault) {
|
|
963
|
+
this.data.default = isDefault;
|
|
964
|
+
return this;
|
|
965
|
+
}
|
|
966
|
+
/**
|
|
967
|
+
* {@inheritDoc ComponentBuilder.toJSON}
|
|
968
|
+
*/
|
|
969
|
+
toJSON() {
|
|
970
|
+
checkboxGroupOptionPredicate.parse(this.data);
|
|
971
|
+
return {
|
|
972
|
+
...this.data
|
|
973
|
+
};
|
|
974
|
+
}
|
|
975
|
+
};
|
|
976
|
+
|
|
977
|
+
// src/components/checkbox/CheckboxGroup.ts
|
|
978
|
+
var CheckboxGroupBuilder = class extends ComponentBuilder {
|
|
979
|
+
static {
|
|
980
|
+
__name(this, "CheckboxGroupBuilder");
|
|
981
|
+
}
|
|
982
|
+
/**
|
|
983
|
+
* The options within this checkbox group.
|
|
984
|
+
*/
|
|
985
|
+
options;
|
|
986
|
+
/**
|
|
987
|
+
* Creates a new checkbox group from API data.
|
|
988
|
+
*
|
|
989
|
+
* @param data - The API data to create this checkbox group with
|
|
990
|
+
* @example
|
|
991
|
+
* Creating a checkbox group from an API data object:
|
|
992
|
+
* ```ts
|
|
993
|
+
* const checkboxGroup = new CheckboxGroupBuilder({
|
|
994
|
+
* custom_id: 'select_options',
|
|
995
|
+
* options: [
|
|
996
|
+
* { label: 'Option 1', value: 'option_1' },
|
|
997
|
+
* { label: 'Option 2', value: 'option_2' },
|
|
998
|
+
* ],
|
|
999
|
+
* });
|
|
1000
|
+
* ```
|
|
1001
|
+
* @example
|
|
1002
|
+
* Creating a checkbox group using setters and API data:
|
|
1003
|
+
* ```ts
|
|
1004
|
+
* const checkboxGroup = new CheckboxGroupBuilder()
|
|
1005
|
+
* .setCustomId('choose_items')
|
|
1006
|
+
* .setOptions([
|
|
1007
|
+
* { label: 'Item A', value: 'item_a' },
|
|
1008
|
+
* { label: 'Item B', value: 'item_b' },
|
|
1009
|
+
* ])
|
|
1010
|
+
* .setMinValues(1)
|
|
1011
|
+
* .setMaxValues(2);
|
|
1012
|
+
* ```
|
|
1013
|
+
*/
|
|
1014
|
+
constructor(data) {
|
|
1015
|
+
const { options, ...initData } = data ?? {};
|
|
1016
|
+
super({ ...initData, type: import_v105.ComponentType.CheckboxGroup });
|
|
1017
|
+
this.options = options?.map((option) => new CheckboxGroupOptionBuilder(option)) ?? [];
|
|
1018
|
+
}
|
|
1019
|
+
/**
|
|
1020
|
+
* Sets the custom id of this checkbox group.
|
|
1021
|
+
*
|
|
1022
|
+
* @param customId - The custom id to use
|
|
1023
|
+
*/
|
|
1024
|
+
setCustomId(customId) {
|
|
1025
|
+
this.data.custom_id = customId;
|
|
1026
|
+
return this;
|
|
1027
|
+
}
|
|
1028
|
+
/**
|
|
1029
|
+
* Adds options to this checkbox group.
|
|
1030
|
+
*
|
|
1031
|
+
* @param options - The options to add
|
|
1032
|
+
*/
|
|
1033
|
+
addOptions(...options) {
|
|
1034
|
+
const normalizedOptions = normalizeArray(options);
|
|
1035
|
+
this.options.push(
|
|
1036
|
+
...normalizedOptions.map((normalizedOption) => {
|
|
1037
|
+
const json = "toJSON" in normalizedOption ? normalizedOption.toJSON() : normalizedOption;
|
|
1038
|
+
const option = new CheckboxGroupOptionBuilder(json);
|
|
1039
|
+
checkboxGroupOptionPredicate.parse(option.toJSON());
|
|
1040
|
+
return option;
|
|
1041
|
+
})
|
|
1042
|
+
);
|
|
1043
|
+
return this;
|
|
1044
|
+
}
|
|
1045
|
+
/**
|
|
1046
|
+
* Sets the options for this checkbox group.
|
|
1047
|
+
*
|
|
1048
|
+
* @param options - The options to use
|
|
1049
|
+
*/
|
|
1050
|
+
setOptions(options) {
|
|
1051
|
+
return this.spliceOptions(0, this.options.length, ...options);
|
|
1052
|
+
}
|
|
1053
|
+
/**
|
|
1054
|
+
* Removes, replaces, or inserts options for this checkbox group.
|
|
1055
|
+
*
|
|
1056
|
+
* @remarks
|
|
1057
|
+
* This method behaves similarly
|
|
1058
|
+
* to {@link https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array/splice | Array.prototype.splice()}.
|
|
1059
|
+
* It's useful for modifying and adjusting the order of existing options.
|
|
1060
|
+
* @param index - The index to start at
|
|
1061
|
+
* @param deleteCount - The number of options to remove
|
|
1062
|
+
* @param options - The replacing option objects or builders
|
|
1063
|
+
*/
|
|
1064
|
+
spliceOptions(index, deleteCount, ...options) {
|
|
1065
|
+
const normalizedOptions = normalizeArray(options);
|
|
1066
|
+
const clone = [...this.options];
|
|
1067
|
+
clone.splice(
|
|
1068
|
+
index,
|
|
1069
|
+
deleteCount,
|
|
1070
|
+
...normalizedOptions.map((normalizedOption) => {
|
|
1071
|
+
const json = "toJSON" in normalizedOption ? normalizedOption.toJSON() : normalizedOption;
|
|
1072
|
+
const option = new CheckboxGroupOptionBuilder(json);
|
|
1073
|
+
checkboxGroupOptionPredicate.parse(option.toJSON());
|
|
1074
|
+
return option;
|
|
1075
|
+
})
|
|
1076
|
+
);
|
|
1077
|
+
this.options.splice(0, this.options.length, ...clone);
|
|
1078
|
+
return this;
|
|
1079
|
+
}
|
|
1080
|
+
/**
|
|
1081
|
+
* Sets the minimum number of options that must be selected.
|
|
1082
|
+
*
|
|
1083
|
+
* @param minValues - The minimum number of options that must be selected
|
|
1084
|
+
*/
|
|
1085
|
+
setMinValues(minValues) {
|
|
1086
|
+
this.data.min_values = minValues;
|
|
1087
|
+
return this;
|
|
1088
|
+
}
|
|
1089
|
+
/**
|
|
1090
|
+
* Sets the maximum number of options that can be selected.
|
|
1091
|
+
*
|
|
1092
|
+
* @param maxValues - The maximum number of options that can be selected
|
|
1093
|
+
*/
|
|
1094
|
+
setMaxValues(maxValues) {
|
|
1095
|
+
this.data.max_values = maxValues;
|
|
1096
|
+
return this;
|
|
1097
|
+
}
|
|
1098
|
+
/**
|
|
1099
|
+
* Sets whether selecting options is required.
|
|
1100
|
+
*
|
|
1101
|
+
* @param required - Whether selecting options is required
|
|
1102
|
+
*/
|
|
1103
|
+
setRequired(required) {
|
|
1104
|
+
this.data.required = required;
|
|
1105
|
+
return this;
|
|
1106
|
+
}
|
|
1107
|
+
/**
|
|
1108
|
+
* {@inheritDoc ComponentBuilder.toJSON}
|
|
1109
|
+
*/
|
|
1110
|
+
toJSON() {
|
|
1111
|
+
const data = {
|
|
1112
|
+
...this.data,
|
|
1113
|
+
options: this.options.map((option) => option.toJSON())
|
|
1114
|
+
};
|
|
1115
|
+
checkboxGroupPredicate.parse(data);
|
|
1116
|
+
return data;
|
|
1117
|
+
}
|
|
1118
|
+
};
|
|
1119
|
+
|
|
1120
|
+
// src/components/checkbox/RadioGroup.ts
|
|
1121
|
+
var import_v106 = require("discord-api-types/v10");
|
|
1122
|
+
|
|
1123
|
+
// src/components/checkbox/RadioGroupOption.ts
|
|
1124
|
+
var RadioGroupOptionBuilder = class {
|
|
1125
|
+
/**
|
|
1126
|
+
* Creates a new radio group option from API data.
|
|
1127
|
+
*
|
|
1128
|
+
* @param data - The API data to create this radio group option with
|
|
1129
|
+
* @example
|
|
1130
|
+
* Creating a radio group option from an API data object:
|
|
1131
|
+
* ```ts
|
|
1132
|
+
* const option = new RadioGroupOptionBuilder({
|
|
1133
|
+
* label: 'Option 1',
|
|
1134
|
+
* value: 'option_1',
|
|
1135
|
+
* });
|
|
1136
|
+
* ```
|
|
1137
|
+
* @example
|
|
1138
|
+
* Creating a radio group option using setters and API data:
|
|
1139
|
+
* ```ts
|
|
1140
|
+
* const option = new RadioGroupOptionBuilder()
|
|
1141
|
+
* .setLabel('Option 2')
|
|
1142
|
+
* .setValue('option_2');
|
|
1143
|
+
* ```
|
|
1144
|
+
*/
|
|
1145
|
+
constructor(data = {}) {
|
|
1146
|
+
this.data = data;
|
|
1147
|
+
}
|
|
1148
|
+
static {
|
|
1149
|
+
__name(this, "RadioGroupOptionBuilder");
|
|
1150
|
+
}
|
|
1151
|
+
/**
|
|
1152
|
+
* Sets the label for this option.
|
|
1153
|
+
*
|
|
1154
|
+
* @param label - The label to use
|
|
1155
|
+
*/
|
|
1156
|
+
setLabel(label) {
|
|
1157
|
+
this.data.label = label;
|
|
1158
|
+
return this;
|
|
1159
|
+
}
|
|
1160
|
+
/**
|
|
1161
|
+
* Sets the value for this option.
|
|
1162
|
+
*
|
|
1163
|
+
* @param value - The value to use
|
|
1164
|
+
*/
|
|
1165
|
+
setValue(value) {
|
|
1166
|
+
this.data.value = value;
|
|
1167
|
+
return this;
|
|
1168
|
+
}
|
|
1169
|
+
/**
|
|
1170
|
+
* Sets the description for this option.
|
|
1171
|
+
*
|
|
1172
|
+
* @param description - The description to use
|
|
1173
|
+
*/
|
|
1174
|
+
setDescription(description) {
|
|
1175
|
+
this.data.description = description;
|
|
1176
|
+
return this;
|
|
1177
|
+
}
|
|
1178
|
+
/**
|
|
1179
|
+
* Sets whether this option is selected by default.
|
|
1180
|
+
*
|
|
1181
|
+
* @param isDefault - Whether the option should be selected by default
|
|
1182
|
+
*/
|
|
1183
|
+
setDefault(isDefault) {
|
|
1184
|
+
this.data.default = isDefault;
|
|
1185
|
+
return this;
|
|
1186
|
+
}
|
|
1187
|
+
/**
|
|
1188
|
+
* {@inheritDoc ComponentBuilder.toJSON}
|
|
1189
|
+
*/
|
|
1190
|
+
toJSON() {
|
|
1191
|
+
radioGroupOptionPredicate.parse(this.data);
|
|
1192
|
+
return {
|
|
1193
|
+
...this.data
|
|
1194
|
+
};
|
|
1195
|
+
}
|
|
1196
|
+
};
|
|
1197
|
+
|
|
1198
|
+
// src/components/checkbox/RadioGroup.ts
|
|
1199
|
+
var RadioGroupBuilder = class extends ComponentBuilder {
|
|
1200
|
+
static {
|
|
1201
|
+
__name(this, "RadioGroupBuilder");
|
|
1202
|
+
}
|
|
1203
|
+
/**
|
|
1204
|
+
* The options within this radio group.
|
|
1205
|
+
*/
|
|
1206
|
+
options;
|
|
1207
|
+
/**
|
|
1208
|
+
* Creates a new radio group from API data.
|
|
1209
|
+
*
|
|
1210
|
+
* @param data - The API data to create this radio group with
|
|
1211
|
+
* @example
|
|
1212
|
+
* Creating a radio group from an API data object:
|
|
1213
|
+
* ```ts
|
|
1214
|
+
* const radioGroup = new RadioGroupBuilder({
|
|
1215
|
+
* custom_id: 'select_options',
|
|
1216
|
+
* options: [
|
|
1217
|
+
* { label: 'Option 1', value: 'option_1' },
|
|
1218
|
+
* { label: 'Option 2', value: 'option_2' },
|
|
1219
|
+
* ],
|
|
1220
|
+
* });
|
|
1221
|
+
* ```
|
|
1222
|
+
* @example
|
|
1223
|
+
* Creating a radio group using setters and API data:
|
|
1224
|
+
* ```ts
|
|
1225
|
+
* const radioGroup = new RadioGroupBuilder()
|
|
1226
|
+
* .setCustomId('choose_items')
|
|
1227
|
+
* .setOptions([
|
|
1228
|
+
* { label: 'Item A', value: 'item_a' },
|
|
1229
|
+
* { label: 'Item B', value: 'item_b' },
|
|
1230
|
+
* ])
|
|
1231
|
+
* ```
|
|
1232
|
+
*/
|
|
1233
|
+
constructor(data) {
|
|
1234
|
+
const { options, ...initData } = data ?? {};
|
|
1235
|
+
super({ ...initData, type: import_v106.ComponentType.RadioGroup });
|
|
1236
|
+
this.options = options?.map((option) => new RadioGroupOptionBuilder(option)) ?? [];
|
|
1237
|
+
}
|
|
1238
|
+
/**
|
|
1239
|
+
* Sets the custom id of this radio group.
|
|
1240
|
+
*
|
|
1241
|
+
* @param customId - The custom id to use
|
|
1242
|
+
*/
|
|
1243
|
+
setCustomId(customId) {
|
|
1244
|
+
this.data.custom_id = customId;
|
|
1245
|
+
return this;
|
|
1246
|
+
}
|
|
1247
|
+
/**
|
|
1248
|
+
* Adds options to this radio group.
|
|
714
1249
|
*
|
|
715
|
-
* @param
|
|
1250
|
+
* @param options - The options to add
|
|
716
1251
|
*/
|
|
717
|
-
|
|
718
|
-
|
|
1252
|
+
addOptions(...options) {
|
|
1253
|
+
const normalizedOptions = normalizeArray(options);
|
|
1254
|
+
this.options.push(
|
|
1255
|
+
...normalizedOptions.map((normalizedOption) => {
|
|
1256
|
+
const json = "toJSON" in normalizedOption ? normalizedOption.toJSON() : normalizedOption;
|
|
1257
|
+
const option = new RadioGroupOptionBuilder(json);
|
|
1258
|
+
radioGroupOptionPredicate.parse(option.toJSON());
|
|
1259
|
+
return option;
|
|
1260
|
+
})
|
|
1261
|
+
);
|
|
719
1262
|
return this;
|
|
720
1263
|
}
|
|
721
1264
|
/**
|
|
722
|
-
* Sets
|
|
1265
|
+
* Sets the options for this radio group.
|
|
723
1266
|
*
|
|
724
|
-
* @param
|
|
1267
|
+
* @param options - The options to use
|
|
725
1268
|
*/
|
|
726
|
-
|
|
727
|
-
this.
|
|
1269
|
+
setOptions(options) {
|
|
1270
|
+
return this.spliceOptions(0, this.options.length, ...options);
|
|
1271
|
+
}
|
|
1272
|
+
/**
|
|
1273
|
+
* Removes, replaces, or inserts options for this radio group.
|
|
1274
|
+
*
|
|
1275
|
+
* @remarks
|
|
1276
|
+
* This method behaves similarly
|
|
1277
|
+
* to {@link https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array/splice | Array.prototype.splice()}.
|
|
1278
|
+
* It's useful for modifying and adjusting the order of existing options.
|
|
1279
|
+
* @param index - The index to start at
|
|
1280
|
+
* @param deleteCount - The number of options to remove
|
|
1281
|
+
* @param options - The replacing option objects or builders
|
|
1282
|
+
*/
|
|
1283
|
+
spliceOptions(index, deleteCount, ...options) {
|
|
1284
|
+
const normalizedOptions = normalizeArray(options);
|
|
1285
|
+
const clone = [...this.options];
|
|
1286
|
+
clone.splice(
|
|
1287
|
+
index,
|
|
1288
|
+
deleteCount,
|
|
1289
|
+
...normalizedOptions.map((normalizedOption) => {
|
|
1290
|
+
const json = "toJSON" in normalizedOption ? normalizedOption.toJSON() : normalizedOption;
|
|
1291
|
+
const option = new RadioGroupOptionBuilder(json);
|
|
1292
|
+
radioGroupOptionPredicate.parse(option.toJSON());
|
|
1293
|
+
return option;
|
|
1294
|
+
})
|
|
1295
|
+
);
|
|
1296
|
+
this.options.splice(0, this.options.length, ...clone);
|
|
728
1297
|
return this;
|
|
729
1298
|
}
|
|
730
1299
|
/**
|
|
731
|
-
* Sets
|
|
1300
|
+
* Sets whether selecting options is required.
|
|
732
1301
|
*
|
|
733
|
-
* @param
|
|
1302
|
+
* @param required - Whether selecting options is required
|
|
734
1303
|
*/
|
|
735
|
-
|
|
736
|
-
this.data.
|
|
1304
|
+
setRequired(required) {
|
|
1305
|
+
this.data.required = required;
|
|
737
1306
|
return this;
|
|
738
1307
|
}
|
|
739
1308
|
/**
|
|
740
1309
|
* {@inheritDoc ComponentBuilder.toJSON}
|
|
741
1310
|
*/
|
|
742
1311
|
toJSON() {
|
|
743
|
-
|
|
744
|
-
this.data
|
|
745
|
-
this.
|
|
746
|
-
this.data.emoji,
|
|
747
|
-
this.data.custom_id,
|
|
748
|
-
this.data.sku_id,
|
|
749
|
-
this.data.url
|
|
750
|
-
);
|
|
751
|
-
return {
|
|
752
|
-
...this.data
|
|
1312
|
+
const data = {
|
|
1313
|
+
...this.data,
|
|
1314
|
+
options: this.options.map((option) => option.toJSON())
|
|
753
1315
|
};
|
|
1316
|
+
radioGroupPredicate.parse(data);
|
|
1317
|
+
return data;
|
|
754
1318
|
}
|
|
755
1319
|
};
|
|
756
1320
|
|
|
757
1321
|
// src/components/fileUpload/FileUpload.ts
|
|
758
|
-
var
|
|
1322
|
+
var import_v108 = require("discord-api-types/v10");
|
|
759
1323
|
|
|
760
1324
|
// src/components/fileUpload/Assertions.ts
|
|
761
|
-
var
|
|
762
|
-
__export(
|
|
1325
|
+
var Assertions_exports4 = {};
|
|
1326
|
+
__export(Assertions_exports4, {
|
|
763
1327
|
fileUploadPredicate: () => fileUploadPredicate
|
|
764
1328
|
});
|
|
765
|
-
var
|
|
766
|
-
var
|
|
767
|
-
var fileUploadPredicate =
|
|
768
|
-
type:
|
|
1329
|
+
var import_shapeshift4 = require("@sapphire/shapeshift");
|
|
1330
|
+
var import_v107 = require("discord-api-types/v10");
|
|
1331
|
+
var fileUploadPredicate = import_shapeshift4.s.object({
|
|
1332
|
+
type: import_shapeshift4.s.literal(import_v107.ComponentType.FileUpload),
|
|
769
1333
|
id: idValidator.optional(),
|
|
770
1334
|
custom_id: customIdValidator,
|
|
771
|
-
min_values:
|
|
772
|
-
max_values:
|
|
773
|
-
required:
|
|
1335
|
+
min_values: import_shapeshift4.s.number().greaterThanOrEqual(0).lessThanOrEqual(10).optional(),
|
|
1336
|
+
max_values: import_shapeshift4.s.number().greaterThanOrEqual(1).lessThanOrEqual(10).optional(),
|
|
1337
|
+
required: import_shapeshift4.s.boolean().optional()
|
|
774
1338
|
});
|
|
775
1339
|
|
|
776
1340
|
// src/components/fileUpload/FileUpload.ts
|
|
@@ -802,7 +1366,7 @@ var FileUploadBuilder = class extends ComponentBuilder {
|
|
|
802
1366
|
* ```
|
|
803
1367
|
*/
|
|
804
1368
|
constructor(data = {}) {
|
|
805
|
-
super({ type:
|
|
1369
|
+
super({ type: import_v108.ComponentType.FileUpload, ...data });
|
|
806
1370
|
}
|
|
807
1371
|
/**
|
|
808
1372
|
* Sets the custom id for this file upload.
|
|
@@ -832,7 +1396,7 @@ var FileUploadBuilder = class extends ComponentBuilder {
|
|
|
832
1396
|
/**
|
|
833
1397
|
* Sets the maximum number of file uploads required.
|
|
834
1398
|
*
|
|
835
|
-
* @param maxValues - The maximum values that
|
|
1399
|
+
* @param maxValues - The maximum values that can be uploaded
|
|
836
1400
|
*/
|
|
837
1401
|
setMaxValues(maxValues) {
|
|
838
1402
|
this.data.max_values = maxValues;
|
|
@@ -864,14 +1428,14 @@ var FileUploadBuilder = class extends ComponentBuilder {
|
|
|
864
1428
|
};
|
|
865
1429
|
|
|
866
1430
|
// src/components/label/Label.ts
|
|
867
|
-
var
|
|
1431
|
+
var import_v1018 = require("discord-api-types/v10");
|
|
868
1432
|
|
|
869
1433
|
// src/components/selectMenu/ChannelSelectMenu.ts
|
|
870
|
-
var
|
|
1434
|
+
var import_v1010 = require("discord-api-types/v10");
|
|
871
1435
|
|
|
872
1436
|
// src/components/textInput/Assertions.ts
|
|
873
|
-
var
|
|
874
|
-
__export(
|
|
1437
|
+
var Assertions_exports5 = {};
|
|
1438
|
+
__export(Assertions_exports5, {
|
|
875
1439
|
labelValidator: () => labelValidator,
|
|
876
1440
|
maxLengthValidator: () => maxLengthValidator,
|
|
877
1441
|
minLengthValidator: () => minLengthValidator,
|
|
@@ -882,17 +1446,17 @@ __export(Assertions_exports4, {
|
|
|
882
1446
|
validateRequiredParameters: () => validateRequiredParameters,
|
|
883
1447
|
valueValidator: () => valueValidator
|
|
884
1448
|
});
|
|
885
|
-
var
|
|
886
|
-
var
|
|
887
|
-
var textInputStyleValidator =
|
|
888
|
-
var minLengthValidator =
|
|
889
|
-
var maxLengthValidator =
|
|
890
|
-
var requiredValidator =
|
|
891
|
-
var valueValidator =
|
|
892
|
-
var placeholderValidator2 =
|
|
893
|
-
var labelValidator =
|
|
894
|
-
var textInputPredicate =
|
|
895
|
-
type:
|
|
1449
|
+
var import_shapeshift5 = require("@sapphire/shapeshift");
|
|
1450
|
+
var import_v109 = require("discord-api-types/v10");
|
|
1451
|
+
var textInputStyleValidator = import_shapeshift5.s.nativeEnum(import_v109.TextInputStyle).setValidationEnabled(isValidationEnabled);
|
|
1452
|
+
var minLengthValidator = import_shapeshift5.s.number().int().greaterThanOrEqual(0).lessThanOrEqual(4e3).setValidationEnabled(isValidationEnabled);
|
|
1453
|
+
var maxLengthValidator = import_shapeshift5.s.number().int().greaterThanOrEqual(1).lessThanOrEqual(4e3).setValidationEnabled(isValidationEnabled);
|
|
1454
|
+
var requiredValidator = import_shapeshift5.s.boolean().setValidationEnabled(isValidationEnabled);
|
|
1455
|
+
var valueValidator = import_shapeshift5.s.string().lengthLessThanOrEqual(4e3).setValidationEnabled(isValidationEnabled);
|
|
1456
|
+
var placeholderValidator2 = import_shapeshift5.s.string().lengthLessThanOrEqual(100).setValidationEnabled(isValidationEnabled);
|
|
1457
|
+
var labelValidator = import_shapeshift5.s.string().lengthGreaterThanOrEqual(1).lengthLessThanOrEqual(45).setValidationEnabled(isValidationEnabled);
|
|
1458
|
+
var textInputPredicate = import_shapeshift5.s.object({
|
|
1459
|
+
type: import_shapeshift5.s.literal(import_v109.ComponentType.TextInput),
|
|
896
1460
|
custom_id: customIdValidator,
|
|
897
1461
|
style: textInputStyleValidator,
|
|
898
1462
|
id: idValidator.optional(),
|
|
@@ -932,9 +1496,9 @@ var BaseSelectMenuBuilder = class extends ComponentBuilder {
|
|
|
932
1496
|
return this;
|
|
933
1497
|
}
|
|
934
1498
|
/**
|
|
935
|
-
* Sets the maximum values that
|
|
1499
|
+
* Sets the maximum values that can be selected in the select menu.
|
|
936
1500
|
*
|
|
937
|
-
* @param maxValues - The maximum values that
|
|
1501
|
+
* @param maxValues - The maximum values that can be selected
|
|
938
1502
|
*/
|
|
939
1503
|
setMaxValues(maxValues) {
|
|
940
1504
|
this.data.max_values = minMaxValidator.parse(maxValues);
|
|
@@ -1008,7 +1572,7 @@ var ChannelSelectMenuBuilder = class extends BaseSelectMenuBuilder {
|
|
|
1008
1572
|
* ```
|
|
1009
1573
|
*/
|
|
1010
1574
|
constructor(data) {
|
|
1011
|
-
super({ ...data, type:
|
|
1575
|
+
super({ ...data, type: import_v1010.ComponentType.ChannelSelect });
|
|
1012
1576
|
}
|
|
1013
1577
|
/**
|
|
1014
1578
|
* Adds channel types to this select menu.
|
|
@@ -1044,7 +1608,7 @@ var ChannelSelectMenuBuilder = class extends BaseSelectMenuBuilder {
|
|
|
1044
1608
|
this.data.default_values.push(
|
|
1045
1609
|
...normalizedValues.map((id) => ({
|
|
1046
1610
|
id,
|
|
1047
|
-
type:
|
|
1611
|
+
type: import_v1010.SelectMenuDefaultValueType.Channel
|
|
1048
1612
|
}))
|
|
1049
1613
|
);
|
|
1050
1614
|
return this;
|
|
@@ -1059,7 +1623,7 @@ var ChannelSelectMenuBuilder = class extends BaseSelectMenuBuilder {
|
|
|
1059
1623
|
optionsLengthValidator.parse(normalizedValues.length);
|
|
1060
1624
|
this.data.default_values = normalizedValues.map((id) => ({
|
|
1061
1625
|
id,
|
|
1062
|
-
type:
|
|
1626
|
+
type: import_v1010.SelectMenuDefaultValueType.Channel
|
|
1063
1627
|
}));
|
|
1064
1628
|
return this;
|
|
1065
1629
|
}
|
|
@@ -1075,7 +1639,7 @@ var ChannelSelectMenuBuilder = class extends BaseSelectMenuBuilder {
|
|
|
1075
1639
|
};
|
|
1076
1640
|
|
|
1077
1641
|
// src/components/selectMenu/MentionableSelectMenu.ts
|
|
1078
|
-
var
|
|
1642
|
+
var import_v1011 = require("discord-api-types/v10");
|
|
1079
1643
|
var MentionableSelectMenuBuilder = class extends BaseSelectMenuBuilder {
|
|
1080
1644
|
static {
|
|
1081
1645
|
__name(this, "MentionableSelectMenuBuilder");
|
|
@@ -1103,7 +1667,7 @@ var MentionableSelectMenuBuilder = class extends BaseSelectMenuBuilder {
|
|
|
1103
1667
|
* ```
|
|
1104
1668
|
*/
|
|
1105
1669
|
constructor(data) {
|
|
1106
|
-
super({ ...data, type:
|
|
1670
|
+
super({ ...data, type: import_v1011.ComponentType.MentionableSelect });
|
|
1107
1671
|
}
|
|
1108
1672
|
/**
|
|
1109
1673
|
* Adds default roles to this auto populated select menu.
|
|
@@ -1117,7 +1681,7 @@ var MentionableSelectMenuBuilder = class extends BaseSelectMenuBuilder {
|
|
|
1117
1681
|
this.data.default_values.push(
|
|
1118
1682
|
...normalizedValues.map((id) => ({
|
|
1119
1683
|
id,
|
|
1120
|
-
type:
|
|
1684
|
+
type: import_v1011.SelectMenuDefaultValueType.Role
|
|
1121
1685
|
}))
|
|
1122
1686
|
);
|
|
1123
1687
|
return this;
|
|
@@ -1134,7 +1698,7 @@ var MentionableSelectMenuBuilder = class extends BaseSelectMenuBuilder {
|
|
|
1134
1698
|
this.data.default_values.push(
|
|
1135
1699
|
...normalizedValues.map((id) => ({
|
|
1136
1700
|
id,
|
|
1137
|
-
type:
|
|
1701
|
+
type: import_v1011.SelectMenuDefaultValueType.User
|
|
1138
1702
|
}))
|
|
1139
1703
|
);
|
|
1140
1704
|
return this;
|
|
@@ -1165,7 +1729,7 @@ var MentionableSelectMenuBuilder = class extends BaseSelectMenuBuilder {
|
|
|
1165
1729
|
};
|
|
1166
1730
|
|
|
1167
1731
|
// src/components/selectMenu/RoleSelectMenu.ts
|
|
1168
|
-
var
|
|
1732
|
+
var import_v1012 = require("discord-api-types/v10");
|
|
1169
1733
|
var RoleSelectMenuBuilder = class extends BaseSelectMenuBuilder {
|
|
1170
1734
|
static {
|
|
1171
1735
|
__name(this, "RoleSelectMenuBuilder");
|
|
@@ -1193,7 +1757,7 @@ var RoleSelectMenuBuilder = class extends BaseSelectMenuBuilder {
|
|
|
1193
1757
|
* ```
|
|
1194
1758
|
*/
|
|
1195
1759
|
constructor(data) {
|
|
1196
|
-
super({ ...data, type:
|
|
1760
|
+
super({ ...data, type: import_v1012.ComponentType.RoleSelect });
|
|
1197
1761
|
}
|
|
1198
1762
|
/**
|
|
1199
1763
|
* Adds default roles to this auto populated select menu.
|
|
@@ -1207,7 +1771,7 @@ var RoleSelectMenuBuilder = class extends BaseSelectMenuBuilder {
|
|
|
1207
1771
|
this.data.default_values.push(
|
|
1208
1772
|
...normalizedValues.map((id) => ({
|
|
1209
1773
|
id,
|
|
1210
|
-
type:
|
|
1774
|
+
type: import_v1012.SelectMenuDefaultValueType.Role
|
|
1211
1775
|
}))
|
|
1212
1776
|
);
|
|
1213
1777
|
return this;
|
|
@@ -1222,14 +1786,78 @@ var RoleSelectMenuBuilder = class extends BaseSelectMenuBuilder {
|
|
|
1222
1786
|
optionsLengthValidator.parse(normalizedValues.length);
|
|
1223
1787
|
this.data.default_values = normalizedValues.map((id) => ({
|
|
1224
1788
|
id,
|
|
1225
|
-
type:
|
|
1789
|
+
type: import_v1012.SelectMenuDefaultValueType.Role
|
|
1226
1790
|
}));
|
|
1227
1791
|
return this;
|
|
1228
1792
|
}
|
|
1229
1793
|
};
|
|
1230
1794
|
|
|
1231
1795
|
// src/components/selectMenu/StringSelectMenu.ts
|
|
1232
|
-
var
|
|
1796
|
+
var import_v1014 = require("discord-api-types/v10");
|
|
1797
|
+
|
|
1798
|
+
// src/components/selectMenu/Assertions.ts
|
|
1799
|
+
var Assertions_exports6 = {};
|
|
1800
|
+
__export(Assertions_exports6, {
|
|
1801
|
+
selectMenuChannelPredicate: () => selectMenuChannelPredicate,
|
|
1802
|
+
selectMenuMentionablePredicate: () => selectMenuMentionablePredicate,
|
|
1803
|
+
selectMenuRolePredicate: () => selectMenuRolePredicate,
|
|
1804
|
+
selectMenuStringOptionPredicate: () => selectMenuStringOptionPredicate,
|
|
1805
|
+
selectMenuStringPredicate: () => selectMenuStringPredicate,
|
|
1806
|
+
selectMenuUserPredicate: () => selectMenuUserPredicate
|
|
1807
|
+
});
|
|
1808
|
+
var import_shapeshift6 = require("@sapphire/shapeshift");
|
|
1809
|
+
var import_v1013 = require("discord-api-types/v10");
|
|
1810
|
+
var selectMenuBasePredicate = import_shapeshift6.s.object({
|
|
1811
|
+
id: idValidator.optional(),
|
|
1812
|
+
placeholder: import_shapeshift6.s.string().lengthLessThanOrEqual(150).optional(),
|
|
1813
|
+
min_values: import_shapeshift6.s.number().greaterThanOrEqual(0).lessThanOrEqual(25).optional(),
|
|
1814
|
+
max_values: import_shapeshift6.s.number().greaterThanOrEqual(0).lessThanOrEqual(25).optional(),
|
|
1815
|
+
custom_id: customIdValidator,
|
|
1816
|
+
disabled: import_shapeshift6.s.boolean().optional()
|
|
1817
|
+
});
|
|
1818
|
+
var selectMenuChannelPredicate = selectMenuBasePredicate.extend({
|
|
1819
|
+
type: import_shapeshift6.s.literal(import_v1013.ComponentType.ChannelSelect),
|
|
1820
|
+
channel_types: import_shapeshift6.s.nativeEnum(import_v1013.ChannelType).array().optional(),
|
|
1821
|
+
default_values: import_shapeshift6.s.object({ id: import_shapeshift6.s.string(), type: import_shapeshift6.s.literal(import_v1013.SelectMenuDefaultValueType.Channel) }).array().lengthLessThanOrEqual(25).optional()
|
|
1822
|
+
}).setValidationEnabled(isValidationEnabled);
|
|
1823
|
+
var selectMenuMentionablePredicate = selectMenuBasePredicate.extend({
|
|
1824
|
+
type: import_shapeshift6.s.literal(import_v1013.ComponentType.MentionableSelect),
|
|
1825
|
+
default_values: import_shapeshift6.s.object({
|
|
1826
|
+
id: import_shapeshift6.s.string(),
|
|
1827
|
+
type: import_shapeshift6.s.union([import_shapeshift6.s.literal(import_v1013.SelectMenuDefaultValueType.Role), import_shapeshift6.s.literal(import_v1013.SelectMenuDefaultValueType.User)])
|
|
1828
|
+
}).array().lengthLessThanOrEqual(25).optional()
|
|
1829
|
+
}).setValidationEnabled(isValidationEnabled);
|
|
1830
|
+
var selectMenuRolePredicate = selectMenuBasePredicate.extend({
|
|
1831
|
+
type: import_shapeshift6.s.literal(import_v1013.ComponentType.RoleSelect),
|
|
1832
|
+
default_values: import_shapeshift6.s.object({ id: import_shapeshift6.s.string(), type: import_shapeshift6.s.literal(import_v1013.SelectMenuDefaultValueType.Role) }).array().lengthLessThanOrEqual(25).optional()
|
|
1833
|
+
}).setValidationEnabled(isValidationEnabled);
|
|
1834
|
+
var selectMenuUserPredicate = selectMenuBasePredicate.extend({
|
|
1835
|
+
type: import_shapeshift6.s.literal(import_v1013.ComponentType.UserSelect),
|
|
1836
|
+
default_values: import_shapeshift6.s.object({ id: import_shapeshift6.s.string(), type: import_shapeshift6.s.literal(import_v1013.SelectMenuDefaultValueType.User) }).array().lengthLessThanOrEqual(25).optional()
|
|
1837
|
+
}).setValidationEnabled(isValidationEnabled);
|
|
1838
|
+
var selectMenuStringOptionPredicate = import_shapeshift6.s.object({
|
|
1839
|
+
label: import_shapeshift6.s.string().lengthGreaterThanOrEqual(1).lengthLessThanOrEqual(100),
|
|
1840
|
+
value: import_shapeshift6.s.string().lengthGreaterThanOrEqual(1).lengthLessThanOrEqual(100),
|
|
1841
|
+
description: import_shapeshift6.s.string().lengthGreaterThanOrEqual(1).lengthLessThanOrEqual(100).optional(),
|
|
1842
|
+
emoji: emojiValidator.optional(),
|
|
1843
|
+
default: import_shapeshift6.s.boolean().optional()
|
|
1844
|
+
}).setValidationEnabled(isValidationEnabled);
|
|
1845
|
+
var selectMenuStringPredicate = selectMenuBasePredicate.extend({
|
|
1846
|
+
type: import_shapeshift6.s.literal(import_v1013.ComponentType.StringSelect),
|
|
1847
|
+
options: selectMenuStringOptionPredicate.array().lengthGreaterThanOrEqual(1).lengthLessThanOrEqual(25)
|
|
1848
|
+
}).reshape((value) => {
|
|
1849
|
+
if (value.min_values !== void 0 && value.options.length < value.min_values) {
|
|
1850
|
+
return import_shapeshift6.Result.err(new RangeError(`The number of options must be greater than or equal to min_values`));
|
|
1851
|
+
}
|
|
1852
|
+
if (value.min_values !== void 0 && value.max_values !== void 0 && value.min_values > value.max_values) {
|
|
1853
|
+
return import_shapeshift6.Result.err(
|
|
1854
|
+
new RangeError(`The maximum amount of options must be greater than or equal to the minimum amount of options`)
|
|
1855
|
+
);
|
|
1856
|
+
}
|
|
1857
|
+
return import_shapeshift6.Result.ok(value);
|
|
1858
|
+
}).setValidationEnabled(isValidationEnabled);
|
|
1859
|
+
|
|
1860
|
+
// src/components/selectMenu/StringSelectMenu.ts
|
|
1233
1861
|
var StringSelectMenuBuilder = class extends BaseSelectMenuBuilder {
|
|
1234
1862
|
static {
|
|
1235
1863
|
__name(this, "StringSelectMenuBuilder");
|
|
@@ -1271,7 +1899,7 @@ var StringSelectMenuBuilder = class extends BaseSelectMenuBuilder {
|
|
|
1271
1899
|
*/
|
|
1272
1900
|
constructor(data) {
|
|
1273
1901
|
const { options, ...initData } = data ?? {};
|
|
1274
|
-
super({ ...initData, type:
|
|
1902
|
+
super({ ...initData, type: import_v1014.ComponentType.StringSelect });
|
|
1275
1903
|
this.options = options?.map((option) => new StringSelectMenuOptionBuilder(option)) ?? [];
|
|
1276
1904
|
}
|
|
1277
1905
|
/**
|
|
@@ -1284,7 +1912,7 @@ var StringSelectMenuBuilder = class extends BaseSelectMenuBuilder {
|
|
|
1284
1912
|
optionsLengthValidator.parse(this.options.length + normalizedOptions.length);
|
|
1285
1913
|
this.options.push(
|
|
1286
1914
|
...normalizedOptions.map(
|
|
1287
|
-
(normalizedOption) => normalizedOption instanceof StringSelectMenuOptionBuilder ? normalizedOption : new StringSelectMenuOptionBuilder(
|
|
1915
|
+
(normalizedOption) => normalizedOption instanceof StringSelectMenuOptionBuilder ? normalizedOption : new StringSelectMenuOptionBuilder(selectMenuStringOptionPredicate.parse(normalizedOption))
|
|
1288
1916
|
)
|
|
1289
1917
|
);
|
|
1290
1918
|
return this;
|
|
@@ -1302,7 +1930,7 @@ var StringSelectMenuBuilder = class extends BaseSelectMenuBuilder {
|
|
|
1302
1930
|
*
|
|
1303
1931
|
* @remarks
|
|
1304
1932
|
* This method behaves similarly
|
|
1305
|
-
* to {@link https://developer.mozilla.org/
|
|
1933
|
+
* to {@link https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array/splice | Array.prototype.splice()}.
|
|
1306
1934
|
* It's useful for modifying and adjusting the order of existing options.
|
|
1307
1935
|
* @example
|
|
1308
1936
|
* Remove the first option:
|
|
@@ -1331,7 +1959,7 @@ var StringSelectMenuBuilder = class extends BaseSelectMenuBuilder {
|
|
|
1331
1959
|
index,
|
|
1332
1960
|
deleteCount,
|
|
1333
1961
|
...normalizedOptions.map(
|
|
1334
|
-
(normalizedOption) => normalizedOption instanceof StringSelectMenuOptionBuilder ? normalizedOption : new StringSelectMenuOptionBuilder(
|
|
1962
|
+
(normalizedOption) => normalizedOption instanceof StringSelectMenuOptionBuilder ? normalizedOption : new StringSelectMenuOptionBuilder(selectMenuStringOptionPredicate.parse(normalizedOption))
|
|
1335
1963
|
)
|
|
1336
1964
|
);
|
|
1337
1965
|
optionsLengthValidator.parse(clone.length);
|
|
@@ -1351,7 +1979,7 @@ var StringSelectMenuBuilder = class extends BaseSelectMenuBuilder {
|
|
|
1351
1979
|
};
|
|
1352
1980
|
|
|
1353
1981
|
// src/components/selectMenu/UserSelectMenu.ts
|
|
1354
|
-
var
|
|
1982
|
+
var import_v1015 = require("discord-api-types/v10");
|
|
1355
1983
|
var UserSelectMenuBuilder = class extends BaseSelectMenuBuilder {
|
|
1356
1984
|
static {
|
|
1357
1985
|
__name(this, "UserSelectMenuBuilder");
|
|
@@ -1379,7 +2007,7 @@ var UserSelectMenuBuilder = class extends BaseSelectMenuBuilder {
|
|
|
1379
2007
|
* ```
|
|
1380
2008
|
*/
|
|
1381
2009
|
constructor(data) {
|
|
1382
|
-
super({ ...data, type:
|
|
2010
|
+
super({ ...data, type: import_v1015.ComponentType.UserSelect });
|
|
1383
2011
|
}
|
|
1384
2012
|
/**
|
|
1385
2013
|
* Adds default users to this auto populated select menu.
|
|
@@ -1393,7 +2021,7 @@ var UserSelectMenuBuilder = class extends BaseSelectMenuBuilder {
|
|
|
1393
2021
|
this.data.default_values.push(
|
|
1394
2022
|
...normalizedValues.map((id) => ({
|
|
1395
2023
|
id,
|
|
1396
|
-
type:
|
|
2024
|
+
type: import_v1015.SelectMenuDefaultValueType.User
|
|
1397
2025
|
}))
|
|
1398
2026
|
);
|
|
1399
2027
|
return this;
|
|
@@ -1408,7 +2036,7 @@ var UserSelectMenuBuilder = class extends BaseSelectMenuBuilder {
|
|
|
1408
2036
|
optionsLengthValidator.parse(normalizedValues.length);
|
|
1409
2037
|
this.data.default_values = normalizedValues.map((id) => ({
|
|
1410
2038
|
id,
|
|
1411
|
-
type:
|
|
2039
|
+
type: import_v1015.SelectMenuDefaultValueType.User
|
|
1412
2040
|
}));
|
|
1413
2041
|
return this;
|
|
1414
2042
|
}
|
|
@@ -1416,7 +2044,7 @@ var UserSelectMenuBuilder = class extends BaseSelectMenuBuilder {
|
|
|
1416
2044
|
|
|
1417
2045
|
// src/components/textInput/TextInput.ts
|
|
1418
2046
|
var import_util = require("@discordjs/util");
|
|
1419
|
-
var
|
|
2047
|
+
var import_v1016 = require("discord-api-types/v10");
|
|
1420
2048
|
var import_fast_deep_equal = __toESM(require("fast-deep-equal"));
|
|
1421
2049
|
var TextInputBuilder = class extends ComponentBuilder {
|
|
1422
2050
|
static {
|
|
@@ -1446,7 +2074,7 @@ var TextInputBuilder = class extends ComponentBuilder {
|
|
|
1446
2074
|
* ```
|
|
1447
2075
|
*/
|
|
1448
2076
|
constructor(data) {
|
|
1449
|
-
super({ type:
|
|
2077
|
+
super({ type: import_v1016.ComponentType.TextInput, ...data });
|
|
1450
2078
|
}
|
|
1451
2079
|
/**
|
|
1452
2080
|
* Sets the custom id for this text input.
|
|
@@ -1542,80 +2170,28 @@ var TextInputBuilder = class extends ComponentBuilder {
|
|
|
1542
2170
|
};
|
|
1543
2171
|
|
|
1544
2172
|
// src/components/label/Assertions.ts
|
|
1545
|
-
var
|
|
1546
|
-
__export(
|
|
2173
|
+
var Assertions_exports7 = {};
|
|
2174
|
+
__export(Assertions_exports7, {
|
|
1547
2175
|
labelPredicate: () => labelPredicate
|
|
1548
2176
|
});
|
|
1549
|
-
var
|
|
1550
|
-
var
|
|
1551
|
-
|
|
1552
|
-
// src/components/selectMenu/Assertions.ts
|
|
1553
|
-
var import_shapeshift5 = require("@sapphire/shapeshift");
|
|
1554
|
-
var import_v1012 = require("discord-api-types/v10");
|
|
1555
|
-
var selectMenuBasePredicate = import_shapeshift5.s.object({
|
|
1556
|
-
id: idValidator.optional(),
|
|
1557
|
-
placeholder: import_shapeshift5.s.string().lengthLessThanOrEqual(150).optional(),
|
|
1558
|
-
min_values: import_shapeshift5.s.number().greaterThanOrEqual(0).lessThanOrEqual(25).optional(),
|
|
1559
|
-
max_values: import_shapeshift5.s.number().greaterThanOrEqual(0).lessThanOrEqual(25).optional(),
|
|
1560
|
-
custom_id: customIdValidator,
|
|
1561
|
-
disabled: import_shapeshift5.s.boolean().optional()
|
|
1562
|
-
});
|
|
1563
|
-
var selectMenuChannelPredicate = selectMenuBasePredicate.extend({
|
|
1564
|
-
type: import_shapeshift5.s.literal(import_v1012.ComponentType.ChannelSelect),
|
|
1565
|
-
channel_types: import_shapeshift5.s.nativeEnum(import_v1012.ChannelType).array().optional(),
|
|
1566
|
-
default_values: import_shapeshift5.s.object({ id: import_shapeshift5.s.string(), type: import_shapeshift5.s.literal(import_v1012.SelectMenuDefaultValueType.Channel) }).array().lengthLessThanOrEqual(25).optional()
|
|
1567
|
-
}).setValidationEnabled(isValidationEnabled);
|
|
1568
|
-
var selectMenuMentionablePredicate = selectMenuBasePredicate.extend({
|
|
1569
|
-
type: import_shapeshift5.s.literal(import_v1012.ComponentType.MentionableSelect),
|
|
1570
|
-
default_values: import_shapeshift5.s.object({
|
|
1571
|
-
id: import_shapeshift5.s.string(),
|
|
1572
|
-
type: import_shapeshift5.s.union([import_shapeshift5.s.literal(import_v1012.SelectMenuDefaultValueType.Role), import_shapeshift5.s.literal(import_v1012.SelectMenuDefaultValueType.User)])
|
|
1573
|
-
}).array().lengthLessThanOrEqual(25).optional()
|
|
1574
|
-
}).setValidationEnabled(isValidationEnabled);
|
|
1575
|
-
var selectMenuRolePredicate = selectMenuBasePredicate.extend({
|
|
1576
|
-
type: import_shapeshift5.s.literal(import_v1012.ComponentType.RoleSelect),
|
|
1577
|
-
default_values: import_shapeshift5.s.object({ id: import_shapeshift5.s.string(), type: import_shapeshift5.s.literal(import_v1012.SelectMenuDefaultValueType.Role) }).array().lengthLessThanOrEqual(25).optional()
|
|
1578
|
-
}).setValidationEnabled(isValidationEnabled);
|
|
1579
|
-
var selectMenuUserPredicate = selectMenuBasePredicate.extend({
|
|
1580
|
-
type: import_shapeshift5.s.literal(import_v1012.ComponentType.UserSelect),
|
|
1581
|
-
default_values: import_shapeshift5.s.object({ id: import_shapeshift5.s.string(), type: import_shapeshift5.s.literal(import_v1012.SelectMenuDefaultValueType.User) }).array().lengthLessThanOrEqual(25).optional()
|
|
1582
|
-
}).setValidationEnabled(isValidationEnabled);
|
|
1583
|
-
var selectMenuStringOptionPredicate = import_shapeshift5.s.object({
|
|
1584
|
-
label: labelValidator,
|
|
1585
|
-
value: import_shapeshift5.s.string().lengthGreaterThanOrEqual(1).lengthLessThanOrEqual(100),
|
|
1586
|
-
description: import_shapeshift5.s.string().lengthGreaterThanOrEqual(1).lengthLessThanOrEqual(100).optional(),
|
|
1587
|
-
emoji: emojiValidator.optional(),
|
|
1588
|
-
default: import_shapeshift5.s.boolean().optional()
|
|
1589
|
-
}).setValidationEnabled(isValidationEnabled);
|
|
1590
|
-
var selectMenuStringPredicate = selectMenuBasePredicate.extend({
|
|
1591
|
-
type: import_shapeshift5.s.literal(import_v1012.ComponentType.StringSelect),
|
|
1592
|
-
options: selectMenuStringOptionPredicate.array().lengthGreaterThanOrEqual(1).lengthLessThanOrEqual(25)
|
|
1593
|
-
}).reshape((value) => {
|
|
1594
|
-
if (value.min_values !== void 0 && value.options.length < value.min_values) {
|
|
1595
|
-
return import_shapeshift5.Result.err(new RangeError(`The number of options must be greater than or equal to min_values`));
|
|
1596
|
-
}
|
|
1597
|
-
if (value.min_values !== void 0 && value.max_values !== void 0 && value.min_values > value.max_values) {
|
|
1598
|
-
return import_shapeshift5.Result.err(
|
|
1599
|
-
new RangeError(`The maximum amount of options must be greater than or equal to the minimum amount of options`)
|
|
1600
|
-
);
|
|
1601
|
-
}
|
|
1602
|
-
return import_shapeshift5.Result.ok(value);
|
|
1603
|
-
}).setValidationEnabled(isValidationEnabled);
|
|
1604
|
-
|
|
1605
|
-
// src/components/label/Assertions.ts
|
|
1606
|
-
var labelPredicate = import_shapeshift6.s.object({
|
|
2177
|
+
var import_shapeshift7 = require("@sapphire/shapeshift");
|
|
2178
|
+
var import_v1017 = require("discord-api-types/v10");
|
|
2179
|
+
var labelPredicate = import_shapeshift7.s.object({
|
|
1607
2180
|
id: idValidator.optional(),
|
|
1608
|
-
type:
|
|
1609
|
-
label:
|
|
1610
|
-
description:
|
|
1611
|
-
component:
|
|
2181
|
+
type: import_shapeshift7.s.literal(import_v1017.ComponentType.Label),
|
|
2182
|
+
label: import_shapeshift7.s.string().lengthGreaterThanOrEqual(1).lengthLessThanOrEqual(45),
|
|
2183
|
+
description: import_shapeshift7.s.string().lengthGreaterThanOrEqual(1).lengthLessThanOrEqual(100).optional(),
|
|
2184
|
+
component: import_shapeshift7.s.union([
|
|
1612
2185
|
textInputPredicate,
|
|
1613
2186
|
selectMenuUserPredicate,
|
|
1614
2187
|
selectMenuRolePredicate,
|
|
1615
2188
|
selectMenuMentionablePredicate,
|
|
1616
2189
|
selectMenuChannelPredicate,
|
|
1617
2190
|
selectMenuStringPredicate,
|
|
1618
|
-
fileUploadPredicate
|
|
2191
|
+
fileUploadPredicate,
|
|
2192
|
+
checkboxPredicate,
|
|
2193
|
+
checkboxGroupPredicate,
|
|
2194
|
+
radioGroupPredicate
|
|
1619
2195
|
])
|
|
1620
2196
|
}).setValidationEnabled(isValidationEnabled);
|
|
1621
2197
|
|
|
@@ -1650,12 +2226,12 @@ var LabelBuilder = class extends ComponentBuilder {
|
|
|
1650
2226
|
* ```
|
|
1651
2227
|
*/
|
|
1652
2228
|
constructor(data = {}) {
|
|
1653
|
-
super({ type:
|
|
2229
|
+
super({ type: import_v1018.ComponentType.Label });
|
|
1654
2230
|
const { component, ...rest } = data;
|
|
1655
2231
|
this.data = {
|
|
1656
2232
|
...rest,
|
|
1657
2233
|
component: component ? createComponentBuilder(component) : void 0,
|
|
1658
|
-
type:
|
|
2234
|
+
type: import_v1018.ComponentType.Label
|
|
1659
2235
|
};
|
|
1660
2236
|
}
|
|
1661
2237
|
/**
|
|
@@ -1746,6 +2322,33 @@ var LabelBuilder = class extends ComponentBuilder {
|
|
|
1746
2322
|
this.data.component = resolveBuilder(input, FileUploadBuilder);
|
|
1747
2323
|
return this;
|
|
1748
2324
|
}
|
|
2325
|
+
/**
|
|
2326
|
+
* Sets a checkbox component to this label.
|
|
2327
|
+
*
|
|
2328
|
+
* @param input - A function that returns a component builder or an already built builder
|
|
2329
|
+
*/
|
|
2330
|
+
setCheckboxComponent(input) {
|
|
2331
|
+
this.data.component = resolveBuilder(input, CheckboxBuilder);
|
|
2332
|
+
return this;
|
|
2333
|
+
}
|
|
2334
|
+
/**
|
|
2335
|
+
* Sets a checkbox group component to this label.
|
|
2336
|
+
*
|
|
2337
|
+
* @param input - A function that returns a component builder or an already built builder
|
|
2338
|
+
*/
|
|
2339
|
+
setCheckboxGroupComponent(input) {
|
|
2340
|
+
this.data.component = resolveBuilder(input, CheckboxGroupBuilder);
|
|
2341
|
+
return this;
|
|
2342
|
+
}
|
|
2343
|
+
/**
|
|
2344
|
+
* Sets a radio group component to this label.
|
|
2345
|
+
*
|
|
2346
|
+
* @param input - A function that returns a component builder or an already built builder
|
|
2347
|
+
*/
|
|
2348
|
+
setRadioGroupComponent(input) {
|
|
2349
|
+
this.data.component = resolveBuilder(input, RadioGroupBuilder);
|
|
2350
|
+
return this;
|
|
2351
|
+
}
|
|
1749
2352
|
/**
|
|
1750
2353
|
* {@inheritDoc ComponentBuilder.toJSON}
|
|
1751
2354
|
*/
|
|
@@ -1762,11 +2365,11 @@ var LabelBuilder = class extends ComponentBuilder {
|
|
|
1762
2365
|
};
|
|
1763
2366
|
|
|
1764
2367
|
// src/components/v2/Container.ts
|
|
1765
|
-
var
|
|
2368
|
+
var import_v1024 = require("discord-api-types/v10");
|
|
1766
2369
|
|
|
1767
2370
|
// src/components/v2/Assertions.ts
|
|
1768
|
-
var
|
|
1769
|
-
__export(
|
|
2371
|
+
var Assertions_exports8 = {};
|
|
2372
|
+
__export(Assertions_exports8, {
|
|
1770
2373
|
accessoryPredicate: () => accessoryPredicate,
|
|
1771
2374
|
assertReturnOfBuilder: () => assertReturnOfBuilder,
|
|
1772
2375
|
containerColorPredicate: () => containerColorPredicate,
|
|
@@ -1779,11 +2382,11 @@ __export(Assertions_exports6, {
|
|
|
1779
2382
|
unfurledMediaItemPredicate: () => unfurledMediaItemPredicate,
|
|
1780
2383
|
validateComponentArray: () => validateComponentArray
|
|
1781
2384
|
});
|
|
1782
|
-
var
|
|
1783
|
-
var
|
|
2385
|
+
var import_shapeshift8 = require("@sapphire/shapeshift");
|
|
2386
|
+
var import_v1020 = require("discord-api-types/v10");
|
|
1784
2387
|
|
|
1785
2388
|
// src/components/v2/Thumbnail.ts
|
|
1786
|
-
var
|
|
2389
|
+
var import_v1019 = require("discord-api-types/v10");
|
|
1787
2390
|
var ThumbnailBuilder = class extends ComponentBuilder {
|
|
1788
2391
|
static {
|
|
1789
2392
|
__name(this, "ThumbnailBuilder");
|
|
@@ -1815,7 +2418,7 @@ var ThumbnailBuilder = class extends ComponentBuilder {
|
|
|
1815
2418
|
*/
|
|
1816
2419
|
constructor(data = {}) {
|
|
1817
2420
|
super({
|
|
1818
|
-
type:
|
|
2421
|
+
type: import_v1019.ComponentType.Thumbnail,
|
|
1819
2422
|
...data,
|
|
1820
2423
|
media: data.media ? { url: data.media.url } : void 0
|
|
1821
2424
|
});
|
|
@@ -1864,33 +2467,33 @@ var ThumbnailBuilder = class extends ComponentBuilder {
|
|
|
1864
2467
|
};
|
|
1865
2468
|
|
|
1866
2469
|
// src/components/v2/Assertions.ts
|
|
1867
|
-
var unfurledMediaItemPredicate =
|
|
1868
|
-
url:
|
|
2470
|
+
var unfurledMediaItemPredicate = import_shapeshift8.s.object({
|
|
2471
|
+
url: import_shapeshift8.s.string().url(
|
|
1869
2472
|
{ allowedProtocols: ["http:", "https:", "attachment:"] },
|
|
1870
2473
|
{ message: "Invalid protocol for media URL. Must be http:, https:, or attachment:" }
|
|
1871
2474
|
)
|
|
1872
2475
|
}).setValidationEnabled(isValidationEnabled);
|
|
1873
|
-
var descriptionPredicate2 =
|
|
1874
|
-
var filePredicate =
|
|
1875
|
-
url:
|
|
2476
|
+
var descriptionPredicate2 = import_shapeshift8.s.string().lengthGreaterThanOrEqual(1).lengthLessThanOrEqual(1024).setValidationEnabled(isValidationEnabled);
|
|
2477
|
+
var filePredicate = import_shapeshift8.s.object({
|
|
2478
|
+
url: import_shapeshift8.s.string().url({ allowedProtocols: ["attachment:"] }, { message: "Invalid protocol for file URL. Must be attachment:" })
|
|
1876
2479
|
}).setValidationEnabled(isValidationEnabled);
|
|
1877
|
-
var spoilerPredicate =
|
|
1878
|
-
var dividerPredicate =
|
|
1879
|
-
var spacingPredicate =
|
|
1880
|
-
var textDisplayContentPredicate =
|
|
1881
|
-
var accessoryPredicate =
|
|
2480
|
+
var spoilerPredicate = import_shapeshift8.s.boolean();
|
|
2481
|
+
var dividerPredicate = import_shapeshift8.s.boolean();
|
|
2482
|
+
var spacingPredicate = import_shapeshift8.s.nativeEnum(import_v1020.SeparatorSpacingSize);
|
|
2483
|
+
var textDisplayContentPredicate = import_shapeshift8.s.string().lengthGreaterThanOrEqual(1).lengthLessThanOrEqual(4e3).setValidationEnabled(isValidationEnabled);
|
|
2484
|
+
var accessoryPredicate = import_shapeshift8.s.instance(ButtonBuilder).or(import_shapeshift8.s.instance(ThumbnailBuilder)).setValidationEnabled(isValidationEnabled);
|
|
1882
2485
|
var containerColorPredicate = colorPredicate.nullish();
|
|
1883
2486
|
function assertReturnOfBuilder(input, ExpectedInstanceOf) {
|
|
1884
|
-
|
|
2487
|
+
import_shapeshift8.s.instance(ExpectedInstanceOf).setValidationEnabled(isValidationEnabled).parse(input);
|
|
1885
2488
|
}
|
|
1886
2489
|
__name(assertReturnOfBuilder, "assertReturnOfBuilder");
|
|
1887
2490
|
function validateComponentArray(input, min, max, ExpectedInstanceOf) {
|
|
1888
|
-
(ExpectedInstanceOf ?
|
|
2491
|
+
(ExpectedInstanceOf ? import_shapeshift8.s.instance(ExpectedInstanceOf) : import_shapeshift8.s.instance(ComponentBuilder)).array().lengthGreaterThanOrEqual(min).lengthLessThanOrEqual(max).setValidationEnabled(isValidationEnabled).parse(input);
|
|
1889
2492
|
}
|
|
1890
2493
|
__name(validateComponentArray, "validateComponentArray");
|
|
1891
2494
|
|
|
1892
2495
|
// src/components/v2/File.ts
|
|
1893
|
-
var
|
|
2496
|
+
var import_v1021 = require("discord-api-types/v10");
|
|
1894
2497
|
var FileBuilder = class extends ComponentBuilder {
|
|
1895
2498
|
static {
|
|
1896
2499
|
__name(this, "FileBuilder");
|
|
@@ -1921,7 +2524,7 @@ var FileBuilder = class extends ComponentBuilder {
|
|
|
1921
2524
|
* ```
|
|
1922
2525
|
*/
|
|
1923
2526
|
constructor(data = {}) {
|
|
1924
|
-
super({ type:
|
|
2527
|
+
super({ type: import_v1021.ComponentType.File, ...data, file: data.file ? { url: data.file.url } : void 0 });
|
|
1925
2528
|
}
|
|
1926
2529
|
/**
|
|
1927
2530
|
* Sets the spoiler status of this file.
|
|
@@ -1951,7 +2554,7 @@ var FileBuilder = class extends ComponentBuilder {
|
|
|
1951
2554
|
};
|
|
1952
2555
|
|
|
1953
2556
|
// src/components/v2/Separator.ts
|
|
1954
|
-
var
|
|
2557
|
+
var import_v1022 = require("discord-api-types/v10");
|
|
1955
2558
|
var SeparatorBuilder = class extends ComponentBuilder {
|
|
1956
2559
|
static {
|
|
1957
2560
|
__name(this, "SeparatorBuilder");
|
|
@@ -1979,7 +2582,7 @@ var SeparatorBuilder = class extends ComponentBuilder {
|
|
|
1979
2582
|
*/
|
|
1980
2583
|
constructor(data = {}) {
|
|
1981
2584
|
super({
|
|
1982
|
-
type:
|
|
2585
|
+
type: import_v1022.ComponentType.Separator,
|
|
1983
2586
|
...data
|
|
1984
2587
|
});
|
|
1985
2588
|
}
|
|
@@ -2017,7 +2620,7 @@ var SeparatorBuilder = class extends ComponentBuilder {
|
|
|
2017
2620
|
};
|
|
2018
2621
|
|
|
2019
2622
|
// src/components/v2/TextDisplay.ts
|
|
2020
|
-
var
|
|
2623
|
+
var import_v1023 = require("discord-api-types/v10");
|
|
2021
2624
|
var TextDisplayBuilder = class extends ComponentBuilder {
|
|
2022
2625
|
static {
|
|
2023
2626
|
__name(this, "TextDisplayBuilder");
|
|
@@ -2044,7 +2647,7 @@ var TextDisplayBuilder = class extends ComponentBuilder {
|
|
|
2044
2647
|
*/
|
|
2045
2648
|
constructor(data = {}) {
|
|
2046
2649
|
super({
|
|
2047
|
-
type:
|
|
2650
|
+
type: import_v1023.ComponentType.TextDisplay,
|
|
2048
2651
|
...data
|
|
2049
2652
|
});
|
|
2050
2653
|
}
|
|
@@ -2102,11 +2705,12 @@ var ContainerBuilder = class extends ComponentBuilder {
|
|
|
2102
2705
|
* },
|
|
2103
2706
|
* ],
|
|
2104
2707
|
* })
|
|
2105
|
-
*
|
|
2708
|
+
* .addSeparatorComponents(separator)
|
|
2709
|
+
* .addSectionComponents(section);
|
|
2106
2710
|
* ```
|
|
2107
2711
|
*/
|
|
2108
2712
|
constructor({ components, ...data } = {}) {
|
|
2109
|
-
super({ type:
|
|
2713
|
+
super({ type: import_v1024.ComponentType.Container, ...data });
|
|
2110
2714
|
this.components = components?.map((component) => createComponentBuilder(component)) ?? [];
|
|
2111
2715
|
}
|
|
2112
2716
|
/**
|
|
@@ -2229,7 +2833,7 @@ var ContainerBuilder = class extends ComponentBuilder {
|
|
|
2229
2833
|
};
|
|
2230
2834
|
|
|
2231
2835
|
// src/components/v2/MediaGallery.ts
|
|
2232
|
-
var
|
|
2836
|
+
var import_v1025 = require("discord-api-types/v10");
|
|
2233
2837
|
|
|
2234
2838
|
// src/components/v2/MediaGalleryItem.ts
|
|
2235
2839
|
var MediaGalleryItemBuilder = class {
|
|
@@ -2359,7 +2963,7 @@ var MediaGalleryBuilder = class extends ComponentBuilder {
|
|
|
2359
2963
|
* ```
|
|
2360
2964
|
*/
|
|
2361
2965
|
constructor({ items, ...data } = {}) {
|
|
2362
|
-
super({ type:
|
|
2966
|
+
super({ type: import_v1025.ComponentType.MediaGallery, ...data });
|
|
2363
2967
|
this.items = items?.map((item) => new MediaGalleryItemBuilder(item)) ?? [];
|
|
2364
2968
|
}
|
|
2365
2969
|
/**
|
|
@@ -2409,7 +3013,7 @@ var MediaGalleryBuilder = class extends ComponentBuilder {
|
|
|
2409
3013
|
};
|
|
2410
3014
|
|
|
2411
3015
|
// src/components/v2/Section.ts
|
|
2412
|
-
var
|
|
3016
|
+
var import_v1026 = require("discord-api-types/v10");
|
|
2413
3017
|
var SectionBuilder = class extends ComponentBuilder {
|
|
2414
3018
|
static {
|
|
2415
3019
|
__name(this, "SectionBuilder");
|
|
@@ -2458,7 +3062,7 @@ var SectionBuilder = class extends ComponentBuilder {
|
|
|
2458
3062
|
* ```
|
|
2459
3063
|
*/
|
|
2460
3064
|
constructor({ components, accessory, ...data } = {}) {
|
|
2461
|
-
super({ type:
|
|
3065
|
+
super({ type: import_v1026.ComponentType.Section, ...data });
|
|
2462
3066
|
this.components = components?.map((component) => createComponentBuilder(component)) ?? [];
|
|
2463
3067
|
this.accessory = accessory ? createComponentBuilder(accessory) : void 0;
|
|
2464
3068
|
}
|
|
@@ -2533,40 +3137,46 @@ function createComponentBuilder(data) {
|
|
|
2533
3137
|
return data;
|
|
2534
3138
|
}
|
|
2535
3139
|
switch (data.type) {
|
|
2536
|
-
case
|
|
3140
|
+
case import_v1027.ComponentType.ActionRow:
|
|
2537
3141
|
return new ActionRowBuilder(data);
|
|
2538
|
-
case
|
|
3142
|
+
case import_v1027.ComponentType.Button:
|
|
2539
3143
|
return new ButtonBuilder(data);
|
|
2540
|
-
case
|
|
3144
|
+
case import_v1027.ComponentType.StringSelect:
|
|
2541
3145
|
return new StringSelectMenuBuilder(data);
|
|
2542
|
-
case
|
|
3146
|
+
case import_v1027.ComponentType.TextInput:
|
|
2543
3147
|
return new TextInputBuilder(data);
|
|
2544
|
-
case
|
|
3148
|
+
case import_v1027.ComponentType.UserSelect:
|
|
2545
3149
|
return new UserSelectMenuBuilder(data);
|
|
2546
|
-
case
|
|
3150
|
+
case import_v1027.ComponentType.RoleSelect:
|
|
2547
3151
|
return new RoleSelectMenuBuilder(data);
|
|
2548
|
-
case
|
|
3152
|
+
case import_v1027.ComponentType.MentionableSelect:
|
|
2549
3153
|
return new MentionableSelectMenuBuilder(data);
|
|
2550
|
-
case
|
|
3154
|
+
case import_v1027.ComponentType.ChannelSelect:
|
|
2551
3155
|
return new ChannelSelectMenuBuilder(data);
|
|
2552
|
-
case
|
|
3156
|
+
case import_v1027.ComponentType.File:
|
|
2553
3157
|
return new FileBuilder(data);
|
|
2554
|
-
case
|
|
3158
|
+
case import_v1027.ComponentType.Container:
|
|
2555
3159
|
return new ContainerBuilder(data);
|
|
2556
|
-
case
|
|
3160
|
+
case import_v1027.ComponentType.Section:
|
|
2557
3161
|
return new SectionBuilder(data);
|
|
2558
|
-
case
|
|
3162
|
+
case import_v1027.ComponentType.Separator:
|
|
2559
3163
|
return new SeparatorBuilder(data);
|
|
2560
|
-
case
|
|
3164
|
+
case import_v1027.ComponentType.TextDisplay:
|
|
2561
3165
|
return new TextDisplayBuilder(data);
|
|
2562
|
-
case
|
|
3166
|
+
case import_v1027.ComponentType.Thumbnail:
|
|
2563
3167
|
return new ThumbnailBuilder(data);
|
|
2564
|
-
case
|
|
3168
|
+
case import_v1027.ComponentType.MediaGallery:
|
|
2565
3169
|
return new MediaGalleryBuilder(data);
|
|
2566
|
-
case
|
|
3170
|
+
case import_v1027.ComponentType.Label:
|
|
2567
3171
|
return new LabelBuilder(data);
|
|
2568
|
-
case
|
|
3172
|
+
case import_v1027.ComponentType.FileUpload:
|
|
2569
3173
|
return new FileUploadBuilder(data);
|
|
3174
|
+
case import_v1027.ComponentType.Checkbox:
|
|
3175
|
+
return new CheckboxBuilder(data);
|
|
3176
|
+
case import_v1027.ComponentType.CheckboxGroup:
|
|
3177
|
+
return new CheckboxGroupBuilder(data);
|
|
3178
|
+
case import_v1027.ComponentType.RadioGroup:
|
|
3179
|
+
return new RadioGroupBuilder(data);
|
|
2570
3180
|
default:
|
|
2571
3181
|
throw new Error(`Cannot properly serialize component type: ${data.type}`);
|
|
2572
3182
|
}
|
|
@@ -2631,7 +3241,7 @@ var ActionRowBuilder = class extends ComponentBuilder {
|
|
|
2631
3241
|
* ```
|
|
2632
3242
|
*/
|
|
2633
3243
|
constructor({ components, ...data } = {}) {
|
|
2634
|
-
super({ type:
|
|
3244
|
+
super({ type: import_v1028.ComponentType.ActionRow, ...data });
|
|
2635
3245
|
this.components = components?.map((component) => createComponentBuilder(component)) ?? [];
|
|
2636
3246
|
}
|
|
2637
3247
|
/**
|
|
@@ -2664,18 +3274,18 @@ var ActionRowBuilder = class extends ComponentBuilder {
|
|
|
2664
3274
|
};
|
|
2665
3275
|
|
|
2666
3276
|
// src/interactions/modals/Modal.ts
|
|
2667
|
-
var
|
|
3277
|
+
var import_v1029 = require("discord-api-types/v10");
|
|
2668
3278
|
|
|
2669
3279
|
// src/interactions/modals/Assertions.ts
|
|
2670
|
-
var
|
|
2671
|
-
__export(
|
|
3280
|
+
var Assertions_exports9 = {};
|
|
3281
|
+
__export(Assertions_exports9, {
|
|
2672
3282
|
componentsValidator: () => componentsValidator,
|
|
2673
3283
|
titleValidator: () => titleValidator,
|
|
2674
3284
|
validateRequiredParameters: () => validateRequiredParameters2
|
|
2675
3285
|
});
|
|
2676
|
-
var
|
|
2677
|
-
var titleValidator =
|
|
2678
|
-
var componentsValidator =
|
|
3286
|
+
var import_shapeshift9 = require("@sapphire/shapeshift");
|
|
3287
|
+
var titleValidator = import_shapeshift9.s.string().lengthGreaterThanOrEqual(1).lengthLessThanOrEqual(45).setValidationEnabled(isValidationEnabled);
|
|
3288
|
+
var componentsValidator = import_shapeshift9.s.union([import_shapeshift9.s.instance(ActionRowBuilder), import_shapeshift9.s.instance(LabelBuilder), import_shapeshift9.s.instance(TextDisplayBuilder)]).array().lengthGreaterThanOrEqual(1).setValidationEnabled(isValidationEnabled);
|
|
2679
3289
|
function validateRequiredParameters2(customId, title, components) {
|
|
2680
3290
|
customIdValidator.parse(customId);
|
|
2681
3291
|
titleValidator.parse(title);
|
|
@@ -2739,16 +3349,16 @@ var ModalBuilder = class {
|
|
|
2739
3349
|
return new ActionRowBuilder().addComponents(component);
|
|
2740
3350
|
}
|
|
2741
3351
|
if ("type" in component) {
|
|
2742
|
-
if (component.type ===
|
|
3352
|
+
if (component.type === import_v1029.ComponentType.ActionRow) {
|
|
2743
3353
|
return new ActionRowBuilder(component);
|
|
2744
3354
|
}
|
|
2745
|
-
if (component.type ===
|
|
3355
|
+
if (component.type === import_v1029.ComponentType.Label) {
|
|
2746
3356
|
return new LabelBuilder(component);
|
|
2747
3357
|
}
|
|
2748
|
-
if (component.type ===
|
|
3358
|
+
if (component.type === import_v1029.ComponentType.TextDisplay) {
|
|
2749
3359
|
return new TextDisplayBuilder(component);
|
|
2750
3360
|
}
|
|
2751
|
-
if (component.type ===
|
|
3361
|
+
if (component.type === import_v1029.ComponentType.TextInput) {
|
|
2752
3362
|
return new ActionRowBuilder().addComponents(
|
|
2753
3363
|
new TextInputBuilder(component)
|
|
2754
3364
|
);
|
|
@@ -2860,8 +3470,8 @@ var ModalBuilder = class {
|
|
|
2860
3470
|
};
|
|
2861
3471
|
|
|
2862
3472
|
// src/interactions/slashCommands/Assertions.ts
|
|
2863
|
-
var
|
|
2864
|
-
__export(
|
|
3473
|
+
var Assertions_exports10 = {};
|
|
3474
|
+
__export(Assertions_exports10, {
|
|
2865
3475
|
assertReturnOfBuilder: () => assertReturnOfBuilder2,
|
|
2866
3476
|
contextsPredicate: () => contextsPredicate,
|
|
2867
3477
|
integrationTypesPredicate: () => integrationTypesPredicate,
|
|
@@ -2879,20 +3489,20 @@ __export(Assertions_exports8, {
|
|
|
2879
3489
|
validateRequired: () => validateRequired,
|
|
2880
3490
|
validateRequiredParameters: () => validateRequiredParameters3
|
|
2881
3491
|
});
|
|
2882
|
-
var
|
|
2883
|
-
var
|
|
2884
|
-
var namePredicate =
|
|
3492
|
+
var import_shapeshift10 = require("@sapphire/shapeshift");
|
|
3493
|
+
var import_v1030 = require("discord-api-types/v10");
|
|
3494
|
+
var namePredicate = import_shapeshift10.s.string().lengthGreaterThanOrEqual(1).lengthLessThanOrEqual(32).regex(/^[\p{Ll}\p{Lm}\p{Lo}\p{N}\p{sc=Devanagari}\p{sc=Thai}_-]+$/u).setValidationEnabled(isValidationEnabled);
|
|
2885
3495
|
function validateName(name) {
|
|
2886
3496
|
namePredicate.parse(name);
|
|
2887
3497
|
}
|
|
2888
3498
|
__name(validateName, "validateName");
|
|
2889
|
-
var descriptionPredicate3 =
|
|
2890
|
-
var localePredicate =
|
|
3499
|
+
var descriptionPredicate3 = import_shapeshift10.s.string().lengthGreaterThanOrEqual(1).lengthLessThanOrEqual(100).setValidationEnabled(isValidationEnabled);
|
|
3500
|
+
var localePredicate = import_shapeshift10.s.nativeEnum(import_v1030.Locale);
|
|
2891
3501
|
function validateDescription(description) {
|
|
2892
3502
|
descriptionPredicate3.parse(description);
|
|
2893
3503
|
}
|
|
2894
3504
|
__name(validateDescription, "validateDescription");
|
|
2895
|
-
var maxArrayLengthPredicate =
|
|
3505
|
+
var maxArrayLengthPredicate = import_shapeshift10.s.unknown().array().lengthLessThanOrEqual(25).setValidationEnabled(isValidationEnabled);
|
|
2896
3506
|
function validateLocale(locale) {
|
|
2897
3507
|
return localePredicate.parse(locale);
|
|
2898
3508
|
}
|
|
@@ -2907,7 +3517,7 @@ function validateRequiredParameters3(name, description, options) {
|
|
|
2907
3517
|
validateMaxOptionsLength(options);
|
|
2908
3518
|
}
|
|
2909
3519
|
__name(validateRequiredParameters3, "validateRequiredParameters");
|
|
2910
|
-
var booleanPredicate =
|
|
3520
|
+
var booleanPredicate = import_shapeshift10.s.boolean();
|
|
2911
3521
|
function validateDefaultPermission(value) {
|
|
2912
3522
|
booleanPredicate.parse(value);
|
|
2913
3523
|
}
|
|
@@ -2916,29 +3526,29 @@ function validateRequired(required) {
|
|
|
2916
3526
|
booleanPredicate.parse(required);
|
|
2917
3527
|
}
|
|
2918
3528
|
__name(validateRequired, "validateRequired");
|
|
2919
|
-
var choicesLengthPredicate =
|
|
3529
|
+
var choicesLengthPredicate = import_shapeshift10.s.number().lessThanOrEqual(25).setValidationEnabled(isValidationEnabled);
|
|
2920
3530
|
function validateChoicesLength(amountAdding, choices) {
|
|
2921
3531
|
choicesLengthPredicate.parse((choices?.length ?? 0) + amountAdding);
|
|
2922
3532
|
}
|
|
2923
3533
|
__name(validateChoicesLength, "validateChoicesLength");
|
|
2924
3534
|
function assertReturnOfBuilder2(input, ExpectedInstanceOf) {
|
|
2925
|
-
|
|
3535
|
+
import_shapeshift10.s.instance(ExpectedInstanceOf).parse(input);
|
|
2926
3536
|
}
|
|
2927
3537
|
__name(assertReturnOfBuilder2, "assertReturnOfBuilder");
|
|
2928
|
-
var localizationMapPredicate =
|
|
3538
|
+
var localizationMapPredicate = import_shapeshift10.s.object(Object.fromEntries(Object.values(import_v1030.Locale).map((locale) => [locale, import_shapeshift10.s.string().nullish()]))).strict().nullish().setValidationEnabled(isValidationEnabled);
|
|
2929
3539
|
function validateLocalizationMap(value) {
|
|
2930
3540
|
localizationMapPredicate.parse(value);
|
|
2931
3541
|
}
|
|
2932
3542
|
__name(validateLocalizationMap, "validateLocalizationMap");
|
|
2933
|
-
var dmPermissionPredicate =
|
|
3543
|
+
var dmPermissionPredicate = import_shapeshift10.s.boolean().nullish();
|
|
2934
3544
|
function validateDMPermission(value) {
|
|
2935
3545
|
dmPermissionPredicate.parse(value);
|
|
2936
3546
|
}
|
|
2937
3547
|
__name(validateDMPermission, "validateDMPermission");
|
|
2938
|
-
var memberPermissionPredicate =
|
|
2939
|
-
|
|
2940
|
-
|
|
2941
|
-
|
|
3548
|
+
var memberPermissionPredicate = import_shapeshift10.s.union([
|
|
3549
|
+
import_shapeshift10.s.bigint().transform((value) => value.toString()),
|
|
3550
|
+
import_shapeshift10.s.number().safeInt().transform((value) => value.toString()),
|
|
3551
|
+
import_shapeshift10.s.string().regex(/^\d+$/)
|
|
2942
3552
|
]).nullish();
|
|
2943
3553
|
function validateDefaultMemberPermissions(permissions) {
|
|
2944
3554
|
return memberPermissionPredicate.parse(permissions);
|
|
@@ -2948,11 +3558,11 @@ function validateNSFW(value) {
|
|
|
2948
3558
|
booleanPredicate.parse(value);
|
|
2949
3559
|
}
|
|
2950
3560
|
__name(validateNSFW, "validateNSFW");
|
|
2951
|
-
var contextsPredicate =
|
|
2952
|
-
|
|
3561
|
+
var contextsPredicate = import_shapeshift10.s.array(
|
|
3562
|
+
import_shapeshift10.s.nativeEnum(import_v1030.InteractionContextType).setValidationEnabled(isValidationEnabled)
|
|
2953
3563
|
);
|
|
2954
|
-
var integrationTypesPredicate =
|
|
2955
|
-
|
|
3564
|
+
var integrationTypesPredicate = import_shapeshift10.s.array(
|
|
3565
|
+
import_shapeshift10.s.nativeEnum(import_v1030.ApplicationIntegrationType).setValidationEnabled(isValidationEnabled)
|
|
2956
3566
|
);
|
|
2957
3567
|
|
|
2958
3568
|
// src/interactions/slashCommands/SlashCommandBuilder.ts
|
|
@@ -3072,7 +3682,7 @@ var SharedNameAndDescription = class {
|
|
|
3072
3682
|
};
|
|
3073
3683
|
|
|
3074
3684
|
// src/interactions/slashCommands/mixins/SharedSlashCommand.ts
|
|
3075
|
-
var
|
|
3685
|
+
var import_v1031 = require("discord-api-types/v10");
|
|
3076
3686
|
var SharedSlashCommand = class {
|
|
3077
3687
|
static {
|
|
3078
3688
|
__name(this, "SharedSlashCommand");
|
|
@@ -3177,14 +3787,14 @@ var SharedSlashCommand = class {
|
|
|
3177
3787
|
validateLocalizationMap(this.description_localizations);
|
|
3178
3788
|
return {
|
|
3179
3789
|
...this,
|
|
3180
|
-
type:
|
|
3790
|
+
type: import_v1031.ApplicationCommandType.ChatInput,
|
|
3181
3791
|
options: this.options.map((option) => option.toJSON())
|
|
3182
3792
|
};
|
|
3183
3793
|
}
|
|
3184
3794
|
};
|
|
3185
3795
|
|
|
3186
3796
|
// src/interactions/slashCommands/options/attachment.ts
|
|
3187
|
-
var
|
|
3797
|
+
var import_v1032 = require("discord-api-types/v10");
|
|
3188
3798
|
|
|
3189
3799
|
// src/interactions/slashCommands/mixins/ApplicationCommandOptionBase.ts
|
|
3190
3800
|
var ApplicationCommandOptionBase = class extends SharedNameAndDescription {
|
|
@@ -3226,7 +3836,7 @@ var SlashCommandAttachmentOption = class extends ApplicationCommandOptionBase {
|
|
|
3226
3836
|
/**
|
|
3227
3837
|
* The type of this option.
|
|
3228
3838
|
*/
|
|
3229
|
-
type =
|
|
3839
|
+
type = import_v1032.ApplicationCommandOptionType.Attachment;
|
|
3230
3840
|
/**
|
|
3231
3841
|
* {@inheritDoc ApplicationCommandOptionBase.toJSON}
|
|
3232
3842
|
*/
|
|
@@ -3237,7 +3847,7 @@ var SlashCommandAttachmentOption = class extends ApplicationCommandOptionBase {
|
|
|
3237
3847
|
};
|
|
3238
3848
|
|
|
3239
3849
|
// src/interactions/slashCommands/options/boolean.ts
|
|
3240
|
-
var
|
|
3850
|
+
var import_v1033 = require("discord-api-types/v10");
|
|
3241
3851
|
var SlashCommandBooleanOption = class extends ApplicationCommandOptionBase {
|
|
3242
3852
|
static {
|
|
3243
3853
|
__name(this, "SlashCommandBooleanOption");
|
|
@@ -3245,7 +3855,7 @@ var SlashCommandBooleanOption = class extends ApplicationCommandOptionBase {
|
|
|
3245
3855
|
/**
|
|
3246
3856
|
* The type of this option.
|
|
3247
3857
|
*/
|
|
3248
|
-
type =
|
|
3858
|
+
type = import_v1033.ApplicationCommandOptionType.Boolean;
|
|
3249
3859
|
/**
|
|
3250
3860
|
* {@inheritDoc ApplicationCommandOptionBase.toJSON}
|
|
3251
3861
|
*/
|
|
@@ -3256,25 +3866,25 @@ var SlashCommandBooleanOption = class extends ApplicationCommandOptionBase {
|
|
|
3256
3866
|
};
|
|
3257
3867
|
|
|
3258
3868
|
// src/interactions/slashCommands/options/channel.ts
|
|
3259
|
-
var
|
|
3869
|
+
var import_v1035 = require("discord-api-types/v10");
|
|
3260
3870
|
var import_ts_mixer = require("ts-mixer");
|
|
3261
3871
|
|
|
3262
3872
|
// src/interactions/slashCommands/mixins/ApplicationCommandOptionChannelTypesMixin.ts
|
|
3263
|
-
var
|
|
3264
|
-
var
|
|
3873
|
+
var import_shapeshift11 = require("@sapphire/shapeshift");
|
|
3874
|
+
var import_v1034 = require("discord-api-types/v10");
|
|
3265
3875
|
var allowedChannelTypes = [
|
|
3266
|
-
|
|
3267
|
-
|
|
3268
|
-
|
|
3269
|
-
|
|
3270
|
-
|
|
3271
|
-
|
|
3272
|
-
|
|
3273
|
-
|
|
3274
|
-
|
|
3275
|
-
|
|
3876
|
+
import_v1034.ChannelType.GuildText,
|
|
3877
|
+
import_v1034.ChannelType.GuildVoice,
|
|
3878
|
+
import_v1034.ChannelType.GuildCategory,
|
|
3879
|
+
import_v1034.ChannelType.GuildAnnouncement,
|
|
3880
|
+
import_v1034.ChannelType.AnnouncementThread,
|
|
3881
|
+
import_v1034.ChannelType.PublicThread,
|
|
3882
|
+
import_v1034.ChannelType.PrivateThread,
|
|
3883
|
+
import_v1034.ChannelType.GuildStageVoice,
|
|
3884
|
+
import_v1034.ChannelType.GuildForum,
|
|
3885
|
+
import_v1034.ChannelType.GuildMedia
|
|
3276
3886
|
];
|
|
3277
|
-
var channelTypesPredicate =
|
|
3887
|
+
var channelTypesPredicate = import_shapeshift11.s.array(import_shapeshift11.s.union(allowedChannelTypes.map((type) => import_shapeshift11.s.literal(type))));
|
|
3278
3888
|
var ApplicationCommandOptionChannelTypesMixin = class {
|
|
3279
3889
|
static {
|
|
3280
3890
|
__name(this, "ApplicationCommandOptionChannelTypesMixin");
|
|
@@ -3302,7 +3912,7 @@ var SlashCommandChannelOption = class extends ApplicationCommandOptionBase {
|
|
|
3302
3912
|
/**
|
|
3303
3913
|
* The type of this option.
|
|
3304
3914
|
*/
|
|
3305
|
-
type =
|
|
3915
|
+
type = import_v1035.ApplicationCommandOptionType.Channel;
|
|
3306
3916
|
/**
|
|
3307
3917
|
* {@inheritDoc ApplicationCommandOptionBase.toJSON}
|
|
3308
3918
|
*/
|
|
@@ -3317,8 +3927,8 @@ SlashCommandChannelOption = __decorateClass([
|
|
|
3317
3927
|
], SlashCommandChannelOption);
|
|
3318
3928
|
|
|
3319
3929
|
// src/interactions/slashCommands/options/integer.ts
|
|
3320
|
-
var
|
|
3321
|
-
var
|
|
3930
|
+
var import_shapeshift14 = require("@sapphire/shapeshift");
|
|
3931
|
+
var import_v1037 = require("discord-api-types/v10");
|
|
3322
3932
|
var import_ts_mixer2 = require("ts-mixer");
|
|
3323
3933
|
|
|
3324
3934
|
// src/interactions/slashCommands/mixins/ApplicationCommandNumericOptionMinMaxValueMixin.ts
|
|
@@ -3337,8 +3947,8 @@ var ApplicationCommandNumericOptionMinMaxValueMixin = class {
|
|
|
3337
3947
|
};
|
|
3338
3948
|
|
|
3339
3949
|
// src/interactions/slashCommands/mixins/ApplicationCommandOptionWithAutocompleteMixin.ts
|
|
3340
|
-
var
|
|
3341
|
-
var booleanPredicate2 =
|
|
3950
|
+
var import_shapeshift12 = require("@sapphire/shapeshift");
|
|
3951
|
+
var booleanPredicate2 = import_shapeshift12.s.boolean();
|
|
3342
3952
|
var ApplicationCommandOptionWithAutocompleteMixin = class {
|
|
3343
3953
|
static {
|
|
3344
3954
|
__name(this, "ApplicationCommandOptionWithAutocompleteMixin");
|
|
@@ -3369,14 +3979,14 @@ var ApplicationCommandOptionWithAutocompleteMixin = class {
|
|
|
3369
3979
|
};
|
|
3370
3980
|
|
|
3371
3981
|
// src/interactions/slashCommands/mixins/ApplicationCommandOptionWithChoicesMixin.ts
|
|
3372
|
-
var
|
|
3373
|
-
var
|
|
3374
|
-
var stringPredicate =
|
|
3375
|
-
var numberPredicate =
|
|
3376
|
-
var choicesPredicate =
|
|
3982
|
+
var import_shapeshift13 = require("@sapphire/shapeshift");
|
|
3983
|
+
var import_v1036 = require("discord-api-types/v10");
|
|
3984
|
+
var stringPredicate = import_shapeshift13.s.string().lengthGreaterThanOrEqual(1).lengthLessThanOrEqual(100);
|
|
3985
|
+
var numberPredicate = import_shapeshift13.s.number().greaterThan(Number.NEGATIVE_INFINITY).lessThan(Number.POSITIVE_INFINITY);
|
|
3986
|
+
var choicesPredicate = import_shapeshift13.s.object({
|
|
3377
3987
|
name: stringPredicate,
|
|
3378
3988
|
name_localizations: localizationMapPredicate,
|
|
3379
|
-
value:
|
|
3989
|
+
value: import_shapeshift13.s.union([stringPredicate, numberPredicate])
|
|
3380
3990
|
}).array();
|
|
3381
3991
|
var ApplicationCommandOptionWithChoicesMixin = class {
|
|
3382
3992
|
static {
|
|
@@ -3408,7 +4018,7 @@ var ApplicationCommandOptionWithChoicesMixin = class {
|
|
|
3408
4018
|
}
|
|
3409
4019
|
validateChoicesLength(normalizedChoices.length, this.choices);
|
|
3410
4020
|
for (const { name, name_localizations, value } of normalizedChoices) {
|
|
3411
|
-
if (this.type ===
|
|
4021
|
+
if (this.type === import_v1036.ApplicationCommandOptionType.String) {
|
|
3412
4022
|
stringPredicate.parse(value);
|
|
3413
4023
|
} else {
|
|
3414
4024
|
numberPredicate.parse(value);
|
|
@@ -3435,12 +4045,12 @@ var ApplicationCommandOptionWithChoicesMixin = class {
|
|
|
3435
4045
|
};
|
|
3436
4046
|
|
|
3437
4047
|
// src/interactions/slashCommands/options/integer.ts
|
|
3438
|
-
var numberValidator =
|
|
4048
|
+
var numberValidator = import_shapeshift14.s.number().int();
|
|
3439
4049
|
var SlashCommandIntegerOption = class extends ApplicationCommandOptionBase {
|
|
3440
4050
|
/**
|
|
3441
4051
|
* The type of this option.
|
|
3442
4052
|
*/
|
|
3443
|
-
type =
|
|
4053
|
+
type = import_v1037.ApplicationCommandOptionType.Integer;
|
|
3444
4054
|
/**
|
|
3445
4055
|
* {@inheritDoc ApplicationCommandNumericOptionMinMaxValueMixin.setMaxValue}
|
|
3446
4056
|
*/
|
|
@@ -3478,7 +4088,7 @@ SlashCommandIntegerOption = __decorateClass([
|
|
|
3478
4088
|
], SlashCommandIntegerOption);
|
|
3479
4089
|
|
|
3480
4090
|
// src/interactions/slashCommands/options/mentionable.ts
|
|
3481
|
-
var
|
|
4091
|
+
var import_v1038 = require("discord-api-types/v10");
|
|
3482
4092
|
var SlashCommandMentionableOption = class extends ApplicationCommandOptionBase {
|
|
3483
4093
|
static {
|
|
3484
4094
|
__name(this, "SlashCommandMentionableOption");
|
|
@@ -3486,7 +4096,7 @@ var SlashCommandMentionableOption = class extends ApplicationCommandOptionBase {
|
|
|
3486
4096
|
/**
|
|
3487
4097
|
* The type of this option.
|
|
3488
4098
|
*/
|
|
3489
|
-
type =
|
|
4099
|
+
type = import_v1038.ApplicationCommandOptionType.Mentionable;
|
|
3490
4100
|
/**
|
|
3491
4101
|
* {@inheritDoc ApplicationCommandOptionBase.toJSON}
|
|
3492
4102
|
*/
|
|
@@ -3497,15 +4107,15 @@ var SlashCommandMentionableOption = class extends ApplicationCommandOptionBase {
|
|
|
3497
4107
|
};
|
|
3498
4108
|
|
|
3499
4109
|
// src/interactions/slashCommands/options/number.ts
|
|
3500
|
-
var
|
|
3501
|
-
var
|
|
4110
|
+
var import_shapeshift15 = require("@sapphire/shapeshift");
|
|
4111
|
+
var import_v1039 = require("discord-api-types/v10");
|
|
3502
4112
|
var import_ts_mixer3 = require("ts-mixer");
|
|
3503
|
-
var numberValidator2 =
|
|
4113
|
+
var numberValidator2 = import_shapeshift15.s.number();
|
|
3504
4114
|
var SlashCommandNumberOption = class extends ApplicationCommandOptionBase {
|
|
3505
4115
|
/**
|
|
3506
4116
|
* The type of this option.
|
|
3507
4117
|
*/
|
|
3508
|
-
type =
|
|
4118
|
+
type = import_v1039.ApplicationCommandOptionType.Number;
|
|
3509
4119
|
/**
|
|
3510
4120
|
* {@inheritDoc ApplicationCommandNumericOptionMinMaxValueMixin.setMaxValue}
|
|
3511
4121
|
*/
|
|
@@ -3543,7 +4153,7 @@ SlashCommandNumberOption = __decorateClass([
|
|
|
3543
4153
|
], SlashCommandNumberOption);
|
|
3544
4154
|
|
|
3545
4155
|
// src/interactions/slashCommands/options/role.ts
|
|
3546
|
-
var
|
|
4156
|
+
var import_v1040 = require("discord-api-types/v10");
|
|
3547
4157
|
var SlashCommandRoleOption = class extends ApplicationCommandOptionBase {
|
|
3548
4158
|
static {
|
|
3549
4159
|
__name(this, "SlashCommandRoleOption");
|
|
@@ -3551,7 +4161,7 @@ var SlashCommandRoleOption = class extends ApplicationCommandOptionBase {
|
|
|
3551
4161
|
/**
|
|
3552
4162
|
* The type of this option.
|
|
3553
4163
|
*/
|
|
3554
|
-
type =
|
|
4164
|
+
type = import_v1040.ApplicationCommandOptionType.Role;
|
|
3555
4165
|
/**
|
|
3556
4166
|
* {@inheritDoc ApplicationCommandOptionBase.toJSON}
|
|
3557
4167
|
*/
|
|
@@ -3562,16 +4172,16 @@ var SlashCommandRoleOption = class extends ApplicationCommandOptionBase {
|
|
|
3562
4172
|
};
|
|
3563
4173
|
|
|
3564
4174
|
// src/interactions/slashCommands/options/string.ts
|
|
3565
|
-
var
|
|
3566
|
-
var
|
|
4175
|
+
var import_shapeshift16 = require("@sapphire/shapeshift");
|
|
4176
|
+
var import_v1041 = require("discord-api-types/v10");
|
|
3567
4177
|
var import_ts_mixer4 = require("ts-mixer");
|
|
3568
|
-
var minLengthValidator2 =
|
|
3569
|
-
var maxLengthValidator2 =
|
|
4178
|
+
var minLengthValidator2 = import_shapeshift16.s.number().greaterThanOrEqual(0).lessThanOrEqual(6e3);
|
|
4179
|
+
var maxLengthValidator2 = import_shapeshift16.s.number().greaterThanOrEqual(1).lessThanOrEqual(6e3);
|
|
3570
4180
|
var SlashCommandStringOption = class extends ApplicationCommandOptionBase {
|
|
3571
4181
|
/**
|
|
3572
4182
|
* The type of this option.
|
|
3573
4183
|
*/
|
|
3574
|
-
type =
|
|
4184
|
+
type = import_v1041.ApplicationCommandOptionType.String;
|
|
3575
4185
|
/**
|
|
3576
4186
|
* The maximum length of this option.
|
|
3577
4187
|
*/
|
|
@@ -3617,7 +4227,7 @@ SlashCommandStringOption = __decorateClass([
|
|
|
3617
4227
|
], SlashCommandStringOption);
|
|
3618
4228
|
|
|
3619
4229
|
// src/interactions/slashCommands/options/user.ts
|
|
3620
|
-
var
|
|
4230
|
+
var import_v1042 = require("discord-api-types/v10");
|
|
3621
4231
|
var SlashCommandUserOption = class extends ApplicationCommandOptionBase {
|
|
3622
4232
|
static {
|
|
3623
4233
|
__name(this, "SlashCommandUserOption");
|
|
@@ -3625,7 +4235,7 @@ var SlashCommandUserOption = class extends ApplicationCommandOptionBase {
|
|
|
3625
4235
|
/**
|
|
3626
4236
|
* The type of this option.
|
|
3627
4237
|
*/
|
|
3628
|
-
type =
|
|
4238
|
+
type = import_v1042.ApplicationCommandOptionType.User;
|
|
3629
4239
|
/**
|
|
3630
4240
|
* {@inheritDoc ApplicationCommandOptionBase.toJSON}
|
|
3631
4241
|
*/
|
|
@@ -3731,7 +4341,7 @@ var SharedSlashCommandOptions = class {
|
|
|
3731
4341
|
};
|
|
3732
4342
|
|
|
3733
4343
|
// src/interactions/slashCommands/SlashCommandSubcommands.ts
|
|
3734
|
-
var
|
|
4344
|
+
var import_v1043 = require("discord-api-types/v10");
|
|
3735
4345
|
var import_ts_mixer5 = require("ts-mixer");
|
|
3736
4346
|
var SlashCommandSubcommandGroupBuilder = class {
|
|
3737
4347
|
/**
|
|
@@ -3769,7 +4379,7 @@ var SlashCommandSubcommandGroupBuilder = class {
|
|
|
3769
4379
|
toJSON() {
|
|
3770
4380
|
validateRequiredParameters3(this.name, this.description, this.options);
|
|
3771
4381
|
return {
|
|
3772
|
-
type:
|
|
4382
|
+
type: import_v1043.ApplicationCommandOptionType.SubcommandGroup,
|
|
3773
4383
|
name: this.name,
|
|
3774
4384
|
name_localizations: this.name_localizations,
|
|
3775
4385
|
description: this.description,
|
|
@@ -3805,7 +4415,7 @@ var SlashCommandSubcommandBuilder = class {
|
|
|
3805
4415
|
toJSON() {
|
|
3806
4416
|
validateRequiredParameters3(this.name, this.description, this.options);
|
|
3807
4417
|
return {
|
|
3808
|
-
type:
|
|
4418
|
+
type: import_v1043.ApplicationCommandOptionType.Subcommand,
|
|
3809
4419
|
name: this.name,
|
|
3810
4420
|
name_localizations: this.name_localizations,
|
|
3811
4421
|
description: this.description,
|
|
@@ -3913,8 +4523,8 @@ SlashCommandBuilder = __decorateClass([
|
|
|
3913
4523
|
], SlashCommandBuilder);
|
|
3914
4524
|
|
|
3915
4525
|
// src/interactions/contextMenuCommands/Assertions.ts
|
|
3916
|
-
var
|
|
3917
|
-
__export(
|
|
4526
|
+
var Assertions_exports11 = {};
|
|
4527
|
+
__export(Assertions_exports11, {
|
|
3918
4528
|
contextsPredicate: () => contextsPredicate2,
|
|
3919
4529
|
integrationTypesPredicate: () => integrationTypesPredicate2,
|
|
3920
4530
|
validateDMPermission: () => validateDMPermission2,
|
|
@@ -3924,11 +4534,11 @@ __export(Assertions_exports9, {
|
|
|
3924
4534
|
validateRequiredParameters: () => validateRequiredParameters4,
|
|
3925
4535
|
validateType: () => validateType
|
|
3926
4536
|
});
|
|
3927
|
-
var
|
|
3928
|
-
var
|
|
3929
|
-
var namePredicate2 =
|
|
3930
|
-
var typePredicate =
|
|
3931
|
-
var booleanPredicate3 =
|
|
4537
|
+
var import_shapeshift17 = require("@sapphire/shapeshift");
|
|
4538
|
+
var import_v1044 = require("discord-api-types/v10");
|
|
4539
|
+
var namePredicate2 = import_shapeshift17.s.string().lengthGreaterThanOrEqual(1).lengthLessThanOrEqual(32).regex(/\S/).setValidationEnabled(isValidationEnabled);
|
|
4540
|
+
var typePredicate = import_shapeshift17.s.union([import_shapeshift17.s.literal(import_v1044.ApplicationCommandType.User), import_shapeshift17.s.literal(import_v1044.ApplicationCommandType.Message)]).setValidationEnabled(isValidationEnabled);
|
|
4541
|
+
var booleanPredicate3 = import_shapeshift17.s.boolean();
|
|
3932
4542
|
function validateDefaultPermission2(value) {
|
|
3933
4543
|
booleanPredicate3.parse(value);
|
|
3934
4544
|
}
|
|
@@ -3946,25 +4556,25 @@ function validateRequiredParameters4(name, type) {
|
|
|
3946
4556
|
validateType(type);
|
|
3947
4557
|
}
|
|
3948
4558
|
__name(validateRequiredParameters4, "validateRequiredParameters");
|
|
3949
|
-
var dmPermissionPredicate2 =
|
|
4559
|
+
var dmPermissionPredicate2 = import_shapeshift17.s.boolean().nullish();
|
|
3950
4560
|
function validateDMPermission2(value) {
|
|
3951
4561
|
dmPermissionPredicate2.parse(value);
|
|
3952
4562
|
}
|
|
3953
4563
|
__name(validateDMPermission2, "validateDMPermission");
|
|
3954
|
-
var memberPermissionPredicate2 =
|
|
3955
|
-
|
|
3956
|
-
|
|
3957
|
-
|
|
4564
|
+
var memberPermissionPredicate2 = import_shapeshift17.s.union([
|
|
4565
|
+
import_shapeshift17.s.bigint().transform((value) => value.toString()),
|
|
4566
|
+
import_shapeshift17.s.number().safeInt().transform((value) => value.toString()),
|
|
4567
|
+
import_shapeshift17.s.string().regex(/^\d+$/)
|
|
3958
4568
|
]).nullish();
|
|
3959
4569
|
function validateDefaultMemberPermissions2(permissions) {
|
|
3960
4570
|
return memberPermissionPredicate2.parse(permissions);
|
|
3961
4571
|
}
|
|
3962
4572
|
__name(validateDefaultMemberPermissions2, "validateDefaultMemberPermissions");
|
|
3963
|
-
var contextsPredicate2 =
|
|
3964
|
-
|
|
4573
|
+
var contextsPredicate2 = import_shapeshift17.s.array(
|
|
4574
|
+
import_shapeshift17.s.nativeEnum(import_v1044.InteractionContextType).setValidationEnabled(isValidationEnabled)
|
|
3965
4575
|
);
|
|
3966
|
-
var integrationTypesPredicate2 =
|
|
3967
|
-
|
|
4576
|
+
var integrationTypesPredicate2 = import_shapeshift17.s.array(
|
|
4577
|
+
import_shapeshift17.s.nativeEnum(import_v1044.ApplicationIntegrationType).setValidationEnabled(isValidationEnabled)
|
|
3968
4578
|
);
|
|
3969
4579
|
|
|
3970
4580
|
// src/interactions/contextMenuCommands/ContextMenuCommandBuilder.ts
|
|
@@ -4145,7 +4755,7 @@ function embedLength(data) {
|
|
|
4145
4755
|
__name(embedLength, "embedLength");
|
|
4146
4756
|
|
|
4147
4757
|
// src/index.ts
|
|
4148
|
-
var version = "1.
|
|
4758
|
+
var version = "1.14.0";
|
|
4149
4759
|
// Annotate the CommonJS export names for ESM import in node:
|
|
4150
4760
|
0 && (module.exports = {
|
|
4151
4761
|
ActionRowBuilder,
|
|
@@ -4157,6 +4767,10 @@ var version = "1.13.0";
|
|
|
4157
4767
|
BaseSelectMenuBuilder,
|
|
4158
4768
|
ButtonBuilder,
|
|
4159
4769
|
ChannelSelectMenuBuilder,
|
|
4770
|
+
CheckboxAssertions,
|
|
4771
|
+
CheckboxBuilder,
|
|
4772
|
+
CheckboxGroupBuilder,
|
|
4773
|
+
CheckboxGroupOptionBuilder,
|
|
4160
4774
|
ComponentAssertions,
|
|
4161
4775
|
ComponentBuilder,
|
|
4162
4776
|
ComponentsV2Assertions,
|
|
@@ -4175,8 +4789,11 @@ var version = "1.13.0";
|
|
|
4175
4789
|
MentionableSelectMenuBuilder,
|
|
4176
4790
|
ModalAssertions,
|
|
4177
4791
|
ModalBuilder,
|
|
4792
|
+
RadioGroupBuilder,
|
|
4793
|
+
RadioGroupOptionBuilder,
|
|
4178
4794
|
RoleSelectMenuBuilder,
|
|
4179
4795
|
SectionBuilder,
|
|
4796
|
+
SelectMenuAssertions,
|
|
4180
4797
|
SelectMenuBuilder,
|
|
4181
4798
|
SelectMenuOptionBuilder,
|
|
4182
4799
|
SeparatorBuilder,
|