4 lines
No EOL
18 KiB
JavaScript
4 lines
No EOL
18 KiB
JavaScript
var Q=Object.defineProperty;var ze=Object.getOwnPropertyDescriptor;var We=(t,e,i)=>e in t?Q(t,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[e]=i;var V=(t,e)=>{for(var i in e)Q(t,i,{get:e[i],enumerable:!0})};var l=(t,e,i,n)=>{for(var s=n>1?void 0:n?ze(e,i):e,y=t.length-1,P;y>=0;y--)(P=t[y])&&(s=(n?P(e,i,s):P(s))||s);return n&&s&&Q(e,i,s),s};var o=(t,e,i)=>(We(t,typeof e!="symbol"?e+"":e,i),i);var we={};V(we,{authorNamePredicate:()=>H,colorPredicate:()=>X,descriptionPredicate:()=>Y,embedFieldPredicate:()=>Re,embedFieldsArrayPredicate:()=>D,fieldInlinePredicate:()=>k,fieldLengthPredicate:()=>ve,fieldNamePredicate:()=>O,fieldValuePredicate:()=>L,footerTextPredicate:()=>ee,timestampPredicate:()=>te,titlePredicate:()=>oe,urlPredicate:()=>h,validateFieldLength:()=>U});import{z as d}from"zod";var O=d.string().min(1).max(256),L=d.string().min(1).max(1024),k=d.boolean().optional(),Re=d.object({name:O,value:L,inline:k}),D=Re.array(),ve=d.number().lte(25);function U(t,e){ve.parse(t.length+e)}var H=O.nullable(),h=d.string().url().nullish(),X=d.number().gte(0).lte(16777215).nullable(),Y=d.string().min(1).max(4096).nullable(),ee=d.string().min(1).max(2048).nullable(),te=d.union([d.number(),d.date()]).nullable(),oe=O.nullable();var J=class{constructor(e={}){o(this,"fields");o(this,"title");o(this,"description");o(this,"url");o(this,"color");o(this,"timestamp");o(this,"thumbnail");o(this,"image");o(this,"video");o(this,"author");o(this,"provider");o(this,"footer");this.title=e.title,this.description=e.description,this.url=e.url,this.color=e.color,this.thumbnail=e.thumbnail,this.image=e.image,this.video=e.video,this.author=e.author,this.provider=e.provider,this.footer=e.footer,this.fields=e.fields??[],e.timestamp&&(this.timestamp=new Date(e.timestamp).toISOString())}get length(){return(this.title?.length??0)+(this.description?.length??0)+this.fields.reduce((e,i)=>e+i.name.length+i.value.length,0)+(this.footer?.text.length??0)+(this.author?.name.length??0)}addField(e){return this.addFields(e)}addFields(...e){return D.parse(e),U(this.fields,e.length),this.fields.push(...J.normalizeFields(...e)),this}spliceFields(e,i,...n){return D.parse(n),U(this.fields,n.length-i),this.fields.splice(e,i,...J.normalizeFields(...n)),this}setAuthor(e){if(e===null)return this.author=void 0,this;let{name:i,iconURL:n,url:s}=e;return H.parse(i),h.parse(n),h.parse(s),this.author={name:i,url:s,icon_url:n},this}setColor(e){return X.parse(e),this.color=e??void 0,this}setDescription(e){return Y.parse(e),this.description=e??void 0,this}setFooter(e){if(e===null)return this.footer=void 0,this;let{text:i,iconURL:n}=e;return ee.parse(i),h.parse(n),this.footer={text:i,icon_url:n},this}setImage(e){return h.parse(e),this.image=e?{url:e}:void 0,this}setThumbnail(e){return h.parse(e),this.thumbnail=e?{url:e}:void 0,this}setTimestamp(e=Date.now()){return te.parse(e),this.timestamp=e?new Date(e).toISOString():void 0,this}setTitle(e){return oe.parse(e),this.title=e??void 0,this}setURL(e){return h.parse(e),this.url=e??void 0,this}toJSON(){return{...this}}static normalizeFields(...e){return e.flat(1/0).map(i=>(O.parse(i.name),L.parse(i.value),k.parse(i.inline),{name:i.name,value:i.value,inline:i.inline??void 0}))}};function Rt(t,e){return typeof e=="undefined"?`\`\`\`
|
|
${t}\`\`\``:`\`\`\`${t}
|
|
${e}\`\`\``}function vt(t){return`\`${t}\``}function wt(t){return`_${t}_`}function Bt(t){return`**${t}**`}function Nt(t){return`__${t}__`}function $t(t){return`~~${t}~~`}function Et(t){return`> ${t}`}function _t(t){return`>>> ${t}`}function Vt(t){return`<${t}>`}function Lt(t,e,i){return i?`[${t}](${e} "${i}")`:`[${t}](${e})`}function kt(t){return`||${t}||`}function Dt(t){return`<@${t}>`}function Ut(t){return`<@!${t}>`}function Jt(t){return`<#${t}>`}function jt(t){return`<@&${t}>`}function qt(t,e=!1){return`<${e?"a":""}:_:${t}>`}function Ft(t,e){return typeof t!="number"&&(t=Math.floor((t?.getTime()??Date.now())/1e3)),typeof e=="string"?`<t:${t}:${e}>`:`<t:${t}>`}var Gt={ShortTime:"t",LongTime:"T",ShortDate:"d",LongDate:"D",ShortDateTime:"f",LongDateTime:"F",RelativeTime:"R"},Ze=(n=>(n.Shrug="\xAF\\_(\u30C4)\\_/\xAF",n.Tableflip="(\u256F\xB0\u25A1\xB0\uFF09\u256F\uFE35 \u253B\u2501\u253B",n.Unflip="\u252C\u2500\u252C \u30CE( \u309C-\u309C\u30CE)",n))(Ze||{});var Ne={};V(Ne,{buttonLabelValidator:()=>ne,buttonStyleValidator:()=>re,customIdValidator:()=>S,defaultValidator:()=>pe,disabledValidator:()=>I,emojiValidator:()=>T,labelValueValidator:()=>M,minMaxValidator:()=>j,optionsValidator:()=>Be,placeholderValidator:()=>ae,urlValidator:()=>le,validateRequiredButtonParameters:()=>de,validateRequiredSelectMenuOptionParameters:()=>me,validateRequiredSelectMenuParameters:()=>se});import{ButtonStyle as ie}from"discord-api-types/v9";import{z as m}from"zod";var S=m.string().min(1).max(100),T=m.object({id:m.string(),name:m.string(),animated:m.boolean()}).partial().strict(),I=m.boolean(),ne=m.string().nonempty().max(80),re=m.number().int().min(ie.Primary).max(ie.Link),ae=m.string().max(100),j=m.number().int().min(0).max(25),Be=m.object({}).array().nonempty();function se(t,e){S.parse(e),Be.parse(t)}var M=m.string().min(1).max(100),pe=m.boolean();function me(t,e){M.parse(t),M.parse(e)}var le=m.string().url();function de(t,e,i,n,s){if(s&&n)throw new RangeError("URL and custom id are mutually exclusive");if(!e&&!i)throw new RangeError("Buttons must have a label and/or an emoji");if(t===ie.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")}import{ComponentType as Ke}from"discord-api-types/v9";import{ComponentType as ce}from"discord-api-types/v9";function $e(t){switch(t.type){case ce.ActionRow:return new ue(t);case ce.Button:return new he(t);case ce.SelectMenu:return new be(t);default:throw new Error(`Cannot serialize component type: ${t.type}`)}}var ue=class{constructor(e){o(this,"components",[]);o(this,"type",Ke.ActionRow);this.components=e?.components.map($e)??[]}addComponents(...e){return this.components.push(...e),this}setComponents(e){return Reflect.set(this,"components",[...e]),this}toJSON(){return{...this,components:this.components.map(e=>e.toJSON())}}};import{ButtonStyle as Qe,ComponentType as He}from"discord-api-types/v9";var he=class{constructor(e){o(this,"type",He.Button);o(this,"style");o(this,"label");o(this,"emoji");o(this,"disabled");o(this,"custom_id");o(this,"url");this.style=e?.style,this.label=e?.label,this.emoji=e?.emoji,this.disabled=e?.disabled,e?.style===Qe.Link?this.url=e.url:this.custom_id=e?.custom_id}setStyle(e){return re.parse(e),Reflect.set(this,"style",e),this}setURL(e){return le.parse(e),Reflect.set(this,"url",e),this}setCustomId(e){return S.parse(e),Reflect.set(this,"custom_id",e),this}setEmoji(e){return T.parse(e),Reflect.set(this,"emoji",e),this}setDisabled(e){return I.parse(e),Reflect.set(this,"disabled",e),this}setLabel(e){return ne.parse(e),Reflect.set(this,"label",e),this}toJSON(){return de(this.style,this.label,this.emoji,this.custom_id,this.url),{...this}}};import{ComponentType as Xe}from"discord-api-types/v9";var Ce=class{constructor(e){o(this,"label");o(this,"value");o(this,"description");o(this,"emoji");o(this,"default");this.label=e?.label,this.value=e?.value,this.description=e?.description,this.emoji=e?.emoji,this.default=e?.default}setLabel(e){return Reflect.set(this,"label",e),this}setValue(e){return Reflect.set(this,"value",e),this}setDescription(e){return M.parse(e),Reflect.set(this,"description",e),this}setDefault(e){return pe.parse(e),Reflect.set(this,"default",e),this}setEmoji(e){return T.parse(e),Reflect.set(this,"emoji",e),this}toJSON(){return me(this.label,this.value),{...this}}};var be=class{constructor(e){o(this,"type",Xe.SelectMenu);o(this,"options");o(this,"placeholder");o(this,"min_values");o(this,"max_values");o(this,"custom_id");o(this,"disabled");this.options=e?.options.map(i=>new Ce(i))??[],this.placeholder=e?.placeholder,this.min_values=e?.min_values,this.max_values=e?.max_values,this.custom_id=e?.custom_id,this.disabled=e?.disabled}setPlaceholder(e){return ae.parse(e),Reflect.set(this,"placeholder",e),this}setMinValues(e){return j.parse(e),Reflect.set(this,"min_values",e),this}setMaxValues(e){return j.parse(e),Reflect.set(this,"max_values",e),this}setCustomId(e){return S.parse(e),Reflect.set(this,"custom_id",e),this}setDisabled(e){return I.parse(e),Reflect.set(this,"disabled",e),this}addOptions(...e){return this.options.push(...e),this}setOptions(e){return Reflect.set(this,"options",[...e]),this}toJSON(){return se(this.options,this.custom_id),{...this,options:this.options.map(e=>e.toJSON())}}};var Ve={};V(Ve,{assertReturnOfBuilder:()=>C,validateDefaultPermission:()=>xe,validateDescription:()=>G,validateMaxChoicesLength:()=>Ae,validateMaxOptionsLength:()=>c,validateName:()=>F,validateRequired:()=>z,validateRequiredParameters:()=>b});import fe from"@sindresorhus/is";import{z as q}from"zod";var Ye=q.string().min(1).max(32).regex(/^[\P{Lu}\p{N}_-]+$/u);function F(t){Ye.parse(t)}var et=q.string().min(1).max(100);function G(t){et.parse(t)}var Ee=q.unknown().array().max(25);function c(t){Ee.parse(t)}function b(t,e,i){F(t),G(e),c(i)}var _e=q.boolean();function xe(t){_e.parse(t)}function z(t){_e.parse(t)}function Ae(t){Ee.parse(t)}function C(t,e){let i=e.name;if(fe.nullOrUndefined(t))throw new TypeError(`Expected to receive a ${i} builder, got ${t===null?"null":"undefined"} instead.`);if(fe.primitive(t))throw new TypeError(`Expected to receive a ${i} builder, got a primitive (${typeof t}) instead.`);if(!(t instanceof e)){let n=t,s=fe.function_(t)?t.name:n.constructor.name,y=Reflect.get(n,Symbol.toStringTag),P=y?`${s} [${y}]`:s;throw new TypeError(`Expected to receive a ${i} builder, got ${P} instead.`)}}import{mix as At}from"ts-mixer";import{ApplicationCommandOptionType as tt}from"discord-api-types/v9";var f=class{constructor(){o(this,"name");o(this,"description")}setName(e){return F(e),Reflect.set(this,"name",e),this}setDescription(e){return G(e),Reflect.set(this,"description",e),this}};var p=class extends f{constructor(){super(...arguments);o(this,"required",!1)}setRequired(e){return z(e),Reflect.set(this,"required",e),this}runRequiredValidations(){b(this.name,this.description,[]),z(this.required)}};var ye=class extends p{constructor(){super(...arguments);o(this,"type",tt.Boolean)}toJSON(){return this.runRequiredValidations(),{...this}}};import{ApplicationCommandOptionType as nt}from"discord-api-types/v9";import{mix as rt}from"ts-mixer";import{ChannelType as u}from"discord-api-types/v9";import{z as Le}from"zod";var ot=[u.GuildText,u.GuildVoice,u.GuildCategory,u.GuildNews,u.GuildStore,u.GuildNewsThread,u.GuildPublicThread,u.GuildPrivateThread,u.GuildStageVoice],it=Le.union(ot.map(t=>Le.literal(t))),Oe=class{constructor(){o(this,"channel_types")}addChannelType(e){return this.channel_types===void 0&&Reflect.set(this,"channel_types",[]),it.parse(e),this.channel_types.push(e),this}addChannelTypes(e){return e.forEach(i=>this.addChannelType(i)),this}};var R=class extends p{constructor(){super(...arguments);o(this,"type",nt.Channel)}toJSON(){return this.runRequiredValidations(),{...this}}};R=l([rt(Oe)],R);import{ApplicationCommandOptionType as pt}from"discord-api-types/v9";import{mix as mt}from"ts-mixer";import{z as lt}from"zod";var v=class{constructor(){o(this,"max_value");o(this,"min_value")}};import{ApplicationCommandOptionType as at}from"discord-api-types/v9";import{z as w}from"zod";var W=w.string().min(1).max(100),ke=w.number().gt(-1/0).lt(1/0),De=w.tuple([W,w.union([W,ke])]).array(),st=w.boolean(),A=class{constructor(){o(this,"choices");o(this,"autocomplete");o(this,"type")}addChoice(e,i){if(this.autocomplete)throw new RangeError("Autocomplete and choices are mutually exclusive to each other.");return this.choices===void 0&&Reflect.set(this,"choices",[]),Ae(this.choices),W.parse(e),this.type===at.String?W.parse(i):ke.parse(i),this.choices.push({name:e,value:i}),this}addChoices(e){if(this.autocomplete)throw new RangeError("Autocomplete and choices are mutually exclusive to each other.");De.parse(e);for(let[i,n]of e)this.addChoice(i,n);return this}setChoices(e){if(e.length>0&&this.autocomplete)throw new RangeError("Autocomplete and choices are mutually exclusive to each other.");De.parse(e),Reflect.set(this,"choices",[]);for(let[i,n]of e)this.addChoice(i,n);return this}setAutocomplete(e){if(st.parse(e),e&&Array.isArray(this.choices)&&this.choices.length>0)throw new RangeError("Autocomplete and choices are mutually exclusive to each other.");return Reflect.set(this,"autocomplete",e),this}};var Ue=lt.number().int().nonnegative(),B=class extends p{constructor(){super(...arguments);o(this,"type",pt.Integer)}setMaxValue(e){return Ue.parse(e),Reflect.set(this,"max_value",e),this}setMinValue(e){return Ue.parse(e),Reflect.set(this,"min_value",e),this}toJSON(){if(this.runRequiredValidations(),this.autocomplete&&Array.isArray(this.choices)&&this.choices.length>0)throw new RangeError("Autocomplete and choices are mutually exclusive to each other.");return{...this}}};B=l([mt(v,A)],B);import{ApplicationCommandOptionType as dt}from"discord-api-types/v9";var Se=class extends p{constructor(){super(...arguments);o(this,"type",dt.Mentionable)}toJSON(){return this.runRequiredValidations(),{...this}}};import{ApplicationCommandOptionType as ct}from"discord-api-types/v9";import{mix as ut}from"ts-mixer";import{z as ht}from"zod";var Je=ht.number().nonnegative(),N=class extends p{constructor(){super(...arguments);o(this,"type",ct.Number)}setMaxValue(e){return Je.parse(e),Reflect.set(this,"max_value",e),this}setMinValue(e){return Je.parse(e),Reflect.set(this,"min_value",e),this}toJSON(){if(this.runRequiredValidations(),this.autocomplete&&Array.isArray(this.choices)&&this.choices.length>0)throw new RangeError("Autocomplete and choices are mutually exclusive to each other.");return{...this}}};N=l([ut(v,A)],N);import{ApplicationCommandOptionType as bt}from"discord-api-types/v9";var ge=class extends p{constructor(){super(...arguments);o(this,"type",bt.Role)}toJSON(){return this.runRequiredValidations(),{...this}}};import{ApplicationCommandOptionType as Ct}from"discord-api-types/v9";import{mix as ft}from"ts-mixer";var $=class extends p{constructor(){super(...arguments);o(this,"type",Ct.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}}};$=l([ft(A)],$);import{ApplicationCommandOptionType as xt}from"discord-api-types/v9";var Pe=class extends p{constructor(){super(...arguments);o(this,"type",xt.User)}toJSON(){return this.runRequiredValidations(),{...this}}};var E=class{constructor(){o(this,"options")}addBooleanOption(e){return this._sharedAddOptionMethod(e,ye)}addUserOption(e){return this._sharedAddOptionMethod(e,Pe)}addChannelOption(e){return this._sharedAddOptionMethod(e,R)}addRoleOption(e){return this._sharedAddOptionMethod(e,ge)}addMentionableOption(e){return this._sharedAddOptionMethod(e,Se)}addStringOption(e){return this._sharedAddOptionMethod(e,$)}addIntegerOption(e){return this._sharedAddOptionMethod(e,B)}addNumberOption(e){return this._sharedAddOptionMethod(e,N)}_sharedAddOptionMethod(e,i){let{options:n}=this;c(n);let s=typeof e=="function"?e(new i):e;return C(s,i),n.push(s),this}};import{ApplicationCommandOptionType as je}from"discord-api-types/v9";import{mix as qe}from"ts-mixer";var g=class{constructor(){o(this,"name");o(this,"description");o(this,"options",[])}addSubcommand(e){let{options:i}=this;c(i);let n=typeof e=="function"?e(new x):e;return C(n,x),i.push(n),this}toJSON(){return b(this.name,this.description,this.options),{type:je.SubcommandGroup,name:this.name,description:this.description,options:this.options.map(e=>e.toJSON())}}};g=l([qe(f)],g);var x=class{constructor(){o(this,"name");o(this,"description");o(this,"options",[])}toJSON(){return b(this.name,this.description,this.options),{type:je.Subcommand,name:this.name,description:this.description,options:this.options.map(e=>e.toJSON())}}};x=l([qe(f,E)],x);var Te=class{constructor(){o(this,"name");o(this,"description");o(this,"options",[]);o(this,"defaultPermission")}toJSON(){return b(this.name,this.description,this.options),{name:this.name,description:this.description,options:this.options.map(e=>e.toJSON()),default_permission:this.defaultPermission}}setDefaultPermission(e){return xe(e),Reflect.set(this,"defaultPermission",e),this}addSubcommandGroup(e){let{options:i}=this;c(i);let n=typeof e=="function"?e(new g):e;return C(n,g),i.push(n),this}addSubcommand(e){let{options:i}=this;c(i);let n=typeof e=="function"?e(new x):e;return C(n,x),i.push(n),this}};Te=l([At(E,f)],Te);var Ge={};V(Ge,{validateDefaultPermission:()=>Ie,validateName:()=>Z,validateRequiredParameters:()=>Me,validateType:()=>K});import{z as _}from"zod";import{ApplicationCommandType as Fe}from"discord-api-types/v9";var yt=_.string().min(1).max(32).regex(/^( *[\p{L}\p{N}_-]+ *)+$/u),Ot=_.union([_.literal(Fe.User),_.literal(Fe.Message)]),St=_.boolean();function Ie(t){St.parse(t)}function Z(t){yt.parse(t)}function K(t){Ot.parse(t)}function Me(t,e){Z(t),K(e)}var gt=class{constructor(){o(this,"name");o(this,"type");o(this,"defaultPermission")}setName(e){return Z(e),Reflect.set(this,"name",e),this}setType(e){return K(e),Reflect.set(this,"type",e),this}setDefaultPermission(e){return Ie(e),Reflect.set(this,"defaultPermission",e),this}toJSON(){return Me(this.name,this.type),{name:this.name,type:this.type,default_permission:this.defaultPermission}}};export{ue as ActionRow,he as ButtonComponent,Ne as ComponentAssertions,Ge as ContextMenuCommandAssertions,gt as ContextMenuCommandBuilder,J as Embed,we as EmbedAssertions,Ze as Faces,be as SelectMenuComponent,Ce as SelectMenuOption,Ve as SlashCommandAssertions,ye as SlashCommandBooleanOption,Te as SlashCommandBuilder,R as SlashCommandChannelOption,B as SlashCommandIntegerOption,Se as SlashCommandMentionableOption,N as SlashCommandNumberOption,ge as SlashCommandRoleOption,$ as SlashCommandStringOption,x as SlashCommandSubcommandBuilder,g as SlashCommandSubcommandGroupBuilder,Pe as SlashCommandUserOption,Gt as TimestampStyles,_t as blockQuote,Bt as bold,Jt as channelMention,Rt as codeBlock,$e as createComponent,qt as formatEmoji,Vt as hideLinkEmbed,Lt as hyperlink,vt as inlineCode,wt as italic,Ut as memberNicknameMention,Et as quote,jt as roleMention,kt as spoiler,$t as strikethrough,Ft as time,Nt as underscore,Dt as userMention};
|
|
//# sourceMappingURL=index.mjs.map
|