@discordjs/builders 0.13.0-dev.1644537978.298b226 → 0.13.0-dev.1644797188.0dfdb2c

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,4 +1,5 @@
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';
1
+ import * as discord_api_types_v9 from 'discord-api-types/v9';
2
+ import { APIEmbedField, APIEmbedAuthor, APIEmbedFooter, APIEmbedImage, APIEmbed, APIEmbedVideo, APISelectMenuOption, APIMessageComponentEmoji, ButtonStyle, APIBaseComponent, ComponentType, APIMessageComponent, APIActionRowComponent, APIButtonComponent, APISelectMenuComponent, ApplicationCommandOptionType, APIApplicationCommandBasicOption, APIApplicationCommandBooleanOption, ChannelType, APIApplicationCommandChannelOption, APIApplicationCommandOptionChoice, APIApplicationCommandIntegerOption, APIApplicationCommandMentionableOption, APIApplicationCommandNumberOption, APIApplicationCommandRoleOption, APIApplicationCommandAttachmentOption, APIApplicationCommandStringOption, APIApplicationCommandUserOption, APIApplicationCommandSubcommandGroupOption, APIApplicationCommandSubcommandOption, RESTPostAPIApplicationCommandsJSONBody, APIApplicationCommandOption, ApplicationCommandType } from 'discord-api-types/v9';
2
3
  import { z } from 'zod';
3
4
  import { Snowflake } from 'discord-api-types/globals';
4
5
  import { URL } from 'url';
@@ -33,7 +34,7 @@ declare const embedFieldsArrayPredicate: z.ZodArray<z.ZodObject<{
33
34
  value: string;
34
35
  }>, "many">;
35
36
  declare const fieldLengthPredicate: z.ZodNumber;
36
- declare function validateFieldLength(fields: APIEmbedField[], amountAdding: number): void;
37
+ declare function validateFieldLength(amountAdding: number, fields?: APIEmbedField[]): void;
37
38
  declare const authorNamePredicate: z.ZodNullable<z.ZodString>;
38
39
  declare const urlPredicate: z.ZodNullable<z.ZodOptional<z.ZodString>>;
39
40
  declare const colorPredicate: z.ZodNullable<z.ZodNumber>;
@@ -75,77 +76,80 @@ declare namespace Assertions$3 {
75
76
  };
76
77
  }
77
78
 
78
- interface JSONEncodable<T> {
79
+ interface IconData {
79
80
  /**
80
- * Transforms this object to its JSON format
81
+ * The URL of the icon
81
82
  */
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
-
90
- interface AuthorOptions {
91
- name: string;
92
- url?: string;
93
83
  iconURL?: string;
84
+ /**
85
+ * The proxy URL of the icon
86
+ */
87
+ proxyIconURL?: string;
94
88
  }
95
- interface FooterOptions {
96
- text: string;
97
- iconURL?: string;
89
+ declare type EmbedAuthorData = Omit<APIEmbedAuthor, 'icon_url' | 'proxy_icon_url'> & IconData;
90
+ declare type EmbedAuthorOptions = Omit<EmbedAuthorData, 'proxyIconURL'>;
91
+ declare type EmbedFooterData = Omit<APIEmbedFooter, 'icon_url' | 'proxy_icon_url'> & IconData;
92
+ declare type EmbedFooterOptions = Omit<EmbedFooterData, 'proxyIconURL'>;
93
+ interface EmbedImageData extends Omit<APIEmbedImage, 'proxy_url'> {
94
+ /**
95
+ * The proxy URL for the image
96
+ */
97
+ proxyURL?: string;
98
98
  }
99
- declare class UnsafeEmbed implements APIEmbed, JSONEncodable<APIEmbed> {
99
+ /**
100
+ * Represents a non-validated embed in a message (image/video preview, rich embed, etc.)
101
+ */
102
+ declare class UnsafeEmbed {
103
+ protected data: APIEmbed;
104
+ constructor(data?: APIEmbed);
100
105
  /**
101
106
  * An array of fields of this embed
102
107
  */
103
- readonly fields: APIEmbedField[];
108
+ get fields(): APIEmbedField[] | undefined;
104
109
  /**
105
110
  * The embed title
106
111
  */
107
- readonly title?: string;
112
+ get title(): string | undefined;
108
113
  /**
109
114
  * The embed description
110
115
  */
111
- readonly description?: string;
116
+ get description(): string | undefined;
112
117
  /**
113
- * The embed url
118
+ * The embed URL
114
119
  */
115
- readonly url?: string;
120
+ get url(): string | undefined;
116
121
  /**
117
122
  * The embed color
118
123
  */
119
- readonly color?: number;
124
+ get color(): number | undefined;
120
125
  /**
121
- * The timestamp of the embed in the ISO format
126
+ * The timestamp of the embed in an ISO 8601 format
122
127
  */
123
- readonly timestamp?: string;
128
+ get timestamp(): string | undefined;
124
129
  /**
125
130
  * The embed thumbnail data
126
131
  */
127
- readonly thumbnail?: APIEmbedThumbnail;
132
+ get thumbnail(): EmbedImageData | undefined;
128
133
  /**
129
134
  * The embed image data
130
135
  */
131
- readonly image?: APIEmbedImage;
136
+ get image(): EmbedImageData | undefined;
132
137
  /**
133
138
  * Received video data
134
139
  */
135
- readonly video?: APIEmbedVideo;
140
+ get video(): APIEmbedVideo | undefined;
136
141
  /**
137
142
  * The embed author data
138
143
  */
139
- readonly author?: APIEmbedAuthor;
144
+ get author(): EmbedAuthorData | undefined;
140
145
  /**
141
146
  * Received data about the embed provider
142
147
  */
143
- readonly provider?: APIEmbedProvider;
148
+ get provider(): discord_api_types_v9.APIEmbedProvider | undefined;
144
149
  /**
145
150
  * The embed footer data
146
151
  */
147
- readonly footer?: APIEmbedFooter;
148
- constructor(data?: APIEmbed);
152
+ get footer(): EmbedFooterData | undefined;
149
153
  /**
150
154
  * The accumulated length for the embed title, description, fields, footer text, and author name
151
155
  */
@@ -180,7 +184,7 @@ declare class UnsafeEmbed implements APIEmbed, JSONEncodable<APIEmbed> {
180
184
  *
181
185
  * @param options The options for the author
182
186
  */
183
- setAuthor(options: AuthorOptions | null): this;
187
+ setAuthor(options: EmbedAuthorOptions | null): this;
184
188
  /**
185
189
  * Sets the color of this embed
186
190
  *
@@ -198,7 +202,7 @@ declare class UnsafeEmbed implements APIEmbed, JSONEncodable<APIEmbed> {
198
202
  *
199
203
  * @param options The options for the footer
200
204
  */
201
- setFooter(options: FooterOptions | null): this;
205
+ setFooter(options: EmbedFooterOptions | null): this;
202
206
  /**
203
207
  * Sets the image of this embed
204
208
  *
@@ -242,15 +246,15 @@ declare class UnsafeEmbed implements APIEmbed, JSONEncodable<APIEmbed> {
242
246
  }
243
247
 
244
248
  /**
245
- * Represents an embed in a message (image/video preview, rich embed, etc.)
249
+ * Represents a validated embed in a message (image/video preview, rich embed, etc.)
246
250
  */
247
251
  declare class Embed extends UnsafeEmbed {
248
252
  addFields(...fields: APIEmbedField[]): this;
249
253
  spliceFields(index: number, deleteCount: number, ...fields: APIEmbedField[]): this;
250
- setAuthor(options: AuthorOptions | null): this;
254
+ setAuthor(options: EmbedAuthorOptions | null): this;
251
255
  setColor(color: number | null): this;
252
256
  setDescription(description: string | null): this;
253
- setFooter(options: FooterOptions | null): this;
257
+ setFooter(options: EmbedFooterOptions | null): this;
254
258
  setImage(url: string | null): this;
255
259
  setThumbnail(url: string | null): this;
256
260
  setTimestamp(timestamp?: number | Date | null): this;
@@ -489,12 +493,28 @@ declare enum Faces {
489
493
  * Represents a non-validated option within a select menu component
490
494
  */
491
495
  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);
496
+ protected data: Partial<APISelectMenuOption>;
497
+ constructor(data?: Partial<APISelectMenuOption>);
498
+ /**
499
+ * The label for this option
500
+ */
501
+ get label(): string | undefined;
502
+ /**
503
+ * The value for this option
504
+ */
505
+ get value(): string | undefined;
506
+ /**
507
+ * The description for this option
508
+ */
509
+ get description(): string | undefined;
510
+ /**
511
+ * The emoji for this option
512
+ */
513
+ get emoji(): APIMessageComponentEmoji | undefined;
514
+ /**
515
+ * Whether this option is selected by default
516
+ */
517
+ get default(): boolean | undefined;
498
518
  /**
499
519
  * Sets the label of this option
500
520
  * @param label The label to show on this option
@@ -512,7 +532,7 @@ declare class UnsafeSelectMenuOption {
512
532
  setDescription(description: string): this;
513
533
  /**
514
534
  * Sets whether this option is selected by default
515
- * @param isDefault Whether or not this option is selected by default
535
+ * @param isDefault Whether this option is selected by default
516
536
  */
517
537
  setDefault(isDefault: boolean): this;
518
538
  /**
@@ -524,7 +544,7 @@ declare class UnsafeSelectMenuOption {
524
544
  }
525
545
 
526
546
  /**
527
- * Represents an option within a select menu component
547
+ * Represents a validated option within a select menu component
528
548
  */
529
549
  declare class SelectMenuOption extends UnsafeSelectMenuOption {
530
550
  setDescription(description: string): this;
@@ -558,7 +578,7 @@ declare const labelValueValidator: z.ZodString;
558
578
  declare const defaultValidator: z.ZodBoolean;
559
579
  declare function validateRequiredSelectMenuOptionParameters(label?: string, value?: string): void;
560
580
  declare const urlValidator: z.ZodString;
561
- declare function validateRequiredButtonParameters(style: ButtonStyle, label?: string, emoji?: APIMessageComponentEmoji, customId?: string, url?: string): void;
581
+ declare function validateRequiredButtonParameters(style?: ButtonStyle, label?: string, emoji?: APIMessageComponentEmoji, customId?: string, url?: string): void;
562
582
 
563
583
  declare const Assertions$2_customIdValidator: typeof customIdValidator;
564
584
  declare const Assertions$2_emojiValidator: typeof emojiValidator;
@@ -593,14 +613,37 @@ declare namespace Assertions$2 {
593
613
  };
594
614
  }
595
615
 
616
+ interface JSONEncodable<T> {
617
+ /**
618
+ * Transforms this object to its JSON format
619
+ */
620
+ toJSON: () => T;
621
+ }
622
+ /**
623
+ * Indicates if an object is encodable or not.
624
+ * @param maybeEncodable The object to check against
625
+ */
626
+ declare function isJSONEncodable(maybeEncodable: unknown): maybeEncodable is JSONEncodable<unknown>;
627
+
596
628
  /**
597
629
  * Represents a discord component
598
630
  */
599
- interface Component extends JSONEncodable<APIMessageComponent> {
631
+ declare abstract class Component<DataType extends Partial<APIBaseComponent<ComponentType>> & {
632
+ type: ComponentType;
633
+ } = APIBaseComponent<ComponentType>> implements JSONEncodable<APIMessageComponent> {
634
+ /**
635
+ * The API data associated with this component
636
+ */
637
+ protected readonly data: DataType;
638
+ /**
639
+ * Converts this component to an API-compatible JSON object
640
+ */
641
+ abstract toJSON(): APIMessageComponent;
642
+ constructor(data: DataType);
600
643
  /**
601
644
  * The type of this component
602
645
  */
603
- readonly type: ComponentType;
646
+ get type(): DataType['type'];
604
647
  }
605
648
 
606
649
  declare type MessageComponent = ActionRowComponent | ActionRow;
@@ -608,12 +651,11 @@ declare type ActionRowComponent = ButtonComponent | SelectMenuComponent;
608
651
  /**
609
652
  * Represents an action row component
610
653
  */
611
- declare class ActionRow<T extends ActionRowComponent = ActionRowComponent> implements Component {
654
+ declare class ActionRow<T extends ActionRowComponent = ActionRowComponent> extends Component<Omit<Partial<APIActionRowComponent<APIMessageComponent>> & {
655
+ type: ComponentType.ActionRow;
656
+ }, 'components'>> {
612
657
  readonly components: T[];
613
- readonly type = ComponentType.ActionRow;
614
- constructor(data?: APIActionRowComponent & {
615
- type?: ComponentType.ActionRow;
616
- });
658
+ constructor({ components, ...data }?: Partial<APIActionRowComponent<APIMessageComponent>>);
617
659
  /**
618
660
  * Adds components to this action row.
619
661
  * @param components The components to add to this action row.
@@ -625,20 +667,40 @@ declare class ActionRow<T extends ActionRowComponent = ActionRowComponent> imple
625
667
  * @param components The components to set this row to
626
668
  */
627
669
  setComponents(components: T[]): this;
628
- toJSON(): APIActionRowComponent;
670
+ toJSON(): APIActionRowComponent<APIMessageComponent>;
629
671
  }
630
672
 
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
- });
673
+ /**
674
+ * Represents a non-validated button component
675
+ */
676
+ declare class UnsafeButtonComponent extends Component<Partial<APIButtonComponent> & {
677
+ type: ComponentType.Button;
678
+ }> {
679
+ constructor(data?: Partial<APIButtonComponent>);
680
+ /**
681
+ * The style of this button
682
+ */
683
+ get style(): ButtonStyle | undefined;
684
+ /**
685
+ * The label of this button
686
+ */
687
+ get label(): string | undefined;
688
+ /**
689
+ * The emoji used in this button
690
+ */
691
+ get emoji(): APIMessageComponentEmoji | undefined;
692
+ /**
693
+ * Whether this button is disabled
694
+ */
695
+ get disabled(): boolean | undefined;
696
+ /**
697
+ * The custom id of this button (only defined on non-link buttons)
698
+ */
699
+ get customId(): string | undefined;
700
+ /**
701
+ * The URL of this button (only defined on link buttons)
702
+ */
703
+ get url(): string | undefined;
642
704
  /**
643
705
  * Sets the style of this button
644
706
  * @param style The style of the button
@@ -651,7 +713,7 @@ declare class UnsafeButtonComponent implements Component {
651
713
  setURL(url: string): this;
652
714
  /**
653
715
  * Sets the custom Id for this button
654
- * @param customId The custom ID to use for this button
716
+ * @param customId The custom id to use for this button
655
717
  */
656
718
  setCustomId(customId: string): this;
657
719
  /**
@@ -672,6 +734,9 @@ declare class UnsafeButtonComponent implements Component {
672
734
  toJSON(): APIButtonComponent;
673
735
  }
674
736
 
737
+ /**
738
+ * Represents a validated button component
739
+ */
675
740
  declare class ButtonComponent extends UnsafeButtonComponent {
676
741
  setStyle(style: ButtonStyle): this;
677
742
  setURL(url: string): this;
@@ -699,33 +764,49 @@ declare function createComponent<C extends MessageComponent>(data: C): C;
699
764
  /**
700
765
  * Represents a non-validated select menu component
701
766
  */
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);
767
+ declare class UnsafeSelectMenuComponent extends Component<Partial<Omit<APISelectMenuComponent, 'options'>> & {
768
+ type: ComponentType.SelectMenu;
769
+ }> {
770
+ readonly options: UnsafeSelectMenuOption[];
771
+ constructor(data?: Partial<APISelectMenuComponent>);
772
+ /**
773
+ * The placeholder for this select menu
774
+ */
775
+ get placeholder(): string | undefined;
776
+ /**
777
+ * The maximum amount of options that can be selected
778
+ */
779
+ get maxValues(): number | undefined;
780
+ /**
781
+ * The minimum amount of options that must be selected
782
+ */
783
+ get minValues(): number | undefined;
784
+ /**
785
+ * The custom id of this select menu
786
+ */
787
+ get customId(): string | undefined;
788
+ /**
789
+ * Whether this select menu is disabled
790
+ */
791
+ get disabled(): boolean | undefined;
711
792
  /**
712
793
  * Sets the placeholder for this select menu
713
794
  * @param placeholder The placeholder to use for this select menu
714
795
  */
715
796
  setPlaceholder(placeholder: string): this;
716
797
  /**
717
- * Sets thes minimum values that must be selected in the select menu
798
+ * Sets the minimum values that must be selected in the select menu
718
799
  * @param minValues The minimum values that must be selected
719
800
  */
720
801
  setMinValues(minValues: number): this;
721
802
  /**
722
- * Sets thes maximum values that must be selected in the select menu
803
+ * Sets the maximum values that must be selected in the select menu
723
804
  * @param minValues The maximum values that must be selected
724
805
  */
725
806
  setMaxValues(maxValues: number): this;
726
807
  /**
727
808
  * Sets the custom Id for this select menu
728
- * @param customId The custom ID to use for this select menu
809
+ * @param customId The custom id to use for this select menu
729
810
  */
730
811
  setCustomId(customId: string): this;
731
812
  /**
@@ -738,17 +819,17 @@ declare class UnsafeSelectMenuComponent implements Component {
738
819
  * @param options The options to add to this select menu
739
820
  * @returns
740
821
  */
741
- addOptions(...options: SelectMenuOption[]): this;
822
+ addOptions(...options: UnsafeSelectMenuOption[]): this;
742
823
  /**
743
824
  * Sets the options on this select menu
744
825
  * @param options The options to set on this select menu
745
826
  */
746
- setOptions(options: SelectMenuOption[]): this;
827
+ setOptions(options: UnsafeSelectMenuOption[]): this;
747
828
  toJSON(): APISelectMenuComponent;
748
829
  }
749
830
 
750
831
  /**
751
- * Represents a select menu component
832
+ * Represents a validated select menu component
752
833
  */
753
834
  declare class SelectMenuComponent extends UnsafeSelectMenuComponent {
754
835
  setPlaceholder(placeholder: string): this;
@@ -841,17 +922,16 @@ declare class ApplicationCommandOptionWithChoicesAndAutocompleteMixin<T extends
841
922
  /**
842
923
  * Adds a choice for this option
843
924
  *
844
- * @param name The name of the choice
845
- * @param value The value of the choice
925
+ * @param choice The choice to add
846
926
  */
847
- addChoice(name: string, value: T): this;
927
+ addChoice(choice: APIApplicationCommandOptionChoice<T>): this;
848
928
  /**
849
929
  * Adds multiple choices for this option
850
930
  *
851
931
  * @param choices The choices to add
852
932
  */
853
- addChoices(choices: [name: string, value: T][]): this;
854
- setChoices(choices: [name: string, value: T][]): this;
933
+ addChoices(...choices: APIApplicationCommandOptionChoice<T>[]): this;
934
+ setChoices<Input extends APIApplicationCommandOptionChoice<T>[]>(...choices: Input): this;
855
935
  /**
856
936
  * Marks the option as autocompletable
857
937
  * @param autocomplete If this option should be autocompletable
@@ -887,6 +967,11 @@ declare class SlashCommandRoleOption extends ApplicationCommandOptionBase {
887
967
  toJSON(): APIApplicationCommandRoleOption;
888
968
  }
889
969
 
970
+ declare class SlashCommandAttachmentOption extends ApplicationCommandOptionBase {
971
+ readonly type: ApplicationCommandOptionType.Attachment;
972
+ toJSON(): APIApplicationCommandAttachmentOption;
973
+ }
974
+
890
975
  declare class SlashCommandStringOption extends ApplicationCommandOptionBase {
891
976
  readonly type: ApplicationCommandOptionType.String;
892
977
  toJSON(): APIApplicationCommandStringOption;
@@ -925,6 +1010,12 @@ declare class SharedSlashCommandOptions<ShouldOmitSubcommandFunctions = true> {
925
1010
  * @param input A function that returns an option builder, or an already built builder
926
1011
  */
927
1012
  addRoleOption(input: SlashCommandRoleOption | ((builder: SlashCommandRoleOption) => SlashCommandRoleOption)): ShouldOmitSubcommandFunctions extends true ? Omit<this, "addSubcommand" | "addSubcommandGroup"> : this;
1013
+ /**
1014
+ * Adds an attachment option
1015
+ *
1016
+ * @param input A function that returns an option builder, or an already built builder
1017
+ */
1018
+ addAttachmentOption(input: SlashCommandAttachmentOption | ((builder: SlashCommandAttachmentOption) => SlashCommandAttachmentOption)): ShouldOmitSubcommandFunctions extends true ? Omit<this, "addSubcommand" | "addSubcommandGroup"> : this;
928
1019
  /**
929
1020
  * Adds a mentionable option
930
1021
  *
@@ -1152,4 +1243,4 @@ declare namespace Assertions {
1152
1243
  };
1153
1244
  }
1154
1245
 
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 };
1246
+ export { ActionRow, ActionRowComponent, ButtonComponent, Component, Assertions$2 as ComponentAssertions, Assertions as ContextMenuCommandAssertions, ContextMenuCommandBuilder, ContextMenuCommandType, Embed, Assertions$3 as EmbedAssertions, EmbedAuthorData, EmbedAuthorOptions, EmbedFooterData, EmbedFooterOptions, EmbedImageData, Faces, IconData, JSONEncodable, MappedComponentTypes, MessageComponent, SelectMenuComponent, SelectMenuOption, Assertions$1 as SlashCommandAssertions, SlashCommandAttachmentOption, 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 };
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- var At=Object.create;var O=Object.defineProperty;var Ue=Object.getOwnPropertyDescriptor;var gt=Object.getOwnPropertyNames;var Ot=Object.getPrototypeOf,St=Object.prototype.hasOwnProperty;var Pt=(t,e,n)=>e in t?O(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n;var qe=t=>O(t,"__esModule",{value:!0}),o=(t,e)=>O(t,"name",{value:e,configurable:!0});var D=(t,e)=>{for(var n in e)O(t,n,{get:e[n],enumerable:!0})},Ge=(t,e,n,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let a of gt(e))!St.call(t,a)&&(n||a!=="default")&&O(t,a,{get:()=>e[a],enumerable:!(r=Ue(e,a))||r.enumerable});return t},It=(t,e)=>Ge(qe(O(t!=null?At(Ot(t)):{},"default",!e&&t&&t.__esModule?{get:()=>t.default,enumerable:!0}:{value:t,enumerable:!0})),t),Tt=(t=>(e,n)=>t&&t.get(e)||(n=Ge(qe({}),e,1),t&&t.set(e,n),n))(typeof WeakMap!="undefined"?new WeakMap:0),m=(t,e,n,r)=>{for(var a=r>1?void 0:r?Ue(e,n):e,v=t.length-1,L;v>=0;v--)(L=t[v])&&(a=(r?L(e,n,a):L(a))||a);return r&&a&&O(e,n,a),a};var i=(t,e,n)=>(Pt(t,typeof e!="symbol"?e+"":e,n),n);var eo={};D(eo,{ActionRow:()=>w,ButtonComponent:()=>N,ComponentAssertions:()=>we,ContextMenuCommandAssertions:()=>Fe,ContextMenuCommandBuilder:()=>je,Embed:()=>ge,EmbedAssertions:()=>Ae,Faces:()=>Ze,SelectMenuComponent:()=>E,SelectMenuOption:()=>q,SlashCommandAssertions:()=>$e,SlashCommandBooleanOption:()=>W,SlashCommandBuilder:()=>H,SlashCommandChannelOption:()=>S,SlashCommandIntegerOption:()=>P,SlashCommandMentionableOption:()=>Z,SlashCommandNumberOption:()=>I,SlashCommandRoleOption:()=>K,SlashCommandStringOption:()=>T,SlashCommandSubcommandBuilder:()=>c,SlashCommandSubcommandGroupBuilder:()=>g,SlashCommandUserOption:()=>Q,TimestampStyles:()=>qt,UnsafeButtonComponent:()=>j,UnsafeEmbed:()=>C,UnsafeSelectMenuComponent:()=>G,UnsafeSelectMenuOption:()=>U,blockQuote:()=>$t,bold:()=>wt,channelMention:()=>kt,codeBlock:()=>vt,createComponent:()=>Ne,formatEmoji:()=>jt,hideLinkEmbed:()=>Vt,hyperlink:()=>_t,inlineCode:()=>Rt,isJSONEncodable:()=>Yt,italic:()=>Mt,memberNicknameMention:()=>Jt,quote:()=>Bt,roleMention:()=>Ft,spoiler:()=>Lt,strikethrough:()=>Et,time:()=>Ut,underscore:()=>Nt,userMention:()=>Dt});var Ae={};D(Ae,{authorNamePredicate:()=>he,colorPredicate:()=>be,descriptionPredicate:()=>fe,embedFieldPredicate:()=>ze,embedFieldsArrayPredicate:()=>ee,fieldInlinePredicate:()=>Y,fieldLengthPredicate:()=>We,fieldNamePredicate:()=>R,fieldValuePredicate:()=>X,footerTextPredicate:()=>Ce,timestampPredicate:()=>xe,titlePredicate:()=>ye,urlPredicate:()=>f,validateFieldLength:()=>te});var d=require("zod"),R=d.z.string().min(1).max(256),X=d.z.string().min(1).max(1024),Y=d.z.boolean().optional(),ze=d.z.object({name:R,value:X,inline:Y}),ee=ze.array(),We=d.z.number().lte(25);function te(t,e){We.parse(t.length+e)}o(te,"validateFieldLength");var he=R.nullable(),f=d.z.string().url().nullish(),be=d.z.number().gte(0).lte(16777215).nullable(),fe=d.z.string().min(1).max(4096).nullable(),Ce=d.z.string().min(1).max(2048).nullable(),xe=d.z.union([d.z.number(),d.z.date()]).nullable(),ye=R.nullable();var C=class{constructor(e={}){i(this,"fields");i(this,"title");i(this,"description");i(this,"url");i(this,"color");i(this,"timestamp");i(this,"thumbnail");i(this,"image");i(this,"video");i(this,"author");i(this,"provider");i(this,"footer");this.title=e.title,this.description=e.description,this.url=e.url,this.color=e.color,this.thumbnail=e.thumbnail,this.image=e.image,this.video=e.video,this.author=e.author,this.provider=e.provider,this.footer=e.footer,this.fields=e.fields??[],e.timestamp&&(this.timestamp=new Date(e.timestamp).toISOString())}get length(){return(this.title?.length??0)+(this.description?.length??0)+this.fields.reduce((e,n)=>e+n.name.length+n.value.length,0)+(this.footer?.text.length??0)+(this.author?.name.length??0)}addField(e){return this.addFields(e)}addFields(...e){return this.fields.push(...C.normalizeFields(...e)),this}spliceFields(e,n,...r){return this.fields.splice(e,n,...C.normalizeFields(...r)),this}setFields(...e){return this.spliceFields(0,this.fields.length,...e),this}setAuthor(e){return e===null?(Reflect.set(this,"author",void 0),this):(Reflect.set(this,"author",{name:e.name,url:e.url,icon_url:e.iconURL}),this)}setColor(e){return Reflect.set(this,"color",e??void 0),this}setDescription(e){return Reflect.set(this,"description",e??void 0),this}setFooter(e){return e===null?(Reflect.set(this,"footer",void 0),this):(Reflect.set(this,"footer",{text:e.text,icon_url:e.iconURL}),this)}setImage(e){return Reflect.set(this,"image",e?{url:e}:void 0),this}setThumbnail(e){return Reflect.set(this,"thumbnail",e?{url:e}:void 0),this}setTimestamp(e=Date.now()){return Reflect.set(this,"timestamp",e?new Date(e).toISOString():void 0),this}setTitle(e){return Reflect.set(this,"title",e??void 0),this}setURL(e){return Reflect.set(this,"url",e??void 0),this}toJSON(){return{...this}}static normalizeFields(...e){return e.flat(1/0).map(n=>({name:n.name,value:n.value,inline:n.inline??void 0}))}};o(C,"UnsafeEmbed");var ge=class extends C{addFields(...e){return te(this.fields,e.length),super.addFields(...ee.parse(e))}spliceFields(e,n,...r){return te(this.fields,r.length-n),super.spliceFields(e,n,...ee.parse(r))}setAuthor(e){return e===null?super.setAuthor(null):(he.parse(e.name),f.parse(e.iconURL),f.parse(e.url),super.setAuthor(e))}setColor(e){return super.setColor(be.parse(e))}setDescription(e){return super.setDescription(fe.parse(e))}setFooter(e){return e===null?super.setFooter(null):(Ce.parse(e.text),f.parse(e.iconURL),super.setFooter(e))}setImage(e){return super.setImage(f.parse(e))}setThumbnail(e){return super.setThumbnail(f.parse(e))}setTimestamp(e=Date.now()){return super.setTimestamp(xe.parse(e))}setTitle(e){return super.setTitle(ye.parse(e))}setURL(e){return super.setURL(f.parse(e))}static normalizeFields(...e){return e.flat(1/0).map(n=>(R.parse(n.name),X.parse(n.value),Y.parse(n.inline),{name:n.name,value:n.value,inline:n.inline??void 0}))}};o(ge,"Embed");function vt(t,e){return typeof e=="undefined"?`\`\`\`
2
- ${t}\`\`\``:`\`\`\`${t}
3
- ${e}\`\`\``}o(vt,"codeBlock");function Rt(t){return`\`${t}\``}o(Rt,"inlineCode");function Mt(t){return`_${t}_`}o(Mt,"italic");function wt(t){return`**${t}**`}o(wt,"bold");function Nt(t){return`__${t}__`}o(Nt,"underscore");function Et(t){return`~~${t}~~`}o(Et,"strikethrough");function Bt(t){return`> ${t}`}o(Bt,"quote");function $t(t){return`>>> ${t}`}o($t,"blockQuote");function Vt(t){return`<${t}>`}o(Vt,"hideLinkEmbed");function _t(t,e,n){return n?`[${t}](${e} "${n}")`:`[${t}](${e})`}o(_t,"hyperlink");function Lt(t){return`||${t}||`}o(Lt,"spoiler");function Dt(t){return`<@${t}>`}o(Dt,"userMention");function Jt(t){return`<@!${t}>`}o(Jt,"memberNicknameMention");function kt(t){return`<#${t}>`}o(kt,"channelMention");function Ft(t){return`<@&${t}>`}o(Ft,"roleMention");function jt(t,e=!1){return`<${e?"a":""}:_:${t}>`}o(jt,"formatEmoji");function Ut(t,e){return typeof t!="number"&&(t=Math.floor((t?.getTime()??Date.now())/1e3)),typeof e=="string"?`<t:${t}:${e}>`:`<t:${t}>`}o(Ut,"time");var qt={ShortTime:"t",LongTime:"T",ShortDate:"d",LongDate:"D",ShortDateTime:"f",LongDateTime:"F",RelativeTime:"R"},Ze=(r=>(r.Shrug="\xAF\\_(\u30C4)\\_/\xAF",r.Tableflip="(\u256F\xB0\u25A1\xB0\uFF09\u256F\uFE35 \u253B\u2501\u253B",r.Unflip="\u252C\u2500\u252C \u30CE( \u309C-\u309C\u30CE)",r))(Ze||{});var we={};D(we,{buttonLabelValidator:()=>Oe,buttonStyleValidator:()=>Se,customIdValidator:()=>M,defaultValidator:()=>Te,disabledValidator:()=>k,emojiValidator:()=>J,labelValueValidator:()=>F,minMaxValidator:()=>ie,optionsValidator:()=>Ke,placeholderValidator:()=>Pe,urlValidator:()=>Re,validateRequiredButtonParameters:()=>Me,validateRequiredSelectMenuOptionParameters:()=>ve,validateRequiredSelectMenuParameters:()=>Ie});var oe=require("discord-api-types/v9"),l=require("zod"),M=l.z.string().min(1).max(100),J=l.z.object({id:l.z.string(),name:l.z.string(),animated:l.z.boolean()}).partial().strict(),k=l.z.boolean(),Oe=l.z.string().nonempty().max(80),Se=l.z.number().int().min(oe.ButtonStyle.Primary).max(oe.ButtonStyle.Link),Pe=l.z.string().max(100),ie=l.z.number().int().min(0).max(25),Ke=l.z.object({}).array().nonempty();function Ie(t,e){M.parse(e),Ke.parse(t)}o(Ie,"validateRequiredSelectMenuParameters");var F=l.z.string().min(1).max(100),Te=l.z.boolean();function ve(t,e){F.parse(t),F.parse(e)}o(ve,"validateRequiredSelectMenuOptionParameters");var Re=l.z.string().url();function Me(t,e,n,r,a){if(a&&r)throw new RangeError("URL and custom id are mutually exclusive");if(!e&&!n)throw new RangeError("Buttons must have a label and/or an emoji");if(t===oe.ButtonStyle.Link){if(!a)throw new RangeError("Link buttons must have a url")}else if(a)throw new RangeError("Non-link buttons cannot have a url")}o(Me,"validateRequiredButtonParameters");var Qe=require("discord-api-types/v9");var ne=require("discord-api-types/v9");function Ne(t){switch(t.type){case ne.ComponentType.ActionRow:return t instanceof w?t:new w(t);case ne.ComponentType.Button:return t instanceof N?t:new N(t);case ne.ComponentType.SelectMenu:return t instanceof E?t:new E(t);default:throw new Error(`Cannot serialize component type: ${t.type}`)}}o(Ne,"createComponent");var w=class{constructor(e){i(this,"components",[]);i(this,"type",Qe.ComponentType.ActionRow);this.components=e?.components.map(Ne)??[]}addComponents(...e){return this.components.push(...e),this}setComponents(e){return Reflect.set(this,"components",[...e]),this}toJSON(){return{...this,components:this.components.map(e=>e.toJSON())}}};o(w,"ActionRow");var re=require("discord-api-types/v9"),j=class{constructor(e){i(this,"type",re.ComponentType.Button);i(this,"style");i(this,"label");i(this,"emoji");i(this,"disabled");i(this,"custom_id");i(this,"url");this.style=e?.style,this.label=e?.label,this.emoji=e?.emoji,this.disabled=e?.disabled,e?.style===re.ButtonStyle.Link?this.url=e.url:this.custom_id=e?.custom_id}setStyle(e){return Reflect.set(this,"style",e),this}setURL(e){return Reflect.set(this,"url",e),this}setCustomId(e){return Reflect.set(this,"custom_id",e),this}setEmoji(e){return Reflect.set(this,"emoji",e),this}setDisabled(e){return Reflect.set(this,"disabled",e),this}setLabel(e){return Reflect.set(this,"label",e),this}toJSON(){return{...this}}};o(j,"UnsafeButtonComponent");var N=class extends j{setStyle(e){return super.setStyle(Se.parse(e))}setURL(e){return super.setURL(Re.parse(e))}setCustomId(e){return super.setCustomId(M.parse(e))}setEmoji(e){return super.setEmoji(J.parse(e))}setDisabled(e){return super.setDisabled(k.parse(e))}setLabel(e){return super.setLabel(Oe.parse(e))}toJSON(){return Me(this.style,this.label,this.emoji,this.custom_id,this.url),super.toJSON()}};o(N,"ButtonComponent");var He=require("discord-api-types/v9");var U=class{constructor(e){i(this,"label");i(this,"value");i(this,"description");i(this,"emoji");i(this,"default");this.label=e?.label,this.value=e?.value,this.description=e?.description,this.emoji=e?.emoji,this.default=e?.default}setLabel(e){return Reflect.set(this,"label",e),this}setValue(e){return Reflect.set(this,"value",e),this}setDescription(e){return Reflect.set(this,"description",e),this}setDefault(e){return Reflect.set(this,"default",e),this}setEmoji(e){return Reflect.set(this,"emoji",e),this}toJSON(){return{...this}}};o(U,"UnsafeSelectMenuOption");var q=class extends U{setDescription(e){return super.setDescription(F.parse(e))}setDefault(e){return super.setDefault(Te.parse(e))}setEmoji(e){return super.setEmoji(J.parse(e))}toJSON(){return ve(this.label,this.value),super.toJSON()}};o(q,"SelectMenuOption");var G=class{constructor(e){i(this,"type",He.ComponentType.SelectMenu);i(this,"options");i(this,"placeholder");i(this,"min_values");i(this,"max_values");i(this,"custom_id");i(this,"disabled");this.options=e?.options.map(n=>new q(n))??[],this.placeholder=e?.placeholder,this.min_values=e?.min_values,this.max_values=e?.max_values,this.custom_id=e?.custom_id,this.disabled=e?.disabled}setPlaceholder(e){return Reflect.set(this,"placeholder",e),this}setMinValues(e){return Reflect.set(this,"min_values",e),this}setMaxValues(e){return Reflect.set(this,"max_values",e),this}setCustomId(e){return Reflect.set(this,"custom_id",e),this}setDisabled(e){return Reflect.set(this,"disabled",e),this}addOptions(...e){return this.options.push(...e),this}setOptions(e){return Reflect.set(this,"options",[...e]),this}toJSON(){return{...this,options:this.options.map(e=>e.toJSON())}}};o(G,"UnsafeSelectMenuComponent");var E=class extends G{setPlaceholder(e){return super.setPlaceholder(Pe.parse(e))}setMinValues(e){return super.setMinValues(ie.parse(e))}setMaxValues(e){return super.setMaxValues(ie.parse(e))}setCustomId(e){return super.setCustomId(M.parse(e))}setDisabled(e){return super.setDisabled(k.parse(e))}toJSON(){return Ie(this.options,this.custom_id),super.toJSON()}};o(E,"SelectMenuComponent");var $e={};D($e,{assertReturnOfBuilder:()=>y,validateDefaultPermission:()=>Ee,validateDescription:()=>pe,validateMaxChoicesLength:()=>Be,validateMaxOptionsLength:()=>h,validateName:()=>ae,validateRequired:()=>le,validateRequiredParameters:()=>x});var se=It(require("@sindresorhus/is")),z=require("zod"),Gt=z.z.string().min(1).max(32).regex(/^[\P{Lu}\p{N}_-]+$/u);function ae(t){Gt.parse(t)}o(ae,"validateName");var zt=z.z.string().min(1).max(100);function pe(t){zt.parse(t)}o(pe,"validateDescription");var Xe=z.z.unknown().array().max(25);function h(t){Xe.parse(t)}o(h,"validateMaxOptionsLength");function x(t,e,n){ae(t),pe(e),h(n)}o(x,"validateRequiredParameters");var Ye=z.z.boolean();function Ee(t){Ye.parse(t)}o(Ee,"validateDefaultPermission");function le(t){Ye.parse(t)}o(le,"validateRequired");function Be(t){Xe.parse(t)}o(Be,"validateMaxChoicesLength");function y(t,e){let n=e.name;if(se.default.nullOrUndefined(t))throw new TypeError(`Expected to receive a ${n} builder, got ${t===null?"null":"undefined"} instead.`);if(se.default.primitive(t))throw new TypeError(`Expected to receive a ${n} builder, got a primitive (${typeof t}) instead.`);if(!(t instanceof e)){let r=t,a=se.default.function_(t)?t.name:r.constructor.name,v=Reflect.get(r,Symbol.toStringTag),L=v?`${a} [${v}]`:a;throw new TypeError(`Expected to receive a ${n} builder, got ${L} instead.`)}}o(y,"assertReturnOfBuilder");var yt=require("ts-mixer");var et=require("discord-api-types/v9");var b=class{constructor(){i(this,"name");i(this,"description")}setName(e){return ae(e),Reflect.set(this,"name",e),this}setDescription(e){return pe(e),Reflect.set(this,"description",e),this}};o(b,"SharedNameAndDescription");var p=class extends b{constructor(){super(...arguments);i(this,"required",!1)}setRequired(e){return le(e),Reflect.set(this,"required",e),this}runRequiredValidations(){x(this.name,this.description,[]),le(this.required)}};o(p,"ApplicationCommandOptionBase");var W=class extends p{constructor(){super(...arguments);i(this,"type",et.ApplicationCommandOptionType.Boolean)}toJSON(){return this.runRequiredValidations(),{...this}}};o(W,"SlashCommandBooleanOption");var tt=require("discord-api-types/v9"),ot=require("ts-mixer");var u=require("discord-api-types/v9"),Ve=require("zod"),Wt=[u.ChannelType.GuildText,u.ChannelType.GuildVoice,u.ChannelType.GuildCategory,u.ChannelType.GuildNews,u.ChannelType.GuildStore,u.ChannelType.GuildNewsThread,u.ChannelType.GuildPublicThread,u.ChannelType.GuildPrivateThread,u.ChannelType.GuildStageVoice],Zt=Ve.z.union(Wt.map(t=>Ve.z.literal(t))),me=class{constructor(){i(this,"channel_types")}addChannelType(e){return this.channel_types===void 0&&Reflect.set(this,"channel_types",[]),Zt.parse(e),this.channel_types.push(e),this}addChannelTypes(e){return e.forEach(n=>this.addChannelType(n)),this}};o(me,"ApplicationCommandOptionChannelTypesMixin");var S=class extends p{constructor(){super(...arguments);i(this,"type",tt.ApplicationCommandOptionType.Channel)}toJSON(){return this.runRequiredValidations(),{...this}}};o(S,"SlashCommandChannelOption"),S=m([(0,ot.mix)(me)],S);var st=require("discord-api-types/v9"),at=require("ts-mixer"),pt=require("zod");var B=class{constructor(){i(this,"max_value");i(this,"min_value")}};o(B,"ApplicationCommandNumericOptionMinMaxValueMixin");var it=require("discord-api-types/v9"),$=require("zod");var de=$.z.string().min(1).max(100),nt=$.z.number().gt(-1/0).lt(1/0),rt=$.z.tuple([de,$.z.union([de,nt])]).array(),Kt=$.z.boolean(),A=class{constructor(){i(this,"choices");i(this,"autocomplete");i(this,"type")}addChoice(e,n){if(this.autocomplete)throw new RangeError("Autocomplete and choices are mutually exclusive to each other.");return this.choices===void 0&&Reflect.set(this,"choices",[]),Be(this.choices),de.parse(e),this.type===it.ApplicationCommandOptionType.String?de.parse(n):nt.parse(n),this.choices.push({name:e,value:n}),this}addChoices(e){if(this.autocomplete)throw new RangeError("Autocomplete and choices are mutually exclusive to each other.");rt.parse(e);for(let[n,r]of e)this.addChoice(n,r);return this}setChoices(e){if(e.length>0&&this.autocomplete)throw new RangeError("Autocomplete and choices are mutually exclusive to each other.");rt.parse(e),Reflect.set(this,"choices",[]);for(let[n,r]of e)this.addChoice(n,r);return this}setAutocomplete(e){if(Kt.parse(e),e&&Array.isArray(this.choices)&&this.choices.length>0)throw new RangeError("Autocomplete and choices are mutually exclusive to each other.");return Reflect.set(this,"autocomplete",e),this}};o(A,"ApplicationCommandOptionWithChoicesAndAutocompleteMixin");var lt=pt.z.number().int().nonnegative(),P=class extends p{constructor(){super(...arguments);i(this,"type",st.ApplicationCommandOptionType.Integer)}setMaxValue(e){return lt.parse(e),Reflect.set(this,"max_value",e),this}setMinValue(e){return lt.parse(e),Reflect.set(this,"min_value",e),this}toJSON(){if(this.runRequiredValidations(),this.autocomplete&&Array.isArray(this.choices)&&this.choices.length>0)throw new RangeError("Autocomplete and choices are mutually exclusive to each other.");return{...this}}};o(P,"SlashCommandIntegerOption"),P=m([(0,at.mix)(B,A)],P);var mt=require("discord-api-types/v9");var Z=class extends p{constructor(){super(...arguments);i(this,"type",mt.ApplicationCommandOptionType.Mentionable)}toJSON(){return this.runRequiredValidations(),{...this}}};o(Z,"SlashCommandMentionableOption");var dt=require("discord-api-types/v9"),ut=require("ts-mixer"),ct=require("zod");var ht=ct.z.number().nonnegative(),I=class extends p{constructor(){super(...arguments);i(this,"type",dt.ApplicationCommandOptionType.Number)}setMaxValue(e){return ht.parse(e),Reflect.set(this,"max_value",e),this}setMinValue(e){return ht.parse(e),Reflect.set(this,"min_value",e),this}toJSON(){if(this.runRequiredValidations(),this.autocomplete&&Array.isArray(this.choices)&&this.choices.length>0)throw new RangeError("Autocomplete and choices are mutually exclusive to each other.");return{...this}}};o(I,"SlashCommandNumberOption"),I=m([(0,ut.mix)(B,A)],I);var bt=require("discord-api-types/v9");var K=class extends p{constructor(){super(...arguments);i(this,"type",bt.ApplicationCommandOptionType.Role)}toJSON(){return this.runRequiredValidations(),{...this}}};o(K,"SlashCommandRoleOption");var ft=require("discord-api-types/v9"),Ct=require("ts-mixer");var T=class extends p{constructor(){super(...arguments);i(this,"type",ft.ApplicationCommandOptionType.String)}toJSON(){if(this.runRequiredValidations(),this.autocomplete&&Array.isArray(this.choices)&&this.choices.length>0)throw new RangeError("Autocomplete and choices are mutually exclusive to each other.");return{...this}}};o(T,"SlashCommandStringOption"),T=m([(0,Ct.mix)(A)],T);var xt=require("discord-api-types/v9");var Q=class extends p{constructor(){super(...arguments);i(this,"type",xt.ApplicationCommandOptionType.User)}toJSON(){return this.runRequiredValidations(),{...this}}};o(Q,"SlashCommandUserOption");var V=class{constructor(){i(this,"options")}addBooleanOption(e){return this._sharedAddOptionMethod(e,W)}addUserOption(e){return this._sharedAddOptionMethod(e,Q)}addChannelOption(e){return this._sharedAddOptionMethod(e,S)}addRoleOption(e){return this._sharedAddOptionMethod(e,K)}addMentionableOption(e){return this._sharedAddOptionMethod(e,Z)}addStringOption(e){return this._sharedAddOptionMethod(e,T)}addIntegerOption(e){return this._sharedAddOptionMethod(e,P)}addNumberOption(e){return this._sharedAddOptionMethod(e,I)}_sharedAddOptionMethod(e,n){let{options:r}=this;h(r);let a=typeof e=="function"?e(new n):e;return y(a,n),r.push(a),this}};o(V,"SharedSlashCommandOptions");var _e=require("discord-api-types/v9"),Le=require("ts-mixer");var g=class{constructor(){i(this,"name");i(this,"description");i(this,"options",[])}addSubcommand(e){let{options:n}=this;h(n);let r=typeof e=="function"?e(new c):e;return y(r,c),n.push(r),this}toJSON(){return x(this.name,this.description,this.options),{type:_e.ApplicationCommandOptionType.SubcommandGroup,name:this.name,description:this.description,options:this.options.map(e=>e.toJSON())}}};o(g,"SlashCommandSubcommandGroupBuilder"),g=m([(0,Le.mix)(b)],g);var c=class{constructor(){i(this,"name");i(this,"description");i(this,"options",[])}toJSON(){return x(this.name,this.description,this.options),{type:_e.ApplicationCommandOptionType.Subcommand,name:this.name,description:this.description,options:this.options.map(e=>e.toJSON())}}};o(c,"SlashCommandSubcommandBuilder"),c=m([(0,Le.mix)(b,V)],c);var H=class{constructor(){i(this,"name");i(this,"description");i(this,"options",[]);i(this,"defaultPermission")}toJSON(){return x(this.name,this.description,this.options),{name:this.name,description:this.description,options:this.options.map(e=>e.toJSON()),default_permission:this.defaultPermission}}setDefaultPermission(e){return Ee(e),Reflect.set(this,"defaultPermission",e),this}addSubcommandGroup(e){let{options:n}=this;h(n);let r=typeof e=="function"?e(new g):e;return y(r,g),n.push(r),this}addSubcommand(e){let{options:n}=this;h(n);let r=typeof e=="function"?e(new c):e;return y(r,c),n.push(r),this}};o(H,"SlashCommandBuilder"),H=m([(0,yt.mix)(V,b)],H);var Fe={};D(Fe,{validateDefaultPermission:()=>Je,validateName:()=>ue,validateRequiredParameters:()=>ke,validateType:()=>ce});var _=require("zod"),De=require("discord-api-types/v9"),Qt=_.z.string().min(1).max(32).regex(/^( *[\p{L}\p{N}_-]+ *)+$/u),Ht=_.z.union([_.z.literal(De.ApplicationCommandType.User),_.z.literal(De.ApplicationCommandType.Message)]),Xt=_.z.boolean();function Je(t){Xt.parse(t)}o(Je,"validateDefaultPermission");function ue(t){Qt.parse(t)}o(ue,"validateName");function ce(t){Ht.parse(t)}o(ce,"validateType");function ke(t,e){ue(t),ce(e)}o(ke,"validateRequiredParameters");var je=class{constructor(){i(this,"name");i(this,"type");i(this,"defaultPermission")}setName(e){return ue(e),Reflect.set(this,"name",e),this}setType(e){return ce(e),Reflect.set(this,"type",e),this}setDefaultPermission(e){return Je(e),Reflect.set(this,"defaultPermission",e),this}toJSON(){return ke(this.name,this.type),{name:this.name,type:this.type,default_permission:this.defaultPermission}}};o(je,"ContextMenuCommandBuilder");function Yt(t){return t!==null&&typeof t=="object"&&"toJSON"in t}o(Yt,"isJSONEncodable");module.exports=Tt(eo);0&&(module.exports={ActionRow,ButtonComponent,ComponentAssertions,ContextMenuCommandAssertions,ContextMenuCommandBuilder,Embed,EmbedAssertions,Faces,SelectMenuComponent,SelectMenuOption,SlashCommandAssertions,SlashCommandBooleanOption,SlashCommandBuilder,SlashCommandChannelOption,SlashCommandIntegerOption,SlashCommandMentionableOption,SlashCommandNumberOption,SlashCommandRoleOption,SlashCommandStringOption,SlashCommandSubcommandBuilder,SlashCommandSubcommandGroupBuilder,SlashCommandUserOption,TimestampStyles,UnsafeButtonComponent,UnsafeEmbed,UnsafeSelectMenuComponent,UnsafeSelectMenuOption,blockQuote,bold,channelMention,codeBlock,createComponent,formatEmoji,hideLinkEmbed,hyperlink,inlineCode,isJSONEncodable,italic,memberNicknameMention,quote,roleMention,spoiler,strikethrough,time,underscore,userMention});
1
+ var Se=Object.create;var S=Object.defineProperty;var qt=Object.getOwnPropertyDescriptor;var Pe=Object.getOwnPropertyNames;var Ie=Object.getPrototypeOf,Te=Object.prototype.hasOwnProperty;var Me=(e,t,n)=>t in e?S(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var Gt=e=>S(e,"__esModule",{value:!0}),o=(e,t)=>S(e,"name",{value:t,configurable:!0});var F=(e,t)=>{for(var n in t)S(e,n,{get:t[n],enumerable:!0})},zt=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of Pe(t))!Te.call(e,s)&&(n||s!=="default")&&S(e,s,{get:()=>t[s],enumerable:!(r=qt(t,s))||r.enumerable});return e},ve=(e,t)=>zt(Gt(S(e!=null?Se(Ie(e)):{},"default",!t&&e&&e.__esModule?{get:()=>e.default,enumerable:!0}:{value:e,enumerable:!0})),e),Re=(e=>(t,n)=>e&&e.get(t)||(n=zt(Gt({}),t,1),e&&e.set(t,n),n))(typeof WeakMap!="undefined"?new WeakMap:0),l=(e,t,n,r)=>{for(var s=r>1?void 0:r?qt(t,n):t,R=e.length-1,U;R>=0;R--)(U=e[R])&&(s=(r?U(t,n,s):U(s))||s);return r&&s&&S(t,n,s),s};var i=(e,t,n)=>(Me(e,typeof t!="symbol"?t+"":t,n),n);var no={};F(no,{ActionRow:()=>B,ButtonComponent:()=>N,Component:()=>h,ComponentAssertions:()=>wt,ContextMenuCommandAssertions:()=>kt,ContextMenuCommandBuilder:()=>jt,Embed:()=>gt,EmbedAssertions:()=>yt,Faces:()=>Kt,SelectMenuComponent:()=>$,SelectMenuOption:()=>Bt,SlashCommandAssertions:()=>_t,SlashCommandAttachmentOption:()=>Q,SlashCommandBooleanOption:()=>W,SlashCommandBuilder:()=>X,SlashCommandChannelOption:()=>I,SlashCommandIntegerOption:()=>T,SlashCommandMentionableOption:()=>Z,SlashCommandNumberOption:()=>M,SlashCommandRoleOption:()=>K,SlashCommandStringOption:()=>v,SlashCommandSubcommandBuilder:()=>c,SlashCommandSubcommandGroupBuilder:()=>O,SlashCommandUserOption:()=>H,TimestampStyles:()=>We,UnsafeButtonComponent:()=>q,UnsafeEmbed:()=>x,UnsafeSelectMenuComponent:()=>G,UnsafeSelectMenuOption:()=>P,blockQuote:()=>Ve,bold:()=>Ne,channelMention:()=>je,codeBlock:()=>we,createComponent:()=>Et,formatEmoji:()=>Ge,hideLinkEmbed:()=>De,hyperlink:()=>Ue,inlineCode:()=>Ee,isJSONEncodable:()=>oo,italic:()=>Be,memberNicknameMention:()=>ke,quote:()=>Le,roleMention:()=>qe,spoiler:()=>Fe,strikethrough:()=>_e,time:()=>ze,underscore:()=>$e,userMention:()=>Je});var yt={};F(yt,{authorNamePredicate:()=>ht,colorPredicate:()=>bt,descriptionPredicate:()=>Ct,embedFieldPredicate:()=>Wt,embedFieldsArrayPredicate:()=>et,fieldInlinePredicate:()=>tt,fieldLengthPredicate:()=>Zt,fieldNamePredicate:()=>w,fieldValuePredicate:()=>Y,footerTextPredicate:()=>ft,timestampPredicate:()=>xt,titlePredicate:()=>At,urlPredicate:()=>f,validateFieldLength:()=>ot});var d=require("zod"),w=d.z.string().min(1).max(256),Y=d.z.string().min(1).max(1024),tt=d.z.boolean().optional(),Wt=d.z.object({name:w,value:Y,inline:tt}),et=Wt.array(),Zt=d.z.number().lte(25);function ot(e,t){Zt.parse((t?.length??0)+e)}o(ot,"validateFieldLength");var ht=w.nullable(),f=d.z.string().url().nullish(),bt=d.z.number().gte(0).lte(16777215).nullable(),Ct=d.z.string().min(1).max(4096).nullable(),ft=d.z.string().min(1).max(2048).nullable(),xt=d.z.union([d.z.number(),d.z.date()]).nullable(),At=w.nullable();var x=class{constructor(t={}){i(this,"data");this.data={...t},t.timestamp&&(this.data.timestamp=new Date(t.timestamp).toISOString())}get fields(){return this.data.fields}get title(){return this.data.title}get description(){return this.data.description}get url(){return this.data.url}get color(){return this.data.color}get timestamp(){return this.data.timestamp}get thumbnail(){if(!!this.data.thumbnail)return{url:this.data.thumbnail.url,proxyURL:this.data.thumbnail.proxy_url,height:this.data.thumbnail.height,width:this.data.thumbnail.width}}get image(){if(!!this.data.image)return{url:this.data.image.url,proxyURL:this.data.image.proxy_url,height:this.data.image.height,width:this.data.image.width}}get video(){return this.data.video}get author(){if(!!this.data.author)return{name:this.data.author.name,url:this.data.author.url,iconURL:this.data.author.icon_url,proxyIconURL:this.data.author.proxy_icon_url}}get provider(){return this.data.provider}get footer(){if(!!this.data.footer)return{text:this.data.footer.text,iconURL:this.data.footer.icon_url,proxyIconURL:this.data.footer.proxy_icon_url}}get length(){return(this.data.title?.length??0)+(this.data.description?.length??0)+(this.data.fields?.reduce((t,n)=>t+n.name.length+n.value.length,0)??0)+(this.data.footer?.text.length??0)+(this.data.author?.name.length??0)}addField(t){return this.addFields(t)}addFields(...t){return t=x.normalizeFields(...t),this.data.fields?this.data.fields.push(...t):this.data.fields=t,this}spliceFields(t,n,...r){return r=x.normalizeFields(...r),this.data.fields?this.data.fields.splice(t,n,...r):this.data.fields=r,this}setFields(...t){return this.spliceFields(0,this.fields?.length??0,...t),this}setAuthor(t){return t===null?(this.data.author=void 0,this):(this.data.author={name:t.name,url:t.url,icon_url:t.iconURL},this)}setColor(t){return this.data.color=t??void 0,this}setDescription(t){return this.data.description=t??void 0,this}setFooter(t){return t===null?(this.data.footer=void 0,this):(this.data.footer={text:t.text,icon_url:t.iconURL},this)}setImage(t){return this.data.image=t?{url:t}:void 0,this}setThumbnail(t){return this.data.thumbnail=t?{url:t}:void 0,this}setTimestamp(t=Date.now()){return this.data.timestamp=t?new Date(t).toISOString():void 0,this}setTitle(t){return this.data.title=t??void 0,this}setURL(t){return this.data.url=t??void 0,this}toJSON(){return{...this.data}}static normalizeFields(...t){return t.flat(1/0).map(n=>({name:n.name,value:n.value,inline:n.inline??void 0}))}};o(x,"UnsafeEmbed");var gt=class extends x{addFields(...t){return ot(t.length,this.fields),super.addFields(...et.parse(t))}spliceFields(t,n,...r){return ot(r.length-n,this.fields),super.spliceFields(t,n,...et.parse(r))}setAuthor(t){return t===null?super.setAuthor(null):(ht.parse(t.name),f.parse(t.iconURL),f.parse(t.url),super.setAuthor(t))}setColor(t){return super.setColor(bt.parse(t))}setDescription(t){return super.setDescription(Ct.parse(t))}setFooter(t){return t===null?super.setFooter(null):(ft.parse(t.text),f.parse(t.iconURL),super.setFooter(t))}setImage(t){return super.setImage(f.parse(t))}setThumbnail(t){return super.setThumbnail(f.parse(t))}setTimestamp(t=Date.now()){return super.setTimestamp(xt.parse(t))}setTitle(t){return super.setTitle(At.parse(t))}setURL(t){return super.setURL(f.parse(t))}static normalizeFields(...t){return t.flat(1/0).map(n=>(w.parse(n.name),Y.parse(n.value),tt.parse(n.inline),{name:n.name,value:n.value,inline:n.inline??void 0}))}};o(gt,"Embed");function we(e,t){return typeof t=="undefined"?`\`\`\`
2
+ ${e}\`\`\``:`\`\`\`${e}
3
+ ${t}\`\`\``}o(we,"codeBlock");function Ee(e){return`\`${e}\``}o(Ee,"inlineCode");function Be(e){return`_${e}_`}o(Be,"italic");function Ne(e){return`**${e}**`}o(Ne,"bold");function $e(e){return`__${e}__`}o($e,"underscore");function _e(e){return`~~${e}~~`}o(_e,"strikethrough");function Le(e){return`> ${e}`}o(Le,"quote");function Ve(e){return`>>> ${e}`}o(Ve,"blockQuote");function De(e){return`<${e}>`}o(De,"hideLinkEmbed");function Ue(e,t,n){return n?`[${e}](${t} "${n}")`:`[${e}](${t})`}o(Ue,"hyperlink");function Fe(e){return`||${e}||`}o(Fe,"spoiler");function Je(e){return`<@${e}>`}o(Je,"userMention");function ke(e){return`<@!${e}>`}o(ke,"memberNicknameMention");function je(e){return`<#${e}>`}o(je,"channelMention");function qe(e){return`<@&${e}>`}o(qe,"roleMention");function Ge(e,t=!1){return`<${t?"a":""}:_:${e}>`}o(Ge,"formatEmoji");function ze(e,t){return typeof e!="number"&&(e=Math.floor((e?.getTime()??Date.now())/1e3)),typeof t=="string"?`<t:${e}:${t}>`:`<t:${e}>`}o(ze,"time");var We={ShortTime:"t",LongTime:"T",ShortDate:"d",LongDate:"D",ShortDateTime:"f",LongDateTime:"F",RelativeTime:"R"},Kt=(r=>(r.Shrug="\xAF\\_(\u30C4)\\_/\xAF",r.Tableflip="(\u256F\xB0\u25A1\xB0\uFF09\u256F\uFE35 \u253B\u2501\u253B",r.Unflip="\u252C\u2500\u252C \u30CE( \u309C-\u309C\u30CE)",r))(Kt||{});var wt={};F(wt,{buttonLabelValidator:()=>Ot,buttonStyleValidator:()=>St,customIdValidator:()=>E,defaultValidator:()=>Tt,disabledValidator:()=>k,emojiValidator:()=>J,labelValueValidator:()=>j,minMaxValidator:()=>it,optionsValidator:()=>Qt,placeholderValidator:()=>Pt,urlValidator:()=>vt,validateRequiredButtonParameters:()=>Rt,validateRequiredSelectMenuOptionParameters:()=>Mt,validateRequiredSelectMenuParameters:()=>It});var nt=require("discord-api-types/v9"),m=require("zod"),E=m.z.string().min(1).max(100),J=m.z.object({id:m.z.string(),name:m.z.string(),animated:m.z.boolean()}).partial().strict(),k=m.z.boolean(),Ot=m.z.string().nonempty().max(80),St=m.z.number().int().min(nt.ButtonStyle.Primary).max(nt.ButtonStyle.Link),Pt=m.z.string().max(100),it=m.z.number().int().min(0).max(25),Qt=m.z.object({}).array().nonempty();function It(e,t){E.parse(t),Qt.parse(e)}o(It,"validateRequiredSelectMenuParameters");var j=m.z.string().min(1).max(100),Tt=m.z.boolean();function Mt(e,t){j.parse(e),j.parse(t)}o(Mt,"validateRequiredSelectMenuOptionParameters");var vt=m.z.string().url();function Rt(e,t,n,r,s){if(s&&r)throw new RangeError("URL and custom id are mutually exclusive");if(!t&&!n)throw new RangeError("Buttons must have a label and/or an emoji");if(e===nt.ButtonStyle.Link){if(!s)throw new RangeError("Link buttons must have a url")}else if(s)throw new RangeError("Non-link buttons cannot have a url")}o(Rt,"validateRequiredButtonParameters");var Ht=require("discord-api-types/v9");var h=class{constructor(t){i(this,"data");this.data=t}get type(){return this.data.type}};o(h,"Component");var rt=require("discord-api-types/v9");function Et(e){switch(e.type){case rt.ComponentType.ActionRow:return e instanceof B?e:new B(e);case rt.ComponentType.Button:return e instanceof N?e:new N(e);case rt.ComponentType.SelectMenu:return e instanceof $?e:new $(e);default:throw new Error(`Cannot serialize component type: ${e.type}`)}}o(Et,"createComponent");var B=class extends h{constructor({components:t,...n}={}){super({type:Ht.ComponentType.ActionRow,...n});i(this,"components");this.components=t?.map(r=>Et(r))??[]}addComponents(...t){return this.components.push(...t),this}setComponents(t){return this.components.splice(0,this.components.length,...t),this}toJSON(){return{...this.data,components:this.components.map(t=>t.toJSON())}}};o(B,"ActionRow");var Xt=require("discord-api-types/v9");var q=class extends h{constructor(t){super({type:Xt.ComponentType.Button,...t})}get style(){return this.data.style}get label(){return this.data.label}get emoji(){return this.data.emoji}get disabled(){return this.data.disabled}get customId(){return this.data.custom_id}get url(){return this.data.url}setStyle(t){return this.data.style=t,this}setURL(t){return this.data.url=t,this}setCustomId(t){return this.data.custom_id=t,this}setEmoji(t){return this.data.emoji=t,this}setDisabled(t){return this.data.disabled=t,this}setLabel(t){return this.data.label=t,this}toJSON(){return{...this.data}}};o(q,"UnsafeButtonComponent");var N=class extends q{setStyle(t){return super.setStyle(St.parse(t))}setURL(t){return super.setURL(vt.parse(t))}setCustomId(t){return super.setCustomId(E.parse(t))}setEmoji(t){return super.setEmoji(J.parse(t))}setDisabled(t){return super.setDisabled(k.parse(t))}setLabel(t){return super.setLabel(Ot.parse(t))}toJSON(){return Rt(this.style,this.label,this.emoji,this.customId,this.url),super.toJSON()}};o(N,"ButtonComponent");var Yt=require("discord-api-types/v9");var P=class{constructor(t={}){this.data=t}get label(){return this.data.label}get value(){return this.data.value}get description(){return this.data.description}get emoji(){return this.data.emoji}get default(){return this.data.default}setLabel(t){return this.data.label=t,this}setValue(t){return this.data.value=t,this}setDescription(t){return this.data.description=t,this}setDefault(t){return this.data.default=t,this}setEmoji(t){return this.data.emoji=t,this}toJSON(){return{...this.data}}};o(P,"UnsafeSelectMenuOption");var G=class extends h{constructor(t){let{options:n,...r}=t??{};super({type:Yt.ComponentType.SelectMenu,...r});i(this,"options");this.options=n?.map(s=>new P(s))??[]}get placeholder(){return this.data.placeholder}get maxValues(){return this.data.max_values}get minValues(){return this.data.min_values}get customId(){return this.data.custom_id}get disabled(){return this.data.disabled}setPlaceholder(t){return this.data.placeholder=t,this}setMinValues(t){return this.data.min_values=t,this}setMaxValues(t){return this.data.max_values=t,this}setCustomId(t){return this.data.custom_id=t,this}setDisabled(t){return this.data.disabled=t,this}addOptions(...t){return this.options.push(...t),this}setOptions(t){return this.options.splice(0,this.options.length,...t),this}toJSON(){return{...this.data,options:this.options.map(t=>t.toJSON())}}};o(G,"UnsafeSelectMenuComponent");var $=class extends G{setPlaceholder(t){return super.setPlaceholder(Pt.parse(t))}setMinValues(t){return super.setMinValues(it.parse(t))}setMaxValues(t){return super.setMaxValues(it.parse(t))}setCustomId(t){return super.setCustomId(E.parse(t))}setDisabled(t){return super.setDisabled(k.parse(t))}toJSON(){return It(this.options,this.customId),super.toJSON()}};o($,"SelectMenuComponent");var Bt=class extends P{setDescription(t){return super.setDescription(j.parse(t))}setDefault(t){return super.setDefault(Tt.parse(t))}setEmoji(t){return super.setEmoji(J.parse(t))}toJSON(){return Mt(this.label,this.value),super.toJSON()}};o(Bt,"SelectMenuOption");var _t={};F(_t,{assertReturnOfBuilder:()=>y,validateDefaultPermission:()=>Nt,validateDescription:()=>pt,validateMaxChoicesLength:()=>$t,validateMaxOptionsLength:()=>b,validateName:()=>st,validateRequired:()=>mt,validateRequiredParameters:()=>A});var at=ve(require("@sindresorhus/is")),z=require("zod"),Ze=z.z.string().min(1).max(32).regex(/^[\P{Lu}\p{N}_-]+$/u);function st(e){Ze.parse(e)}o(st,"validateName");var Ke=z.z.string().min(1).max(100);function pt(e){Ke.parse(e)}o(pt,"validateDescription");var te=z.z.unknown().array().max(25);function b(e){te.parse(e)}o(b,"validateMaxOptionsLength");function A(e,t,n){st(e),pt(t),b(n)}o(A,"validateRequiredParameters");var ee=z.z.boolean();function Nt(e){ee.parse(e)}o(Nt,"validateDefaultPermission");function mt(e){ee.parse(e)}o(mt,"validateRequired");function $t(e){te.parse(e)}o($t,"validateMaxChoicesLength");function y(e,t){let n=t.name;if(at.default.nullOrUndefined(e))throw new TypeError(`Expected to receive a ${n} builder, got ${e===null?"null":"undefined"} instead.`);if(at.default.primitive(e))throw new TypeError(`Expected to receive a ${n} builder, got a primitive (${typeof e}) instead.`);if(!(e instanceof t)){let r=e,s=at.default.function_(e)?e.name:r.constructor.name,R=Reflect.get(r,Symbol.toStringTag),U=R?`${s} [${R}]`:s;throw new TypeError(`Expected to receive a ${n} builder, got ${U} instead.`)}}o(y,"assertReturnOfBuilder");var Oe=require("ts-mixer");var oe=require("discord-api-types/v9");var C=class{constructor(){i(this,"name");i(this,"description")}setName(t){return st(t),Reflect.set(this,"name",t),this}setDescription(t){return pt(t),Reflect.set(this,"description",t),this}};o(C,"SharedNameAndDescription");var p=class extends C{constructor(){super(...arguments);i(this,"required",!1)}setRequired(t){return mt(t),Reflect.set(this,"required",t),this}runRequiredValidations(){A(this.name,this.description,[]),mt(this.required)}};o(p,"ApplicationCommandOptionBase");var W=class extends p{constructor(){super(...arguments);i(this,"type",oe.ApplicationCommandOptionType.Boolean)}toJSON(){return this.runRequiredValidations(),{...this}}};o(W,"SlashCommandBooleanOption");var ne=require("discord-api-types/v9"),ie=require("ts-mixer");var u=require("discord-api-types/v9"),Lt=require("zod"),Qe=[u.ChannelType.GuildText,u.ChannelType.GuildVoice,u.ChannelType.GuildCategory,u.ChannelType.GuildNews,u.ChannelType.GuildStore,u.ChannelType.GuildNewsThread,u.ChannelType.GuildPublicThread,u.ChannelType.GuildPrivateThread,u.ChannelType.GuildStageVoice],He=Lt.z.union(Qe.map(e=>Lt.z.literal(e))),lt=class{constructor(){i(this,"channel_types")}addChannelType(t){return this.channel_types===void 0&&Reflect.set(this,"channel_types",[]),He.parse(t),this.channel_types.push(t),this}addChannelTypes(t){return t.forEach(n=>this.addChannelType(n)),this}};o(lt,"ApplicationCommandOptionChannelTypesMixin");var I=class extends p{constructor(){super(...arguments);i(this,"type",ne.ApplicationCommandOptionType.Channel)}toJSON(){return this.runRequiredValidations(),{...this}}};o(I,"SlashCommandChannelOption"),I=l([(0,ie.mix)(lt)],I);var pe=require("discord-api-types/v9"),me=require("ts-mixer"),le=require("zod");var _=class{constructor(){i(this,"max_value");i(this,"min_value")}};o(_,"ApplicationCommandNumericOptionMinMaxValueMixin");var re=require("discord-api-types/v9"),L=require("zod");var dt=L.z.string().min(1).max(100),ae=L.z.number().gt(-1/0).lt(1/0),se=L.z.object({name:dt,value:L.z.union([dt,ae])}).array(),Xe=L.z.boolean(),g=class{constructor(){i(this,"choices");i(this,"autocomplete");i(this,"type")}addChoice(t){let{name:n,value:r}=t;if(this.autocomplete)throw new RangeError("Autocomplete and choices are mutually exclusive to each other.");return this.choices===void 0&&Reflect.set(this,"choices",[]),$t(this.choices),dt.parse(n),this.type===re.ApplicationCommandOptionType.String?dt.parse(r):ae.parse(r),this.choices.push({name:n,value:r}),this}addChoices(...t){if(this.autocomplete)throw new RangeError("Autocomplete and choices are mutually exclusive to each other.");se.parse(t);for(let n of t)this.addChoice(n);return this}setChoices(...t){if(t.length>0&&this.autocomplete)throw new RangeError("Autocomplete and choices are mutually exclusive to each other.");se.parse(t),Reflect.set(this,"choices",[]);for(let n of t)this.addChoice(n);return this}setAutocomplete(t){if(Xe.parse(t),t&&Array.isArray(this.choices)&&this.choices.length>0)throw new RangeError("Autocomplete and choices are mutually exclusive to each other.");return Reflect.set(this,"autocomplete",t),this}};o(g,"ApplicationCommandOptionWithChoicesAndAutocompleteMixin");var de=le.z.number().int().nonnegative(),T=class extends p{constructor(){super(...arguments);i(this,"type",pe.ApplicationCommandOptionType.Integer)}setMaxValue(t){return de.parse(t),Reflect.set(this,"max_value",t),this}setMinValue(t){return de.parse(t),Reflect.set(this,"min_value",t),this}toJSON(){if(this.runRequiredValidations(),this.autocomplete&&Array.isArray(this.choices)&&this.choices.length>0)throw new RangeError("Autocomplete and choices are mutually exclusive to each other.");return{...this}}};o(T,"SlashCommandIntegerOption"),T=l([(0,me.mix)(_,g)],T);var ue=require("discord-api-types/v9");var Z=class extends p{constructor(){super(...arguments);i(this,"type",ue.ApplicationCommandOptionType.Mentionable)}toJSON(){return this.runRequiredValidations(),{...this}}};o(Z,"SlashCommandMentionableOption");var ce=require("discord-api-types/v9"),he=require("ts-mixer"),be=require("zod");var Ce=be.z.number().nonnegative(),M=class extends p{constructor(){super(...arguments);i(this,"type",ce.ApplicationCommandOptionType.Number)}setMaxValue(t){return Ce.parse(t),Reflect.set(this,"max_value",t),this}setMinValue(t){return Ce.parse(t),Reflect.set(this,"min_value",t),this}toJSON(){if(this.runRequiredValidations(),this.autocomplete&&Array.isArray(this.choices)&&this.choices.length>0)throw new RangeError("Autocomplete and choices are mutually exclusive to each other.");return{...this}}};o(M,"SlashCommandNumberOption"),M=l([(0,he.mix)(_,g)],M);var fe=require("discord-api-types/v9");var K=class extends p{constructor(){super(...arguments);i(this,"type",fe.ApplicationCommandOptionType.Role)}toJSON(){return this.runRequiredValidations(),{...this}}};o(K,"SlashCommandRoleOption");var xe=require("discord-api-types/v9");var Q=class extends p{constructor(){super(...arguments);i(this,"type",xe.ApplicationCommandOptionType.Attachment)}toJSON(){return this.runRequiredValidations(),{...this}}};o(Q,"SlashCommandAttachmentOption");var Ae=require("discord-api-types/v9"),ye=require("ts-mixer");var v=class extends p{constructor(){super(...arguments);i(this,"type",Ae.ApplicationCommandOptionType.String)}toJSON(){if(this.runRequiredValidations(),this.autocomplete&&Array.isArray(this.choices)&&this.choices.length>0)throw new RangeError("Autocomplete and choices are mutually exclusive to each other.");return{...this}}};o(v,"SlashCommandStringOption"),v=l([(0,ye.mix)(g)],v);var ge=require("discord-api-types/v9");var H=class extends p{constructor(){super(...arguments);i(this,"type",ge.ApplicationCommandOptionType.User)}toJSON(){return this.runRequiredValidations(),{...this}}};o(H,"SlashCommandUserOption");var V=class{constructor(){i(this,"options")}addBooleanOption(t){return this._sharedAddOptionMethod(t,W)}addUserOption(t){return this._sharedAddOptionMethod(t,H)}addChannelOption(t){return this._sharedAddOptionMethod(t,I)}addRoleOption(t){return this._sharedAddOptionMethod(t,K)}addAttachmentOption(t){return this._sharedAddOptionMethod(t,Q)}addMentionableOption(t){return this._sharedAddOptionMethod(t,Z)}addStringOption(t){return this._sharedAddOptionMethod(t,v)}addIntegerOption(t){return this._sharedAddOptionMethod(t,T)}addNumberOption(t){return this._sharedAddOptionMethod(t,M)}_sharedAddOptionMethod(t,n){let{options:r}=this;b(r);let s=typeof t=="function"?t(new n):t;return y(s,n),r.push(s),this}};o(V,"SharedSlashCommandOptions");var Vt=require("discord-api-types/v9"),Dt=require("ts-mixer");var O=class{constructor(){i(this,"name");i(this,"description");i(this,"options",[])}addSubcommand(t){let{options:n}=this;b(n);let r=typeof t=="function"?t(new c):t;return y(r,c),n.push(r),this}toJSON(){return A(this.name,this.description,this.options),{type:Vt.ApplicationCommandOptionType.SubcommandGroup,name:this.name,description:this.description,options:this.options.map(t=>t.toJSON())}}};o(O,"SlashCommandSubcommandGroupBuilder"),O=l([(0,Dt.mix)(C)],O);var c=class{constructor(){i(this,"name");i(this,"description");i(this,"options",[])}toJSON(){return A(this.name,this.description,this.options),{type:Vt.ApplicationCommandOptionType.Subcommand,name:this.name,description:this.description,options:this.options.map(t=>t.toJSON())}}};o(c,"SlashCommandSubcommandBuilder"),c=l([(0,Dt.mix)(C,V)],c);var X=class{constructor(){i(this,"name");i(this,"description");i(this,"options",[]);i(this,"defaultPermission")}toJSON(){return A(this.name,this.description,this.options),{name:this.name,description:this.description,options:this.options.map(t=>t.toJSON()),default_permission:this.defaultPermission}}setDefaultPermission(t){return Nt(t),Reflect.set(this,"defaultPermission",t),this}addSubcommandGroup(t){let{options:n}=this;b(n);let r=typeof t=="function"?t(new O):t;return y(r,O),n.push(r),this}addSubcommand(t){let{options:n}=this;b(n);let r=typeof t=="function"?t(new c):t;return y(r,c),n.push(r),this}};o(X,"SlashCommandBuilder"),X=l([(0,Oe.mix)(V,C)],X);var kt={};F(kt,{validateDefaultPermission:()=>Ft,validateName:()=>ut,validateRequiredParameters:()=>Jt,validateType:()=>ct});var D=require("zod"),Ut=require("discord-api-types/v9"),Ye=D.z.string().min(1).max(32).regex(/^( *[\p{L}\p{N}_-]+ *)+$/u),to=D.z.union([D.z.literal(Ut.ApplicationCommandType.User),D.z.literal(Ut.ApplicationCommandType.Message)]),eo=D.z.boolean();function Ft(e){eo.parse(e)}o(Ft,"validateDefaultPermission");function ut(e){Ye.parse(e)}o(ut,"validateName");function ct(e){to.parse(e)}o(ct,"validateType");function Jt(e,t){ut(e),ct(t)}o(Jt,"validateRequiredParameters");var jt=class{constructor(){i(this,"name");i(this,"type");i(this,"defaultPermission")}setName(t){return ut(t),Reflect.set(this,"name",t),this}setType(t){return ct(t),Reflect.set(this,"type",t),this}setDefaultPermission(t){return Ft(t),Reflect.set(this,"defaultPermission",t),this}toJSON(){return Jt(this.name,this.type),{name:this.name,type:this.type,default_permission:this.defaultPermission}}};o(jt,"ContextMenuCommandBuilder");function oo(e){return e!==null&&typeof e=="object"&&"toJSON"in e}o(oo,"isJSONEncodable");module.exports=Re(no);0&&(module.exports={ActionRow,ButtonComponent,Component,ComponentAssertions,ContextMenuCommandAssertions,ContextMenuCommandBuilder,Embed,EmbedAssertions,Faces,SelectMenuComponent,SelectMenuOption,SlashCommandAssertions,SlashCommandAttachmentOption,SlashCommandBooleanOption,SlashCommandBuilder,SlashCommandChannelOption,SlashCommandIntegerOption,SlashCommandMentionableOption,SlashCommandNumberOption,SlashCommandRoleOption,SlashCommandStringOption,SlashCommandSubcommandBuilder,SlashCommandSubcommandGroupBuilder,SlashCommandUserOption,TimestampStyles,UnsafeButtonComponent,UnsafeEmbed,UnsafeSelectMenuComponent,UnsafeSelectMenuOption,blockQuote,bold,channelMention,codeBlock,createComponent,formatEmoji,hideLinkEmbed,hyperlink,inlineCode,isJSONEncodable,italic,memberNicknameMention,quote,roleMention,spoiler,strikethrough,time,underscore,userMention});
4
4
  //# sourceMappingURL=index.js.map