@discordjs/builders 0.13.0-dev.1649030892-5748dbe → 0.13.0-dev.1649505810-3c0bbac
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +63 -140
- package/dist/index.js +83 -80
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +83 -80
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -3
package/dist/index.d.ts
CHANGED
|
@@ -1,47 +1,32 @@
|
|
|
1
|
+
import * as _sapphire_shapeshift from '@sapphire/shapeshift';
|
|
1
2
|
import { APIEmbedField, APIEmbedAuthor, APIEmbedFooter, APIEmbedImage, APIEmbed, APISelectMenuOption, APIMessageComponentEmoji, ButtonStyle, APIBaseComponent, ComponentType, APIModalComponent, APIMessageComponent, APIActionRowComponent, APIModalActionRowComponent, APIMessageActionRowComponent, APIActionRowComponentTypes, APIButtonComponent, APITextInputComponent, TextInputStyle, APIModalInteractionResponseCallbackData, APISelectMenuComponent, ApplicationCommandOptionType, APIApplicationCommandBasicOption, APIApplicationCommandBooleanOption, ChannelType, APIApplicationCommandChannelOption, APIApplicationCommandOptionChoice, APIApplicationCommandIntegerOption, APIApplicationCommandMentionableOption, APIApplicationCommandNumberOption, APIApplicationCommandRoleOption, APIApplicationCommandAttachmentOption, APIApplicationCommandStringOption, APIApplicationCommandUserOption, APIApplicationCommandSubcommandGroupOption, APIApplicationCommandSubcommandOption, RESTPostAPIApplicationCommandsJSONBody, APIApplicationCommandOption, ApplicationCommandType } from 'discord-api-types/v10';
|
|
2
|
-
import { z } from 'zod';
|
|
3
3
|
import { Snowflake } from 'discord-api-types/globals';
|
|
4
4
|
import { URL } from 'url';
|
|
5
5
|
|
|
6
|
-
declare const fieldNamePredicate:
|
|
7
|
-
declare const fieldValuePredicate:
|
|
8
|
-
declare const fieldInlinePredicate:
|
|
9
|
-
declare const embedFieldPredicate:
|
|
10
|
-
name: z.ZodString;
|
|
11
|
-
value: z.ZodString;
|
|
12
|
-
inline: z.ZodOptional<z.ZodBoolean>;
|
|
13
|
-
}, "strip", z.ZodTypeAny, {
|
|
14
|
-
inline?: boolean | undefined;
|
|
15
|
-
name: string;
|
|
16
|
-
value: string;
|
|
17
|
-
}, {
|
|
18
|
-
inline?: boolean | undefined;
|
|
6
|
+
declare const fieldNamePredicate: _sapphire_shapeshift.StringValidator<string>;
|
|
7
|
+
declare const fieldValuePredicate: _sapphire_shapeshift.StringValidator<string>;
|
|
8
|
+
declare const fieldInlinePredicate: _sapphire_shapeshift.UnionValidator<boolean | undefined>;
|
|
9
|
+
declare const embedFieldPredicate: _sapphire_shapeshift.ObjectValidator<{
|
|
19
10
|
name: string;
|
|
20
11
|
value: string;
|
|
12
|
+
inline: boolean | undefined;
|
|
21
13
|
}>;
|
|
22
|
-
declare const embedFieldsArrayPredicate:
|
|
23
|
-
name: z.ZodString;
|
|
24
|
-
value: z.ZodString;
|
|
25
|
-
inline: z.ZodOptional<z.ZodBoolean>;
|
|
26
|
-
}, "strip", z.ZodTypeAny, {
|
|
27
|
-
inline?: boolean | undefined;
|
|
28
|
-
name: string;
|
|
29
|
-
value: string;
|
|
30
|
-
}, {
|
|
31
|
-
inline?: boolean | undefined;
|
|
14
|
+
declare const embedFieldsArrayPredicate: _sapphire_shapeshift.ArrayValidator<{
|
|
32
15
|
name: string;
|
|
33
16
|
value: string;
|
|
34
|
-
|
|
35
|
-
|
|
17
|
+
inline: boolean | undefined;
|
|
18
|
+
}>;
|
|
19
|
+
declare const fieldLengthPredicate: _sapphire_shapeshift.NumberValidator<number>;
|
|
36
20
|
declare function validateFieldLength(amountAdding: number, fields?: APIEmbedField[]): void;
|
|
37
|
-
declare const authorNamePredicate:
|
|
38
|
-
declare const
|
|
39
|
-
declare const
|
|
40
|
-
declare const
|
|
41
|
-
declare const
|
|
42
|
-
declare const
|
|
43
|
-
declare const
|
|
44
|
-
declare const
|
|
21
|
+
declare const authorNamePredicate: _sapphire_shapeshift.UnionValidator<string | null>;
|
|
22
|
+
declare const imageURLPredicate: _sapphire_shapeshift.UnionValidator<string | null | undefined>;
|
|
23
|
+
declare const urlPredicate: _sapphire_shapeshift.UnionValidator<string | null | undefined>;
|
|
24
|
+
declare const RGBPredicate: _sapphire_shapeshift.NumberValidator<number>;
|
|
25
|
+
declare const colorPredicate: _sapphire_shapeshift.UnionValidator<number | [number, number, number] | null>;
|
|
26
|
+
declare const descriptionPredicate: _sapphire_shapeshift.UnionValidator<string | null>;
|
|
27
|
+
declare const footerTextPredicate: _sapphire_shapeshift.UnionValidator<string | null>;
|
|
28
|
+
declare const timestampPredicate: _sapphire_shapeshift.UnionValidator<number | Date | null>;
|
|
29
|
+
declare const titlePredicate: _sapphire_shapeshift.UnionValidator<string | null>;
|
|
45
30
|
|
|
46
31
|
declare const Assertions$5_fieldNamePredicate: typeof fieldNamePredicate;
|
|
47
32
|
declare const Assertions$5_fieldValuePredicate: typeof fieldValuePredicate;
|
|
@@ -51,6 +36,7 @@ declare const Assertions$5_embedFieldsArrayPredicate: typeof embedFieldsArrayPre
|
|
|
51
36
|
declare const Assertions$5_fieldLengthPredicate: typeof fieldLengthPredicate;
|
|
52
37
|
declare const Assertions$5_validateFieldLength: typeof validateFieldLength;
|
|
53
38
|
declare const Assertions$5_authorNamePredicate: typeof authorNamePredicate;
|
|
39
|
+
declare const Assertions$5_imageURLPredicate: typeof imageURLPredicate;
|
|
54
40
|
declare const Assertions$5_urlPredicate: typeof urlPredicate;
|
|
55
41
|
declare const Assertions$5_RGBPredicate: typeof RGBPredicate;
|
|
56
42
|
declare const Assertions$5_colorPredicate: typeof colorPredicate;
|
|
@@ -68,6 +54,7 @@ declare namespace Assertions$5 {
|
|
|
68
54
|
Assertions$5_fieldLengthPredicate as fieldLengthPredicate,
|
|
69
55
|
Assertions$5_validateFieldLength as validateFieldLength,
|
|
70
56
|
Assertions$5_authorNamePredicate as authorNamePredicate,
|
|
57
|
+
Assertions$5_imageURLPredicate as imageURLPredicate,
|
|
71
58
|
Assertions$5_urlPredicate as urlPredicate,
|
|
72
59
|
Assertions$5_RGBPredicate as RGBPredicate,
|
|
73
60
|
Assertions$5_colorPredicate as colorPredicate,
|
|
@@ -466,110 +453,46 @@ declare class SelectMenuOptionBuilder extends UnsafeSelectMenuOptionBuilder {
|
|
|
466
453
|
toJSON(): APISelectMenuOption;
|
|
467
454
|
}
|
|
468
455
|
|
|
469
|
-
declare const customIdValidator:
|
|
470
|
-
declare const emojiValidator:
|
|
471
|
-
id:
|
|
472
|
-
name:
|
|
473
|
-
animated:
|
|
474
|
-
}, "strict", z.ZodTypeAny, {
|
|
475
|
-
name?: string | undefined;
|
|
476
|
-
id?: string | undefined;
|
|
477
|
-
animated?: boolean | undefined;
|
|
478
|
-
}, {
|
|
479
|
-
name?: string | undefined;
|
|
480
|
-
id?: string | undefined;
|
|
481
|
-
animated?: boolean | undefined;
|
|
456
|
+
declare const customIdValidator: _sapphire_shapeshift.StringValidator<string>;
|
|
457
|
+
declare const emojiValidator: _sapphire_shapeshift.ObjectValidator<{
|
|
458
|
+
id: string;
|
|
459
|
+
name: string;
|
|
460
|
+
animated: boolean;
|
|
482
461
|
}>;
|
|
483
|
-
declare const disabledValidator:
|
|
484
|
-
declare const buttonLabelValidator:
|
|
485
|
-
declare const buttonStyleValidator:
|
|
486
|
-
declare const placeholderValidator$1:
|
|
487
|
-
declare const minMaxValidator:
|
|
488
|
-
declare const labelValueDescriptionValidator:
|
|
489
|
-
declare const optionValidator:
|
|
490
|
-
label: z.ZodString;
|
|
491
|
-
value: z.ZodString;
|
|
492
|
-
description: z.ZodOptional<z.ZodString>;
|
|
493
|
-
emoji: z.ZodOptional<z.ZodObject<{
|
|
494
|
-
id: z.ZodOptional<z.ZodString>;
|
|
495
|
-
name: z.ZodOptional<z.ZodString>;
|
|
496
|
-
animated: z.ZodOptional<z.ZodBoolean>;
|
|
497
|
-
}, "strict", z.ZodTypeAny, {
|
|
498
|
-
name?: string | undefined;
|
|
499
|
-
id?: string | undefined;
|
|
500
|
-
animated?: boolean | undefined;
|
|
501
|
-
}, {
|
|
502
|
-
name?: string | undefined;
|
|
503
|
-
id?: string | undefined;
|
|
504
|
-
animated?: boolean | undefined;
|
|
505
|
-
}>>;
|
|
506
|
-
default: z.ZodOptional<z.ZodBoolean>;
|
|
507
|
-
}, "strip", z.ZodTypeAny, {
|
|
508
|
-
description?: string | undefined;
|
|
509
|
-
emoji?: {
|
|
510
|
-
name?: string | undefined;
|
|
511
|
-
id?: string | undefined;
|
|
512
|
-
animated?: boolean | undefined;
|
|
513
|
-
} | undefined;
|
|
514
|
-
default?: boolean | undefined;
|
|
515
|
-
value: string;
|
|
462
|
+
declare const disabledValidator: _sapphire_shapeshift.BooleanValidator<boolean>;
|
|
463
|
+
declare const buttonLabelValidator: _sapphire_shapeshift.StringValidator<string>;
|
|
464
|
+
declare const buttonStyleValidator: _sapphire_shapeshift.NativeEnumValidator<typeof ButtonStyle>;
|
|
465
|
+
declare const placeholderValidator$1: _sapphire_shapeshift.StringValidator<string>;
|
|
466
|
+
declare const minMaxValidator: _sapphire_shapeshift.NumberValidator<number>;
|
|
467
|
+
declare const labelValueDescriptionValidator: _sapphire_shapeshift.StringValidator<string>;
|
|
468
|
+
declare const optionValidator: _sapphire_shapeshift.UnionValidator<UnsafeSelectMenuOptionBuilder | {
|
|
516
469
|
label: string;
|
|
517
|
-
}, {
|
|
518
|
-
description?: string | undefined;
|
|
519
|
-
emoji?: {
|
|
520
|
-
name?: string | undefined;
|
|
521
|
-
id?: string | undefined;
|
|
522
|
-
animated?: boolean | undefined;
|
|
523
|
-
} | undefined;
|
|
524
|
-
default?: boolean | undefined;
|
|
525
470
|
value: string;
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
description: z.ZodOptional<z.ZodString>;
|
|
532
|
-
emoji: z.ZodOptional<z.ZodObject<{
|
|
533
|
-
id: z.ZodOptional<z.ZodString>;
|
|
534
|
-
name: z.ZodOptional<z.ZodString>;
|
|
535
|
-
animated: z.ZodOptional<z.ZodBoolean>;
|
|
536
|
-
}, "strict", z.ZodTypeAny, {
|
|
537
|
-
name?: string | undefined;
|
|
538
|
-
id?: string | undefined;
|
|
539
|
-
animated?: boolean | undefined;
|
|
540
|
-
}, {
|
|
541
|
-
name?: string | undefined;
|
|
542
|
-
id?: string | undefined;
|
|
543
|
-
animated?: boolean | undefined;
|
|
544
|
-
}>>;
|
|
545
|
-
default: z.ZodOptional<z.ZodBoolean>;
|
|
546
|
-
}, "strip", z.ZodTypeAny, {
|
|
547
|
-
description?: string | undefined;
|
|
548
|
-
emoji?: {
|
|
549
|
-
name?: string | undefined;
|
|
550
|
-
id?: string | undefined;
|
|
551
|
-
animated?: boolean | undefined;
|
|
471
|
+
description: string | undefined;
|
|
472
|
+
emoji: {
|
|
473
|
+
id: string;
|
|
474
|
+
name: string;
|
|
475
|
+
animated: boolean;
|
|
552
476
|
} | undefined;
|
|
553
|
-
default
|
|
554
|
-
|
|
477
|
+
default: boolean | undefined;
|
|
478
|
+
}>;
|
|
479
|
+
declare const optionsValidator: _sapphire_shapeshift.BaseValidator<(UnsafeSelectMenuOptionBuilder | {
|
|
555
480
|
label: string;
|
|
556
|
-
}, {
|
|
557
|
-
description?: string | undefined;
|
|
558
|
-
emoji?: {
|
|
559
|
-
name?: string | undefined;
|
|
560
|
-
id?: string | undefined;
|
|
561
|
-
animated?: boolean | undefined;
|
|
562
|
-
} | undefined;
|
|
563
|
-
default?: boolean | undefined;
|
|
564
481
|
value: string;
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
482
|
+
description: string | undefined;
|
|
483
|
+
emoji: {
|
|
484
|
+
id: string;
|
|
485
|
+
name: string;
|
|
486
|
+
animated: boolean;
|
|
487
|
+
} | undefined;
|
|
488
|
+
default: boolean | undefined;
|
|
489
|
+
})[]>;
|
|
490
|
+
declare const optionsLengthValidator: _sapphire_shapeshift.NumberValidator<number>;
|
|
568
491
|
declare function validateRequiredSelectMenuParameters(options: SelectMenuOptionBuilder[], customId?: string): void;
|
|
569
|
-
declare const labelValueValidator:
|
|
570
|
-
declare const defaultValidator:
|
|
492
|
+
declare const labelValueValidator: _sapphire_shapeshift.StringValidator<string>;
|
|
493
|
+
declare const defaultValidator: _sapphire_shapeshift.BooleanValidator<boolean>;
|
|
571
494
|
declare function validateRequiredSelectMenuOptionParameters(label?: string, value?: string): void;
|
|
572
|
-
declare const urlValidator:
|
|
495
|
+
declare const urlValidator: _sapphire_shapeshift.StringValidator<string>;
|
|
573
496
|
declare function validateRequiredButtonParameters(style?: ButtonStyle, label?: string, emoji?: APIMessageComponentEmoji, customId?: string, url?: string): void;
|
|
574
497
|
|
|
575
498
|
declare const Assertions$4_customIdValidator: typeof customIdValidator;
|
|
@@ -792,13 +715,13 @@ declare class TextInputBuilder extends UnsafeTextInputBuilder {
|
|
|
792
715
|
toJSON(): APITextInputComponent;
|
|
793
716
|
}
|
|
794
717
|
|
|
795
|
-
declare const textInputStyleValidator:
|
|
796
|
-
declare const minLengthValidator:
|
|
797
|
-
declare const maxLengthValidator:
|
|
798
|
-
declare const requiredValidator:
|
|
799
|
-
declare const valueValidator:
|
|
800
|
-
declare const placeholderValidator:
|
|
801
|
-
declare const labelValidator:
|
|
718
|
+
declare const textInputStyleValidator: _sapphire_shapeshift.NativeEnumValidator<typeof TextInputStyle>;
|
|
719
|
+
declare const minLengthValidator: _sapphire_shapeshift.NumberValidator<number>;
|
|
720
|
+
declare const maxLengthValidator: _sapphire_shapeshift.NumberValidator<number>;
|
|
721
|
+
declare const requiredValidator: _sapphire_shapeshift.BooleanValidator<boolean>;
|
|
722
|
+
declare const valueValidator: _sapphire_shapeshift.StringValidator<string>;
|
|
723
|
+
declare const placeholderValidator: _sapphire_shapeshift.StringValidator<string>;
|
|
724
|
+
declare const labelValidator: _sapphire_shapeshift.StringValidator<string>;
|
|
802
725
|
declare function validateRequiredParameters$3(customId?: string, style?: TextInputStyle, label?: string): void;
|
|
803
726
|
|
|
804
727
|
declare const Assertions$3_textInputStyleValidator: typeof textInputStyleValidator;
|
|
@@ -854,8 +777,8 @@ declare class ModalBuilder extends UnsafeModalBuilder {
|
|
|
854
777
|
toJSON(): APIModalInteractionResponseCallbackData;
|
|
855
778
|
}
|
|
856
779
|
|
|
857
|
-
declare const titleValidator:
|
|
858
|
-
declare const componentsValidator:
|
|
780
|
+
declare const titleValidator: _sapphire_shapeshift.StringValidator<string>;
|
|
781
|
+
declare const componentsValidator: _sapphire_shapeshift.BaseValidator<[ActionRowBuilder<MessageActionRowComponentBuilder | TextInputBuilder>, ...ActionRowBuilder<MessageActionRowComponentBuilder | TextInputBuilder>[]]>;
|
|
859
782
|
declare function validateRequiredParameters$2(customId?: string, title?: string, components?: ActionRowBuilder<ModalActionRowComponentBuilder>[]): void;
|
|
860
783
|
|
|
861
784
|
declare const Assertions$2_titleValidator: typeof titleValidator;
|
|
@@ -967,7 +890,7 @@ declare class SlashCommandBooleanOption extends ApplicationCommandOptionBase {
|
|
|
967
890
|
toJSON(): APIApplicationCommandBooleanOption;
|
|
968
891
|
}
|
|
969
892
|
|
|
970
|
-
declare const allowedChannelTypes: readonly [ChannelType.GuildText, ChannelType.GuildVoice, ChannelType.GuildCategory, ChannelType.GuildNews, ChannelType.
|
|
893
|
+
declare const allowedChannelTypes: readonly [ChannelType.GuildText, ChannelType.GuildVoice, ChannelType.GuildCategory, ChannelType.GuildNews, ChannelType.GuildNewsThread, ChannelType.GuildPublicThread, ChannelType.GuildPrivateThread, ChannelType.GuildStageVoice];
|
|
971
894
|
declare type ApplicationCommandOptionAllowedChannelTypes = typeof allowedChannelTypes[number];
|
|
972
895
|
declare class ApplicationCommandOptionChannelTypesMixin {
|
|
973
896
|
readonly channel_types?: ApplicationCommandOptionAllowedChannelTypes[];
|
package/dist/index.js
CHANGED
|
@@ -117,34 +117,40 @@ __export(Assertions_exports, {
|
|
|
117
117
|
fieldNamePredicate: () => fieldNamePredicate,
|
|
118
118
|
fieldValuePredicate: () => fieldValuePredicate,
|
|
119
119
|
footerTextPredicate: () => footerTextPredicate,
|
|
120
|
+
imageURLPredicate: () => imageURLPredicate,
|
|
120
121
|
timestampPredicate: () => timestampPredicate,
|
|
121
122
|
titlePredicate: () => titlePredicate,
|
|
122
123
|
urlPredicate: () => urlPredicate,
|
|
123
124
|
validateFieldLength: () => validateFieldLength
|
|
124
125
|
});
|
|
125
|
-
var
|
|
126
|
-
var fieldNamePredicate =
|
|
127
|
-
var fieldValuePredicate =
|
|
128
|
-
var fieldInlinePredicate =
|
|
129
|
-
var embedFieldPredicate =
|
|
126
|
+
var import_shapeshift = require("@sapphire/shapeshift");
|
|
127
|
+
var fieldNamePredicate = import_shapeshift.s.string.lengthGe(1).lengthLe(256);
|
|
128
|
+
var fieldValuePredicate = import_shapeshift.s.string.lengthGe(1).lengthLe(1024);
|
|
129
|
+
var fieldInlinePredicate = import_shapeshift.s.boolean.optional;
|
|
130
|
+
var embedFieldPredicate = import_shapeshift.s.object({
|
|
130
131
|
name: fieldNamePredicate,
|
|
131
132
|
value: fieldValuePredicate,
|
|
132
133
|
inline: fieldInlinePredicate
|
|
133
134
|
});
|
|
134
|
-
var embedFieldsArrayPredicate = embedFieldPredicate.array
|
|
135
|
-
var fieldLengthPredicate =
|
|
135
|
+
var embedFieldsArrayPredicate = embedFieldPredicate.array;
|
|
136
|
+
var fieldLengthPredicate = import_shapeshift.s.number.le(25);
|
|
136
137
|
function validateFieldLength(amountAdding, fields) {
|
|
137
138
|
fieldLengthPredicate.parse((fields?.length ?? 0) + amountAdding);
|
|
138
139
|
}
|
|
139
140
|
__name(validateFieldLength, "validateFieldLength");
|
|
140
|
-
var authorNamePredicate = fieldNamePredicate.nullable
|
|
141
|
-
var
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
var
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
var
|
|
141
|
+
var authorNamePredicate = fieldNamePredicate.nullable;
|
|
142
|
+
var imageURLPredicate = import_shapeshift.s.string.url({
|
|
143
|
+
allowedProtocols: ["http:", "https:", "attachment:"]
|
|
144
|
+
}).nullish;
|
|
145
|
+
var urlPredicate = import_shapeshift.s.string.url({
|
|
146
|
+
allowedProtocols: ["http:", "https:"]
|
|
147
|
+
}).nullish;
|
|
148
|
+
var RGBPredicate = import_shapeshift.s.number.int.ge(0).le(255);
|
|
149
|
+
var colorPredicate = import_shapeshift.s.number.int.ge(0).le(16777215).or(import_shapeshift.s.tuple([RGBPredicate, RGBPredicate, RGBPredicate])).nullable;
|
|
150
|
+
var descriptionPredicate = import_shapeshift.s.string.lengthGe(1).lengthLe(4096).nullable;
|
|
151
|
+
var footerTextPredicate = import_shapeshift.s.string.lengthGe(1).lengthLe(2048).nullable;
|
|
152
|
+
var timestampPredicate = import_shapeshift.s.union(import_shapeshift.s.number, import_shapeshift.s.date).nullable;
|
|
153
|
+
var titlePredicate = fieldNamePredicate.nullable;
|
|
148
154
|
|
|
149
155
|
// src/messages/embed/UnsafeEmbed.ts
|
|
150
156
|
var UnsafeEmbedBuilder = class {
|
|
@@ -261,10 +267,10 @@ var EmbedBuilder = class extends UnsafeEmbedBuilder {
|
|
|
261
267
|
return super.setFooter(options);
|
|
262
268
|
}
|
|
263
269
|
setImage(url) {
|
|
264
|
-
return super.setImage(
|
|
270
|
+
return super.setImage(imageURLPredicate.parse(url));
|
|
265
271
|
}
|
|
266
272
|
setThumbnail(url) {
|
|
267
|
-
return super.setThumbnail(
|
|
273
|
+
return super.setThumbnail(imageURLPredicate.parse(url));
|
|
268
274
|
}
|
|
269
275
|
setTimestamp(timestamp = Date.now()) {
|
|
270
276
|
return super.setTimestamp(timestampPredicate.parse(timestamp));
|
|
@@ -390,7 +396,7 @@ __export(Assertions_exports2, {
|
|
|
390
396
|
validateRequiredSelectMenuParameters: () => validateRequiredSelectMenuParameters
|
|
391
397
|
});
|
|
392
398
|
var import_v10 = require("discord-api-types/v10");
|
|
393
|
-
var
|
|
399
|
+
var import_shapeshift2 = require("@sapphire/shapeshift");
|
|
394
400
|
|
|
395
401
|
// src/components/selectMenu/UnsafeSelectMenuOption.ts
|
|
396
402
|
var UnsafeSelectMenuOptionBuilder = class {
|
|
@@ -426,43 +432,42 @@ var UnsafeSelectMenuOptionBuilder = class {
|
|
|
426
432
|
__name(UnsafeSelectMenuOptionBuilder, "UnsafeSelectMenuOptionBuilder");
|
|
427
433
|
|
|
428
434
|
// src/components/Assertions.ts
|
|
429
|
-
var customIdValidator =
|
|
430
|
-
var emojiValidator =
|
|
431
|
-
id:
|
|
432
|
-
name:
|
|
433
|
-
animated:
|
|
434
|
-
}).partial
|
|
435
|
-
var disabledValidator =
|
|
436
|
-
var buttonLabelValidator =
|
|
437
|
-
var buttonStyleValidator =
|
|
438
|
-
var placeholderValidator =
|
|
439
|
-
var minMaxValidator =
|
|
440
|
-
var labelValueDescriptionValidator =
|
|
441
|
-
var optionValidator =
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
]);
|
|
451
|
-
var optionsValidator = optionValidator.array().nonempty();
|
|
452
|
-
var optionsLengthValidator = import_zod2.z.number().int().min(0).max(25);
|
|
435
|
+
var customIdValidator = import_shapeshift2.s.string.lengthGe(1).lengthLe(100);
|
|
436
|
+
var emojiValidator = import_shapeshift2.s.object({
|
|
437
|
+
id: import_shapeshift2.s.string,
|
|
438
|
+
name: import_shapeshift2.s.string,
|
|
439
|
+
animated: import_shapeshift2.s.boolean
|
|
440
|
+
}).partial.strict;
|
|
441
|
+
var disabledValidator = import_shapeshift2.s.boolean;
|
|
442
|
+
var buttonLabelValidator = import_shapeshift2.s.string.lengthGe(1).lengthLe(80);
|
|
443
|
+
var buttonStyleValidator = import_shapeshift2.s.nativeEnum(import_v10.ButtonStyle);
|
|
444
|
+
var placeholderValidator = import_shapeshift2.s.string.lengthLe(150);
|
|
445
|
+
var minMaxValidator = import_shapeshift2.s.number.int.ge(0).le(25);
|
|
446
|
+
var labelValueDescriptionValidator = import_shapeshift2.s.string.lengthGe(1).lengthLe(100);
|
|
447
|
+
var optionValidator = import_shapeshift2.s.union(import_shapeshift2.s.object({
|
|
448
|
+
label: labelValueDescriptionValidator,
|
|
449
|
+
value: labelValueDescriptionValidator,
|
|
450
|
+
description: labelValueDescriptionValidator.optional,
|
|
451
|
+
emoji: emojiValidator.optional,
|
|
452
|
+
default: import_shapeshift2.s.boolean.optional
|
|
453
|
+
}), import_shapeshift2.s.instance(UnsafeSelectMenuOptionBuilder));
|
|
454
|
+
var optionsValidator = optionValidator.array.lengthGe(0);
|
|
455
|
+
var optionsLengthValidator = import_shapeshift2.s.number.int.ge(0).le(25);
|
|
453
456
|
function validateRequiredSelectMenuParameters(options, customId) {
|
|
454
457
|
customIdValidator.parse(customId);
|
|
455
458
|
optionsValidator.parse(options);
|
|
456
459
|
}
|
|
457
460
|
__name(validateRequiredSelectMenuParameters, "validateRequiredSelectMenuParameters");
|
|
458
|
-
var labelValueValidator =
|
|
459
|
-
var defaultValidator =
|
|
461
|
+
var labelValueValidator = import_shapeshift2.s.string.lengthGe(1).lengthLe(100);
|
|
462
|
+
var defaultValidator = import_shapeshift2.s.boolean;
|
|
460
463
|
function validateRequiredSelectMenuOptionParameters(label, value) {
|
|
461
464
|
labelValueValidator.parse(label);
|
|
462
465
|
labelValueValidator.parse(value);
|
|
463
466
|
}
|
|
464
467
|
__name(validateRequiredSelectMenuOptionParameters, "validateRequiredSelectMenuOptionParameters");
|
|
465
|
-
var urlValidator =
|
|
468
|
+
var urlValidator = import_shapeshift2.s.string.url({
|
|
469
|
+
allowedProtocols: ["http:", "https:", "discord:"]
|
|
470
|
+
});
|
|
466
471
|
function validateRequiredButtonParameters(style, label, emoji, customId, url) {
|
|
467
472
|
if (url && customId) {
|
|
468
473
|
throw new RangeError("URL and custom id are mutually exclusive");
|
|
@@ -618,14 +623,14 @@ __export(Assertions_exports3, {
|
|
|
618
623
|
valueValidator: () => valueValidator
|
|
619
624
|
});
|
|
620
625
|
var import_v105 = require("discord-api-types/v10");
|
|
621
|
-
var
|
|
622
|
-
var textInputStyleValidator =
|
|
623
|
-
var minLengthValidator =
|
|
624
|
-
var maxLengthValidator =
|
|
625
|
-
var requiredValidator =
|
|
626
|
-
var valueValidator =
|
|
627
|
-
var placeholderValidator2 =
|
|
628
|
-
var labelValidator =
|
|
626
|
+
var import_shapeshift3 = require("@sapphire/shapeshift");
|
|
627
|
+
var textInputStyleValidator = import_shapeshift3.s.nativeEnum(import_v105.TextInputStyle);
|
|
628
|
+
var minLengthValidator = import_shapeshift3.s.number.int.ge(0).le(4e3);
|
|
629
|
+
var maxLengthValidator = import_shapeshift3.s.number.int.ge(1).le(4e3);
|
|
630
|
+
var requiredValidator = import_shapeshift3.s.boolean;
|
|
631
|
+
var valueValidator = import_shapeshift3.s.string.lengthLe(4e3);
|
|
632
|
+
var placeholderValidator2 = import_shapeshift3.s.string.lengthLe(100);
|
|
633
|
+
var labelValidator = import_shapeshift3.s.string.lengthGe(1).lengthLe(45);
|
|
629
634
|
function validateRequiredParameters(customId, style, label) {
|
|
630
635
|
customIdValidator.parse(customId);
|
|
631
636
|
textInputStyleValidator.parse(style);
|
|
@@ -750,9 +755,9 @@ __export(Assertions_exports4, {
|
|
|
750
755
|
titleValidator: () => titleValidator,
|
|
751
756
|
validateRequiredParameters: () => validateRequiredParameters2
|
|
752
757
|
});
|
|
753
|
-
var
|
|
754
|
-
var titleValidator =
|
|
755
|
-
var componentsValidator =
|
|
758
|
+
var import_shapeshift4 = require("@sapphire/shapeshift");
|
|
759
|
+
var titleValidator = import_shapeshift4.s.string.lengthGe(1).lengthLe(45);
|
|
760
|
+
var componentsValidator = import_shapeshift4.s.instance(ActionRowBuilder).array.lengthGe(1);
|
|
756
761
|
function validateRequiredParameters2(customId, title, components) {
|
|
757
762
|
customIdValidator.parse(customId);
|
|
758
763
|
titleValidator.parse(title);
|
|
@@ -886,18 +891,18 @@ __export(Assertions_exports5, {
|
|
|
886
891
|
validateRequiredParameters: () => validateRequiredParameters3
|
|
887
892
|
});
|
|
888
893
|
var import_is = __toESM(require("@sindresorhus/is"));
|
|
889
|
-
var
|
|
890
|
-
var namePredicate =
|
|
894
|
+
var import_shapeshift5 = require("@sapphire/shapeshift");
|
|
895
|
+
var namePredicate = import_shapeshift5.s.string.lengthGe(1).lengthLe(32).regex(/^[\P{Lu}\p{N}_-]+$/u);
|
|
891
896
|
function validateName(name) {
|
|
892
897
|
namePredicate.parse(name);
|
|
893
898
|
}
|
|
894
899
|
__name(validateName, "validateName");
|
|
895
|
-
var descriptionPredicate2 =
|
|
900
|
+
var descriptionPredicate2 = import_shapeshift5.s.string.lengthGe(1).lengthLe(100);
|
|
896
901
|
function validateDescription(description) {
|
|
897
902
|
descriptionPredicate2.parse(description);
|
|
898
903
|
}
|
|
899
904
|
__name(validateDescription, "validateDescription");
|
|
900
|
-
var maxArrayLengthPredicate =
|
|
905
|
+
var maxArrayLengthPredicate = import_shapeshift5.s.unknown.array.lengthLe(25);
|
|
901
906
|
function validateMaxOptionsLength(options) {
|
|
902
907
|
maxArrayLengthPredicate.parse(options);
|
|
903
908
|
}
|
|
@@ -908,7 +913,7 @@ function validateRequiredParameters3(name, description, options) {
|
|
|
908
913
|
validateMaxOptionsLength(options);
|
|
909
914
|
}
|
|
910
915
|
__name(validateRequiredParameters3, "validateRequiredParameters");
|
|
911
|
-
var booleanPredicate =
|
|
916
|
+
var booleanPredicate = import_shapeshift5.s.boolean;
|
|
912
917
|
function validateDefaultPermission(value) {
|
|
913
918
|
booleanPredicate.parse(value);
|
|
914
919
|
}
|
|
@@ -917,7 +922,7 @@ function validateRequired(required) {
|
|
|
917
922
|
booleanPredicate.parse(required);
|
|
918
923
|
}
|
|
919
924
|
__name(validateRequired, "validateRequired");
|
|
920
|
-
var choicesLengthPredicate =
|
|
925
|
+
var choicesLengthPredicate = import_shapeshift5.s.number.le(25);
|
|
921
926
|
function validateChoicesLength(amountAdding, choices) {
|
|
922
927
|
choicesLengthPredicate.parse((choices?.length ?? 0) + amountAdding);
|
|
923
928
|
}
|
|
@@ -1002,19 +1007,18 @@ var import_ts_mixer = require("ts-mixer");
|
|
|
1002
1007
|
|
|
1003
1008
|
// src/interactions/slashCommands/mixins/ApplicationCommandOptionChannelTypesMixin.ts
|
|
1004
1009
|
var import_v109 = require("discord-api-types/v10");
|
|
1005
|
-
var
|
|
1010
|
+
var import_shapeshift6 = require("@sapphire/shapeshift");
|
|
1006
1011
|
var allowedChannelTypes = [
|
|
1007
1012
|
import_v109.ChannelType.GuildText,
|
|
1008
1013
|
import_v109.ChannelType.GuildVoice,
|
|
1009
1014
|
import_v109.ChannelType.GuildCategory,
|
|
1010
1015
|
import_v109.ChannelType.GuildNews,
|
|
1011
|
-
import_v109.ChannelType.GuildStore,
|
|
1012
1016
|
import_v109.ChannelType.GuildNewsThread,
|
|
1013
1017
|
import_v109.ChannelType.GuildPublicThread,
|
|
1014
1018
|
import_v109.ChannelType.GuildPrivateThread,
|
|
1015
1019
|
import_v109.ChannelType.GuildStageVoice
|
|
1016
1020
|
];
|
|
1017
|
-
var channelTypesPredicate =
|
|
1021
|
+
var channelTypesPredicate = import_shapeshift6.s.array(import_shapeshift6.s.union(...allowedChannelTypes.map((type) => import_shapeshift6.s.literal(type))));
|
|
1018
1022
|
var ApplicationCommandOptionChannelTypesMixin = class {
|
|
1019
1023
|
constructor() {
|
|
1020
1024
|
__publicField(this, "channel_types");
|
|
@@ -1023,8 +1027,7 @@ var ApplicationCommandOptionChannelTypesMixin = class {
|
|
|
1023
1027
|
if (this.channel_types === void 0) {
|
|
1024
1028
|
Reflect.set(this, "channel_types", []);
|
|
1025
1029
|
}
|
|
1026
|
-
channelTypesPredicate.parse(channelTypes);
|
|
1027
|
-
this.channel_types.push(...channelTypes);
|
|
1030
|
+
this.channel_types.push(...channelTypesPredicate.parse(channelTypes));
|
|
1028
1031
|
return this;
|
|
1029
1032
|
}
|
|
1030
1033
|
};
|
|
@@ -1049,7 +1052,7 @@ SlashCommandChannelOption = __decorateClass([
|
|
|
1049
1052
|
// src/interactions/slashCommands/options/integer.ts
|
|
1050
1053
|
var import_v1012 = require("discord-api-types/v10");
|
|
1051
1054
|
var import_ts_mixer2 = require("ts-mixer");
|
|
1052
|
-
var
|
|
1055
|
+
var import_shapeshift8 = require("@sapphire/shapeshift");
|
|
1053
1056
|
|
|
1054
1057
|
// src/interactions/slashCommands/mixins/ApplicationCommandNumericOptionMinMaxValueMixin.ts
|
|
1055
1058
|
var ApplicationCommandNumericOptionMinMaxValueMixin = class {
|
|
@@ -1062,11 +1065,11 @@ __name(ApplicationCommandNumericOptionMinMaxValueMixin, "ApplicationCommandNumer
|
|
|
1062
1065
|
|
|
1063
1066
|
// src/interactions/slashCommands/mixins/ApplicationCommandOptionWithChoicesAndAutocompleteMixin.ts
|
|
1064
1067
|
var import_v1011 = require("discord-api-types/v10");
|
|
1065
|
-
var
|
|
1066
|
-
var stringPredicate =
|
|
1067
|
-
var numberPredicate =
|
|
1068
|
-
var choicesPredicate =
|
|
1069
|
-
var booleanPredicate2 =
|
|
1068
|
+
var import_shapeshift7 = require("@sapphire/shapeshift");
|
|
1069
|
+
var stringPredicate = import_shapeshift7.s.string.lengthGe(1).lengthLe(100);
|
|
1070
|
+
var numberPredicate = import_shapeshift7.s.number.gt(-Infinity).lt(Infinity);
|
|
1071
|
+
var choicesPredicate = import_shapeshift7.s.object({ name: stringPredicate, value: import_shapeshift7.s.union(stringPredicate, numberPredicate) }).array;
|
|
1072
|
+
var booleanPredicate2 = import_shapeshift7.s.boolean;
|
|
1070
1073
|
var ApplicationCommandOptionWithChoicesAndAutocompleteMixin = class {
|
|
1071
1074
|
constructor() {
|
|
1072
1075
|
__publicField(this, "choices");
|
|
@@ -1113,7 +1116,7 @@ var ApplicationCommandOptionWithChoicesAndAutocompleteMixin = class {
|
|
|
1113
1116
|
__name(ApplicationCommandOptionWithChoicesAndAutocompleteMixin, "ApplicationCommandOptionWithChoicesAndAutocompleteMixin");
|
|
1114
1117
|
|
|
1115
1118
|
// src/interactions/slashCommands/options/integer.ts
|
|
1116
|
-
var numberValidator =
|
|
1119
|
+
var numberValidator = import_shapeshift8.s.number.int;
|
|
1117
1120
|
var SlashCommandIntegerOption = class extends ApplicationCommandOptionBase {
|
|
1118
1121
|
constructor() {
|
|
1119
1122
|
super(...arguments);
|
|
@@ -1159,8 +1162,8 @@ __name(SlashCommandMentionableOption, "SlashCommandMentionableOption");
|
|
|
1159
1162
|
// src/interactions/slashCommands/options/number.ts
|
|
1160
1163
|
var import_v1014 = require("discord-api-types/v10");
|
|
1161
1164
|
var import_ts_mixer3 = require("ts-mixer");
|
|
1162
|
-
var
|
|
1163
|
-
var numberValidator2 =
|
|
1165
|
+
var import_shapeshift9 = require("@sapphire/shapeshift");
|
|
1166
|
+
var numberValidator2 = import_shapeshift9.s.number;
|
|
1164
1167
|
var SlashCommandNumberOption = class extends ApplicationCommandOptionBase {
|
|
1165
1168
|
constructor() {
|
|
1166
1169
|
super(...arguments);
|
|
@@ -1399,11 +1402,11 @@ __export(Assertions_exports6, {
|
|
|
1399
1402
|
validateRequiredParameters: () => validateRequiredParameters4,
|
|
1400
1403
|
validateType: () => validateType
|
|
1401
1404
|
});
|
|
1402
|
-
var
|
|
1405
|
+
var import_shapeshift10 = require("@sapphire/shapeshift");
|
|
1403
1406
|
var import_v1020 = require("discord-api-types/v10");
|
|
1404
|
-
var namePredicate2 =
|
|
1405
|
-
var typePredicate =
|
|
1406
|
-
var booleanPredicate3 =
|
|
1407
|
+
var namePredicate2 = import_shapeshift10.s.string.lengthGe(1).lengthLe(32).regex(/^( *[\p{L}\p{N}_-]+ *)+$/u);
|
|
1408
|
+
var typePredicate = import_shapeshift10.s.union(import_shapeshift10.s.literal(import_v1020.ApplicationCommandType.User), import_shapeshift10.s.literal(import_v1020.ApplicationCommandType.Message));
|
|
1409
|
+
var booleanPredicate3 = import_shapeshift10.s.boolean;
|
|
1407
1410
|
function validateDefaultPermission2(value) {
|
|
1408
1411
|
booleanPredicate3.parse(value);
|
|
1409
1412
|
}
|