@discordjs/builders 0.13.0-dev.1646395406.6f7a366 → 0.13.0-dev.1646611698.b9ff7b0
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 +7 -19
- 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 +3 -2
package/dist/index.d.ts
CHANGED
|
@@ -1061,18 +1061,12 @@ declare const allowedChannelTypes: readonly [ChannelType.GuildText, ChannelType.
|
|
|
1061
1061
|
declare type ApplicationCommandOptionAllowedChannelTypes = typeof allowedChannelTypes[number];
|
|
1062
1062
|
declare class ApplicationCommandOptionChannelTypesMixin {
|
|
1063
1063
|
readonly channel_types?: ApplicationCommandOptionAllowedChannelTypes[];
|
|
1064
|
-
/**
|
|
1065
|
-
* Adds a channel type to this option
|
|
1066
|
-
*
|
|
1067
|
-
* @param channelType The type of channel to allow
|
|
1068
|
-
*/
|
|
1069
|
-
addChannelType(channelType: ApplicationCommandOptionAllowedChannelTypes): this;
|
|
1070
1064
|
/**
|
|
1071
1065
|
* Adds channel types to this option
|
|
1072
1066
|
*
|
|
1073
1067
|
* @param channelTypes The channel types to add
|
|
1074
1068
|
*/
|
|
1075
|
-
addChannelTypes(channelTypes: ApplicationCommandOptionAllowedChannelTypes[]): this;
|
|
1069
|
+
addChannelTypes(...channelTypes: ApplicationCommandOptionAllowedChannelTypes[]): this;
|
|
1076
1070
|
}
|
|
1077
1071
|
|
|
1078
1072
|
declare class SlashCommandChannelOption extends ApplicationCommandOptionBase {
|
|
@@ -1101,12 +1095,6 @@ declare class ApplicationCommandOptionWithChoicesAndAutocompleteMixin<T extends
|
|
|
1101
1095
|
readonly choices?: APIApplicationCommandOptionChoice<T>[];
|
|
1102
1096
|
readonly autocomplete?: boolean;
|
|
1103
1097
|
readonly type: ApplicationCommandOptionType;
|
|
1104
|
-
/**
|
|
1105
|
-
* Adds a choice for this option
|
|
1106
|
-
*
|
|
1107
|
-
* @param choice The choice to add
|
|
1108
|
-
*/
|
|
1109
|
-
addChoice(choice: APIApplicationCommandOptionChoice<T>): this;
|
|
1110
1098
|
/**
|
|
1111
1099
|
* Adds multiple choices for this option
|
|
1112
1100
|
*
|
|
@@ -1209,19 +1197,19 @@ declare class SharedSlashCommandOptions<ShouldOmitSubcommandFunctions = true> {
|
|
|
1209
1197
|
*
|
|
1210
1198
|
* @param input A function that returns an option builder, or an already built builder
|
|
1211
1199
|
*/
|
|
1212
|
-
addStringOption(input: SlashCommandStringOption | Omit<SlashCommandStringOption, 'setAutocomplete'> | Omit<SlashCommandStringOption, '
|
|
1200
|
+
addStringOption(input: SlashCommandStringOption | Omit<SlashCommandStringOption, 'setAutocomplete'> | Omit<SlashCommandStringOption, 'addChoices'> | ((builder: SlashCommandStringOption) => SlashCommandStringOption | Omit<SlashCommandStringOption, 'setAutocomplete'> | Omit<SlashCommandStringOption, 'addChoices'>)): ShouldOmitSubcommandFunctions extends true ? Omit<this, "addSubcommand" | "addSubcommandGroup"> : this;
|
|
1213
1201
|
/**
|
|
1214
1202
|
* Adds an integer option
|
|
1215
1203
|
*
|
|
1216
1204
|
* @param input A function that returns an option builder, or an already built builder
|
|
1217
1205
|
*/
|
|
1218
|
-
addIntegerOption(input: SlashCommandIntegerOption | Omit<SlashCommandIntegerOption, 'setAutocomplete'> | Omit<SlashCommandIntegerOption, '
|
|
1206
|
+
addIntegerOption(input: SlashCommandIntegerOption | Omit<SlashCommandIntegerOption, 'setAutocomplete'> | Omit<SlashCommandIntegerOption, 'addChoices'> | ((builder: SlashCommandIntegerOption) => SlashCommandIntegerOption | Omit<SlashCommandIntegerOption, 'setAutocomplete'> | Omit<SlashCommandIntegerOption, 'addChoices'>)): ShouldOmitSubcommandFunctions extends true ? Omit<this, "addSubcommand" | "addSubcommandGroup"> : this;
|
|
1219
1207
|
/**
|
|
1220
1208
|
* Adds a number option
|
|
1221
1209
|
*
|
|
1222
1210
|
* @param input A function that returns an option builder, or an already built builder
|
|
1223
1211
|
*/
|
|
1224
|
-
addNumberOption(input: SlashCommandNumberOption | Omit<SlashCommandNumberOption, 'setAutocomplete'> | Omit<SlashCommandNumberOption, '
|
|
1212
|
+
addNumberOption(input: SlashCommandNumberOption | Omit<SlashCommandNumberOption, 'setAutocomplete'> | Omit<SlashCommandNumberOption, 'addChoices'> | ((builder: SlashCommandNumberOption) => SlashCommandNumberOption | Omit<SlashCommandNumberOption, 'setAutocomplete'> | Omit<SlashCommandNumberOption, 'addChoices'>)): ShouldOmitSubcommandFunctions extends true ? Omit<this, "addSubcommand" | "addSubcommandGroup"> : this;
|
|
1225
1213
|
private _sharedAddOptionMethod;
|
|
1226
1214
|
}
|
|
1227
1215
|
|
|
@@ -1340,13 +1328,13 @@ declare function validateMaxOptionsLength(options: unknown): asserts options is
|
|
|
1340
1328
|
declare function validateRequiredParameters$1(name: string, description: string, options: ToAPIApplicationCommandOptions[]): void;
|
|
1341
1329
|
declare function validateDefaultPermission$1(value: unknown): asserts value is boolean;
|
|
1342
1330
|
declare function validateRequired(required: unknown): asserts required is boolean;
|
|
1343
|
-
declare function
|
|
1331
|
+
declare function validateChoicesLength(amountAdding: number, choices?: APIApplicationCommandOptionChoice[]): void;
|
|
1344
1332
|
declare function assertReturnOfBuilder<T extends ApplicationCommandOptionBase | SlashCommandSubcommandBuilder | SlashCommandSubcommandGroupBuilder>(input: unknown, ExpectedInstanceOf: new () => T): asserts input is T;
|
|
1345
1333
|
|
|
1346
1334
|
declare const Assertions$1_validateDescription: typeof validateDescription;
|
|
1347
1335
|
declare const Assertions$1_validateMaxOptionsLength: typeof validateMaxOptionsLength;
|
|
1348
1336
|
declare const Assertions$1_validateRequired: typeof validateRequired;
|
|
1349
|
-
declare const Assertions$
|
|
1337
|
+
declare const Assertions$1_validateChoicesLength: typeof validateChoicesLength;
|
|
1350
1338
|
declare const Assertions$1_assertReturnOfBuilder: typeof assertReturnOfBuilder;
|
|
1351
1339
|
declare namespace Assertions$1 {
|
|
1352
1340
|
export {
|
|
@@ -1356,7 +1344,7 @@ declare namespace Assertions$1 {
|
|
|
1356
1344
|
validateRequiredParameters$1 as validateRequiredParameters,
|
|
1357
1345
|
validateDefaultPermission$1 as validateDefaultPermission,
|
|
1358
1346
|
Assertions$1_validateRequired as validateRequired,
|
|
1359
|
-
Assertions$
|
|
1347
|
+
Assertions$1_validateChoicesLength as validateChoicesLength,
|
|
1360
1348
|
Assertions$1_assertReturnOfBuilder as assertReturnOfBuilder,
|
|
1361
1349
|
};
|
|
1362
1350
|
}
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var
|
|
1
|
+
var Xe=Object.create;var T=Object.defineProperty;var le=Object.getOwnPropertyDescriptor;var Ye=Object.getOwnPropertyNames;var to=Object.getPrototypeOf,eo=Object.prototype.hasOwnProperty;var oo=(e,t,n)=>t in e?T(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var ue=e=>T(e,"__esModule",{value:!0}),o=(e,t)=>T(e,"name",{value:t,configurable:!0});var w=(e,t)=>{for(var n in t)T(e,n,{get:t[n],enumerable:!0})},de=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of Ye(t))!eo.call(e,s)&&(n||s!=="default")&&T(e,s,{get:()=>t[s],enumerable:!(r=le(t,s))||r.enumerable});return e},D=(e,t)=>de(ue(T(e!=null?Xe(to(e)):{},"default",!t&&e&&e.__esModule?{get:()=>e.default,enumerable:!0}:{value:e,enumerable:!0})),e),no=(e=>(t,n)=>e&&e.get(t)||(n=de(ue({}),t,1),e&&e.set(t,n),n))(typeof WeakMap!="undefined"?new WeakMap:0),u=(e,t,n,r)=>{for(var s=r>1?void 0:r?le(t,n):t,g=e.length-1,M;g>=0;g--)(M=e[g])&&(s=(r?M(t,n,s):M(s))||s);return r&&s&&T(t,n,s),s};var i=(e,t,n)=>(oo(e,typeof t!="symbol"?t+"":t,n),n);var Vo={};w(Vo,{ActionRow:()=>h,ButtonComponent:()=>K,Component:()=>d,ComponentAssertions:()=>qt,ContextMenuCommandAssertions:()=>pe,ContextMenuCommandBuilder:()=>me,Embed:()=>vt,EmbedAssertions:()=>wt,Faces:()=>Ae,Modal:()=>Ht,ModalAssertions:()=>Qt,SelectMenuComponent:()=>H,SelectMenuOption:()=>Xt,SlashCommandAssertions:()=>ee,SlashCommandAttachmentOption:()=>ot,SlashCommandBooleanOption:()=>Y,SlashCommandBuilder:()=>it,SlashCommandChannelOption:()=>V,SlashCommandIntegerOption:()=>L,SlashCommandMentionableOption:()=>tt,SlashCommandNumberOption:()=>$,SlashCommandRoleOption:()=>et,SlashCommandStringOption:()=>_,SlashCommandSubcommandBuilder:()=>f,SlashCommandSubcommandGroupBuilder:()=>R,SlashCommandUserOption:()=>nt,TextInputAssertions:()=>Wt,TextInputComponent:()=>Q,TimestampStyles:()=>Oo,UnsafeButtonComponent:()=>E,UnsafeEmbed:()=>v,UnsafeModal:()=>X,UnsafeSelectMenuComponent:()=>B,UnsafeSelectMenuOption:()=>b,UnsafeTextInputComponent:()=>N,blockQuote:()=>uo,bold:()=>so,channelMention:()=>Ao,codeBlock:()=>io,createComponent:()=>Z,formatEmoji:()=>go,hideLinkEmbed:()=>co,hyperlink:()=>ho,inlineCode:()=>ro,isJSONEncodable:()=>Bo,italic:()=>ao,memberNicknameMention:()=>fo,quote:()=>lo,roleMention:()=>xo,spoiler:()=>bo,strikethrough:()=>mo,time:()=>yo,underscore:()=>po,userMention:()=>Co});var wt={};w(wt,{RGBPredicate:()=>pt,authorNamePredicate:()=>Pt,colorPredicate:()=>It,descriptionPredicate:()=>St,embedFieldPredicate:()=>be,embedFieldsArrayPredicate:()=>at,fieldInlinePredicate:()=>he,fieldLengthPredicate:()=>Ce,fieldNamePredicate:()=>rt,fieldValuePredicate:()=>ce,footerTextPredicate:()=>Rt,timestampPredicate:()=>Mt,titlePredicate:()=>Tt,urlPredicate:()=>y,validateFieldLength:()=>st});var m=require("zod"),rt=m.z.string().min(1).max(256),ce=m.z.string().min(1).max(1024),he=m.z.boolean().optional(),be=m.z.object({name:rt,value:ce,inline:he}),at=be.array(),Ce=m.z.number().lte(25);function st(e,t){Ce.parse((t?.length??0)+e)}o(st,"validateFieldLength");var Pt=rt.nullable(),y=m.z.string().url().nullish(),pt=m.z.number().int().gte(0).lte(255),It=m.z.number().int().gte(0).lte(16777215).nullable().or(m.z.tuple([pt,pt,pt])),St=m.z.string().min(1).max(4096).nullable(),Rt=m.z.string().min(1).max(2048).nullable(),Mt=m.z.union([m.z.number(),m.z.date()]).nullable(),Tt=rt.nullable();var fe=D(require("fast-deep-equal")),v=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}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.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,g=t instanceof v?t.data:t,{image:M,thumbnail:Qe,...He}=g;return(0,fe.default)(He,s)&&M?.url===n?.url&&Qe?.url===r?.url}};o(v,"UnsafeEmbed");var vt=class extends v{addFields(...t){return st(t.length,this.fields),super.addFields(...at.parse(t))}spliceFields(t,n,...r){return st(r.length-n,this.fields),super.spliceFields(t,n,...at.parse(r))}setAuthor(t){return t===null?super.setAuthor(null):(Pt.parse(t.name),y.parse(t.iconURL),y.parse(t.url),super.setAuthor(t))}setColor(t){return super.setColor(It.parse(t))}setDescription(t){return super.setDescription(St.parse(t))}setFooter(t){return t===null?super.setFooter(null):(Rt.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(Mt.parse(t))}setTitle(t){return super.setTitle(Tt.parse(t))}setURL(t){return super.setURL(y.parse(t))}};o(vt,"Embed");function io(e,t){return typeof t=="undefined"?`\`\`\`
|
|
2
2
|
${e}\`\`\``:`\`\`\`${e}
|
|
3
|
-
${t}\`\`\``}o(ro,"codeBlock");function ao(e){return`\`${e}\``}o(ao,"inlineCode");function so(e){return`_${e}_`}o(so,"italic");function po(e){return`**${e}**`}o(po,"bold");function mo(e){return`__${e}__`}o(mo,"underscore");function lo(e){return`~~${e}~~`}o(lo,"strikethrough");function uo(e){return`> ${e}`}o(uo,"quote");function co(e){return`>>> ${e}`}o(co,"blockQuote");function ho(e){return`<${e}>`}o(ho,"hideLinkEmbed");function bo(e,t,n){return n?`[${e}](${t} "${n}")`:`[${e}](${t})`}o(bo,"hyperlink");function Co(e){return`||${e}||`}o(Co,"spoiler");function fo(e){return`<@${e}>`}o(fo,"userMention");function Ao(e){return`<@!${e}>`}o(Ao,"memberNicknameMention");function xo(e){return`<#${e}>`}o(xo,"channelMention");function yo(e){return`<@&${e}>`}o(yo,"roleMention");function go(e,t=!1){return`<${t?"a":""}:_:${e}>`}o(go,"formatEmoji");function Oo(e,t){return typeof e!="number"&&(e=Math.floor((e?.getTime()??Date.now())/1e3)),typeof t=="string"?`<t:${e}:${t}>`:`<t:${e}>`}o(Oo,"time");var Po={ShortTime:"t",LongTime:"T",ShortDate:"d",LongDate:"D",ShortDateTime:"f",LongDateTime:"F",RelativeTime:"R"},Ae=(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))(Ae||{});var qt={};w(qt,{buttonLabelValidator:()=>Et,buttonStyleValidator:()=>Nt,customIdValidator:()=>c,defaultValidator:()=>Lt,disabledValidator:()=>F,emojiValidator:()=>j,labelValueValidator:()=>G,minMaxValidator:()=>lt,optionsValidator:()=>xe,placeholderValidator:()=>Bt,urlValidator:()=>_t,validateRequiredButtonParameters:()=>Dt,validateRequiredSelectMenuOptionParameters:()=>$t,validateRequiredSelectMenuParameters:()=>Vt});var mt=require("discord-api-types/v9"),l=require("zod"),c=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(),F=l.z.boolean(),Et=l.z.string().nonempty().max(80),Nt=l.z.number().int().min(mt.ButtonStyle.Primary).max(mt.ButtonStyle.Link),Bt=l.z.string().max(100),lt=l.z.number().int().min(0).max(25),xe=l.z.object({}).array().nonempty();function Vt(e,t){c.parse(t),xe.parse(e)}o(Vt,"validateRequiredSelectMenuParameters");var G=l.z.string().min(1).max(100),Lt=l.z.boolean();function $t(e,t){G.parse(e),G.parse(t)}o($t,"validateRequiredSelectMenuOptionParameters");var _t=l.z.string().url();function Dt(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===mt.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(Dt,"validateRequiredButtonParameters");var ye=require("discord-api-types/v9");var u=class{constructor(t){i(this,"data");this.data=t}get type(){return this.data.type}};o(u,"Component");var z=require("discord-api-types/v9");function W(e){if(e instanceof u)return e;switch(e.type){case z.ComponentType.ActionRow:return new h(e);case z.ComponentType.Button:return new Z(e);case z.ComponentType.SelectMenu:return new Q(e);case z.ComponentType.TextInput:return new K(e);default:throw new Error(`Cannot serialize component type: ${e.type}`)}}o(W,"createComponent");var dt=D(require("fast-deep-equal")),h=class extends u{constructor({components:t,...n}={}){super({type:ye.ComponentType.ActionRow,...n});i(this,"components");this.components=t?.map(r=>W(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 h?(0,dt.default)(t.data,this.data)&&(0,dt.default)(t.components,this.components):(0,dt.default)(t,{...this.data,components:this.components.map(n=>n.toJSON())})}};o(h,"ActionRow");var ge=require("discord-api-types/v9");var Jt=D(require("fast-deep-equal")),E=class extends u{constructor(t){super({type:ge.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=!0){return this.data.disabled=t,this}setLabel(t){return this.data.label=t,this}toJSON(){return{...this.data}}equals(t){return t instanceof E?(0,Jt.default)(t.data,this.data):(0,Jt.default)(t,this.data)}};o(E,"UnsafeButtonComponent");var Z=class extends E{setStyle(t){return super.setStyle(Nt.parse(t))}setURL(t){return super.setURL(_t.parse(t))}setCustomId(t){return super.setCustomId(c.parse(t))}setEmoji(t){return super.setEmoji(j.parse(t))}setDisabled(t=!0){return super.setDisabled(F.parse(t))}setLabel(t){return super.setLabel(Et.parse(t))}toJSON(){return Dt(this.style,this.label,this.emoji,this.customId,this.url),super.toJSON()}};o(Z,"ButtonComponent");var Wt={};w(Wt,{labelValidator:()=>Ie,maxLengthValidator:()=>kt,minLengthValidator:()=>Ut,placeholderValidator:()=>Gt,requiredValidator:()=>jt,textInputStyleValidator:()=>Pe,validateRequiredParameters:()=>zt,valueValidator:()=>Ft});var Oe=require("discord-api-types/v9"),O=require("zod");var Pe=O.z.nativeEnum(Oe.TextInputStyle),Ut=O.z.number().int().min(0).max(4e3),kt=O.z.number().int().min(1).max(4e3),jt=O.z.boolean(),Ft=O.z.string().max(4e3),Gt=O.z.string().max(100),Ie=O.z.string().min(1).max(45);function zt(e,t,n){c.parse(e),Pe.parse(t),Ie.parse(n)}o(zt,"validateRequiredParameters");var Se=require("discord-api-types/v9");var Zt=D(require("fast-deep-equal")),N=class extends u{constructor(t){super({type:Se.ComponentType.TextInput,...t})}get style(){return this.data.style}get customId(){return this.data.custom_id}get label(){return this.data.label}get placeholder(){return this.data.placeholder}get value(){return this.data.value}get minLength(){return this.data.min_length}get maxLength(){return this.data.max_length}get required(){return this.data.required}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 N?(0,Zt.default)(t.data,this.data):(0,Zt.default)(t,this.data)}};o(N,"UnsafeTextInputComponent");var K=class extends N{setMinLength(t){return super.setMinLength(Ut.parse(t))}setMaxLength(t){return super.setMaxLength(kt.parse(t))}setRequired(t=!0){return super.setRequired(jt.parse(t))}setValue(t){return super.setValue(Ft.parse(t))}setPlaceholder(t){return super.setPlaceholder(Gt.parse(t))}toJSON(){return zt(this.data.custom_id,this.data.style,this.data.label),super.toJSON()}};o(K,"TextInputComponent");var H=class{constructor({components:t,...n}={}){i(this,"data");i(this,"components",[]);this.data={...n},this.components=t?.map(r=>W(r))??[]}get customId(){return this.data.custom_id}get title(){return this.data.title}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 h?n:new h(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(H,"UnsafeModal");var Qt={};w(Qt,{componentsValidator:()=>Re,titleValidator:()=>ct,validateRequiredParameters:()=>Kt});var ut=require("zod");var ct=ut.z.string().min(1).max(45),Re=ut.z.array(ut.z.instanceof(h)).min(1);function Kt(e,t,n){c.parse(e),ct.parse(t),Re.parse(n)}o(Kt,"validateRequiredParameters");var Ht=class extends H{setCustomId(t){return super.setCustomId(c.parse(t))}setTitle(t){return super.setTitle(ct.parse(t))}toJSON(){return Kt(this.data.custom_id,this.data.title,this.components),super.toJSON()}};o(Ht,"Modal");var Me=require("discord-api-types/v9");var b=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=!0){return this.data.default=t,this}setEmoji(t){return this.data.emoji=t,this}toJSON(){return{...this.data}}};o(b,"UnsafeSelectMenuOption");var ht=D(require("fast-deep-equal")),B=class extends u{constructor(t){let{options:n,...r}=t??{};super({type:Me.ComponentType.SelectMenu,...r});i(this,"options");this.options=n?.map(s=>new b(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=!0){return this.data.disabled=t,this}addOptions(...t){return this.options.push(...t.map(n=>n instanceof b?n:new b(n))),this}setOptions(...t){return this.options.splice(0,this.options.length,...t.map(n=>n instanceof b?n:new b(n))),this}toJSON(){return{...this.data,options:this.options.map(t=>t.toJSON())}}equals(t){return t instanceof B?(0,ht.default)(t.data,this.data)&&(0,ht.default)(t.options,this.options):(0,ht.default)(t,{...this.data,options:this.options.map(n=>n.toJSON())})}};o(B,"UnsafeSelectMenuComponent");var Q=class extends B{setPlaceholder(t){return super.setPlaceholder(Bt.parse(t))}setMinValues(t){return super.setMinValues(lt.parse(t))}setMaxValues(t){return super.setMaxValues(lt.parse(t))}setCustomId(t){return super.setCustomId(c.parse(t))}setDisabled(t=!0){return super.setDisabled(F.parse(t))}toJSON(){return Vt(this.options,this.customId),super.toJSON()}};o(Q,"SelectMenuComponent");var Xt=class extends b{setDescription(t){return super.setDescription(G.parse(t))}setDefault(t=!0){return super.setDefault(Lt.parse(t))}setEmoji(t){return super.setEmoji(j.parse(t))}toJSON(){return $t(this.label,this.value),super.toJSON()}};o(Xt,"SelectMenuOption");var ee={};w(ee,{assertReturnOfBuilder:()=>I,validateDefaultPermission:()=>Yt,validateDescription:()=>ft,validateMaxChoicesLength:()=>te,validateMaxOptionsLength:()=>A,validateName:()=>Ct,validateRequired:()=>At,validateRequiredParameters:()=>P});var bt=D(require("@sindresorhus/is")),X=require("zod"),Io=X.z.string().min(1).max(32).regex(/^[\P{Lu}\p{N}_-]+$/u);function Ct(e){Io.parse(e)}o(Ct,"validateName");var So=X.z.string().min(1).max(100);function ft(e){So.parse(e)}o(ft,"validateDescription");var Te=X.z.unknown().array().max(25);function A(e){Te.parse(e)}o(A,"validateMaxOptionsLength");function P(e,t,n){Ct(e),ft(t),A(n)}o(P,"validateRequiredParameters");var we=X.z.boolean();function Yt(e){we.parse(e)}o(Yt,"validateDefaultPermission");function At(e){we.parse(e)}o(At,"validateRequired");function te(e){Te.parse(e)}o(te,"validateMaxChoicesLength");function I(e,t){let n=t.name;if(bt.default.nullOrUndefined(e))throw new TypeError(`Expected to receive a ${n} builder, got ${e===null?"null":"undefined"} instead.`);if(bt.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=bt.default.function_(e)?e.name:r.constructor.name,y=Reflect.get(r,Symbol.toStringTag),M=y?`${s} [${y}]`:s;throw new TypeError(`Expected to receive a ${n} builder, got ${M} instead.`)}}o(I,"assertReturnOfBuilder");var Qe=require("ts-mixer");var ve=require("discord-api-types/v9");var x=class{constructor(){i(this,"name");i(this,"description")}setName(t){return Ct(t),Reflect.set(this,"name",t),this}setDescription(t){return ft(t),Reflect.set(this,"description",t),this}};o(x,"SharedNameAndDescription");var p=class extends x{constructor(){super(...arguments);i(this,"required",!1)}setRequired(t){return At(t),Reflect.set(this,"required",t),this}runRequiredValidations(){P(this.name,this.description,[]),At(this.required)}};o(p,"ApplicationCommandOptionBase");var Y=class extends p{constructor(){super(...arguments);i(this,"type",ve.ApplicationCommandOptionType.Boolean)}toJSON(){return this.runRequiredValidations(),{...this}}};o(Y,"SlashCommandBooleanOption");var Ee=require("discord-api-types/v9"),Ne=require("ts-mixer");var C=require("discord-api-types/v9"),oe=require("zod"),Ro=[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],Mo=oe.z.union(Ro.map(e=>oe.z.literal(e))),xt=class{constructor(){i(this,"channel_types")}addChannelType(t){return this.channel_types===void 0&&Reflect.set(this,"channel_types",[]),Mo.parse(t),this.channel_types.push(t),this}addChannelTypes(t){return t.forEach(n=>this.addChannelType(n)),this}};o(xt,"ApplicationCommandOptionChannelTypesMixin");var V=class extends p{constructor(){super(...arguments);i(this,"type",Ee.ApplicationCommandOptionType.Channel)}toJSON(){return this.runRequiredValidations(),{...this}}};o(V,"SlashCommandChannelOption"),V=d([(0,Ne.mix)(xt)],V);var $e=require("discord-api-types/v9"),_e=require("ts-mixer"),De=require("zod");var q=class{constructor(){i(this,"max_value");i(this,"min_value")}};o(q,"ApplicationCommandNumericOptionMinMaxValueMixin");var Be=require("discord-api-types/v9"),J=require("zod");var yt=J.z.string().min(1).max(100),Ve=J.z.number().gt(-1/0).lt(1/0),Le=J.z.object({name:yt,value:J.z.union([yt,Ve])}).array(),To=J.z.boolean(),S=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",[]),te(this.choices),yt.parse(n),this.type===Be.ApplicationCommandOptionType.String?yt.parse(r):Ve.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.");Le.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.");Le.parse(t),Reflect.set(this,"choices",[]);for(let n of t)this.addChoice(n);return this}setAutocomplete(t){if(To.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(S,"ApplicationCommandOptionWithChoicesAndAutocompleteMixin");var qe=De.z.number().int(),L=class extends p{constructor(){super(...arguments);i(this,"type",$e.ApplicationCommandOptionType.Integer)}setMaxValue(t){return qe.parse(t),Reflect.set(this,"max_value",t),this}setMinValue(t){return qe.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(L,"SlashCommandIntegerOption"),L=d([(0,_e.mix)(q,S)],L);var Je=require("discord-api-types/v9");var tt=class extends p{constructor(){super(...arguments);i(this,"type",Je.ApplicationCommandOptionType.Mentionable)}toJSON(){return this.runRequiredValidations(),{...this}}};o(tt,"SlashCommandMentionableOption");var Ue=require("discord-api-types/v9"),ke=require("ts-mixer"),je=require("zod");var Fe=je.z.number(),$=class extends p{constructor(){super(...arguments);i(this,"type",Ue.ApplicationCommandOptionType.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($,"SlashCommandNumberOption"),$=d([(0,ke.mix)(q,S)],$);var Ge=require("discord-api-types/v9");var et=class extends p{constructor(){super(...arguments);i(this,"type",Ge.ApplicationCommandOptionType.Role)}toJSON(){return this.runRequiredValidations(),{...this}}};o(et,"SlashCommandRoleOption");var ze=require("discord-api-types/v9");var ot=class extends p{constructor(){super(...arguments);i(this,"type",ze.ApplicationCommandOptionType.Attachment)}toJSON(){return this.runRequiredValidations(),{...this}}};o(ot,"SlashCommandAttachmentOption");var We=require("discord-api-types/v9"),Ze=require("ts-mixer");var _=class extends p{constructor(){super(...arguments);i(this,"type",We.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(_,"SlashCommandStringOption"),_=d([(0,Ze.mix)(S)],_);var Ke=require("discord-api-types/v9");var nt=class extends p{constructor(){super(...arguments);i(this,"type",Ke.ApplicationCommandOptionType.User)}toJSON(){return this.runRequiredValidations(),{...this}}};o(nt,"SlashCommandUserOption");var U=class{constructor(){i(this,"options")}addBooleanOption(t){return this._sharedAddOptionMethod(t,Y)}addUserOption(t){return this._sharedAddOptionMethod(t,nt)}addChannelOption(t){return this._sharedAddOptionMethod(t,V)}addRoleOption(t){return this._sharedAddOptionMethod(t,et)}addAttachmentOption(t){return this._sharedAddOptionMethod(t,ot)}addMentionableOption(t){return this._sharedAddOptionMethod(t,tt)}addStringOption(t){return this._sharedAddOptionMethod(t,_)}addIntegerOption(t){return this._sharedAddOptionMethod(t,L)}addNumberOption(t){return this._sharedAddOptionMethod(t,$)}_sharedAddOptionMethod(t,n){let{options:r}=this;A(r);let s=typeof t=="function"?t(new n):t;return I(s,n),r.push(s),this}};o(U,"SharedSlashCommandOptions");var ne=require("discord-api-types/v9"),ie=require("ts-mixer");var R=class{constructor(){i(this,"name");i(this,"description");i(this,"options",[])}addSubcommand(t){let{options:n}=this;A(n);let r=typeof t=="function"?t(new f):t;return I(r,f),n.push(r),this}toJSON(){return P(this.name,this.description,this.options),{type:ne.ApplicationCommandOptionType.SubcommandGroup,name:this.name,description:this.description,options:this.options.map(t=>t.toJSON())}}};o(R,"SlashCommandSubcommandGroupBuilder"),R=d([(0,ie.mix)(x)],R);var f=class{constructor(){i(this,"name");i(this,"description");i(this,"options",[])}toJSON(){return P(this.name,this.description,this.options),{type:ne.ApplicationCommandOptionType.Subcommand,name:this.name,description:this.description,options:this.options.map(t=>t.toJSON())}}};o(f,"SlashCommandSubcommandBuilder"),f=d([(0,ie.mix)(x,U)],f);var it=class{constructor(){i(this,"name");i(this,"description");i(this,"options",[]);i(this,"defaultPermission")}toJSON(){return P(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 Yt(t),Reflect.set(this,"defaultPermission",t),this}addSubcommandGroup(t){let{options:n}=this;A(n);let r=typeof t=="function"?t(new R):t;return I(r,R),n.push(r),this}addSubcommand(t){let{options:n}=this;A(n);let r=typeof t=="function"?t(new f):t;return I(r,f),n.push(r),this}};o(it,"SlashCommandBuilder"),it=d([(0,Qe.mix)(U,x)],it);var pe={};w(pe,{validateDefaultPermission:()=>ae,validateName:()=>gt,validateRequiredParameters:()=>se,validateType:()=>Ot});var k=require("zod"),re=require("discord-api-types/v9"),wo=k.z.string().min(1).max(32).regex(/^( *[\p{L}\p{N}_-]+ *)+$/u),vo=k.z.union([k.z.literal(re.ApplicationCommandType.User),k.z.literal(re.ApplicationCommandType.Message)]),Eo=k.z.boolean();function ae(e){Eo.parse(e)}o(ae,"validateDefaultPermission");function gt(e){wo.parse(e)}o(gt,"validateName");function Ot(e){vo.parse(e)}o(Ot,"validateType");function se(e,t){gt(e),Ot(t)}o(se,"validateRequiredParameters");var me=class{constructor(){i(this,"name");i(this,"type");i(this,"defaultPermission")}setName(t){return gt(t),Reflect.set(this,"name",t),this}setType(t){return Ot(t),Reflect.set(this,"type",t),this}setDefaultPermission(t){return ae(t),Reflect.set(this,"defaultPermission",t),this}toJSON(){return se(this.name,this.type),{name:this.name,type:this.type,default_permission:this.defaultPermission}}};o(me,"ContextMenuCommandBuilder");function No(e){return e!==null&&typeof e=="object"&&"toJSON"in e}o(No,"isJSONEncodable");module.exports=io(Bo);0&&(module.exports={ActionRow,ButtonComponent,Component,ComponentAssertions,ContextMenuCommandAssertions,ContextMenuCommandBuilder,Embed,EmbedAssertions,Faces,Modal,ModalAssertions,SelectMenuComponent,SelectMenuOption,SlashCommandAssertions,SlashCommandAttachmentOption,SlashCommandBooleanOption,SlashCommandBuilder,SlashCommandChannelOption,SlashCommandIntegerOption,SlashCommandMentionableOption,SlashCommandNumberOption,SlashCommandRoleOption,SlashCommandStringOption,SlashCommandSubcommandBuilder,SlashCommandSubcommandGroupBuilder,SlashCommandUserOption,TextInputAssertions,TextInputComponent,TimestampStyles,UnsafeButtonComponent,UnsafeEmbed,UnsafeModal,UnsafeSelectMenuComponent,UnsafeSelectMenuOption,UnsafeTextInputComponent,blockQuote,bold,channelMention,codeBlock,createComponent,formatEmoji,hideLinkEmbed,hyperlink,inlineCode,isJSONEncodable,italic,memberNicknameMention,quote,roleMention,spoiler,strikethrough,time,underscore,userMention});
|
|
3
|
+
${t}\`\`\``}o(io,"codeBlock");function ro(e){return`\`${e}\``}o(ro,"inlineCode");function ao(e){return`_${e}_`}o(ao,"italic");function so(e){return`**${e}**`}o(so,"bold");function po(e){return`__${e}__`}o(po,"underscore");function mo(e){return`~~${e}~~`}o(mo,"strikethrough");function lo(e){return`> ${e}`}o(lo,"quote");function uo(e){return`>>> ${e}`}o(uo,"blockQuote");function co(e){return`<${e}>`}o(co,"hideLinkEmbed");function ho(e,t,n){return n?`[${e}](${t} "${n}")`:`[${e}](${t})`}o(ho,"hyperlink");function bo(e){return`||${e}||`}o(bo,"spoiler");function Co(e){return`<@${e}>`}o(Co,"userMention");function fo(e){return`<@!${e}>`}o(fo,"memberNicknameMention");function Ao(e){return`<#${e}>`}o(Ao,"channelMention");function xo(e){return`<@&${e}>`}o(xo,"roleMention");function go(e,t=!1){return`<${t?"a":""}:_:${e}>`}o(go,"formatEmoji");function yo(e,t){return typeof e!="number"&&(e=Math.floor((e?.getTime()??Date.now())/1e3)),typeof t=="string"?`<t:${e}:${t}>`:`<t:${e}>`}o(yo,"time");var Oo={ShortTime:"t",LongTime:"T",ShortDate:"d",LongDate:"D",ShortDateTime:"f",LongDateTime:"F",RelativeTime:"R"},Ae=(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))(Ae||{});var qt={};w(qt,{buttonLabelValidator:()=>Et,buttonStyleValidator:()=>Nt,customIdValidator:()=>c,defaultValidator:()=>Lt,disabledValidator:()=>G,emojiValidator:()=>F,labelValueValidator:()=>z,minMaxValidator:()=>lt,optionsValidator:()=>xe,placeholderValidator:()=>Bt,urlValidator:()=>_t,validateRequiredButtonParameters:()=>Dt,validateRequiredSelectMenuOptionParameters:()=>$t,validateRequiredSelectMenuParameters:()=>Vt});var mt=require("discord-api-types/v9"),l=require("zod"),c=l.z.string().min(1).max(100),F=l.z.object({id:l.z.string(),name:l.z.string(),animated:l.z.boolean()}).partial().strict(),G=l.z.boolean(),Et=l.z.string().nonempty().max(80),Nt=l.z.number().int().min(mt.ButtonStyle.Primary).max(mt.ButtonStyle.Link),Bt=l.z.string().max(100),lt=l.z.number().int().min(0).max(25),xe=l.z.object({}).array().nonempty();function Vt(e,t){c.parse(t),xe.parse(e)}o(Vt,"validateRequiredSelectMenuParameters");var z=l.z.string().min(1).max(100),Lt=l.z.boolean();function $t(e,t){z.parse(e),z.parse(t)}o($t,"validateRequiredSelectMenuOptionParameters");var _t=l.z.string().url();function Dt(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===mt.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(Dt,"validateRequiredButtonParameters");var ge=require("discord-api-types/v9");var d=class{constructor(t){i(this,"data");this.data=t}get type(){return this.data.type}};o(d,"Component");var W=require("discord-api-types/v9");function Z(e){if(e instanceof d)return e;switch(e.type){case W.ComponentType.ActionRow:return new h(e);case W.ComponentType.Button:return new K(e);case W.ComponentType.SelectMenu:return new H(e);case W.ComponentType.TextInput:return new Q(e);default:throw new Error(`Cannot serialize component type: ${e.type}`)}}o(Z,"createComponent");var ut=D(require("fast-deep-equal")),h=class extends d{constructor({components:t,...n}={}){super({type:ge.ComponentType.ActionRow,...n});i(this,"components");this.components=t?.map(r=>Z(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 h?(0,ut.default)(t.data,this.data)&&(0,ut.default)(t.components,this.components):(0,ut.default)(t,{...this.data,components:this.components.map(n=>n.toJSON())})}};o(h,"ActionRow");var ye=require("discord-api-types/v9");var Jt=D(require("fast-deep-equal")),E=class extends d{constructor(t){super({type:ye.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=!0){return this.data.disabled=t,this}setLabel(t){return this.data.label=t,this}toJSON(){return{...this.data}}equals(t){return t instanceof E?(0,Jt.default)(t.data,this.data):(0,Jt.default)(t,this.data)}};o(E,"UnsafeButtonComponent");var K=class extends E{setStyle(t){return super.setStyle(Nt.parse(t))}setURL(t){return super.setURL(_t.parse(t))}setCustomId(t){return super.setCustomId(c.parse(t))}setEmoji(t){return super.setEmoji(F.parse(t))}setDisabled(t=!0){return super.setDisabled(G.parse(t))}setLabel(t){return super.setLabel(Et.parse(t))}toJSON(){return Dt(this.style,this.label,this.emoji,this.customId,this.url),super.toJSON()}};o(K,"ButtonComponent");var Wt={};w(Wt,{labelValidator:()=>Ie,maxLengthValidator:()=>kt,minLengthValidator:()=>Ut,placeholderValidator:()=>Gt,requiredValidator:()=>jt,textInputStyleValidator:()=>Pe,validateRequiredParameters:()=>zt,valueValidator:()=>Ft});var Oe=require("discord-api-types/v9"),O=require("zod");var Pe=O.z.nativeEnum(Oe.TextInputStyle),Ut=O.z.number().int().min(0).max(4e3),kt=O.z.number().int().min(1).max(4e3),jt=O.z.boolean(),Ft=O.z.string().max(4e3),Gt=O.z.string().max(100),Ie=O.z.string().min(1).max(45);function zt(e,t,n){c.parse(e),Pe.parse(t),Ie.parse(n)}o(zt,"validateRequiredParameters");var Se=require("discord-api-types/v9");var Zt=D(require("fast-deep-equal")),N=class extends d{constructor(t){super({type:Se.ComponentType.TextInput,...t})}get style(){return this.data.style}get customId(){return this.data.custom_id}get label(){return this.data.label}get placeholder(){return this.data.placeholder}get value(){return this.data.value}get minLength(){return this.data.min_length}get maxLength(){return this.data.max_length}get required(){return this.data.required}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 N?(0,Zt.default)(t.data,this.data):(0,Zt.default)(t,this.data)}};o(N,"UnsafeTextInputComponent");var Q=class extends N{setMinLength(t){return super.setMinLength(Ut.parse(t))}setMaxLength(t){return super.setMaxLength(kt.parse(t))}setRequired(t=!0){return super.setRequired(jt.parse(t))}setValue(t){return super.setValue(Ft.parse(t))}setPlaceholder(t){return super.setPlaceholder(Gt.parse(t))}toJSON(){return zt(this.data.custom_id,this.data.style,this.data.label),super.toJSON()}};o(Q,"TextInputComponent");var X=class{constructor({components:t,...n}={}){i(this,"data");i(this,"components",[]);this.data={...n},this.components=t?.map(r=>Z(r))??[]}get customId(){return this.data.custom_id}get title(){return this.data.title}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 h?n:new h(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(X,"UnsafeModal");var Qt={};w(Qt,{componentsValidator:()=>Re,titleValidator:()=>ct,validateRequiredParameters:()=>Kt});var dt=require("zod");var ct=dt.z.string().min(1).max(45),Re=dt.z.array(dt.z.instanceof(h)).min(1);function Kt(e,t,n){c.parse(e),ct.parse(t),Re.parse(n)}o(Kt,"validateRequiredParameters");var Ht=class extends X{setCustomId(t){return super.setCustomId(c.parse(t))}setTitle(t){return super.setTitle(ct.parse(t))}toJSON(){return Kt(this.data.custom_id,this.data.title,this.components),super.toJSON()}};o(Ht,"Modal");var Me=require("discord-api-types/v9");var b=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=!0){return this.data.default=t,this}setEmoji(t){return this.data.emoji=t,this}toJSON(){return{...this.data}}};o(b,"UnsafeSelectMenuOption");var ht=D(require("fast-deep-equal")),B=class extends d{constructor(t){let{options:n,...r}=t??{};super({type:Me.ComponentType.SelectMenu,...r});i(this,"options");this.options=n?.map(s=>new b(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=!0){return this.data.disabled=t,this}addOptions(...t){return this.options.push(...t.map(n=>n instanceof b?n:new b(n))),this}setOptions(...t){return this.options.splice(0,this.options.length,...t.map(n=>n instanceof b?n:new b(n))),this}toJSON(){return{...this.data,options:this.options.map(t=>t.toJSON())}}equals(t){return t instanceof B?(0,ht.default)(t.data,this.data)&&(0,ht.default)(t.options,this.options):(0,ht.default)(t,{...this.data,options:this.options.map(n=>n.toJSON())})}};o(B,"UnsafeSelectMenuComponent");var H=class extends B{setPlaceholder(t){return super.setPlaceholder(Bt.parse(t))}setMinValues(t){return super.setMinValues(lt.parse(t))}setMaxValues(t){return super.setMaxValues(lt.parse(t))}setCustomId(t){return super.setCustomId(c.parse(t))}setDisabled(t=!0){return super.setDisabled(G.parse(t))}toJSON(){return Vt(this.options,this.customId),super.toJSON()}};o(H,"SelectMenuComponent");var Xt=class extends b{setDescription(t){return super.setDescription(z.parse(t))}setDefault(t=!0){return super.setDefault(Lt.parse(t))}setEmoji(t){return super.setEmoji(F.parse(t))}toJSON(){return $t(this.label,this.value),super.toJSON()}};o(Xt,"SelectMenuOption");var ee={};w(ee,{assertReturnOfBuilder:()=>I,validateChoicesLength:()=>te,validateDefaultPermission:()=>Yt,validateDescription:()=>ft,validateMaxOptionsLength:()=>A,validateName:()=>Ct,validateRequired:()=>At,validateRequiredParameters:()=>P});var bt=D(require("@sindresorhus/is")),q=require("zod"),Po=q.z.string().min(1).max(32).regex(/^[\P{Lu}\p{N}_-]+$/u);function Ct(e){Po.parse(e)}o(Ct,"validateName");var Io=q.z.string().min(1).max(100);function ft(e){Io.parse(e)}o(ft,"validateDescription");var So=q.z.unknown().array().max(25);function A(e){So.parse(e)}o(A,"validateMaxOptionsLength");function P(e,t,n){Ct(e),ft(t),A(n)}o(P,"validateRequiredParameters");var Te=q.z.boolean();function Yt(e){Te.parse(e)}o(Yt,"validateDefaultPermission");function At(e){Te.parse(e)}o(At,"validateRequired");var Ro=q.z.number().lte(25);function te(e,t){Ro.parse((t?.length??0)+e)}o(te,"validateChoicesLength");function I(e,t){let n=t.name;if(bt.default.nullOrUndefined(e))throw new TypeError(`Expected to receive a ${n} builder, got ${e===null?"null":"undefined"} instead.`);if(bt.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=bt.default.function_(e)?e.name:r.constructor.name,g=Reflect.get(r,Symbol.toStringTag),M=g?`${s} [${g}]`:s;throw new TypeError(`Expected to receive a ${n} builder, got ${M} instead.`)}}o(I,"assertReturnOfBuilder");var Ke=require("ts-mixer");var we=require("discord-api-types/v9");var x=class{constructor(){i(this,"name");i(this,"description")}setName(t){return Ct(t),Reflect.set(this,"name",t),this}setDescription(t){return ft(t),Reflect.set(this,"description",t),this}};o(x,"SharedNameAndDescription");var p=class extends x{constructor(){super(...arguments);i(this,"required",!1)}setRequired(t){return At(t),Reflect.set(this,"required",t),this}runRequiredValidations(){P(this.name,this.description,[]),At(this.required)}};o(p,"ApplicationCommandOptionBase");var Y=class extends p{constructor(){super(...arguments);i(this,"type",we.ApplicationCommandOptionType.Boolean)}toJSON(){return this.runRequiredValidations(),{...this}}};o(Y,"SlashCommandBooleanOption");var ve=require("discord-api-types/v9"),Ee=require("ts-mixer");var C=require("discord-api-types/v9"),xt=require("zod"),Mo=[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],To=xt.z.array(xt.z.union(Mo.map(e=>xt.z.literal(e)))),gt=class{constructor(){i(this,"channel_types")}addChannelTypes(...t){return this.channel_types===void 0&&Reflect.set(this,"channel_types",[]),To.parse(t),this.channel_types.push(...t),this}};o(gt,"ApplicationCommandOptionChannelTypesMixin");var V=class extends p{constructor(){super(...arguments);i(this,"type",ve.ApplicationCommandOptionType.Channel)}toJSON(){return this.runRequiredValidations(),{...this}}};o(V,"SlashCommandChannelOption"),V=u([(0,Ee.mix)(gt)],V);var Le=require("discord-api-types/v9"),$e=require("ts-mixer"),_e=require("zod");var J=class{constructor(){i(this,"max_value");i(this,"min_value")}};o(J,"ApplicationCommandNumericOptionMinMaxValueMixin");var Ne=require("discord-api-types/v9"),U=require("zod");var oe=U.z.string().min(1).max(100),Be=U.z.number().gt(-1/0).lt(1/0),Ve=U.z.object({name:oe,value:U.z.union([oe,Be])}).array(),wo=U.z.boolean(),S=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.");Ve.parse(t),this.choices===void 0&&Reflect.set(this,"choices",[]),te(t.length,this.choices);for(let{name:n,value:r}of t)this.type===Ne.ApplicationCommandOptionType.String?oe.parse(r):Be.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 Ve.parse(t),Reflect.set(this,"choices",[]),this.addChoices(...t),this}setAutocomplete(t){if(wo.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(S,"ApplicationCommandOptionWithChoicesAndAutocompleteMixin");var De=_e.z.number().int(),L=class extends p{constructor(){super(...arguments);i(this,"type",Le.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(L,"SlashCommandIntegerOption"),L=u([(0,$e.mix)(J,S)],L);var qe=require("discord-api-types/v9");var tt=class extends p{constructor(){super(...arguments);i(this,"type",qe.ApplicationCommandOptionType.Mentionable)}toJSON(){return this.runRequiredValidations(),{...this}}};o(tt,"SlashCommandMentionableOption");var Je=require("discord-api-types/v9"),Ue=require("ts-mixer"),ke=require("zod");var je=ke.z.number(),$=class extends p{constructor(){super(...arguments);i(this,"type",Je.ApplicationCommandOptionType.Number)}setMaxValue(t){return je.parse(t),Reflect.set(this,"max_value",t),this}setMinValue(t){return je.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($,"SlashCommandNumberOption"),$=u([(0,Ue.mix)(J,S)],$);var Fe=require("discord-api-types/v9");var et=class extends p{constructor(){super(...arguments);i(this,"type",Fe.ApplicationCommandOptionType.Role)}toJSON(){return this.runRequiredValidations(),{...this}}};o(et,"SlashCommandRoleOption");var Ge=require("discord-api-types/v9");var ot=class extends p{constructor(){super(...arguments);i(this,"type",Ge.ApplicationCommandOptionType.Attachment)}toJSON(){return this.runRequiredValidations(),{...this}}};o(ot,"SlashCommandAttachmentOption");var ze=require("discord-api-types/v9"),We=require("ts-mixer");var _=class extends p{constructor(){super(...arguments);i(this,"type",ze.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(_,"SlashCommandStringOption"),_=u([(0,We.mix)(S)],_);var Ze=require("discord-api-types/v9");var nt=class extends p{constructor(){super(...arguments);i(this,"type",Ze.ApplicationCommandOptionType.User)}toJSON(){return this.runRequiredValidations(),{...this}}};o(nt,"SlashCommandUserOption");var k=class{constructor(){i(this,"options")}addBooleanOption(t){return this._sharedAddOptionMethod(t,Y)}addUserOption(t){return this._sharedAddOptionMethod(t,nt)}addChannelOption(t){return this._sharedAddOptionMethod(t,V)}addRoleOption(t){return this._sharedAddOptionMethod(t,et)}addAttachmentOption(t){return this._sharedAddOptionMethod(t,ot)}addMentionableOption(t){return this._sharedAddOptionMethod(t,tt)}addStringOption(t){return this._sharedAddOptionMethod(t,_)}addIntegerOption(t){return this._sharedAddOptionMethod(t,L)}addNumberOption(t){return this._sharedAddOptionMethod(t,$)}_sharedAddOptionMethod(t,n){let{options:r}=this;A(r);let s=typeof t=="function"?t(new n):t;return I(s,n),r.push(s),this}};o(k,"SharedSlashCommandOptions");var ne=require("discord-api-types/v9"),ie=require("ts-mixer");var R=class{constructor(){i(this,"name");i(this,"description");i(this,"options",[])}addSubcommand(t){let{options:n}=this;A(n);let r=typeof t=="function"?t(new f):t;return I(r,f),n.push(r),this}toJSON(){return P(this.name,this.description,this.options),{type:ne.ApplicationCommandOptionType.SubcommandGroup,name:this.name,description:this.description,options:this.options.map(t=>t.toJSON())}}};o(R,"SlashCommandSubcommandGroupBuilder"),R=u([(0,ie.mix)(x)],R);var f=class{constructor(){i(this,"name");i(this,"description");i(this,"options",[])}toJSON(){return P(this.name,this.description,this.options),{type:ne.ApplicationCommandOptionType.Subcommand,name:this.name,description:this.description,options:this.options.map(t=>t.toJSON())}}};o(f,"SlashCommandSubcommandBuilder"),f=u([(0,ie.mix)(x,k)],f);var it=class{constructor(){i(this,"name");i(this,"description");i(this,"options",[]);i(this,"defaultPermission")}toJSON(){return P(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 Yt(t),Reflect.set(this,"defaultPermission",t),this}addSubcommandGroup(t){let{options:n}=this;A(n);let r=typeof t=="function"?t(new R):t;return I(r,R),n.push(r),this}addSubcommand(t){let{options:n}=this;A(n);let r=typeof t=="function"?t(new f):t;return I(r,f),n.push(r),this}};o(it,"SlashCommandBuilder"),it=u([(0,Ke.mix)(k,x)],it);var pe={};w(pe,{validateDefaultPermission:()=>ae,validateName:()=>yt,validateRequiredParameters:()=>se,validateType:()=>Ot});var j=require("zod"),re=require("discord-api-types/v9"),vo=j.z.string().min(1).max(32).regex(/^( *[\p{L}\p{N}_-]+ *)+$/u),Eo=j.z.union([j.z.literal(re.ApplicationCommandType.User),j.z.literal(re.ApplicationCommandType.Message)]),No=j.z.boolean();function ae(e){No.parse(e)}o(ae,"validateDefaultPermission");function yt(e){vo.parse(e)}o(yt,"validateName");function Ot(e){Eo.parse(e)}o(Ot,"validateType");function se(e,t){yt(e),Ot(t)}o(se,"validateRequiredParameters");var me=class{constructor(){i(this,"name");i(this,"type");i(this,"defaultPermission")}setName(t){return yt(t),Reflect.set(this,"name",t),this}setType(t){return Ot(t),Reflect.set(this,"type",t),this}setDefaultPermission(t){return ae(t),Reflect.set(this,"defaultPermission",t),this}toJSON(){return se(this.name,this.type),{name:this.name,type:this.type,default_permission:this.defaultPermission}}};o(me,"ContextMenuCommandBuilder");function Bo(e){return e!==null&&typeof e=="object"&&"toJSON"in e}o(Bo,"isJSONEncodable");module.exports=no(Vo);0&&(module.exports={ActionRow,ButtonComponent,Component,ComponentAssertions,ContextMenuCommandAssertions,ContextMenuCommandBuilder,Embed,EmbedAssertions,Faces,Modal,ModalAssertions,SelectMenuComponent,SelectMenuOption,SlashCommandAssertions,SlashCommandAttachmentOption,SlashCommandBooleanOption,SlashCommandBuilder,SlashCommandChannelOption,SlashCommandIntegerOption,SlashCommandMentionableOption,SlashCommandNumberOption,SlashCommandRoleOption,SlashCommandStringOption,SlashCommandSubcommandBuilder,SlashCommandSubcommandGroupBuilder,SlashCommandUserOption,TextInputAssertions,TextInputComponent,TimestampStyles,UnsafeButtonComponent,UnsafeEmbed,UnsafeModal,UnsafeSelectMenuComponent,UnsafeSelectMenuOption,UnsafeTextInputComponent,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
|