@discordjs/builders 0.11.0 → 0.13.0-dev.1644235495.b936103
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/CHANGELOG.md +126 -0
- package/README.md +4 -4
- package/dist/index.d.ts +375 -64
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +2 -2
- package/dist/index.mjs.map +1 -1
- package/package.json +87 -97
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { APIEmbedField, APIEmbed, APIEmbedThumbnail, APIEmbedImage, APIEmbedVideo, APIEmbedAuthor, APIEmbedProvider, APIEmbedFooter, ApplicationCommandOptionType, APIApplicationCommandBasicOption, APIApplicationCommandBooleanOption, ChannelType, APIApplicationCommandChannelOption, APIApplicationCommandOptionChoice, APIApplicationCommandIntegerOption, APIApplicationCommandMentionableOption, APIApplicationCommandNumberOption, APIApplicationCommandRoleOption, APIApplicationCommandStringOption, APIApplicationCommandUserOption, APIApplicationCommandSubcommandGroupOption, APIApplicationCommandSubcommandOption, RESTPostAPIApplicationCommandsJSONBody, APIApplicationCommandOption, ApplicationCommandType } from 'discord-api-types/v9';
|
|
1
|
+
import { APIEmbedField, APIEmbed, APIEmbedThumbnail, APIEmbedImage, APIEmbedVideo, APIEmbedAuthor, APIEmbedProvider, APIEmbedFooter, APIMessageComponentEmoji, APISelectMenuOption, ButtonStyle, APIMessageComponent, ComponentType, APIActionRowComponent, APIButtonComponent, APISelectMenuComponent, ApplicationCommandOptionType, APIApplicationCommandBasicOption, APIApplicationCommandBooleanOption, ChannelType, APIApplicationCommandChannelOption, APIApplicationCommandOptionChoice, APIApplicationCommandIntegerOption, APIApplicationCommandMentionableOption, APIApplicationCommandNumberOption, APIApplicationCommandRoleOption, APIApplicationCommandStringOption, APIApplicationCommandUserOption, APIApplicationCommandSubcommandGroupOption, APIApplicationCommandSubcommandOption, RESTPostAPIApplicationCommandsJSONBody, APIApplicationCommandOption, ApplicationCommandType } from 'discord-api-types/v9';
|
|
2
2
|
import { z } from 'zod';
|
|
3
3
|
import { Snowflake } from 'discord-api-types/globals';
|
|
4
4
|
import { URL } from 'url';
|
|
@@ -42,39 +42,51 @@ declare const footerTextPredicate: z.ZodNullable<z.ZodString>;
|
|
|
42
42
|
declare const timestampPredicate: z.ZodNullable<z.ZodUnion<[z.ZodNumber, z.ZodDate]>>;
|
|
43
43
|
declare const titlePredicate: z.ZodNullable<z.ZodString>;
|
|
44
44
|
|
|
45
|
-
declare const Assertions$
|
|
46
|
-
declare const Assertions$
|
|
47
|
-
declare const Assertions$
|
|
48
|
-
declare const Assertions$
|
|
49
|
-
declare const Assertions$
|
|
50
|
-
declare const Assertions$
|
|
51
|
-
declare const Assertions$
|
|
52
|
-
declare const Assertions$
|
|
53
|
-
declare const Assertions$
|
|
54
|
-
declare const Assertions$
|
|
55
|
-
declare const Assertions$
|
|
56
|
-
declare const Assertions$
|
|
57
|
-
declare const Assertions$
|
|
58
|
-
declare const Assertions$
|
|
59
|
-
declare namespace Assertions$
|
|
45
|
+
declare const Assertions$3_fieldNamePredicate: typeof fieldNamePredicate;
|
|
46
|
+
declare const Assertions$3_fieldValuePredicate: typeof fieldValuePredicate;
|
|
47
|
+
declare const Assertions$3_fieldInlinePredicate: typeof fieldInlinePredicate;
|
|
48
|
+
declare const Assertions$3_embedFieldPredicate: typeof embedFieldPredicate;
|
|
49
|
+
declare const Assertions$3_embedFieldsArrayPredicate: typeof embedFieldsArrayPredicate;
|
|
50
|
+
declare const Assertions$3_fieldLengthPredicate: typeof fieldLengthPredicate;
|
|
51
|
+
declare const Assertions$3_validateFieldLength: typeof validateFieldLength;
|
|
52
|
+
declare const Assertions$3_authorNamePredicate: typeof authorNamePredicate;
|
|
53
|
+
declare const Assertions$3_urlPredicate: typeof urlPredicate;
|
|
54
|
+
declare const Assertions$3_colorPredicate: typeof colorPredicate;
|
|
55
|
+
declare const Assertions$3_descriptionPredicate: typeof descriptionPredicate;
|
|
56
|
+
declare const Assertions$3_footerTextPredicate: typeof footerTextPredicate;
|
|
57
|
+
declare const Assertions$3_timestampPredicate: typeof timestampPredicate;
|
|
58
|
+
declare const Assertions$3_titlePredicate: typeof titlePredicate;
|
|
59
|
+
declare namespace Assertions$3 {
|
|
60
60
|
export {
|
|
61
|
-
Assertions$
|
|
62
|
-
Assertions$
|
|
63
|
-
Assertions$
|
|
64
|
-
Assertions$
|
|
65
|
-
Assertions$
|
|
66
|
-
Assertions$
|
|
67
|
-
Assertions$
|
|
68
|
-
Assertions$
|
|
69
|
-
Assertions$
|
|
70
|
-
Assertions$
|
|
71
|
-
Assertions$
|
|
72
|
-
Assertions$
|
|
73
|
-
Assertions$
|
|
74
|
-
Assertions$
|
|
61
|
+
Assertions$3_fieldNamePredicate as fieldNamePredicate,
|
|
62
|
+
Assertions$3_fieldValuePredicate as fieldValuePredicate,
|
|
63
|
+
Assertions$3_fieldInlinePredicate as fieldInlinePredicate,
|
|
64
|
+
Assertions$3_embedFieldPredicate as embedFieldPredicate,
|
|
65
|
+
Assertions$3_embedFieldsArrayPredicate as embedFieldsArrayPredicate,
|
|
66
|
+
Assertions$3_fieldLengthPredicate as fieldLengthPredicate,
|
|
67
|
+
Assertions$3_validateFieldLength as validateFieldLength,
|
|
68
|
+
Assertions$3_authorNamePredicate as authorNamePredicate,
|
|
69
|
+
Assertions$3_urlPredicate as urlPredicate,
|
|
70
|
+
Assertions$3_colorPredicate as colorPredicate,
|
|
71
|
+
Assertions$3_descriptionPredicate as descriptionPredicate,
|
|
72
|
+
Assertions$3_footerTextPredicate as footerTextPredicate,
|
|
73
|
+
Assertions$3_timestampPredicate as timestampPredicate,
|
|
74
|
+
Assertions$3_titlePredicate as titlePredicate,
|
|
75
75
|
};
|
|
76
76
|
}
|
|
77
77
|
|
|
78
|
+
interface JSONEncodable<T> {
|
|
79
|
+
/**
|
|
80
|
+
* Transforms this object to its JSON format
|
|
81
|
+
*/
|
|
82
|
+
toJSON: () => T;
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* Indicates if an object is encodable or not.
|
|
86
|
+
* @param maybeEncodable The object to check against
|
|
87
|
+
*/
|
|
88
|
+
declare function isJSONEncodable(maybeEncodable: unknown): maybeEncodable is JSONEncodable<unknown>;
|
|
89
|
+
|
|
78
90
|
interface AuthorOptions {
|
|
79
91
|
name: string;
|
|
80
92
|
url?: string;
|
|
@@ -84,58 +96,55 @@ interface FooterOptions {
|
|
|
84
96
|
text: string;
|
|
85
97
|
iconURL?: string;
|
|
86
98
|
}
|
|
87
|
-
|
|
88
|
-
* Represents an embed in a message (image/video preview, rich embed, etc.)
|
|
89
|
-
*/
|
|
90
|
-
declare class Embed implements APIEmbed {
|
|
99
|
+
declare class UnsafeEmbed implements APIEmbed, JSONEncodable<APIEmbed> {
|
|
91
100
|
/**
|
|
92
101
|
* An array of fields of this embed
|
|
93
102
|
*/
|
|
94
|
-
fields: APIEmbedField[];
|
|
103
|
+
readonly fields: APIEmbedField[];
|
|
95
104
|
/**
|
|
96
105
|
* The embed title
|
|
97
106
|
*/
|
|
98
|
-
title?: string;
|
|
107
|
+
readonly title?: string;
|
|
99
108
|
/**
|
|
100
109
|
* The embed description
|
|
101
110
|
*/
|
|
102
|
-
description?: string;
|
|
111
|
+
readonly description?: string;
|
|
103
112
|
/**
|
|
104
113
|
* The embed url
|
|
105
114
|
*/
|
|
106
|
-
url?: string;
|
|
115
|
+
readonly url?: string;
|
|
107
116
|
/**
|
|
108
117
|
* The embed color
|
|
109
118
|
*/
|
|
110
|
-
color?: number;
|
|
119
|
+
readonly color?: number;
|
|
111
120
|
/**
|
|
112
121
|
* The timestamp of the embed in the ISO format
|
|
113
122
|
*/
|
|
114
|
-
timestamp?: string;
|
|
123
|
+
readonly timestamp?: string;
|
|
115
124
|
/**
|
|
116
125
|
* The embed thumbnail data
|
|
117
126
|
*/
|
|
118
|
-
thumbnail?: APIEmbedThumbnail;
|
|
127
|
+
readonly thumbnail?: APIEmbedThumbnail;
|
|
119
128
|
/**
|
|
120
129
|
* The embed image data
|
|
121
130
|
*/
|
|
122
|
-
image?: APIEmbedImage;
|
|
131
|
+
readonly image?: APIEmbedImage;
|
|
123
132
|
/**
|
|
124
133
|
* Received video data
|
|
125
134
|
*/
|
|
126
|
-
video?: APIEmbedVideo;
|
|
135
|
+
readonly video?: APIEmbedVideo;
|
|
127
136
|
/**
|
|
128
137
|
* The embed author data
|
|
129
138
|
*/
|
|
130
|
-
author?: APIEmbedAuthor;
|
|
139
|
+
readonly author?: APIEmbedAuthor;
|
|
131
140
|
/**
|
|
132
141
|
* Received data about the embed provider
|
|
133
142
|
*/
|
|
134
|
-
provider?: APIEmbedProvider;
|
|
143
|
+
readonly provider?: APIEmbedProvider;
|
|
135
144
|
/**
|
|
136
145
|
* The embed footer data
|
|
137
146
|
*/
|
|
138
|
-
footer?: APIEmbedFooter;
|
|
147
|
+
readonly footer?: APIEmbedFooter;
|
|
139
148
|
constructor(data?: APIEmbed);
|
|
140
149
|
/**
|
|
141
150
|
* The accumulated length for the embed title, description, fields, footer text, and author name
|
|
@@ -161,6 +170,11 @@ declare class Embed implements APIEmbed {
|
|
|
161
170
|
* @param fields The replacing field objects
|
|
162
171
|
*/
|
|
163
172
|
spliceFields(index: number, deleteCount: number, ...fields: APIEmbedField[]): this;
|
|
173
|
+
/**
|
|
174
|
+
* Sets the embed's fields (max 25).
|
|
175
|
+
* @param fields The fields to set
|
|
176
|
+
*/
|
|
177
|
+
setFields(...fields: APIEmbedField[]): this;
|
|
164
178
|
/**
|
|
165
179
|
* Sets the author of this embed
|
|
166
180
|
*
|
|
@@ -227,6 +241,29 @@ declare class Embed implements APIEmbed {
|
|
|
227
241
|
static normalizeFields(...fields: APIEmbedField[]): APIEmbedField[];
|
|
228
242
|
}
|
|
229
243
|
|
|
244
|
+
/**
|
|
245
|
+
* Represents an embed in a message (image/video preview, rich embed, etc.)
|
|
246
|
+
*/
|
|
247
|
+
declare class Embed extends UnsafeEmbed {
|
|
248
|
+
addFields(...fields: APIEmbedField[]): this;
|
|
249
|
+
spliceFields(index: number, deleteCount: number, ...fields: APIEmbedField[]): this;
|
|
250
|
+
setAuthor(options: AuthorOptions | null): this;
|
|
251
|
+
setColor(color: number | null): this;
|
|
252
|
+
setDescription(description: string | null): this;
|
|
253
|
+
setFooter(options: FooterOptions | null): this;
|
|
254
|
+
setImage(url: string | null): this;
|
|
255
|
+
setThumbnail(url: string | null): this;
|
|
256
|
+
setTimestamp(timestamp?: number | Date | null): this;
|
|
257
|
+
setTitle(title: string | null): this;
|
|
258
|
+
setURL(url: string | null): this;
|
|
259
|
+
/**
|
|
260
|
+
* Normalizes field input and resolves strings
|
|
261
|
+
*
|
|
262
|
+
* @param fields Fields to normalize
|
|
263
|
+
*/
|
|
264
|
+
static normalizeFields(...fields: APIEmbedField[]): APIEmbedField[];
|
|
265
|
+
}
|
|
266
|
+
|
|
230
267
|
/**
|
|
231
268
|
* Wraps the content inside a codeblock with no language
|
|
232
269
|
*
|
|
@@ -448,6 +485,280 @@ declare enum Faces {
|
|
|
448
485
|
Unflip = "\u252C\u2500\u252C \u30CE( \u309C-\u309C\u30CE)"
|
|
449
486
|
}
|
|
450
487
|
|
|
488
|
+
/**
|
|
489
|
+
* Represents a non-validated option within a select menu component
|
|
490
|
+
*/
|
|
491
|
+
declare class UnsafeSelectMenuOption {
|
|
492
|
+
readonly label: string;
|
|
493
|
+
readonly value: string;
|
|
494
|
+
readonly description?: string;
|
|
495
|
+
readonly emoji?: APIMessageComponentEmoji;
|
|
496
|
+
readonly default?: boolean;
|
|
497
|
+
constructor(data?: APISelectMenuOption);
|
|
498
|
+
/**
|
|
499
|
+
* Sets the label of this option
|
|
500
|
+
* @param label The label to show on this option
|
|
501
|
+
*/
|
|
502
|
+
setLabel(label: string): this;
|
|
503
|
+
/**
|
|
504
|
+
* Sets the value of this option
|
|
505
|
+
* @param value The value of this option
|
|
506
|
+
*/
|
|
507
|
+
setValue(value: string): this;
|
|
508
|
+
/**
|
|
509
|
+
* Sets the description of this option.
|
|
510
|
+
* @param description The description of this option
|
|
511
|
+
*/
|
|
512
|
+
setDescription(description: string): this;
|
|
513
|
+
/**
|
|
514
|
+
* Sets whether this option is selected by default
|
|
515
|
+
* @param isDefault Whether or not this option is selected by default
|
|
516
|
+
*/
|
|
517
|
+
setDefault(isDefault: boolean): this;
|
|
518
|
+
/**
|
|
519
|
+
* Sets the emoji to display on this button
|
|
520
|
+
* @param emoji The emoji to display on this button
|
|
521
|
+
*/
|
|
522
|
+
setEmoji(emoji: APIMessageComponentEmoji): this;
|
|
523
|
+
toJSON(): APISelectMenuOption;
|
|
524
|
+
}
|
|
525
|
+
|
|
526
|
+
/**
|
|
527
|
+
* Represents an option within a select menu component
|
|
528
|
+
*/
|
|
529
|
+
declare class SelectMenuOption extends UnsafeSelectMenuOption {
|
|
530
|
+
setDescription(description: string): this;
|
|
531
|
+
setDefault(isDefault: boolean): this;
|
|
532
|
+
setEmoji(emoji: APIMessageComponentEmoji): this;
|
|
533
|
+
toJSON(): APISelectMenuOption;
|
|
534
|
+
}
|
|
535
|
+
|
|
536
|
+
declare const customIdValidator: z.ZodString;
|
|
537
|
+
declare const emojiValidator: z.ZodObject<{
|
|
538
|
+
id: z.ZodOptional<z.ZodString>;
|
|
539
|
+
name: z.ZodOptional<z.ZodString>;
|
|
540
|
+
animated: z.ZodOptional<z.ZodBoolean>;
|
|
541
|
+
}, "strict", z.ZodTypeAny, {
|
|
542
|
+
name?: string | undefined;
|
|
543
|
+
id?: string | undefined;
|
|
544
|
+
animated?: boolean | undefined;
|
|
545
|
+
}, {
|
|
546
|
+
name?: string | undefined;
|
|
547
|
+
id?: string | undefined;
|
|
548
|
+
animated?: boolean | undefined;
|
|
549
|
+
}>;
|
|
550
|
+
declare const disabledValidator: z.ZodBoolean;
|
|
551
|
+
declare const buttonLabelValidator: z.ZodString;
|
|
552
|
+
declare const buttonStyleValidator: z.ZodNumber;
|
|
553
|
+
declare const placeholderValidator: z.ZodString;
|
|
554
|
+
declare const minMaxValidator: z.ZodNumber;
|
|
555
|
+
declare const optionsValidator: z.ZodArray<z.ZodObject<{}, "strip", z.ZodTypeAny, {}, {}>, "atleastone">;
|
|
556
|
+
declare function validateRequiredSelectMenuParameters(options: SelectMenuOption[], customId?: string): void;
|
|
557
|
+
declare const labelValueValidator: z.ZodString;
|
|
558
|
+
declare const defaultValidator: z.ZodBoolean;
|
|
559
|
+
declare function validateRequiredSelectMenuOptionParameters(label?: string, value?: string): void;
|
|
560
|
+
declare const urlValidator: z.ZodString;
|
|
561
|
+
declare function validateRequiredButtonParameters(style: ButtonStyle, label?: string, emoji?: APIMessageComponentEmoji, customId?: string, url?: string): void;
|
|
562
|
+
|
|
563
|
+
declare const Assertions$2_customIdValidator: typeof customIdValidator;
|
|
564
|
+
declare const Assertions$2_emojiValidator: typeof emojiValidator;
|
|
565
|
+
declare const Assertions$2_disabledValidator: typeof disabledValidator;
|
|
566
|
+
declare const Assertions$2_buttonLabelValidator: typeof buttonLabelValidator;
|
|
567
|
+
declare const Assertions$2_buttonStyleValidator: typeof buttonStyleValidator;
|
|
568
|
+
declare const Assertions$2_placeholderValidator: typeof placeholderValidator;
|
|
569
|
+
declare const Assertions$2_minMaxValidator: typeof minMaxValidator;
|
|
570
|
+
declare const Assertions$2_optionsValidator: typeof optionsValidator;
|
|
571
|
+
declare const Assertions$2_validateRequiredSelectMenuParameters: typeof validateRequiredSelectMenuParameters;
|
|
572
|
+
declare const Assertions$2_labelValueValidator: typeof labelValueValidator;
|
|
573
|
+
declare const Assertions$2_defaultValidator: typeof defaultValidator;
|
|
574
|
+
declare const Assertions$2_validateRequiredSelectMenuOptionParameters: typeof validateRequiredSelectMenuOptionParameters;
|
|
575
|
+
declare const Assertions$2_urlValidator: typeof urlValidator;
|
|
576
|
+
declare const Assertions$2_validateRequiredButtonParameters: typeof validateRequiredButtonParameters;
|
|
577
|
+
declare namespace Assertions$2 {
|
|
578
|
+
export {
|
|
579
|
+
Assertions$2_customIdValidator as customIdValidator,
|
|
580
|
+
Assertions$2_emojiValidator as emojiValidator,
|
|
581
|
+
Assertions$2_disabledValidator as disabledValidator,
|
|
582
|
+
Assertions$2_buttonLabelValidator as buttonLabelValidator,
|
|
583
|
+
Assertions$2_buttonStyleValidator as buttonStyleValidator,
|
|
584
|
+
Assertions$2_placeholderValidator as placeholderValidator,
|
|
585
|
+
Assertions$2_minMaxValidator as minMaxValidator,
|
|
586
|
+
Assertions$2_optionsValidator as optionsValidator,
|
|
587
|
+
Assertions$2_validateRequiredSelectMenuParameters as validateRequiredSelectMenuParameters,
|
|
588
|
+
Assertions$2_labelValueValidator as labelValueValidator,
|
|
589
|
+
Assertions$2_defaultValidator as defaultValidator,
|
|
590
|
+
Assertions$2_validateRequiredSelectMenuOptionParameters as validateRequiredSelectMenuOptionParameters,
|
|
591
|
+
Assertions$2_urlValidator as urlValidator,
|
|
592
|
+
Assertions$2_validateRequiredButtonParameters as validateRequiredButtonParameters,
|
|
593
|
+
};
|
|
594
|
+
}
|
|
595
|
+
|
|
596
|
+
/**
|
|
597
|
+
* Represents a discord component
|
|
598
|
+
*/
|
|
599
|
+
interface Component extends JSONEncodable<APIMessageComponent> {
|
|
600
|
+
/**
|
|
601
|
+
* The type of this component
|
|
602
|
+
*/
|
|
603
|
+
readonly type: ComponentType;
|
|
604
|
+
}
|
|
605
|
+
|
|
606
|
+
declare type MessageComponent = ActionRowComponent | ActionRow;
|
|
607
|
+
declare type ActionRowComponent = ButtonComponent | SelectMenuComponent;
|
|
608
|
+
/**
|
|
609
|
+
* Represents an action row component
|
|
610
|
+
*/
|
|
611
|
+
declare class ActionRow<T extends ActionRowComponent = ActionRowComponent> implements Component {
|
|
612
|
+
readonly components: T[];
|
|
613
|
+
readonly type = ComponentType.ActionRow;
|
|
614
|
+
constructor(data?: APIActionRowComponent & {
|
|
615
|
+
type?: ComponentType.ActionRow;
|
|
616
|
+
});
|
|
617
|
+
/**
|
|
618
|
+
* Adds components to this action row.
|
|
619
|
+
* @param components The components to add to this action row.
|
|
620
|
+
* @returns
|
|
621
|
+
*/
|
|
622
|
+
addComponents(...components: T[]): this;
|
|
623
|
+
/**
|
|
624
|
+
* Sets the components in this action row
|
|
625
|
+
* @param components The components to set this row to
|
|
626
|
+
*/
|
|
627
|
+
setComponents(components: T[]): this;
|
|
628
|
+
toJSON(): APIActionRowComponent;
|
|
629
|
+
}
|
|
630
|
+
|
|
631
|
+
declare class UnsafeButtonComponent implements Component {
|
|
632
|
+
readonly type: ComponentType.Button;
|
|
633
|
+
readonly style: ButtonStyle;
|
|
634
|
+
readonly label?: string;
|
|
635
|
+
readonly emoji?: APIMessageComponentEmoji;
|
|
636
|
+
readonly disabled?: boolean;
|
|
637
|
+
readonly custom_id: string;
|
|
638
|
+
readonly url: string;
|
|
639
|
+
constructor(data?: APIButtonComponent & {
|
|
640
|
+
type?: ComponentType.Button;
|
|
641
|
+
});
|
|
642
|
+
/**
|
|
643
|
+
* Sets the style of this button
|
|
644
|
+
* @param style The style of the button
|
|
645
|
+
*/
|
|
646
|
+
setStyle(style: ButtonStyle): this;
|
|
647
|
+
/**
|
|
648
|
+
* Sets the URL for this button
|
|
649
|
+
* @param url The URL to open when this button is clicked
|
|
650
|
+
*/
|
|
651
|
+
setURL(url: string): this;
|
|
652
|
+
/**
|
|
653
|
+
* Sets the custom Id for this button
|
|
654
|
+
* @param customId The custom ID to use for this button
|
|
655
|
+
*/
|
|
656
|
+
setCustomId(customId: string): this;
|
|
657
|
+
/**
|
|
658
|
+
* Sets the emoji to display on this button
|
|
659
|
+
* @param emoji The emoji to display on this button
|
|
660
|
+
*/
|
|
661
|
+
setEmoji(emoji: APIMessageComponentEmoji): this;
|
|
662
|
+
/**
|
|
663
|
+
* Sets whether this button is disable or not
|
|
664
|
+
* @param disabled Whether or not to disable this button or not
|
|
665
|
+
*/
|
|
666
|
+
setDisabled(disabled: boolean): this;
|
|
667
|
+
/**
|
|
668
|
+
* Sets the label for this button
|
|
669
|
+
* @param label The label to display on this button
|
|
670
|
+
*/
|
|
671
|
+
setLabel(label: string): this;
|
|
672
|
+
toJSON(): APIButtonComponent;
|
|
673
|
+
}
|
|
674
|
+
|
|
675
|
+
declare class ButtonComponent extends UnsafeButtonComponent {
|
|
676
|
+
setStyle(style: ButtonStyle): this;
|
|
677
|
+
setURL(url: string): this;
|
|
678
|
+
setCustomId(customId: string): this;
|
|
679
|
+
setEmoji(emoji: APIMessageComponentEmoji): this;
|
|
680
|
+
setDisabled(disabled: boolean): this;
|
|
681
|
+
setLabel(label: string): this;
|
|
682
|
+
toJSON(): APIButtonComponent;
|
|
683
|
+
}
|
|
684
|
+
|
|
685
|
+
interface MappedComponentTypes {
|
|
686
|
+
[ComponentType.ActionRow]: ActionRow;
|
|
687
|
+
[ComponentType.Button]: ButtonComponent;
|
|
688
|
+
[ComponentType.SelectMenu]: SelectMenuComponent;
|
|
689
|
+
}
|
|
690
|
+
/**
|
|
691
|
+
* Factory for creating components from API data
|
|
692
|
+
* @param data The api data to transform to a component class
|
|
693
|
+
*/
|
|
694
|
+
declare function createComponent<T extends keyof MappedComponentTypes>(data: APIMessageComponent & {
|
|
695
|
+
type: T;
|
|
696
|
+
}): MappedComponentTypes[T];
|
|
697
|
+
declare function createComponent<C extends MessageComponent>(data: C): C;
|
|
698
|
+
|
|
699
|
+
/**
|
|
700
|
+
* Represents a non-validated select menu component
|
|
701
|
+
*/
|
|
702
|
+
declare class UnsafeSelectMenuComponent implements Component {
|
|
703
|
+
readonly type: ComponentType.SelectMenu;
|
|
704
|
+
readonly options: SelectMenuOption[];
|
|
705
|
+
readonly placeholder?: string;
|
|
706
|
+
readonly min_values?: number;
|
|
707
|
+
readonly max_values?: number;
|
|
708
|
+
readonly custom_id: string;
|
|
709
|
+
readonly disabled?: boolean;
|
|
710
|
+
constructor(data?: APISelectMenuComponent);
|
|
711
|
+
/**
|
|
712
|
+
* Sets the placeholder for this select menu
|
|
713
|
+
* @param placeholder The placeholder to use for this select menu
|
|
714
|
+
*/
|
|
715
|
+
setPlaceholder(placeholder: string): this;
|
|
716
|
+
/**
|
|
717
|
+
* Sets thes minimum values that must be selected in the select menu
|
|
718
|
+
* @param minValues The minimum values that must be selected
|
|
719
|
+
*/
|
|
720
|
+
setMinValues(minValues: number): this;
|
|
721
|
+
/**
|
|
722
|
+
* Sets thes maximum values that must be selected in the select menu
|
|
723
|
+
* @param minValues The maximum values that must be selected
|
|
724
|
+
*/
|
|
725
|
+
setMaxValues(maxValues: number): this;
|
|
726
|
+
/**
|
|
727
|
+
* Sets the custom Id for this select menu
|
|
728
|
+
* @param customId The custom ID to use for this select menu
|
|
729
|
+
*/
|
|
730
|
+
setCustomId(customId: string): this;
|
|
731
|
+
/**
|
|
732
|
+
* Sets whether or not this select menu is disabled
|
|
733
|
+
* @param disabled Whether or not this select menu is disabled
|
|
734
|
+
*/
|
|
735
|
+
setDisabled(disabled: boolean): this;
|
|
736
|
+
/**
|
|
737
|
+
* Adds options to this select menu
|
|
738
|
+
* @param options The options to add to this select menu
|
|
739
|
+
* @returns
|
|
740
|
+
*/
|
|
741
|
+
addOptions(...options: SelectMenuOption[]): this;
|
|
742
|
+
/**
|
|
743
|
+
* Sets the options on this select menu
|
|
744
|
+
* @param options The options to set on this select menu
|
|
745
|
+
*/
|
|
746
|
+
setOptions(options: SelectMenuOption[]): this;
|
|
747
|
+
toJSON(): APISelectMenuComponent;
|
|
748
|
+
}
|
|
749
|
+
|
|
750
|
+
/**
|
|
751
|
+
* Represents a select menu component
|
|
752
|
+
*/
|
|
753
|
+
declare class SelectMenuComponent extends UnsafeSelectMenuComponent {
|
|
754
|
+
setPlaceholder(placeholder: string): this;
|
|
755
|
+
setMinValues(minValues: number): this;
|
|
756
|
+
setMaxValues(maxValues: number): this;
|
|
757
|
+
setCustomId(customId: string): this;
|
|
758
|
+
setDisabled(disabled: boolean): this;
|
|
759
|
+
toJSON(): APISelectMenuComponent;
|
|
760
|
+
}
|
|
761
|
+
|
|
451
762
|
declare class SharedNameAndDescription {
|
|
452
763
|
readonly name: string;
|
|
453
764
|
readonly description: string;
|
|
@@ -467,7 +778,7 @@ declare class SharedNameAndDescription {
|
|
|
467
778
|
|
|
468
779
|
declare abstract class ApplicationCommandOptionBase extends SharedNameAndDescription {
|
|
469
780
|
abstract readonly type: ApplicationCommandOptionType;
|
|
470
|
-
readonly required
|
|
781
|
+
readonly required: boolean;
|
|
471
782
|
/**
|
|
472
783
|
* Marks the option as required
|
|
473
784
|
*
|
|
@@ -509,8 +820,8 @@ interface SlashCommandChannelOption extends ApplicationCommandOptionChannelTypes
|
|
|
509
820
|
}
|
|
510
821
|
|
|
511
822
|
declare abstract class ApplicationCommandNumericOptionMinMaxValueMixin {
|
|
512
|
-
|
|
513
|
-
|
|
823
|
+
readonly max_value?: number;
|
|
824
|
+
readonly min_value?: number;
|
|
514
825
|
/**
|
|
515
826
|
* Sets the maximum number value of this option
|
|
516
827
|
* @param max The maximum value this option can be
|
|
@@ -644,7 +955,7 @@ declare class SharedSlashCommandOptions<ShouldOmitSubcommandFunctions = true> {
|
|
|
644
955
|
/**
|
|
645
956
|
* Represents a folder for subcommands
|
|
646
957
|
*
|
|
647
|
-
* For more information, go to https://discord.com/developers/docs/interactions/
|
|
958
|
+
* For more information, go to https://discord.com/developers/docs/interactions/application-commands#subcommands-and-subcommand-groups
|
|
648
959
|
*/
|
|
649
960
|
declare class SlashCommandSubcommandGroupBuilder implements ToAPIApplicationCommandOptions {
|
|
650
961
|
/**
|
|
@@ -672,7 +983,7 @@ interface SlashCommandSubcommandGroupBuilder extends SharedNameAndDescription {
|
|
|
672
983
|
/**
|
|
673
984
|
* Represents a subcommand
|
|
674
985
|
*
|
|
675
|
-
* For more information, go to https://discord.com/developers/docs/interactions/
|
|
986
|
+
* For more information, go to https://discord.com/developers/docs/interactions/application-commands#subcommands-and-subcommand-groups
|
|
676
987
|
*/
|
|
677
988
|
declare class SlashCommandSubcommandBuilder implements ToAPIApplicationCommandOptions {
|
|
678
989
|
/**
|
|
@@ -747,31 +1058,31 @@ interface SlashCommandSubcommandsOnlyBuilder extends SharedNameAndDescription, P
|
|
|
747
1058
|
interface SlashCommandOptionsOnlyBuilder extends SharedNameAndDescription, SharedSlashCommandOptions, Pick<SlashCommandBuilder, 'toJSON'> {
|
|
748
1059
|
}
|
|
749
1060
|
interface ToAPIApplicationCommandOptions {
|
|
750
|
-
toJSON()
|
|
1061
|
+
toJSON: () => APIApplicationCommandOption;
|
|
751
1062
|
}
|
|
752
1063
|
|
|
753
|
-
declare function validateRequiredParameters$1(name: string, description: string, options: ToAPIApplicationCommandOptions[]): void;
|
|
754
1064
|
declare function validateName$1(name: unknown): asserts name is string;
|
|
755
1065
|
declare function validateDescription(description: unknown): asserts description is string;
|
|
1066
|
+
declare function validateMaxOptionsLength(options: unknown): asserts options is ToAPIApplicationCommandOptions[];
|
|
1067
|
+
declare function validateRequiredParameters$1(name: string, description: string, options: ToAPIApplicationCommandOptions[]): void;
|
|
756
1068
|
declare function validateDefaultPermission$1(value: unknown): asserts value is boolean;
|
|
757
1069
|
declare function validateRequired(required: unknown): asserts required is boolean;
|
|
758
|
-
declare function validateMaxOptionsLength(options: unknown): asserts options is ToAPIApplicationCommandOptions[];
|
|
759
1070
|
declare function validateMaxChoicesLength(choices: APIApplicationCommandOptionChoice[]): void;
|
|
760
1071
|
declare function assertReturnOfBuilder<T extends ApplicationCommandOptionBase | SlashCommandSubcommandBuilder | SlashCommandSubcommandGroupBuilder>(input: unknown, ExpectedInstanceOf: new () => T): asserts input is T;
|
|
761
1072
|
|
|
762
1073
|
declare const Assertions$1_validateDescription: typeof validateDescription;
|
|
763
|
-
declare const Assertions$1_validateRequired: typeof validateRequired;
|
|
764
1074
|
declare const Assertions$1_validateMaxOptionsLength: typeof validateMaxOptionsLength;
|
|
1075
|
+
declare const Assertions$1_validateRequired: typeof validateRequired;
|
|
765
1076
|
declare const Assertions$1_validateMaxChoicesLength: typeof validateMaxChoicesLength;
|
|
766
1077
|
declare const Assertions$1_assertReturnOfBuilder: typeof assertReturnOfBuilder;
|
|
767
1078
|
declare namespace Assertions$1 {
|
|
768
1079
|
export {
|
|
769
|
-
validateRequiredParameters$1 as validateRequiredParameters,
|
|
770
1080
|
validateName$1 as validateName,
|
|
771
1081
|
Assertions$1_validateDescription as validateDescription,
|
|
1082
|
+
Assertions$1_validateMaxOptionsLength as validateMaxOptionsLength,
|
|
1083
|
+
validateRequiredParameters$1 as validateRequiredParameters,
|
|
772
1084
|
validateDefaultPermission$1 as validateDefaultPermission,
|
|
773
1085
|
Assertions$1_validateRequired as validateRequired,
|
|
774
|
-
Assertions$1_validateMaxOptionsLength as validateMaxOptionsLength,
|
|
775
1086
|
Assertions$1_validateMaxChoicesLength as validateMaxChoicesLength,
|
|
776
1087
|
Assertions$1_assertReturnOfBuilder as assertReturnOfBuilder,
|
|
777
1088
|
};
|
|
@@ -823,22 +1134,22 @@ declare class ContextMenuCommandBuilder {
|
|
|
823
1134
|
}
|
|
824
1135
|
declare type ContextMenuCommandType = ApplicationCommandType.User | ApplicationCommandType.Message;
|
|
825
1136
|
|
|
826
|
-
declare function
|
|
1137
|
+
declare function validateDefaultPermission(value: unknown): asserts value is boolean;
|
|
827
1138
|
declare function validateName(name: unknown): asserts name is string;
|
|
828
1139
|
declare function validateType(type: unknown): asserts type is ContextMenuCommandType;
|
|
829
|
-
declare function
|
|
1140
|
+
declare function validateRequiredParameters(name: string, type: number): void;
|
|
830
1141
|
|
|
831
|
-
declare const
|
|
1142
|
+
declare const Assertions_validateDefaultPermission: typeof validateDefaultPermission;
|
|
832
1143
|
declare const Assertions_validateName: typeof validateName;
|
|
833
1144
|
declare const Assertions_validateType: typeof validateType;
|
|
834
|
-
declare const
|
|
1145
|
+
declare const Assertions_validateRequiredParameters: typeof validateRequiredParameters;
|
|
835
1146
|
declare namespace Assertions {
|
|
836
1147
|
export {
|
|
837
|
-
|
|
1148
|
+
Assertions_validateDefaultPermission as validateDefaultPermission,
|
|
838
1149
|
Assertions_validateName as validateName,
|
|
839
1150
|
Assertions_validateType as validateType,
|
|
840
|
-
|
|
1151
|
+
Assertions_validateRequiredParameters as validateRequiredParameters,
|
|
841
1152
|
};
|
|
842
1153
|
}
|
|
843
1154
|
|
|
844
|
-
export { AuthorOptions, Assertions as ContextMenuCommandAssertions, ContextMenuCommandBuilder, ContextMenuCommandType, Embed, Assertions$
|
|
1155
|
+
export { ActionRow, ActionRowComponent, AuthorOptions, ButtonComponent, Component, Assertions$2 as ComponentAssertions, Assertions as ContextMenuCommandAssertions, ContextMenuCommandBuilder, ContextMenuCommandType, Embed, Assertions$3 as EmbedAssertions, Faces, FooterOptions, JSONEncodable, MappedComponentTypes, MessageComponent, SelectMenuComponent, SelectMenuOption, Assertions$1 as SlashCommandAssertions, SlashCommandBooleanOption, SlashCommandBuilder, SlashCommandChannelOption, SlashCommandIntegerOption, SlashCommandMentionableOption, SlashCommandNumberOption, SlashCommandOptionsOnlyBuilder, SlashCommandRoleOption, SlashCommandStringOption, SlashCommandSubcommandBuilder, SlashCommandSubcommandGroupBuilder, SlashCommandSubcommandsOnlyBuilder, SlashCommandUserOption, TimestampStyles, TimestampStylesString, ToAPIApplicationCommandOptions, UnsafeButtonComponent, UnsafeEmbed, UnsafeSelectMenuComponent, UnsafeSelectMenuOption, blockQuote, bold, channelMention, codeBlock, createComponent, formatEmoji, hideLinkEmbed, hyperlink, inlineCode, isJSONEncodable, italic, memberNicknameMention, quote, roleMention, spoiler, strikethrough, time, underscore, userMention };
|