@discordjs/builders 0.12.0 → 0.13.0-dev.1644408664.fe11ff5
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 +107 -36
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +2 -2
- package/dist/index.mjs.map +1 -1
- package/package.json +87 -87
- package/docs/README.md +0 -1
- package/docs/index.yml +0 -5
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { APIEmbedField, APIEmbed, APIEmbedThumbnail, APIEmbedImage, APIEmbedVideo, APIEmbedAuthor, APIEmbedProvider, APIEmbedFooter, APIMessageComponentEmoji, APISelectMenuOption, ButtonStyle,
|
|
1
|
+
import { APIEmbedField, APIEmbed, APIEmbedThumbnail, APIEmbedImage, APIEmbedVideo, APIEmbedAuthor, APIEmbedProvider, APIEmbedFooter, APIMessageComponentEmoji, APISelectMenuOption, ButtonStyle, APIMessageComponent, ComponentType, APIActionRowComponent, APIButtonComponent, APISelectMenuComponent, ApplicationCommandOptionType, APIApplicationCommandBasicOption, APIApplicationCommandBooleanOption, ChannelType, APIApplicationCommandChannelOption, APIApplicationCommandOptionChoice, APIApplicationCommandIntegerOption, APIApplicationCommandMentionableOption, APIApplicationCommandNumberOption, APIApplicationCommandRoleOption, APIApplicationCommandStringOption, APIApplicationCommandUserOption, APIApplicationCommandSubcommandGroupOption, APIApplicationCommandSubcommandOption, RESTPostAPIApplicationCommandsJSONBody, APIApplicationCommandOption, ApplicationCommandType } from 'discord-api-types/v9';
|
|
2
2
|
import { z } from 'zod';
|
|
3
3
|
import { Snowflake } from 'discord-api-types/globals';
|
|
4
4
|
import { URL } from 'url';
|
|
@@ -75,6 +75,18 @@ declare namespace Assertions$3 {
|
|
|
75
75
|
};
|
|
76
76
|
}
|
|
77
77
|
|
|
78
|
+
interface JSONEncodable<T> {
|
|
79
|
+
/**
|
|
80
|
+
* Transforms this object to its JSON format
|
|
81
|
+
*/
|
|
82
|
+
toJSON: () => T;
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* Indicates if an object is encodable or not.
|
|
86
|
+
* @param maybeEncodable The object to check against
|
|
87
|
+
*/
|
|
88
|
+
declare function isJSONEncodable(maybeEncodable: unknown): maybeEncodable is JSONEncodable<unknown>;
|
|
89
|
+
|
|
78
90
|
interface AuthorOptions {
|
|
79
91
|
name: string;
|
|
80
92
|
url?: string;
|
|
@@ -84,58 +96,55 @@ interface FooterOptions {
|
|
|
84
96
|
text: string;
|
|
85
97
|
iconURL?: string;
|
|
86
98
|
}
|
|
87
|
-
|
|
88
|
-
* Represents an embed in a message (image/video preview, rich embed, etc.)
|
|
89
|
-
*/
|
|
90
|
-
declare class Embed implements APIEmbed {
|
|
99
|
+
declare class UnsafeEmbed implements APIEmbed, JSONEncodable<APIEmbed> {
|
|
91
100
|
/**
|
|
92
101
|
* An array of fields of this embed
|
|
93
102
|
*/
|
|
94
|
-
fields: APIEmbedField[];
|
|
103
|
+
readonly fields: APIEmbedField[];
|
|
95
104
|
/**
|
|
96
105
|
* The embed title
|
|
97
106
|
*/
|
|
98
|
-
title?: string;
|
|
107
|
+
readonly title?: string;
|
|
99
108
|
/**
|
|
100
109
|
* The embed description
|
|
101
110
|
*/
|
|
102
|
-
description?: string;
|
|
111
|
+
readonly description?: string;
|
|
103
112
|
/**
|
|
104
113
|
* The embed url
|
|
105
114
|
*/
|
|
106
|
-
url?: string;
|
|
115
|
+
readonly url?: string;
|
|
107
116
|
/**
|
|
108
117
|
* The embed color
|
|
109
118
|
*/
|
|
110
|
-
color?: number;
|
|
119
|
+
readonly color?: number;
|
|
111
120
|
/**
|
|
112
121
|
* The timestamp of the embed in the ISO format
|
|
113
122
|
*/
|
|
114
|
-
timestamp?: string;
|
|
123
|
+
readonly timestamp?: string;
|
|
115
124
|
/**
|
|
116
125
|
* The embed thumbnail data
|
|
117
126
|
*/
|
|
118
|
-
thumbnail?: APIEmbedThumbnail;
|
|
127
|
+
readonly thumbnail?: APIEmbedThumbnail;
|
|
119
128
|
/**
|
|
120
129
|
* The embed image data
|
|
121
130
|
*/
|
|
122
|
-
image?: APIEmbedImage;
|
|
131
|
+
readonly image?: APIEmbedImage;
|
|
123
132
|
/**
|
|
124
133
|
* Received video data
|
|
125
134
|
*/
|
|
126
|
-
video?: APIEmbedVideo;
|
|
135
|
+
readonly video?: APIEmbedVideo;
|
|
127
136
|
/**
|
|
128
137
|
* The embed author data
|
|
129
138
|
*/
|
|
130
|
-
author?: APIEmbedAuthor;
|
|
139
|
+
readonly author?: APIEmbedAuthor;
|
|
131
140
|
/**
|
|
132
141
|
* Received data about the embed provider
|
|
133
142
|
*/
|
|
134
|
-
provider?: APIEmbedProvider;
|
|
143
|
+
readonly provider?: APIEmbedProvider;
|
|
135
144
|
/**
|
|
136
145
|
* The embed footer data
|
|
137
146
|
*/
|
|
138
|
-
footer?: APIEmbedFooter;
|
|
147
|
+
readonly footer?: APIEmbedFooter;
|
|
139
148
|
constructor(data?: APIEmbed);
|
|
140
149
|
/**
|
|
141
150
|
* The accumulated length for the embed title, description, fields, footer text, and author name
|
|
@@ -161,6 +170,11 @@ declare class Embed implements APIEmbed {
|
|
|
161
170
|
* @param fields The replacing field objects
|
|
162
171
|
*/
|
|
163
172
|
spliceFields(index: number, deleteCount: number, ...fields: APIEmbedField[]): this;
|
|
173
|
+
/**
|
|
174
|
+
* Sets the embed's fields (max 25).
|
|
175
|
+
* @param fields The fields to set
|
|
176
|
+
*/
|
|
177
|
+
setFields(...fields: APIEmbedField[]): this;
|
|
164
178
|
/**
|
|
165
179
|
* Sets the author of this embed
|
|
166
180
|
*
|
|
@@ -227,6 +241,29 @@ declare class Embed implements APIEmbed {
|
|
|
227
241
|
static normalizeFields(...fields: APIEmbedField[]): APIEmbedField[];
|
|
228
242
|
}
|
|
229
243
|
|
|
244
|
+
/**
|
|
245
|
+
* Represents an embed in a message (image/video preview, rich embed, etc.)
|
|
246
|
+
*/
|
|
247
|
+
declare class Embed extends UnsafeEmbed {
|
|
248
|
+
addFields(...fields: APIEmbedField[]): this;
|
|
249
|
+
spliceFields(index: number, deleteCount: number, ...fields: APIEmbedField[]): this;
|
|
250
|
+
setAuthor(options: AuthorOptions | null): this;
|
|
251
|
+
setColor(color: number | null): this;
|
|
252
|
+
setDescription(description: string | null): this;
|
|
253
|
+
setFooter(options: FooterOptions | null): this;
|
|
254
|
+
setImage(url: string | null): this;
|
|
255
|
+
setThumbnail(url: string | null): this;
|
|
256
|
+
setTimestamp(timestamp?: number | Date | null): this;
|
|
257
|
+
setTitle(title: string | null): this;
|
|
258
|
+
setURL(url: string | null): this;
|
|
259
|
+
/**
|
|
260
|
+
* Normalizes field input and resolves strings
|
|
261
|
+
*
|
|
262
|
+
* @param fields Fields to normalize
|
|
263
|
+
*/
|
|
264
|
+
static normalizeFields(...fields: APIEmbedField[]): APIEmbedField[];
|
|
265
|
+
}
|
|
266
|
+
|
|
230
267
|
/**
|
|
231
268
|
* Wraps the content inside a codeblock with no language
|
|
232
269
|
*
|
|
@@ -449,9 +486,9 @@ declare enum Faces {
|
|
|
449
486
|
}
|
|
450
487
|
|
|
451
488
|
/**
|
|
452
|
-
* Represents
|
|
489
|
+
* Represents a non-validated option within a select menu component
|
|
453
490
|
*/
|
|
454
|
-
declare class
|
|
491
|
+
declare class UnsafeSelectMenuOption {
|
|
455
492
|
readonly label: string;
|
|
456
493
|
readonly value: string;
|
|
457
494
|
readonly description?: string;
|
|
@@ -486,6 +523,16 @@ declare class SelectMenuOption {
|
|
|
486
523
|
toJSON(): APISelectMenuOption;
|
|
487
524
|
}
|
|
488
525
|
|
|
526
|
+
/**
|
|
527
|
+
* Represents an option within a select menu component
|
|
528
|
+
*/
|
|
529
|
+
declare class SelectMenuOption extends UnsafeSelectMenuOption {
|
|
530
|
+
setDescription(description: string): this;
|
|
531
|
+
setDefault(isDefault: boolean): this;
|
|
532
|
+
setEmoji(emoji: APIMessageComponentEmoji): this;
|
|
533
|
+
toJSON(): APISelectMenuOption;
|
|
534
|
+
}
|
|
535
|
+
|
|
489
536
|
declare const customIdValidator: z.ZodString;
|
|
490
537
|
declare const emojiValidator: z.ZodObject<{
|
|
491
538
|
id: z.ZodOptional<z.ZodString>;
|
|
@@ -549,25 +596,24 @@ declare namespace Assertions$2 {
|
|
|
549
596
|
/**
|
|
550
597
|
* Represents a discord component
|
|
551
598
|
*/
|
|
552
|
-
interface Component {
|
|
599
|
+
interface Component extends JSONEncodable<APIMessageComponent> {
|
|
553
600
|
/**
|
|
554
601
|
* The type of this component
|
|
555
602
|
*/
|
|
556
603
|
readonly type: ComponentType;
|
|
557
|
-
/**
|
|
558
|
-
* Converts this component to an API-compatible JSON object
|
|
559
|
-
*/
|
|
560
|
-
toJSON: () => APIMessageComponent;
|
|
561
604
|
}
|
|
562
605
|
|
|
606
|
+
declare type MessageComponent = ActionRowComponent | ActionRow;
|
|
563
607
|
declare type ActionRowComponent = ButtonComponent | SelectMenuComponent;
|
|
564
608
|
/**
|
|
565
609
|
* Represents an action row component
|
|
566
610
|
*/
|
|
567
|
-
declare class ActionRow<T extends ActionRowComponent> implements Component {
|
|
611
|
+
declare class ActionRow<T extends ActionRowComponent = ActionRowComponent> implements Component {
|
|
568
612
|
readonly components: T[];
|
|
569
613
|
readonly type = ComponentType.ActionRow;
|
|
570
|
-
constructor(data?: APIActionRowComponent
|
|
614
|
+
constructor(data?: APIActionRowComponent & {
|
|
615
|
+
type?: ComponentType.ActionRow;
|
|
616
|
+
});
|
|
571
617
|
/**
|
|
572
618
|
* Adds components to this action row.
|
|
573
619
|
* @param components The components to add to this action row.
|
|
@@ -582,7 +628,7 @@ declare class ActionRow<T extends ActionRowComponent> implements Component {
|
|
|
582
628
|
toJSON(): APIActionRowComponent;
|
|
583
629
|
}
|
|
584
630
|
|
|
585
|
-
declare class
|
|
631
|
+
declare class UnsafeButtonComponent implements Component {
|
|
586
632
|
readonly type: ComponentType.Button;
|
|
587
633
|
readonly style: ButtonStyle;
|
|
588
634
|
readonly label?: string;
|
|
@@ -590,7 +636,9 @@ declare class ButtonComponent implements Component {
|
|
|
590
636
|
readonly disabled?: boolean;
|
|
591
637
|
readonly custom_id: string;
|
|
592
638
|
readonly url: string;
|
|
593
|
-
constructor(data?: APIButtonComponent
|
|
639
|
+
constructor(data?: APIButtonComponent & {
|
|
640
|
+
type?: ComponentType.Button;
|
|
641
|
+
});
|
|
594
642
|
/**
|
|
595
643
|
* Sets the style of this button
|
|
596
644
|
* @param style The style of the button
|
|
@@ -624,8 +672,18 @@ declare class ButtonComponent implements Component {
|
|
|
624
672
|
toJSON(): APIButtonComponent;
|
|
625
673
|
}
|
|
626
674
|
|
|
675
|
+
declare class ButtonComponent extends UnsafeButtonComponent {
|
|
676
|
+
setStyle(style: ButtonStyle): this;
|
|
677
|
+
setURL(url: string): this;
|
|
678
|
+
setCustomId(customId: string): this;
|
|
679
|
+
setEmoji(emoji: APIMessageComponentEmoji): this;
|
|
680
|
+
setDisabled(disabled: boolean): this;
|
|
681
|
+
setLabel(label: string): this;
|
|
682
|
+
toJSON(): APIButtonComponent;
|
|
683
|
+
}
|
|
684
|
+
|
|
627
685
|
interface MappedComponentTypes {
|
|
628
|
-
[ComponentType.ActionRow]: ActionRow
|
|
686
|
+
[ComponentType.ActionRow]: ActionRow;
|
|
629
687
|
[ComponentType.Button]: ButtonComponent;
|
|
630
688
|
[ComponentType.SelectMenu]: SelectMenuComponent;
|
|
631
689
|
}
|
|
@@ -636,11 +694,12 @@ interface MappedComponentTypes {
|
|
|
636
694
|
declare function createComponent<T extends keyof MappedComponentTypes>(data: APIMessageComponent & {
|
|
637
695
|
type: T;
|
|
638
696
|
}): MappedComponentTypes[T];
|
|
697
|
+
declare function createComponent<C extends MessageComponent>(data: C): C;
|
|
639
698
|
|
|
640
699
|
/**
|
|
641
|
-
* Represents a select menu component
|
|
700
|
+
* Represents a non-validated select menu component
|
|
642
701
|
*/
|
|
643
|
-
declare class
|
|
702
|
+
declare class UnsafeSelectMenuComponent implements Component {
|
|
644
703
|
readonly type: ComponentType.SelectMenu;
|
|
645
704
|
readonly options: SelectMenuOption[];
|
|
646
705
|
readonly placeholder?: string;
|
|
@@ -688,6 +747,18 @@ declare class SelectMenuComponent implements Component {
|
|
|
688
747
|
toJSON(): APISelectMenuComponent;
|
|
689
748
|
}
|
|
690
749
|
|
|
750
|
+
/**
|
|
751
|
+
* Represents a select menu component
|
|
752
|
+
*/
|
|
753
|
+
declare class SelectMenuComponent extends UnsafeSelectMenuComponent {
|
|
754
|
+
setPlaceholder(placeholder: string): this;
|
|
755
|
+
setMinValues(minValues: number): this;
|
|
756
|
+
setMaxValues(maxValues: number): this;
|
|
757
|
+
setCustomId(customId: string): this;
|
|
758
|
+
setDisabled(disabled: boolean): this;
|
|
759
|
+
toJSON(): APISelectMenuComponent;
|
|
760
|
+
}
|
|
761
|
+
|
|
691
762
|
declare class SharedNameAndDescription {
|
|
692
763
|
readonly name: string;
|
|
693
764
|
readonly description: string;
|
|
@@ -773,19 +844,19 @@ declare class ApplicationCommandOptionWithChoicesAndAutocompleteMixin<T extends
|
|
|
773
844
|
* @param name The name of the choice
|
|
774
845
|
* @param value The value of the choice
|
|
775
846
|
*/
|
|
776
|
-
addChoice(name: string, value: T):
|
|
847
|
+
addChoice(name: string, value: T): this;
|
|
777
848
|
/**
|
|
778
849
|
* Adds multiple choices for this option
|
|
779
850
|
*
|
|
780
851
|
* @param choices The choices to add
|
|
781
852
|
*/
|
|
782
|
-
addChoices(choices: [name: string, value: T][]):
|
|
783
|
-
setChoices
|
|
853
|
+
addChoices(choices: [name: string, value: T][]): this;
|
|
854
|
+
setChoices(choices: [name: string, value: T][]): this;
|
|
784
855
|
/**
|
|
785
856
|
* Marks the option as autocompletable
|
|
786
857
|
* @param autocomplete If this option should be autocompletable
|
|
787
858
|
*/
|
|
788
|
-
setAutocomplete
|
|
859
|
+
setAutocomplete(autocomplete: boolean): this;
|
|
789
860
|
}
|
|
790
861
|
|
|
791
862
|
declare class SlashCommandIntegerOption extends ApplicationCommandOptionBase implements ApplicationCommandNumericOptionMinMaxValueMixin {
|
|
@@ -1081,4 +1152,4 @@ declare namespace Assertions {
|
|
|
1081
1152
|
};
|
|
1082
1153
|
}
|
|
1083
1154
|
|
|
1084
|
-
export { ActionRow, ActionRowComponent, AuthorOptions, ButtonComponent, Component, Assertions$2 as ComponentAssertions, Assertions as ContextMenuCommandAssertions, ContextMenuCommandBuilder, ContextMenuCommandType, Embed, Assertions$3 as EmbedAssertions, Faces, FooterOptions, MappedComponentTypes, SelectMenuComponent, SelectMenuOption, Assertions$1 as SlashCommandAssertions, SlashCommandBooleanOption, SlashCommandBuilder, SlashCommandChannelOption, SlashCommandIntegerOption, SlashCommandMentionableOption, SlashCommandNumberOption, SlashCommandOptionsOnlyBuilder, SlashCommandRoleOption, SlashCommandStringOption, SlashCommandSubcommandBuilder, SlashCommandSubcommandGroupBuilder, SlashCommandSubcommandsOnlyBuilder, SlashCommandUserOption, TimestampStyles, TimestampStylesString, ToAPIApplicationCommandOptions, blockQuote, bold, channelMention, codeBlock, createComponent, formatEmoji, hideLinkEmbed, hyperlink, inlineCode, italic, memberNicknameMention, quote, roleMention, spoiler, strikethrough, time, underscore, userMention };
|
|
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 };
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var
|
|
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
2
|
${t}\`\`\``:`\`\`\`${t}
|
|
3
|
-
${e}\`\`\``}function gt(t){return`\`${t}\``}function Pt(t){return`_${t}_`}function Tt(t){return`**${t}**`}function It(t){return`__${t}__`}function Mt(t){return`~~${t}~~`}function Rt(t){return`> ${t}`}function vt(t){return`>>> ${t}`}function wt(t){return`<${t}>`}function Bt(t,e,i){return i?`[${t}](${e} "${i}")`:`[${t}](${e})`}function Nt(t){return`||${t}||`}function $t(t){return`<@${t}>`}function Et(t){return`<@!${t}>`}function _t(t){return`<#${t}>`}function Vt(t){return`<@&${t}>`}function Lt(t,e=!1){return`<${e?"a":""}:_:${t}>`}function kt(t,e){return typeof t!="number"&&(t=Math.floor((t?.getTime()??Date.now())/1e3)),typeof e=="string"?`<t:${t}:${e}>`:`<t:${t}>`}var Dt={ShortTime:"t",LongTime:"T",ShortDate:"d",LongDate:"D",ShortDateTime:"f",LongDateTime:"F",RelativeTime:"R"},je=(n=>(n.Shrug="\xAF\\_(\u30C4)\\_/\xAF",n.Tableflip="(\u256F\xB0\u25A1\xB0\uFF09\u256F\uFE35 \u253B\u2501\u253B",n.Unflip="\u252C\u2500\u252C \u30CE( \u309C-\u309C\u30CE)",n))(je||{});var Pe={};B(Pe,{buttonLabelValidator:()=>Ce,buttonStyleValidator:()=>fe,customIdValidator:()=>g,defaultValidator:()=>ye,disabledValidator:()=>E,emojiValidator:()=>$,labelValueValidator:()=>_,minMaxValidator:()=>F,optionsValidator:()=>qe,placeholderValidator:()=>xe,urlValidator:()=>Se,validateRequiredButtonParameters:()=>ge,validateRequiredSelectMenuOptionParameters:()=>Oe,validateRequiredSelectMenuParameters:()=>Ae});var q=require("discord-api-types/v9"),p=require("zod"),g=p.z.string().min(1).max(100),$=p.z.object({id:p.z.string(),name:p.z.string(),animated:p.z.boolean()}).partial().strict(),E=p.z.boolean(),Ce=p.z.string().nonempty().max(80),fe=p.z.number().int().min(q.ButtonStyle.Primary).max(q.ButtonStyle.Link),xe=p.z.string().max(100),F=p.z.number().int().min(0).max(25),qe=p.z.object({}).array().nonempty();function Ae(t,e){g.parse(e),qe.parse(t)}var _=p.z.string().min(1).max(100),ye=p.z.boolean();function Oe(t,e){_.parse(t),_.parse(e)}var Se=p.z.string().url();function ge(t,e,i,n,a){if(a&&n)throw new RangeError("URL and custom id are mutually exclusive");if(!e&&!i)throw new RangeError("Buttons must have a label and/or an emoji");if(t===q.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")}var Fe=require("discord-api-types/v9");var G=require("discord-api-types/v9");function Te(t){switch(t.type){case G.ComponentType.ActionRow:return new z(t);case G.ComponentType.Button:return new W(t);case G.ComponentType.SelectMenu:return new Z(t);default:throw new Error(`Cannot serialize component type: ${t.type}`)}}var z=class{constructor(e){o(this,"components",[]);o(this,"type",Fe.ComponentType.ActionRow);this.components=e?.components.map(Te)??[]}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())}}};var K=require("discord-api-types/v9");var W=class{constructor(e){o(this,"type",K.ComponentType.Button);o(this,"style");o(this,"label");o(this,"emoji");o(this,"disabled");o(this,"custom_id");o(this,"url");this.style=e?.style,this.label=e?.label,this.emoji=e?.emoji,this.disabled=e?.disabled,e?.style===K.ButtonStyle.Link?this.url=e.url:this.custom_id=e?.custom_id}setStyle(e){return fe.parse(e),Reflect.set(this,"style",e),this}setURL(e){return Se.parse(e),Reflect.set(this,"url",e),this}setCustomId(e){return g.parse(e),Reflect.set(this,"custom_id",e),this}setEmoji(e){return $.parse(e),Reflect.set(this,"emoji",e),this}setDisabled(e){return E.parse(e),Reflect.set(this,"disabled",e),this}setLabel(e){return Ce.parse(e),Reflect.set(this,"label",e),this}toJSON(){return ge(this.style,this.label,this.emoji,this.custom_id,this.url),{...this}}};var Ge=require("discord-api-types/v9");var Q=class{constructor(e){o(this,"label");o(this,"value");o(this,"description");o(this,"emoji");o(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 _.parse(e),Reflect.set(this,"description",e),this}setDefault(e){return ye.parse(e),Reflect.set(this,"default",e),this}setEmoji(e){return $.parse(e),Reflect.set(this,"emoji",e),this}toJSON(){return Oe(this.label,this.value),{...this}}};var Z=class{constructor(e){o(this,"type",Ge.ComponentType.SelectMenu);o(this,"options");o(this,"placeholder");o(this,"min_values");o(this,"max_values");o(this,"custom_id");o(this,"disabled");this.options=e?.options.map(i=>new Q(i))??[],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 xe.parse(e),Reflect.set(this,"placeholder",e),this}setMinValues(e){return F.parse(e),Reflect.set(this,"min_values",e),this}setMaxValues(e){return F.parse(e),Reflect.set(this,"max_values",e),this}setCustomId(e){return g.parse(e),Reflect.set(this,"custom_id",e),this}setDisabled(e){return E.parse(e),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 Ae(this.options,this.custom_id),{...this,options:this.options.map(e=>e.toJSON())}}};var Re={};B(Re,{assertReturnOfBuilder:()=>C,validateDefaultPermission:()=>Ie,validateDescription:()=>Y,validateMaxChoicesLength:()=>Me,validateMaxOptionsLength:()=>c,validateName:()=>X,validateRequired:()=>ee,validateRequiredParameters:()=>b});var H=yt(require("@sindresorhus/is")),V=require("zod"),Ut=V.z.string().min(1).max(32).regex(/^[\P{Lu}\p{N}_-]+$/u);function X(t){Ut.parse(t)}var Jt=V.z.string().min(1).max(100);function Y(t){Jt.parse(t)}var ze=V.z.unknown().array().max(25);function c(t){ze.parse(t)}function b(t,e,i){X(t),Y(e),c(i)}var We=V.z.boolean();function Ie(t){We.parse(t)}function ee(t){We.parse(t)}function Me(t){ze.parse(t)}function C(t,e){let i=e.name;if(H.default.nullOrUndefined(t))throw new TypeError(`Expected to receive a ${i} builder, got ${t===null?"null":"undefined"} instead.`);if(H.default.primitive(t))throw new TypeError(`Expected to receive a ${i} builder, got a primitive (${typeof t}) instead.`);if(!(t instanceof e)){let n=t,a=H.default.function_(t)?t.name:n.constructor.name,y=Reflect.get(n,Symbol.toStringTag),w=y?`${a} [${y}]`:a;throw new TypeError(`Expected to receive a ${i} builder, got ${w} instead.`)}}var ut=require("ts-mixer");var Ze=require("discord-api-types/v9");var f=class{constructor(){o(this,"name");o(this,"description")}setName(e){return X(e),Reflect.set(this,"name",e),this}setDescription(e){return Y(e),Reflect.set(this,"description",e),this}};var s=class extends f{constructor(){super(...arguments);o(this,"required",!1)}setRequired(e){return ee(e),Reflect.set(this,"required",e),this}runRequiredValidations(){b(this.name,this.description,[]),ee(this.required)}};var te=class extends s{constructor(){super(...arguments);o(this,"type",Ze.ApplicationCommandOptionType.Boolean)}toJSON(){return this.runRequiredValidations(),{...this}}};var Ke=require("discord-api-types/v9"),Qe=require("ts-mixer");var d=require("discord-api-types/v9"),ve=require("zod"),jt=[d.ChannelType.GuildText,d.ChannelType.GuildVoice,d.ChannelType.GuildCategory,d.ChannelType.GuildNews,d.ChannelType.GuildStore,d.ChannelType.GuildNewsThread,d.ChannelType.GuildPublicThread,d.ChannelType.GuildPrivateThread,d.ChannelType.GuildStageVoice],qt=ve.z.union(jt.map(t=>ve.z.literal(t))),we=class{constructor(){o(this,"channel_types")}addChannelType(e){return this.channel_types===void 0&&Reflect.set(this,"channel_types",[]),qt.parse(e),this.channel_types.push(e),this}addChannelTypes(e){return e.forEach(i=>this.addChannelType(i)),this}};var P=class extends s{constructor(){super(...arguments);o(this,"type",Ke.ApplicationCommandOptionType.Channel)}toJSON(){return this.runRequiredValidations(),{...this}}};P=m([(0,Qe.mix)(we)],P);var et=require("discord-api-types/v9"),tt=require("ts-mixer"),ot=require("zod");var L=class{constructor(){o(this,"max_value");o(this,"min_value")}};var He=require("discord-api-types/v9"),T=require("zod");var oe=T.z.string().min(1).max(100),Xe=T.z.number().gt(-1/0).lt(1/0),Ye=T.z.tuple([oe,T.z.union([oe,Xe])]).array(),Ft=T.z.boolean(),x=class{constructor(){o(this,"choices");o(this,"autocomplete");o(this,"type")}addChoice(e,i){if(this.autocomplete)throw new RangeError("Autocomplete and choices are mutually exclusive to each other.");return this.choices===void 0&&Reflect.set(this,"choices",[]),Me(this.choices),oe.parse(e),this.type===He.ApplicationCommandOptionType.String?oe.parse(i):Xe.parse(i),this.choices.push({name:e,value:i}),this}addChoices(e){if(this.autocomplete)throw new RangeError("Autocomplete and choices are mutually exclusive to each other.");Ye.parse(e);for(let[i,n]of e)this.addChoice(i,n);return this}setChoices(e){if(e.length>0&&this.autocomplete)throw new RangeError("Autocomplete and choices are mutually exclusive to each other.");Ye.parse(e),Reflect.set(this,"choices",[]);for(let[i,n]of e)this.addChoice(i,n);return this}setAutocomplete(e){if(Ft.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}};var it=ot.z.number().int().nonnegative(),I=class extends s{constructor(){super(...arguments);o(this,"type",et.ApplicationCommandOptionType.Integer)}setMaxValue(e){return it.parse(e),Reflect.set(this,"max_value",e),this}setMinValue(e){return it.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}}};I=m([(0,tt.mix)(L,x)],I);var nt=require("discord-api-types/v9");var ie=class extends s{constructor(){super(...arguments);o(this,"type",nt.ApplicationCommandOptionType.Mentionable)}toJSON(){return this.runRequiredValidations(),{...this}}};var rt=require("discord-api-types/v9"),at=require("ts-mixer"),st=require("zod");var pt=st.z.number().nonnegative(),M=class extends s{constructor(){super(...arguments);o(this,"type",rt.ApplicationCommandOptionType.Number)}setMaxValue(e){return pt.parse(e),Reflect.set(this,"max_value",e),this}setMinValue(e){return pt.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}}};M=m([(0,at.mix)(L,x)],M);var mt=require("discord-api-types/v9");var ne=class extends s{constructor(){super(...arguments);o(this,"type",mt.ApplicationCommandOptionType.Role)}toJSON(){return this.runRequiredValidations(),{...this}}};var lt=require("discord-api-types/v9"),dt=require("ts-mixer");var R=class extends s{constructor(){super(...arguments);o(this,"type",lt.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}}};R=m([(0,dt.mix)(x)],R);var ct=require("discord-api-types/v9");var re=class extends s{constructor(){super(...arguments);o(this,"type",ct.ApplicationCommandOptionType.User)}toJSON(){return this.runRequiredValidations(),{...this}}};var k=class{constructor(){o(this,"options")}addBooleanOption(e){return this._sharedAddOptionMethod(e,te)}addUserOption(e){return this._sharedAddOptionMethod(e,re)}addChannelOption(e){return this._sharedAddOptionMethod(e,P)}addRoleOption(e){return this._sharedAddOptionMethod(e,ne)}addMentionableOption(e){return this._sharedAddOptionMethod(e,ie)}addStringOption(e){return this._sharedAddOptionMethod(e,R)}addIntegerOption(e){return this._sharedAddOptionMethod(e,I)}addNumberOption(e){return this._sharedAddOptionMethod(e,M)}_sharedAddOptionMethod(e,i){let{options:n}=this;c(n);let a=typeof e=="function"?e(new i):e;return C(a,i),n.push(a),this}};var Be=require("discord-api-types/v9"),Ne=require("ts-mixer");var A=class{constructor(){o(this,"name");o(this,"description");o(this,"options",[])}addSubcommand(e){let{options:i}=this;c(i);let n=typeof e=="function"?e(new u):e;return C(n,u),i.push(n),this}toJSON(){return b(this.name,this.description,this.options),{type:Be.ApplicationCommandOptionType.SubcommandGroup,name:this.name,description:this.description,options:this.options.map(e=>e.toJSON())}}};A=m([(0,Ne.mix)(f)],A);var u=class{constructor(){o(this,"name");o(this,"description");o(this,"options",[])}toJSON(){return b(this.name,this.description,this.options),{type:Be.ApplicationCommandOptionType.Subcommand,name:this.name,description:this.description,options:this.options.map(e=>e.toJSON())}}};u=m([(0,Ne.mix)(f,k)],u);var ae=class{constructor(){o(this,"name");o(this,"description");o(this,"options",[]);o(this,"defaultPermission")}toJSON(){return b(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 Ie(e),Reflect.set(this,"defaultPermission",e),this}addSubcommandGroup(e){let{options:i}=this;c(i);let n=typeof e=="function"?e(new A):e;return C(n,A),i.push(n),this}addSubcommand(e){let{options:i}=this;c(i);let n=typeof e=="function"?e(new u):e;return C(n,u),i.push(n),this}};ae=m([(0,ut.mix)(k,f)],ae);var Ve={};B(Ve,{validateDefaultPermission:()=>Ee,validateName:()=>se,validateRequiredParameters:()=>_e,validateType:()=>pe});var v=require("zod"),$e=require("discord-api-types/v9"),Gt=v.z.string().min(1).max(32).regex(/^( *[\p{L}\p{N}_-]+ *)+$/u),zt=v.z.union([v.z.literal($e.ApplicationCommandType.User),v.z.literal($e.ApplicationCommandType.Message)]),Wt=v.z.boolean();function Ee(t){Wt.parse(t)}function se(t){Gt.parse(t)}function pe(t){zt.parse(t)}function _e(t,e){se(t),pe(e)}var ht=class{constructor(){o(this,"name");o(this,"type");o(this,"defaultPermission")}setName(e){return se(e),Reflect.set(this,"name",e),this}setType(e){return pe(e),Reflect.set(this,"type",e),this}setDefaultPermission(e){return Ee(e),Reflect.set(this,"defaultPermission",e),this}toJSON(){return _e(this.name,this.type),{name:this.name,type:this.type,default_permission:this.defaultPermission}}};module.exports=Ot(Zt);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,blockQuote,bold,channelMention,codeBlock,createComponent,formatEmoji,hideLinkEmbed,hyperlink,inlineCode,italic,memberNicknameMention,quote,roleMention,spoiler,strikethrough,time,underscore,userMention});
|
|
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});
|
|
4
4
|
//# sourceMappingURL=index.js.map
|