RockPaperScissors/node_modules/@discordjs/builders/dist/index.js
2021-11-30 22:03:51 +01:00

5 lines
15 KiB
JavaScript

var Ee=Object.create;var T=Object.defineProperty;var ve=Object.getOwnPropertyDescriptor;var Re=Object.getOwnPropertyNames;var Me=Object.getPrototypeOf,De=Object.prototype.hasOwnProperty;var _e=(t,e,n)=>e in t?T(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n;var $e=t=>T(t,"__esModule",{value:!0});var L=(t,e)=>{$e(t);for(var n in e)T(t,n,{get:e[n],enumerable:!0})},ke=(t,e,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of Re(e))!De.call(t,o)&&o!=="default"&&T(t,o,{get:()=>e[o],enumerable:!(n=ve(e,o))||n.enumerable});return t},s=t=>ke($e(T(t!=null?Ee(Me(t)):{},"default",t&&t.__esModule&&"default"in t?{get:()=>t.default,enumerable:!0}:{value:t,enumerable:!0})),t),I=(t,e,n,o)=>{for(var p=o>1?void 0:o?ve(e,n):e,P=t.length-1,$;P>=0;P--)($=t[P])&&(p=(o?$(e,n,p):$(p))||p);return o&&p&&T(e,n,p),p};var i=(t,e,n)=>(_e(t,typeof e!="symbol"?e+"":e,n),n);L(exports,{ContextMenuCommandAssertions:()=>Te,ContextMenuCommandBuilder:()=>Le,Embed:()=>B,EmbedAssertions:()=>ie,Faces:()=>oe,SlashCommandAssertions:()=>ae,SlashCommandBooleanOption:()=>G,SlashCommandBuilder:()=>K,SlashCommandChannelOption:()=>F,SlashCommandIntegerOption:()=>J,SlashCommandMentionableOption:()=>q,SlashCommandNumberOption:()=>V,SlashCommandRoleOption:()=>W,SlashCommandStringOption:()=>j,SlashCommandSubcommandBuilder:()=>f,SlashCommandSubcommandGroupBuilder:()=>O,SlashCommandUserOption:()=>z,TimestampStyles:()=>nt,blockQuote:()=>je,bold:()=>Je,channelMention:()=>Ye,codeBlock:()=>Ue,formatEmoji:()=>et,hideLinkEmbed:()=>ze,hyperlink:()=>Ke,inlineCode:()=>Ge,italic:()=>Fe,memberNicknameMention:()=>Xe,quote:()=>We,roleMention:()=>Ze,spoiler:()=>Qe,strikethrough:()=>Ve,time:()=>tt,underscore:()=>qe,userMention:()=>He});var ie={};L(ie,{authorNamePredicate:()=>X,colorPredicate:()=>Y,descriptionPredicate:()=>Z,embedFieldPredicate:()=>Ie,embedFieldsArrayPredicate:()=>M,fieldInlinePredicate:()=>R,fieldNamePredicate:()=>v,fieldValuePredicate:()=>E,footerTextPredicate:()=>ee,timestampPredicate:()=>te,titlePredicate:()=>ne,urlPredicate:()=>b,validateFieldLength:()=>D});var r=s(require("ow")),v=r.default.string.minLength(1).maxLength(256),E=r.default.string.minLength(1).maxLength(1024),R=r.default.optional.boolean,Ie=r.default.object.exactShape({name:v,value:E,inline:R}),M=r.default.array.ofType(Ie);function D(t,e){(0,r.default)(t.length+e,"field amount",r.default.number.lessThanOrEqual(25))}var X=r.default.any(v,r.default.null),b=r.default.any(r.default.string.url,r.default.nullOrUndefined),Y=r.default.any(r.default.number.greaterThanOrEqual(0).lessThanOrEqual(16777215),r.default.null),Z=r.default.any(r.default.string.minLength(1).maxLength(4096),r.default.null),ee=r.default.any(r.default.string.minLength(1).maxLength(2048),r.default.null),te=r.default.any(r.default.number,r.default.date,r.default.null),ne=r.default.any(v,r.default.null);var m=s(require("ow"));var B=class{constructor(e={}){i(this,"fields");i(this,"title");i(this,"description");i(this,"url");i(this,"color");i(this,"timestamp");i(this,"thumbnail");i(this,"image");i(this,"video");i(this,"author");i(this,"provider");i(this,"footer");this.title=e.title,this.description=e.description,this.url=e.url,this.color=e.color,this.thumbnail=e.thumbnail,this.image=e.image,this.video=e.video,this.author=e.author,this.provider=e.provider,this.footer=e.footer,this.fields=e.fields??[],e.timestamp&&(this.timestamp=new Date(e.timestamp).toISOString())}get length(){return(this.title?.length??0)+(this.description?.length??0)+this.fields.reduce((e,n)=>e+n.name.length+n.value.length,0)+(this.footer?.text.length??0)+(this.author?.name.length??0)}addField(e){return this.addFields(e)}addFields(...e){return(0,m.default)(e,"fields",M),D(this.fields,e.length),this.fields.push(...B.normalizeFields(...e)),this}spliceFields(e,n,...o){return(0,m.default)(o,"fields",M),D(this.fields,o.length-n),this.fields.splice(e,n,...B.normalizeFields(...o)),this}setAuthor(e){if(e===null)return this.author=void 0,this;let{name:n,iconURL:o,url:p}=e;return(0,m.default)(n,"name",X),(0,m.default)(o,"iconURL",b),(0,m.default)(p,"url",b),this.author={name:n,url:p,icon_url:o},this}setColor(e){return(0,m.default)(e,"color",Y),this.color=e??void 0,this}setDescription(e){return(0,m.default)(e,"description",Z),this.description=e??void 0,this}setFooter(e){if(e===null)return this.footer=void 0,this;let{text:n,iconURL:o}=e;return(0,m.default)(n,"text",ee),(0,m.default)(o,"iconURL",b),this.footer={text:n,icon_url:o},this}setImage(e){return(0,m.default)(e,"url",b),this.image=e?{url:e}:void 0,this}setThumbnail(e){return(0,m.default)(e,"url",b),this.thumbnail=e?{url:e}:void 0,this}setTimestamp(e=Date.now()){return(0,m.default)(e,"timestamp",te),this.timestamp=e?new Date(e).toISOString():void 0,this}setTitle(e){return(0,m.default)(e,"title",ne),this.title=e??void 0,this}setURL(e){return(0,m.default)(e,"url",b),this.url=e??void 0,this}toJSON(){return{...this}}static normalizeFields(...e){return e.flat(1/0).map(n=>((0,m.default)(n.name,"field name",v),(0,m.default)(n.value,"field value",E),(0,m.default)(n.inline,"field inline",R),{name:n.name,value:n.value,inline:n.inline??void 0}))}};function Ue(t,e){return typeof e=="undefined"?`\`\`\`
${t}\`\`\``:`\`\`\`${t}
${e}\`\`\``}function Ge(t){return`\`${t}\``}function Fe(t){return`_${t}_`}function Je(t){return`**${t}**`}function qe(t){return`__${t}__`}function Ve(t){return`~~${t}~~`}function We(t){return`> ${t}`}function je(t){return`>>> ${t}`}function ze(t){return`<${t}>`}function Ke(t,e,n){return n?`[${t}](${e} "${n}")`:`[${t}](${e})`}function Qe(t){return`||${t}||`}function He(t){return`<@${t}>`}function Xe(t){return`<@!${t}>`}function Ye(t){return`<#${t}>`}function Ze(t){return`<@&${t}>`}function et(t,e=!1){return`<${e?"a":""}:_:${t}>`}function tt(t,e){return typeof t!="number"&&(t=Math.floor((t?.getTime()??Date.now())/1e3)),typeof e=="string"?`<t:${t}:${e}>`:`<t:${t}>`}var nt={ShortTime:"t",LongTime:"T",ShortDate:"d",LongDate:"D",ShortDateTime:"f",LongDateTime:"F",RelativeTime:"R"},oe;(function(o){o.Shrug="\xAF\\_(\u30C4)\\_/\xAF",o.Tableflip="(\u256F\xB0\u25A1\xB0\uFF09\u256F\uFE35 \u253B\u2501\u253B",o.Unflip="\u252C\u2500\u252C \u30CE( \u309C-\u309C\u30CE)"})(oe||(oe={}));var ae={};L(ae,{assertReturnOfBuilder:()=>y,validateDefaultPermission:()=>re,validateDescription:()=>U,validateMaxChoicesLength:()=>se,validateMaxOptionsLength:()=>C,validateName:()=>k,validateRequiredParameters:()=>x});var _=s(require("@sindresorhus/is")),h=s(require("ow"));function x(t,e,n){k(t),U(e),C(n)}var it=h.default.string.lowercase.minLength(1).maxLength(32).addValidator({message:(t,e)=>`Expected ${e} to match "^[\\p{L}\\p{N}_-]+$", got ${t} instead`,validator:t=>/^[\p{L}\p{N}_-]+$/u.test(t)});function k(t){(0,h.default)(t,"name",it)}var ot=h.default.string.minLength(1).maxLength(100);function U(t){(0,h.default)(t,"description",ot)}var rt=h.default.boolean;function re(t){(0,h.default)(t,"default_permission",rt)}var Be=h.default.array.maxLength(25);function C(t){(0,h.default)(t,"options",Be)}function se(t){(0,h.default)(t,"choices",Be)}function y(t,e){let n=e.name;if(_.default.nullOrUndefined(t))throw new TypeError(`Expected to receive a ${n} builder, got ${t===null?"null":"undefined"} instead.`);if(_.default.primitive(t))throw new TypeError(`Expected to receive a ${n} builder, got a primitive (${typeof t}) instead.`);if(!(t instanceof e)){let o=t,p=_.default.function_(t)?t.name:o.constructor.name,P=Reflect.get(o,Symbol.toStringTag),$=P?`${p} [${P}]`:p;throw new TypeError(`Expected to receive a ${n} builder, got ${$} instead.`)}}var we=s(require("ts-mixer"));var me=s(require("discord-api-types/v9"));var N=s(require("ow"));var S=class{constructor(){i(this,"name");i(this,"description")}setName(e){return k(e),Reflect.set(this,"name",e),this}setDescription(e){return U(e),Reflect.set(this,"description",e),this}};var d=class extends S{constructor(e){super();i(this,"required",!1);i(this,"type");this.type=e}setRequired(e){return(0,N.default)(e,"required",N.default.boolean),this.required=e,this}toJSON(){return x(this.name,this.description,[]),(0,N.default)(this.required,"required",N.default.boolean),{type:this.type,name:this.name,description:this.description,required:this.required}}};var G=class extends d{constructor(){super(me.ApplicationCommandOptionType.Boolean);i(this,"type",me.ApplicationCommandOptionType.Boolean)}};var le=s(require("discord-api-types/v9"));var l=s(require("discord-api-types/v9")),pe=s(require("ow"));var st=[l.ChannelType.GuildCategory,l.ChannelType.GuildNews,l.ChannelType.GuildNewsThread,l.ChannelType.GuildStore,l.ChannelType.GuildStageVoice,l.ChannelType.GuildText,l.ChannelType.GuildVoice,l.ChannelType.GuildPublicThread,l.ChannelType.GuildPrivateThread],at=pe.default.number.oneOf(st),de=class extends d{constructor(){super(...arguments);i(this,"channelTypes")}addChannelType(e){return this.channelTypes??=[],(0,pe.default)(e,"channel type",at),this.channelTypes.push(e),this}addChannelTypes(e){return e.forEach(n=>this.addChannelType(n)),this}toJSON(){return{...super.toJSON(),type:l.ApplicationCommandOptionType.Channel,channel_types:this.channelTypes}}};var F=class extends de{constructor(){super(le.ApplicationCommandOptionType.Channel);i(this,"type",le.ApplicationCommandOptionType.Channel)}};var he=s(require("discord-api-types/v9"));var c=s(require("discord-api-types/v9")),u=s(require("ow"));var ce=u.default.string.minLength(1).maxLength(100),Ne=u.default.number.finite,mt=u.default.array.ofType(u.default.array.exactShape([ce,u.default.any(u.default.string,Ne)])),g=class extends d{constructor(){super(...arguments);i(this,"choices")}addChoice(e,n){return this.choices??=[],se(this.choices),(0,u.default)(e,`${ue[this.type]} choice name`,ce),this.type===c.ApplicationCommandOptionType.String?(0,u.default)(n,"string choice value",ce):(0,u.default)(n,`${ue[this.type]} choice value`,Ne),this.choices.push({name:e,value:n}),this}addChoices(e){(0,u.default)(e,`${ue[this.type]} choices`,mt);for(let[n,o]of e)this.addChoice(n,o);return this}toJSON(){return{...super.toJSON(),choices:this.choices}}},ue={[c.ApplicationCommandOptionType.Subcommand]:"subcommand",[c.ApplicationCommandOptionType.SubcommandGroup]:"subcommand group",[c.ApplicationCommandOptionType.String]:"string",[c.ApplicationCommandOptionType.Integer]:"integer",[c.ApplicationCommandOptionType.Boolean]:"boolean",[c.ApplicationCommandOptionType.User]:"user",[c.ApplicationCommandOptionType.Channel]:"channel",[c.ApplicationCommandOptionType.Role]:"role",[c.ApplicationCommandOptionType.Mentionable]:"mentionable",[c.ApplicationCommandOptionType.Number]:"number"};var J=class extends g{constructor(){super(he.ApplicationCommandOptionType.Integer);i(this,"type",he.ApplicationCommandOptionType.Integer)}};var Ce=s(require("discord-api-types/v9"));var q=class extends d{constructor(){super(Ce.ApplicationCommandOptionType.Mentionable);i(this,"type",Ce.ApplicationCommandOptionType.Mentionable)}};var fe=s(require("discord-api-types/v9"));var V=class extends g{constructor(){super(fe.ApplicationCommandOptionType.Number);i(this,"type",fe.ApplicationCommandOptionType.Number)}};var be=s(require("discord-api-types/v9"));var W=class extends d{constructor(){super(be.ApplicationCommandOptionType.Role);i(this,"type",be.ApplicationCommandOptionType.Role)}};var xe=s(require("discord-api-types/v9"));var j=class extends g{constructor(){super(xe.ApplicationCommandOptionType.String);i(this,"type",xe.ApplicationCommandOptionType.String)}};var ye=s(require("discord-api-types/v9"));var z=class extends d{constructor(){super(ye.ApplicationCommandOptionType.User);i(this,"type",ye.ApplicationCommandOptionType.User)}};var w=class{constructor(){i(this,"options")}addBooleanOption(e){return this._sharedAddOptionMethod(e,G)}addUserOption(e){return this._sharedAddOptionMethod(e,z)}addChannelOption(e){return this._sharedAddOptionMethod(e,F)}addRoleOption(e){return this._sharedAddOptionMethod(e,W)}addMentionableOption(e){return this._sharedAddOptionMethod(e,q)}addStringOption(e){return this._sharedAddOptionMethod(e,j)}addIntegerOption(e){return this._sharedAddOptionMethod(e,J)}addNumberOption(e){return this._sharedAddOptionMethod(e,V)}_sharedAddOptionMethod(e,n){let{options:o}=this;C(o);let p=typeof e=="function"?e(new n):e;return y(p,n),o.push(p),this}};var Se=s(require("discord-api-types/v9")),ge=s(require("ts-mixer"));var O=class{constructor(){i(this,"name");i(this,"description");i(this,"options",[])}addSubcommand(e){let{options:n}=this;C(n);let o=typeof e=="function"?e(new f):e;return y(o,f),n.push(o),this}toJSON(){return x(this.name,this.description,this.options),{type:Se.ApplicationCommandOptionType.SubcommandGroup,name:this.name,description:this.description,options:this.options.map(e=>e.toJSON())}}};O=I([(0,ge.mix)(S)],O);var f=class{constructor(){i(this,"name");i(this,"description");i(this,"options",[])}toJSON(){return x(this.name,this.description,this.options),{type:Se.ApplicationCommandOptionType.Subcommand,name:this.name,description:this.description,options:this.options.map(e=>e.toJSON())}}};f=I([(0,ge.mix)(S,w)],f);var K=class{constructor(){i(this,"name");i(this,"description");i(this,"options",[]);i(this,"defaultPermission")}toJSON(){return x(this.name,this.description,this.options),{name:this.name,description:this.description,options:this.options.map(e=>e.toJSON()),default_permission:this.defaultPermission}}setDefaultPermission(e){return re(e),Reflect.set(this,"defaultPermission",e),this}addSubcommandGroup(e){let{options:n}=this;C(n);let o=typeof e=="function"?e(new O):e;return y(o,O),n.push(o),this}addSubcommand(e){let{options:n}=this;C(n);let o=typeof e=="function"?e(new f):e;return y(o,f),n.push(o),this}};K=I([(0,we.mix)(w,S)],K);var Te={};L(Te,{validateDefaultPermission:()=>Pe,validateName:()=>Q,validateRequiredParameters:()=>Ae,validateType:()=>H});var A=s(require("ow")),Oe=s(require("discord-api-types/v9"));function Ae(t,e){Q(t),H(e)}var pt=A.default.string.minLength(1).maxLength(32).matches(/^( *[\p{L}\p{N}_-]+ *)+$/u);function Q(t){(0,A.default)(t,"name",pt)}var dt=A.default.number.oneOf([Oe.ApplicationCommandType.User,Oe.ApplicationCommandType.Message]);function H(t){(0,A.default)(t,"type",dt)}var lt=A.default.boolean;function Pe(t){(0,A.default)(t,"default_permission",lt)}var Le=class{constructor(){i(this,"name");i(this,"type");i(this,"defaultPermission")}setName(e){return Q(e),Reflect.set(this,"name",e),this}setType(e){return H(e),Reflect.set(this,"type",e),this}setDefaultPermission(e){return Pe(e),Reflect.set(this,"defaultPermission",e),this}toJSON(){return Ae(this.name,this.type),{name:this.name,type:this.type,default_permission:this.defaultPermission}}};0&&(module.exports={ContextMenuCommandAssertions,ContextMenuCommandBuilder,Embed,EmbedAssertions,Faces,SlashCommandAssertions,SlashCommandBooleanOption,SlashCommandBuilder,SlashCommandChannelOption,SlashCommandIntegerOption,SlashCommandMentionableOption,SlashCommandNumberOption,SlashCommandRoleOption,SlashCommandStringOption,SlashCommandSubcommandBuilder,SlashCommandSubcommandGroupBuilder,SlashCommandUserOption,TimestampStyles,blockQuote,bold,channelMention,codeBlock,formatEmoji,hideLinkEmbed,hyperlink,inlineCode,italic,memberNicknameMention,quote,roleMention,spoiler,strikethrough,time,underscore,userMention});
//# sourceMappingURL=index.js.map