@discordjs/builders 0.13.0-dev.1644797188.0dfdb2c → 0.13.0-dev.1645142857.f7257f0
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 +30 -13
- 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 +2 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as discord_api_types_v9 from 'discord-api-types/v9';
|
|
2
|
-
import { APIEmbedField, APIEmbedAuthor, APIEmbedFooter, APIEmbedImage, APIEmbed, APIEmbedVideo, APISelectMenuOption, APIMessageComponentEmoji, ButtonStyle, APIBaseComponent, ComponentType, APIMessageComponent, APIActionRowComponent, APIButtonComponent, APISelectMenuComponent, ApplicationCommandOptionType, APIApplicationCommandBasicOption, APIApplicationCommandBooleanOption, ChannelType, APIApplicationCommandChannelOption, APIApplicationCommandOptionChoice, APIApplicationCommandIntegerOption, APIApplicationCommandMentionableOption, APIApplicationCommandNumberOption, APIApplicationCommandRoleOption, APIApplicationCommandAttachmentOption, APIApplicationCommandStringOption, APIApplicationCommandUserOption, APIApplicationCommandSubcommandGroupOption, APIApplicationCommandSubcommandOption, RESTPostAPIApplicationCommandsJSONBody, APIApplicationCommandOption, ApplicationCommandType } from 'discord-api-types/v9';
|
|
2
|
+
import { APIEmbedField, APIEmbedAuthor, APIEmbedFooter, APIEmbedImage, APIEmbed, APIEmbedVideo, APISelectMenuOption, APIMessageComponentEmoji, ButtonStyle, APIBaseComponent, ComponentType, APIMessageComponent, APIActionRowComponentTypes, APIActionRowComponent, APIButtonComponent, APISelectMenuComponent, ApplicationCommandOptionType, APIApplicationCommandBasicOption, APIApplicationCommandBooleanOption, ChannelType, APIApplicationCommandChannelOption, APIApplicationCommandOptionChoice, APIApplicationCommandIntegerOption, APIApplicationCommandMentionableOption, APIApplicationCommandNumberOption, APIApplicationCommandRoleOption, APIApplicationCommandAttachmentOption, APIApplicationCommandStringOption, APIApplicationCommandUserOption, APIApplicationCommandSubcommandGroupOption, APIApplicationCommandSubcommandOption, RESTPostAPIApplicationCommandsJSONBody, APIApplicationCommandOption, ApplicationCommandType } from 'discord-api-types/v9';
|
|
3
3
|
import { z } from 'zod';
|
|
4
4
|
import { Snowflake } from 'discord-api-types/globals';
|
|
5
5
|
import { URL } from 'url';
|
|
@@ -37,7 +37,8 @@ declare const fieldLengthPredicate: z.ZodNumber;
|
|
|
37
37
|
declare function validateFieldLength(amountAdding: number, fields?: APIEmbedField[]): void;
|
|
38
38
|
declare const authorNamePredicate: z.ZodNullable<z.ZodString>;
|
|
39
39
|
declare const urlPredicate: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
40
|
-
declare const
|
|
40
|
+
declare const RGBPredicate: z.ZodNumber;
|
|
41
|
+
declare const colorPredicate: z.ZodUnion<[z.ZodNullable<z.ZodNumber>, z.ZodTuple<[z.ZodNumber, z.ZodNumber, z.ZodNumber], null>]>;
|
|
41
42
|
declare const descriptionPredicate: z.ZodNullable<z.ZodString>;
|
|
42
43
|
declare const footerTextPredicate: z.ZodNullable<z.ZodString>;
|
|
43
44
|
declare const timestampPredicate: z.ZodNullable<z.ZodUnion<[z.ZodNumber, z.ZodDate]>>;
|
|
@@ -52,6 +53,7 @@ declare const Assertions$3_fieldLengthPredicate: typeof fieldLengthPredicate;
|
|
|
52
53
|
declare const Assertions$3_validateFieldLength: typeof validateFieldLength;
|
|
53
54
|
declare const Assertions$3_authorNamePredicate: typeof authorNamePredicate;
|
|
54
55
|
declare const Assertions$3_urlPredicate: typeof urlPredicate;
|
|
56
|
+
declare const Assertions$3_RGBPredicate: typeof RGBPredicate;
|
|
55
57
|
declare const Assertions$3_colorPredicate: typeof colorPredicate;
|
|
56
58
|
declare const Assertions$3_descriptionPredicate: typeof descriptionPredicate;
|
|
57
59
|
declare const Assertions$3_footerTextPredicate: typeof footerTextPredicate;
|
|
@@ -68,6 +70,7 @@ declare namespace Assertions$3 {
|
|
|
68
70
|
Assertions$3_validateFieldLength as validateFieldLength,
|
|
69
71
|
Assertions$3_authorNamePredicate as authorNamePredicate,
|
|
70
72
|
Assertions$3_urlPredicate as urlPredicate,
|
|
73
|
+
Assertions$3_RGBPredicate as RGBPredicate,
|
|
71
74
|
Assertions$3_colorPredicate as colorPredicate,
|
|
72
75
|
Assertions$3_descriptionPredicate as descriptionPredicate,
|
|
73
76
|
Assertions$3_footerTextPredicate as footerTextPredicate,
|
|
@@ -76,6 +79,14 @@ declare namespace Assertions$3 {
|
|
|
76
79
|
};
|
|
77
80
|
}
|
|
78
81
|
|
|
82
|
+
interface Equatable<T> {
|
|
83
|
+
/**
|
|
84
|
+
* Whether or not this is equal to another structure
|
|
85
|
+
*/
|
|
86
|
+
equals: (other: T) => boolean;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
declare type RGBTuple = [red: number, green: number, blue: number];
|
|
79
90
|
interface IconData {
|
|
80
91
|
/**
|
|
81
92
|
* The URL of the icon
|
|
@@ -99,7 +110,7 @@ interface EmbedImageData extends Omit<APIEmbedImage, 'proxy_url'> {
|
|
|
99
110
|
/**
|
|
100
111
|
* Represents a non-validated embed in a message (image/video preview, rich embed, etc.)
|
|
101
112
|
*/
|
|
102
|
-
declare class UnsafeEmbed {
|
|
113
|
+
declare class UnsafeEmbed implements Equatable<APIEmbed | UnsafeEmbed> {
|
|
103
114
|
protected data: APIEmbed;
|
|
104
115
|
constructor(data?: APIEmbed);
|
|
105
116
|
/**
|
|
@@ -154,6 +165,10 @@ declare class UnsafeEmbed {
|
|
|
154
165
|
* The accumulated length for the embed title, description, fields, footer text, and author name
|
|
155
166
|
*/
|
|
156
167
|
get length(): number;
|
|
168
|
+
/**
|
|
169
|
+
* The hex color of the current color of the embed
|
|
170
|
+
*/
|
|
171
|
+
get hexColor(): string | undefined;
|
|
157
172
|
/**
|
|
158
173
|
* Adds a field to the embed (max 25)
|
|
159
174
|
*
|
|
@@ -190,7 +205,7 @@ declare class UnsafeEmbed {
|
|
|
190
205
|
*
|
|
191
206
|
* @param color The color of the embed
|
|
192
207
|
*/
|
|
193
|
-
setColor(color: number | null): this;
|
|
208
|
+
setColor(color: number | RGBTuple | null): this;
|
|
194
209
|
/**
|
|
195
210
|
* Sets the description of this embed
|
|
196
211
|
*
|
|
@@ -237,6 +252,7 @@ declare class UnsafeEmbed {
|
|
|
237
252
|
* Transforms the embed to a plain object
|
|
238
253
|
*/
|
|
239
254
|
toJSON(): APIEmbed;
|
|
255
|
+
equals(other: UnsafeEmbed | APIEmbed): boolean;
|
|
240
256
|
/**
|
|
241
257
|
* Normalizes field input and resolves strings
|
|
242
258
|
*
|
|
@@ -252,7 +268,7 @@ declare class Embed extends UnsafeEmbed {
|
|
|
252
268
|
addFields(...fields: APIEmbedField[]): this;
|
|
253
269
|
spliceFields(index: number, deleteCount: number, ...fields: APIEmbedField[]): this;
|
|
254
270
|
setAuthor(options: EmbedAuthorOptions | null): this;
|
|
255
|
-
setColor(color: number | null): this;
|
|
271
|
+
setColor(color: number | RGBTuple | null): this;
|
|
256
272
|
setDescription(description: string | null): this;
|
|
257
273
|
setFooter(options: EmbedFooterOptions | null): this;
|
|
258
274
|
setImage(url: string | null): this;
|
|
@@ -630,15 +646,13 @@ declare function isJSONEncodable(maybeEncodable: unknown): maybeEncodable is JSO
|
|
|
630
646
|
*/
|
|
631
647
|
declare abstract class Component<DataType extends Partial<APIBaseComponent<ComponentType>> & {
|
|
632
648
|
type: ComponentType;
|
|
633
|
-
} = APIBaseComponent<ComponentType>> implements JSONEncodable<APIMessageComponent> {
|
|
649
|
+
} = APIBaseComponent<ComponentType>> implements JSONEncodable<APIMessageComponent>, Equatable<Component | APIActionRowComponentTypes> {
|
|
634
650
|
/**
|
|
635
651
|
* The API data associated with this component
|
|
636
652
|
*/
|
|
637
653
|
protected readonly data: DataType;
|
|
638
|
-
/**
|
|
639
|
-
* Converts this component to an API-compatible JSON object
|
|
640
|
-
*/
|
|
641
654
|
abstract toJSON(): APIMessageComponent;
|
|
655
|
+
abstract equals(other: Component | APIActionRowComponentTypes): boolean;
|
|
642
656
|
constructor(data: DataType);
|
|
643
657
|
/**
|
|
644
658
|
* The type of this component
|
|
@@ -666,8 +680,9 @@ declare class ActionRow<T extends ActionRowComponent = ActionRowComponent> exten
|
|
|
666
680
|
* Sets the components in this action row
|
|
667
681
|
* @param components The components to set this row to
|
|
668
682
|
*/
|
|
669
|
-
setComponents(components: T[]): this;
|
|
683
|
+
setComponents(...components: T[]): this;
|
|
670
684
|
toJSON(): APIActionRowComponent<APIMessageComponent>;
|
|
685
|
+
equals(other: APIActionRowComponent<APIMessageComponent> | ActionRow): boolean;
|
|
671
686
|
}
|
|
672
687
|
|
|
673
688
|
/**
|
|
@@ -732,6 +747,7 @@ declare class UnsafeButtonComponent extends Component<Partial<APIButtonComponent
|
|
|
732
747
|
*/
|
|
733
748
|
setLabel(label: string): this;
|
|
734
749
|
toJSON(): APIButtonComponent;
|
|
750
|
+
equals(other: APIButtonComponent | UnsafeButtonComponent): boolean;
|
|
735
751
|
}
|
|
736
752
|
|
|
737
753
|
/**
|
|
@@ -819,13 +835,14 @@ declare class UnsafeSelectMenuComponent extends Component<Partial<Omit<APISelect
|
|
|
819
835
|
* @param options The options to add to this select menu
|
|
820
836
|
* @returns
|
|
821
837
|
*/
|
|
822
|
-
addOptions(...options: UnsafeSelectMenuOption[]): this;
|
|
838
|
+
addOptions(...options: (UnsafeSelectMenuOption | APISelectMenuOption)[]): this;
|
|
823
839
|
/**
|
|
824
840
|
* Sets the options on this select menu
|
|
825
841
|
* @param options The options to set on this select menu
|
|
826
842
|
*/
|
|
827
|
-
setOptions(options: UnsafeSelectMenuOption[]): this;
|
|
843
|
+
setOptions(...options: (UnsafeSelectMenuOption | APISelectMenuOption)[]): this;
|
|
828
844
|
toJSON(): APISelectMenuComponent;
|
|
845
|
+
equals(other: APISelectMenuComponent | UnsafeSelectMenuComponent): boolean;
|
|
829
846
|
}
|
|
830
847
|
|
|
831
848
|
/**
|
|
@@ -1243,4 +1260,4 @@ declare namespace Assertions {
|
|
|
1243
1260
|
};
|
|
1244
1261
|
}
|
|
1245
1262
|
|
|
1246
|
-
export { ActionRow, ActionRowComponent, ButtonComponent, Component, Assertions$2 as ComponentAssertions, Assertions as ContextMenuCommandAssertions, ContextMenuCommandBuilder, ContextMenuCommandType, Embed, Assertions$3 as EmbedAssertions, EmbedAuthorData, EmbedAuthorOptions, EmbedFooterData, EmbedFooterOptions, EmbedImageData, Faces, IconData, JSONEncodable, MappedComponentTypes, MessageComponent, SelectMenuComponent, SelectMenuOption, Assertions$1 as SlashCommandAssertions, SlashCommandAttachmentOption, SlashCommandBooleanOption, SlashCommandBuilder, SlashCommandChannelOption, SlashCommandIntegerOption, SlashCommandMentionableOption, SlashCommandNumberOption, SlashCommandOptionsOnlyBuilder, SlashCommandRoleOption, SlashCommandStringOption, SlashCommandSubcommandBuilder, SlashCommandSubcommandGroupBuilder, SlashCommandSubcommandsOnlyBuilder, SlashCommandUserOption, TimestampStyles, TimestampStylesString, ToAPIApplicationCommandOptions, UnsafeButtonComponent, UnsafeEmbed, UnsafeSelectMenuComponent, UnsafeSelectMenuOption, blockQuote, bold, channelMention, codeBlock, createComponent, formatEmoji, hideLinkEmbed, hyperlink, inlineCode, isJSONEncodable, italic, memberNicknameMention, quote, roleMention, spoiler, strikethrough, time, underscore, userMention };
|
|
1263
|
+
export { ActionRow, ActionRowComponent, ButtonComponent, Component, Assertions$2 as ComponentAssertions, Assertions as ContextMenuCommandAssertions, ContextMenuCommandBuilder, ContextMenuCommandType, Embed, Assertions$3 as EmbedAssertions, EmbedAuthorData, EmbedAuthorOptions, EmbedFooterData, EmbedFooterOptions, EmbedImageData, Faces, IconData, JSONEncodable, MappedComponentTypes, MessageComponent, RGBTuple, SelectMenuComponent, SelectMenuOption, Assertions$1 as SlashCommandAssertions, SlashCommandAttachmentOption, SlashCommandBooleanOption, SlashCommandBuilder, SlashCommandChannelOption, SlashCommandIntegerOption, SlashCommandMentionableOption, SlashCommandNumberOption, SlashCommandOptionsOnlyBuilder, SlashCommandRoleOption, SlashCommandStringOption, SlashCommandSubcommandBuilder, SlashCommandSubcommandGroupBuilder, SlashCommandSubcommandsOnlyBuilder, SlashCommandUserOption, TimestampStyles, TimestampStylesString, ToAPIApplicationCommandOptions, UnsafeButtonComponent, UnsafeEmbed, UnsafeSelectMenuComponent, UnsafeSelectMenuOption, blockQuote, bold, channelMention, codeBlock, createComponent, formatEmoji, hideLinkEmbed, hyperlink, inlineCode, isJSONEncodable, italic, memberNicknameMention, quote, roleMention, spoiler, strikethrough, time, underscore, userMention };
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var
|
|
1
|
+
var we=Object.create;var M=Object.defineProperty;var Kt=Object.getOwnPropertyDescriptor;var Be=Object.getOwnPropertyNames;var Ne=Object.getPrototypeOf,$e=Object.prototype.hasOwnProperty;var De=(e,t,n)=>t in e?M(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var Qt=e=>M(e,"__esModule",{value:!0}),o=(e,t)=>M(e,"name",{value:t,configurable:!0});var q=(e,t)=>{for(var n in t)M(e,n,{get:t[n],enumerable:!0})},Ht=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of Be(t))!$e.call(e,s)&&(n||s!=="default")&&M(e,s,{get:()=>t[s],enumerable:!(r=Kt(t,s))||r.enumerable});return e},k=(e,t)=>Ht(Qt(M(e!=null?we(Ne(e)):{},"default",!t&&e&&e.__esModule?{get:()=>e.default,enumerable:!0}:{value:e,enumerable:!0})),e),Le=(e=>(t,n)=>e&&e.get(t)||(n=Ht(Qt({}),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?Kt(t,n):t,x=e.length-1,T;x>=0;x--)(T=e[x])&&(s=(r?T(t,n,s):T(s))||s);return r&&s&&M(t,n,s),s};var i=(e,t,n)=>(De(e,typeof t!="symbol"?t+"":t,n),n);var lo={};q(lo,{ActionRow:()=>g,ButtonComponent:()=>L,Component:()=>C,ComponentAssertions:()=>$t,ContextMenuCommandAssertions:()=>Wt,ContextMenuCommandBuilder:()=>Zt,Embed:()=>It,EmbedAssertions:()=>Pt,Faces:()=>ee,SelectMenuComponent:()=>V,SelectMenuOption:()=>Vt,SlashCommandAssertions:()=>Jt,SlashCommandAttachmentOption:()=>H,SlashCommandBooleanOption:()=>Z,SlashCommandBuilder:()=>Y,SlashCommandChannelOption:()=>E,SlashCommandIntegerOption:()=>w,SlashCommandMentionableOption:()=>K,SlashCommandNumberOption:()=>B,SlashCommandRoleOption:()=>Q,SlashCommandStringOption:()=>N,SlashCommandSubcommandBuilder:()=>h,SlashCommandSubcommandGroupBuilder:()=>I,SlashCommandUserOption:()=>X,TimestampStyles:()=>to,UnsafeButtonComponent:()=>v,UnsafeEmbed:()=>b,UnsafeSelectMenuComponent:()=>R,UnsafeSelectMenuOption:()=>u,blockQuote:()=>je,bold:()=>Je,channelMention:()=>Qe,codeBlock:()=>Ve,createComponent:()=>Dt,formatEmoji:()=>Xe,hideLinkEmbed:()=>Ge,hyperlink:()=>ze,inlineCode:()=>_e,isJSONEncodable:()=>mo,italic:()=>Ue,memberNicknameMention:()=>Ke,quote:()=>ke,roleMention:()=>He,spoiler:()=>We,strikethrough:()=>qe,time:()=>Ye,underscore:()=>Fe,userMention:()=>Ze});var Pt={};q(Pt,{RGBPredicate:()=>it,authorNamePredicate:()=>At,colorPredicate:()=>xt,descriptionPredicate:()=>yt,embedFieldPredicate:()=>Xt,embedFieldsArrayPredicate:()=>ot,fieldInlinePredicate:()=>et,fieldLengthPredicate:()=>Yt,fieldNamePredicate:()=>$,fieldValuePredicate:()=>tt,footerTextPredicate:()=>gt,timestampPredicate:()=>Ot,titlePredicate:()=>St,urlPredicate:()=>y,validateFieldLength:()=>nt});var m=require("zod"),$=m.z.string().min(1).max(256),tt=m.z.string().min(1).max(1024),et=m.z.boolean().optional(),Xt=m.z.object({name:$,value:tt,inline:et}),ot=Xt.array(),Yt=m.z.number().lte(25);function nt(e,t){Yt.parse((t?.length??0)+e)}o(nt,"validateFieldLength");var At=$.nullable(),y=m.z.string().url().nullish(),it=m.z.number().int().gte(0).lte(255),xt=m.z.number().int().gte(0).lte(16777215).nullable().or(m.z.tuple([it,it,it])),yt=m.z.string().min(1).max(4096).nullable(),gt=m.z.string().min(1).max(2048).nullable(),Ot=m.z.union([m.z.number(),m.z.date()]).nullable(),St=$.nullable();var te=k(require("fast-deep-equal")),b=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}addField(t){return this.addFields(t)}addFields(...t){return t=b.normalizeFields(...t),this.data.fields?this.data.fields.push(...t):this.data.fields=t,this}spliceFields(t,n,...r){return r=b.normalizeFields(...r),this.data.fields?this.data.fields.splice(t,n,...r):this.data.fields=r,this}setFields(...t){return this.spliceFields(0,this.fields?.length??0,...t),this}setAuthor(t){return t===null?(this.data.author=void 0,this):(this.data.author={name:t.name,url:t.url,icon_url:t.iconURL},this)}setColor(t){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,x=t instanceof b?t.data:t,{image:T,thumbnail:Re,...Ee}=x;return(0,te.default)(Ee,s)&&T?.url===n?.url&&Re?.url===r?.url}static normalizeFields(...t){return t.flat(1/0).map(n=>({name:n.name,value:n.value,inline:n.inline??void 0}))}};o(b,"UnsafeEmbed");var It=class extends b{addFields(...t){return nt(t.length,this.fields),super.addFields(...ot.parse(t))}spliceFields(t,n,...r){return nt(r.length-n,this.fields),super.spliceFields(t,n,...ot.parse(r))}setAuthor(t){return t===null?super.setAuthor(null):(At.parse(t.name),y.parse(t.iconURL),y.parse(t.url),super.setAuthor(t))}setColor(t){return super.setColor(xt.parse(t))}setDescription(t){return super.setDescription(yt.parse(t))}setFooter(t){return t===null?super.setFooter(null):(gt.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(Ot.parse(t))}setTitle(t){return super.setTitle(St.parse(t))}setURL(t){return super.setURL(y.parse(t))}static normalizeFields(...t){return t.flat(1/0).map(n=>($.parse(n.name),tt.parse(n.value),et.parse(n.inline),{name:n.name,value:n.value,inline:n.inline??void 0}))}};o(It,"Embed");function Ve(e,t){return typeof t=="undefined"?`\`\`\`
|
|
2
2
|
${e}\`\`\``:`\`\`\`${e}
|
|
3
|
-
${t}\`\`\``}o(we,"codeBlock");function Ee(e){return`\`${e}\``}o(Ee,"inlineCode");function Be(e){return`_${e}_`}o(Be,"italic");function Ne(e){return`**${e}**`}o(Ne,"bold");function $e(e){return`__${e}__`}o($e,"underscore");function _e(e){return`~~${e}~~`}o(_e,"strikethrough");function Le(e){return`> ${e}`}o(Le,"quote");function Ve(e){return`>>> ${e}`}o(Ve,"blockQuote");function De(e){return`<${e}>`}o(De,"hideLinkEmbed");function Ue(e,t,n){return n?`[${e}](${t} "${n}")`:`[${e}](${t})`}o(Ue,"hyperlink");function Fe(e){return`||${e}||`}o(Fe,"spoiler");function Je(e){return`<@${e}>`}o(Je,"userMention");function ke(e){return`<@!${e}>`}o(ke,"memberNicknameMention");function je(e){return`<#${e}>`}o(je,"channelMention");function qe(e){return`<@&${e}>`}o(qe,"roleMention");function Ge(e,t=!1){return`<${t?"a":""}:_:${e}>`}o(Ge,"formatEmoji");function ze(e,t){return typeof e!="number"&&(e=Math.floor((e?.getTime()??Date.now())/1e3)),typeof t=="string"?`<t:${e}:${t}>`:`<t:${e}>`}o(ze,"time");var We={ShortTime:"t",LongTime:"T",ShortDate:"d",LongDate:"D",ShortDateTime:"f",LongDateTime:"F",RelativeTime:"R"},Kt=(r=>(r.Shrug="\xAF\\_(\u30C4)\\_/\xAF",r.Tableflip="(\u256F\xB0\u25A1\xB0\uFF09\u256F\uFE35 \u253B\u2501\u253B",r.Unflip="\u252C\u2500\u252C \u30CE( \u309C-\u309C\u30CE)",r))(Kt||{});var wt={};F(wt,{buttonLabelValidator:()=>Ot,buttonStyleValidator:()=>St,customIdValidator:()=>E,defaultValidator:()=>Tt,disabledValidator:()=>k,emojiValidator:()=>J,labelValueValidator:()=>j,minMaxValidator:()=>it,optionsValidator:()=>Qt,placeholderValidator:()=>Pt,urlValidator:()=>vt,validateRequiredButtonParameters:()=>Rt,validateRequiredSelectMenuOptionParameters:()=>Mt,validateRequiredSelectMenuParameters:()=>It});var nt=require("discord-api-types/v9"),m=require("zod"),E=m.z.string().min(1).max(100),J=m.z.object({id:m.z.string(),name:m.z.string(),animated:m.z.boolean()}).partial().strict(),k=m.z.boolean(),Ot=m.z.string().nonempty().max(80),St=m.z.number().int().min(nt.ButtonStyle.Primary).max(nt.ButtonStyle.Link),Pt=m.z.string().max(100),it=m.z.number().int().min(0).max(25),Qt=m.z.object({}).array().nonempty();function It(e,t){E.parse(t),Qt.parse(e)}o(It,"validateRequiredSelectMenuParameters");var j=m.z.string().min(1).max(100),Tt=m.z.boolean();function Mt(e,t){j.parse(e),j.parse(t)}o(Mt,"validateRequiredSelectMenuOptionParameters");var vt=m.z.string().url();function Rt(e,t,n,r,s){if(s&&r)throw new RangeError("URL and custom id are mutually exclusive");if(!t&&!n)throw new RangeError("Buttons must have a label and/or an emoji");if(e===nt.ButtonStyle.Link){if(!s)throw new RangeError("Link buttons must have a url")}else if(s)throw new RangeError("Non-link buttons cannot have a url")}o(Rt,"validateRequiredButtonParameters");var Ht=require("discord-api-types/v9");var h=class{constructor(t){i(this,"data");this.data=t}get type(){return this.data.type}};o(h,"Component");var rt=require("discord-api-types/v9");function Et(e){switch(e.type){case rt.ComponentType.ActionRow:return e instanceof B?e:new B(e);case rt.ComponentType.Button:return e instanceof N?e:new N(e);case rt.ComponentType.SelectMenu:return e instanceof $?e:new $(e);default:throw new Error(`Cannot serialize component type: ${e.type}`)}}o(Et,"createComponent");var B=class extends h{constructor({components:t,...n}={}){super({type:Ht.ComponentType.ActionRow,...n});i(this,"components");this.components=t?.map(r=>Et(r))??[]}addComponents(...t){return this.components.push(...t),this}setComponents(t){return this.components.splice(0,this.components.length,...t),this}toJSON(){return{...this.data,components:this.components.map(t=>t.toJSON())}}};o(B,"ActionRow");var Xt=require("discord-api-types/v9");var q=class extends h{constructor(t){super({type:Xt.ComponentType.Button,...t})}get style(){return this.data.style}get label(){return this.data.label}get emoji(){return this.data.emoji}get disabled(){return this.data.disabled}get customId(){return this.data.custom_id}get url(){return this.data.url}setStyle(t){return this.data.style=t,this}setURL(t){return this.data.url=t,this}setCustomId(t){return this.data.custom_id=t,this}setEmoji(t){return this.data.emoji=t,this}setDisabled(t){return this.data.disabled=t,this}setLabel(t){return this.data.label=t,this}toJSON(){return{...this.data}}};o(q,"UnsafeButtonComponent");var N=class extends q{setStyle(t){return super.setStyle(St.parse(t))}setURL(t){return super.setURL(vt.parse(t))}setCustomId(t){return super.setCustomId(E.parse(t))}setEmoji(t){return super.setEmoji(J.parse(t))}setDisabled(t){return super.setDisabled(k.parse(t))}setLabel(t){return super.setLabel(Ot.parse(t))}toJSON(){return Rt(this.style,this.label,this.emoji,this.customId,this.url),super.toJSON()}};o(N,"ButtonComponent");var Yt=require("discord-api-types/v9");var P=class{constructor(t={}){this.data=t}get label(){return this.data.label}get value(){return this.data.value}get description(){return this.data.description}get emoji(){return this.data.emoji}get default(){return this.data.default}setLabel(t){return this.data.label=t,this}setValue(t){return this.data.value=t,this}setDescription(t){return this.data.description=t,this}setDefault(t){return this.data.default=t,this}setEmoji(t){return this.data.emoji=t,this}toJSON(){return{...this.data}}};o(P,"UnsafeSelectMenuOption");var G=class extends h{constructor(t){let{options:n,...r}=t??{};super({type:Yt.ComponentType.SelectMenu,...r});i(this,"options");this.options=n?.map(s=>new P(s))??[]}get placeholder(){return this.data.placeholder}get maxValues(){return this.data.max_values}get minValues(){return this.data.min_values}get customId(){return this.data.custom_id}get disabled(){return this.data.disabled}setPlaceholder(t){return this.data.placeholder=t,this}setMinValues(t){return this.data.min_values=t,this}setMaxValues(t){return this.data.max_values=t,this}setCustomId(t){return this.data.custom_id=t,this}setDisabled(t){return this.data.disabled=t,this}addOptions(...t){return this.options.push(...t),this}setOptions(t){return this.options.splice(0,this.options.length,...t),this}toJSON(){return{...this.data,options:this.options.map(t=>t.toJSON())}}};o(G,"UnsafeSelectMenuComponent");var $=class extends G{setPlaceholder(t){return super.setPlaceholder(Pt.parse(t))}setMinValues(t){return super.setMinValues(it.parse(t))}setMaxValues(t){return super.setMaxValues(it.parse(t))}setCustomId(t){return super.setCustomId(E.parse(t))}setDisabled(t){return super.setDisabled(k.parse(t))}toJSON(){return It(this.options,this.customId),super.toJSON()}};o($,"SelectMenuComponent");var Bt=class extends P{setDescription(t){return super.setDescription(j.parse(t))}setDefault(t){return super.setDefault(Tt.parse(t))}setEmoji(t){return super.setEmoji(J.parse(t))}toJSON(){return Mt(this.label,this.value),super.toJSON()}};o(Bt,"SelectMenuOption");var _t={};F(_t,{assertReturnOfBuilder:()=>y,validateDefaultPermission:()=>Nt,validateDescription:()=>pt,validateMaxChoicesLength:()=>$t,validateMaxOptionsLength:()=>b,validateName:()=>st,validateRequired:()=>mt,validateRequiredParameters:()=>A});var at=ve(require("@sindresorhus/is")),z=require("zod"),Ze=z.z.string().min(1).max(32).regex(/^[\P{Lu}\p{N}_-]+$/u);function st(e){Ze.parse(e)}o(st,"validateName");var Ke=z.z.string().min(1).max(100);function pt(e){Ke.parse(e)}o(pt,"validateDescription");var te=z.z.unknown().array().max(25);function b(e){te.parse(e)}o(b,"validateMaxOptionsLength");function A(e,t,n){st(e),pt(t),b(n)}o(A,"validateRequiredParameters");var ee=z.z.boolean();function Nt(e){ee.parse(e)}o(Nt,"validateDefaultPermission");function mt(e){ee.parse(e)}o(mt,"validateRequired");function $t(e){te.parse(e)}o($t,"validateMaxChoicesLength");function y(e,t){let n=t.name;if(at.default.nullOrUndefined(e))throw new TypeError(`Expected to receive a ${n} builder, got ${e===null?"null":"undefined"} instead.`);if(at.default.primitive(e))throw new TypeError(`Expected to receive a ${n} builder, got a primitive (${typeof e}) instead.`);if(!(e instanceof t)){let r=e,s=at.default.function_(e)?e.name:r.constructor.name,R=Reflect.get(r,Symbol.toStringTag),U=R?`${s} [${R}]`:s;throw new TypeError(`Expected to receive a ${n} builder, got ${U} instead.`)}}o(y,"assertReturnOfBuilder");var Oe=require("ts-mixer");var oe=require("discord-api-types/v9");var C=class{constructor(){i(this,"name");i(this,"description")}setName(t){return st(t),Reflect.set(this,"name",t),this}setDescription(t){return pt(t),Reflect.set(this,"description",t),this}};o(C,"SharedNameAndDescription");var p=class extends C{constructor(){super(...arguments);i(this,"required",!1)}setRequired(t){return mt(t),Reflect.set(this,"required",t),this}runRequiredValidations(){A(this.name,this.description,[]),mt(this.required)}};o(p,"ApplicationCommandOptionBase");var W=class extends p{constructor(){super(...arguments);i(this,"type",oe.ApplicationCommandOptionType.Boolean)}toJSON(){return this.runRequiredValidations(),{...this}}};o(W,"SlashCommandBooleanOption");var ne=require("discord-api-types/v9"),ie=require("ts-mixer");var u=require("discord-api-types/v9"),Lt=require("zod"),Qe=[u.ChannelType.GuildText,u.ChannelType.GuildVoice,u.ChannelType.GuildCategory,u.ChannelType.GuildNews,u.ChannelType.GuildStore,u.ChannelType.GuildNewsThread,u.ChannelType.GuildPublicThread,u.ChannelType.GuildPrivateThread,u.ChannelType.GuildStageVoice],He=Lt.z.union(Qe.map(e=>Lt.z.literal(e))),lt=class{constructor(){i(this,"channel_types")}addChannelType(t){return this.channel_types===void 0&&Reflect.set(this,"channel_types",[]),He.parse(t),this.channel_types.push(t),this}addChannelTypes(t){return t.forEach(n=>this.addChannelType(n)),this}};o(lt,"ApplicationCommandOptionChannelTypesMixin");var I=class extends p{constructor(){super(...arguments);i(this,"type",ne.ApplicationCommandOptionType.Channel)}toJSON(){return this.runRequiredValidations(),{...this}}};o(I,"SlashCommandChannelOption"),I=l([(0,ie.mix)(lt)],I);var pe=require("discord-api-types/v9"),me=require("ts-mixer"),le=require("zod");var _=class{constructor(){i(this,"max_value");i(this,"min_value")}};o(_,"ApplicationCommandNumericOptionMinMaxValueMixin");var re=require("discord-api-types/v9"),L=require("zod");var dt=L.z.string().min(1).max(100),ae=L.z.number().gt(-1/0).lt(1/0),se=L.z.object({name:dt,value:L.z.union([dt,ae])}).array(),Xe=L.z.boolean(),g=class{constructor(){i(this,"choices");i(this,"autocomplete");i(this,"type")}addChoice(t){let{name:n,value:r}=t;if(this.autocomplete)throw new RangeError("Autocomplete and choices are mutually exclusive to each other.");return this.choices===void 0&&Reflect.set(this,"choices",[]),$t(this.choices),dt.parse(n),this.type===re.ApplicationCommandOptionType.String?dt.parse(r):ae.parse(r),this.choices.push({name:n,value:r}),this}addChoices(...t){if(this.autocomplete)throw new RangeError("Autocomplete and choices are mutually exclusive to each other.");se.parse(t);for(let n of t)this.addChoice(n);return this}setChoices(...t){if(t.length>0&&this.autocomplete)throw new RangeError("Autocomplete and choices are mutually exclusive to each other.");se.parse(t),Reflect.set(this,"choices",[]);for(let n of t)this.addChoice(n);return this}setAutocomplete(t){if(Xe.parse(t),t&&Array.isArray(this.choices)&&this.choices.length>0)throw new RangeError("Autocomplete and choices are mutually exclusive to each other.");return Reflect.set(this,"autocomplete",t),this}};o(g,"ApplicationCommandOptionWithChoicesAndAutocompleteMixin");var de=le.z.number().int().nonnegative(),T=class extends p{constructor(){super(...arguments);i(this,"type",pe.ApplicationCommandOptionType.Integer)}setMaxValue(t){return de.parse(t),Reflect.set(this,"max_value",t),this}setMinValue(t){return de.parse(t),Reflect.set(this,"min_value",t),this}toJSON(){if(this.runRequiredValidations(),this.autocomplete&&Array.isArray(this.choices)&&this.choices.length>0)throw new RangeError("Autocomplete and choices are mutually exclusive to each other.");return{...this}}};o(T,"SlashCommandIntegerOption"),T=l([(0,me.mix)(_,g)],T);var ue=require("discord-api-types/v9");var Z=class extends p{constructor(){super(...arguments);i(this,"type",ue.ApplicationCommandOptionType.Mentionable)}toJSON(){return this.runRequiredValidations(),{...this}}};o(Z,"SlashCommandMentionableOption");var ce=require("discord-api-types/v9"),he=require("ts-mixer"),be=require("zod");var Ce=be.z.number().nonnegative(),M=class extends p{constructor(){super(...arguments);i(this,"type",ce.ApplicationCommandOptionType.Number)}setMaxValue(t){return Ce.parse(t),Reflect.set(this,"max_value",t),this}setMinValue(t){return Ce.parse(t),Reflect.set(this,"min_value",t),this}toJSON(){if(this.runRequiredValidations(),this.autocomplete&&Array.isArray(this.choices)&&this.choices.length>0)throw new RangeError("Autocomplete and choices are mutually exclusive to each other.");return{...this}}};o(M,"SlashCommandNumberOption"),M=l([(0,he.mix)(_,g)],M);var fe=require("discord-api-types/v9");var K=class extends p{constructor(){super(...arguments);i(this,"type",fe.ApplicationCommandOptionType.Role)}toJSON(){return this.runRequiredValidations(),{...this}}};o(K,"SlashCommandRoleOption");var xe=require("discord-api-types/v9");var Q=class extends p{constructor(){super(...arguments);i(this,"type",xe.ApplicationCommandOptionType.Attachment)}toJSON(){return this.runRequiredValidations(),{...this}}};o(Q,"SlashCommandAttachmentOption");var Ae=require("discord-api-types/v9"),ye=require("ts-mixer");var v=class extends p{constructor(){super(...arguments);i(this,"type",Ae.ApplicationCommandOptionType.String)}toJSON(){if(this.runRequiredValidations(),this.autocomplete&&Array.isArray(this.choices)&&this.choices.length>0)throw new RangeError("Autocomplete and choices are mutually exclusive to each other.");return{...this}}};o(v,"SlashCommandStringOption"),v=l([(0,ye.mix)(g)],v);var ge=require("discord-api-types/v9");var H=class extends p{constructor(){super(...arguments);i(this,"type",ge.ApplicationCommandOptionType.User)}toJSON(){return this.runRequiredValidations(),{...this}}};o(H,"SlashCommandUserOption");var V=class{constructor(){i(this,"options")}addBooleanOption(t){return this._sharedAddOptionMethod(t,W)}addUserOption(t){return this._sharedAddOptionMethod(t,H)}addChannelOption(t){return this._sharedAddOptionMethod(t,I)}addRoleOption(t){return this._sharedAddOptionMethod(t,K)}addAttachmentOption(t){return this._sharedAddOptionMethod(t,Q)}addMentionableOption(t){return this._sharedAddOptionMethod(t,Z)}addStringOption(t){return this._sharedAddOptionMethod(t,v)}addIntegerOption(t){return this._sharedAddOptionMethod(t,T)}addNumberOption(t){return this._sharedAddOptionMethod(t,M)}_sharedAddOptionMethod(t,n){let{options:r}=this;b(r);let s=typeof t=="function"?t(new n):t;return y(s,n),r.push(s),this}};o(V,"SharedSlashCommandOptions");var Vt=require("discord-api-types/v9"),Dt=require("ts-mixer");var O=class{constructor(){i(this,"name");i(this,"description");i(this,"options",[])}addSubcommand(t){let{options:n}=this;b(n);let r=typeof t=="function"?t(new c):t;return y(r,c),n.push(r),this}toJSON(){return A(this.name,this.description,this.options),{type:Vt.ApplicationCommandOptionType.SubcommandGroup,name:this.name,description:this.description,options:this.options.map(t=>t.toJSON())}}};o(O,"SlashCommandSubcommandGroupBuilder"),O=l([(0,Dt.mix)(C)],O);var c=class{constructor(){i(this,"name");i(this,"description");i(this,"options",[])}toJSON(){return A(this.name,this.description,this.options),{type:Vt.ApplicationCommandOptionType.Subcommand,name:this.name,description:this.description,options:this.options.map(t=>t.toJSON())}}};o(c,"SlashCommandSubcommandBuilder"),c=l([(0,Dt.mix)(C,V)],c);var X=class{constructor(){i(this,"name");i(this,"description");i(this,"options",[]);i(this,"defaultPermission")}toJSON(){return A(this.name,this.description,this.options),{name:this.name,description:this.description,options:this.options.map(t=>t.toJSON()),default_permission:this.defaultPermission}}setDefaultPermission(t){return Nt(t),Reflect.set(this,"defaultPermission",t),this}addSubcommandGroup(t){let{options:n}=this;b(n);let r=typeof t=="function"?t(new O):t;return y(r,O),n.push(r),this}addSubcommand(t){let{options:n}=this;b(n);let r=typeof t=="function"?t(new c):t;return y(r,c),n.push(r),this}};o(X,"SlashCommandBuilder"),X=l([(0,Oe.mix)(V,C)],X);var kt={};F(kt,{validateDefaultPermission:()=>Ft,validateName:()=>ut,validateRequiredParameters:()=>Jt,validateType:()=>ct});var D=require("zod"),Ut=require("discord-api-types/v9"),Ye=D.z.string().min(1).max(32).regex(/^( *[\p{L}\p{N}_-]+ *)+$/u),to=D.z.union([D.z.literal(Ut.ApplicationCommandType.User),D.z.literal(Ut.ApplicationCommandType.Message)]),eo=D.z.boolean();function Ft(e){eo.parse(e)}o(Ft,"validateDefaultPermission");function ut(e){Ye.parse(e)}o(ut,"validateName");function ct(e){to.parse(e)}o(ct,"validateType");function Jt(e,t){ut(e),ct(t)}o(Jt,"validateRequiredParameters");var jt=class{constructor(){i(this,"name");i(this,"type");i(this,"defaultPermission")}setName(t){return ut(t),Reflect.set(this,"name",t),this}setType(t){return ct(t),Reflect.set(this,"type",t),this}setDefaultPermission(t){return Ft(t),Reflect.set(this,"defaultPermission",t),this}toJSON(){return Jt(this.name,this.type),{name:this.name,type:this.type,default_permission:this.defaultPermission}}};o(jt,"ContextMenuCommandBuilder");function oo(e){return e!==null&&typeof e=="object"&&"toJSON"in e}o(oo,"isJSONEncodable");module.exports=Re(no);0&&(module.exports={ActionRow,ButtonComponent,Component,ComponentAssertions,ContextMenuCommandAssertions,ContextMenuCommandBuilder,Embed,EmbedAssertions,Faces,SelectMenuComponent,SelectMenuOption,SlashCommandAssertions,SlashCommandAttachmentOption,SlashCommandBooleanOption,SlashCommandBuilder,SlashCommandChannelOption,SlashCommandIntegerOption,SlashCommandMentionableOption,SlashCommandNumberOption,SlashCommandRoleOption,SlashCommandStringOption,SlashCommandSubcommandBuilder,SlashCommandSubcommandGroupBuilder,SlashCommandUserOption,TimestampStyles,UnsafeButtonComponent,UnsafeEmbed,UnsafeSelectMenuComponent,UnsafeSelectMenuOption,blockQuote,bold,channelMention,codeBlock,createComponent,formatEmoji,hideLinkEmbed,hyperlink,inlineCode,isJSONEncodable,italic,memberNicknameMention,quote,roleMention,spoiler,strikethrough,time,underscore,userMention});
|
|
3
|
+
${t}\`\`\``}o(Ve,"codeBlock");function _e(e){return`\`${e}\``}o(_e,"inlineCode");function Ue(e){return`_${e}_`}o(Ue,"italic");function Je(e){return`**${e}**`}o(Je,"bold");function Fe(e){return`__${e}__`}o(Fe,"underscore");function qe(e){return`~~${e}~~`}o(qe,"strikethrough");function ke(e){return`> ${e}`}o(ke,"quote");function je(e){return`>>> ${e}`}o(je,"blockQuote");function Ge(e){return`<${e}>`}o(Ge,"hideLinkEmbed");function ze(e,t,n){return n?`[${e}](${t} "${n}")`:`[${e}](${t})`}o(ze,"hyperlink");function We(e){return`||${e}||`}o(We,"spoiler");function Ze(e){return`<@${e}>`}o(Ze,"userMention");function Ke(e){return`<@!${e}>`}o(Ke,"memberNicknameMention");function Qe(e){return`<#${e}>`}o(Qe,"channelMention");function He(e){return`<@&${e}>`}o(He,"roleMention");function Xe(e,t=!1){return`<${t?"a":""}:_:${e}>`}o(Xe,"formatEmoji");function Ye(e,t){return typeof e!="number"&&(e=Math.floor((e?.getTime()??Date.now())/1e3)),typeof t=="string"?`<t:${e}:${t}>`:`<t:${e}>`}o(Ye,"time");var to={ShortTime:"t",LongTime:"T",ShortDate:"d",LongDate:"D",ShortDateTime:"f",LongDateTime:"F",RelativeTime:"R"},ee=(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))(ee||{});var $t={};q($t,{buttonLabelValidator:()=>Tt,buttonStyleValidator:()=>Mt,customIdValidator:()=>D,defaultValidator:()=>Et,disabledValidator:()=>G,emojiValidator:()=>j,labelValueValidator:()=>z,minMaxValidator:()=>at,optionsValidator:()=>oe,placeholderValidator:()=>vt,urlValidator:()=>Bt,validateRequiredButtonParameters:()=>Nt,validateRequiredSelectMenuOptionParameters:()=>wt,validateRequiredSelectMenuParameters:()=>Rt});var rt=require("discord-api-types/v9"),l=require("zod"),D=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(),G=l.z.boolean(),Tt=l.z.string().nonempty().max(80),Mt=l.z.number().int().min(rt.ButtonStyle.Primary).max(rt.ButtonStyle.Link),vt=l.z.string().max(100),at=l.z.number().int().min(0).max(25),oe=l.z.object({}).array().nonempty();function Rt(e,t){D.parse(t),oe.parse(e)}o(Rt,"validateRequiredSelectMenuParameters");var z=l.z.string().min(1).max(100),Et=l.z.boolean();function wt(e,t){z.parse(e),z.parse(t)}o(wt,"validateRequiredSelectMenuOptionParameters");var Bt=l.z.string().url();function Nt(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===rt.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(Nt,"validateRequiredButtonParameters");var ne=require("discord-api-types/v9");var C=class{constructor(t){i(this,"data");this.data=t}get type(){return this.data.type}};o(C,"Component");var st=require("discord-api-types/v9");function Dt(e){switch(e.type){case st.ComponentType.ActionRow:return e instanceof g?e:new g(e);case st.ComponentType.Button:return e instanceof L?e:new L(e);case st.ComponentType.SelectMenu:return e instanceof V?e:new V(e);default:throw new Error(`Cannot serialize component type: ${e.type}`)}}o(Dt,"createComponent");var pt=k(require("fast-deep-equal")),g=class extends C{constructor({components:t,...n}={}){super({type:ne.ComponentType.ActionRow,...n});i(this,"components");this.components=t?.map(r=>Dt(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 g?(0,pt.default)(t.data,this.data)&&(0,pt.default)(t.components,this.components):(0,pt.default)(t,{...this.data,components:this.components.map(n=>n.toJSON())})}};o(g,"ActionRow");var ie=require("discord-api-types/v9");var Lt=k(require("fast-deep-equal")),v=class extends C{constructor(t){super({type:ie.ComponentType.Button,...t})}get style(){return this.data.style}get label(){return this.data.label}get emoji(){return this.data.emoji}get disabled(){return this.data.disabled}get customId(){return this.data.custom_id}get url(){return this.data.url}setStyle(t){return this.data.style=t,this}setURL(t){return this.data.url=t,this}setCustomId(t){return this.data.custom_id=t,this}setEmoji(t){return this.data.emoji=t,this}setDisabled(t){return this.data.disabled=t,this}setLabel(t){return this.data.label=t,this}toJSON(){return{...this.data}}equals(t){return t instanceof v?(0,Lt.default)(t.data,this.data):(0,Lt.default)(t,this.data)}};o(v,"UnsafeButtonComponent");var L=class extends v{setStyle(t){return super.setStyle(Mt.parse(t))}setURL(t){return super.setURL(Bt.parse(t))}setCustomId(t){return super.setCustomId(D.parse(t))}setEmoji(t){return super.setEmoji(j.parse(t))}setDisabled(t){return super.setDisabled(G.parse(t))}setLabel(t){return super.setLabel(Tt.parse(t))}toJSON(){return Nt(this.style,this.label,this.emoji,this.customId,this.url),super.toJSON()}};o(L,"ButtonComponent");var re=require("discord-api-types/v9");var u=class{constructor(t={}){this.data=t}get label(){return this.data.label}get value(){return this.data.value}get description(){return this.data.description}get emoji(){return this.data.emoji}get default(){return this.data.default}setLabel(t){return this.data.label=t,this}setValue(t){return this.data.value=t,this}setDescription(t){return this.data.description=t,this}setDefault(t){return this.data.default=t,this}setEmoji(t){return this.data.emoji=t,this}toJSON(){return{...this.data}}};o(u,"UnsafeSelectMenuOption");var mt=k(require("fast-deep-equal")),R=class extends C{constructor(t){let{options:n,...r}=t??{};super({type:re.ComponentType.SelectMenu,...r});i(this,"options");this.options=n?.map(s=>new u(s))??[]}get placeholder(){return this.data.placeholder}get maxValues(){return this.data.max_values}get minValues(){return this.data.min_values}get customId(){return this.data.custom_id}get disabled(){return this.data.disabled}setPlaceholder(t){return this.data.placeholder=t,this}setMinValues(t){return this.data.min_values=t,this}setMaxValues(t){return this.data.max_values=t,this}setCustomId(t){return this.data.custom_id=t,this}setDisabled(t){return this.data.disabled=t,this}addOptions(...t){return this.options.push(...t.map(n=>n instanceof u?n:new u(n))),this}setOptions(...t){return this.options.splice(0,this.options.length,...t.map(n=>n instanceof u?n:new u(n))),this}toJSON(){return{...this.data,options:this.options.map(t=>t.toJSON())}}equals(t){return t instanceof R?(0,mt.default)(t.data,this.data)&&(0,mt.default)(t.options,this.options):(0,mt.default)(t,{...this.data,options:this.options.map(n=>n.toJSON())})}};o(R,"UnsafeSelectMenuComponent");var V=class extends R{setPlaceholder(t){return super.setPlaceholder(vt.parse(t))}setMinValues(t){return super.setMinValues(at.parse(t))}setMaxValues(t){return super.setMaxValues(at.parse(t))}setCustomId(t){return super.setCustomId(D.parse(t))}setDisabled(t){return super.setDisabled(G.parse(t))}toJSON(){return Rt(this.options,this.customId),super.toJSON()}};o(V,"SelectMenuComponent");var Vt=class extends u{setDescription(t){return super.setDescription(z.parse(t))}setDefault(t){return super.setDefault(Et.parse(t))}setEmoji(t){return super.setEmoji(j.parse(t))}toJSON(){return wt(this.label,this.value),super.toJSON()}};o(Vt,"SelectMenuOption");var Jt={};q(Jt,{assertReturnOfBuilder:()=>S,validateDefaultPermission:()=>_t,validateDescription:()=>ut,validateMaxChoicesLength:()=>Ut,validateMaxOptionsLength:()=>f,validateName:()=>dt,validateRequired:()=>ct,validateRequiredParameters:()=>O});var lt=k(require("@sindresorhus/is")),W=require("zod"),eo=W.z.string().min(1).max(32).regex(/^[\P{Lu}\p{N}_-]+$/u);function dt(e){eo.parse(e)}o(dt,"validateName");var oo=W.z.string().min(1).max(100);function ut(e){oo.parse(e)}o(ut,"validateDescription");var ae=W.z.unknown().array().max(25);function f(e){ae.parse(e)}o(f,"validateMaxOptionsLength");function O(e,t,n){dt(e),ut(t),f(n)}o(O,"validateRequiredParameters");var se=W.z.boolean();function _t(e){se.parse(e)}o(_t,"validateDefaultPermission");function ct(e){se.parse(e)}o(ct,"validateRequired");function Ut(e){ae.parse(e)}o(Ut,"validateMaxChoicesLength");function S(e,t){let n=t.name;if(lt.default.nullOrUndefined(e))throw new TypeError(`Expected to receive a ${n} builder, got ${e===null?"null":"undefined"} instead.`);if(lt.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=lt.default.function_(e)?e.name:r.constructor.name,x=Reflect.get(r,Symbol.toStringTag),T=x?`${s} [${x}]`:s;throw new TypeError(`Expected to receive a ${n} builder, got ${T} instead.`)}}o(S,"assertReturnOfBuilder");var ve=require("ts-mixer");var pe=require("discord-api-types/v9");var A=class{constructor(){i(this,"name");i(this,"description")}setName(t){return dt(t),Reflect.set(this,"name",t),this}setDescription(t){return ut(t),Reflect.set(this,"description",t),this}};o(A,"SharedNameAndDescription");var p=class extends A{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 Z=class extends p{constructor(){super(...arguments);i(this,"type",pe.ApplicationCommandOptionType.Boolean)}toJSON(){return this.runRequiredValidations(),{...this}}};o(Z,"SlashCommandBooleanOption");var me=require("discord-api-types/v9"),le=require("ts-mixer");var c=require("discord-api-types/v9"),Ft=require("zod"),no=[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],io=Ft.z.union(no.map(e=>Ft.z.literal(e))),ht=class{constructor(){i(this,"channel_types")}addChannelType(t){return this.channel_types===void 0&&Reflect.set(this,"channel_types",[]),io.parse(t),this.channel_types.push(t),this}addChannelTypes(t){return t.forEach(n=>this.addChannelType(n)),this}};o(ht,"ApplicationCommandOptionChannelTypesMixin");var E=class extends p{constructor(){super(...arguments);i(this,"type",me.ApplicationCommandOptionType.Channel)}toJSON(){return this.runRequiredValidations(),{...this}}};o(E,"SlashCommandChannelOption"),E=d([(0,le.mix)(ht)],E);var he=require("discord-api-types/v9"),be=require("ts-mixer"),Ce=require("zod");var _=class{constructor(){i(this,"max_value");i(this,"min_value")}};o(_,"ApplicationCommandNumericOptionMinMaxValueMixin");var de=require("discord-api-types/v9"),U=require("zod");var bt=U.z.string().min(1).max(100),ue=U.z.number().gt(-1/0).lt(1/0),ce=U.z.object({name:bt,value:U.z.union([bt,ue])}).array(),ro=U.z.boolean(),P=class{constructor(){i(this,"choices");i(this,"autocomplete");i(this,"type")}addChoice(t){let{name:n,value:r}=t;if(this.autocomplete)throw new RangeError("Autocomplete and choices are mutually exclusive to each other.");return this.choices===void 0&&Reflect.set(this,"choices",[]),Ut(this.choices),bt.parse(n),this.type===de.ApplicationCommandOptionType.String?bt.parse(r):ue.parse(r),this.choices.push({name:n,value:r}),this}addChoices(...t){if(this.autocomplete)throw new RangeError("Autocomplete and choices are mutually exclusive to each other.");ce.parse(t);for(let n of t)this.addChoice(n);return this}setChoices(...t){if(t.length>0&&this.autocomplete)throw new RangeError("Autocomplete and choices are mutually exclusive to each other.");ce.parse(t),Reflect.set(this,"choices",[]);for(let n of t)this.addChoice(n);return this}setAutocomplete(t){if(ro.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 fe=Ce.z.number().int().nonnegative(),w=class extends p{constructor(){super(...arguments);i(this,"type",he.ApplicationCommandOptionType.Integer)}setMaxValue(t){return fe.parse(t),Reflect.set(this,"max_value",t),this}setMinValue(t){return fe.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,be.mix)(_,P)],w);var Ae=require("discord-api-types/v9");var K=class extends p{constructor(){super(...arguments);i(this,"type",Ae.ApplicationCommandOptionType.Mentionable)}toJSON(){return this.runRequiredValidations(),{...this}}};o(K,"SlashCommandMentionableOption");var xe=require("discord-api-types/v9"),ye=require("ts-mixer"),ge=require("zod");var Oe=ge.z.number().nonnegative(),B=class extends p{constructor(){super(...arguments);i(this,"type",xe.ApplicationCommandOptionType.Number)}setMaxValue(t){return Oe.parse(t),Reflect.set(this,"max_value",t),this}setMinValue(t){return Oe.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(B,"SlashCommandNumberOption"),B=d([(0,ye.mix)(_,P)],B);var Se=require("discord-api-types/v9");var Q=class extends p{constructor(){super(...arguments);i(this,"type",Se.ApplicationCommandOptionType.Role)}toJSON(){return this.runRequiredValidations(),{...this}}};o(Q,"SlashCommandRoleOption");var Pe=require("discord-api-types/v9");var H=class extends p{constructor(){super(...arguments);i(this,"type",Pe.ApplicationCommandOptionType.Attachment)}toJSON(){return this.runRequiredValidations(),{...this}}};o(H,"SlashCommandAttachmentOption");var Ie=require("discord-api-types/v9"),Te=require("ts-mixer");var N=class extends p{constructor(){super(...arguments);i(this,"type",Ie.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,Te.mix)(P)],N);var Me=require("discord-api-types/v9");var X=class extends p{constructor(){super(...arguments);i(this,"type",Me.ApplicationCommandOptionType.User)}toJSON(){return this.runRequiredValidations(),{...this}}};o(X,"SlashCommandUserOption");var J=class{constructor(){i(this,"options")}addBooleanOption(t){return this._sharedAddOptionMethod(t,Z)}addUserOption(t){return this._sharedAddOptionMethod(t,X)}addChannelOption(t){return this._sharedAddOptionMethod(t,E)}addRoleOption(t){return this._sharedAddOptionMethod(t,Q)}addAttachmentOption(t){return this._sharedAddOptionMethod(t,H)}addMentionableOption(t){return this._sharedAddOptionMethod(t,K)}addStringOption(t){return this._sharedAddOptionMethod(t,N)}addIntegerOption(t){return this._sharedAddOptionMethod(t,w)}addNumberOption(t){return this._sharedAddOptionMethod(t,B)}_sharedAddOptionMethod(t,n){let{options:r}=this;f(r);let s=typeof t=="function"?t(new n):t;return S(s,n),r.push(s),this}};o(J,"SharedSlashCommandOptions");var qt=require("discord-api-types/v9"),kt=require("ts-mixer");var I=class{constructor(){i(this,"name");i(this,"description");i(this,"options",[])}addSubcommand(t){let{options:n}=this;f(n);let r=typeof t=="function"?t(new h):t;return S(r,h),n.push(r),this}toJSON(){return O(this.name,this.description,this.options),{type:qt.ApplicationCommandOptionType.SubcommandGroup,name:this.name,description:this.description,options:this.options.map(t=>t.toJSON())}}};o(I,"SlashCommandSubcommandGroupBuilder"),I=d([(0,kt.mix)(A)],I);var h=class{constructor(){i(this,"name");i(this,"description");i(this,"options",[])}toJSON(){return O(this.name,this.description,this.options),{type:qt.ApplicationCommandOptionType.Subcommand,name:this.name,description:this.description,options:this.options.map(t=>t.toJSON())}}};o(h,"SlashCommandSubcommandBuilder"),h=d([(0,kt.mix)(A,J)],h);var Y=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 _t(t),Reflect.set(this,"defaultPermission",t),this}addSubcommandGroup(t){let{options:n}=this;f(n);let r=typeof t=="function"?t(new I):t;return S(r,I),n.push(r),this}addSubcommand(t){let{options:n}=this;f(n);let r=typeof t=="function"?t(new h):t;return S(r,h),n.push(r),this}};o(Y,"SlashCommandBuilder"),Y=d([(0,ve.mix)(J,A)],Y);var Wt={};q(Wt,{validateDefaultPermission:()=>Gt,validateName:()=>Ct,validateRequiredParameters:()=>zt,validateType:()=>ft});var F=require("zod"),jt=require("discord-api-types/v9"),ao=F.z.string().min(1).max(32).regex(/^( *[\p{L}\p{N}_-]+ *)+$/u),so=F.z.union([F.z.literal(jt.ApplicationCommandType.User),F.z.literal(jt.ApplicationCommandType.Message)]),po=F.z.boolean();function Gt(e){po.parse(e)}o(Gt,"validateDefaultPermission");function Ct(e){ao.parse(e)}o(Ct,"validateName");function ft(e){so.parse(e)}o(ft,"validateType");function zt(e,t){Ct(e),ft(t)}o(zt,"validateRequiredParameters");var Zt=class{constructor(){i(this,"name");i(this,"type");i(this,"defaultPermission")}setName(t){return Ct(t),Reflect.set(this,"name",t),this}setType(t){return ft(t),Reflect.set(this,"type",t),this}setDefaultPermission(t){return Gt(t),Reflect.set(this,"defaultPermission",t),this}toJSON(){return zt(this.name,this.type),{name:this.name,type:this.type,default_permission:this.defaultPermission}}};o(Zt,"ContextMenuCommandBuilder");function mo(e){return e!==null&&typeof e=="object"&&"toJSON"in e}o(mo,"isJSONEncodable");module.exports=Le(lo);0&&(module.exports={ActionRow,ButtonComponent,Component,ComponentAssertions,ContextMenuCommandAssertions,ContextMenuCommandBuilder,Embed,EmbedAssertions,Faces,SelectMenuComponent,SelectMenuOption,SlashCommandAssertions,SlashCommandAttachmentOption,SlashCommandBooleanOption,SlashCommandBuilder,SlashCommandChannelOption,SlashCommandIntegerOption,SlashCommandMentionableOption,SlashCommandNumberOption,SlashCommandRoleOption,SlashCommandStringOption,SlashCommandSubcommandBuilder,SlashCommandSubcommandGroupBuilder,SlashCommandUserOption,TimestampStyles,UnsafeButtonComponent,UnsafeEmbed,UnsafeSelectMenuComponent,UnsafeSelectMenuOption,blockQuote,bold,channelMention,codeBlock,createComponent,formatEmoji,hideLinkEmbed,hyperlink,inlineCode,isJSONEncodable,italic,memberNicknameMention,quote,roleMention,spoiler,strikethrough,time,underscore,userMention});
|
|
4
4
|
//# sourceMappingURL=index.js.map
|