@discordjs/builders 0.16.0-dev.1657109073-8198da5 → 0.16.0-dev.1657325364-33ae7df
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 +144 -201
- 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 +2 -2
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
|
|
|
@@ -118,83 +118,82 @@ interface EmbedImageData extends Omit<APIEmbedImage, 'proxy_url'> {
|
|
|
118
118
|
proxyURL?: string;
|
|
119
119
|
}
|
|
120
120
|
/**
|
|
121
|
-
* Represents a
|
|
121
|
+
* Represents a embed in a message (image/video preview, rich embed, etc.)
|
|
122
122
|
*/
|
|
123
|
-
declare class
|
|
123
|
+
declare class EmbedBuilder {
|
|
124
124
|
readonly data: APIEmbed;
|
|
125
125
|
constructor(data?: APIEmbed);
|
|
126
126
|
/**
|
|
127
127
|
* Adds fields to the embed (max 25)
|
|
128
128
|
*
|
|
129
|
-
* @param fields
|
|
129
|
+
* @param fields The fields to add
|
|
130
130
|
*/
|
|
131
131
|
addFields(...fields: RestOrArray<APIEmbedField>): this;
|
|
132
132
|
/**
|
|
133
133
|
* Removes, replaces, or inserts fields in the embed (max 25)
|
|
134
134
|
*
|
|
135
|
-
* @param index
|
|
136
|
-
* @param deleteCount
|
|
137
|
-
* @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
|
|
138
138
|
*/
|
|
139
139
|
spliceFields(index: number, deleteCount: number, ...fields: APIEmbedField[]): this;
|
|
140
140
|
/**
|
|
141
141
|
* Sets the embed's fields (max 25).
|
|
142
|
-
*
|
|
143
|
-
* @param fields - The fields to set
|
|
142
|
+
* @param fields The fields to set
|
|
144
143
|
*/
|
|
145
144
|
setFields(...fields: RestOrArray<APIEmbedField>): this;
|
|
146
145
|
/**
|
|
147
146
|
* Sets the author of this embed
|
|
148
147
|
*
|
|
149
|
-
* @param options
|
|
148
|
+
* @param options The options for the author
|
|
150
149
|
*/
|
|
151
150
|
setAuthor(options: EmbedAuthorOptions | null): this;
|
|
152
151
|
/**
|
|
153
152
|
* Sets the color of this embed
|
|
154
153
|
*
|
|
155
|
-
* @param color
|
|
154
|
+
* @param color The color of the embed
|
|
156
155
|
*/
|
|
157
156
|
setColor(color: number | RGBTuple | null): this;
|
|
158
157
|
/**
|
|
159
158
|
* Sets the description of this embed
|
|
160
159
|
*
|
|
161
|
-
* @param description
|
|
160
|
+
* @param description The description
|
|
162
161
|
*/
|
|
163
162
|
setDescription(description: string | null): this;
|
|
164
163
|
/**
|
|
165
164
|
* Sets the footer of this embed
|
|
166
165
|
*
|
|
167
|
-
* @param options
|
|
166
|
+
* @param options The options for the footer
|
|
168
167
|
*/
|
|
169
168
|
setFooter(options: EmbedFooterOptions | null): this;
|
|
170
169
|
/**
|
|
171
170
|
* Sets the image of this embed
|
|
172
171
|
*
|
|
173
|
-
* @param url
|
|
172
|
+
* @param url The URL of the image
|
|
174
173
|
*/
|
|
175
174
|
setImage(url: string | null): this;
|
|
176
175
|
/**
|
|
177
176
|
* Sets the thumbnail of this embed
|
|
178
177
|
*
|
|
179
|
-
* @param url
|
|
178
|
+
* @param url The URL of the thumbnail
|
|
180
179
|
*/
|
|
181
180
|
setThumbnail(url: string | null): this;
|
|
182
181
|
/**
|
|
183
182
|
* Sets the timestamp of this embed
|
|
184
183
|
*
|
|
185
|
-
* @param timestamp
|
|
184
|
+
* @param timestamp The timestamp or date
|
|
186
185
|
*/
|
|
187
186
|
setTimestamp(timestamp?: number | Date | null): this;
|
|
188
187
|
/**
|
|
189
188
|
* Sets the title of this embed
|
|
190
189
|
*
|
|
191
|
-
* @param title
|
|
190
|
+
* @param title The title
|
|
192
191
|
*/
|
|
193
192
|
setTitle(title: string | null): this;
|
|
194
193
|
/**
|
|
195
194
|
* Sets the URL of this embed
|
|
196
195
|
*
|
|
197
|
-
* @param url
|
|
196
|
+
* @param url The URL
|
|
198
197
|
*/
|
|
199
198
|
setURL(url: string | null): this;
|
|
200
199
|
/**
|
|
@@ -203,23 +202,6 @@ declare class UnsafeEmbedBuilder {
|
|
|
203
202
|
toJSON(): APIEmbed;
|
|
204
203
|
}
|
|
205
204
|
|
|
206
|
-
/**
|
|
207
|
-
* Represents a validated embed in a message (image/video preview, rich embed, etc.)
|
|
208
|
-
*/
|
|
209
|
-
declare class EmbedBuilder extends UnsafeEmbedBuilder {
|
|
210
|
-
addFields(...fields: RestOrArray<APIEmbedField>): this;
|
|
211
|
-
spliceFields(index: number, deleteCount: number, ...fields: APIEmbedField[]): this;
|
|
212
|
-
setAuthor(options: EmbedAuthorOptions | null): this;
|
|
213
|
-
setColor(color: number | RGBTuple | null): this;
|
|
214
|
-
setDescription(description: string | null): this;
|
|
215
|
-
setFooter(options: EmbedFooterOptions | null): this;
|
|
216
|
-
setImage(url: string | null): this;
|
|
217
|
-
setThumbnail(url: string | null): this;
|
|
218
|
-
setTimestamp(timestamp?: number | Date | null): this;
|
|
219
|
-
setTitle(title: string | null): this;
|
|
220
|
-
setURL(url: string | null): this;
|
|
221
|
-
}
|
|
222
|
-
|
|
223
205
|
/**
|
|
224
206
|
* Wraps the content inside a codeblock with no language
|
|
225
207
|
*
|
|
@@ -436,9 +418,9 @@ declare enum Faces {
|
|
|
436
418
|
}
|
|
437
419
|
|
|
438
420
|
/**
|
|
439
|
-
* Represents a
|
|
421
|
+
* Represents a option within a select menu component
|
|
440
422
|
*/
|
|
441
|
-
declare class
|
|
423
|
+
declare class SelectMenuOptionBuilder {
|
|
442
424
|
data: Partial<APISelectMenuOption>;
|
|
443
425
|
constructor(data?: Partial<APISelectMenuOption>);
|
|
444
426
|
/**
|
|
@@ -454,7 +436,7 @@ declare class UnsafeSelectMenuOptionBuilder {
|
|
|
454
436
|
*/
|
|
455
437
|
setValue(value: string): this;
|
|
456
438
|
/**
|
|
457
|
-
* Sets the description of this option
|
|
439
|
+
* Sets the description of this option
|
|
458
440
|
*
|
|
459
441
|
* @param description - The description of this option
|
|
460
442
|
*/
|
|
@@ -474,16 +456,6 @@ declare class UnsafeSelectMenuOptionBuilder {
|
|
|
474
456
|
toJSON(): APISelectMenuOption;
|
|
475
457
|
}
|
|
476
458
|
|
|
477
|
-
/**
|
|
478
|
-
* Represents a validated option within a select menu component
|
|
479
|
-
*/
|
|
480
|
-
declare class SelectMenuOptionBuilder extends UnsafeSelectMenuOptionBuilder {
|
|
481
|
-
setDescription(description: string): this;
|
|
482
|
-
setDefault(isDefault?: boolean): this;
|
|
483
|
-
setEmoji(emoji: APIMessageComponentEmoji): this;
|
|
484
|
-
toJSON(): APISelectMenuOption;
|
|
485
|
-
}
|
|
486
|
-
|
|
487
459
|
declare const customIdValidator: _sapphire_shapeshift.StringValidator<string>;
|
|
488
460
|
declare const emojiValidator: _sapphire_shapeshift.ObjectValidator<{
|
|
489
461
|
id?: string | undefined;
|
|
@@ -500,7 +472,7 @@ declare const buttonStyleValidator: _sapphire_shapeshift.NativeEnumValidator<typ
|
|
|
500
472
|
declare const placeholderValidator$1: _sapphire_shapeshift.StringValidator<string>;
|
|
501
473
|
declare const minMaxValidator: _sapphire_shapeshift.NumberValidator<number>;
|
|
502
474
|
declare const labelValueDescriptionValidator: _sapphire_shapeshift.StringValidator<string>;
|
|
503
|
-
declare const optionValidator: _sapphire_shapeshift.UnionValidator<
|
|
475
|
+
declare const optionValidator: _sapphire_shapeshift.UnionValidator<SelectMenuOptionBuilder | _sapphire_shapeshift.UndefinedToOptional<{
|
|
504
476
|
label: string;
|
|
505
477
|
value: string;
|
|
506
478
|
description: string | undefined;
|
|
@@ -511,7 +483,7 @@ declare const optionValidator: _sapphire_shapeshift.UnionValidator<UnsafeSelectM
|
|
|
511
483
|
}> | undefined;
|
|
512
484
|
default: boolean | undefined;
|
|
513
485
|
}>>;
|
|
514
|
-
declare const optionsValidator: _sapphire_shapeshift.ArrayValidator<(
|
|
486
|
+
declare const optionsValidator: _sapphire_shapeshift.ArrayValidator<(SelectMenuOptionBuilder | _sapphire_shapeshift.UndefinedToOptional<{
|
|
515
487
|
label: string;
|
|
516
488
|
value: string;
|
|
517
489
|
description: string | undefined;
|
|
@@ -521,7 +493,7 @@ declare const optionsValidator: _sapphire_shapeshift.ArrayValidator<(UnsafeSelec
|
|
|
521
493
|
animated?: boolean | undefined;
|
|
522
494
|
}> | undefined;
|
|
523
495
|
default: boolean | undefined;
|
|
524
|
-
}>)[],
|
|
496
|
+
}>)[], SelectMenuOptionBuilder | _sapphire_shapeshift.UndefinedToOptional<{
|
|
525
497
|
label: string;
|
|
526
498
|
value: string;
|
|
527
499
|
description: string | undefined;
|
|
@@ -534,7 +506,6 @@ declare const optionsValidator: _sapphire_shapeshift.ArrayValidator<(UnsafeSelec
|
|
|
534
506
|
}>>;
|
|
535
507
|
declare const optionsLengthValidator: _sapphire_shapeshift.NumberValidator<number>;
|
|
536
508
|
declare function validateRequiredSelectMenuParameters(options: SelectMenuOptionBuilder[], customId?: string): void;
|
|
537
|
-
declare const labelValueValidator: _sapphire_shapeshift.StringValidator<string>;
|
|
538
509
|
declare const defaultValidator: _sapphire_shapeshift.BooleanValidator<boolean>;
|
|
539
510
|
declare function validateRequiredSelectMenuOptionParameters(label?: string, value?: string): void;
|
|
540
511
|
declare const urlValidator: _sapphire_shapeshift.StringValidator<string>;
|
|
@@ -551,7 +522,6 @@ declare const Assertions$4_optionValidator: typeof optionValidator;
|
|
|
551
522
|
declare const Assertions$4_optionsValidator: typeof optionsValidator;
|
|
552
523
|
declare const Assertions$4_optionsLengthValidator: typeof optionsLengthValidator;
|
|
553
524
|
declare const Assertions$4_validateRequiredSelectMenuParameters: typeof validateRequiredSelectMenuParameters;
|
|
554
|
-
declare const Assertions$4_labelValueValidator: typeof labelValueValidator;
|
|
555
525
|
declare const Assertions$4_defaultValidator: typeof defaultValidator;
|
|
556
526
|
declare const Assertions$4_validateRequiredSelectMenuOptionParameters: typeof validateRequiredSelectMenuOptionParameters;
|
|
557
527
|
declare const Assertions$4_urlValidator: typeof urlValidator;
|
|
@@ -570,7 +540,6 @@ declare namespace Assertions$4 {
|
|
|
570
540
|
Assertions$4_optionsValidator as optionsValidator,
|
|
571
541
|
Assertions$4_optionsLengthValidator as optionsLengthValidator,
|
|
572
542
|
Assertions$4_validateRequiredSelectMenuParameters as validateRequiredSelectMenuParameters,
|
|
573
|
-
Assertions$4_labelValueValidator as labelValueValidator,
|
|
574
543
|
Assertions$4_defaultValidator as defaultValidator,
|
|
575
544
|
Assertions$4_validateRequiredSelectMenuOptionParameters as validateRequiredSelectMenuOptionParameters,
|
|
576
545
|
Assertions$4_urlValidator as urlValidator,
|
|
@@ -603,39 +572,10 @@ declare abstract class ComponentBuilder<DataType extends Partial<APIBaseComponen
|
|
|
603
572
|
constructor(data: Partial<DataType>);
|
|
604
573
|
}
|
|
605
574
|
|
|
606
|
-
declare type MessageComponentBuilder = MessageActionRowComponentBuilder | ActionRowBuilder<MessageActionRowComponentBuilder>;
|
|
607
|
-
declare type ModalComponentBuilder = ModalActionRowComponentBuilder | ActionRowBuilder<ModalActionRowComponentBuilder>;
|
|
608
|
-
declare type MessageActionRowComponentBuilder = ButtonBuilder | SelectMenuBuilder;
|
|
609
|
-
declare type ModalActionRowComponentBuilder = TextInputBuilder;
|
|
610
|
-
declare type AnyComponentBuilder = MessageActionRowComponentBuilder | ModalActionRowComponentBuilder;
|
|
611
575
|
/**
|
|
612
|
-
* Represents
|
|
576
|
+
* Represents a button component
|
|
613
577
|
*/
|
|
614
|
-
declare class
|
|
615
|
-
/**
|
|
616
|
-
* The components within this action row
|
|
617
|
-
*/
|
|
618
|
-
readonly components: T[];
|
|
619
|
-
constructor({ components, ...data }?: Partial<APIActionRowComponent<APIActionRowComponentTypes>>);
|
|
620
|
-
/**
|
|
621
|
-
* Adds components to this action row.
|
|
622
|
-
*
|
|
623
|
-
* @param components - The components to add to this action row.
|
|
624
|
-
*/
|
|
625
|
-
addComponents(...components: RestOrArray<T>): this;
|
|
626
|
-
/**
|
|
627
|
-
* Sets the components in this action row
|
|
628
|
-
*
|
|
629
|
-
* @param components - The components to set this row to
|
|
630
|
-
*/
|
|
631
|
-
setComponents(...components: RestOrArray<T>): this;
|
|
632
|
-
toJSON(): APIActionRowComponent<ReturnType<T['toJSON']>>;
|
|
633
|
-
}
|
|
634
|
-
|
|
635
|
-
/**
|
|
636
|
-
* Represents a non-validated button component
|
|
637
|
-
*/
|
|
638
|
-
declare class UnsafeButtonBuilder extends ComponentBuilder<APIButtonComponent> {
|
|
578
|
+
declare class ButtonBuilder extends ComponentBuilder<APIButtonComponent> {
|
|
639
579
|
constructor(data?: Partial<APIButtonComponent>);
|
|
640
580
|
/**
|
|
641
581
|
* Sets the style of this button
|
|
@@ -650,7 +590,7 @@ declare class UnsafeButtonBuilder extends ComponentBuilder<APIButtonComponent> {
|
|
|
650
590
|
*/
|
|
651
591
|
setURL(url: string): this;
|
|
652
592
|
/**
|
|
653
|
-
* Sets the custom
|
|
593
|
+
* Sets the custom id for this button
|
|
654
594
|
*
|
|
655
595
|
* @param customId - The custom id to use for this button
|
|
656
596
|
*/
|
|
@@ -662,9 +602,9 @@ declare class UnsafeButtonBuilder extends ComponentBuilder<APIButtonComponent> {
|
|
|
662
602
|
*/
|
|
663
603
|
setEmoji(emoji: APIMessageComponentEmoji): this;
|
|
664
604
|
/**
|
|
665
|
-
* Sets whether this button is
|
|
605
|
+
* Sets whether this button is disabled
|
|
666
606
|
*
|
|
667
|
-
* @param disabled - Whether
|
|
607
|
+
* @param disabled - Whether to disable this button
|
|
668
608
|
*/
|
|
669
609
|
setDisabled(disabled?: boolean): this;
|
|
670
610
|
/**
|
|
@@ -677,35 +617,61 @@ declare class UnsafeButtonBuilder extends ComponentBuilder<APIButtonComponent> {
|
|
|
677
617
|
}
|
|
678
618
|
|
|
679
619
|
/**
|
|
680
|
-
* Represents a
|
|
620
|
+
* Represents a select menu component
|
|
681
621
|
*/
|
|
682
|
-
declare class
|
|
683
|
-
|
|
684
|
-
|
|
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
|
+
*/
|
|
685
651
|
setCustomId(customId: string): this;
|
|
686
|
-
|
|
652
|
+
/**
|
|
653
|
+
* Sets whether this select menu is disabled
|
|
654
|
+
*
|
|
655
|
+
* @param disabled - Whether this select menu is disabled
|
|
656
|
+
*/
|
|
687
657
|
setDisabled(disabled?: boolean): this;
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
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;
|
|
697
672
|
}
|
|
698
|
-
/**
|
|
699
|
-
* Factory for creating components from API data
|
|
700
|
-
*
|
|
701
|
-
* @param data - The api data to transform to a component class
|
|
702
|
-
*/
|
|
703
|
-
declare function createComponentBuilder<T extends keyof MappedComponentTypes>(data: (APIMessageComponent | APIModalComponent) & {
|
|
704
|
-
type: T;
|
|
705
|
-
}): MappedComponentTypes[T];
|
|
706
|
-
declare function createComponentBuilder<C extends MessageComponentBuilder | ModalComponentBuilder>(data: C): C;
|
|
707
673
|
|
|
708
|
-
declare class
|
|
674
|
+
declare class TextInputBuilder extends ComponentBuilder<APITextInputComponent> {
|
|
709
675
|
constructor(data?: APITextInputComponent & {
|
|
710
676
|
type?: ComponentType.TextInput;
|
|
711
677
|
});
|
|
@@ -752,27 +718,60 @@ declare class UnsafeTextInputBuilder extends ComponentBuilder<APITextInputCompon
|
|
|
752
718
|
*/
|
|
753
719
|
setValue(value: string): this;
|
|
754
720
|
/**
|
|
755
|
-
* Sets whether this text input is required
|
|
721
|
+
* Sets whether this text input is required
|
|
756
722
|
*
|
|
757
|
-
* @param required - Whether this text input is required
|
|
723
|
+
* @param required - Whether this text input is required
|
|
758
724
|
*/
|
|
759
725
|
setRequired(required?: boolean): this;
|
|
760
726
|
toJSON(): APITextInputComponent;
|
|
761
|
-
equals(other:
|
|
727
|
+
equals(other: JSONEncodable<APITextInputComponent> | APITextInputComponent): boolean;
|
|
762
728
|
}
|
|
763
729
|
|
|
764
|
-
declare
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
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']>>;
|
|
774
757
|
}
|
|
775
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
|
+
|
|
776
775
|
declare const textInputStyleValidator: _sapphire_shapeshift.NativeEnumValidator<typeof TextInputStyle>;
|
|
777
776
|
declare const minLengthValidator: _sapphire_shapeshift.NumberValidator<number>;
|
|
778
777
|
declare const maxLengthValidator: _sapphire_shapeshift.NumberValidator<number>;
|
|
@@ -802,7 +801,7 @@ declare namespace Assertions$3 {
|
|
|
802
801
|
};
|
|
803
802
|
}
|
|
804
803
|
|
|
805
|
-
declare class
|
|
804
|
+
declare class ModalBuilder implements JSONEncodable<APIModalInteractionResponseCallbackData> {
|
|
806
805
|
readonly data: Partial<APIModalInteractionResponseCallbackData>;
|
|
807
806
|
readonly components: ActionRowBuilder<ModalActionRowComponentBuilder>[];
|
|
808
807
|
constructor({ components, ...data }?: Partial<APIModalInteractionResponseCallbackData>);
|
|
@@ -833,12 +832,6 @@ declare class UnsafeModalBuilder implements JSONEncodable<APIModalInteractionRes
|
|
|
833
832
|
toJSON(): APIModalInteractionResponseCallbackData;
|
|
834
833
|
}
|
|
835
834
|
|
|
836
|
-
declare class ModalBuilder extends UnsafeModalBuilder {
|
|
837
|
-
setCustomId(customId: string): this;
|
|
838
|
-
setTitle(title: string): this;
|
|
839
|
-
toJSON(): APIModalInteractionResponseCallbackData;
|
|
840
|
-
}
|
|
841
|
-
|
|
842
835
|
declare const titleValidator: _sapphire_shapeshift.StringValidator<string>;
|
|
843
836
|
declare const componentsValidator: _sapphire_shapeshift.ArrayValidator<[ActionRowBuilder<AnyComponentBuilder>, ...ActionRowBuilder<AnyComponentBuilder>[]], ActionRowBuilder<AnyComponentBuilder>>;
|
|
844
837
|
declare function validateRequiredParameters$2(customId?: string, title?: string, components?: ActionRowBuilder<ModalActionRowComponentBuilder>[]): void;
|
|
@@ -853,74 +846,6 @@ declare namespace Assertions$2 {
|
|
|
853
846
|
};
|
|
854
847
|
}
|
|
855
848
|
|
|
856
|
-
/**
|
|
857
|
-
* Represents a non-validated select menu component
|
|
858
|
-
*/
|
|
859
|
-
declare class UnsafeSelectMenuBuilder extends ComponentBuilder<APISelectMenuComponent> {
|
|
860
|
-
/**
|
|
861
|
-
* The options within this select menu
|
|
862
|
-
*/
|
|
863
|
-
readonly options: UnsafeSelectMenuOptionBuilder[];
|
|
864
|
-
constructor(data?: Partial<APISelectMenuComponent>);
|
|
865
|
-
/**
|
|
866
|
-
* Sets the placeholder for this select menu
|
|
867
|
-
*
|
|
868
|
-
* @param placeholder - The placeholder to use for this select menu
|
|
869
|
-
*/
|
|
870
|
-
setPlaceholder(placeholder: string): this;
|
|
871
|
-
/**
|
|
872
|
-
* Sets the minimum values that must be selected in the select menu
|
|
873
|
-
*
|
|
874
|
-
* @param minValues - The minimum values that must be selected
|
|
875
|
-
*/
|
|
876
|
-
setMinValues(minValues: number): this;
|
|
877
|
-
/**
|
|
878
|
-
* Sets the maximum values that must be selected in the select menu
|
|
879
|
-
*
|
|
880
|
-
* @param minValues - The maximum values that must be selected
|
|
881
|
-
*/
|
|
882
|
-
setMaxValues(maxValues: number): this;
|
|
883
|
-
/**
|
|
884
|
-
* Sets the custom Id for this select menu
|
|
885
|
-
*
|
|
886
|
-
* @param customId - The custom id to use for this select menu
|
|
887
|
-
*/
|
|
888
|
-
setCustomId(customId: string): this;
|
|
889
|
-
/**
|
|
890
|
-
* Sets whether or not this select menu is disabled
|
|
891
|
-
*
|
|
892
|
-
* @param disabled - Whether or not this select menu is disabled
|
|
893
|
-
*/
|
|
894
|
-
setDisabled(disabled?: boolean): this;
|
|
895
|
-
/**
|
|
896
|
-
* Adds options to this select menu
|
|
897
|
-
*
|
|
898
|
-
* @param options - The options to add to this select menu
|
|
899
|
-
*/
|
|
900
|
-
addOptions(...options: RestOrArray<UnsafeSelectMenuOptionBuilder | APISelectMenuOption>): this;
|
|
901
|
-
/**
|
|
902
|
-
* Sets the options on this select menu
|
|
903
|
-
*
|
|
904
|
-
* @param options - The options to set on this select menu
|
|
905
|
-
*/
|
|
906
|
-
setOptions(...options: RestOrArray<UnsafeSelectMenuOptionBuilder | APISelectMenuOption>): this;
|
|
907
|
-
toJSON(): APISelectMenuComponent;
|
|
908
|
-
}
|
|
909
|
-
|
|
910
|
-
/**
|
|
911
|
-
* Represents a validated select menu component
|
|
912
|
-
*/
|
|
913
|
-
declare class SelectMenuBuilder extends UnsafeSelectMenuBuilder {
|
|
914
|
-
setPlaceholder(placeholder: string): this;
|
|
915
|
-
setMinValues(minValues: number): this;
|
|
916
|
-
setMaxValues(maxValues: number): this;
|
|
917
|
-
setCustomId(customId: string): this;
|
|
918
|
-
setDisabled(disabled?: boolean): this;
|
|
919
|
-
addOptions(...options: RestOrArray<UnsafeSelectMenuOptionBuilder | APISelectMenuOption>): this;
|
|
920
|
-
setOptions(...options: RestOrArray<UnsafeSelectMenuOptionBuilder | APISelectMenuOption>): this;
|
|
921
|
-
toJSON(): APISelectMenuComponent;
|
|
922
|
-
}
|
|
923
|
-
|
|
924
849
|
declare class SharedNameAndDescription {
|
|
925
850
|
readonly name: string;
|
|
926
851
|
readonly name_localizations?: LocalizationMap;
|
|
@@ -1073,6 +998,20 @@ declare class SlashCommandRoleOption extends ApplicationCommandOptionBase {
|
|
|
1073
998
|
|
|
1074
999
|
declare class SlashCommandStringOption extends ApplicationCommandOptionBase {
|
|
1075
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;
|
|
1076
1015
|
toJSON(): APIApplicationCommandStringOption;
|
|
1077
1016
|
}
|
|
1078
1017
|
interface SlashCommandStringOption extends ApplicationCommandOptionWithChoicesAndAutocompleteMixin<string> {
|
|
@@ -1460,4 +1399,8 @@ declare function isEquatable(maybeEquatable: unknown): maybeEquatable is Equatab
|
|
|
1460
1399
|
|
|
1461
1400
|
declare function embedLength(data: APIEmbed): number;
|
|
1462
1401
|
|
|
1463
|
-
|
|
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 };
|