@discordjs/builders 0.16.0-dev.1657066311-68c3d87 → 0.16.0-dev.1657239113-e78c9c9
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 +195 -254
- package/dist/index.js +218 -355
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +213 -347
- package/dist/index.mjs.map +1 -1
- package/package.json +9 -8
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as _sapphire_shapeshift from '@sapphire/shapeshift';
|
|
2
|
-
import { APIEmbedField, APIEmbedAuthor, APIEmbedFooter, APIEmbedImage, APIEmbed, APISelectMenuOption, APIMessageComponentEmoji, ButtonStyle, APIActionRowComponentTypes, APIActionRowComponent, APIBaseComponent, ComponentType,
|
|
2
|
+
import { APIEmbedField, APIEmbedAuthor, APIEmbedFooter, APIEmbedImage, APIEmbed, APISelectMenuOption, APIMessageComponentEmoji, ButtonStyle, APIActionRowComponentTypes, APIActionRowComponent, APIBaseComponent, ComponentType, APIButtonComponent, APISelectMenuComponent, APITextInputComponent, TextInputStyle, APIMessageActionRowComponent, APIModalActionRowComponent, APIMessageComponent, APIModalComponent, APIModalInteractionResponseCallbackData, LocalizationMap, LocaleString, ApplicationCommandOptionType, APIApplicationCommandBasicOption, APIApplicationCommandAttachmentOption, APIApplicationCommandBooleanOption, ChannelType, APIApplicationCommandChannelOption, APIApplicationCommandOptionChoice, APIApplicationCommandIntegerOption, APIApplicationCommandMentionableOption, APIApplicationCommandNumberOption, APIApplicationCommandRoleOption, APIApplicationCommandStringOption, APIApplicationCommandUserOption, APIApplicationCommandSubcommandGroupOption, APIApplicationCommandSubcommandOption, Permissions, RESTPostAPIApplicationCommandsJSONBody, APIApplicationCommandOption, Locale, ApplicationCommandType } from 'discord-api-types/v10';
|
|
3
3
|
import { URL } from 'url';
|
|
4
4
|
import { Snowflake } from 'discord-api-types/globals';
|
|
5
5
|
|
|
@@ -10,12 +10,20 @@ declare const embedFieldPredicate: _sapphire_shapeshift.ObjectValidator<{
|
|
|
10
10
|
name: string;
|
|
11
11
|
value: string;
|
|
12
12
|
inline: boolean | undefined;
|
|
13
|
-
}
|
|
14
|
-
declare const embedFieldsArrayPredicate: _sapphire_shapeshift.ArrayValidator<{
|
|
13
|
+
}, _sapphire_shapeshift.UndefinedToOptional<{
|
|
15
14
|
name: string;
|
|
16
15
|
value: string;
|
|
17
16
|
inline: boolean | undefined;
|
|
18
|
-
}
|
|
17
|
+
}>>;
|
|
18
|
+
declare const embedFieldsArrayPredicate: _sapphire_shapeshift.ArrayValidator<_sapphire_shapeshift.UndefinedToOptional<{
|
|
19
|
+
name: string;
|
|
20
|
+
value: string;
|
|
21
|
+
inline: boolean | undefined;
|
|
22
|
+
}>[], _sapphire_shapeshift.UndefinedToOptional<{
|
|
23
|
+
name: string;
|
|
24
|
+
value: string;
|
|
25
|
+
inline: boolean | undefined;
|
|
26
|
+
}>>;
|
|
19
27
|
declare const fieldLengthPredicate: _sapphire_shapeshift.NumberValidator<number>;
|
|
20
28
|
declare function validateFieldLength(amountAdding: number, fields?: APIEmbedField[]): void;
|
|
21
29
|
declare const authorNamePredicate: _sapphire_shapeshift.UnionValidator<string | null>;
|
|
@@ -25,7 +33,11 @@ declare const embedAuthorPredicate: _sapphire_shapeshift.ObjectValidator<{
|
|
|
25
33
|
name: string | null;
|
|
26
34
|
iconURL: string | null | undefined;
|
|
27
35
|
url: string | null | undefined;
|
|
28
|
-
}
|
|
36
|
+
}, _sapphire_shapeshift.UndefinedToOptional<{
|
|
37
|
+
name: string | null;
|
|
38
|
+
iconURL: string | null | undefined;
|
|
39
|
+
url: string | null | undefined;
|
|
40
|
+
}>>;
|
|
29
41
|
declare const RGBPredicate: _sapphire_shapeshift.NumberValidator<number>;
|
|
30
42
|
declare const colorPredicate: _sapphire_shapeshift.UnionValidator<number | [number, number, number] | null>;
|
|
31
43
|
declare const descriptionPredicate: _sapphire_shapeshift.UnionValidator<string | null>;
|
|
@@ -33,7 +45,10 @@ declare const footerTextPredicate: _sapphire_shapeshift.UnionValidator<string |
|
|
|
33
45
|
declare const embedFooterPredicate: _sapphire_shapeshift.ObjectValidator<{
|
|
34
46
|
text: string | null;
|
|
35
47
|
iconURL: string | null | undefined;
|
|
36
|
-
}
|
|
48
|
+
}, _sapphire_shapeshift.UndefinedToOptional<{
|
|
49
|
+
text: string | null;
|
|
50
|
+
iconURL: string | null | undefined;
|
|
51
|
+
}>>;
|
|
37
52
|
declare const timestampPredicate: _sapphire_shapeshift.UnionValidator<number | Date | null>;
|
|
38
53
|
declare const titlePredicate: _sapphire_shapeshift.UnionValidator<string | null>;
|
|
39
54
|
|
|
@@ -103,83 +118,82 @@ interface EmbedImageData extends Omit<APIEmbedImage, 'proxy_url'> {
|
|
|
103
118
|
proxyURL?: string;
|
|
104
119
|
}
|
|
105
120
|
/**
|
|
106
|
-
* Represents a
|
|
121
|
+
* Represents a embed in a message (image/video preview, rich embed, etc.)
|
|
107
122
|
*/
|
|
108
|
-
declare class
|
|
123
|
+
declare class EmbedBuilder {
|
|
109
124
|
readonly data: APIEmbed;
|
|
110
125
|
constructor(data?: APIEmbed);
|
|
111
126
|
/**
|
|
112
127
|
* Adds fields to the embed (max 25)
|
|
113
128
|
*
|
|
114
|
-
* @param fields
|
|
129
|
+
* @param fields The fields to add
|
|
115
130
|
*/
|
|
116
131
|
addFields(...fields: RestOrArray<APIEmbedField>): this;
|
|
117
132
|
/**
|
|
118
133
|
* Removes, replaces, or inserts fields in the embed (max 25)
|
|
119
134
|
*
|
|
120
|
-
* @param index
|
|
121
|
-
* @param deleteCount
|
|
122
|
-
* @param fields
|
|
135
|
+
* @param index The index to start at
|
|
136
|
+
* @param deleteCount The number of fields to remove
|
|
137
|
+
* @param fields The replacing field objects
|
|
123
138
|
*/
|
|
124
139
|
spliceFields(index: number, deleteCount: number, ...fields: APIEmbedField[]): this;
|
|
125
140
|
/**
|
|
126
141
|
* Sets the embed's fields (max 25).
|
|
127
|
-
*
|
|
128
|
-
* @param fields - The fields to set
|
|
142
|
+
* @param fields The fields to set
|
|
129
143
|
*/
|
|
130
144
|
setFields(...fields: RestOrArray<APIEmbedField>): this;
|
|
131
145
|
/**
|
|
132
146
|
* Sets the author of this embed
|
|
133
147
|
*
|
|
134
|
-
* @param options
|
|
148
|
+
* @param options The options for the author
|
|
135
149
|
*/
|
|
136
150
|
setAuthor(options: EmbedAuthorOptions | null): this;
|
|
137
151
|
/**
|
|
138
152
|
* Sets the color of this embed
|
|
139
153
|
*
|
|
140
|
-
* @param color
|
|
154
|
+
* @param color The color of the embed
|
|
141
155
|
*/
|
|
142
156
|
setColor(color: number | RGBTuple | null): this;
|
|
143
157
|
/**
|
|
144
158
|
* Sets the description of this embed
|
|
145
159
|
*
|
|
146
|
-
* @param description
|
|
160
|
+
* @param description The description
|
|
147
161
|
*/
|
|
148
162
|
setDescription(description: string | null): this;
|
|
149
163
|
/**
|
|
150
164
|
* Sets the footer of this embed
|
|
151
165
|
*
|
|
152
|
-
* @param options
|
|
166
|
+
* @param options The options for the footer
|
|
153
167
|
*/
|
|
154
168
|
setFooter(options: EmbedFooterOptions | null): this;
|
|
155
169
|
/**
|
|
156
170
|
* Sets the image of this embed
|
|
157
171
|
*
|
|
158
|
-
* @param url
|
|
172
|
+
* @param url The URL of the image
|
|
159
173
|
*/
|
|
160
174
|
setImage(url: string | null): this;
|
|
161
175
|
/**
|
|
162
176
|
* Sets the thumbnail of this embed
|
|
163
177
|
*
|
|
164
|
-
* @param url
|
|
178
|
+
* @param url The URL of the thumbnail
|
|
165
179
|
*/
|
|
166
180
|
setThumbnail(url: string | null): this;
|
|
167
181
|
/**
|
|
168
182
|
* Sets the timestamp of this embed
|
|
169
183
|
*
|
|
170
|
-
* @param timestamp
|
|
184
|
+
* @param timestamp The timestamp or date
|
|
171
185
|
*/
|
|
172
186
|
setTimestamp(timestamp?: number | Date | null): this;
|
|
173
187
|
/**
|
|
174
188
|
* Sets the title of this embed
|
|
175
189
|
*
|
|
176
|
-
* @param title
|
|
190
|
+
* @param title The title
|
|
177
191
|
*/
|
|
178
192
|
setTitle(title: string | null): this;
|
|
179
193
|
/**
|
|
180
194
|
* Sets the URL of this embed
|
|
181
195
|
*
|
|
182
|
-
* @param url
|
|
196
|
+
* @param url The URL
|
|
183
197
|
*/
|
|
184
198
|
setURL(url: string | null): this;
|
|
185
199
|
/**
|
|
@@ -188,23 +202,6 @@ declare class UnsafeEmbedBuilder {
|
|
|
188
202
|
toJSON(): APIEmbed;
|
|
189
203
|
}
|
|
190
204
|
|
|
191
|
-
/**
|
|
192
|
-
* Represents a validated embed in a message (image/video preview, rich embed, etc.)
|
|
193
|
-
*/
|
|
194
|
-
declare class EmbedBuilder extends UnsafeEmbedBuilder {
|
|
195
|
-
addFields(...fields: RestOrArray<APIEmbedField>): this;
|
|
196
|
-
spliceFields(index: number, deleteCount: number, ...fields: APIEmbedField[]): this;
|
|
197
|
-
setAuthor(options: EmbedAuthorOptions | null): this;
|
|
198
|
-
setColor(color: number | RGBTuple | null): this;
|
|
199
|
-
setDescription(description: string | null): this;
|
|
200
|
-
setFooter(options: EmbedFooterOptions | null): this;
|
|
201
|
-
setImage(url: string | null): this;
|
|
202
|
-
setThumbnail(url: string | null): this;
|
|
203
|
-
setTimestamp(timestamp?: number | Date | null): this;
|
|
204
|
-
setTitle(title: string | null): this;
|
|
205
|
-
setURL(url: string | null): this;
|
|
206
|
-
}
|
|
207
|
-
|
|
208
205
|
/**
|
|
209
206
|
* Wraps the content inside a codeblock with no language
|
|
210
207
|
*
|
|
@@ -421,9 +418,9 @@ declare enum Faces {
|
|
|
421
418
|
}
|
|
422
419
|
|
|
423
420
|
/**
|
|
424
|
-
* Represents a
|
|
421
|
+
* Represents a option within a select menu component
|
|
425
422
|
*/
|
|
426
|
-
declare class
|
|
423
|
+
declare class SelectMenuOptionBuilder {
|
|
427
424
|
data: Partial<APISelectMenuOption>;
|
|
428
425
|
constructor(data?: Partial<APISelectMenuOption>);
|
|
429
426
|
/**
|
|
@@ -439,7 +436,7 @@ declare class UnsafeSelectMenuOptionBuilder {
|
|
|
439
436
|
*/
|
|
440
437
|
setValue(value: string): this;
|
|
441
438
|
/**
|
|
442
|
-
* Sets the description of this option
|
|
439
|
+
* Sets the description of this option
|
|
443
440
|
*
|
|
444
441
|
* @param description - The description of this option
|
|
445
442
|
*/
|
|
@@ -459,53 +456,56 @@ declare class UnsafeSelectMenuOptionBuilder {
|
|
|
459
456
|
toJSON(): APISelectMenuOption;
|
|
460
457
|
}
|
|
461
458
|
|
|
462
|
-
/**
|
|
463
|
-
* Represents a validated option within a select menu component
|
|
464
|
-
*/
|
|
465
|
-
declare class SelectMenuOptionBuilder extends UnsafeSelectMenuOptionBuilder {
|
|
466
|
-
setDescription(description: string): this;
|
|
467
|
-
setDefault(isDefault?: boolean): this;
|
|
468
|
-
setEmoji(emoji: APIMessageComponentEmoji): this;
|
|
469
|
-
toJSON(): APISelectMenuOption;
|
|
470
|
-
}
|
|
471
|
-
|
|
472
459
|
declare const customIdValidator: _sapphire_shapeshift.StringValidator<string>;
|
|
473
460
|
declare const emojiValidator: _sapphire_shapeshift.ObjectValidator<{
|
|
474
|
-
id
|
|
475
|
-
name
|
|
476
|
-
animated
|
|
477
|
-
}
|
|
461
|
+
id?: string | undefined;
|
|
462
|
+
name?: string | undefined;
|
|
463
|
+
animated?: boolean | undefined;
|
|
464
|
+
}, _sapphire_shapeshift.UndefinedToOptional<{
|
|
465
|
+
id?: string | undefined;
|
|
466
|
+
name?: string | undefined;
|
|
467
|
+
animated?: boolean | undefined;
|
|
468
|
+
}>>;
|
|
478
469
|
declare const disabledValidator: _sapphire_shapeshift.BooleanValidator<boolean>;
|
|
479
470
|
declare const buttonLabelValidator: _sapphire_shapeshift.StringValidator<string>;
|
|
480
471
|
declare const buttonStyleValidator: _sapphire_shapeshift.NativeEnumValidator<typeof ButtonStyle>;
|
|
481
472
|
declare const placeholderValidator$1: _sapphire_shapeshift.StringValidator<string>;
|
|
482
473
|
declare const minMaxValidator: _sapphire_shapeshift.NumberValidator<number>;
|
|
483
474
|
declare const labelValueDescriptionValidator: _sapphire_shapeshift.StringValidator<string>;
|
|
484
|
-
declare const optionValidator: _sapphire_shapeshift.UnionValidator<
|
|
475
|
+
declare const optionValidator: _sapphire_shapeshift.UnionValidator<SelectMenuOptionBuilder | _sapphire_shapeshift.UndefinedToOptional<{
|
|
476
|
+
label: string;
|
|
477
|
+
value: string;
|
|
478
|
+
description: string | undefined;
|
|
479
|
+
emoji: _sapphire_shapeshift.UndefinedToOptional<{
|
|
480
|
+
id?: string | undefined;
|
|
481
|
+
name?: string | undefined;
|
|
482
|
+
animated?: boolean | undefined;
|
|
483
|
+
}> | undefined;
|
|
484
|
+
default: boolean | undefined;
|
|
485
|
+
}>>;
|
|
486
|
+
declare const optionsValidator: _sapphire_shapeshift.ArrayValidator<(SelectMenuOptionBuilder | _sapphire_shapeshift.UndefinedToOptional<{
|
|
485
487
|
label: string;
|
|
486
488
|
value: string;
|
|
487
489
|
description: string | undefined;
|
|
488
|
-
emoji: {
|
|
489
|
-
id
|
|
490
|
-
name
|
|
491
|
-
animated
|
|
492
|
-
} | undefined;
|
|
490
|
+
emoji: _sapphire_shapeshift.UndefinedToOptional<{
|
|
491
|
+
id?: string | undefined;
|
|
492
|
+
name?: string | undefined;
|
|
493
|
+
animated?: boolean | undefined;
|
|
494
|
+
}> | undefined;
|
|
493
495
|
default: boolean | undefined;
|
|
494
|
-
}
|
|
495
|
-
declare const optionsValidator: _sapphire_shapeshift.BaseValidator<(UnsafeSelectMenuOptionBuilder | {
|
|
496
|
+
}>)[], SelectMenuOptionBuilder | _sapphire_shapeshift.UndefinedToOptional<{
|
|
496
497
|
label: string;
|
|
497
498
|
value: string;
|
|
498
499
|
description: string | undefined;
|
|
499
|
-
emoji: {
|
|
500
|
-
id
|
|
501
|
-
name
|
|
502
|
-
animated
|
|
503
|
-
} | undefined;
|
|
500
|
+
emoji: _sapphire_shapeshift.UndefinedToOptional<{
|
|
501
|
+
id?: string | undefined;
|
|
502
|
+
name?: string | undefined;
|
|
503
|
+
animated?: boolean | undefined;
|
|
504
|
+
}> | undefined;
|
|
504
505
|
default: boolean | undefined;
|
|
505
|
-
}
|
|
506
|
+
}>>;
|
|
506
507
|
declare const optionsLengthValidator: _sapphire_shapeshift.NumberValidator<number>;
|
|
507
508
|
declare function validateRequiredSelectMenuParameters(options: SelectMenuOptionBuilder[], customId?: string): void;
|
|
508
|
-
declare const labelValueValidator: _sapphire_shapeshift.StringValidator<string>;
|
|
509
509
|
declare const defaultValidator: _sapphire_shapeshift.BooleanValidator<boolean>;
|
|
510
510
|
declare function validateRequiredSelectMenuOptionParameters(label?: string, value?: string): void;
|
|
511
511
|
declare const urlValidator: _sapphire_shapeshift.StringValidator<string>;
|
|
@@ -522,7 +522,6 @@ declare const Assertions$4_optionValidator: typeof optionValidator;
|
|
|
522
522
|
declare const Assertions$4_optionsValidator: typeof optionsValidator;
|
|
523
523
|
declare const Assertions$4_optionsLengthValidator: typeof optionsLengthValidator;
|
|
524
524
|
declare const Assertions$4_validateRequiredSelectMenuParameters: typeof validateRequiredSelectMenuParameters;
|
|
525
|
-
declare const Assertions$4_labelValueValidator: typeof labelValueValidator;
|
|
526
525
|
declare const Assertions$4_defaultValidator: typeof defaultValidator;
|
|
527
526
|
declare const Assertions$4_validateRequiredSelectMenuOptionParameters: typeof validateRequiredSelectMenuOptionParameters;
|
|
528
527
|
declare const Assertions$4_urlValidator: typeof urlValidator;
|
|
@@ -541,7 +540,6 @@ declare namespace Assertions$4 {
|
|
|
541
540
|
Assertions$4_optionsValidator as optionsValidator,
|
|
542
541
|
Assertions$4_optionsLengthValidator as optionsLengthValidator,
|
|
543
542
|
Assertions$4_validateRequiredSelectMenuParameters as validateRequiredSelectMenuParameters,
|
|
544
|
-
Assertions$4_labelValueValidator as labelValueValidator,
|
|
545
543
|
Assertions$4_defaultValidator as defaultValidator,
|
|
546
544
|
Assertions$4_validateRequiredSelectMenuOptionParameters as validateRequiredSelectMenuOptionParameters,
|
|
547
545
|
Assertions$4_urlValidator as urlValidator,
|
|
@@ -574,39 +572,10 @@ declare abstract class ComponentBuilder<DataType extends Partial<APIBaseComponen
|
|
|
574
572
|
constructor(data: Partial<DataType>);
|
|
575
573
|
}
|
|
576
574
|
|
|
577
|
-
declare type MessageComponentBuilder = MessageActionRowComponentBuilder | ActionRowBuilder<MessageActionRowComponentBuilder>;
|
|
578
|
-
declare type ModalComponentBuilder = ModalActionRowComponentBuilder | ActionRowBuilder<ModalActionRowComponentBuilder>;
|
|
579
|
-
declare type MessageActionRowComponentBuilder = ButtonBuilder | SelectMenuBuilder;
|
|
580
|
-
declare type ModalActionRowComponentBuilder = TextInputBuilder;
|
|
581
|
-
declare type AnyComponentBuilder = MessageActionRowComponentBuilder | ModalActionRowComponentBuilder;
|
|
582
575
|
/**
|
|
583
|
-
* Represents
|
|
576
|
+
* Represents a button component
|
|
584
577
|
*/
|
|
585
|
-
declare class
|
|
586
|
-
/**
|
|
587
|
-
* The components within this action row
|
|
588
|
-
*/
|
|
589
|
-
readonly components: T[];
|
|
590
|
-
constructor({ components, ...data }?: Partial<APIActionRowComponent<APIActionRowComponentTypes>>);
|
|
591
|
-
/**
|
|
592
|
-
* Adds components to this action row.
|
|
593
|
-
*
|
|
594
|
-
* @param components - The components to add to this action row.
|
|
595
|
-
*/
|
|
596
|
-
addComponents(...components: RestOrArray<T>): this;
|
|
597
|
-
/**
|
|
598
|
-
* Sets the components in this action row
|
|
599
|
-
*
|
|
600
|
-
* @param components - The components to set this row to
|
|
601
|
-
*/
|
|
602
|
-
setComponents(...components: RestOrArray<T>): this;
|
|
603
|
-
toJSON(): APIActionRowComponent<ReturnType<T['toJSON']>>;
|
|
604
|
-
}
|
|
605
|
-
|
|
606
|
-
/**
|
|
607
|
-
* Represents a non-validated button component
|
|
608
|
-
*/
|
|
609
|
-
declare class UnsafeButtonBuilder extends ComponentBuilder<APIButtonComponent> {
|
|
578
|
+
declare class ButtonBuilder extends ComponentBuilder<APIButtonComponent> {
|
|
610
579
|
constructor(data?: Partial<APIButtonComponent>);
|
|
611
580
|
/**
|
|
612
581
|
* Sets the style of this button
|
|
@@ -621,7 +590,7 @@ declare class UnsafeButtonBuilder extends ComponentBuilder<APIButtonComponent> {
|
|
|
621
590
|
*/
|
|
622
591
|
setURL(url: string): this;
|
|
623
592
|
/**
|
|
624
|
-
* Sets the custom
|
|
593
|
+
* Sets the custom id for this button
|
|
625
594
|
*
|
|
626
595
|
* @param customId - The custom id to use for this button
|
|
627
596
|
*/
|
|
@@ -633,9 +602,9 @@ declare class UnsafeButtonBuilder extends ComponentBuilder<APIButtonComponent> {
|
|
|
633
602
|
*/
|
|
634
603
|
setEmoji(emoji: APIMessageComponentEmoji): this;
|
|
635
604
|
/**
|
|
636
|
-
* Sets whether this button is
|
|
605
|
+
* Sets whether this button is disabled
|
|
637
606
|
*
|
|
638
|
-
* @param disabled - Whether
|
|
607
|
+
* @param disabled - Whether to disable this button
|
|
639
608
|
*/
|
|
640
609
|
setDisabled(disabled?: boolean): this;
|
|
641
610
|
/**
|
|
@@ -648,35 +617,61 @@ declare class UnsafeButtonBuilder extends ComponentBuilder<APIButtonComponent> {
|
|
|
648
617
|
}
|
|
649
618
|
|
|
650
619
|
/**
|
|
651
|
-
* Represents a
|
|
620
|
+
* Represents a select menu component
|
|
652
621
|
*/
|
|
653
|
-
declare class
|
|
654
|
-
|
|
655
|
-
|
|
622
|
+
declare class SelectMenuBuilder extends ComponentBuilder<APISelectMenuComponent> {
|
|
623
|
+
/**
|
|
624
|
+
* The options within this select menu
|
|
625
|
+
*/
|
|
626
|
+
readonly options: SelectMenuOptionBuilder[];
|
|
627
|
+
constructor(data?: Partial<APISelectMenuComponent>);
|
|
628
|
+
/**
|
|
629
|
+
* Sets the placeholder for this select menu
|
|
630
|
+
*
|
|
631
|
+
* @param placeholder - The placeholder to use for this select menu
|
|
632
|
+
*/
|
|
633
|
+
setPlaceholder(placeholder: string): this;
|
|
634
|
+
/**
|
|
635
|
+
* Sets the minimum values that must be selected in the select menu
|
|
636
|
+
*
|
|
637
|
+
* @param minValues - The minimum values that must be selected
|
|
638
|
+
*/
|
|
639
|
+
setMinValues(minValues: number): this;
|
|
640
|
+
/**
|
|
641
|
+
* Sets the maximum values that must be selected in the select menu
|
|
642
|
+
*
|
|
643
|
+
* @param maxValues - The maximum values that must be selected
|
|
644
|
+
*/
|
|
645
|
+
setMaxValues(maxValues: number): this;
|
|
646
|
+
/**
|
|
647
|
+
* Sets the custom id for this select menu
|
|
648
|
+
*
|
|
649
|
+
* @param customId - The custom id to use for this select menu
|
|
650
|
+
*/
|
|
656
651
|
setCustomId(customId: string): this;
|
|
657
|
-
|
|
652
|
+
/**
|
|
653
|
+
* Sets whether this select menu is disabled
|
|
654
|
+
*
|
|
655
|
+
* @param disabled - Whether this select menu is disabled
|
|
656
|
+
*/
|
|
658
657
|
setDisabled(disabled?: boolean): this;
|
|
659
|
-
|
|
660
|
-
|
|
658
|
+
/**
|
|
659
|
+
* Adds options to this select menu
|
|
660
|
+
*
|
|
661
|
+
* @param options - The options to add to this select menu
|
|
662
|
+
* @returns
|
|
663
|
+
*/
|
|
664
|
+
addOptions(...options: RestOrArray<SelectMenuOptionBuilder | APISelectMenuOption>): this;
|
|
665
|
+
/**
|
|
666
|
+
* Sets the options on this select menu
|
|
667
|
+
*
|
|
668
|
+
* @param options - The options to set on this select menu
|
|
669
|
+
*/
|
|
670
|
+
setOptions(...options: RestOrArray<SelectMenuOptionBuilder | APISelectMenuOption>): this;
|
|
671
|
+
toJSON(): APISelectMenuComponent;
|
|
661
672
|
}
|
|
662
673
|
|
|
663
|
-
|
|
664
|
-
[ComponentType.ActionRow]: ActionRowBuilder<AnyComponentBuilder>;
|
|
665
|
-
[ComponentType.Button]: ButtonBuilder;
|
|
666
|
-
[ComponentType.SelectMenu]: SelectMenuBuilder;
|
|
667
|
-
[ComponentType.TextInput]: TextInputBuilder;
|
|
668
|
-
}
|
|
669
|
-
/**
|
|
670
|
-
* Factory for creating components from API data
|
|
671
|
-
*
|
|
672
|
-
* @param data - The api data to transform to a component class
|
|
673
|
-
*/
|
|
674
|
-
declare function createComponentBuilder<T extends keyof MappedComponentTypes>(data: (APIMessageComponent | APIModalComponent) & {
|
|
675
|
-
type: T;
|
|
676
|
-
}): MappedComponentTypes[T];
|
|
677
|
-
declare function createComponentBuilder<C extends MessageComponentBuilder | ModalComponentBuilder>(data: C): C;
|
|
678
|
-
|
|
679
|
-
declare class UnsafeTextInputBuilder extends ComponentBuilder<APITextInputComponent> {
|
|
674
|
+
declare class TextInputBuilder extends ComponentBuilder<APITextInputComponent> {
|
|
680
675
|
constructor(data?: APITextInputComponent & {
|
|
681
676
|
type?: ComponentType.TextInput;
|
|
682
677
|
});
|
|
@@ -723,27 +718,60 @@ declare class UnsafeTextInputBuilder extends ComponentBuilder<APITextInputCompon
|
|
|
723
718
|
*/
|
|
724
719
|
setValue(value: string): this;
|
|
725
720
|
/**
|
|
726
|
-
* Sets whether this text input is required
|
|
721
|
+
* Sets whether this text input is required
|
|
727
722
|
*
|
|
728
|
-
* @param required - Whether this text input is required
|
|
723
|
+
* @param required - Whether this text input is required
|
|
729
724
|
*/
|
|
730
725
|
setRequired(required?: boolean): this;
|
|
731
726
|
toJSON(): APITextInputComponent;
|
|
732
|
-
equals(other:
|
|
727
|
+
equals(other: JSONEncodable<APITextInputComponent> | APITextInputComponent): boolean;
|
|
733
728
|
}
|
|
734
729
|
|
|
735
|
-
declare
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
730
|
+
declare type MessageComponentBuilder = MessageActionRowComponentBuilder | ActionRowBuilder<MessageActionRowComponentBuilder>;
|
|
731
|
+
declare type ModalComponentBuilder = ModalActionRowComponentBuilder | ActionRowBuilder<ModalActionRowComponentBuilder>;
|
|
732
|
+
declare type MessageActionRowComponentBuilder = ButtonBuilder | SelectMenuBuilder;
|
|
733
|
+
declare type ModalActionRowComponentBuilder = TextInputBuilder;
|
|
734
|
+
declare type AnyComponentBuilder = MessageActionRowComponentBuilder | ModalActionRowComponentBuilder;
|
|
735
|
+
/**
|
|
736
|
+
* Represents an action row component
|
|
737
|
+
*/
|
|
738
|
+
declare class ActionRowBuilder<T extends AnyComponentBuilder> extends ComponentBuilder<APIActionRowComponent<APIMessageActionRowComponent | APIModalActionRowComponent>> {
|
|
739
|
+
/**
|
|
740
|
+
* The components within this action row
|
|
741
|
+
*/
|
|
742
|
+
readonly components: T[];
|
|
743
|
+
constructor({ components, ...data }?: Partial<APIActionRowComponent<APIActionRowComponentTypes>>);
|
|
744
|
+
/**
|
|
745
|
+
* Adds components to this action row.
|
|
746
|
+
*
|
|
747
|
+
* @param components - The components to add to this action row.
|
|
748
|
+
*/
|
|
749
|
+
addComponents(...components: RestOrArray<T>): this;
|
|
750
|
+
/**
|
|
751
|
+
* Sets the components in this action row
|
|
752
|
+
*
|
|
753
|
+
* @param components - The components to set this row to
|
|
754
|
+
*/
|
|
755
|
+
setComponents(...components: RestOrArray<T>): this;
|
|
756
|
+
toJSON(): APIActionRowComponent<ReturnType<T['toJSON']>>;
|
|
745
757
|
}
|
|
746
758
|
|
|
759
|
+
interface MappedComponentTypes {
|
|
760
|
+
[ComponentType.ActionRow]: ActionRowBuilder<AnyComponentBuilder>;
|
|
761
|
+
[ComponentType.Button]: ButtonBuilder;
|
|
762
|
+
[ComponentType.SelectMenu]: SelectMenuBuilder;
|
|
763
|
+
[ComponentType.TextInput]: TextInputBuilder;
|
|
764
|
+
}
|
|
765
|
+
/**
|
|
766
|
+
* Factory for creating components from API data
|
|
767
|
+
*
|
|
768
|
+
* @param data - The api data to transform to a component class
|
|
769
|
+
*/
|
|
770
|
+
declare function createComponentBuilder<T extends keyof MappedComponentTypes>(data: (APIMessageComponent | APIModalComponent) & {
|
|
771
|
+
type: T;
|
|
772
|
+
}): MappedComponentTypes[T];
|
|
773
|
+
declare function createComponentBuilder<C extends MessageComponentBuilder | ModalComponentBuilder>(data: C): C;
|
|
774
|
+
|
|
747
775
|
declare const textInputStyleValidator: _sapphire_shapeshift.NativeEnumValidator<typeof TextInputStyle>;
|
|
748
776
|
declare const minLengthValidator: _sapphire_shapeshift.NumberValidator<number>;
|
|
749
777
|
declare const maxLengthValidator: _sapphire_shapeshift.NumberValidator<number>;
|
|
@@ -773,7 +801,7 @@ declare namespace Assertions$3 {
|
|
|
773
801
|
};
|
|
774
802
|
}
|
|
775
803
|
|
|
776
|
-
declare class
|
|
804
|
+
declare class ModalBuilder implements JSONEncodable<APIModalInteractionResponseCallbackData> {
|
|
777
805
|
readonly data: Partial<APIModalInteractionResponseCallbackData>;
|
|
778
806
|
readonly components: ActionRowBuilder<ModalActionRowComponentBuilder>[];
|
|
779
807
|
constructor({ components, ...data }?: Partial<APIModalInteractionResponseCallbackData>);
|
|
@@ -804,14 +832,8 @@ declare class UnsafeModalBuilder implements JSONEncodable<APIModalInteractionRes
|
|
|
804
832
|
toJSON(): APIModalInteractionResponseCallbackData;
|
|
805
833
|
}
|
|
806
834
|
|
|
807
|
-
declare class ModalBuilder extends UnsafeModalBuilder {
|
|
808
|
-
setCustomId(customId: string): this;
|
|
809
|
-
setTitle(title: string): this;
|
|
810
|
-
toJSON(): APIModalInteractionResponseCallbackData;
|
|
811
|
-
}
|
|
812
|
-
|
|
813
835
|
declare const titleValidator: _sapphire_shapeshift.StringValidator<string>;
|
|
814
|
-
declare const componentsValidator: _sapphire_shapeshift.
|
|
836
|
+
declare const componentsValidator: _sapphire_shapeshift.ArrayValidator<[ActionRowBuilder<AnyComponentBuilder>, ...ActionRowBuilder<AnyComponentBuilder>[]], ActionRowBuilder<AnyComponentBuilder>>;
|
|
815
837
|
declare function validateRequiredParameters$2(customId?: string, title?: string, components?: ActionRowBuilder<ModalActionRowComponentBuilder>[]): void;
|
|
816
838
|
|
|
817
839
|
declare const Assertions$2_titleValidator: typeof titleValidator;
|
|
@@ -824,74 +846,6 @@ declare namespace Assertions$2 {
|
|
|
824
846
|
};
|
|
825
847
|
}
|
|
826
848
|
|
|
827
|
-
/**
|
|
828
|
-
* Represents a non-validated select menu component
|
|
829
|
-
*/
|
|
830
|
-
declare class UnsafeSelectMenuBuilder extends ComponentBuilder<APISelectMenuComponent> {
|
|
831
|
-
/**
|
|
832
|
-
* The options within this select menu
|
|
833
|
-
*/
|
|
834
|
-
readonly options: UnsafeSelectMenuOptionBuilder[];
|
|
835
|
-
constructor(data?: Partial<APISelectMenuComponent>);
|
|
836
|
-
/**
|
|
837
|
-
* Sets the placeholder for this select menu
|
|
838
|
-
*
|
|
839
|
-
* @param placeholder - The placeholder to use for this select menu
|
|
840
|
-
*/
|
|
841
|
-
setPlaceholder(placeholder: string): this;
|
|
842
|
-
/**
|
|
843
|
-
* Sets the minimum values that must be selected in the select menu
|
|
844
|
-
*
|
|
845
|
-
* @param minValues - The minimum values that must be selected
|
|
846
|
-
*/
|
|
847
|
-
setMinValues(minValues: number): this;
|
|
848
|
-
/**
|
|
849
|
-
* Sets the maximum values that must be selected in the select menu
|
|
850
|
-
*
|
|
851
|
-
* @param minValues - The maximum values that must be selected
|
|
852
|
-
*/
|
|
853
|
-
setMaxValues(maxValues: number): this;
|
|
854
|
-
/**
|
|
855
|
-
* Sets the custom Id for this select menu
|
|
856
|
-
*
|
|
857
|
-
* @param customId - The custom id to use for this select menu
|
|
858
|
-
*/
|
|
859
|
-
setCustomId(customId: string): this;
|
|
860
|
-
/**
|
|
861
|
-
* Sets whether or not this select menu is disabled
|
|
862
|
-
*
|
|
863
|
-
* @param disabled - Whether or not this select menu is disabled
|
|
864
|
-
*/
|
|
865
|
-
setDisabled(disabled?: boolean): this;
|
|
866
|
-
/**
|
|
867
|
-
* Adds options to this select menu
|
|
868
|
-
*
|
|
869
|
-
* @param options - The options to add to this select menu
|
|
870
|
-
*/
|
|
871
|
-
addOptions(...options: RestOrArray<UnsafeSelectMenuOptionBuilder | APISelectMenuOption>): this;
|
|
872
|
-
/**
|
|
873
|
-
* Sets the options on this select menu
|
|
874
|
-
*
|
|
875
|
-
* @param options - The options to set on this select menu
|
|
876
|
-
*/
|
|
877
|
-
setOptions(...options: RestOrArray<UnsafeSelectMenuOptionBuilder | APISelectMenuOption>): this;
|
|
878
|
-
toJSON(): APISelectMenuComponent;
|
|
879
|
-
}
|
|
880
|
-
|
|
881
|
-
/**
|
|
882
|
-
* Represents a validated select menu component
|
|
883
|
-
*/
|
|
884
|
-
declare class SelectMenuBuilder extends UnsafeSelectMenuBuilder {
|
|
885
|
-
setPlaceholder(placeholder: string): this;
|
|
886
|
-
setMinValues(minValues: number): this;
|
|
887
|
-
setMaxValues(maxValues: number): this;
|
|
888
|
-
setCustomId(customId: string): this;
|
|
889
|
-
setDisabled(disabled?: boolean): this;
|
|
890
|
-
addOptions(...options: RestOrArray<UnsafeSelectMenuOptionBuilder | APISelectMenuOption>): this;
|
|
891
|
-
setOptions(...options: RestOrArray<UnsafeSelectMenuOptionBuilder | APISelectMenuOption>): this;
|
|
892
|
-
toJSON(): APISelectMenuComponent;
|
|
893
|
-
}
|
|
894
|
-
|
|
895
849
|
declare class SharedNameAndDescription {
|
|
896
850
|
readonly name: string;
|
|
897
851
|
readonly name_localizations?: LocalizationMap;
|
|
@@ -1044,6 +998,20 @@ declare class SlashCommandRoleOption extends ApplicationCommandOptionBase {
|
|
|
1044
998
|
|
|
1045
999
|
declare class SlashCommandStringOption extends ApplicationCommandOptionBase {
|
|
1046
1000
|
readonly type: ApplicationCommandOptionType.String;
|
|
1001
|
+
readonly max_length?: number;
|
|
1002
|
+
readonly min_length?: number;
|
|
1003
|
+
/**
|
|
1004
|
+
* Sets the maximum length of this string option.
|
|
1005
|
+
*
|
|
1006
|
+
* @param max - The maximum length this option can be
|
|
1007
|
+
*/
|
|
1008
|
+
setMaxLength(max: number): this;
|
|
1009
|
+
/**
|
|
1010
|
+
* Sets the minimum length of this string option.
|
|
1011
|
+
*
|
|
1012
|
+
* @param min - The minimum length this option can be
|
|
1013
|
+
*/
|
|
1014
|
+
setMinLength(min: number): this;
|
|
1047
1015
|
toJSON(): APIApplicationCommandStringOption;
|
|
1048
1016
|
}
|
|
1049
1017
|
interface SlashCommandStringOption extends ApplicationCommandOptionWithChoicesAndAutocompleteMixin<string> {
|
|
@@ -1269,38 +1237,7 @@ declare function validateDefaultPermission$1(value: unknown): asserts value is b
|
|
|
1269
1237
|
declare function validateRequired(required: unknown): asserts required is boolean;
|
|
1270
1238
|
declare function validateChoicesLength(amountAdding: number, choices?: APIApplicationCommandOptionChoice[]): void;
|
|
1271
1239
|
declare function assertReturnOfBuilder<T extends ApplicationCommandOptionBase | SlashCommandSubcommandBuilder | SlashCommandSubcommandGroupBuilder>(input: unknown, ExpectedInstanceOf: new () => T): asserts input is T;
|
|
1272
|
-
declare const localizationMapPredicate: _sapphire_shapeshift.UnionValidator<
|
|
1273
|
-
"en-US": string | null;
|
|
1274
|
-
"en-GB": string | null;
|
|
1275
|
-
bg: string | null;
|
|
1276
|
-
"zh-CN": string | null;
|
|
1277
|
-
"zh-TW": string | null;
|
|
1278
|
-
hr: string | null;
|
|
1279
|
-
cs: string | null;
|
|
1280
|
-
da: string | null;
|
|
1281
|
-
nl: string | null;
|
|
1282
|
-
fi: string | null;
|
|
1283
|
-
fr: string | null;
|
|
1284
|
-
de: string | null;
|
|
1285
|
-
el: string | null;
|
|
1286
|
-
hi: string | null;
|
|
1287
|
-
hu: string | null;
|
|
1288
|
-
it: string | null;
|
|
1289
|
-
ja: string | null;
|
|
1290
|
-
ko: string | null;
|
|
1291
|
-
lt: string | null;
|
|
1292
|
-
no: string | null;
|
|
1293
|
-
pl: string | null;
|
|
1294
|
-
"pt-BR": string | null;
|
|
1295
|
-
ro: string | null;
|
|
1296
|
-
ru: string | null;
|
|
1297
|
-
"es-ES": string | null;
|
|
1298
|
-
"sv-SE": string | null;
|
|
1299
|
-
th: string | null;
|
|
1300
|
-
tr: string | null;
|
|
1301
|
-
uk: string | null;
|
|
1302
|
-
vi: string | null;
|
|
1303
|
-
} | null | undefined>;
|
|
1240
|
+
declare const localizationMapPredicate: _sapphire_shapeshift.UnionValidator<_sapphire_shapeshift.UndefinedToOptional<Partial<Record<"en-US" | "en-GB" | "bg" | "zh-CN" | "zh-TW" | "hr" | "cs" | "da" | "nl" | "fi" | "fr" | "de" | "el" | "hi" | "hu" | "it" | "ja" | "ko" | "lt" | "no" | "pl" | "pt-BR" | "ro" | "ru" | "es-ES" | "sv-SE" | "th" | "tr" | "uk" | "vi", string | null>>> | null | undefined>;
|
|
1304
1241
|
declare function validateLocalizationMap(value: unknown): asserts value is LocalizationMap;
|
|
1305
1242
|
declare function validateDMPermission$1(value: unknown): asserts value is boolean | null | undefined;
|
|
1306
1243
|
declare function validateDefaultMemberPermissions$1(permissions: unknown): string | null | undefined;
|
|
@@ -1462,4 +1399,8 @@ declare function isEquatable(maybeEquatable: unknown): maybeEquatable is Equatab
|
|
|
1462
1399
|
|
|
1463
1400
|
declare function embedLength(data: APIEmbed): number;
|
|
1464
1401
|
|
|
1465
|
-
|
|
1402
|
+
declare const enableValidators: () => boolean;
|
|
1403
|
+
declare const disableValidators: () => boolean;
|
|
1404
|
+
declare const isValidationEnabled: () => boolean;
|
|
1405
|
+
|
|
1406
|
+
export { ActionRowBuilder, AnyAPIActionRowComponent, AnyComponentBuilder, ApplicationCommandNumericOptionMinMaxValueMixin, ApplicationCommandOptionAllowedChannelTypes, ApplicationCommandOptionBase, ApplicationCommandOptionChannelTypesMixin, ApplicationCommandOptionWithChoicesAndAutocompleteMixin, ButtonBuilder, Assertions$4 as ComponentAssertions, ComponentBuilder, Assertions as ContextMenuCommandAssertions, ContextMenuCommandBuilder, ContextMenuCommandType, Assertions$5 as EmbedAssertions, EmbedAuthorData, EmbedAuthorOptions, EmbedBuilder, EmbedFooterData, EmbedFooterOptions, EmbedImageData, Equatable, Faces, IconData, JSONEncodable, MappedComponentTypes, MessageActionRowComponentBuilder, MessageComponentBuilder, ModalActionRowComponentBuilder, Assertions$2 as ModalAssertions, ModalBuilder, ModalComponentBuilder, RGBTuple, RestOrArray, SelectMenuBuilder, SelectMenuOptionBuilder, SharedNameAndDescription, SharedSlashCommandOptions, Assertions$1 as SlashCommandAssertions, SlashCommandAttachmentOption, SlashCommandBooleanOption, SlashCommandBuilder, SlashCommandChannelOption, SlashCommandIntegerOption, SlashCommandMentionableOption, SlashCommandNumberOption, SlashCommandOptionsOnlyBuilder, SlashCommandRoleOption, SlashCommandStringOption, SlashCommandSubcommandBuilder, SlashCommandSubcommandGroupBuilder, SlashCommandSubcommandsOnlyBuilder, SlashCommandUserOption, Assertions$3 as TextInputAssertions, TextInputBuilder, TimestampStyles, TimestampStylesString, ToAPIApplicationCommandOptions, blockQuote, bold, channelMention, codeBlock, createComponentBuilder, disableValidators, embedLength, enableValidators, formatEmoji, hideLinkEmbed, hyperlink, inlineCode, isEquatable, isJSONEncodable, isValidationEnabled, italic, normalizeArray, quote, roleMention, spoiler, strikethrough, time, underscore, userMention };
|