@discordjs/builders 0.9.0 → 0.13.0-dev.1644067366.5f4b44d

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,5 +1,4 @@
1
- import * as discord_api_types_v9 from 'discord-api-types/v9';
2
- import { APIEmbedField, APIEmbed, APIEmbedThumbnail, APIEmbedImage, APIEmbedVideo, APIEmbedAuthor, APIEmbedProvider, APIEmbedFooter, ApplicationCommandOptionType, ChannelType, APIApplicationCommandChannelOptions, APIApplicationCommandOptionChoice, APIApplicationCommandSubCommandOptions, RESTPostAPIApplicationCommandsJSONBody, APIApplicationCommandOption, 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';
3
2
  import { z } from 'zod';
4
3
  import { Snowflake } from 'discord-api-types/globals';
5
4
  import { URL } from 'url';
@@ -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 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 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,76 +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(): {
501
- choices: APIApplicationCommandOptionChoice[] | undefined;
502
- autocomplete: boolean | undefined;
503
- type: ApplicationCommandOptionType.String | ApplicationCommandOptionType.Integer | ApplicationCommandOptionType.Number;
504
- name: string;
505
- description: string;
506
- default?: boolean | undefined;
507
- required?: boolean | undefined;
508
- } | {
509
- choices: APIApplicationCommandOptionChoice[] | undefined;
510
- autocomplete: boolean | undefined;
511
- type: ApplicationCommandOptionType.Subcommand | ApplicationCommandOptionType.SubcommandGroup;
512
- options?: discord_api_types_v9.APIApplicationCommandOption[] | undefined;
513
- name: string;
514
- description: string;
515
- default?: boolean | undefined;
516
- required?: boolean | undefined;
517
- } | {
518
- choices: APIApplicationCommandOptionChoice[] | undefined;
519
- autocomplete: boolean | undefined;
520
- type: ApplicationCommandOptionType.Channel;
521
- channel_types?: (discord_api_types_v9.ChannelType.GuildText | discord_api_types_v9.ChannelType.GuildVoice | discord_api_types_v9.ChannelType.GuildCategory | discord_api_types_v9.ChannelType.GuildNews | discord_api_types_v9.ChannelType.GuildStore | discord_api_types_v9.ChannelType.GuildNewsThread | discord_api_types_v9.ChannelType.GuildPublicThread | discord_api_types_v9.ChannelType.GuildPrivateThread | discord_api_types_v9.ChannelType.GuildStageVoice)[] | undefined;
522
- name: string;
523
- description: string;
524
- default?: boolean | undefined;
525
- required?: boolean | undefined;
526
- } | {
527
- choices: APIApplicationCommandOptionChoice[] | undefined;
528
- autocomplete: boolean | undefined;
529
- type: ApplicationCommandOptionType.Boolean | ApplicationCommandOptionType.User | ApplicationCommandOptionType.Role | ApplicationCommandOptionType.Mentionable;
530
- name: string;
531
- description: string;
532
- default?: boolean | undefined;
533
- required?: boolean | undefined;
534
- };
535
- }
536
-
537
- declare class SlashCommandIntegerOption extends ApplicationCommandOptionWithChoicesBase<number> {
851
+ setAutocomplete<U extends boolean>(autocomplete: U): U extends true ? Omit<this, 'addChoice' | 'addChoices'> : this & Pick<ApplicationCommandOptionWithChoicesAndAutocompleteMixin<T>, 'addChoice' | 'addChoices'>;
852
+ }
853
+
854
+ declare class SlashCommandIntegerOption extends ApplicationCommandOptionBase implements ApplicationCommandNumericOptionMinMaxValueMixin {
538
855
  readonly type: ApplicationCommandOptionType.Integer;
539
- constructor();
856
+ setMaxValue(max: number): this;
857
+ setMinValue(min: number): this;
858
+ toJSON(): APIApplicationCommandIntegerOption;
859
+ }
860
+ interface SlashCommandIntegerOption extends ApplicationCommandNumericOptionMinMaxValueMixin, ApplicationCommandOptionWithChoicesAndAutocompleteMixin<number> {
540
861
  }
541
862
 
542
- declare class SlashCommandMentionableOption extends SlashCommandOptionBase {
863
+ declare class SlashCommandMentionableOption extends ApplicationCommandOptionBase {
543
864
  readonly type: ApplicationCommandOptionType.Mentionable;
544
- constructor();
865
+ toJSON(): APIApplicationCommandMentionableOption;
545
866
  }
546
867
 
547
- declare class SlashCommandNumberOption extends ApplicationCommandOptionWithChoicesBase<number> {
868
+ declare class SlashCommandNumberOption extends ApplicationCommandOptionBase implements ApplicationCommandNumericOptionMinMaxValueMixin {
548
869
  readonly type: ApplicationCommandOptionType.Number;
549
- constructor();
870
+ setMaxValue(max: number): this;
871
+ setMinValue(min: number): this;
872
+ toJSON(): APIApplicationCommandNumberOption;
873
+ }
874
+ interface SlashCommandNumberOption extends ApplicationCommandNumericOptionMinMaxValueMixin, ApplicationCommandOptionWithChoicesAndAutocompleteMixin<number> {
550
875
  }
551
876
 
552
- declare class SlashCommandRoleOption extends SlashCommandOptionBase {
877
+ declare class SlashCommandRoleOption extends ApplicationCommandOptionBase {
553
878
  readonly type: ApplicationCommandOptionType.Role;
554
- constructor();
879
+ toJSON(): APIApplicationCommandRoleOption;
555
880
  }
556
881
 
557
- declare class SlashCommandStringOption extends ApplicationCommandOptionWithChoicesBase<string> {
882
+ declare class SlashCommandStringOption extends ApplicationCommandOptionBase {
558
883
  readonly type: ApplicationCommandOptionType.String;
559
- constructor();
884
+ toJSON(): APIApplicationCommandStringOption;
885
+ }
886
+ interface SlashCommandStringOption extends ApplicationCommandOptionWithChoicesAndAutocompleteMixin<string> {
560
887
  }
561
888
 
562
- declare class SlashCommandUserOption extends SlashCommandOptionBase {
889
+ declare class SlashCommandUserOption extends ApplicationCommandOptionBase {
563
890
  readonly type: ApplicationCommandOptionType.User;
564
- constructor();
891
+ toJSON(): APIApplicationCommandUserOption;
565
892
  }
566
893
 
567
894
  declare class SharedSlashCommandOptions<ShouldOmitSubcommandFunctions = true> {
@@ -617,27 +944,10 @@ declare class SharedSlashCommandOptions<ShouldOmitSubcommandFunctions = true> {
617
944
  private _sharedAddOptionMethod;
618
945
  }
619
946
 
620
- declare class SharedNameAndDescription {
621
- readonly name: string;
622
- readonly description: string;
623
- /**
624
- * Sets the name
625
- *
626
- * @param name The name
627
- */
628
- setName(name: string): this;
629
- /**
630
- * Sets the description
631
- *
632
- * @param description The description
633
- */
634
- setDescription(description: string): this;
635
- }
636
-
637
947
  /**
638
948
  * Represents a folder for subcommands
639
949
  *
640
- * 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
641
951
  */
642
952
  declare class SlashCommandSubcommandGroupBuilder implements ToAPIApplicationCommandOptions {
643
953
  /**
@@ -651,21 +961,21 @@ declare class SlashCommandSubcommandGroupBuilder implements ToAPIApplicationComm
651
961
  /**
652
962
  * The subcommands part of this subcommand group
653
963
  */
654
- readonly options: ToAPIApplicationCommandOptions[];
964
+ readonly options: SlashCommandSubcommandBuilder[];
655
965
  /**
656
966
  * Adds a new subcommand to this group
657
967
  *
658
968
  * @param input A function that returns a subcommand builder, or an already built builder
659
969
  */
660
970
  addSubcommand(input: SlashCommandSubcommandBuilder | ((subcommandGroup: SlashCommandSubcommandBuilder) => SlashCommandSubcommandBuilder)): this;
661
- toJSON(): APIApplicationCommandSubCommandOptions;
971
+ toJSON(): APIApplicationCommandSubcommandGroupOption;
662
972
  }
663
973
  interface SlashCommandSubcommandGroupBuilder extends SharedNameAndDescription {
664
974
  }
665
975
  /**
666
976
  * Represents a subcommand
667
977
  *
668
- * 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
669
979
  */
670
980
  declare class SlashCommandSubcommandBuilder implements ToAPIApplicationCommandOptions {
671
981
  /**
@@ -679,8 +989,8 @@ declare class SlashCommandSubcommandBuilder implements ToAPIApplicationCommandOp
679
989
  /**
680
990
  * The options of this subcommand
681
991
  */
682
- readonly options: ToAPIApplicationCommandOptions[];
683
- toJSON(): APIApplicationCommandSubCommandOptions;
992
+ readonly options: ApplicationCommandOptionBase[];
993
+ toJSON(): APIApplicationCommandSubcommandOption;
684
994
  }
685
995
  interface SlashCommandSubcommandBuilder extends SharedNameAndDescription, SharedSlashCommandOptions<false> {
686
996
  }
@@ -740,44 +1050,31 @@ interface SlashCommandSubcommandsOnlyBuilder extends SharedNameAndDescription, P
740
1050
  interface SlashCommandOptionsOnlyBuilder extends SharedNameAndDescription, SharedSlashCommandOptions, Pick<SlashCommandBuilder, 'toJSON'> {
741
1051
  }
742
1052
  interface ToAPIApplicationCommandOptions {
743
- toJSON(): APIApplicationCommandOption;
744
- }
745
-
746
- declare class SlashCommandOptionBase extends SharedNameAndDescription implements ToAPIApplicationCommandOptions {
747
- required: boolean;
748
- readonly type: ApplicationCommandOptionType;
749
- constructor(type: ApplicationCommandOptionType);
750
- /**
751
- * Marks the option as required
752
- *
753
- * @param required If this option should be required
754
- */
755
- setRequired(required: boolean): this;
756
- toJSON(): APIApplicationCommandOption;
1053
+ toJSON: () => APIApplicationCommandOption;
757
1054
  }
758
1055
 
759
- declare function validateRequiredParameters$1(name: string, description: string, options: ToAPIApplicationCommandOptions[]): void;
760
1056
  declare function validateName$1(name: unknown): asserts name is string;
761
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;
762
1060
  declare function validateDefaultPermission$1(value: unknown): asserts value is boolean;
763
1061
  declare function validateRequired(required: unknown): asserts required is boolean;
764
- declare function validateMaxOptionsLength(options: unknown): asserts options is ToAPIApplicationCommandOptions[];
765
1062
  declare function validateMaxChoicesLength(choices: APIApplicationCommandOptionChoice[]): void;
766
- 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;
767
1064
 
768
1065
  declare const Assertions$1_validateDescription: typeof validateDescription;
769
- declare const Assertions$1_validateRequired: typeof validateRequired;
770
1066
  declare const Assertions$1_validateMaxOptionsLength: typeof validateMaxOptionsLength;
1067
+ declare const Assertions$1_validateRequired: typeof validateRequired;
771
1068
  declare const Assertions$1_validateMaxChoicesLength: typeof validateMaxChoicesLength;
772
1069
  declare const Assertions$1_assertReturnOfBuilder: typeof assertReturnOfBuilder;
773
1070
  declare namespace Assertions$1 {
774
1071
  export {
775
- validateRequiredParameters$1 as validateRequiredParameters,
776
1072
  validateName$1 as validateName,
777
1073
  Assertions$1_validateDescription as validateDescription,
1074
+ Assertions$1_validateMaxOptionsLength as validateMaxOptionsLength,
1075
+ validateRequiredParameters$1 as validateRequiredParameters,
778
1076
  validateDefaultPermission$1 as validateDefaultPermission,
779
1077
  Assertions$1_validateRequired as validateRequired,
780
- Assertions$1_validateMaxOptionsLength as validateMaxOptionsLength,
781
1078
  Assertions$1_validateMaxChoicesLength as validateMaxChoicesLength,
782
1079
  Assertions$1_assertReturnOfBuilder as assertReturnOfBuilder,
783
1080
  };
@@ -829,22 +1126,22 @@ declare class ContextMenuCommandBuilder {
829
1126
  }
830
1127
  declare type ContextMenuCommandType = ApplicationCommandType.User | ApplicationCommandType.Message;
831
1128
 
832
- declare function validateRequiredParameters(name: string, type: number): void;
1129
+ declare function validateDefaultPermission(value: unknown): asserts value is boolean;
833
1130
  declare function validateName(name: unknown): asserts name is string;
834
1131
  declare function validateType(type: unknown): asserts type is ContextMenuCommandType;
835
- declare function validateDefaultPermission(value: unknown): asserts value is boolean;
1132
+ declare function validateRequiredParameters(name: string, type: number): void;
836
1133
 
837
- declare const Assertions_validateRequiredParameters: typeof validateRequiredParameters;
1134
+ declare const Assertions_validateDefaultPermission: typeof validateDefaultPermission;
838
1135
  declare const Assertions_validateName: typeof validateName;
839
1136
  declare const Assertions_validateType: typeof validateType;
840
- declare const Assertions_validateDefaultPermission: typeof validateDefaultPermission;
1137
+ declare const Assertions_validateRequiredParameters: typeof validateRequiredParameters;
841
1138
  declare namespace Assertions {
842
1139
  export {
843
- Assertions_validateRequiredParameters as validateRequiredParameters,
1140
+ Assertions_validateDefaultPermission as validateDefaultPermission,
844
1141
  Assertions_validateName as validateName,
845
1142
  Assertions_validateType as validateType,
846
- Assertions_validateDefaultPermission as validateDefaultPermission,
1143
+ Assertions_validateRequiredParameters as validateRequiredParameters,
847
1144
  };
848
1145
  }
849
1146
 
850
- 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 };