@discordjs/builders 0.13.0-dev.1646913825.dcd4797 → 0.13.0-dev.1647130084.549716e

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, APIEmbedAuthor, APIEmbedFooter, APIEmbedImage, APIEmbed, APIEmbedVideo, APISelectMenuOption, APIMessageComponentEmoji, ButtonStyle, APIBaseComponent, ComponentType, APIModalComponent, APIMessageComponent, APIActionRowComponent, APIModalActionRowComponent, APIMessageActionRowComponent, APIActionRowComponentTypes, APIButtonComponent, APITextInputComponent, TextInputStyle, APIModalInteractionResponseCallbackData, APISelectMenuComponent, ApplicationCommandOptionType, APIApplicationCommandBasicOption, APIApplicationCommandBooleanOption, ChannelType, APIApplicationCommandChannelOption, APIApplicationCommandOptionChoice, APIApplicationCommandIntegerOption, APIApplicationCommandMentionableOption, APIApplicationCommandNumberOption, APIApplicationCommandRoleOption, APIApplicationCommandAttachmentOption, APIApplicationCommandStringOption, APIApplicationCommandUserOption, APIApplicationCommandSubcommandGroupOption, APIApplicationCommandSubcommandOption, RESTPostAPIApplicationCommandsJSONBody, APIApplicationCommandOption, ApplicationCommandType } from 'discord-api-types/v9';
1
+ import { APIEmbedField, APIEmbedAuthor, APIEmbedFooter, APIEmbedImage, APIEmbed, APISelectMenuOption, APIMessageComponentEmoji, ButtonStyle, APIBaseComponent, ComponentType, APIModalComponent, APIMessageComponent, APIActionRowComponent, APIModalActionRowComponent, APIMessageActionRowComponent, APIActionRowComponentTypes, APIButtonComponent, APITextInputComponent, TextInputStyle, APIModalInteractionResponseCallbackData, APISelectMenuComponent, ApplicationCommandOptionType, APIApplicationCommandBasicOption, APIApplicationCommandBooleanOption, ChannelType, APIApplicationCommandChannelOption, APIApplicationCommandOptionChoice, APIApplicationCommandIntegerOption, APIApplicationCommandMentionableOption, APIApplicationCommandNumberOption, APIApplicationCommandRoleOption, APIApplicationCommandAttachmentOption, 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';
@@ -79,13 +78,6 @@ declare namespace Assertions$5 {
79
78
  };
80
79
  }
81
80
 
82
- interface Equatable<T> {
83
- /**
84
- * Whether or not this is equal to another structure
85
- */
86
- equals: (other: T) => boolean;
87
- }
88
-
89
81
  declare type RGBTuple = [red: number, green: number, blue: number];
90
82
  interface IconData {
91
83
  /**
@@ -110,65 +102,9 @@ interface EmbedImageData extends Omit<APIEmbedImage, 'proxy_url'> {
110
102
  /**
111
103
  * Represents a non-validated embed in a message (image/video preview, rich embed, etc.)
112
104
  */
113
- declare class UnsafeEmbed implements Equatable<APIEmbed | UnsafeEmbed> {
105
+ declare class UnsafeEmbedBuilder {
114
106
  readonly data: APIEmbed;
115
107
  constructor(data?: APIEmbed);
116
- /**
117
- * An array of fields of this embed
118
- */
119
- get fields(): APIEmbedField[] | undefined;
120
- /**
121
- * The embed title
122
- */
123
- get title(): string | undefined;
124
- /**
125
- * The embed description
126
- */
127
- get description(): string | undefined;
128
- /**
129
- * The embed URL
130
- */
131
- get url(): string | undefined;
132
- /**
133
- * The embed color
134
- */
135
- get color(): number | undefined;
136
- /**
137
- * The timestamp of the embed in an ISO 8601 format
138
- */
139
- get timestamp(): string | undefined;
140
- /**
141
- * The embed thumbnail data
142
- */
143
- get thumbnail(): EmbedImageData | undefined;
144
- /**
145
- * The embed image data
146
- */
147
- get image(): EmbedImageData | undefined;
148
- /**
149
- * Received video data
150
- */
151
- get video(): APIEmbedVideo | undefined;
152
- /**
153
- * The embed author data
154
- */
155
- get author(): EmbedAuthorData | undefined;
156
- /**
157
- * Received data about the embed provider
158
- */
159
- get provider(): discord_api_types_v9.APIEmbedProvider | undefined;
160
- /**
161
- * The embed footer data
162
- */
163
- get footer(): EmbedFooterData | undefined;
164
- /**
165
- * The accumulated length for the embed title, description, fields, footer text, and author name
166
- */
167
- get length(): number;
168
- /**
169
- * The hex color of the current color of the embed
170
- */
171
- get hexColor(): string | undefined;
172
108
  /**
173
109
  * Adds fields to the embed (max 25)
174
110
  *
@@ -246,13 +182,12 @@ declare class UnsafeEmbed implements Equatable<APIEmbed | UnsafeEmbed> {
246
182
  * Transforms the embed to a plain object
247
183
  */
248
184
  toJSON(): APIEmbed;
249
- equals(other: UnsafeEmbed | APIEmbed): boolean;
250
185
  }
251
186
 
252
187
  /**
253
188
  * Represents a validated embed in a message (image/video preview, rich embed, etc.)
254
189
  */
255
- declare class Embed extends UnsafeEmbed {
190
+ declare class EmbedBuilder extends UnsafeEmbedBuilder {
256
191
  addFields(...fields: APIEmbedField[]): this;
257
192
  spliceFields(index: number, deleteCount: number, ...fields: APIEmbedField[]): this;
258
193
  setAuthor(options: EmbedAuthorOptions | null): this;
@@ -490,29 +425,9 @@ declare enum Faces {
490
425
  /**
491
426
  * Represents a non-validated option within a select menu component
492
427
  */
493
- declare class UnsafeSelectMenuOption {
494
- protected data: Partial<APISelectMenuOption>;
428
+ declare class UnsafeSelectMenuOptionBuilder {
429
+ data: Partial<APISelectMenuOption>;
495
430
  constructor(data?: Partial<APISelectMenuOption>);
496
- /**
497
- * The label for this option
498
- */
499
- get label(): string | undefined;
500
- /**
501
- * The value for this option
502
- */
503
- get value(): string | undefined;
504
- /**
505
- * The description for this option
506
- */
507
- get description(): string | undefined;
508
- /**
509
- * The emoji for this option
510
- */
511
- get emoji(): APIMessageComponentEmoji | undefined;
512
- /**
513
- * Whether this option is selected by default
514
- */
515
- get default(): boolean | undefined;
516
431
  /**
517
432
  * Sets the label of this option
518
433
  * @param label The label to show on this option
@@ -544,7 +459,7 @@ declare class UnsafeSelectMenuOption {
544
459
  /**
545
460
  * Represents a validated option within a select menu component
546
461
  */
547
- declare class SelectMenuOption extends UnsafeSelectMenuOption {
462
+ declare class SelectMenuOptionBuilder extends UnsafeSelectMenuOptionBuilder {
548
463
  setDescription(description: string): this;
549
464
  setDefault(isDefault?: boolean): this;
550
465
  setEmoji(emoji: APIMessageComponentEmoji): this;
@@ -571,7 +486,7 @@ declare const buttonStyleValidator: z.ZodNumber;
571
486
  declare const placeholderValidator$1: z.ZodString;
572
487
  declare const minMaxValidator: z.ZodNumber;
573
488
  declare const optionsValidator: z.ZodArray<z.ZodObject<{}, "strip", z.ZodTypeAny, {}, {}>, "atleastone">;
574
- declare function validateRequiredSelectMenuParameters(options: SelectMenuOption[], customId?: string): void;
489
+ declare function validateRequiredSelectMenuParameters(options: SelectMenuOptionBuilder[], customId?: string): void;
575
490
  declare const labelValueValidator: z.ZodString;
576
491
  declare const defaultValidator: z.ZodBoolean;
577
492
  declare function validateRequiredSelectMenuOptionParameters(label?: string, value?: string): void;
@@ -625,36 +540,31 @@ declare function isJSONEncodable(maybeEncodable: unknown): maybeEncodable is JSO
625
540
  /**
626
541
  * Represents a discord component
627
542
  */
628
- declare abstract class Component<DataType extends Partial<APIBaseComponent<ComponentType>> & {
543
+ declare abstract class ComponentBuilder<DataType extends Partial<APIBaseComponent<ComponentType>> & {
629
544
  type: ComponentType;
630
- } = APIBaseComponent<ComponentType>> implements JSONEncodable<APIModalComponent | APIMessageComponent | APIActionRowComponent<APIModalActionRowComponent | APIMessageActionRowComponent>>, Equatable<Component | APIActionRowComponentTypes | APIActionRowComponent<APIModalActionRowComponent | APIMessageActionRowComponent>> {
545
+ } = APIBaseComponent<ComponentType>> implements JSONEncodable<APIModalComponent | APIMessageComponent | APIActionRowComponent<APIModalActionRowComponent | APIMessageActionRowComponent>> {
631
546
  /**
632
547
  * The API data associated with this component
633
548
  */
634
549
  readonly data: DataType;
635
550
  abstract toJSON(): APIActionRowComponentTypes | APIActionRowComponent<APIModalActionRowComponent | APIMessageActionRowComponent>;
636
- abstract equals(other: Component | APIActionRowComponentTypes | APIActionRowComponent<APIModalActionRowComponent | APIMessageActionRowComponent>): boolean;
637
551
  constructor(data: DataType);
638
- /**
639
- * The type of this component
640
- */
641
- get type(): DataType['type'];
642
552
  }
643
553
 
644
- declare type MessageComponent = MessageActionRowComponent | ActionRow<MessageActionRowComponent>;
645
- declare type ModalComponent = ModalActionRowComponent | ActionRow<ModalActionRowComponent>;
646
- declare type MessageActionRowComponent = ButtonComponent | SelectMenuComponent;
647
- declare type ModalActionRowComponent = TextInputComponent;
554
+ declare type MessageComponentBuilder = MessageActionRowComponentBuilder | ActionRowBuilder<MessageActionRowComponentBuilder>;
555
+ declare type ModalComponentBuilder = ModalActionRowComponentBuilder | ActionRowBuilder<ModalActionRowComponentBuilder>;
556
+ declare type MessageActionRowComponentBuilder = ButtonBuilder | SelectMenuBuilder;
557
+ declare type ModalActionRowComponentBuilder = TextInputBuilder;
648
558
  /**
649
559
  * Represents an action row component
650
560
  */
651
- declare class ActionRow<T extends ModalActionRowComponent | MessageActionRowComponent = ModalActionRowComponent | MessageActionRowComponent> extends Component<Omit<Partial<APIActionRowComponent<APIMessageActionRowComponent | APIModalActionRowComponent>> & {
561
+ declare class ActionRowBuilder<T extends MessageActionRowComponentBuilder | ModalActionRowComponentBuilder = MessageActionRowComponentBuilder | ModalActionRowComponentBuilder> extends ComponentBuilder<Omit<Partial<APIActionRowComponent<APIMessageActionRowComponent | APIModalActionRowComponent>> & {
652
562
  type: ComponentType.ActionRow;
653
563
  }, 'components'>> {
654
564
  /**
655
565
  * The components within this action row
656
566
  */
657
- readonly components: T[];
567
+ private readonly components;
658
568
  constructor({ components, ...data }?: Partial<APIActionRowComponent<APIMessageActionRowComponent | APIModalActionRowComponent>>);
659
569
  /**
660
570
  * Adds components to this action row.
@@ -668,40 +578,15 @@ declare class ActionRow<T extends ModalActionRowComponent | MessageActionRowComp
668
578
  */
669
579
  setComponents(...components: T[]): this;
670
580
  toJSON(): APIActionRowComponent<ReturnType<T['toJSON']>>;
671
- equals(other: APIActionRowComponent<APIMessageActionRowComponent | APIModalActionRowComponent> | ActionRow): boolean;
672
581
  }
673
582
 
674
583
  /**
675
584
  * Represents a non-validated button component
676
585
  */
677
- declare class UnsafeButtonComponent extends Component<Partial<APIButtonComponent> & {
586
+ declare class UnsafeButtonBuilder extends ComponentBuilder<Partial<APIButtonComponent> & {
678
587
  type: ComponentType.Button;
679
588
  }> {
680
589
  constructor(data?: Partial<APIButtonComponent>);
681
- /**
682
- * The style of this button
683
- */
684
- get style(): ButtonStyle | undefined;
685
- /**
686
- * The label of this button
687
- */
688
- get label(): string | undefined;
689
- /**
690
- * The emoji used in this button
691
- */
692
- get emoji(): APIMessageComponentEmoji | undefined;
693
- /**
694
- * Whether this button is disabled
695
- */
696
- get disabled(): boolean | undefined;
697
- /**
698
- * The custom id of this button (only defined on non-link buttons)
699
- */
700
- get customId(): string | undefined;
701
- /**
702
- * The URL of this button (only defined on link buttons)
703
- */
704
- get url(): string | undefined;
705
590
  /**
706
591
  * Sets the style of this button
707
592
  * @param style The style of the button
@@ -733,13 +618,12 @@ declare class UnsafeButtonComponent extends Component<Partial<APIButtonComponent
733
618
  */
734
619
  setLabel(label: string): this;
735
620
  toJSON(): APIButtonComponent;
736
- equals(other: APIButtonComponent | UnsafeButtonComponent): boolean;
737
621
  }
738
622
 
739
623
  /**
740
624
  * Represents a validated button component
741
625
  */
742
- declare class ButtonComponent extends UnsafeButtonComponent {
626
+ declare class ButtonBuilder extends UnsafeButtonBuilder {
743
627
  setStyle(style: ButtonStyle): this;
744
628
  setURL(url: string): this;
745
629
  setCustomId(customId: string): this;
@@ -750,61 +634,29 @@ declare class ButtonComponent extends UnsafeButtonComponent {
750
634
  }
751
635
 
752
636
  interface MappedComponentTypes {
753
- [ComponentType.ActionRow]: ActionRow;
754
- [ComponentType.Button]: ButtonComponent;
755
- [ComponentType.SelectMenu]: SelectMenuComponent;
756
- [ComponentType.TextInput]: TextInputComponent;
637
+ [ComponentType.ActionRow]: ActionRowBuilder;
638
+ [ComponentType.Button]: ButtonBuilder;
639
+ [ComponentType.SelectMenu]: SelectMenuBuilder;
640
+ [ComponentType.TextInput]: TextInputBuilder;
757
641
  }
758
642
  /**
759
643
  * Factory for creating components from API data
760
644
  * @param data The api data to transform to a component class
761
645
  */
762
- declare function createComponent<T extends keyof MappedComponentTypes>(data: (APIMessageComponent | APIModalComponent) & {
646
+ declare function createComponentBuilder<T extends keyof MappedComponentTypes>(data: (APIMessageComponent | APIModalComponent) & {
763
647
  type: T;
764
648
  }): MappedComponentTypes[T];
765
- declare function createComponent<C extends MessageComponent | ModalActionRowComponent>(data: C): C;
649
+ declare function createComponentBuilder<C extends MessageComponentBuilder | ModalComponentBuilder>(data: C): C;
766
650
 
767
- declare class UnsafeTextInputComponent extends Component<Partial<APITextInputComponent> & {
651
+ declare class UnsafeTextInputBuilder extends ComponentBuilder<Partial<APITextInputComponent> & {
768
652
  type: ComponentType.TextInput;
769
653
  }> {
770
654
  constructor(data?: APITextInputComponent & {
771
655
  type?: ComponentType.TextInput;
772
656
  });
773
- /**
774
- * The style of this text input
775
- */
776
- get style(): TextInputStyle | undefined;
777
- /**
778
- * The custom id of this text input
779
- */
780
- get customId(): string | undefined;
781
- /**
782
- * The label for this text input
783
- */
784
- get label(): string | undefined;
785
- /**
786
- * The placeholder text for this text input
787
- */
788
- get placeholder(): string | undefined;
789
- /**
790
- * The default value for this text input
791
- */
792
- get value(): string | undefined;
793
- /**
794
- * The minimum length of this text input
795
- */
796
- get minLength(): number | undefined;
797
- /**
798
- * The maximum length of this text input
799
- */
800
- get maxLength(): number | undefined;
801
- /**
802
- * Whether this text input is required
803
- */
804
- get required(): boolean | undefined;
805
657
  /**
806
658
  * Sets the custom id for this text input
807
- * @param customId The custom id of this text input
659
+ * @param customId The custom id of this text inputå
808
660
  */
809
661
  setCustomId(customId: string): this;
810
662
  /**
@@ -843,10 +695,10 @@ declare class UnsafeTextInputComponent extends Component<Partial<APITextInputCom
843
695
  */
844
696
  setRequired(required?: boolean): this;
845
697
  toJSON(): APITextInputComponent;
846
- equals(other: UnsafeTextInputComponent | APITextInputComponent): boolean;
698
+ equals(other: UnsafeTextInputBuilder | APITextInputComponent): boolean;
847
699
  }
848
700
 
849
- declare class TextInputComponent extends UnsafeTextInputComponent {
701
+ declare class TextInputBuilder extends UnsafeTextInputBuilder {
850
702
  setMinLength(minLength: number): this;
851
703
  setMaxLength(maxLength: number): this;
852
704
  setRequired(required?: boolean): this;
@@ -884,18 +736,10 @@ declare namespace Assertions$3 {
884
736
  };
885
737
  }
886
738
 
887
- declare class UnsafeModal implements JSONEncodable<APIModalInteractionResponseCallbackData> {
739
+ declare class UnsafeModalBuilder implements JSONEncodable<APIModalInteractionResponseCallbackData> {
888
740
  protected readonly data: Partial<Omit<APIModalInteractionResponseCallbackData, 'components'>>;
889
- readonly components: ActionRow<ModalActionRowComponent>[];
741
+ readonly components: ActionRowBuilder<ModalActionRowComponentBuilder>[];
890
742
  constructor({ components, ...data }?: Partial<APIModalInteractionResponseCallbackData>);
891
- /**
892
- * The custom id of this modal
893
- */
894
- get customId(): string | undefined;
895
- /**
896
- * The title of this modal
897
- */
898
- get title(): string | undefined;
899
743
  /**
900
744
  * Sets the title of the modal
901
745
  * @param title The title of the modal
@@ -910,24 +754,24 @@ declare class UnsafeModal implements JSONEncodable<APIModalInteractionResponseCa
910
754
  * Adds components to this modal
911
755
  * @param components The components to add to this modal
912
756
  */
913
- addComponents(...components: (ActionRow<ModalActionRowComponent> | APIActionRowComponent<APIModalActionRowComponent>)[]): this;
757
+ addComponents(...components: (ActionRowBuilder<ModalActionRowComponentBuilder> | APIActionRowComponent<APIModalActionRowComponent>)[]): this;
914
758
  /**
915
759
  * Sets the components in this modal
916
760
  * @param components The components to set this modal to
917
761
  */
918
- setComponents(...components: ActionRow<ModalActionRowComponent>[]): this;
762
+ setComponents(...components: ActionRowBuilder<ModalActionRowComponentBuilder>[]): this;
919
763
  toJSON(): APIModalInteractionResponseCallbackData;
920
764
  }
921
765
 
922
- declare class Modal extends UnsafeModal {
766
+ declare class ModalBuilder extends UnsafeModalBuilder {
923
767
  setCustomId(customId: string): this;
924
768
  setTitle(title: string): this;
925
769
  toJSON(): APIModalInteractionResponseCallbackData;
926
770
  }
927
771
 
928
772
  declare const titleValidator: z.ZodString;
929
- declare const componentsValidator: z.ZodArray<z.ZodType<ActionRow<TextInputComponent | MessageActionRowComponent>, z.ZodTypeDef, ActionRow<TextInputComponent | MessageActionRowComponent>>, "many">;
930
- declare function validateRequiredParameters$2(customId?: string, title?: string, components?: ActionRow<ModalActionRowComponent>[]): void;
773
+ declare const componentsValidator: z.ZodArray<z.ZodType<ActionRowBuilder<MessageActionRowComponentBuilder | TextInputBuilder>, z.ZodTypeDef, ActionRowBuilder<MessageActionRowComponentBuilder | TextInputBuilder>>, "many">;
774
+ declare function validateRequiredParameters$2(customId?: string, title?: string, components?: ActionRowBuilder<ModalActionRowComponentBuilder>[]): void;
931
775
 
932
776
  declare const Assertions$2_titleValidator: typeof titleValidator;
933
777
  declare const Assertions$2_componentsValidator: typeof componentsValidator;
@@ -942,34 +786,14 @@ declare namespace Assertions$2 {
942
786
  /**
943
787
  * Represents a non-validated select menu component
944
788
  */
945
- declare class UnsafeSelectMenuComponent extends Component<Partial<Omit<APISelectMenuComponent, 'options'>> & {
789
+ declare class UnsafeSelectMenuBuilder extends ComponentBuilder<Partial<Omit<APISelectMenuComponent, 'options'>> & {
946
790
  type: ComponentType.SelectMenu;
947
791
  }> {
948
792
  /**
949
793
  * The options within this select menu
950
794
  */
951
- readonly options: UnsafeSelectMenuOption[];
795
+ protected readonly options: UnsafeSelectMenuOptionBuilder[];
952
796
  constructor(data?: Partial<APISelectMenuComponent>);
953
- /**
954
- * The placeholder for this select menu
955
- */
956
- get placeholder(): string | undefined;
957
- /**
958
- * The maximum amount of options that can be selected
959
- */
960
- get maxValues(): number | undefined;
961
- /**
962
- * The minimum amount of options that must be selected
963
- */
964
- get minValues(): number | undefined;
965
- /**
966
- * The custom id of this select menu
967
- */
968
- get customId(): string | undefined;
969
- /**
970
- * Whether this select menu is disabled
971
- */
972
- get disabled(): boolean | undefined;
973
797
  /**
974
798
  * Sets the placeholder for this select menu
975
799
  * @param placeholder The placeholder to use for this select menu
@@ -1000,20 +824,19 @@ declare class UnsafeSelectMenuComponent extends Component<Partial<Omit<APISelect
1000
824
  * @param options The options to add to this select menu
1001
825
  * @returns
1002
826
  */
1003
- addOptions(...options: (UnsafeSelectMenuOption | APISelectMenuOption)[]): this;
827
+ addOptions(...options: (UnsafeSelectMenuOptionBuilder | APISelectMenuOption)[]): this;
1004
828
  /**
1005
829
  * Sets the options on this select menu
1006
830
  * @param options The options to set on this select menu
1007
831
  */
1008
- setOptions(...options: (UnsafeSelectMenuOption | APISelectMenuOption)[]): this;
832
+ setOptions(...options: (UnsafeSelectMenuOptionBuilder | APISelectMenuOption)[]): this;
1009
833
  toJSON(): APISelectMenuComponent;
1010
- equals(other: APISelectMenuComponent | UnsafeSelectMenuComponent): boolean;
1011
834
  }
1012
835
 
1013
836
  /**
1014
837
  * Represents a validated select menu component
1015
838
  */
1016
- declare class SelectMenuComponent extends UnsafeSelectMenuComponent {
839
+ declare class SelectMenuBuilder extends UnsafeSelectMenuBuilder {
1017
840
  setPlaceholder(placeholder: string): this;
1018
841
  setMinValues(minValues: number): this;
1019
842
  setMaxValues(maxValues: number): this;
@@ -1413,4 +1236,18 @@ declare namespace Assertions {
1413
1236
  };
1414
1237
  }
1415
1238
 
1416
- export { ActionRow, ButtonComponent, Component, Assertions$4 as ComponentAssertions, Assertions as ContextMenuCommandAssertions, ContextMenuCommandBuilder, ContextMenuCommandType, Embed, Assertions$5 as EmbedAssertions, EmbedAuthorData, EmbedAuthorOptions, EmbedFooterData, EmbedFooterOptions, EmbedImageData, Faces, IconData, JSONEncodable, MappedComponentTypes, MessageActionRowComponent, MessageComponent, Modal, ModalActionRowComponent, Assertions$2 as ModalAssertions, ModalComponent, RGBTuple, SelectMenuComponent, SelectMenuOption, Assertions$1 as SlashCommandAssertions, SlashCommandAttachmentOption, SlashCommandBooleanOption, SlashCommandBuilder, SlashCommandChannelOption, SlashCommandIntegerOption, SlashCommandMentionableOption, SlashCommandNumberOption, SlashCommandOptionsOnlyBuilder, SlashCommandRoleOption, SlashCommandStringOption, SlashCommandSubcommandBuilder, SlashCommandSubcommandGroupBuilder, SlashCommandSubcommandsOnlyBuilder, SlashCommandUserOption, Assertions$3 as TextInputAssertions, TextInputComponent, TimestampStyles, TimestampStylesString, ToAPIApplicationCommandOptions, UnsafeButtonComponent, UnsafeEmbed, UnsafeModal, UnsafeSelectMenuComponent, UnsafeSelectMenuOption, UnsafeTextInputComponent, blockQuote, bold, channelMention, codeBlock, createComponent, formatEmoji, hideLinkEmbed, hyperlink, inlineCode, isJSONEncodable, italic, memberNicknameMention, quote, roleMention, spoiler, strikethrough, time, underscore, userMention };
1239
+ interface Equatable<T> {
1240
+ /**
1241
+ * Whether or not this is equal to another structure
1242
+ */
1243
+ equals: (other: T) => boolean;
1244
+ }
1245
+ /**
1246
+ * Indicates if an object is equatable or not.
1247
+ * @param maybeEquatable The object to check against
1248
+ */
1249
+ declare function isEquatable(maybeEquatable: unknown): maybeEquatable is Equatable<unknown>;
1250
+
1251
+ declare function embedLength(data: APIEmbed): number;
1252
+
1253
+ export { ActionRowBuilder, ButtonBuilder, Assertions$4 as ComponentAssertions, ComponentBuilder, Assertions as ContextMenuCommandAssertions, ContextMenuCommandBuilder, ContextMenuCommandType, Assertions$5 as EmbedAssertions, EmbedAuthorData, EmbedAuthorOptions, EmbedBuilder, EmbedFooterData, EmbedFooterOptions, EmbedImageData, Equatable, Faces, IconData, JSONEncodable, MappedComponentTypes, MessageActionRowComponentBuilder, MessageComponentBuilder, ModalActionRowComponentBuilder, Assertions$2 as ModalAssertions, ModalBuilder, ModalComponentBuilder, RGBTuple, SelectMenuBuilder, SelectMenuOptionBuilder, Assertions$1 as SlashCommandAssertions, SlashCommandAttachmentOption, SlashCommandBooleanOption, SlashCommandBuilder, SlashCommandChannelOption, SlashCommandIntegerOption, SlashCommandMentionableOption, SlashCommandNumberOption, SlashCommandOptionsOnlyBuilder, SlashCommandRoleOption, SlashCommandStringOption, SlashCommandSubcommandBuilder, SlashCommandSubcommandGroupBuilder, SlashCommandSubcommandsOnlyBuilder, SlashCommandUserOption, Assertions$3 as TextInputAssertions, TextInputBuilder, TimestampStyles, TimestampStylesString, ToAPIApplicationCommandOptions, UnsafeButtonBuilder, UnsafeEmbedBuilder, UnsafeModalBuilder, UnsafeSelectMenuBuilder, UnsafeSelectMenuOptionBuilder, UnsafeTextInputBuilder, blockQuote, bold, channelMention, codeBlock, createComponentBuilder, embedLength, formatEmoji, hideLinkEmbed, hyperlink, inlineCode, isEquatable, isJSONEncodable, italic, memberNicknameMention, quote, roleMention, spoiler, strikethrough, time, underscore, userMention };
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- var Xe=Object.create;var T=Object.defineProperty;var le=Object.getOwnPropertyDescriptor;var Ye=Object.getOwnPropertyNames;var to=Object.getPrototypeOf,eo=Object.prototype.hasOwnProperty;var oo=(e,t,n)=>t in e?T(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var ue=e=>T(e,"__esModule",{value:!0}),o=(e,t)=>T(e,"name",{value:t,configurable:!0});var w=(e,t)=>{for(var n in t)T(e,n,{get:t[n],enumerable:!0})},de=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of Ye(t))!eo.call(e,s)&&(n||s!=="default")&&T(e,s,{get:()=>t[s],enumerable:!(r=le(t,s))||r.enumerable});return e},D=(e,t)=>de(ue(T(e!=null?Xe(to(e)):{},"default",!t&&e&&e.__esModule?{get:()=>e.default,enumerable:!0}:{value:e,enumerable:!0})),e),no=(e=>(t,n)=>e&&e.get(t)||(n=de(ue({}),t,1),e&&e.set(t,n),n))(typeof WeakMap!="undefined"?new WeakMap:0),u=(e,t,n,r)=>{for(var s=r>1?void 0:r?le(t,n):t,g=e.length-1,M;g>=0;g--)(M=e[g])&&(s=(r?M(t,n,s):M(s))||s);return r&&s&&T(t,n,s),s};var i=(e,t,n)=>(oo(e,typeof t!="symbol"?t+"":t,n),n);var Vo={};w(Vo,{ActionRow:()=>h,ButtonComponent:()=>K,Component:()=>d,ComponentAssertions:()=>qt,ContextMenuCommandAssertions:()=>pe,ContextMenuCommandBuilder:()=>me,Embed:()=>vt,EmbedAssertions:()=>wt,Faces:()=>Ae,Modal:()=>Ht,ModalAssertions:()=>Qt,SelectMenuComponent:()=>H,SelectMenuOption:()=>Xt,SlashCommandAssertions:()=>ee,SlashCommandAttachmentOption:()=>ot,SlashCommandBooleanOption:()=>Y,SlashCommandBuilder:()=>it,SlashCommandChannelOption:()=>V,SlashCommandIntegerOption:()=>L,SlashCommandMentionableOption:()=>tt,SlashCommandNumberOption:()=>$,SlashCommandRoleOption:()=>et,SlashCommandStringOption:()=>_,SlashCommandSubcommandBuilder:()=>f,SlashCommandSubcommandGroupBuilder:()=>R,SlashCommandUserOption:()=>nt,TextInputAssertions:()=>Wt,TextInputComponent:()=>Q,TimestampStyles:()=>Oo,UnsafeButtonComponent:()=>E,UnsafeEmbed:()=>v,UnsafeModal:()=>X,UnsafeSelectMenuComponent:()=>B,UnsafeSelectMenuOption:()=>b,UnsafeTextInputComponent:()=>N,blockQuote:()=>uo,bold:()=>so,channelMention:()=>Ao,codeBlock:()=>io,createComponent:()=>Z,formatEmoji:()=>go,hideLinkEmbed:()=>co,hyperlink:()=>ho,inlineCode:()=>ro,isJSONEncodable:()=>Bo,italic:()=>ao,memberNicknameMention:()=>fo,quote:()=>lo,roleMention:()=>xo,spoiler:()=>bo,strikethrough:()=>mo,time:()=>yo,underscore:()=>po,userMention:()=>Co});var wt={};w(wt,{RGBPredicate:()=>pt,authorNamePredicate:()=>Pt,colorPredicate:()=>It,descriptionPredicate:()=>St,embedFieldPredicate:()=>be,embedFieldsArrayPredicate:()=>at,fieldInlinePredicate:()=>he,fieldLengthPredicate:()=>Ce,fieldNamePredicate:()=>rt,fieldValuePredicate:()=>ce,footerTextPredicate:()=>Rt,timestampPredicate:()=>Mt,titlePredicate:()=>Tt,urlPredicate:()=>y,validateFieldLength:()=>st});var m=require("zod"),rt=m.z.string().min(1).max(256),ce=m.z.string().min(1).max(1024),he=m.z.boolean().optional(),be=m.z.object({name:rt,value:ce,inline:he}),at=be.array(),Ce=m.z.number().lte(25);function st(e,t){Ce.parse((t?.length??0)+e)}o(st,"validateFieldLength");var Pt=rt.nullable(),y=m.z.string().url().nullish(),pt=m.z.number().int().gte(0).lte(255),It=m.z.number().int().gte(0).lte(16777215).nullable().or(m.z.tuple([pt,pt,pt])),St=m.z.string().min(1).max(4096).nullable(),Rt=m.z.string().min(1).max(2048).nullable(),Mt=m.z.union([m.z.number(),m.z.date()]).nullable(),Tt=rt.nullable();var fe=D(require("fast-deep-equal")),v=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)}get hexColor(){return typeof this.data.color=="number"?`#${this.data.color.toString(16).padStart(6,"0")}`:this.data.color}addFields(...t){return this.data.fields?this.data.fields.push(...t):this.data.fields=t,this}spliceFields(t,n,...r){return 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){if(Array.isArray(t)){let[n,r,s]=t;return this.data.color=(n<<16)+(r<<8)+s,this}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}}equals(t){let{image:n,thumbnail:r,...s}=this.data,g=t instanceof v?t.data:t,{image:M,thumbnail:Qe,...He}=g;return(0,fe.default)(He,s)&&M?.url===n?.url&&Qe?.url===r?.url}};o(v,"UnsafeEmbed");var vt=class extends v{addFields(...t){return st(t.length,this.fields),super.addFields(...at.parse(t))}spliceFields(t,n,...r){return st(r.length-n,this.fields),super.spliceFields(t,n,...at.parse(r))}setAuthor(t){return t===null?super.setAuthor(null):(Pt.parse(t.name),y.parse(t.iconURL),y.parse(t.url),super.setAuthor(t))}setColor(t){return super.setColor(It.parse(t))}setDescription(t){return super.setDescription(St.parse(t))}setFooter(t){return t===null?super.setFooter(null):(Rt.parse(t.text),y.parse(t.iconURL),super.setFooter(t))}setImage(t){return super.setImage(y.parse(t))}setThumbnail(t){return super.setThumbnail(y.parse(t))}setTimestamp(t=Date.now()){return super.setTimestamp(Mt.parse(t))}setTitle(t){return super.setTitle(Tt.parse(t))}setURL(t){return super.setURL(y.parse(t))}};o(vt,"Embed");function io(e,t){return typeof t=="undefined"?`\`\`\`
1
+ var We=Object.create;var M=Object.defineProperty;var ae=Object.getOwnPropertyDescriptor;var ze=Object.getOwnPropertyNames;var Ze=Object.getPrototypeOf,Ke=Object.prototype.hasOwnProperty;var Qe=(e,t,n)=>t in e?M(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var se=e=>M(e,"__esModule",{value:!0}),o=(e,t)=>M(e,"name",{value:t,configurable:!0});var T=(e,t)=>{for(var n in t)M(e,n,{get:t[n],enumerable:!0})},pe=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of ze(t))!Ke.call(e,s)&&(n||s!=="default")&&M(e,s,{get:()=>t[s],enumerable:!(r=ae(t,s))||r.enumerable});return e},me=(e,t)=>pe(se(M(e!=null?We(Ze(e)):{},"default",!t&&e&&e.__esModule?{get:()=>e.default,enumerable:!0}:{value:e,enumerable:!0})),e),He=(e=>(t,n)=>e&&e.get(t)||(n=pe(se({}),t,1),e&&e.set(t,n),n))(typeof WeakMap!="undefined"?new WeakMap:0),d=(e,t,n,r)=>{for(var s=r>1?void 0:r?ae(t,n):t,E=e.length-1,J;E>=0;E--)(J=e[E])&&(s=(r?J(t,n,s):J(s))||s);return r&&s&&M(t,n,s),s};var i=(e,t,n)=>(Qe(e,typeof t!="symbol"?t+"":t,n),n);var wo={};T(wo,{ActionRowBuilder:()=>C,ButtonBuilder:()=>W,ComponentAssertions:()=>Lt,ComponentBuilder:()=>u,ContextMenuCommandAssertions:()=>ie,ContextMenuCommandBuilder:()=>re,EmbedAssertions:()=>Mt,EmbedBuilder:()=>Tt,Faces:()=>he,ModalAssertions:()=>Wt,ModalBuilder:()=>zt,SelectMenuBuilder:()=>Z,SelectMenuOptionBuilder:()=>Zt,SlashCommandAssertions:()=>Ht,SlashCommandAttachmentOption:()=>et,SlashCommandBooleanOption:()=>X,SlashCommandBuilder:()=>nt,SlashCommandChannelOption:()=>B,SlashCommandIntegerOption:()=>w,SlashCommandMentionableOption:()=>Y,SlashCommandNumberOption:()=>v,SlashCommandRoleOption:()=>tt,SlashCommandStringOption:()=>N,SlashCommandSubcommandBuilder:()=>f,SlashCommandSubcommandGroupBuilder:()=>I,SlashCommandUserOption:()=>ot,TextInputAssertions:()=>jt,TextInputBuilder:()=>z,TimestampStyles:()=>bo,UnsafeButtonBuilder:()=>K,UnsafeEmbedBuilder:()=>k,UnsafeModalBuilder:()=>Q,UnsafeSelectMenuBuilder:()=>H,UnsafeSelectMenuOptionBuilder:()=>h,UnsafeTextInputBuilder:()=>R,blockQuote:()=>ro,bold:()=>eo,channelMention:()=>uo,codeBlock:()=>Xe,createComponentBuilder:()=>G,embedLength:()=>Bo,formatEmoji:()=>ho,hideLinkEmbed:()=>ao,hyperlink:()=>so,inlineCode:()=>Ye,isEquatable:()=>Ro,isJSONEncodable:()=>To,italic:()=>to,memberNicknameMention:()=>lo,quote:()=>io,roleMention:()=>co,spoiler:()=>po,strikethrough:()=>no,time:()=>Co,underscore:()=>oo,userMention:()=>mo});var Mt={};T(Mt,{RGBPredicate:()=>st,authorNamePredicate:()=>yt,colorPredicate:()=>gt,descriptionPredicate:()=>Ot,embedFieldPredicate:()=>ue,embedFieldsArrayPredicate:()=>rt,fieldInlinePredicate:()=>de,fieldLengthPredicate:()=>ce,fieldNamePredicate:()=>it,fieldValuePredicate:()=>le,footerTextPredicate:()=>St,timestampPredicate:()=>Pt,titlePredicate:()=>It,urlPredicate:()=>y,validateFieldLength:()=>at});var m=require("zod"),it=m.z.string().min(1).max(256),le=m.z.string().min(1).max(1024),de=m.z.boolean().optional(),ue=m.z.object({name:it,value:le,inline:de}),rt=ue.array(),ce=m.z.number().lte(25);function at(e,t){ce.parse((t?.length??0)+e)}o(at,"validateFieldLength");var yt=it.nullable(),y=m.z.string().url().nullish(),st=m.z.number().int().gte(0).lte(255),gt=m.z.number().int().gte(0).lte(16777215).nullable().or(m.z.tuple([st,st,st])),Ot=m.z.string().min(1).max(4096).nullable(),St=m.z.string().min(1).max(2048).nullable(),Pt=m.z.union([m.z.number(),m.z.date()]).nullable(),It=it.nullable();var k=class{constructor(t={}){i(this,"data");this.data={...t},t.timestamp&&(this.data.timestamp=new Date(t.timestamp).toISOString())}addFields(...t){return this.data.fields?this.data.fields.push(...t):this.data.fields=t,this}spliceFields(t,n,...r){return this.data.fields?this.data.fields.splice(t,n,...r):this.data.fields=r,this}setFields(...t){return this.spliceFields(0,this.data.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){if(Array.isArray(t)){let[n,r,s]=t;return this.data.color=(n<<16)+(r<<8)+s,this}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}}};o(k,"UnsafeEmbedBuilder");var Tt=class extends k{addFields(...t){return at(t.length,this.data.fields),super.addFields(...rt.parse(t))}spliceFields(t,n,...r){return at(r.length-n,this.data.fields),super.spliceFields(t,n,...rt.parse(r))}setAuthor(t){return t===null?super.setAuthor(null):(yt.parse(t.name),y.parse(t.iconURL),y.parse(t.url),super.setAuthor(t))}setColor(t){return super.setColor(gt.parse(t))}setDescription(t){return super.setDescription(Ot.parse(t))}setFooter(t){return t===null?super.setFooter(null):(St.parse(t.text),y.parse(t.iconURL),super.setFooter(t))}setImage(t){return super.setImage(y.parse(t))}setThumbnail(t){return super.setThumbnail(y.parse(t))}setTimestamp(t=Date.now()){return super.setTimestamp(Pt.parse(t))}setTitle(t){return super.setTitle(It.parse(t))}setURL(t){return super.setURL(y.parse(t))}};o(Tt,"EmbedBuilder");function Xe(e,t){return typeof t=="undefined"?`\`\`\`
2
2
  ${e}\`\`\``:`\`\`\`${e}
3
- ${t}\`\`\``}o(io,"codeBlock");function ro(e){return`\`${e}\``}o(ro,"inlineCode");function ao(e){return`_${e}_`}o(ao,"italic");function so(e){return`**${e}**`}o(so,"bold");function po(e){return`__${e}__`}o(po,"underscore");function mo(e){return`~~${e}~~`}o(mo,"strikethrough");function lo(e){return`> ${e}`}o(lo,"quote");function uo(e){return`>>> ${e}`}o(uo,"blockQuote");function co(e){return`<${e}>`}o(co,"hideLinkEmbed");function ho(e,t,n){return n?`[${e}](${t} "${n}")`:`[${e}](${t})`}o(ho,"hyperlink");function bo(e){return`||${e}||`}o(bo,"spoiler");function Co(e){return`<@${e}>`}o(Co,"userMention");function fo(e){return`<@!${e}>`}o(fo,"memberNicknameMention");function Ao(e){return`<#${e}>`}o(Ao,"channelMention");function xo(e){return`<@&${e}>`}o(xo,"roleMention");function go(e,t=!1){return`<${t?"a":""}:_:${e}>`}o(go,"formatEmoji");function yo(e,t){return typeof e!="number"&&(e=Math.floor((e?.getTime()??Date.now())/1e3)),typeof t=="string"?`<t:${e}:${t}>`:`<t:${e}>`}o(yo,"time");var Oo={ShortTime:"t",LongTime:"T",ShortDate:"d",LongDate:"D",ShortDateTime:"f",LongDateTime:"F",RelativeTime:"R"},Ae=(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))(Ae||{});var qt={};w(qt,{buttonLabelValidator:()=>Et,buttonStyleValidator:()=>Nt,customIdValidator:()=>c,defaultValidator:()=>Lt,disabledValidator:()=>G,emojiValidator:()=>F,labelValueValidator:()=>z,minMaxValidator:()=>lt,optionsValidator:()=>xe,placeholderValidator:()=>Bt,urlValidator:()=>_t,validateRequiredButtonParameters:()=>Dt,validateRequiredSelectMenuOptionParameters:()=>$t,validateRequiredSelectMenuParameters:()=>Vt});var mt=require("discord-api-types/v9"),l=require("zod"),c=l.z.string().min(1).max(100),F=l.z.object({id:l.z.string(),name:l.z.string(),animated:l.z.boolean()}).partial().strict(),G=l.z.boolean(),Et=l.z.string().nonempty().max(80),Nt=l.z.number().int().min(mt.ButtonStyle.Primary).max(mt.ButtonStyle.Link),Bt=l.z.string().max(150),lt=l.z.number().int().min(0).max(25),xe=l.z.object({}).array().nonempty();function Vt(e,t){c.parse(t),xe.parse(e)}o(Vt,"validateRequiredSelectMenuParameters");var z=l.z.string().min(1).max(100),Lt=l.z.boolean();function $t(e,t){z.parse(e),z.parse(t)}o($t,"validateRequiredSelectMenuOptionParameters");var _t=l.z.string().url();function Dt(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===mt.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(Dt,"validateRequiredButtonParameters");var ge=require("discord-api-types/v9");var d=class{constructor(t){i(this,"data");this.data=t}get type(){return this.data.type}};o(d,"Component");var W=require("discord-api-types/v9");function Z(e){if(e instanceof d)return e;switch(e.type){case W.ComponentType.ActionRow:return new h(e);case W.ComponentType.Button:return new K(e);case W.ComponentType.SelectMenu:return new H(e);case W.ComponentType.TextInput:return new Q(e);default:throw new Error(`Cannot serialize component type: ${e.type}`)}}o(Z,"createComponent");var ut=D(require("fast-deep-equal")),h=class extends d{constructor({components:t,...n}={}){super({type:ge.ComponentType.ActionRow,...n});i(this,"components");this.components=t?.map(r=>Z(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())}}equals(t){return t instanceof h?(0,ut.default)(t.data,this.data)&&(0,ut.default)(t.components,this.components):(0,ut.default)(t,{...this.data,components:this.components.map(n=>n.toJSON())})}};o(h,"ActionRow");var ye=require("discord-api-types/v9");var Jt=D(require("fast-deep-equal")),E=class extends d{constructor(t){super({type:ye.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=!0){return this.data.disabled=t,this}setLabel(t){return this.data.label=t,this}toJSON(){return{...this.data}}equals(t){return t instanceof E?(0,Jt.default)(t.data,this.data):(0,Jt.default)(t,this.data)}};o(E,"UnsafeButtonComponent");var K=class extends E{setStyle(t){return super.setStyle(Nt.parse(t))}setURL(t){return super.setURL(_t.parse(t))}setCustomId(t){return super.setCustomId(c.parse(t))}setEmoji(t){return super.setEmoji(F.parse(t))}setDisabled(t=!0){return super.setDisabled(G.parse(t))}setLabel(t){return super.setLabel(Et.parse(t))}toJSON(){return Dt(this.style,this.label,this.emoji,this.customId,this.url),super.toJSON()}};o(K,"ButtonComponent");var Wt={};w(Wt,{labelValidator:()=>Ie,maxLengthValidator:()=>kt,minLengthValidator:()=>Ut,placeholderValidator:()=>Gt,requiredValidator:()=>jt,textInputStyleValidator:()=>Pe,validateRequiredParameters:()=>zt,valueValidator:()=>Ft});var Oe=require("discord-api-types/v9"),O=require("zod");var Pe=O.z.nativeEnum(Oe.TextInputStyle),Ut=O.z.number().int().min(0).max(4e3),kt=O.z.number().int().min(1).max(4e3),jt=O.z.boolean(),Ft=O.z.string().max(4e3),Gt=O.z.string().max(100),Ie=O.z.string().min(1).max(45);function zt(e,t,n){c.parse(e),Pe.parse(t),Ie.parse(n)}o(zt,"validateRequiredParameters");var Se=require("discord-api-types/v9");var Zt=D(require("fast-deep-equal")),N=class extends d{constructor(t){super({type:Se.ComponentType.TextInput,...t})}get style(){return this.data.style}get customId(){return this.data.custom_id}get label(){return this.data.label}get placeholder(){return this.data.placeholder}get value(){return this.data.value}get minLength(){return this.data.min_length}get maxLength(){return this.data.max_length}get required(){return this.data.required}setCustomId(t){return this.data.custom_id=t,this}setLabel(t){return this.data.label=t,this}setStyle(t){return this.data.style=t,this}setMinLength(t){return this.data.min_length=t,this}setMaxLength(t){return this.data.max_length=t,this}setPlaceholder(t){return this.data.placeholder=t,this}setValue(t){return this.data.value=t,this}setRequired(t=!0){return this.data.required=t,this}toJSON(){return{...this.data}}equals(t){return t instanceof N?(0,Zt.default)(t.data,this.data):(0,Zt.default)(t,this.data)}};o(N,"UnsafeTextInputComponent");var Q=class extends N{setMinLength(t){return super.setMinLength(Ut.parse(t))}setMaxLength(t){return super.setMaxLength(kt.parse(t))}setRequired(t=!0){return super.setRequired(jt.parse(t))}setValue(t){return super.setValue(Ft.parse(t))}setPlaceholder(t){return super.setPlaceholder(Gt.parse(t))}toJSON(){return zt(this.data.custom_id,this.data.style,this.data.label),super.toJSON()}};o(Q,"TextInputComponent");var X=class{constructor({components:t,...n}={}){i(this,"data");i(this,"components",[]);this.data={...n},this.components=t?.map(r=>Z(r))??[]}get customId(){return this.data.custom_id}get title(){return this.data.title}setTitle(t){return this.data.title=t,this}setCustomId(t){return this.data.custom_id=t,this}addComponents(...t){return this.components.push(...t.map(n=>n instanceof h?n:new h(n))),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(X,"UnsafeModal");var Qt={};w(Qt,{componentsValidator:()=>Re,titleValidator:()=>ct,validateRequiredParameters:()=>Kt});var dt=require("zod");var ct=dt.z.string().min(1).max(45),Re=dt.z.array(dt.z.instanceof(h)).min(1);function Kt(e,t,n){c.parse(e),ct.parse(t),Re.parse(n)}o(Kt,"validateRequiredParameters");var Ht=class extends X{setCustomId(t){return super.setCustomId(c.parse(t))}setTitle(t){return super.setTitle(ct.parse(t))}toJSON(){return Kt(this.data.custom_id,this.data.title,this.components),super.toJSON()}};o(Ht,"Modal");var Me=require("discord-api-types/v9");var b=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=!0){return this.data.default=t,this}setEmoji(t){return this.data.emoji=t,this}toJSON(){return{...this.data}}};o(b,"UnsafeSelectMenuOption");var ht=D(require("fast-deep-equal")),B=class extends d{constructor(t){let{options:n,...r}=t??{};super({type:Me.ComponentType.SelectMenu,...r});i(this,"options");this.options=n?.map(s=>new b(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=!0){return this.data.disabled=t,this}addOptions(...t){return this.options.push(...t.map(n=>n instanceof b?n:new b(n))),this}setOptions(...t){return this.options.splice(0,this.options.length,...t.map(n=>n instanceof b?n:new b(n))),this}toJSON(){return{...this.data,options:this.options.map(t=>t.toJSON())}}equals(t){return t instanceof B?(0,ht.default)(t.data,this.data)&&(0,ht.default)(t.options,this.options):(0,ht.default)(t,{...this.data,options:this.options.map(n=>n.toJSON())})}};o(B,"UnsafeSelectMenuComponent");var H=class extends B{setPlaceholder(t){return super.setPlaceholder(Bt.parse(t))}setMinValues(t){return super.setMinValues(lt.parse(t))}setMaxValues(t){return super.setMaxValues(lt.parse(t))}setCustomId(t){return super.setCustomId(c.parse(t))}setDisabled(t=!0){return super.setDisabled(G.parse(t))}toJSON(){return Vt(this.options,this.customId),super.toJSON()}};o(H,"SelectMenuComponent");var Xt=class extends b{setDescription(t){return super.setDescription(z.parse(t))}setDefault(t=!0){return super.setDefault(Lt.parse(t))}setEmoji(t){return super.setEmoji(F.parse(t))}toJSON(){return $t(this.label,this.value),super.toJSON()}};o(Xt,"SelectMenuOption");var ee={};w(ee,{assertReturnOfBuilder:()=>I,validateChoicesLength:()=>te,validateDefaultPermission:()=>Yt,validateDescription:()=>ft,validateMaxOptionsLength:()=>A,validateName:()=>Ct,validateRequired:()=>At,validateRequiredParameters:()=>P});var bt=D(require("@sindresorhus/is")),q=require("zod"),Po=q.z.string().min(1).max(32).regex(/^[\P{Lu}\p{N}_-]+$/u);function Ct(e){Po.parse(e)}o(Ct,"validateName");var Io=q.z.string().min(1).max(100);function ft(e){Io.parse(e)}o(ft,"validateDescription");var So=q.z.unknown().array().max(25);function A(e){So.parse(e)}o(A,"validateMaxOptionsLength");function P(e,t,n){Ct(e),ft(t),A(n)}o(P,"validateRequiredParameters");var Te=q.z.boolean();function Yt(e){Te.parse(e)}o(Yt,"validateDefaultPermission");function At(e){Te.parse(e)}o(At,"validateRequired");var Ro=q.z.number().lte(25);function te(e,t){Ro.parse((t?.length??0)+e)}o(te,"validateChoicesLength");function I(e,t){let n=t.name;if(bt.default.nullOrUndefined(e))throw new TypeError(`Expected to receive a ${n} builder, got ${e===null?"null":"undefined"} instead.`);if(bt.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=bt.default.function_(e)?e.name:r.constructor.name,g=Reflect.get(r,Symbol.toStringTag),M=g?`${s} [${g}]`:s;throw new TypeError(`Expected to receive a ${n} builder, got ${M} instead.`)}}o(I,"assertReturnOfBuilder");var Ke=require("ts-mixer");var we=require("discord-api-types/v9");var x=class{constructor(){i(this,"name");i(this,"description")}setName(t){return Ct(t),Reflect.set(this,"name",t),this}setDescription(t){return ft(t),Reflect.set(this,"description",t),this}};o(x,"SharedNameAndDescription");var p=class extends x{constructor(){super(...arguments);i(this,"required",!1)}setRequired(t){return At(t),Reflect.set(this,"required",t),this}runRequiredValidations(){P(this.name,this.description,[]),At(this.required)}};o(p,"ApplicationCommandOptionBase");var Y=class extends p{constructor(){super(...arguments);i(this,"type",we.ApplicationCommandOptionType.Boolean)}toJSON(){return this.runRequiredValidations(),{...this}}};o(Y,"SlashCommandBooleanOption");var ve=require("discord-api-types/v9"),Ee=require("ts-mixer");var C=require("discord-api-types/v9"),xt=require("zod"),Mo=[C.ChannelType.GuildText,C.ChannelType.GuildVoice,C.ChannelType.GuildCategory,C.ChannelType.GuildNews,C.ChannelType.GuildStore,C.ChannelType.GuildNewsThread,C.ChannelType.GuildPublicThread,C.ChannelType.GuildPrivateThread,C.ChannelType.GuildStageVoice],To=xt.z.array(xt.z.union(Mo.map(e=>xt.z.literal(e)))),gt=class{constructor(){i(this,"channel_types")}addChannelTypes(...t){return this.channel_types===void 0&&Reflect.set(this,"channel_types",[]),To.parse(t),this.channel_types.push(...t),this}};o(gt,"ApplicationCommandOptionChannelTypesMixin");var V=class extends p{constructor(){super(...arguments);i(this,"type",ve.ApplicationCommandOptionType.Channel)}toJSON(){return this.runRequiredValidations(),{...this}}};o(V,"SlashCommandChannelOption"),V=u([(0,Ee.mix)(gt)],V);var Le=require("discord-api-types/v9"),$e=require("ts-mixer"),_e=require("zod");var J=class{constructor(){i(this,"max_value");i(this,"min_value")}};o(J,"ApplicationCommandNumericOptionMinMaxValueMixin");var Ne=require("discord-api-types/v9"),U=require("zod");var oe=U.z.string().min(1).max(100),Be=U.z.number().gt(-1/0).lt(1/0),Ve=U.z.object({name:oe,value:U.z.union([oe,Be])}).array(),wo=U.z.boolean(),S=class{constructor(){i(this,"choices");i(this,"autocomplete");i(this,"type")}addChoices(...t){if(t.length>0&&this.autocomplete)throw new RangeError("Autocomplete and choices are mutually exclusive to each other.");Ve.parse(t),this.choices===void 0&&Reflect.set(this,"choices",[]),te(t.length,this.choices);for(let{name:n,value:r}of t)this.type===Ne.ApplicationCommandOptionType.String?oe.parse(r):Be.parse(r),this.choices.push({name:n,value:r});return this}setChoices(...t){if(t.length>0&&this.autocomplete)throw new RangeError("Autocomplete and choices are mutually exclusive to each other.");return Ve.parse(t),Reflect.set(this,"choices",[]),this.addChoices(...t),this}setAutocomplete(t){if(wo.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(S,"ApplicationCommandOptionWithChoicesAndAutocompleteMixin");var De=_e.z.number().int(),L=class extends p{constructor(){super(...arguments);i(this,"type",Le.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(L,"SlashCommandIntegerOption"),L=u([(0,$e.mix)(J,S)],L);var qe=require("discord-api-types/v9");var tt=class extends p{constructor(){super(...arguments);i(this,"type",qe.ApplicationCommandOptionType.Mentionable)}toJSON(){return this.runRequiredValidations(),{...this}}};o(tt,"SlashCommandMentionableOption");var Je=require("discord-api-types/v9"),Ue=require("ts-mixer"),ke=require("zod");var je=ke.z.number(),$=class extends p{constructor(){super(...arguments);i(this,"type",Je.ApplicationCommandOptionType.Number)}setMaxValue(t){return je.parse(t),Reflect.set(this,"max_value",t),this}setMinValue(t){return je.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($,"SlashCommandNumberOption"),$=u([(0,Ue.mix)(J,S)],$);var Fe=require("discord-api-types/v9");var et=class extends p{constructor(){super(...arguments);i(this,"type",Fe.ApplicationCommandOptionType.Role)}toJSON(){return this.runRequiredValidations(),{...this}}};o(et,"SlashCommandRoleOption");var Ge=require("discord-api-types/v9");var ot=class extends p{constructor(){super(...arguments);i(this,"type",Ge.ApplicationCommandOptionType.Attachment)}toJSON(){return this.runRequiredValidations(),{...this}}};o(ot,"SlashCommandAttachmentOption");var ze=require("discord-api-types/v9"),We=require("ts-mixer");var _=class extends p{constructor(){super(...arguments);i(this,"type",ze.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(_,"SlashCommandStringOption"),_=u([(0,We.mix)(S)],_);var Ze=require("discord-api-types/v9");var nt=class extends p{constructor(){super(...arguments);i(this,"type",Ze.ApplicationCommandOptionType.User)}toJSON(){return this.runRequiredValidations(),{...this}}};o(nt,"SlashCommandUserOption");var k=class{constructor(){i(this,"options")}addBooleanOption(t){return this._sharedAddOptionMethod(t,Y)}addUserOption(t){return this._sharedAddOptionMethod(t,nt)}addChannelOption(t){return this._sharedAddOptionMethod(t,V)}addRoleOption(t){return this._sharedAddOptionMethod(t,et)}addAttachmentOption(t){return this._sharedAddOptionMethod(t,ot)}addMentionableOption(t){return this._sharedAddOptionMethod(t,tt)}addStringOption(t){return this._sharedAddOptionMethod(t,_)}addIntegerOption(t){return this._sharedAddOptionMethod(t,L)}addNumberOption(t){return this._sharedAddOptionMethod(t,$)}_sharedAddOptionMethod(t,n){let{options:r}=this;A(r);let s=typeof t=="function"?t(new n):t;return I(s,n),r.push(s),this}};o(k,"SharedSlashCommandOptions");var ne=require("discord-api-types/v9"),ie=require("ts-mixer");var R=class{constructor(){i(this,"name");i(this,"description");i(this,"options",[])}addSubcommand(t){let{options:n}=this;A(n);let r=typeof t=="function"?t(new f):t;return I(r,f),n.push(r),this}toJSON(){return P(this.name,this.description,this.options),{type:ne.ApplicationCommandOptionType.SubcommandGroup,name:this.name,description:this.description,options:this.options.map(t=>t.toJSON())}}};o(R,"SlashCommandSubcommandGroupBuilder"),R=u([(0,ie.mix)(x)],R);var f=class{constructor(){i(this,"name");i(this,"description");i(this,"options",[])}toJSON(){return P(this.name,this.description,this.options),{type:ne.ApplicationCommandOptionType.Subcommand,name:this.name,description:this.description,options:this.options.map(t=>t.toJSON())}}};o(f,"SlashCommandSubcommandBuilder"),f=u([(0,ie.mix)(x,k)],f);var it=class{constructor(){i(this,"name");i(this,"description");i(this,"options",[]);i(this,"defaultPermission")}toJSON(){return P(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 Yt(t),Reflect.set(this,"defaultPermission",t),this}addSubcommandGroup(t){let{options:n}=this;A(n);let r=typeof t=="function"?t(new R):t;return I(r,R),n.push(r),this}addSubcommand(t){let{options:n}=this;A(n);let r=typeof t=="function"?t(new f):t;return I(r,f),n.push(r),this}};o(it,"SlashCommandBuilder"),it=u([(0,Ke.mix)(k,x)],it);var pe={};w(pe,{validateDefaultPermission:()=>ae,validateName:()=>yt,validateRequiredParameters:()=>se,validateType:()=>Ot});var j=require("zod"),re=require("discord-api-types/v9"),vo=j.z.string().min(1).max(32).regex(/^( *[\p{L}\p{N}_-]+ *)+$/u),Eo=j.z.union([j.z.literal(re.ApplicationCommandType.User),j.z.literal(re.ApplicationCommandType.Message)]),No=j.z.boolean();function ae(e){No.parse(e)}o(ae,"validateDefaultPermission");function yt(e){vo.parse(e)}o(yt,"validateName");function Ot(e){Eo.parse(e)}o(Ot,"validateType");function se(e,t){yt(e),Ot(t)}o(se,"validateRequiredParameters");var me=class{constructor(){i(this,"name");i(this,"type");i(this,"defaultPermission")}setName(t){return yt(t),Reflect.set(this,"name",t),this}setType(t){return Ot(t),Reflect.set(this,"type",t),this}setDefaultPermission(t){return ae(t),Reflect.set(this,"defaultPermission",t),this}toJSON(){return se(this.name,this.type),{name:this.name,type:this.type,default_permission:this.defaultPermission}}};o(me,"ContextMenuCommandBuilder");function Bo(e){return e!==null&&typeof e=="object"&&"toJSON"in e}o(Bo,"isJSONEncodable");module.exports=no(Vo);0&&(module.exports={ActionRow,ButtonComponent,Component,ComponentAssertions,ContextMenuCommandAssertions,ContextMenuCommandBuilder,Embed,EmbedAssertions,Faces,Modal,ModalAssertions,SelectMenuComponent,SelectMenuOption,SlashCommandAssertions,SlashCommandAttachmentOption,SlashCommandBooleanOption,SlashCommandBuilder,SlashCommandChannelOption,SlashCommandIntegerOption,SlashCommandMentionableOption,SlashCommandNumberOption,SlashCommandRoleOption,SlashCommandStringOption,SlashCommandSubcommandBuilder,SlashCommandSubcommandGroupBuilder,SlashCommandUserOption,TextInputAssertions,TextInputComponent,TimestampStyles,UnsafeButtonComponent,UnsafeEmbed,UnsafeModal,UnsafeSelectMenuComponent,UnsafeSelectMenuOption,UnsafeTextInputComponent,blockQuote,bold,channelMention,codeBlock,createComponent,formatEmoji,hideLinkEmbed,hyperlink,inlineCode,isJSONEncodable,italic,memberNicknameMention,quote,roleMention,spoiler,strikethrough,time,underscore,userMention});
3
+ ${t}\`\`\``}o(Xe,"codeBlock");function Ye(e){return`\`${e}\``}o(Ye,"inlineCode");function to(e){return`_${e}_`}o(to,"italic");function eo(e){return`**${e}**`}o(eo,"bold");function oo(e){return`__${e}__`}o(oo,"underscore");function no(e){return`~~${e}~~`}o(no,"strikethrough");function io(e){return`> ${e}`}o(io,"quote");function ro(e){return`>>> ${e}`}o(ro,"blockQuote");function ao(e){return`<${e}>`}o(ao,"hideLinkEmbed");function so(e,t,n){return n?`[${e}](${t} "${n}")`:`[${e}](${t})`}o(so,"hyperlink");function po(e){return`||${e}||`}o(po,"spoiler");function mo(e){return`<@${e}>`}o(mo,"userMention");function lo(e){return`<@!${e}>`}o(lo,"memberNicknameMention");function uo(e){return`<#${e}>`}o(uo,"channelMention");function co(e){return`<@&${e}>`}o(co,"roleMention");function ho(e,t=!1){return`<${t?"a":""}:_:${e}>`}o(ho,"formatEmoji");function Co(e,t){return typeof e!="number"&&(e=Math.floor((e?.getTime()??Date.now())/1e3)),typeof t=="string"?`<t:${e}:${t}>`:`<t:${e}>`}o(Co,"time");var bo={ShortTime:"t",LongTime:"T",ShortDate:"d",LongDate:"D",ShortDateTime:"f",LongDateTime:"F",RelativeTime:"R"},he=(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))(he||{});var Lt={};T(Lt,{buttonLabelValidator:()=>Rt,buttonStyleValidator:()=>Bt,customIdValidator:()=>c,defaultValidator:()=>Nt,disabledValidator:()=>q,emojiValidator:()=>U,labelValueValidator:()=>j,minMaxValidator:()=>mt,optionsValidator:()=>Ce,placeholderValidator:()=>wt,urlValidator:()=>Vt,validateRequiredButtonParameters:()=>$t,validateRequiredSelectMenuOptionParameters:()=>Et,validateRequiredSelectMenuParameters:()=>vt});var pt=require("discord-api-types/v9"),l=require("zod"),c=l.z.string().min(1).max(100),U=l.z.object({id:l.z.string(),name:l.z.string(),animated:l.z.boolean()}).partial().strict(),q=l.z.boolean(),Rt=l.z.string().nonempty().max(80),Bt=l.z.number().int().min(pt.ButtonStyle.Primary).max(pt.ButtonStyle.Link),wt=l.z.string().max(150),mt=l.z.number().int().min(0).max(25),Ce=l.z.object({}).array().nonempty();function vt(e,t){c.parse(t),Ce.parse(e)}o(vt,"validateRequiredSelectMenuParameters");var j=l.z.string().min(1).max(100),Nt=l.z.boolean();function Et(e,t){j.parse(e),j.parse(t)}o(Et,"validateRequiredSelectMenuOptionParameters");var Vt=l.z.string().url();function $t(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===pt.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($t,"validateRequiredButtonParameters");var be=require("discord-api-types/v9");var u=class{constructor(t){i(this,"data");this.data=t}};o(u,"ComponentBuilder");var F=require("discord-api-types/v9");function G(e){if(e instanceof u)return e;switch(e.type){case F.ComponentType.ActionRow:return new C(e);case F.ComponentType.Button:return new W(e);case F.ComponentType.SelectMenu:return new Z(e);case F.ComponentType.TextInput:return new z(e);default:throw new Error(`Cannot properly serialize component type: ${e.type}`)}}o(G,"createComponentBuilder");var C=class extends u{constructor({components:t,...n}={}){super({type:be.ComponentType.ActionRow,...n});i(this,"components");this.components=t?.map(r=>G(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(C,"ActionRowBuilder");var fe=require("discord-api-types/v9");var K=class extends u{constructor(t){super({type:fe.ComponentType.Button,...t})}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=!0){return this.data.disabled=t,this}setLabel(t){return this.data.label=t,this}toJSON(){return{...this.data}}};o(K,"UnsafeButtonBuilder");var W=class extends K{setStyle(t){return super.setStyle(Bt.parse(t))}setURL(t){return super.setURL(Vt.parse(t))}setCustomId(t){return super.setCustomId(c.parse(t))}setEmoji(t){return super.setEmoji(U.parse(t))}setDisabled(t=!0){return super.setDisabled(q.parse(t))}setLabel(t){return super.setLabel(Rt.parse(t))}toJSON(){return $t(this.data.style,this.data.label,this.data.emoji,this.data.custom_id,this.data.url),super.toJSON()}};o(W,"ButtonBuilder");var jt={};T(jt,{labelValidator:()=>ye,maxLengthValidator:()=>_t,minLengthValidator:()=>Dt,placeholderValidator:()=>Ut,requiredValidator:()=>Jt,textInputStyleValidator:()=>xe,validateRequiredParameters:()=>qt,valueValidator:()=>kt});var Ae=require("discord-api-types/v9"),g=require("zod");var xe=g.z.nativeEnum(Ae.TextInputStyle),Dt=g.z.number().int().min(0).max(4e3),_t=g.z.number().int().min(1).max(4e3),Jt=g.z.boolean(),kt=g.z.string().max(4e3),Ut=g.z.string().max(100),ye=g.z.string().min(1).max(45);function qt(e,t,n){c.parse(e),xe.parse(t),ye.parse(n)}o(qt,"validateRequiredParameters");var ge=require("discord-api-types/v9");var Ft=me(require("fast-deep-equal")),R=class extends u{constructor(t){super({type:ge.ComponentType.TextInput,...t})}setCustomId(t){return this.data.custom_id=t,this}setLabel(t){return this.data.label=t,this}setStyle(t){return this.data.style=t,this}setMinLength(t){return this.data.min_length=t,this}setMaxLength(t){return this.data.max_length=t,this}setPlaceholder(t){return this.data.placeholder=t,this}setValue(t){return this.data.value=t,this}setRequired(t=!0){return this.data.required=t,this}toJSON(){return{...this.data}}equals(t){return t instanceof R?(0,Ft.default)(t.data,this.data):(0,Ft.default)(t,this.data)}};o(R,"UnsafeTextInputBuilder");var z=class extends R{setMinLength(t){return super.setMinLength(Dt.parse(t))}setMaxLength(t){return super.setMaxLength(_t.parse(t))}setRequired(t=!0){return super.setRequired(Jt.parse(t))}setValue(t){return super.setValue(kt.parse(t))}setPlaceholder(t){return super.setPlaceholder(Ut.parse(t))}toJSON(){return qt(this.data.custom_id,this.data.style,this.data.label),super.toJSON()}};o(z,"TextInputBuilder");var Q=class{constructor({components:t,...n}={}){i(this,"data");i(this,"components",[]);this.data={...n},this.components=t?.map(r=>G(r))??[]}setTitle(t){return this.data.title=t,this}setCustomId(t){return this.data.custom_id=t,this}addComponents(...t){return this.components.push(...t.map(n=>n instanceof C?n:new C(n))),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(Q,"UnsafeModalBuilder");var Wt={};T(Wt,{componentsValidator:()=>Oe,titleValidator:()=>dt,validateRequiredParameters:()=>Gt});var lt=require("zod");var dt=lt.z.string().min(1).max(45),Oe=lt.z.array(lt.z.instanceof(C)).min(1);function Gt(e,t,n){c.parse(e),dt.parse(t),Oe.parse(n)}o(Gt,"validateRequiredParameters");var zt=class extends Q{setCustomId(t){return super.setCustomId(c.parse(t))}setTitle(t){return super.setTitle(dt.parse(t))}toJSON(){return Gt(this.data.custom_id,this.data.title,this.components),super.toJSON()}};o(zt,"ModalBuilder");var Se=require("discord-api-types/v9");var h=class{constructor(t={}){this.data=t}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=!0){return this.data.default=t,this}setEmoji(t){return this.data.emoji=t,this}toJSON(){return{...this.data}}};o(h,"UnsafeSelectMenuOptionBuilder");var H=class extends u{constructor(t){let{options:n,...r}=t??{};super({type:Se.ComponentType.SelectMenu,...r});i(this,"options");this.options=n?.map(s=>new h(s))??[]}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=!0){return this.data.disabled=t,this}addOptions(...t){return this.options.push(...t.map(n=>n instanceof h?n:new h(n))),this}setOptions(...t){return this.options.splice(0,this.options.length,...t.map(n=>n instanceof h?n:new h(n))),this}toJSON(){return{...this.data,options:this.options.map(t=>t.toJSON())}}};o(H,"UnsafeSelectMenuBuilder");var Z=class extends H{setPlaceholder(t){return super.setPlaceholder(wt.parse(t))}setMinValues(t){return super.setMinValues(mt.parse(t))}setMaxValues(t){return super.setMaxValues(mt.parse(t))}setCustomId(t){return super.setCustomId(c.parse(t))}setDisabled(t=!0){return super.setDisabled(q.parse(t))}toJSON(){return vt(this.options,this.data.custom_id),super.toJSON()}};o(Z,"SelectMenuBuilder");var Zt=class extends h{setDescription(t){return super.setDescription(j.parse(t))}setDefault(t=!0){return super.setDefault(Nt.parse(t))}setEmoji(t){return super.setEmoji(U.parse(t))}toJSON(){return Et(this.data.label,this.data.value),super.toJSON()}};o(Zt,"SelectMenuOptionBuilder");var Ht={};T(Ht,{assertReturnOfBuilder:()=>S,validateChoicesLength:()=>Qt,validateDefaultPermission:()=>Kt,validateDescription:()=>ht,validateMaxOptionsLength:()=>A,validateName:()=>ct,validateRequired:()=>Ct,validateRequiredParameters:()=>O});var ut=me(require("@sindresorhus/is")),V=require("zod"),fo=V.z.string().min(1).max(32).regex(/^[\P{Lu}\p{N}_-]+$/u);function ct(e){fo.parse(e)}o(ct,"validateName");var Ao=V.z.string().min(1).max(100);function ht(e){Ao.parse(e)}o(ht,"validateDescription");var xo=V.z.unknown().array().max(25);function A(e){xo.parse(e)}o(A,"validateMaxOptionsLength");function O(e,t,n){ct(e),ht(t),A(n)}o(O,"validateRequiredParameters");var Pe=V.z.boolean();function Kt(e){Pe.parse(e)}o(Kt,"validateDefaultPermission");function Ct(e){Pe.parse(e)}o(Ct,"validateRequired");var yo=V.z.number().lte(25);function Qt(e,t){yo.parse((t?.length??0)+e)}o(Qt,"validateChoicesLength");function S(e,t){let n=t.name;if(ut.default.nullOrUndefined(e))throw new TypeError(`Expected to receive a ${n} builder, got ${e===null?"null":"undefined"} instead.`);if(ut.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=ut.default.function_(e)?e.name:r.constructor.name,E=Reflect.get(r,Symbol.toStringTag),J=E?`${s} [${E}]`:s;throw new TypeError(`Expected to receive a ${n} builder, got ${J} instead.`)}}o(S,"assertReturnOfBuilder");var Ge=require("ts-mixer");var Ie=require("discord-api-types/v9");var x=class{constructor(){i(this,"name");i(this,"description")}setName(t){return ct(t),Reflect.set(this,"name",t),this}setDescription(t){return ht(t),Reflect.set(this,"description",t),this}};o(x,"SharedNameAndDescription");var p=class extends x{constructor(){super(...arguments);i(this,"required",!1)}setRequired(t){return Ct(t),Reflect.set(this,"required",t),this}runRequiredValidations(){O(this.name,this.description,[]),Ct(this.required)}};o(p,"ApplicationCommandOptionBase");var X=class extends p{constructor(){super(...arguments);i(this,"type",Ie.ApplicationCommandOptionType.Boolean)}toJSON(){return this.runRequiredValidations(),{...this}}};o(X,"SlashCommandBooleanOption");var Me=require("discord-api-types/v9"),Te=require("ts-mixer");var b=require("discord-api-types/v9"),bt=require("zod"),go=[b.ChannelType.GuildText,b.ChannelType.GuildVoice,b.ChannelType.GuildCategory,b.ChannelType.GuildNews,b.ChannelType.GuildStore,b.ChannelType.GuildNewsThread,b.ChannelType.GuildPublicThread,b.ChannelType.GuildPrivateThread,b.ChannelType.GuildStageVoice],Oo=bt.z.array(bt.z.union(go.map(e=>bt.z.literal(e)))),ft=class{constructor(){i(this,"channel_types")}addChannelTypes(...t){return this.channel_types===void 0&&Reflect.set(this,"channel_types",[]),Oo.parse(t),this.channel_types.push(...t),this}};o(ft,"ApplicationCommandOptionChannelTypesMixin");var B=class extends p{constructor(){super(...arguments);i(this,"type",Me.ApplicationCommandOptionType.Channel)}toJSON(){return this.runRequiredValidations(),{...this}}};o(B,"SlashCommandChannelOption"),B=d([(0,Te.mix)(ft)],B);var ve=require("discord-api-types/v9"),Ne=require("ts-mixer"),Ee=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 Xt=L.z.string().min(1).max(100),Be=L.z.number().gt(-1/0).lt(1/0),we=L.z.object({name:Xt,value:L.z.union([Xt,Be])}).array(),So=L.z.boolean(),P=class{constructor(){i(this,"choices");i(this,"autocomplete");i(this,"type")}addChoices(...t){if(t.length>0&&this.autocomplete)throw new RangeError("Autocomplete and choices are mutually exclusive to each other.");we.parse(t),this.choices===void 0&&Reflect.set(this,"choices",[]),Qt(t.length,this.choices);for(let{name:n,value:r}of t)this.type===Re.ApplicationCommandOptionType.String?Xt.parse(r):Be.parse(r),this.choices.push({name:n,value:r});return this}setChoices(...t){if(t.length>0&&this.autocomplete)throw new RangeError("Autocomplete and choices are mutually exclusive to each other.");return we.parse(t),Reflect.set(this,"choices",[]),this.addChoices(...t),this}setAutocomplete(t){if(So.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(P,"ApplicationCommandOptionWithChoicesAndAutocompleteMixin");var Ve=Ee.z.number().int(),w=class extends p{constructor(){super(...arguments);i(this,"type",ve.ApplicationCommandOptionType.Integer)}setMaxValue(t){return Ve.parse(t),Reflect.set(this,"max_value",t),this}setMinValue(t){return Ve.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(w,"SlashCommandIntegerOption"),w=d([(0,Ne.mix)($,P)],w);var $e=require("discord-api-types/v9");var Y=class extends p{constructor(){super(...arguments);i(this,"type",$e.ApplicationCommandOptionType.Mentionable)}toJSON(){return this.runRequiredValidations(),{...this}}};o(Y,"SlashCommandMentionableOption");var Le=require("discord-api-types/v9"),De=require("ts-mixer"),_e=require("zod");var Je=_e.z.number(),v=class extends p{constructor(){super(...arguments);i(this,"type",Le.ApplicationCommandOptionType.Number)}setMaxValue(t){return Je.parse(t),Reflect.set(this,"max_value",t),this}setMinValue(t){return Je.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(v,"SlashCommandNumberOption"),v=d([(0,De.mix)($,P)],v);var ke=require("discord-api-types/v9");var tt=class extends p{constructor(){super(...arguments);i(this,"type",ke.ApplicationCommandOptionType.Role)}toJSON(){return this.runRequiredValidations(),{...this}}};o(tt,"SlashCommandRoleOption");var Ue=require("discord-api-types/v9");var et=class extends p{constructor(){super(...arguments);i(this,"type",Ue.ApplicationCommandOptionType.Attachment)}toJSON(){return this.runRequiredValidations(),{...this}}};o(et,"SlashCommandAttachmentOption");var qe=require("discord-api-types/v9"),je=require("ts-mixer");var N=class extends p{constructor(){super(...arguments);i(this,"type",qe.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(N,"SlashCommandStringOption"),N=d([(0,je.mix)(P)],N);var Fe=require("discord-api-types/v9");var ot=class extends p{constructor(){super(...arguments);i(this,"type",Fe.ApplicationCommandOptionType.User)}toJSON(){return this.runRequiredValidations(),{...this}}};o(ot,"SlashCommandUserOption");var D=class{constructor(){i(this,"options")}addBooleanOption(t){return this._sharedAddOptionMethod(t,X)}addUserOption(t){return this._sharedAddOptionMethod(t,ot)}addChannelOption(t){return this._sharedAddOptionMethod(t,B)}addRoleOption(t){return this._sharedAddOptionMethod(t,tt)}addAttachmentOption(t){return this._sharedAddOptionMethod(t,et)}addMentionableOption(t){return this._sharedAddOptionMethod(t,Y)}addStringOption(t){return this._sharedAddOptionMethod(t,N)}addIntegerOption(t){return this._sharedAddOptionMethod(t,w)}addNumberOption(t){return this._sharedAddOptionMethod(t,v)}_sharedAddOptionMethod(t,n){let{options:r}=this;A(r);let s=typeof t=="function"?t(new n):t;return S(s,n),r.push(s),this}};o(D,"SharedSlashCommandOptions");var Yt=require("discord-api-types/v9"),te=require("ts-mixer");var I=class{constructor(){i(this,"name");i(this,"description");i(this,"options",[])}addSubcommand(t){let{options:n}=this;A(n);let r=typeof t=="function"?t(new f):t;return S(r,f),n.push(r),this}toJSON(){return O(this.name,this.description,this.options),{type:Yt.ApplicationCommandOptionType.SubcommandGroup,name:this.name,description:this.description,options:this.options.map(t=>t.toJSON())}}};o(I,"SlashCommandSubcommandGroupBuilder"),I=d([(0,te.mix)(x)],I);var f=class{constructor(){i(this,"name");i(this,"description");i(this,"options",[])}toJSON(){return O(this.name,this.description,this.options),{type:Yt.ApplicationCommandOptionType.Subcommand,name:this.name,description:this.description,options:this.options.map(t=>t.toJSON())}}};o(f,"SlashCommandSubcommandBuilder"),f=d([(0,te.mix)(x,D)],f);var nt=class{constructor(){i(this,"name");i(this,"description");i(this,"options",[]);i(this,"defaultPermission")}toJSON(){return O(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 Kt(t),Reflect.set(this,"defaultPermission",t),this}addSubcommandGroup(t){let{options:n}=this;A(n);let r=typeof t=="function"?t(new I):t;return S(r,I),n.push(r),this}addSubcommand(t){let{options:n}=this;A(n);let r=typeof t=="function"?t(new f):t;return S(r,f),n.push(r),this}};o(nt,"SlashCommandBuilder"),nt=d([(0,Ge.mix)(D,x)],nt);var ie={};T(ie,{validateDefaultPermission:()=>oe,validateName:()=>At,validateRequiredParameters:()=>ne,validateType:()=>xt});var _=require("zod"),ee=require("discord-api-types/v9"),Po=_.z.string().min(1).max(32).regex(/^( *[\p{L}\p{N}_-]+ *)+$/u),Io=_.z.union([_.z.literal(ee.ApplicationCommandType.User),_.z.literal(ee.ApplicationCommandType.Message)]),Mo=_.z.boolean();function oe(e){Mo.parse(e)}o(oe,"validateDefaultPermission");function At(e){Po.parse(e)}o(At,"validateName");function xt(e){Io.parse(e)}o(xt,"validateType");function ne(e,t){At(e),xt(t)}o(ne,"validateRequiredParameters");var re=class{constructor(){i(this,"name");i(this,"type");i(this,"defaultPermission")}setName(t){return At(t),Reflect.set(this,"name",t),this}setType(t){return xt(t),Reflect.set(this,"type",t),this}setDefaultPermission(t){return oe(t),Reflect.set(this,"defaultPermission",t),this}toJSON(){return ne(this.name,this.type),{name:this.name,type:this.type,default_permission:this.defaultPermission}}};o(re,"ContextMenuCommandBuilder");function To(e){return e!==null&&typeof e=="object"&&"toJSON"in e}o(To,"isJSONEncodable");function Ro(e){return e!==null&&typeof e=="object"&&"equals"in e}o(Ro,"isEquatable");function Bo(e){return(e.title?.length??0)+(e.description?.length??0)+(e.fields?.reduce((t,n)=>t+n.name.length+n.value.length,0)??0)+(e.footer?.text.length??0)+(e.author?.name.length??0)}o(Bo,"embedLength");module.exports=He(wo);0&&(module.exports={ActionRowBuilder,ButtonBuilder,ComponentAssertions,ComponentBuilder,ContextMenuCommandAssertions,ContextMenuCommandBuilder,EmbedAssertions,EmbedBuilder,Faces,ModalAssertions,ModalBuilder,SelectMenuBuilder,SelectMenuOptionBuilder,SlashCommandAssertions,SlashCommandAttachmentOption,SlashCommandBooleanOption,SlashCommandBuilder,SlashCommandChannelOption,SlashCommandIntegerOption,SlashCommandMentionableOption,SlashCommandNumberOption,SlashCommandRoleOption,SlashCommandStringOption,SlashCommandSubcommandBuilder,SlashCommandSubcommandGroupBuilder,SlashCommandUserOption,TextInputAssertions,TextInputBuilder,TimestampStyles,UnsafeButtonBuilder,UnsafeEmbedBuilder,UnsafeModalBuilder,UnsafeSelectMenuBuilder,UnsafeSelectMenuOptionBuilder,UnsafeTextInputBuilder,blockQuote,bold,channelMention,codeBlock,createComponentBuilder,embedLength,formatEmoji,hideLinkEmbed,hyperlink,inlineCode,isEquatable,isJSONEncodable,italic,memberNicknameMention,quote,roleMention,spoiler,strikethrough,time,underscore,userMention});
4
4
  //# sourceMappingURL=index.js.map