@discordjs/builders 0.13.0-dev.1648123730.b520c3d → 0.13.0-dev.1648166909.cedd053
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 +90 -3
- 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 +1 -1
package/dist/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var
|
|
1
|
+
var F=Object.defineProperty;var Se=Object.getOwnPropertyDescriptor;var Pe=(e,t,n)=>t in e?F(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var o=(e,t)=>F(e,"name",{value:t,configurable:!0});var R=(e,t)=>{for(var n in t)F(e,n,{get:t[n],enumerable:!0})};var c=(e,t,n,r)=>{for(var p=r>1?void 0:r?Se(t,n):t,T=e.length-1,D;T>=0;T--)(D=e[T])&&(p=(r?D(t,n,p):D(p))||p);return r&&p&&F(t,n,p),p};var i=(e,t,n)=>(Pe(e,typeof t!="symbol"?t+"":t,n),n);var te={};R(te,{RGBPredicate:()=>Z,authorNamePredicate:()=>yt,colorPredicate:()=>Ot,descriptionPredicate:()=>gt,embedFieldPredicate:()=>Xt,embedFieldsArrayPredicate:()=>W,fieldInlinePredicate:()=>Ht,fieldLengthPredicate:()=>Yt,fieldNamePredicate:()=>G,fieldValuePredicate:()=>Qt,footerTextPredicate:()=>St,timestampPredicate:()=>Pt,titlePredicate:()=>It,urlPredicate:()=>O,validateFieldLength:()=>z});import{z as u}from"zod";var G=u.string().min(1).max(256),Qt=u.string().min(1).max(1024),Ht=u.boolean().optional(),Xt=u.object({name:G,value:Qt,inline:Ht}),W=Xt.array(),Yt=u.number().lte(25);function z(e,t){Yt.parse((t?.length??0)+e)}o(z,"validateFieldLength");var yt=G.nullable(),O=u.string().url().nullish(),Z=u.number().int().gte(0).lte(255),Ot=u.number().int().gte(0).lte(16777215).nullable().or(u.tuple([Z,Z,Z])),gt=u.string().min(1).max(4096).nullable(),St=u.string().min(1).max(2048).nullable(),Pt=u.union([u.number(),u.date()]).nullable(),It=G.nullable();var K=class{constructor(t={}){i(this,"data");this.data={...t},t.timestamp&&(this.data.timestamp=new Date(t.timestamp).toISOString())}addFields(...t){return this.data.fields?this.data.fields.push(...t):this.data.fields=t,this}spliceFields(t,n,...r){return this.data.fields?this.data.fields.splice(t,n,...r):this.data.fields=r,this}setFields(...t){return this.spliceFields(0,this.data.fields?.length??0,...t),this}setAuthor(t){return t===null?(this.data.author=void 0,this):(this.data.author={name:t.name,url:t.url,icon_url:t.iconURL},this)}setColor(t){if(Array.isArray(t)){let[n,r,p]=t;return this.data.color=(n<<16)+(r<<8)+p,this}return this.data.color=t??void 0,this}setDescription(t){return this.data.description=t??void 0,this}setFooter(t){return t===null?(this.data.footer=void 0,this):(this.data.footer={text:t.text,icon_url:t.iconURL},this)}setImage(t){return this.data.image=t?{url:t}:void 0,this}setThumbnail(t){return this.data.thumbnail=t?{url:t}:void 0,this}setTimestamp(t=Date.now()){return this.data.timestamp=t?new Date(t).toISOString():void 0,this}setTitle(t){return this.data.title=t??void 0,this}setURL(t){return this.data.url=t??void 0,this}toJSON(){return{...this.data}}};o(K,"UnsafeEmbedBuilder");var ee=class extends K{addFields(...t){return z(t.length,this.data.fields),super.addFields(...W.parse(t))}spliceFields(t,n,...r){return z(r.length-n,this.data.fields),super.spliceFields(t,n,...W.parse(r))}setAuthor(t){return t===null?super.setAuthor(null):(yt.parse(t.name),O.parse(t.iconURL),O.parse(t.url),super.setAuthor(t))}setColor(t){return super.setColor(Ot.parse(t))}setDescription(t){return super.setDescription(gt.parse(t))}setFooter(t){return t===null?super.setFooter(null):(St.parse(t.text),O.parse(t.iconURL),super.setFooter(t))}setImage(t){return super.setImage(O.parse(t))}setThumbnail(t){return super.setThumbnail(O.parse(t))}setTimestamp(t=Date.now()){return super.setTimestamp(Pt.parse(t))}setTitle(t){return super.setTitle(It.parse(t))}setURL(t){return super.setURL(O.parse(t))}};o(ee,"EmbedBuilder");function ho(e,t){return typeof t=="undefined"?`\`\`\`
|
|
2
2
|
${e}\`\`\``:`\`\`\`${e}
|
|
3
|
-
${t}\`\`\``}o(lo,"codeBlock");function uo(e){return`\`${e}\``}o(uo,"inlineCode");function co(e){return`_${e}_`}o(co,"italic");function ho(e){return`**${e}**`}o(ho,"bold");function Co(e){return`__${e}__`}o(Co,"underscore");function bo(e){return`~~${e}~~`}o(bo,"strikethrough");function fo(e){return`> ${e}`}o(fo,"quote");function Ao(e){return`>>> ${e}`}o(Ao,"blockQuote");function xo(e){return`<${e}>`}o(xo,"hideLinkEmbed");function yo(e,t,n){return n?`[${e}](${t} "${n}")`:`[${e}](${t})`}o(yo,"hyperlink");function go(e){return`||${e}||`}o(go,"spoiler");function Oo(e){return`<@${e}>`}o(Oo,"userMention");function So(e){return`<@!${e}>`}o(So,"memberNicknameMention");function Po(e){return`<#${e}>`}o(Po,"channelMention");function Io(e){return`<@&${e}>`}o(Io,"roleMention");function Mo(e,t=!1){return`<${t?"a":""}:_:${e}>`}o(Mo,"formatEmoji");function To(e,t){return typeof e!="number"&&(e=Math.floor((e?.getTime()??Date.now())/1e3)),typeof t=="string"?`<t:${e}:${t}>`:`<t:${e}>`}o(To,"time");var Ro={ShortTime:"t",LongTime:"T",ShortDate:"d",LongDate:"D",ShortDateTime:"f",LongDateTime:"F",RelativeTime:"R"},Oe=(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))(Oe||{});var te={};R(te,{buttonLabelValidator:()=>Pt,buttonStyleValidator:()=>It,customIdValidator:()=>c,defaultValidator:()=>Rt,disabledValidator:()=>_,emojiValidator:()=>D,labelValueValidator:()=>J,minMaxValidator:()=>K,optionsValidator:()=>Yt,placeholderValidator:()=>Mt,urlValidator:()=>wt,validateRequiredButtonParameters:()=>vt,validateRequiredSelectMenuOptionParameters:()=>Bt,validateRequiredSelectMenuParameters:()=>Tt});import{ButtonStyle as St}from"discord-api-types/v10";import{z as d}from"zod";var c=d.string().min(1).max(100),D=d.object({id:d.string(),name:d.string(),animated:d.boolean()}).partial().strict(),_=d.boolean(),Pt=d.string().nonempty().max(80),It=d.number().int().min(St.Primary).max(St.Link),Mt=d.string().max(150),K=d.number().int().min(0).max(25),Yt=d.object({}).array().nonempty();function Tt(e,t){c.parse(t),Yt.parse(e)}o(Tt,"validateRequiredSelectMenuParameters");var J=d.string().min(1).max(100),Rt=d.boolean();function Bt(e,t){J.parse(e),J.parse(t)}o(Bt,"validateRequiredSelectMenuOptionParameters");var wt=d.string().url();function vt(e,t,n,r,p){if(p&&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===St.Link){if(!p)throw new RangeError("Link buttons must have a url")}else if(p)throw new RangeError("Non-link buttons cannot have a url")}o(vt,"validateRequiredButtonParameters");import{ComponentType as Se}from"discord-api-types/v10";var h=class{constructor(t){i(this,"data");this.data=t}};o(h,"ComponentBuilder");import{ComponentType as Q}from"discord-api-types/v10";function H(e){if(e instanceof h)return e;switch(e.type){case Q.ActionRow:return new b(e);case Q.Button:return new X(e);case Q.SelectMenu:return new tt(e);case Q.TextInput:return new Y(e);default:throw new Error(`Cannot properly serialize component type: ${e.type}`)}}o(H,"createComponentBuilder");var b=class extends h{constructor({components:t,...n}={}){super({type:Se.ActionRow,...n});i(this,"components");this.components=t?.map(r=>H(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,"ActionRowBuilder");import{ComponentType as Pe}from"discord-api-types/v10";var et=class extends h{constructor(t){super({type:Pe.Button,...t})}setStyle(t){return this.data.style=t,this}setURL(t){return this.data.url=t,this}setCustomId(t){return this.data.custom_id=t,this}setEmoji(t){return this.data.emoji=t,this}setDisabled(t=!0){return this.data.disabled=t,this}setLabel(t){return this.data.label=t,this}toJSON(){return{...this.data}}};o(et,"UnsafeButtonBuilder");var X=class extends et{setStyle(t){return super.setStyle(It.parse(t))}setURL(t){return super.setURL(wt.parse(t))}setCustomId(t){return super.setCustomId(c.parse(t))}setEmoji(t){return super.setEmoji(D.parse(t))}setDisabled(t=!0){return super.setDisabled(_.parse(t))}setLabel(t){return super.setLabel(Pt.parse(t))}toJSON(){return vt(this.data.style,this.data.label,this.data.emoji,this.data.custom_id,this.data.url),super.toJSON()}};o(X,"ButtonBuilder");var ne={};R(ne,{labelValidator:()=>oe,maxLengthValidator:()=>Et,minLengthValidator:()=>Nt,placeholderValidator:()=>Lt,requiredValidator:()=>Vt,textInputStyleValidator:()=>ee,validateRequiredParameters:()=>Dt,valueValidator:()=>$t});import{TextInputStyle as Ie}from"discord-api-types/v10";import{z as I}from"zod";var ee=I.nativeEnum(Ie),Nt=I.number().int().min(0).max(4e3),Et=I.number().int().min(1).max(4e3),Vt=I.boolean(),$t=I.string().max(4e3),Lt=I.string().max(100),oe=I.string().min(1).max(45);function Dt(e,t,n){c.parse(e),ee.parse(t),oe.parse(n)}o(Dt,"validateRequiredParameters");import{ComponentType as Me}from"discord-api-types/v10";import ie from"fast-deep-equal";var B=class extends h{constructor(t){super({type:Me.TextInput,...t})}setCustomId(t){return this.data.custom_id=t,this}setLabel(t){return this.data.label=t,this}setStyle(t){return this.data.style=t,this}setMinLength(t){return this.data.min_length=t,this}setMaxLength(t){return this.data.max_length=t,this}setPlaceholder(t){return this.data.placeholder=t,this}setValue(t){return this.data.value=t,this}setRequired(t=!0){return this.data.required=t,this}toJSON(){return{...this.data}}equals(t){return t instanceof B?ie(t.data,this.data):ie(t,this.data)}};o(B,"UnsafeTextInputBuilder");var Y=class extends B{setMinLength(t){return super.setMinLength(Nt.parse(t))}setMaxLength(t){return super.setMaxLength(Et.parse(t))}setRequired(t=!0){return super.setRequired(Vt.parse(t))}setValue(t){return super.setValue($t.parse(t))}setPlaceholder(t){return super.setPlaceholder(Lt.parse(t))}toJSON(){return Dt(this.data.custom_id,this.data.style,this.data.label),super.toJSON()}};o(Y,"TextInputBuilder");var ot=class{constructor({components:t,...n}={}){i(this,"data");i(this,"components",[]);this.data={...n},this.components=t?.map(r=>H(r))??[]}setTitle(t){return this.data.title=t,this}setCustomId(t){return this.data.custom_id=t,this}addComponents(...t){return this.components.push(...t.map(n=>n instanceof b?n:new b(n))),this}setComponents(...t){return this.components.splice(0,this.components.length,...t),this}toJSON(){return{...this.data,components:this.components.map(t=>t.toJSON())}}};o(ot,"UnsafeModalBuilder");var ae={};R(ae,{componentsValidator:()=>re,titleValidator:()=>nt,validateRequiredParameters:()=>Jt});import{z as _t}from"zod";var nt=_t.string().min(1).max(45),re=_t.array(_t.instanceof(b)).min(1);function Jt(e,t,n){c.parse(e),nt.parse(t),re.parse(n)}o(Jt,"validateRequiredParameters");var se=class extends ot{setCustomId(t){return super.setCustomId(c.parse(t))}setTitle(t){return super.setTitle(nt.parse(t))}toJSON(){return Jt(this.data.custom_id,this.data.title,this.components),super.toJSON()}};o(se,"ModalBuilder");import{ComponentType as Te}from"discord-api-types/v10";var C=class{constructor(t={}){this.data=t}setLabel(t){return this.data.label=t,this}setValue(t){return this.data.value=t,this}setDescription(t){return this.data.description=t,this}setDefault(t=!0){return this.data.default=t,this}setEmoji(t){return this.data.emoji=t,this}toJSON(){return{...this.data}}};o(C,"UnsafeSelectMenuOptionBuilder");var it=class extends h{constructor(t){let{options:n,...r}=t??{};super({type:Te.SelectMenu,...r});i(this,"options");this.options=n?.map(p=>new C(p))??[]}setPlaceholder(t){return this.data.placeholder=t,this}setMinValues(t){return this.data.min_values=t,this}setMaxValues(t){return this.data.max_values=t,this}setCustomId(t){return this.data.custom_id=t,this}setDisabled(t=!0){return this.data.disabled=t,this}addOptions(...t){return this.options.push(...t.map(n=>n instanceof C?n:new C(n))),this}setOptions(...t){return this.options.splice(0,this.options.length,...t.map(n=>n instanceof C?n:new C(n))),this}toJSON(){return{...this.data,options:this.options.map(t=>t.toJSON())}}};o(it,"UnsafeSelectMenuBuilder");var tt=class extends it{setPlaceholder(t){return super.setPlaceholder(Mt.parse(t))}setMinValues(t){return super.setMinValues(K.parse(t))}setMaxValues(t){return super.setMaxValues(K.parse(t))}setCustomId(t){return super.setCustomId(c.parse(t))}setDisabled(t=!0){return super.setDisabled(_.parse(t))}toJSON(){return Tt(this.options,this.data.custom_id),super.toJSON()}};o(tt,"SelectMenuBuilder");var pe=class extends C{setDescription(t){return super.setDescription(J.parse(t))}setDefault(t=!0){return super.setDefault(Rt.parse(t))}setEmoji(t){return super.setEmoji(D.parse(t))}toJSON(){return Bt(this.data.label,this.data.value),super.toJSON()}};o(pe,"SelectMenuOptionBuilder");var le={};R(le,{assertReturnOfBuilder:()=>S,validateChoicesLength:()=>qt,validateDefaultPermission:()=>Ut,validateDescription:()=>at,validateMaxOptionsLength:()=>f,validateName:()=>rt,validateRequired:()=>st,validateRequiredParameters:()=>O});import kt from"@sindresorhus/is";import{z as k}from"zod";var Re=k.string().min(1).max(32).regex(/^[\P{Lu}\p{N}_-]+$/u);function rt(e){Re.parse(e)}o(rt,"validateName");var Be=k.string().min(1).max(100);function at(e){Be.parse(e)}o(at,"validateDescription");var we=k.unknown().array().max(25);function f(e){we.parse(e)}o(f,"validateMaxOptionsLength");function O(e,t,n){rt(e),at(t),f(n)}o(O,"validateRequiredParameters");var me=k.boolean();function Ut(e){me.parse(e)}o(Ut,"validateDefaultPermission");function st(e){me.parse(e)}o(st,"validateRequired");var ve=k.number().lte(25);function qt(e,t){ve.parse((t?.length??0)+e)}o(qt,"validateChoicesLength");function S(e,t){let n=t.name;if(kt.nullOrUndefined(e))throw new TypeError(`Expected to receive a ${n} builder, got ${e===null?"null":"undefined"} instead.`);if(kt.primitive(e))throw new TypeError(`Expected to receive a ${n} builder, got a primitive (${typeof e}) instead.`);if(!(e instanceof t)){let r=e,p=kt.function_(e)?e.name:r.constructor.name,T=Reflect.get(r,Symbol.toStringTag),L=T?`${p} [${T}]`:p;throw new TypeError(`Expected to receive a ${n} builder, got ${L} instead.`)}}o(S,"assertReturnOfBuilder");import{mix as He}from"ts-mixer";import{ApplicationCommandOptionType as Ne}from"discord-api-types/v10";var A=class{constructor(){i(this,"name");i(this,"description")}setName(t){return rt(t),Reflect.set(this,"name",t),this}setDescription(t){return at(t),Reflect.set(this,"description",t),this}};o(A,"SharedNameAndDescription");var m=class extends A{constructor(){super(...arguments);i(this,"required",!1)}setRequired(t){return st(t),Reflect.set(this,"required",t),this}runRequiredValidations(){O(this.name,this.description,[]),st(this.required)}};o(m,"ApplicationCommandOptionBase");var pt=class extends m{constructor(){super(...arguments);i(this,"type",Ne.Boolean)}toJSON(){return this.runRequiredValidations(),{...this}}};o(pt,"SlashCommandBooleanOption");import{ApplicationCommandOptionType as $e}from"discord-api-types/v10";import{mix as Le}from"ts-mixer";import{ChannelType as x}from"discord-api-types/v10";import{z as jt}from"zod";var Ee=[x.GuildText,x.GuildVoice,x.GuildCategory,x.GuildNews,x.GuildStore,x.GuildNewsThread,x.GuildPublicThread,x.GuildPrivateThread,x.GuildStageVoice],Ve=jt.array(jt.union(Ee.map(e=>jt.literal(e)))),mt=class{constructor(){i(this,"channel_types")}addChannelTypes(...t){return this.channel_types===void 0&&Reflect.set(this,"channel_types",[]),Ve.parse(t),this.channel_types.push(...t),this}};o(mt,"ApplicationCommandOptionChannelTypesMixin");var w=class extends m{constructor(){super(...arguments);i(this,"type",$e.Channel)}toJSON(){return this.runRequiredValidations(),{...this}}};o(w,"SlashCommandChannelOption"),w=u([Le(mt)],w);import{ApplicationCommandOptionType as Je}from"discord-api-types/v10";import{mix as ke}from"ts-mixer";import{z as Ue}from"zod";var v=class{constructor(){i(this,"max_value");i(this,"min_value")}};o(v,"ApplicationCommandNumericOptionMinMaxValueMixin");import{ApplicationCommandOptionType as De}from"discord-api-types/v10";import{z as U}from"zod";var Ft=U.string().min(1).max(100),de=U.number().gt(-1/0).lt(1/0),ue=U.object({name:Ft,value:U.union([Ft,de])}).array(),_e=U.boolean(),P=class{constructor(){i(this,"choices");i(this,"autocomplete");i(this,"type")}addChoices(...t){if(t.length>0&&this.autocomplete)throw new RangeError("Autocomplete and choices are mutually exclusive to each other.");ue.parse(t),this.choices===void 0&&Reflect.set(this,"choices",[]),qt(t.length,this.choices);for(let{name:n,value:r}of t)this.type===De.String?Ft.parse(r):de.parse(r),this.choices.push({name:n,value:r});return this}setChoices(...t){if(t.length>0&&this.autocomplete)throw new RangeError("Autocomplete and choices are mutually exclusive to each other.");return ue.parse(t),Reflect.set(this,"choices",[]),this.addChoices(...t),this}setAutocomplete(t){if(_e.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 ce=Ue.number().int(),N=class extends m{constructor(){super(...arguments);i(this,"type",Je.Integer)}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(N,"SlashCommandIntegerOption"),N=u([ke(v,P)],N);import{ApplicationCommandOptionType as qe}from"discord-api-types/v10";var lt=class extends m{constructor(){super(...arguments);i(this,"type",qe.Mentionable)}toJSON(){return this.runRequiredValidations(),{...this}}};o(lt,"SlashCommandMentionableOption");import{ApplicationCommandOptionType as je}from"discord-api-types/v10";import{mix as Fe}from"ts-mixer";import{z as Ge}from"zod";var he=Ge.number(),E=class extends m{constructor(){super(...arguments);i(this,"type",je.Number)}setMaxValue(t){return he.parse(t),Reflect.set(this,"max_value",t),this}setMinValue(t){return he.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(E,"SlashCommandNumberOption"),E=u([Fe(v,P)],E);import{ApplicationCommandOptionType as We}from"discord-api-types/v10";var dt=class extends m{constructor(){super(...arguments);i(this,"type",We.Role)}toJSON(){return this.runRequiredValidations(),{...this}}};o(dt,"SlashCommandRoleOption");import{ApplicationCommandOptionType as ze}from"discord-api-types/v10";var ut=class extends m{constructor(){super(...arguments);i(this,"type",ze.Attachment)}toJSON(){return this.runRequiredValidations(),{...this}}};o(ut,"SlashCommandAttachmentOption");import{ApplicationCommandOptionType as Ze}from"discord-api-types/v10";import{mix as Ke}from"ts-mixer";var V=class extends m{constructor(){super(...arguments);i(this,"type",Ze.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=u([Ke(P)],V);import{ApplicationCommandOptionType as Qe}from"discord-api-types/v10";var ct=class extends m{constructor(){super(...arguments);i(this,"type",Qe.User)}toJSON(){return this.runRequiredValidations(),{...this}}};o(ct,"SlashCommandUserOption");var $=class{constructor(){i(this,"options")}addBooleanOption(t){return this._sharedAddOptionMethod(t,pt)}addUserOption(t){return this._sharedAddOptionMethod(t,ct)}addChannelOption(t){return this._sharedAddOptionMethod(t,w)}addRoleOption(t){return this._sharedAddOptionMethod(t,dt)}addAttachmentOption(t){return this._sharedAddOptionMethod(t,ut)}addMentionableOption(t){return this._sharedAddOptionMethod(t,lt)}addStringOption(t){return this._sharedAddOptionMethod(t,V)}addIntegerOption(t){return this._sharedAddOptionMethod(t,N)}addNumberOption(t){return this._sharedAddOptionMethod(t,E)}_sharedAddOptionMethod(t,n){let{options:r}=this;f(r);let p=typeof t=="function"?t(new n):t;return S(p,n),r.push(p),this}};o($,"SharedSlashCommandOptions");import{ApplicationCommandOptionType as Ce}from"discord-api-types/v10";import{mix as be}from"ts-mixer";var M=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 y):t;return S(r,y),n.push(r),this}toJSON(){return O(this.name,this.description,this.options),{type:Ce.SubcommandGroup,name:this.name,description:this.description,options:this.options.map(t=>t.toJSON())}}};o(M,"SlashCommandSubcommandGroupBuilder"),M=u([be(A)],M);var y=class{constructor(){i(this,"name");i(this,"description");i(this,"options",[])}toJSON(){return O(this.name,this.description,this.options),{type:Ce.Subcommand,name:this.name,description:this.description,options:this.options.map(t=>t.toJSON())}}};o(y,"SlashCommandSubcommandBuilder"),y=u([be(A,$)],y);var ht=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 Ut(t),Reflect.set(this,"defaultPermission",t),this}addSubcommandGroup(t){let{options:n}=this;f(n);let r=typeof t=="function"?t(new M):t;return S(r,M),n.push(r),this}addSubcommand(t){let{options:n}=this;f(n);let r=typeof t=="function"?t(new y):t;return S(r,y),n.push(r),this}};o(ht,"SlashCommandBuilder"),ht=u([He($,A)],ht);var Ae={};R(Ae,{validateDefaultPermission:()=>Gt,validateName:()=>Ct,validateRequiredParameters:()=>Wt,validateType:()=>bt});import{z as q}from"zod";import{ApplicationCommandType as fe}from"discord-api-types/v10";var Xe=q.string().min(1).max(32).regex(/^( *[\p{L}\p{N}_-]+ *)+$/u),Ye=q.union([q.literal(fe.User),q.literal(fe.Message)]),to=q.boolean();function Gt(e){to.parse(e)}o(Gt,"validateDefaultPermission");function Ct(e){Xe.parse(e)}o(Ct,"validateName");function bt(e){Ye.parse(e)}o(bt,"validateType");function Wt(e,t){Ct(e),bt(t)}o(Wt,"validateRequiredParameters");var xe=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 bt(t),Reflect.set(this,"type",t),this}setDefaultPermission(t){return Gt(t),Reflect.set(this,"defaultPermission",t),this}toJSON(){return Wt(this.name,this.type),{name:this.name,type:this.type,default_permission:this.defaultPermission}}};o(xe,"ContextMenuCommandBuilder");function Ar(e){return e!==null&&typeof e=="object"&&"toJSON"in e}o(Ar,"isJSONEncodable");function yr(e){return e!==null&&typeof e=="object"&&"equals"in e}o(yr,"isEquatable");function Or(e){return(e.title?.length??0)+(e.description?.length??0)+(e.fields?.reduce((t,n)=>t+n.name.length+n.value.length,0)??0)+(e.footer?.text.length??0)+(e.author?.name.length??0)}o(Or,"embedLength");export{b as ActionRowBuilder,X as ButtonBuilder,te as ComponentAssertions,h as ComponentBuilder,Ae as ContextMenuCommandAssertions,xe as ContextMenuCommandBuilder,Ht as EmbedAssertions,Xt as EmbedBuilder,Oe as Faces,ae as ModalAssertions,se as ModalBuilder,tt as SelectMenuBuilder,pe as SelectMenuOptionBuilder,le as SlashCommandAssertions,ut as SlashCommandAttachmentOption,pt as SlashCommandBooleanOption,ht as SlashCommandBuilder,w as SlashCommandChannelOption,N as SlashCommandIntegerOption,lt as SlashCommandMentionableOption,E as SlashCommandNumberOption,dt as SlashCommandRoleOption,V as SlashCommandStringOption,y as SlashCommandSubcommandBuilder,M as SlashCommandSubcommandGroupBuilder,ct as SlashCommandUserOption,ne as TextInputAssertions,Y as TextInputBuilder,Ro as TimestampStyles,et as UnsafeButtonBuilder,Z as UnsafeEmbedBuilder,ot as UnsafeModalBuilder,it as UnsafeSelectMenuBuilder,C as UnsafeSelectMenuOptionBuilder,B as UnsafeTextInputBuilder,Ao as blockQuote,ho as bold,Po as channelMention,lo as codeBlock,H as createComponentBuilder,Or as embedLength,Mo as formatEmoji,xo as hideLinkEmbed,yo as hyperlink,uo as inlineCode,yr as isEquatable,Ar as isJSONEncodable,co as italic,So as memberNicknameMention,fo as quote,Io as roleMention,go as spoiler,bo as strikethrough,To as time,Co as underscore,Oo as userMention};
|
|
3
|
+
${t}\`\`\``}o(ho,"codeBlock");function bo(e){return`\`${e}\``}o(bo,"inlineCode");function Co(e){return`_${e}_`}o(Co,"italic");function fo(e){return`**${e}**`}o(fo,"bold");function Ao(e){return`__${e}__`}o(Ao,"underscore");function xo(e){return`~~${e}~~`}o(xo,"strikethrough");function yo(e){return`> ${e}`}o(yo,"quote");function Oo(e){return`>>> ${e}`}o(Oo,"blockQuote");function go(e){return`<${e}>`}o(go,"hideLinkEmbed");function So(e,t,n){return n?`[${e}](${t} "${n}")`:`[${e}](${t})`}o(So,"hyperlink");function Po(e){return`||${e}||`}o(Po,"spoiler");function Io(e){return`<@${e}>`}o(Io,"userMention");function Mo(e){return`<@!${e}>`}o(Mo,"memberNicknameMention");function To(e){return`<#${e}>`}o(To,"channelMention");function Ro(e){return`<@&${e}>`}o(Ro,"roleMention");function Bo(e,t=!1){return`<${t?"a":""}:_:${e}>`}o(Bo,"formatEmoji");function wo(e,t){return typeof e!="number"&&(e=Math.floor((e?.getTime()??Date.now())/1e3)),typeof t=="string"?`<t:${e}:${t}>`:`<t:${e}>`}o(wo,"time");var vo={ShortTime:"t",LongTime:"T",ShortDate:"d",LongDate:"D",ShortDateTime:"f",LongDateTime:"F",RelativeTime:"R"},Ie=(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))(Ie||{});var ne={};R(ne,{buttonLabelValidator:()=>Tt,buttonStyleValidator:()=>Rt,customIdValidator:()=>h,defaultValidator:()=>vt,disabledValidator:()=>_,emojiValidator:()=>B,labelValueDescriptionValidator:()=>H,labelValueValidator:()=>k,minMaxValidator:()=>Q,optionValidator:()=>J,optionsLengthValidator:()=>X,optionsValidator:()=>oe,placeholderValidator:()=>Bt,urlValidator:()=>Et,validateRequiredButtonParameters:()=>Vt,validateRequiredSelectMenuOptionParameters:()=>Nt,validateRequiredSelectMenuParameters:()=>wt});import{ButtonStyle as Mt}from"discord-api-types/v10";import{z as l}from"zod";var d=class{constructor(t={}){this.data=t}setLabel(t){return this.data.label=t,this}setValue(t){return this.data.value=t,this}setDescription(t){return this.data.description=t,this}setDefault(t=!0){return this.data.default=t,this}setEmoji(t){return this.data.emoji=t,this}toJSON(){return{...this.data}}};o(d,"UnsafeSelectMenuOptionBuilder");var h=l.string().min(1).max(100),B=l.object({id:l.string(),name:l.string(),animated:l.boolean()}).partial().strict(),_=l.boolean(),Tt=l.string().nonempty().max(80),Rt=l.number().int().min(Mt.Primary).max(Mt.Link),Bt=l.string().max(150),Q=l.number().int().min(0).max(25),H=l.string().min(1).max(100),J=l.union([l.object({label:H,value:H,description:H.optional(),emoji:B.optional(),default:l.boolean().optional()}),l.instanceof(d)]),oe=J.array().nonempty(),X=l.number().int().min(0).max(25);function wt(e,t){h.parse(t),oe.parse(e)}o(wt,"validateRequiredSelectMenuParameters");var k=l.string().min(1).max(100),vt=l.boolean();function Nt(e,t){k.parse(e),k.parse(t)}o(Nt,"validateRequiredSelectMenuOptionParameters");var Et=l.string().url();function Vt(e,t,n,r,p){if(p&&r)throw new RangeError("URL and custom id are mutually exclusive");if(!t&&!n)throw new RangeError("Buttons must have a label and/or an emoji");if(e===Mt.Link){if(!p)throw new RangeError("Link buttons must have a url")}else if(p)throw new RangeError("Non-link buttons cannot have a url")}o(Vt,"validateRequiredButtonParameters");import{ComponentType as Me}from"discord-api-types/v10";var b=class{constructor(t){i(this,"data");this.data=t}};o(b,"ComponentBuilder");import{ComponentType as Y}from"discord-api-types/v10";function tt(e){if(e instanceof b)return e;switch(e.type){case Y.ActionRow:return new C(e);case Y.Button:return new et(e);case Y.SelectMenu:return new nt(e);case Y.TextInput:return new ot(e);default:throw new Error(`Cannot properly serialize component type: ${e.type}`)}}o(tt,"createComponentBuilder");var C=class extends b{constructor({components:t,...n}={}){super({type:Me.ActionRow,...n});i(this,"components");this.components=t?.map(r=>tt(r))??[]}addComponents(...t){return this.components.push(...t),this}setComponents(...t){return this.components.splice(0,this.components.length,...t),this}toJSON(){return{...this.data,components:this.components.map(t=>t.toJSON())}}};o(C,"ActionRowBuilder");import{ComponentType as Te}from"discord-api-types/v10";var it=class extends b{constructor(t){super({type:Te.Button,...t})}setStyle(t){return this.data.style=t,this}setURL(t){return this.data.url=t,this}setCustomId(t){return this.data.custom_id=t,this}setEmoji(t){return this.data.emoji=t,this}setDisabled(t=!0){return this.data.disabled=t,this}setLabel(t){return this.data.label=t,this}toJSON(){return{...this.data}}};o(it,"UnsafeButtonBuilder");var et=class extends it{setStyle(t){return super.setStyle(Rt.parse(t))}setURL(t){return super.setURL(Et.parse(t))}setCustomId(t){return super.setCustomId(h.parse(t))}setEmoji(t){return super.setEmoji(B.parse(t))}setDisabled(t=!0){return super.setDisabled(_.parse(t))}setLabel(t){return super.setLabel(Tt.parse(t))}toJSON(){return Vt(this.data.style,this.data.label,this.data.emoji,this.data.custom_id,this.data.url),super.toJSON()}};o(et,"ButtonBuilder");var ae={};R(ae,{labelValidator:()=>re,maxLengthValidator:()=>$t,minLengthValidator:()=>Lt,placeholderValidator:()=>Jt,requiredValidator:()=>Dt,textInputStyleValidator:()=>ie,validateRequiredParameters:()=>kt,valueValidator:()=>_t});import{TextInputStyle as Re}from"discord-api-types/v10";import{z as I}from"zod";var ie=I.nativeEnum(Re),Lt=I.number().int().min(0).max(4e3),$t=I.number().int().min(1).max(4e3),Dt=I.boolean(),_t=I.string().max(4e3),Jt=I.string().max(100),re=I.string().min(1).max(45);function kt(e,t,n){h.parse(e),ie.parse(t),re.parse(n)}o(kt,"validateRequiredParameters");import{ComponentType as Be}from"discord-api-types/v10";import se from"fast-deep-equal";var w=class extends b{constructor(t){super({type:Be.TextInput,...t})}setCustomId(t){return this.data.custom_id=t,this}setLabel(t){return this.data.label=t,this}setStyle(t){return this.data.style=t,this}setMinLength(t){return this.data.min_length=t,this}setMaxLength(t){return this.data.max_length=t,this}setPlaceholder(t){return this.data.placeholder=t,this}setValue(t){return this.data.value=t,this}setRequired(t=!0){return this.data.required=t,this}toJSON(){return{...this.data}}equals(t){return t instanceof w?se(t.data,this.data):se(t,this.data)}};o(w,"UnsafeTextInputBuilder");var ot=class extends w{setMinLength(t){return super.setMinLength(Lt.parse(t))}setMaxLength(t){return super.setMaxLength($t.parse(t))}setRequired(t=!0){return super.setRequired(Dt.parse(t))}setValue(t){return super.setValue(_t.parse(t))}setPlaceholder(t){return super.setPlaceholder(Jt.parse(t))}toJSON(){return kt(this.data.custom_id,this.data.style,this.data.label),super.toJSON()}};o(ot,"TextInputBuilder");var rt=class{constructor({components:t,...n}={}){i(this,"data");i(this,"components",[]);this.data={...n},this.components=t?.map(r=>tt(r))??[]}setTitle(t){return this.data.title=t,this}setCustomId(t){return this.data.custom_id=t,this}addComponents(...t){return this.components.push(...t.map(n=>n instanceof C?n:new C(n))),this}setComponents(...t){return this.components.splice(0,this.components.length,...t),this}toJSON(){return{...this.data,components:this.components.map(t=>t.toJSON())}}};o(rt,"UnsafeModalBuilder");var me={};R(me,{componentsValidator:()=>pe,titleValidator:()=>at,validateRequiredParameters:()=>qt});import{z as Ut}from"zod";var at=Ut.string().min(1).max(45),pe=Ut.array(Ut.instanceof(C)).min(1);function qt(e,t,n){h.parse(e),at.parse(t),pe.parse(n)}o(qt,"validateRequiredParameters");var le=class extends rt{setCustomId(t){return super.setCustomId(h.parse(t))}setTitle(t){return super.setTitle(at.parse(t))}toJSON(){return qt(this.data.custom_id,this.data.title,this.components),super.toJSON()}};o(le,"ModalBuilder");import{ComponentType as we}from"discord-api-types/v10";var st=class extends b{constructor(t){let{options:n,...r}=t??{};super({type:we.SelectMenu,...r});i(this,"options");this.options=n?.map(p=>new d(p))??[]}setPlaceholder(t){return this.data.placeholder=t,this}setMinValues(t){return this.data.min_values=t,this}setMaxValues(t){return this.data.max_values=t,this}setCustomId(t){return this.data.custom_id=t,this}setDisabled(t=!0){return this.data.disabled=t,this}addOptions(...t){return this.options.push(...t.map(n=>n instanceof d?n:new d(n))),this}setOptions(...t){return this.options.splice(0,this.options.length,...t.map(n=>n instanceof d?n:new d(n))),this}toJSON(){return{...this.data,options:this.options.map(t=>t.toJSON())}}};o(st,"UnsafeSelectMenuBuilder");var nt=class extends st{setPlaceholder(t){return super.setPlaceholder(Bt.parse(t))}setMinValues(t){return super.setMinValues(Q.parse(t))}setMaxValues(t){return super.setMaxValues(Q.parse(t))}setCustomId(t){return super.setCustomId(h.parse(t))}setDisabled(t=!0){return super.setDisabled(_.parse(t))}addOptions(...t){return X.parse(this.options.length+t.length),this.options.push(...t.map(n=>n instanceof d?n:new d(J.parse(n)))),this}setOptions(...t){return X.parse(t.length),this.options.splice(0,this.options.length,...t.map(n=>n instanceof d?n:new d(J.parse(n)))),this}toJSON(){return wt(this.options,this.data.custom_id),super.toJSON()}};o(nt,"SelectMenuBuilder");var de=class extends d{setDescription(t){return super.setDescription(k.parse(t))}setDefault(t=!0){return super.setDefault(vt.parse(t))}setEmoji(t){return super.setEmoji(B.parse(t))}toJSON(){return Nt(this.data.label,this.data.value),super.toJSON()}};o(de,"SelectMenuOptionBuilder");var ce={};R(ce,{assertReturnOfBuilder:()=>S,validateChoicesLength:()=>Gt,validateDefaultPermission:()=>Ft,validateDescription:()=>mt,validateMaxOptionsLength:()=>f,validateName:()=>pt,validateRequired:()=>lt,validateRequiredParameters:()=>g});import jt from"@sindresorhus/is";import{z as U}from"zod";var ve=U.string().min(1).max(32).regex(/^[\P{Lu}\p{N}_-]+$/u);function pt(e){ve.parse(e)}o(pt,"validateName");var Ne=U.string().min(1).max(100);function mt(e){Ne.parse(e)}o(mt,"validateDescription");var Ee=U.unknown().array().max(25);function f(e){Ee.parse(e)}o(f,"validateMaxOptionsLength");function g(e,t,n){pt(e),mt(t),f(n)}o(g,"validateRequiredParameters");var ue=U.boolean();function Ft(e){ue.parse(e)}o(Ft,"validateDefaultPermission");function lt(e){ue.parse(e)}o(lt,"validateRequired");var Ve=U.number().lte(25);function Gt(e,t){Ve.parse((t?.length??0)+e)}o(Gt,"validateChoicesLength");function S(e,t){let n=t.name;if(jt.nullOrUndefined(e))throw new TypeError(`Expected to receive a ${n} builder, got ${e===null?"null":"undefined"} instead.`);if(jt.primitive(e))throw new TypeError(`Expected to receive a ${n} builder, got a primitive (${typeof e}) instead.`);if(!(e instanceof t)){let r=e,p=jt.function_(e)?e.name:r.constructor.name,T=Reflect.get(r,Symbol.toStringTag),D=T?`${p} [${T}]`:p;throw new TypeError(`Expected to receive a ${n} builder, got ${D} instead.`)}}o(S,"assertReturnOfBuilder");import{mix as to}from"ts-mixer";import{ApplicationCommandOptionType as Le}from"discord-api-types/v10";var A=class{constructor(){i(this,"name");i(this,"description")}setName(t){return pt(t),Reflect.set(this,"name",t),this}setDescription(t){return mt(t),Reflect.set(this,"description",t),this}};o(A,"SharedNameAndDescription");var m=class extends A{constructor(){super(...arguments);i(this,"required",!1)}setRequired(t){return lt(t),Reflect.set(this,"required",t),this}runRequiredValidations(){g(this.name,this.description,[]),lt(this.required)}};o(m,"ApplicationCommandOptionBase");var dt=class extends m{constructor(){super(...arguments);i(this,"type",Le.Boolean)}toJSON(){return this.runRequiredValidations(),{...this}}};o(dt,"SlashCommandBooleanOption");import{ApplicationCommandOptionType as _e}from"discord-api-types/v10";import{mix as Je}from"ts-mixer";import{ChannelType as x}from"discord-api-types/v10";import{z as Wt}from"zod";var $e=[x.GuildText,x.GuildVoice,x.GuildCategory,x.GuildNews,x.GuildStore,x.GuildNewsThread,x.GuildPublicThread,x.GuildPrivateThread,x.GuildStageVoice],De=Wt.array(Wt.union($e.map(e=>Wt.literal(e)))),ut=class{constructor(){i(this,"channel_types")}addChannelTypes(...t){return this.channel_types===void 0&&Reflect.set(this,"channel_types",[]),De.parse(t),this.channel_types.push(...t),this}};o(ut,"ApplicationCommandOptionChannelTypesMixin");var v=class extends m{constructor(){super(...arguments);i(this,"type",_e.Channel)}toJSON(){return this.runRequiredValidations(),{...this}}};o(v,"SlashCommandChannelOption"),v=c([Je(ut)],v);import{ApplicationCommandOptionType as qe}from"discord-api-types/v10";import{mix as je}from"ts-mixer";import{z as Fe}from"zod";var N=class{constructor(){i(this,"max_value");i(this,"min_value")}};o(N,"ApplicationCommandNumericOptionMinMaxValueMixin");import{ApplicationCommandOptionType as ke}from"discord-api-types/v10";import{z as q}from"zod";var zt=q.string().min(1).max(100),he=q.number().gt(-1/0).lt(1/0),be=q.object({name:zt,value:q.union([zt,he])}).array(),Ue=q.boolean(),P=class{constructor(){i(this,"choices");i(this,"autocomplete");i(this,"type")}addChoices(...t){if(t.length>0&&this.autocomplete)throw new RangeError("Autocomplete and choices are mutually exclusive to each other.");be.parse(t),this.choices===void 0&&Reflect.set(this,"choices",[]),Gt(t.length,this.choices);for(let{name:n,value:r}of t)this.type===ke.String?zt.parse(r):he.parse(r),this.choices.push({name:n,value:r});return this}setChoices(...t){if(t.length>0&&this.autocomplete)throw new RangeError("Autocomplete and choices are mutually exclusive to each other.");return be.parse(t),Reflect.set(this,"choices",[]),this.addChoices(...t),this}setAutocomplete(t){if(Ue.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 Ce=Fe.number().int(),E=class extends m{constructor(){super(...arguments);i(this,"type",qe.Integer)}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(E,"SlashCommandIntegerOption"),E=c([je(N,P)],E);import{ApplicationCommandOptionType as Ge}from"discord-api-types/v10";var ct=class extends m{constructor(){super(...arguments);i(this,"type",Ge.Mentionable)}toJSON(){return this.runRequiredValidations(),{...this}}};o(ct,"SlashCommandMentionableOption");import{ApplicationCommandOptionType as We}from"discord-api-types/v10";import{mix as ze}from"ts-mixer";import{z as Ze}from"zod";var fe=Ze.number(),V=class extends m{constructor(){super(...arguments);i(this,"type",We.Number)}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(V,"SlashCommandNumberOption"),V=c([ze(N,P)],V);import{ApplicationCommandOptionType as Ke}from"discord-api-types/v10";var ht=class extends m{constructor(){super(...arguments);i(this,"type",Ke.Role)}toJSON(){return this.runRequiredValidations(),{...this}}};o(ht,"SlashCommandRoleOption");import{ApplicationCommandOptionType as Qe}from"discord-api-types/v10";var bt=class extends m{constructor(){super(...arguments);i(this,"type",Qe.Attachment)}toJSON(){return this.runRequiredValidations(),{...this}}};o(bt,"SlashCommandAttachmentOption");import{ApplicationCommandOptionType as He}from"discord-api-types/v10";import{mix as Xe}from"ts-mixer";var L=class extends m{constructor(){super(...arguments);i(this,"type",He.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(L,"SlashCommandStringOption"),L=c([Xe(P)],L);import{ApplicationCommandOptionType as Ye}from"discord-api-types/v10";var Ct=class extends m{constructor(){super(...arguments);i(this,"type",Ye.User)}toJSON(){return this.runRequiredValidations(),{...this}}};o(Ct,"SlashCommandUserOption");var $=class{constructor(){i(this,"options")}addBooleanOption(t){return this._sharedAddOptionMethod(t,dt)}addUserOption(t){return this._sharedAddOptionMethod(t,Ct)}addChannelOption(t){return this._sharedAddOptionMethod(t,v)}addRoleOption(t){return this._sharedAddOptionMethod(t,ht)}addAttachmentOption(t){return this._sharedAddOptionMethod(t,bt)}addMentionableOption(t){return this._sharedAddOptionMethod(t,ct)}addStringOption(t){return this._sharedAddOptionMethod(t,L)}addIntegerOption(t){return this._sharedAddOptionMethod(t,E)}addNumberOption(t){return this._sharedAddOptionMethod(t,V)}_sharedAddOptionMethod(t,n){let{options:r}=this;f(r);let p=typeof t=="function"?t(new n):t;return S(p,n),r.push(p),this}};o($,"SharedSlashCommandOptions");import{ApplicationCommandOptionType as Ae}from"discord-api-types/v10";import{mix as xe}from"ts-mixer";var M=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 y):t;return S(r,y),n.push(r),this}toJSON(){return g(this.name,this.description,this.options),{type:Ae.SubcommandGroup,name:this.name,description:this.description,options:this.options.map(t=>t.toJSON())}}};o(M,"SlashCommandSubcommandGroupBuilder"),M=c([xe(A)],M);var y=class{constructor(){i(this,"name");i(this,"description");i(this,"options",[])}toJSON(){return g(this.name,this.description,this.options),{type:Ae.Subcommand,name:this.name,description:this.description,options:this.options.map(t=>t.toJSON())}}};o(y,"SlashCommandSubcommandBuilder"),y=c([xe(A,$)],y);var ft=class{constructor(){i(this,"name");i(this,"description");i(this,"options",[]);i(this,"defaultPermission")}toJSON(){return g(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 Ft(t),Reflect.set(this,"defaultPermission",t),this}addSubcommandGroup(t){let{options:n}=this;f(n);let r=typeof t=="function"?t(new M):t;return S(r,M),n.push(r),this}addSubcommand(t){let{options:n}=this;f(n);let r=typeof t=="function"?t(new y):t;return S(r,y),n.push(r),this}};o(ft,"SlashCommandBuilder"),ft=c([to($,A)],ft);var Oe={};R(Oe,{validateDefaultPermission:()=>Zt,validateName:()=>At,validateRequiredParameters:()=>Kt,validateType:()=>xt});import{z as j}from"zod";import{ApplicationCommandType as ye}from"discord-api-types/v10";var eo=j.string().min(1).max(32).regex(/^( *[\p{L}\p{N}_-]+ *)+$/u),oo=j.union([j.literal(ye.User),j.literal(ye.Message)]),no=j.boolean();function Zt(e){no.parse(e)}o(Zt,"validateDefaultPermission");function At(e){eo.parse(e)}o(At,"validateName");function xt(e){oo.parse(e)}o(xt,"validateType");function Kt(e,t){At(e),xt(t)}o(Kt,"validateRequiredParameters");var ge=class{constructor(){i(this,"name");i(this,"type");i(this,"defaultPermission")}setName(t){return At(t),Reflect.set(this,"name",t),this}setType(t){return xt(t),Reflect.set(this,"type",t),this}setDefaultPermission(t){return Zt(t),Reflect.set(this,"defaultPermission",t),this}toJSON(){return Kt(this.name,this.type),{name:this.name,type:this.type,default_permission:this.defaultPermission}}};o(ge,"ContextMenuCommandBuilder");function Sr(e){return e!==null&&typeof e=="object"&&"toJSON"in e}o(Sr,"isJSONEncodable");function Ir(e){return e!==null&&typeof e=="object"&&"equals"in e}o(Ir,"isEquatable");function Tr(e){return(e.title?.length??0)+(e.description?.length??0)+(e.fields?.reduce((t,n)=>t+n.name.length+n.value.length,0)??0)+(e.footer?.text.length??0)+(e.author?.name.length??0)}o(Tr,"embedLength");export{C as ActionRowBuilder,et as ButtonBuilder,ne as ComponentAssertions,b as ComponentBuilder,Oe as ContextMenuCommandAssertions,ge as ContextMenuCommandBuilder,te as EmbedAssertions,ee as EmbedBuilder,Ie as Faces,me as ModalAssertions,le as ModalBuilder,nt as SelectMenuBuilder,de as SelectMenuOptionBuilder,ce as SlashCommandAssertions,bt as SlashCommandAttachmentOption,dt as SlashCommandBooleanOption,ft as SlashCommandBuilder,v as SlashCommandChannelOption,E as SlashCommandIntegerOption,ct as SlashCommandMentionableOption,V as SlashCommandNumberOption,ht as SlashCommandRoleOption,L as SlashCommandStringOption,y as SlashCommandSubcommandBuilder,M as SlashCommandSubcommandGroupBuilder,Ct as SlashCommandUserOption,ae as TextInputAssertions,ot as TextInputBuilder,vo as TimestampStyles,it as UnsafeButtonBuilder,K as UnsafeEmbedBuilder,rt as UnsafeModalBuilder,st as UnsafeSelectMenuBuilder,d as UnsafeSelectMenuOptionBuilder,w as UnsafeTextInputBuilder,Oo as blockQuote,fo as bold,To as channelMention,ho as codeBlock,tt as createComponentBuilder,Tr as embedLength,Bo as formatEmoji,go as hideLinkEmbed,So as hyperlink,bo as inlineCode,Ir as isEquatable,Sr as isJSONEncodable,Co as italic,Mo as memberNicknameMention,yo as quote,Ro as roleMention,Po as spoiler,xo as strikethrough,wo as time,Ao as underscore,Io as userMention};
|
|
4
4
|
//# sourceMappingURL=index.mjs.map
|