@discordjs/builders 0.10.0 → 0.13.0-dev.1644106034.d8184f9

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 CHANGED
@@ -1,8 +1,7 @@
1
- import { APIEmbedField, APIEmbed, APIEmbedThumbnail, APIEmbedImage, APIEmbedVideo, APIEmbedAuthor, APIEmbedProvider, APIEmbedFooter, ApplicationCommandOptionType, ChannelType, APIApplicationCommandChannelOptions, APIApplicationCommandOptionChoice, APIApplicationCommandOption, APIApplicationCommandSubCommandOptions, RESTPostAPIApplicationCommandsJSONBody, ApplicationCommandType } from 'discord-api-types/v9';
1
+ import { APIEmbedField, APIEmbed, APIEmbedThumbnail, APIEmbedImage, APIEmbedVideo, APIEmbedAuthor, APIEmbedProvider, APIEmbedFooter, APIMessageComponentEmoji, APISelectMenuOption, ButtonStyle, ComponentType, APIMessageComponent, 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';
5
- import * as discord_api_types from 'discord-api-types';
6
5
 
7
6
  declare const fieldNamePredicate: z.ZodString;
8
7
  declare const fieldValuePredicate: z.ZodString;
@@ -43,36 +42,36 @@ declare const footerTextPredicate: z.ZodNullable<z.ZodString>;
43
42
  declare const timestampPredicate: z.ZodNullable<z.ZodUnion<[z.ZodNumber, z.ZodDate]>>;
44
43
  declare const titlePredicate: z.ZodNullable<z.ZodString>;
45
44
 
46
- declare const Assertions$2_fieldNamePredicate: typeof fieldNamePredicate;
47
- declare const Assertions$2_fieldValuePredicate: typeof fieldValuePredicate;
48
- declare const Assertions$2_fieldInlinePredicate: typeof fieldInlinePredicate;
49
- declare const Assertions$2_embedFieldPredicate: typeof embedFieldPredicate;
50
- declare const Assertions$2_embedFieldsArrayPredicate: typeof embedFieldsArrayPredicate;
51
- declare const Assertions$2_fieldLengthPredicate: typeof fieldLengthPredicate;
52
- declare const Assertions$2_validateFieldLength: typeof validateFieldLength;
53
- declare const Assertions$2_authorNamePredicate: typeof authorNamePredicate;
54
- declare const Assertions$2_urlPredicate: typeof urlPredicate;
55
- declare const Assertions$2_colorPredicate: typeof colorPredicate;
56
- declare const Assertions$2_descriptionPredicate: typeof descriptionPredicate;
57
- declare const Assertions$2_footerTextPredicate: typeof footerTextPredicate;
58
- declare const Assertions$2_timestampPredicate: typeof timestampPredicate;
59
- declare const Assertions$2_titlePredicate: typeof titlePredicate;
60
- declare namespace Assertions$2 {
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 {
61
60
  export {
62
- Assertions$2_fieldNamePredicate as fieldNamePredicate,
63
- Assertions$2_fieldValuePredicate as fieldValuePredicate,
64
- Assertions$2_fieldInlinePredicate as fieldInlinePredicate,
65
- Assertions$2_embedFieldPredicate as embedFieldPredicate,
66
- Assertions$2_embedFieldsArrayPredicate as embedFieldsArrayPredicate,
67
- Assertions$2_fieldLengthPredicate as fieldLengthPredicate,
68
- Assertions$2_validateFieldLength as validateFieldLength,
69
- Assertions$2_authorNamePredicate as authorNamePredicate,
70
- Assertions$2_urlPredicate as urlPredicate,
71
- Assertions$2_colorPredicate as colorPredicate,
72
- Assertions$2_descriptionPredicate as descriptionPredicate,
73
- Assertions$2_footerTextPredicate as footerTextPredicate,
74
- Assertions$2_timestampPredicate as timestampPredicate,
75
- Assertions$2_titlePredicate as titlePredicate,
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,
76
75
  };
77
76
  }
78
77
 
@@ -85,58 +84,55 @@ interface FooterOptions {
85
84
  text: string;
86
85
  iconURL?: string;
87
86
  }
88
- /**
89
- * Represents an embed in a message (image/video preview, rich embed, etc.)
90
- */
91
- declare class Embed implements APIEmbed {
87
+ declare class UnsafeEmbed implements APIEmbed {
92
88
  /**
93
89
  * An array of fields of this embed
94
90
  */
95
- fields: APIEmbedField[];
91
+ readonly fields: APIEmbedField[];
96
92
  /**
97
93
  * The embed title
98
94
  */
99
- title?: string;
95
+ readonly title?: string;
100
96
  /**
101
97
  * The embed description
102
98
  */
103
- description?: string;
99
+ readonly description?: string;
104
100
  /**
105
101
  * The embed url
106
102
  */
107
- url?: string;
103
+ readonly url?: string;
108
104
  /**
109
105
  * The embed color
110
106
  */
111
- color?: number;
107
+ readonly color?: number;
112
108
  /**
113
109
  * The timestamp of the embed in the ISO format
114
110
  */
115
- timestamp?: string;
111
+ readonly timestamp?: string;
116
112
  /**
117
113
  * The embed thumbnail data
118
114
  */
119
- thumbnail?: APIEmbedThumbnail;
115
+ readonly thumbnail?: APIEmbedThumbnail;
120
116
  /**
121
117
  * The embed image data
122
118
  */
123
- image?: APIEmbedImage;
119
+ readonly image?: APIEmbedImage;
124
120
  /**
125
121
  * Received video data
126
122
  */
127
- video?: APIEmbedVideo;
123
+ readonly video?: APIEmbedVideo;
128
124
  /**
129
125
  * The embed author data
130
126
  */
131
- author?: APIEmbedAuthor;
127
+ readonly author?: APIEmbedAuthor;
132
128
  /**
133
129
  * Received data about the embed provider
134
130
  */
135
- provider?: APIEmbedProvider;
131
+ readonly provider?: APIEmbedProvider;
136
132
  /**
137
133
  * The embed footer data
138
134
  */
139
- footer?: APIEmbedFooter;
135
+ readonly footer?: APIEmbedFooter;
140
136
  constructor(data?: APIEmbed);
141
137
  /**
142
138
  * The accumulated length for the embed title, description, fields, footer text, and author name
@@ -162,6 +158,11 @@ declare class Embed implements APIEmbed {
162
158
  * @param fields The replacing field objects
163
159
  */
164
160
  spliceFields(index: number, deleteCount: number, ...fields: APIEmbedField[]): this;
161
+ /**
162
+ * Sets the embed's fields (max 25).
163
+ * @param fields The fields to set
164
+ */
165
+ setFields(...fields: APIEmbedField[]): this;
165
166
  /**
166
167
  * Sets the author of this embed
167
168
  *
@@ -228,6 +229,29 @@ declare class Embed implements APIEmbed {
228
229
  static normalizeFields(...fields: APIEmbedField[]): APIEmbedField[];
229
230
  }
230
231
 
232
+ /**
233
+ * Represents an embed in a message (image/video preview, rich embed, etc.)
234
+ */
235
+ declare class Embed extends UnsafeEmbed {
236
+ addFields(...fields: APIEmbedField[]): this;
237
+ spliceFields(index: number, deleteCount: number, ...fields: APIEmbedField[]): this;
238
+ setAuthor(options: AuthorOptions | null): this;
239
+ setColor(color: number | null): this;
240
+ setDescription(description: string | null): this;
241
+ setFooter(options: FooterOptions | null): this;
242
+ setImage(url: string | null): this;
243
+ setThumbnail(url: string | null): this;
244
+ setTimestamp(timestamp?: number | Date | null): this;
245
+ setTitle(title: string | null): this;
246
+ setURL(url: string | null): this;
247
+ /**
248
+ * Normalizes field input and resolves strings
249
+ *
250
+ * @param fields Fields to normalize
251
+ */
252
+ static normalizeFields(...fields: APIEmbedField[]): APIEmbedField[];
253
+ }
254
+
231
255
  /**
232
256
  * Wraps the content inside a codeblock with no language
233
257
  *
@@ -449,36 +473,363 @@ declare enum Faces {
449
473
  Unflip = "\u252C\u2500\u252C \u30CE( \u309C-\u309C\u30CE)"
450
474
  }
451
475
 
452
- declare class SlashCommandBooleanOption extends SlashCommandOptionBase {
476
+ /**
477
+ * Represents a non-validated option within a select menu component
478
+ */
479
+ declare class UnsafeSelectMenuOption {
480
+ readonly label: string;
481
+ readonly value: string;
482
+ readonly description?: string;
483
+ readonly emoji?: APIMessageComponentEmoji;
484
+ readonly default?: boolean;
485
+ constructor(data?: APISelectMenuOption);
486
+ /**
487
+ * Sets the label of this option
488
+ * @param label The label to show on this option
489
+ */
490
+ setLabel(label: string): this;
491
+ /**
492
+ * Sets the value of this option
493
+ * @param value The value of this option
494
+ */
495
+ setValue(value: string): this;
496
+ /**
497
+ * Sets the description of this option.
498
+ * @param description The description of this option
499
+ */
500
+ setDescription(description: string): this;
501
+ /**
502
+ * Sets whether this option is selected by default
503
+ * @param isDefault Whether or not this option is selected by default
504
+ */
505
+ setDefault(isDefault: boolean): this;
506
+ /**
507
+ * Sets the emoji to display on this button
508
+ * @param emoji The emoji to display on this button
509
+ */
510
+ setEmoji(emoji: APIMessageComponentEmoji): this;
511
+ toJSON(): APISelectMenuOption;
512
+ }
513
+
514
+ /**
515
+ * Represents an option within a select menu component
516
+ */
517
+ declare class SelectMenuOption extends UnsafeSelectMenuOption {
518
+ setDescription(description: string): this;
519
+ setDefault(isDefault: boolean): this;
520
+ setEmoji(emoji: APIMessageComponentEmoji): this;
521
+ toJSON(): APISelectMenuOption;
522
+ }
523
+
524
+ declare const customIdValidator: z.ZodString;
525
+ declare const emojiValidator: z.ZodObject<{
526
+ id: z.ZodOptional<z.ZodString>;
527
+ name: z.ZodOptional<z.ZodString>;
528
+ animated: z.ZodOptional<z.ZodBoolean>;
529
+ }, "strict", z.ZodTypeAny, {
530
+ name?: string | undefined;
531
+ id?: string | undefined;
532
+ animated?: boolean | undefined;
533
+ }, {
534
+ name?: string | undefined;
535
+ id?: string | undefined;
536
+ animated?: boolean | undefined;
537
+ }>;
538
+ declare const disabledValidator: z.ZodBoolean;
539
+ declare const buttonLabelValidator: z.ZodString;
540
+ declare const buttonStyleValidator: z.ZodNumber;
541
+ declare const placeholderValidator: z.ZodString;
542
+ declare const minMaxValidator: z.ZodNumber;
543
+ declare const optionsValidator: z.ZodArray<z.ZodObject<{}, "strip", z.ZodTypeAny, {}, {}>, "atleastone">;
544
+ declare function validateRequiredSelectMenuParameters(options: SelectMenuOption[], customId?: string): void;
545
+ declare const labelValueValidator: z.ZodString;
546
+ declare const defaultValidator: z.ZodBoolean;
547
+ declare function validateRequiredSelectMenuOptionParameters(label?: string, value?: string): void;
548
+ declare const urlValidator: z.ZodString;
549
+ declare function validateRequiredButtonParameters(style: ButtonStyle, label?: string, emoji?: APIMessageComponentEmoji, customId?: string, url?: string): void;
550
+
551
+ declare const Assertions$2_customIdValidator: typeof customIdValidator;
552
+ declare const Assertions$2_emojiValidator: typeof emojiValidator;
553
+ declare const Assertions$2_disabledValidator: typeof disabledValidator;
554
+ declare const Assertions$2_buttonLabelValidator: typeof buttonLabelValidator;
555
+ declare const Assertions$2_buttonStyleValidator: typeof buttonStyleValidator;
556
+ declare const Assertions$2_placeholderValidator: typeof placeholderValidator;
557
+ declare const Assertions$2_minMaxValidator: typeof minMaxValidator;
558
+ declare const Assertions$2_optionsValidator: typeof optionsValidator;
559
+ declare const Assertions$2_validateRequiredSelectMenuParameters: typeof validateRequiredSelectMenuParameters;
560
+ declare const Assertions$2_labelValueValidator: typeof labelValueValidator;
561
+ declare const Assertions$2_defaultValidator: typeof defaultValidator;
562
+ declare const Assertions$2_validateRequiredSelectMenuOptionParameters: typeof validateRequiredSelectMenuOptionParameters;
563
+ declare const Assertions$2_urlValidator: typeof urlValidator;
564
+ declare const Assertions$2_validateRequiredButtonParameters: typeof validateRequiredButtonParameters;
565
+ declare namespace Assertions$2 {
566
+ export {
567
+ Assertions$2_customIdValidator as customIdValidator,
568
+ Assertions$2_emojiValidator as emojiValidator,
569
+ Assertions$2_disabledValidator as disabledValidator,
570
+ Assertions$2_buttonLabelValidator as buttonLabelValidator,
571
+ Assertions$2_buttonStyleValidator as buttonStyleValidator,
572
+ Assertions$2_placeholderValidator as placeholderValidator,
573
+ Assertions$2_minMaxValidator as minMaxValidator,
574
+ Assertions$2_optionsValidator as optionsValidator,
575
+ Assertions$2_validateRequiredSelectMenuParameters as validateRequiredSelectMenuParameters,
576
+ Assertions$2_labelValueValidator as labelValueValidator,
577
+ Assertions$2_defaultValidator as defaultValidator,
578
+ Assertions$2_validateRequiredSelectMenuOptionParameters as validateRequiredSelectMenuOptionParameters,
579
+ Assertions$2_urlValidator as urlValidator,
580
+ Assertions$2_validateRequiredButtonParameters as validateRequiredButtonParameters,
581
+ };
582
+ }
583
+
584
+ /**
585
+ * Represents a discord component
586
+ */
587
+ interface Component {
588
+ /**
589
+ * The type of this component
590
+ */
591
+ readonly type: ComponentType;
592
+ /**
593
+ * Converts this component to an API-compatible JSON object
594
+ */
595
+ toJSON: () => APIMessageComponent;
596
+ }
597
+
598
+ declare type MessageComponent = ActionRowComponent | ActionRow;
599
+ declare type ActionRowComponent = ButtonComponent | SelectMenuComponent;
600
+ /**
601
+ * Represents an action row component
602
+ */
603
+ declare class ActionRow<T extends ActionRowComponent = ActionRowComponent> implements Component {
604
+ readonly components: T[];
605
+ readonly type = ComponentType.ActionRow;
606
+ constructor(data?: APIActionRowComponent & {
607
+ type?: ComponentType.ActionRow;
608
+ });
609
+ /**
610
+ * Adds components to this action row.
611
+ * @param components The components to add to this action row.
612
+ * @returns
613
+ */
614
+ addComponents(...components: T[]): this;
615
+ /**
616
+ * Sets the components in this action row
617
+ * @param components The components to set this row to
618
+ */
619
+ setComponents(components: T[]): this;
620
+ toJSON(): APIActionRowComponent;
621
+ }
622
+
623
+ declare class UnsafeButtonComponent implements Component {
624
+ readonly type: ComponentType.Button;
625
+ readonly style: ButtonStyle;
626
+ readonly label?: string;
627
+ readonly emoji?: APIMessageComponentEmoji;
628
+ readonly disabled?: boolean;
629
+ readonly custom_id: string;
630
+ readonly url: string;
631
+ constructor(data?: APIButtonComponent & {
632
+ type?: ComponentType.Button;
633
+ });
634
+ /**
635
+ * Sets the style of this button
636
+ * @param style The style of the button
637
+ */
638
+ setStyle(style: ButtonStyle): this;
639
+ /**
640
+ * Sets the URL for this button
641
+ * @param url The URL to open when this button is clicked
642
+ */
643
+ setURL(url: string): this;
644
+ /**
645
+ * Sets the custom Id for this button
646
+ * @param customId The custom ID to use for this button
647
+ */
648
+ setCustomId(customId: string): this;
649
+ /**
650
+ * Sets the emoji to display on this button
651
+ * @param emoji The emoji to display on this button
652
+ */
653
+ setEmoji(emoji: APIMessageComponentEmoji): this;
654
+ /**
655
+ * Sets whether this button is disable or not
656
+ * @param disabled Whether or not to disable this button or not
657
+ */
658
+ setDisabled(disabled: boolean): this;
659
+ /**
660
+ * Sets the label for this button
661
+ * @param label The label to display on this button
662
+ */
663
+ setLabel(label: string): this;
664
+ toJSON(): APIButtonComponent;
665
+ }
666
+
667
+ declare class ButtonComponent extends UnsafeButtonComponent {
668
+ setStyle(style: ButtonStyle): this;
669
+ setURL(url: string): this;
670
+ setCustomId(customId: string): this;
671
+ setEmoji(emoji: APIMessageComponentEmoji): this;
672
+ setDisabled(disabled: boolean): this;
673
+ setLabel(label: string): this;
674
+ toJSON(): APIButtonComponent;
675
+ }
676
+
677
+ interface MappedComponentTypes {
678
+ [ComponentType.ActionRow]: ActionRow;
679
+ [ComponentType.Button]: ButtonComponent;
680
+ [ComponentType.SelectMenu]: SelectMenuComponent;
681
+ }
682
+ /**
683
+ * Factory for creating components from API data
684
+ * @param data The api data to transform to a component class
685
+ */
686
+ declare function createComponent<T extends keyof MappedComponentTypes>(data: APIMessageComponent & {
687
+ type: T;
688
+ }): MappedComponentTypes[T];
689
+ declare function createComponent<C extends MessageComponent>(data: C): C;
690
+
691
+ /**
692
+ * Represents a non-validated select menu component
693
+ */
694
+ declare class UnsafeSelectMenuComponent implements Component {
695
+ readonly type: ComponentType.SelectMenu;
696
+ readonly options: SelectMenuOption[];
697
+ readonly placeholder?: string;
698
+ readonly min_values?: number;
699
+ readonly max_values?: number;
700
+ readonly custom_id: string;
701
+ readonly disabled?: boolean;
702
+ constructor(data?: APISelectMenuComponent);
703
+ /**
704
+ * Sets the placeholder for this select menu
705
+ * @param placeholder The placeholder to use for this select menu
706
+ */
707
+ setPlaceholder(placeholder: string): this;
708
+ /**
709
+ * Sets thes minimum values that must be selected in the select menu
710
+ * @param minValues The minimum values that must be selected
711
+ */
712
+ setMinValues(minValues: number): this;
713
+ /**
714
+ * Sets thes maximum values that must be selected in the select menu
715
+ * @param minValues The maximum values that must be selected
716
+ */
717
+ setMaxValues(maxValues: number): this;
718
+ /**
719
+ * Sets the custom Id for this select menu
720
+ * @param customId The custom ID to use for this select menu
721
+ */
722
+ setCustomId(customId: string): this;
723
+ /**
724
+ * Sets whether or not this select menu is disabled
725
+ * @param disabled Whether or not this select menu is disabled
726
+ */
727
+ setDisabled(disabled: boolean): this;
728
+ /**
729
+ * Adds options to this select menu
730
+ * @param options The options to add to this select menu
731
+ * @returns
732
+ */
733
+ addOptions(...options: SelectMenuOption[]): this;
734
+ /**
735
+ * Sets the options on this select menu
736
+ * @param options The options to set on this select menu
737
+ */
738
+ setOptions(options: SelectMenuOption[]): this;
739
+ toJSON(): APISelectMenuComponent;
740
+ }
741
+
742
+ /**
743
+ * Represents a select menu component
744
+ */
745
+ declare class SelectMenuComponent extends UnsafeSelectMenuComponent {
746
+ setPlaceholder(placeholder: string): this;
747
+ setMinValues(minValues: number): this;
748
+ setMaxValues(maxValues: number): this;
749
+ setCustomId(customId: string): this;
750
+ setDisabled(disabled: boolean): this;
751
+ toJSON(): APISelectMenuComponent;
752
+ }
753
+
754
+ declare class SharedNameAndDescription {
755
+ readonly name: string;
756
+ readonly description: string;
757
+ /**
758
+ * Sets the name
759
+ *
760
+ * @param name The name
761
+ */
762
+ setName(name: string): this;
763
+ /**
764
+ * Sets the description
765
+ *
766
+ * @param description The description
767
+ */
768
+ setDescription(description: string): this;
769
+ }
770
+
771
+ declare abstract class ApplicationCommandOptionBase extends SharedNameAndDescription {
772
+ abstract readonly type: ApplicationCommandOptionType;
773
+ readonly required: boolean;
774
+ /**
775
+ * Marks the option as required
776
+ *
777
+ * @param required If this option should be required
778
+ */
779
+ setRequired(required: boolean): this;
780
+ abstract toJSON(): APIApplicationCommandBasicOption;
781
+ protected runRequiredValidations(): void;
782
+ }
783
+
784
+ declare class SlashCommandBooleanOption extends ApplicationCommandOptionBase {
453
785
  readonly type: ApplicationCommandOptionType.Boolean;
454
- constructor();
786
+ toJSON(): APIApplicationCommandBooleanOption;
455
787
  }
456
788
 
457
- declare abstract class ApplicationCommandOptionWithChannelTypesBase extends SlashCommandOptionBase<ApplicationCommandOptionType.Channel> implements ToAPIApplicationCommandOptions {
458
- channelTypes?: Exclude<ChannelType, ChannelType.DM | ChannelType.GroupDM>[];
789
+ declare const allowedChannelTypes: readonly [ChannelType.GuildText, ChannelType.GuildVoice, ChannelType.GuildCategory, ChannelType.GuildNews, ChannelType.GuildStore, ChannelType.GuildNewsThread, ChannelType.GuildPublicThread, ChannelType.GuildPrivateThread, ChannelType.GuildStageVoice];
790
+ declare type ApplicationCommandOptionAllowedChannelTypes = typeof allowedChannelTypes[number];
791
+ declare class ApplicationCommandOptionChannelTypesMixin {
792
+ readonly channel_types?: ApplicationCommandOptionAllowedChannelTypes[];
459
793
  /**
460
794
  * Adds a channel type to this option
461
795
  *
462
796
  * @param channelType The type of channel to allow
463
797
  */
464
- addChannelType(channelType: Exclude<ChannelType, ChannelType.DM | ChannelType.GroupDM>): this;
798
+ addChannelType(channelType: ApplicationCommandOptionAllowedChannelTypes): this;
465
799
  /**
466
800
  * Adds channel types to this option
467
801
  *
468
802
  * @param channelTypes The channel types to add
469
803
  */
470
- addChannelTypes(channelTypes: Exclude<ChannelType, ChannelType.DM | ChannelType.GroupDM>[]): this;
471
- toJSON(): APIApplicationCommandChannelOptions;
804
+ addChannelTypes(channelTypes: ApplicationCommandOptionAllowedChannelTypes[]): this;
472
805
  }
473
806
 
474
- declare class SlashCommandChannelOption extends ApplicationCommandOptionWithChannelTypesBase {
807
+ declare class SlashCommandChannelOption extends ApplicationCommandOptionBase {
475
808
  readonly type: ApplicationCommandOptionType.Channel;
476
- constructor();
809
+ toJSON(): APIApplicationCommandChannelOption;
810
+ }
811
+ interface SlashCommandChannelOption extends ApplicationCommandOptionChannelTypesMixin {
477
812
  }
478
813
 
479
- declare abstract class ApplicationCommandOptionWithChoicesBase<T extends string | number> extends SlashCommandOptionBase<ApplicationCommandOptionType.String | ApplicationCommandOptionType.Number | ApplicationCommandOptionType.Integer> implements ToAPIApplicationCommandOptions {
480
- choices?: APIApplicationCommandOptionChoice[];
814
+ declare abstract class ApplicationCommandNumericOptionMinMaxValueMixin {
815
+ readonly max_value?: number;
816
+ readonly min_value?: number;
817
+ /**
818
+ * Sets the maximum number value of this option
819
+ * @param max The maximum value this option can be
820
+ */
821
+ abstract setMaxValue(max: number): this;
822
+ /**
823
+ * Sets the minimum number value of this option
824
+ * @param min The minimum value this option can be
825
+ */
826
+ abstract setMinValue(min: number): this;
827
+ }
828
+
829
+ declare class ApplicationCommandOptionWithChoicesAndAutocompleteMixin<T extends string | number> {
830
+ readonly choices?: APIApplicationCommandOptionChoice<T>[];
481
831
  readonly autocomplete?: boolean;
832
+ readonly type: ApplicationCommandOptionType;
482
833
  /**
483
834
  * Adds a choice for this option
484
835
  *
@@ -492,122 +843,52 @@ declare abstract class ApplicationCommandOptionWithChoicesBase<T extends string
492
843
  * @param choices The choices to add
493
844
  */
494
845
  addChoices(choices: [name: string, value: T][]): Omit<this, 'setAutocomplete'>;
846
+ setChoices<Input extends [name: string, value: T][]>(choices: Input): Input extends [] ? this & Pick<ApplicationCommandOptionWithChoicesAndAutocompleteMixin<T>, 'setAutocomplete'> : Omit<this, 'setAutocomplete'>;
495
847
  /**
496
848
  * Marks the option as autocompletable
497
849
  * @param autocomplete If this option should be autocompletable
498
850
  */
499
- setAutocomplete<U extends boolean>(autocomplete: U): U extends true ? Omit<this, 'addChoice' | 'addChoices'> : this & Pick<ApplicationCommandOptionWithChoicesBase<T>, 'addChoice' | 'addChoices'>;
500
- toJSON(): APIApplicationCommandOption;
851
+ setAutocomplete<U extends boolean>(autocomplete: U): U extends true ? Omit<this, 'addChoice' | 'addChoices'> : this & Pick<ApplicationCommandOptionWithChoicesAndAutocompleteMixin<T>, 'addChoice' | 'addChoices'>;
501
852
  }
502
853
 
503
- declare abstract class ApplicationCommandNumberOptionBase extends ApplicationCommandOptionWithChoicesBase<number> {
504
- protected maxValue?: number;
505
- protected minValue?: number;
506
- /**
507
- * Sets the maximum number value of this option
508
- * @param max The maximum value this option can be
509
- */
510
- abstract setMaxValue(max: number): this;
511
- /**
512
- * Sets the minimum number value of this option
513
- * @param min The minimum value this option can be
514
- */
515
- abstract setMinValue(min: number): this;
516
- toJSON(): {
517
- min_value: number | undefined;
518
- max_value: number | undefined;
519
- type: discord_api_types.ApplicationCommandOptionType.String | discord_api_types.ApplicationCommandOptionType.Integer | discord_api_types.ApplicationCommandOptionType.Number;
520
- choices?: discord_api_types.APIApplicationCommandOptionChoice[] | undefined;
521
- autocomplete?: false | undefined;
522
- name: string;
523
- description: string;
524
- required?: boolean | undefined;
525
- } | {
526
- min_value: number | undefined;
527
- max_value: number | undefined;
528
- type: discord_api_types.ApplicationCommandOptionType.Subcommand | discord_api_types.ApplicationCommandOptionType.SubcommandGroup;
529
- options?: discord_api_types.APIApplicationCommandOption[] | undefined;
530
- name: string;
531
- description: string;
532
- required?: boolean | undefined;
533
- autocomplete?: undefined;
534
- } | {
535
- min_value: number | undefined;
536
- max_value: number | undefined;
537
- type: discord_api_types.ApplicationCommandOptionType.Boolean | discord_api_types.ApplicationCommandOptionType.User | discord_api_types.ApplicationCommandOptionType.Role | discord_api_types.ApplicationCommandOptionType.Mentionable;
538
- name: string;
539
- description: string;
540
- required?: boolean | undefined;
541
- autocomplete?: undefined;
542
- } | {
543
- min_value: number | undefined;
544
- max_value: number | undefined;
545
- type: discord_api_types.ApplicationCommandOptionType.Channel;
546
- channel_types?: (discord_api_types.ChannelType.GuildText | discord_api_types.ChannelType.GuildVoice | discord_api_types.ChannelType.GuildCategory | discord_api_types.ChannelType.GuildNews | discord_api_types.ChannelType.GuildStore | discord_api_types.ChannelType.GuildNewsThread | discord_api_types.ChannelType.GuildPublicThread | discord_api_types.ChannelType.GuildPrivateThread | discord_api_types.ChannelType.GuildStageVoice)[] | undefined;
547
- name: string;
548
- description: string;
549
- required?: boolean | undefined;
550
- autocomplete?: undefined;
551
- } | {
552
- min_value: number | undefined;
553
- max_value: number | undefined;
554
- type: discord_api_types.ApplicationCommandOptionType.Integer | discord_api_types.ApplicationCommandOptionType.Number;
555
- choices?: discord_api_types.APIApplicationCommandOptionChoice[] | undefined;
556
- autocomplete?: false | undefined;
557
- name: string;
558
- description: string;
559
- required?: boolean | undefined;
560
- } | {
561
- min_value: number | undefined;
562
- max_value: number | undefined;
563
- type: discord_api_types.ApplicationCommandOptionType.String;
564
- autocomplete: true;
565
- name: string;
566
- description: string;
567
- required?: boolean | undefined;
568
- } | {
569
- min_value: number | undefined;
570
- max_value: number | undefined;
571
- type: discord_api_types.ApplicationCommandOptionType.Integer | discord_api_types.ApplicationCommandOptionType.Number;
572
- autocomplete: true;
573
- name: string;
574
- description: string;
575
- required?: boolean | undefined;
576
- };
577
- }
578
-
579
- declare class SlashCommandIntegerOption extends ApplicationCommandNumberOptionBase {
854
+ declare class SlashCommandIntegerOption extends ApplicationCommandOptionBase implements ApplicationCommandNumericOptionMinMaxValueMixin {
580
855
  readonly type: ApplicationCommandOptionType.Integer;
581
- constructor();
582
856
  setMaxValue(max: number): this;
583
857
  setMinValue(min: number): this;
858
+ toJSON(): APIApplicationCommandIntegerOption;
859
+ }
860
+ interface SlashCommandIntegerOption extends ApplicationCommandNumericOptionMinMaxValueMixin, ApplicationCommandOptionWithChoicesAndAutocompleteMixin<number> {
584
861
  }
585
862
 
586
- declare class SlashCommandMentionableOption extends SlashCommandOptionBase {
863
+ declare class SlashCommandMentionableOption extends ApplicationCommandOptionBase {
587
864
  readonly type: ApplicationCommandOptionType.Mentionable;
588
- constructor();
865
+ toJSON(): APIApplicationCommandMentionableOption;
589
866
  }
590
867
 
591
- declare class SlashCommandNumberOption extends ApplicationCommandNumberOptionBase {
868
+ declare class SlashCommandNumberOption extends ApplicationCommandOptionBase implements ApplicationCommandNumericOptionMinMaxValueMixin {
592
869
  readonly type: ApplicationCommandOptionType.Number;
593
- constructor();
594
870
  setMaxValue(max: number): this;
595
871
  setMinValue(min: number): this;
872
+ toJSON(): APIApplicationCommandNumberOption;
873
+ }
874
+ interface SlashCommandNumberOption extends ApplicationCommandNumericOptionMinMaxValueMixin, ApplicationCommandOptionWithChoicesAndAutocompleteMixin<number> {
596
875
  }
597
876
 
598
- declare class SlashCommandRoleOption extends SlashCommandOptionBase {
877
+ declare class SlashCommandRoleOption extends ApplicationCommandOptionBase {
599
878
  readonly type: ApplicationCommandOptionType.Role;
600
- constructor();
879
+ toJSON(): APIApplicationCommandRoleOption;
601
880
  }
602
881
 
603
- declare class SlashCommandStringOption extends ApplicationCommandOptionWithChoicesBase<string> {
882
+ declare class SlashCommandStringOption extends ApplicationCommandOptionBase {
604
883
  readonly type: ApplicationCommandOptionType.String;
605
- constructor();
884
+ toJSON(): APIApplicationCommandStringOption;
885
+ }
886
+ interface SlashCommandStringOption extends ApplicationCommandOptionWithChoicesAndAutocompleteMixin<string> {
606
887
  }
607
888
 
608
- declare class SlashCommandUserOption extends SlashCommandOptionBase {
889
+ declare class SlashCommandUserOption extends ApplicationCommandOptionBase {
609
890
  readonly type: ApplicationCommandOptionType.User;
610
- constructor();
891
+ toJSON(): APIApplicationCommandUserOption;
611
892
  }
612
893
 
613
894
  declare class SharedSlashCommandOptions<ShouldOmitSubcommandFunctions = true> {
@@ -663,27 +944,10 @@ declare class SharedSlashCommandOptions<ShouldOmitSubcommandFunctions = true> {
663
944
  private _sharedAddOptionMethod;
664
945
  }
665
946
 
666
- declare class SharedNameAndDescription {
667
- readonly name: string;
668
- readonly description: string;
669
- /**
670
- * Sets the name
671
- *
672
- * @param name The name
673
- */
674
- setName(name: string): this;
675
- /**
676
- * Sets the description
677
- *
678
- * @param description The description
679
- */
680
- setDescription(description: string): this;
681
- }
682
-
683
947
  /**
684
948
  * Represents a folder for subcommands
685
949
  *
686
- * For more information, go to https://discord.com/developers/docs/interactions/slash-commands#subcommands-and-subcommand-groups
950
+ * For more information, go to https://discord.com/developers/docs/interactions/application-commands#subcommands-and-subcommand-groups
687
951
  */
688
952
  declare class SlashCommandSubcommandGroupBuilder implements ToAPIApplicationCommandOptions {
689
953
  /**
@@ -697,21 +961,21 @@ declare class SlashCommandSubcommandGroupBuilder implements ToAPIApplicationComm
697
961
  /**
698
962
  * The subcommands part of this subcommand group
699
963
  */
700
- readonly options: ToAPIApplicationCommandOptions[];
964
+ readonly options: SlashCommandSubcommandBuilder[];
701
965
  /**
702
966
  * Adds a new subcommand to this group
703
967
  *
704
968
  * @param input A function that returns a subcommand builder, or an already built builder
705
969
  */
706
970
  addSubcommand(input: SlashCommandSubcommandBuilder | ((subcommandGroup: SlashCommandSubcommandBuilder) => SlashCommandSubcommandBuilder)): this;
707
- toJSON(): APIApplicationCommandSubCommandOptions;
971
+ toJSON(): APIApplicationCommandSubcommandGroupOption;
708
972
  }
709
973
  interface SlashCommandSubcommandGroupBuilder extends SharedNameAndDescription {
710
974
  }
711
975
  /**
712
976
  * Represents a subcommand
713
977
  *
714
- * For more information, go to https://discord.com/developers/docs/interactions/slash-commands#subcommands-and-subcommand-groups
978
+ * For more information, go to https://discord.com/developers/docs/interactions/application-commands#subcommands-and-subcommand-groups
715
979
  */
716
980
  declare class SlashCommandSubcommandBuilder implements ToAPIApplicationCommandOptions {
717
981
  /**
@@ -725,8 +989,8 @@ declare class SlashCommandSubcommandBuilder implements ToAPIApplicationCommandOp
725
989
  /**
726
990
  * The options of this subcommand
727
991
  */
728
- readonly options: ToAPIApplicationCommandOptions[];
729
- toJSON(): APIApplicationCommandSubCommandOptions;
992
+ readonly options: ApplicationCommandOptionBase[];
993
+ toJSON(): APIApplicationCommandSubcommandOption;
730
994
  }
731
995
  interface SlashCommandSubcommandBuilder extends SharedNameAndDescription, SharedSlashCommandOptions<false> {
732
996
  }
@@ -786,44 +1050,31 @@ interface SlashCommandSubcommandsOnlyBuilder extends SharedNameAndDescription, P
786
1050
  interface SlashCommandOptionsOnlyBuilder extends SharedNameAndDescription, SharedSlashCommandOptions, Pick<SlashCommandBuilder, 'toJSON'> {
787
1051
  }
788
1052
  interface ToAPIApplicationCommandOptions {
789
- toJSON(): APIApplicationCommandOption;
1053
+ toJSON: () => APIApplicationCommandOption;
790
1054
  }
791
1055
 
792
- declare class SlashCommandOptionBase<OptionType extends ApplicationCommandOptionType = ApplicationCommandOptionType> extends SharedNameAndDescription implements ToAPIApplicationCommandOptions {
793
- required: boolean;
794
- readonly type: OptionType;
795
- constructor(type: OptionType);
796
- /**
797
- * Marks the option as required
798
- *
799
- * @param required If this option should be required
800
- */
801
- setRequired(required: boolean): this;
802
- toJSON(): APIApplicationCommandOption;
803
- }
804
-
805
- declare function validateRequiredParameters$1(name: string, description: string, options: ToAPIApplicationCommandOptions[]): void;
806
1056
  declare function validateName$1(name: unknown): asserts name is string;
807
1057
  declare function validateDescription(description: unknown): asserts description is string;
1058
+ declare function validateMaxOptionsLength(options: unknown): asserts options is ToAPIApplicationCommandOptions[];
1059
+ declare function validateRequiredParameters$1(name: string, description: string, options: ToAPIApplicationCommandOptions[]): void;
808
1060
  declare function validateDefaultPermission$1(value: unknown): asserts value is boolean;
809
1061
  declare function validateRequired(required: unknown): asserts required is boolean;
810
- declare function validateMaxOptionsLength(options: unknown): asserts options is ToAPIApplicationCommandOptions[];
811
1062
  declare function validateMaxChoicesLength(choices: APIApplicationCommandOptionChoice[]): void;
812
- declare function assertReturnOfBuilder<T extends SlashCommandOptionBase | SlashCommandSubcommandBuilder | SlashCommandSubcommandGroupBuilder>(input: unknown, ExpectedInstanceOf: new () => T): asserts input is T;
1063
+ declare function assertReturnOfBuilder<T extends ApplicationCommandOptionBase | SlashCommandSubcommandBuilder | SlashCommandSubcommandGroupBuilder>(input: unknown, ExpectedInstanceOf: new () => T): asserts input is T;
813
1064
 
814
1065
  declare const Assertions$1_validateDescription: typeof validateDescription;
815
- declare const Assertions$1_validateRequired: typeof validateRequired;
816
1066
  declare const Assertions$1_validateMaxOptionsLength: typeof validateMaxOptionsLength;
1067
+ declare const Assertions$1_validateRequired: typeof validateRequired;
817
1068
  declare const Assertions$1_validateMaxChoicesLength: typeof validateMaxChoicesLength;
818
1069
  declare const Assertions$1_assertReturnOfBuilder: typeof assertReturnOfBuilder;
819
1070
  declare namespace Assertions$1 {
820
1071
  export {
821
- validateRequiredParameters$1 as validateRequiredParameters,
822
1072
  validateName$1 as validateName,
823
1073
  Assertions$1_validateDescription as validateDescription,
1074
+ Assertions$1_validateMaxOptionsLength as validateMaxOptionsLength,
1075
+ validateRequiredParameters$1 as validateRequiredParameters,
824
1076
  validateDefaultPermission$1 as validateDefaultPermission,
825
1077
  Assertions$1_validateRequired as validateRequired,
826
- Assertions$1_validateMaxOptionsLength as validateMaxOptionsLength,
827
1078
  Assertions$1_validateMaxChoicesLength as validateMaxChoicesLength,
828
1079
  Assertions$1_assertReturnOfBuilder as assertReturnOfBuilder,
829
1080
  };
@@ -875,22 +1126,22 @@ declare class ContextMenuCommandBuilder {
875
1126
  }
876
1127
  declare type ContextMenuCommandType = ApplicationCommandType.User | ApplicationCommandType.Message;
877
1128
 
878
- declare function validateRequiredParameters(name: string, type: number): void;
1129
+ declare function validateDefaultPermission(value: unknown): asserts value is boolean;
879
1130
  declare function validateName(name: unknown): asserts name is string;
880
1131
  declare function validateType(type: unknown): asserts type is ContextMenuCommandType;
881
- declare function validateDefaultPermission(value: unknown): asserts value is boolean;
1132
+ declare function validateRequiredParameters(name: string, type: number): void;
882
1133
 
883
- declare const Assertions_validateRequiredParameters: typeof validateRequiredParameters;
1134
+ declare const Assertions_validateDefaultPermission: typeof validateDefaultPermission;
884
1135
  declare const Assertions_validateName: typeof validateName;
885
1136
  declare const Assertions_validateType: typeof validateType;
886
- declare const Assertions_validateDefaultPermission: typeof validateDefaultPermission;
1137
+ declare const Assertions_validateRequiredParameters: typeof validateRequiredParameters;
887
1138
  declare namespace Assertions {
888
1139
  export {
889
- Assertions_validateRequiredParameters as validateRequiredParameters,
1140
+ Assertions_validateDefaultPermission as validateDefaultPermission,
890
1141
  Assertions_validateName as validateName,
891
1142
  Assertions_validateType as validateType,
892
- Assertions_validateDefaultPermission as validateDefaultPermission,
1143
+ Assertions_validateRequiredParameters as validateRequiredParameters,
893
1144
  };
894
1145
  }
895
1146
 
896
- export { AuthorOptions, Assertions as ContextMenuCommandAssertions, ContextMenuCommandBuilder, ContextMenuCommandType, Embed, Assertions$2 as EmbedAssertions, Faces, FooterOptions, Assertions$1 as SlashCommandAssertions, SlashCommandBooleanOption, SlashCommandBuilder, SlashCommandChannelOption, SlashCommandIntegerOption, SlashCommandMentionableOption, SlashCommandNumberOption, SlashCommandOptionsOnlyBuilder, SlashCommandRoleOption, SlashCommandStringOption, SlashCommandSubcommandBuilder, SlashCommandSubcommandGroupBuilder, SlashCommandSubcommandsOnlyBuilder, SlashCommandUserOption, TimestampStyles, TimestampStylesString, ToAPIApplicationCommandOptions, blockQuote, bold, channelMention, codeBlock, formatEmoji, hideLinkEmbed, hyperlink, inlineCode, italic, memberNicknameMention, quote, roleMention, spoiler, strikethrough, time, underscore, userMention };
1147
+ export { ActionRow, ActionRowComponent, AuthorOptions, ButtonComponent, Component, Assertions$2 as ComponentAssertions, Assertions as ContextMenuCommandAssertions, ContextMenuCommandBuilder, ContextMenuCommandType, Embed, Assertions$3 as EmbedAssertions, Faces, FooterOptions, 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, italic, memberNicknameMention, quote, roleMention, spoiler, strikethrough, time, underscore, userMention };