@discordjs/builders 1.2.0-dev.1660478697-bc06cc6.0 → 1.2.0-dev.1660910631-e475b63.0
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/components/ActionRow.cjs.map +1 -1
- package/dist/components/ActionRow.d.ts +5 -0
- package/dist/components/ActionRow.d.ts.map +1 -1
- package/dist/components/ActionRow.mjs.map +1 -1
- package/dist/components/Component.cjs.map +1 -1
- package/dist/components/Component.d.ts +5 -0
- package/dist/components/Component.d.ts.map +1 -1
- package/dist/components/Component.mjs.map +1 -1
- package/dist/components/button/Button.cjs.map +1 -1
- package/dist/components/button/Button.d.ts +3 -0
- package/dist/components/button/Button.d.ts.map +1 -1
- package/dist/components/button/Button.mjs.map +1 -1
- package/dist/components/selectMenu/SelectMenu.cjs.map +1 -1
- package/dist/components/selectMenu/SelectMenu.d.ts +3 -0
- package/dist/components/selectMenu/SelectMenu.d.ts.map +1 -1
- package/dist/components/selectMenu/SelectMenu.mjs.map +1 -1
- package/dist/components/selectMenu/SelectMenuOption.cjs.map +1 -1
- package/dist/components/selectMenu/SelectMenuOption.d.ts +5 -1
- package/dist/components/selectMenu/SelectMenuOption.d.ts.map +1 -1
- package/dist/components/selectMenu/SelectMenuOption.mjs.map +1 -1
- package/dist/components/textInput/TextInput.cjs.map +1 -1
- package/dist/components/textInput/TextInput.d.ts +8 -1
- package/dist/components/textInput/TextInput.d.ts.map +1 -1
- package/dist/components/textInput/TextInput.mjs.map +1 -1
- package/dist/interactions/slashCommands/SlashCommandBuilder.cjs.map +1 -1
- package/dist/interactions/slashCommands/SlashCommandBuilder.d.ts +2 -2
- package/dist/interactions/slashCommands/SlashCommandBuilder.mjs.map +1 -1
- package/dist/messages/embed/Embed.cjs.map +1 -1
- package/dist/messages/embed/Embed.d.ts +58 -3
- package/dist/messages/embed/Embed.d.ts.map +1 -1
- package/dist/messages/embed/Embed.mjs.map +1 -1
- package/dist/util/equatable.cjs.map +1 -1
- package/dist/util/equatable.d.ts +6 -0
- package/dist/util/equatable.d.ts.map +1 -1
- package/dist/util/equatable.mjs.map +1 -1
- package/dist/util/jsonEncodable.cjs.map +1 -1
- package/dist/util/jsonEncodable.d.ts +5 -0
- package/dist/util/jsonEncodable.d.ts.map +1 -1
- package/dist/util/jsonEncodable.mjs.map +1 -1
- package/package.json +15 -9
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ActionRow.cjs","sources":["../../src/components/ActionRow.ts"],"sourcesContent":["import {\n\ttype APIActionRowComponent,\n\tComponentType,\n\tAPIMessageActionRowComponent,\n\tAPIModalActionRowComponent,\n\tAPIActionRowComponentTypes,\n} from 'discord-api-types/v10';\nimport { ComponentBuilder } from './Component';\nimport { createComponentBuilder } from './Components';\nimport type { ButtonBuilder } from './button/Button';\nimport type { SelectMenuBuilder } from './selectMenu/SelectMenu';\nimport type { TextInputBuilder } from './textInput/TextInput';\nimport { normalizeArray, type RestOrArray } from '../util/normalizeArray';\n\nexport type MessageComponentBuilder =\n\t| MessageActionRowComponentBuilder\n\t| ActionRowBuilder<MessageActionRowComponentBuilder>;\nexport type ModalComponentBuilder = ModalActionRowComponentBuilder | ActionRowBuilder<ModalActionRowComponentBuilder>;\nexport type MessageActionRowComponentBuilder = ButtonBuilder | SelectMenuBuilder;\nexport type ModalActionRowComponentBuilder = TextInputBuilder;\nexport type AnyComponentBuilder = MessageActionRowComponentBuilder | ModalActionRowComponentBuilder;\n\n/**\n * Represents an action row component\n */\nexport class ActionRowBuilder<T extends AnyComponentBuilder> extends ComponentBuilder<\n\tAPIActionRowComponent<APIMessageActionRowComponent | APIModalActionRowComponent>\n> {\n\t/**\n\t * The components within this action row\n\t */\n\tpublic readonly components: T[];\n\n\tpublic constructor({ components, ...data }: Partial<APIActionRowComponent<APIActionRowComponentTypes>> = {}) {\n\t\tsuper({ type: ComponentType.ActionRow, ...data });\n\t\tthis.components = (components?.map((c) => createComponentBuilder(c)) ?? []) as T[];\n\t}\n\n\t/**\n\t * Adds components to this action row.\n\t *\n\t * @param components - The components to add to this action row.\n\t */\n\tpublic addComponents(...components: RestOrArray<T>) {\n\t\tthis.components.push(...normalizeArray(components));\n\t\treturn this;\n\t}\n\n\t/**\n\t * Sets the components in this action row\n\t *\n\t * @param components - The components to set this row to\n\t */\n\tpublic setComponents(...components: RestOrArray<T>) {\n\t\tthis.components.splice(0, this.components.length, ...normalizeArray(components));\n\t\treturn this;\n\t}\n\n\tpublic toJSON(): APIActionRowComponent<ReturnType<T['toJSON']>> {\n\t\t// eslint-disable-next-line @typescript-eslint/consistent-type-assertions\n\t\treturn {\n\t\t\t...this.data,\n\t\t\tcomponents: this.components.map((component) => component.toJSON()),\n\t\t} as APIActionRowComponent<ReturnType<T['toJSON']>>;\n\t}\n}\n"],"names":["ComponentBuilder","ComponentType","createComponentBuilder","normalizeArray"],"mappings":";;;;;;;;;AAMO,MAAM,gBAAgB,SAASA,0BAAgB,CAAC;AACvD,EAAE,WAAW,CAAC,EAAE,UAAU,EAAE,GAAG,IAAI,EAAE,GAAG,EAAE,EAAE;AAC5C,IAAI,KAAK,CAAC,EAAE,IAAI,EAAEC,iBAAa,CAAC,SAAS,EAAE,GAAG,IAAI,EAAE,CAAC,CAAC;AACtD,IAAI,IAAI,CAAC,UAAU,GAAG,UAAU,EAAE,GAAG,CAAC,CAAC,CAAC,KAAKC,iCAAsB,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;AAC9E,GAAG;AACH,EAAE,aAAa,CAAC,GAAG,UAAU,EAAE;AAC/B,IAAI,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,GAAGC,6BAAc,CAAC,UAAU,CAAC,CAAC,CAAC;AACxD,IAAI,OAAO,IAAI,CAAC;AAChB,GAAG;AACH,EAAE,aAAa,CAAC,GAAG,UAAU,EAAE;AAC/B,IAAI,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC,EAAE,IAAI,CAAC,UAAU,CAAC,MAAM,EAAE,GAAGA,6BAAc,CAAC,UAAU,CAAC,CAAC,CAAC;AACrF,IAAI,OAAO,IAAI,CAAC;AAChB,GAAG;AACH,EAAE,MAAM,GAAG;AACX,IAAI,OAAO;AACX,MAAM,GAAG,IAAI,CAAC,IAAI;AAClB,MAAM,UAAU,EAAE,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,SAAS,KAAK,SAAS,CAAC,MAAM,EAAE,CAAC;AACxE,KAAK,CAAC;AACN,GAAG;AACH;;;;"}
|
|
1
|
+
{"version":3,"file":"ActionRow.cjs","sources":["../../src/components/ActionRow.ts"],"sourcesContent":["import {\n\ttype APIActionRowComponent,\n\tComponentType,\n\tAPIMessageActionRowComponent,\n\tAPIModalActionRowComponent,\n\tAPIActionRowComponentTypes,\n} from 'discord-api-types/v10';\nimport { ComponentBuilder } from './Component';\nimport { createComponentBuilder } from './Components';\nimport type { ButtonBuilder } from './button/Button';\nimport type { SelectMenuBuilder } from './selectMenu/SelectMenu';\nimport type { TextInputBuilder } from './textInput/TextInput';\nimport { normalizeArray, type RestOrArray } from '../util/normalizeArray';\n\nexport type MessageComponentBuilder =\n\t| MessageActionRowComponentBuilder\n\t| ActionRowBuilder<MessageActionRowComponentBuilder>;\nexport type ModalComponentBuilder = ModalActionRowComponentBuilder | ActionRowBuilder<ModalActionRowComponentBuilder>;\nexport type MessageActionRowComponentBuilder = ButtonBuilder | SelectMenuBuilder;\nexport type ModalActionRowComponentBuilder = TextInputBuilder;\nexport type AnyComponentBuilder = MessageActionRowComponentBuilder | ModalActionRowComponentBuilder;\n\n/**\n * Represents an action row component\n *\n * @typeParam T - The types of components this action row holds\n */\nexport class ActionRowBuilder<T extends AnyComponentBuilder> extends ComponentBuilder<\n\tAPIActionRowComponent<APIMessageActionRowComponent | APIModalActionRowComponent>\n> {\n\t/**\n\t * The components within this action row\n\t */\n\tpublic readonly components: T[];\n\n\tpublic constructor({ components, ...data }: Partial<APIActionRowComponent<APIActionRowComponentTypes>> = {}) {\n\t\tsuper({ type: ComponentType.ActionRow, ...data });\n\t\tthis.components = (components?.map((c) => createComponentBuilder(c)) ?? []) as T[];\n\t}\n\n\t/**\n\t * Adds components to this action row.\n\t *\n\t * @param components - The components to add to this action row.\n\t */\n\tpublic addComponents(...components: RestOrArray<T>) {\n\t\tthis.components.push(...normalizeArray(components));\n\t\treturn this;\n\t}\n\n\t/**\n\t * Sets the components in this action row\n\t *\n\t * @param components - The components to set this row to\n\t */\n\tpublic setComponents(...components: RestOrArray<T>) {\n\t\tthis.components.splice(0, this.components.length, ...normalizeArray(components));\n\t\treturn this;\n\t}\n\n\t/**\n\t * {@inheritDoc JSONEncodable.toJSON}\n\t */\n\tpublic toJSON(): APIActionRowComponent<ReturnType<T['toJSON']>> {\n\t\t// eslint-disable-next-line @typescript-eslint/consistent-type-assertions\n\t\treturn {\n\t\t\t...this.data,\n\t\t\tcomponents: this.components.map((component) => component.toJSON()),\n\t\t} as APIActionRowComponent<ReturnType<T['toJSON']>>;\n\t}\n}\n"],"names":["ComponentBuilder","ComponentType","createComponentBuilder","normalizeArray"],"mappings":";;;;;;;;;AAMO,MAAM,gBAAgB,SAASA,0BAAgB,CAAC;AACvD,EAAE,WAAW,CAAC,EAAE,UAAU,EAAE,GAAG,IAAI,EAAE,GAAG,EAAE,EAAE;AAC5C,IAAI,KAAK,CAAC,EAAE,IAAI,EAAEC,iBAAa,CAAC,SAAS,EAAE,GAAG,IAAI,EAAE,CAAC,CAAC;AACtD,IAAI,IAAI,CAAC,UAAU,GAAG,UAAU,EAAE,GAAG,CAAC,CAAC,CAAC,KAAKC,iCAAsB,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;AAC9E,GAAG;AACH,EAAE,aAAa,CAAC,GAAG,UAAU,EAAE;AAC/B,IAAI,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,GAAGC,6BAAc,CAAC,UAAU,CAAC,CAAC,CAAC;AACxD,IAAI,OAAO,IAAI,CAAC;AAChB,GAAG;AACH,EAAE,aAAa,CAAC,GAAG,UAAU,EAAE;AAC/B,IAAI,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC,EAAE,IAAI,CAAC,UAAU,CAAC,MAAM,EAAE,GAAGA,6BAAc,CAAC,UAAU,CAAC,CAAC,CAAC;AACrF,IAAI,OAAO,IAAI,CAAC;AAChB,GAAG;AACH,EAAE,MAAM,GAAG;AACX,IAAI,OAAO;AACX,MAAM,GAAG,IAAI,CAAC,IAAI;AAClB,MAAM,UAAU,EAAE,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,SAAS,KAAK,SAAS,CAAC,MAAM,EAAE,CAAC;AACxE,KAAK,CAAC;AACN,GAAG;AACH;;;;"}
|
|
@@ -11,6 +11,8 @@ export declare type ModalActionRowComponentBuilder = TextInputBuilder;
|
|
|
11
11
|
export declare type AnyComponentBuilder = MessageActionRowComponentBuilder | ModalActionRowComponentBuilder;
|
|
12
12
|
/**
|
|
13
13
|
* Represents an action row component
|
|
14
|
+
*
|
|
15
|
+
* @typeParam T - The types of components this action row holds
|
|
14
16
|
*/
|
|
15
17
|
export declare class ActionRowBuilder<T extends AnyComponentBuilder> extends ComponentBuilder<APIActionRowComponent<APIMessageActionRowComponent | APIModalActionRowComponent>> {
|
|
16
18
|
/**
|
|
@@ -30,6 +32,9 @@ export declare class ActionRowBuilder<T extends AnyComponentBuilder> extends Com
|
|
|
30
32
|
* @param components - The components to set this row to
|
|
31
33
|
*/
|
|
32
34
|
setComponents(...components: RestOrArray<T>): this;
|
|
35
|
+
/**
|
|
36
|
+
* {@inheritDoc JSONEncodable.toJSON}
|
|
37
|
+
*/
|
|
33
38
|
toJSON(): APIActionRowComponent<ReturnType<T['toJSON']>>;
|
|
34
39
|
}
|
|
35
40
|
//# sourceMappingURL=ActionRow.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ActionRow.d.ts","sourceRoot":"","sources":["../../src/components/ActionRow.ts"],"names":[],"mappings":"AAAA,OAAO,E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CAAgC,CAAC,CAAC;AACtD,oBAAY,qBAAqB,GAAG,8BAA8B,GAAG,gBAAgB,CAAC,8BAA8B,CAAC,CAAC;AACtH,oBAAY,gCAAgC,GAAG,aAAa,GAAG,iBAAiB,CAAC;AACjF,oBAAY,8BAA8B,GAAG,gBAAgB,CAAC;AAC9D,oBAAY,mBAAmB,GAAG,gCAAgC,GAAG,8BAA8B,CAAC;AAEpG;;;;GAIG;AACH,qBAAa,gBAAgB,CAAC,CAAC,SAAS,mBAAmB,CAAE,SAAQ,gBAAgB,CACpF,qBAAqB,CAAC,4BAA4B,GAAG,0BAA0B,CAAC,CAChF;IACA;;OAEG;IACH,SAAgB,UAAU,EAAE,CAAC,EAAE,CAAC;gBAEb,EAAE,UAAU,EAAE,GAAG,IAAI,EAAE,GAAE,OAAO,CAAC,qBAAqB,CAAC,0BAA0B,CAAC,CAAM;IAK3G;;;;OAIG;IACI,aAAa,CAAC,GAAG,UAAU,EAAE,WAAW,CAAC,CAAC,CAAC;IAKlD;;;;OAIG;IACI,aAAa,CAAC,GAAG,UAAU,EAAE,WAAW,CAAC,CAAC,CAAC;IAKlD;;OAEG;IACI,MAAM,IAAI,qBAAqB,CAAC,UAAU,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC;CAO/D"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ActionRow.mjs","sources":["../../src/components/ActionRow.ts"],"sourcesContent":["import {\n\ttype APIActionRowComponent,\n\tComponentType,\n\tAPIMessageActionRowComponent,\n\tAPIModalActionRowComponent,\n\tAPIActionRowComponentTypes,\n} from 'discord-api-types/v10';\nimport { ComponentBuilder } from './Component';\nimport { createComponentBuilder } from './Components';\nimport type { ButtonBuilder } from './button/Button';\nimport type { SelectMenuBuilder } from './selectMenu/SelectMenu';\nimport type { TextInputBuilder } from './textInput/TextInput';\nimport { normalizeArray, type RestOrArray } from '../util/normalizeArray';\n\nexport type MessageComponentBuilder =\n\t| MessageActionRowComponentBuilder\n\t| ActionRowBuilder<MessageActionRowComponentBuilder>;\nexport type ModalComponentBuilder = ModalActionRowComponentBuilder | ActionRowBuilder<ModalActionRowComponentBuilder>;\nexport type MessageActionRowComponentBuilder = ButtonBuilder | SelectMenuBuilder;\nexport type ModalActionRowComponentBuilder = TextInputBuilder;\nexport type AnyComponentBuilder = MessageActionRowComponentBuilder | ModalActionRowComponentBuilder;\n\n/**\n * Represents an action row component\n */\nexport class ActionRowBuilder<T extends AnyComponentBuilder> extends ComponentBuilder<\n\tAPIActionRowComponent<APIMessageActionRowComponent | APIModalActionRowComponent>\n> {\n\t/**\n\t * The components within this action row\n\t */\n\tpublic readonly components: T[];\n\n\tpublic constructor({ components, ...data }: Partial<APIActionRowComponent<APIActionRowComponentTypes>> = {}) {\n\t\tsuper({ type: ComponentType.ActionRow, ...data });\n\t\tthis.components = (components?.map((c) => createComponentBuilder(c)) ?? []) as T[];\n\t}\n\n\t/**\n\t * Adds components to this action row.\n\t *\n\t * @param components - The components to add to this action row.\n\t */\n\tpublic addComponents(...components: RestOrArray<T>) {\n\t\tthis.components.push(...normalizeArray(components));\n\t\treturn this;\n\t}\n\n\t/**\n\t * Sets the components in this action row\n\t *\n\t * @param components - The components to set this row to\n\t */\n\tpublic setComponents(...components: RestOrArray<T>) {\n\t\tthis.components.splice(0, this.components.length, ...normalizeArray(components));\n\t\treturn this;\n\t}\n\n\tpublic toJSON(): APIActionRowComponent<ReturnType<T['toJSON']>> {\n\t\t// eslint-disable-next-line @typescript-eslint/consistent-type-assertions\n\t\treturn {\n\t\t\t...this.data,\n\t\t\tcomponents: this.components.map((component) => component.toJSON()),\n\t\t} as APIActionRowComponent<ReturnType<T['toJSON']>>;\n\t}\n}\n"],"names":[],"mappings":";;;;;AAMO,MAAM,gBAAgB,SAAS,gBAAgB,CAAC;AACvD,EAAE,WAAW,CAAC,EAAE,UAAU,EAAE,GAAG,IAAI,EAAE,GAAG,EAAE,EAAE;AAC5C,IAAI,KAAK,CAAC,EAAE,IAAI,EAAE,aAAa,CAAC,SAAS,EAAE,GAAG,IAAI,EAAE,CAAC,CAAC;AACtD,IAAI,IAAI,CAAC,UAAU,GAAG,UAAU,EAAE,GAAG,CAAC,CAAC,CAAC,KAAK,sBAAsB,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;AAC9E,GAAG;AACH,EAAE,aAAa,CAAC,GAAG,UAAU,EAAE;AAC/B,IAAI,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,GAAG,cAAc,CAAC,UAAU,CAAC,CAAC,CAAC;AACxD,IAAI,OAAO,IAAI,CAAC;AAChB,GAAG;AACH,EAAE,aAAa,CAAC,GAAG,UAAU,EAAE;AAC/B,IAAI,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC,EAAE,IAAI,CAAC,UAAU,CAAC,MAAM,EAAE,GAAG,cAAc,CAAC,UAAU,CAAC,CAAC,CAAC;AACrF,IAAI,OAAO,IAAI,CAAC;AAChB,GAAG;AACH,EAAE,MAAM,GAAG;AACX,IAAI,OAAO;AACX,MAAM,GAAG,IAAI,CAAC,IAAI;AAClB,MAAM,UAAU,EAAE,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,SAAS,KAAK,SAAS,CAAC,MAAM,EAAE,CAAC;AACxE,KAAK,CAAC;AACN,GAAG;AACH;;;;"}
|
|
1
|
+
{"version":3,"file":"ActionRow.mjs","sources":["../../src/components/ActionRow.ts"],"sourcesContent":["import {\n\ttype APIActionRowComponent,\n\tComponentType,\n\tAPIMessageActionRowComponent,\n\tAPIModalActionRowComponent,\n\tAPIActionRowComponentTypes,\n} from 'discord-api-types/v10';\nimport { ComponentBuilder } from './Component';\nimport { createComponentBuilder } from './Components';\nimport type { ButtonBuilder } from './button/Button';\nimport type { SelectMenuBuilder } from './selectMenu/SelectMenu';\nimport type { TextInputBuilder } from './textInput/TextInput';\nimport { normalizeArray, type RestOrArray } from '../util/normalizeArray';\n\nexport type MessageComponentBuilder =\n\t| MessageActionRowComponentBuilder\n\t| ActionRowBuilder<MessageActionRowComponentBuilder>;\nexport type ModalComponentBuilder = ModalActionRowComponentBuilder | ActionRowBuilder<ModalActionRowComponentBuilder>;\nexport type MessageActionRowComponentBuilder = ButtonBuilder | SelectMenuBuilder;\nexport type ModalActionRowComponentBuilder = TextInputBuilder;\nexport type AnyComponentBuilder = MessageActionRowComponentBuilder | ModalActionRowComponentBuilder;\n\n/**\n * Represents an action row component\n *\n * @typeParam T - The types of components this action row holds\n */\nexport class ActionRowBuilder<T extends AnyComponentBuilder> extends ComponentBuilder<\n\tAPIActionRowComponent<APIMessageActionRowComponent | APIModalActionRowComponent>\n> {\n\t/**\n\t * The components within this action row\n\t */\n\tpublic readonly components: T[];\n\n\tpublic constructor({ components, ...data }: Partial<APIActionRowComponent<APIActionRowComponentTypes>> = {}) {\n\t\tsuper({ type: ComponentType.ActionRow, ...data });\n\t\tthis.components = (components?.map((c) => createComponentBuilder(c)) ?? []) as T[];\n\t}\n\n\t/**\n\t * Adds components to this action row.\n\t *\n\t * @param components - The components to add to this action row.\n\t */\n\tpublic addComponents(...components: RestOrArray<T>) {\n\t\tthis.components.push(...normalizeArray(components));\n\t\treturn this;\n\t}\n\n\t/**\n\t * Sets the components in this action row\n\t *\n\t * @param components - The components to set this row to\n\t */\n\tpublic setComponents(...components: RestOrArray<T>) {\n\t\tthis.components.splice(0, this.components.length, ...normalizeArray(components));\n\t\treturn this;\n\t}\n\n\t/**\n\t * {@inheritDoc JSONEncodable.toJSON}\n\t */\n\tpublic toJSON(): APIActionRowComponent<ReturnType<T['toJSON']>> {\n\t\t// eslint-disable-next-line @typescript-eslint/consistent-type-assertions\n\t\treturn {\n\t\t\t...this.data,\n\t\t\tcomponents: this.components.map((component) => component.toJSON()),\n\t\t} as APIActionRowComponent<ReturnType<T['toJSON']>>;\n\t}\n}\n"],"names":[],"mappings":";;;;;AAMO,MAAM,gBAAgB,SAAS,gBAAgB,CAAC;AACvD,EAAE,WAAW,CAAC,EAAE,UAAU,EAAE,GAAG,IAAI,EAAE,GAAG,EAAE,EAAE;AAC5C,IAAI,KAAK,CAAC,EAAE,IAAI,EAAE,aAAa,CAAC,SAAS,EAAE,GAAG,IAAI,EAAE,CAAC,CAAC;AACtD,IAAI,IAAI,CAAC,UAAU,GAAG,UAAU,EAAE,GAAG,CAAC,CAAC,CAAC,KAAK,sBAAsB,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;AAC9E,GAAG;AACH,EAAE,aAAa,CAAC,GAAG,UAAU,EAAE;AAC/B,IAAI,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,GAAG,cAAc,CAAC,UAAU,CAAC,CAAC,CAAC;AACxD,IAAI,OAAO,IAAI,CAAC;AAChB,GAAG;AACH,EAAE,aAAa,CAAC,GAAG,UAAU,EAAE;AAC/B,IAAI,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC,EAAE,IAAI,CAAC,UAAU,CAAC,MAAM,EAAE,GAAG,cAAc,CAAC,UAAU,CAAC,CAAC,CAAC;AACrF,IAAI,OAAO,IAAI,CAAC;AAChB,GAAG;AACH,EAAE,MAAM,GAAG;AACX,IAAI,OAAO;AACX,MAAM,GAAG,IAAI,CAAC,IAAI;AAClB,MAAM,UAAU,EAAE,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,SAAS,KAAK,SAAS,CAAC,MAAM,EAAE,CAAC;AACxE,KAAK,CAAC;AACN,GAAG;AACH;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Component.cjs","sources":["../../src/components/Component.ts"],"sourcesContent":["import type {\n\tAPIActionRowComponent,\n\tAPIActionRowComponentTypes,\n\tAPIBaseComponent,\n\tComponentType,\n} from 'discord-api-types/v10';\nimport type { JSONEncodable } from '../util/jsonEncodable';\n\nexport type AnyAPIActionRowComponent = APIActionRowComponentTypes | APIActionRowComponent<APIActionRowComponentTypes>;\n\n/**\n * Represents a discord component\n */\nexport abstract class ComponentBuilder<\n\tDataType extends Partial<APIBaseComponent<ComponentType>> = APIBaseComponent<ComponentType>,\n> implements JSONEncodable<AnyAPIActionRowComponent>\n{\n\t/**\n\t * The API data associated with this component\n\t */\n\tpublic readonly data: Partial<DataType>;\n\n\tpublic abstract toJSON(): AnyAPIActionRowComponent;\n\n\tpublic constructor(data: Partial<DataType>) {\n\t\tthis.data = data;\n\t}\n}\n"],"names":[],"mappings":";;;;AAAO,MAAM,gBAAgB,CAAC;AAC9B,EAAE,WAAW,CAAC,IAAI,EAAE;AACpB,IAAI,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;AACrB,GAAG;AACH;;;;"}
|
|
1
|
+
{"version":3,"file":"Component.cjs","sources":["../../src/components/Component.ts"],"sourcesContent":["import type {\n\tAPIActionRowComponent,\n\tAPIActionRowComponentTypes,\n\tAPIBaseComponent,\n\tComponentType,\n} from 'discord-api-types/v10';\nimport type { JSONEncodable } from '../util/jsonEncodable';\n\nexport type AnyAPIActionRowComponent = APIActionRowComponentTypes | APIActionRowComponent<APIActionRowComponentTypes>;\n\n/**\n * Represents a discord component\n *\n * @typeParam DataType - The type of internal API data that is stored within the component\n */\nexport abstract class ComponentBuilder<\n\tDataType extends Partial<APIBaseComponent<ComponentType>> = APIBaseComponent<ComponentType>,\n> implements JSONEncodable<AnyAPIActionRowComponent>\n{\n\t/**\n\t * The API data associated with this component\n\t */\n\tpublic readonly data: Partial<DataType>;\n\n\t/**\n\t * {@inheritDoc JSONEncodable.toJSON}\n\t */\n\tpublic abstract toJSON(): AnyAPIActionRowComponent;\n\n\tpublic constructor(data: Partial<DataType>) {\n\t\tthis.data = data;\n\t}\n}\n"],"names":[],"mappings":";;;;AAAO,MAAM,gBAAgB,CAAC;AAC9B,EAAE,WAAW,CAAC,IAAI,EAAE;AACpB,IAAI,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;AACrB,GAAG;AACH;;;;"}
|
|
@@ -3,12 +3,17 @@ import type { JSONEncodable } from '../util/jsonEncodable';
|
|
|
3
3
|
export declare type AnyAPIActionRowComponent = APIActionRowComponentTypes | APIActionRowComponent<APIActionRowComponentTypes>;
|
|
4
4
|
/**
|
|
5
5
|
* Represents a discord component
|
|
6
|
+
*
|
|
7
|
+
* @typeParam DataType - The type of internal API data that is stored within the component
|
|
6
8
|
*/
|
|
7
9
|
export declare abstract class ComponentBuilder<DataType extends Partial<APIBaseComponent<ComponentType>> = APIBaseComponent<ComponentType>> implements JSONEncodable<AnyAPIActionRowComponent> {
|
|
8
10
|
/**
|
|
9
11
|
* The API data associated with this component
|
|
10
12
|
*/
|
|
11
13
|
readonly data: Partial<DataType>;
|
|
14
|
+
/**
|
|
15
|
+
* {@inheritDoc JSONEncodable.toJSON}
|
|
16
|
+
*/
|
|
12
17
|
abstract toJSON(): AnyAPIActionRowComponent;
|
|
13
18
|
constructor(data: Partial<DataType>);
|
|
14
19
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Component.d.ts","sourceRoot":"","sources":["../../src/components/Component.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACX,qBAAqB,EACrB,0BAA0B,EAC1B,gBAAgB,EAChB,aAAa,EACb,MAAM,uBAAuB,CAAC;AAC/B,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAE3D,oBAAY,wBAAwB,GAAG,0BAA0B,GAAG,qBAAqB,CAAC,0BAA0B,CAAC,CAAC;AAEtH
|
|
1
|
+
{"version":3,"file":"Component.d.ts","sourceRoot":"","sources":["../../src/components/Component.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACX,qBAAqB,EACrB,0BAA0B,EAC1B,gBAAgB,EAChB,aAAa,EACb,MAAM,uBAAuB,CAAC;AAC/B,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAE3D,oBAAY,wBAAwB,GAAG,0BAA0B,GAAG,qBAAqB,CAAC,0BAA0B,CAAC,CAAC;AAEtH;;;;GAIG;AACH,8BAAsB,gBAAgB,CACrC,QAAQ,SAAS,OAAO,CAAC,gBAAgB,CAAC,aAAa,CAAC,CAAC,GAAG,gBAAgB,CAAC,aAAa,CAAC,CAC1F,YAAW,aAAa,CAAC,wBAAwB,CAAC;IAEnD;;OAEG;IACH,SAAgB,IAAI,EAAE,OAAO,CAAC,QAAQ,CAAC,CAAC;IAExC;;OAEG;aACa,MAAM,IAAI,wBAAwB;gBAE/B,IAAI,EAAE,OAAO,CAAC,QAAQ,CAAC;CAG1C"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Component.mjs","sources":["../../src/components/Component.ts"],"sourcesContent":["import type {\n\tAPIActionRowComponent,\n\tAPIActionRowComponentTypes,\n\tAPIBaseComponent,\n\tComponentType,\n} from 'discord-api-types/v10';\nimport type { JSONEncodable } from '../util/jsonEncodable';\n\nexport type AnyAPIActionRowComponent = APIActionRowComponentTypes | APIActionRowComponent<APIActionRowComponentTypes>;\n\n/**\n * Represents a discord component\n */\nexport abstract class ComponentBuilder<\n\tDataType extends Partial<APIBaseComponent<ComponentType>> = APIBaseComponent<ComponentType>,\n> implements JSONEncodable<AnyAPIActionRowComponent>\n{\n\t/**\n\t * The API data associated with this component\n\t */\n\tpublic readonly data: Partial<DataType>;\n\n\tpublic abstract toJSON(): AnyAPIActionRowComponent;\n\n\tpublic constructor(data: Partial<DataType>) {\n\t\tthis.data = data;\n\t}\n}\n"],"names":[],"mappings":"AAAO,MAAM,gBAAgB,CAAC;AAC9B,EAAE,WAAW,CAAC,IAAI,EAAE;AACpB,IAAI,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;AACrB,GAAG;AACH;;;;"}
|
|
1
|
+
{"version":3,"file":"Component.mjs","sources":["../../src/components/Component.ts"],"sourcesContent":["import type {\n\tAPIActionRowComponent,\n\tAPIActionRowComponentTypes,\n\tAPIBaseComponent,\n\tComponentType,\n} from 'discord-api-types/v10';\nimport type { JSONEncodable } from '../util/jsonEncodable';\n\nexport type AnyAPIActionRowComponent = APIActionRowComponentTypes | APIActionRowComponent<APIActionRowComponentTypes>;\n\n/**\n * Represents a discord component\n *\n * @typeParam DataType - The type of internal API data that is stored within the component\n */\nexport abstract class ComponentBuilder<\n\tDataType extends Partial<APIBaseComponent<ComponentType>> = APIBaseComponent<ComponentType>,\n> implements JSONEncodable<AnyAPIActionRowComponent>\n{\n\t/**\n\t * The API data associated with this component\n\t */\n\tpublic readonly data: Partial<DataType>;\n\n\t/**\n\t * {@inheritDoc JSONEncodable.toJSON}\n\t */\n\tpublic abstract toJSON(): AnyAPIActionRowComponent;\n\n\tpublic constructor(data: Partial<DataType>) {\n\t\tthis.data = data;\n\t}\n}\n"],"names":[],"mappings":"AAAO,MAAM,gBAAgB,CAAC;AAC9B,EAAE,WAAW,CAAC,IAAI,EAAE;AACpB,IAAI,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;AACrB,GAAG;AACH;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Button.cjs","sources":["../../../src/components/button/Button.ts"],"sourcesContent":["import {\n\tComponentType,\n\tButtonStyle,\n\ttype APIMessageComponentEmoji,\n\ttype APIButtonComponent,\n\ttype APIButtonComponentWithURL,\n\ttype APIButtonComponentWithCustomId,\n} from 'discord-api-types/v10';\nimport {\n\tbuttonLabelValidator,\n\tbuttonStyleValidator,\n\tcustomIdValidator,\n\tdisabledValidator,\n\temojiValidator,\n\turlValidator,\n\tvalidateRequiredButtonParameters,\n} from '../Assertions';\nimport { ComponentBuilder } from '../Component';\n\n/**\n * Represents a button component\n */\nexport class ButtonBuilder extends ComponentBuilder<APIButtonComponent> {\n\tpublic constructor(data?: Partial<APIButtonComponent>) {\n\t\tsuper({ type: ComponentType.Button, ...data });\n\t}\n\n\t/**\n\t * Sets the style of this button\n\t *\n\t * @param style - The style of the button\n\t */\n\tpublic setStyle(style: ButtonStyle) {\n\t\tthis.data.style = buttonStyleValidator.parse(style);\n\t\treturn this;\n\t}\n\n\t/**\n\t * Sets the URL for this button\n\t *\n\t * @param url - The URL to open when this button is clicked\n\t */\n\tpublic setURL(url: string) {\n\t\t(this.data as APIButtonComponentWithURL).url = urlValidator.parse(url);\n\t\treturn this;\n\t}\n\n\t/**\n\t * Sets the custom id for this button\n\t *\n\t * @param customId - The custom id to use for this button\n\t */\n\tpublic setCustomId(customId: string) {\n\t\t(this.data as APIButtonComponentWithCustomId).custom_id = customIdValidator.parse(customId);\n\t\treturn this;\n\t}\n\n\t/**\n\t * Sets the emoji to display on this button\n\t *\n\t * @param emoji - The emoji to display on this button\n\t */\n\tpublic setEmoji(emoji: APIMessageComponentEmoji) {\n\t\tthis.data.emoji = emojiValidator.parse(emoji);\n\t\treturn this;\n\t}\n\n\t/**\n\t * Sets whether this button is disabled\n\t *\n\t * @param disabled - Whether to disable this button\n\t */\n\tpublic setDisabled(disabled = true) {\n\t\tthis.data.disabled = disabledValidator.parse(disabled);\n\t\treturn this;\n\t}\n\n\t/**\n\t * Sets the label for this button\n\t *\n\t * @param label - The label to display on this button\n\t */\n\tpublic setLabel(label: string) {\n\t\tthis.data.label = buttonLabelValidator.parse(label);\n\t\treturn this;\n\t}\n\n\tpublic toJSON(): APIButtonComponent {\n\t\tvalidateRequiredButtonParameters(\n\t\t\tthis.data.style,\n\t\t\tthis.data.label,\n\t\t\tthis.data.emoji,\n\t\t\t(this.data as APIButtonComponentWithCustomId).custom_id,\n\t\t\t(this.data as APIButtonComponentWithURL).url,\n\t\t);\n\t\t// eslint-disable-next-line @typescript-eslint/consistent-type-assertions\n\t\treturn {\n\t\t\t...this.data,\n\t\t} as APIButtonComponent;\n\t}\n}\n"],"names":["ComponentBuilder","ComponentType","buttonStyleValidator","urlValidator","customIdValidator","emojiValidator","disabledValidator","buttonLabelValidator","validateRequiredButtonParameters"],"mappings":";;;;;;;;AAaO,MAAM,aAAa,SAASA,0BAAgB,CAAC;AACpD,EAAE,WAAW,CAAC,IAAI,EAAE;AACpB,IAAI,KAAK,CAAC,EAAE,IAAI,EAAEC,iBAAa,CAAC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ACrB,MAAM,IAAI,CAAC,IAAI,CAAC,KAAK;AACrB,MAAM,IAAI,CAAC,IAAI,CAAC,SAAS;AACzB,MAAM,IAAI,CAAC,IAAI,CAAC,GAAG;AACnB,KAAK,CAAC;AACN,IAAI,OAAO;AACX,MAAM,GAAG,IAAI,CAAC,IAAI;AAClB,KAAK,CAAC;AACN,GAAG;AACH;;;;"}
|
|
1
|
+
{"version":3,"file":"Button.cjs","sources":["../../../src/components/button/Button.ts"],"sourcesContent":["import {\n\tComponentType,\n\tButtonStyle,\n\ttype APIMessageComponentEmoji,\n\ttype APIButtonComponent,\n\ttype APIButtonComponentWithURL,\n\ttype APIButtonComponentWithCustomId,\n} from 'discord-api-types/v10';\nimport {\n\tbuttonLabelValidator,\n\tbuttonStyleValidator,\n\tcustomIdValidator,\n\tdisabledValidator,\n\temojiValidator,\n\turlValidator,\n\tvalidateRequiredButtonParameters,\n} from '../Assertions';\nimport { ComponentBuilder } from '../Component';\n\n/**\n * Represents a button component\n */\nexport class ButtonBuilder extends ComponentBuilder<APIButtonComponent> {\n\tpublic constructor(data?: Partial<APIButtonComponent>) {\n\t\tsuper({ type: ComponentType.Button, ...data });\n\t}\n\n\t/**\n\t * Sets the style of this button\n\t *\n\t * @param style - The style of the button\n\t */\n\tpublic setStyle(style: ButtonStyle) {\n\t\tthis.data.style = buttonStyleValidator.parse(style);\n\t\treturn this;\n\t}\n\n\t/**\n\t * Sets the URL for this button\n\t *\n\t * @param url - The URL to open when this button is clicked\n\t */\n\tpublic setURL(url: string) {\n\t\t(this.data as APIButtonComponentWithURL).url = urlValidator.parse(url);\n\t\treturn this;\n\t}\n\n\t/**\n\t * Sets the custom id for this button\n\t *\n\t * @param customId - The custom id to use for this button\n\t */\n\tpublic setCustomId(customId: string) {\n\t\t(this.data as APIButtonComponentWithCustomId).custom_id = customIdValidator.parse(customId);\n\t\treturn this;\n\t}\n\n\t/**\n\t * Sets the emoji to display on this button\n\t *\n\t * @param emoji - The emoji to display on this button\n\t */\n\tpublic setEmoji(emoji: APIMessageComponentEmoji) {\n\t\tthis.data.emoji = emojiValidator.parse(emoji);\n\t\treturn this;\n\t}\n\n\t/**\n\t * Sets whether this button is disabled\n\t *\n\t * @param disabled - Whether to disable this button\n\t */\n\tpublic setDisabled(disabled = true) {\n\t\tthis.data.disabled = disabledValidator.parse(disabled);\n\t\treturn this;\n\t}\n\n\t/**\n\t * Sets the label for this button\n\t *\n\t * @param label - The label to display on this button\n\t */\n\tpublic setLabel(label: string) {\n\t\tthis.data.label = buttonLabelValidator.parse(label);\n\t\treturn this;\n\t}\n\n\t/**\n\t * {@inheritDoc JSONEncodable.toJSON}\n\t */\n\tpublic toJSON(): APIButtonComponent {\n\t\tvalidateRequiredButtonParameters(\n\t\t\tthis.data.style,\n\t\t\tthis.data.label,\n\t\t\tthis.data.emoji,\n\t\t\t(this.data as APIButtonComponentWithCustomId).custom_id,\n\t\t\t(this.data as APIButtonComponentWithURL).url,\n\t\t);\n\t\t// eslint-disable-next-line @typescript-eslint/consistent-type-assertions\n\t\treturn {\n\t\t\t...this.data,\n\t\t} as APIButtonComponent;\n\t}\n}\n"],"names":["ComponentBuilder","ComponentType","buttonStyleValidator","urlValidator","customIdValidator","emojiValidator","disabledValidator","buttonLabelValidator","validateRequiredButtonParameters"],"mappings":";;;;;;;;AAaO,MAAM,aAAa,SAASA,0BAAgB,CAAC;AACpD,EAAE,WAAW,CAAC,IAAI,EAAE;AACpB,IAAI,KAAK,CAAC,EAAE,IAAI,EAAEC,iBAAa,CAAC,MAAM,EAAE,GAAG,IAAI,EAAE,CAAC,CAAC;AACnD,GAAG;AACH,EAAE,QAAQ,CAAC,KAAK,EAAE;AAClB,IAAI,IAAI,CAAC,IAAI,CAAC,KAAK,GAAGC,+BAAoB,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;AACxD,IAAI,OAAO,IAAI,CAAC;AAChB,GAAG;AACH,EAAE,MAAM,CAAC,GAAG,EAAE;AACd,IAAI,IAAI,CAAC,IAAI,C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onComponent>
|
|
|
41
41
|
* @param label - The label to display on this button
|
|
42
42
|
*/
|
|
43
43
|
setLabel(label: string): this;
|
|
44
|
+
/**
|
|
45
|
+
* {@inheritDoc JSONEncodable.toJSON}
|
|
46
|
+
*/
|
|
44
47
|
toJSON(): APIButtonComponent;
|
|
45
48
|
}
|
|
46
49
|
//# sourceMappingURL=Button.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Button.d.ts","sourceRoot":"","sources":["../../../src/components/button/Button.ts"],"names":[],"mappings":"AAAA,OAAO,EAEN,WAAW,EACX,KAAK,wBAAwB,EAC7B,KAAK,kBAAkB,EAGvB,MAAM,uBAAuB,CAAC;AAU/B,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAEhD;;GAEG;AACH,qBAAa,aAAc,SAAQ,gBAAgB,CAAC,kBAAkB,CAAC;gBACnD,IAAI,CAAC,EAAE,OAAO,CAAC,kBAAkB,CAAC;IAIrD;;;;OAIG;IACI,QAAQ,CAAC,KAAK,EAAE,WAAW;IAKlC;;;;OAIG;IACI,MAAM,CAAC,GAAG,EAAE,MAAM;IAKzB;;;;OAIG;IACI,WAAW,CAAC,QAAQ,EAAE,MAAM;IAKnC;;;;OAIG;IACI,QAAQ,CAAC,KAAK,EAAE,wBAAwB;IAK/C;;;;OAIG;IACI,WAAW,CAAC,QAAQ,UAAO;IAKlC;;;;OAIG;IACI,QAAQ,CAAC,KAAK,EAAE,MAAM;
|
|
1
|
+
{"version":3,"file":"Button.d.ts","sourceRoot":"","sources":["../../../src/components/button/Button.ts"],"names":[],"mappings":"AAAA,OAAO,EAEN,WAAW,EACX,KAAK,wBAAwB,EAC7B,KAAK,kBAAkB,EAGvB,MAAM,uBAAuB,CAAC;AAU/B,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAEhD;;GAEG;AACH,qBAAa,aAAc,SAAQ,gBAAgB,CAAC,kBAAkB,CAAC;gBACnD,IAAI,CAAC,EAAE,OAAO,CAAC,kBAAkB,CAAC;IAIrD;;;;OAIG;IACI,QAAQ,CAAC,KAAK,EAAE,WAAW;IAKlC;;;;OAIG;IACI,MAAM,CAAC,GAAG,EAAE,MAAM;IAKzB;;;;OAIG;IACI,WAAW,CAAC,QAAQ,EAAE,MAAM;IAKnC;;;;OAIG;IACI,QAAQ,CAAC,KAAK,EAAE,wBAAwB;IAK/C;;;;OAIG;IACI,WAAW,CAAC,QAAQ,UAAO;IAKlC;;;;OAIG;IACI,QAAQ,CAAC,KAAK,EAAE,MAAM;IAK7B;;OAEG;IACI,MAAM,IAAI,kBAAkB;CAanC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Button.mjs","sources":["../../../src/components/button/Button.ts"],"sourcesContent":["import {\n\tComponentType,\n\tButtonStyle,\n\ttype APIMessageComponentEmoji,\n\ttype APIButtonComponent,\n\ttype APIButtonComponentWithURL,\n\ttype APIButtonComponentWithCustomId,\n} from 'discord-api-types/v10';\nimport {\n\tbuttonLabelValidator,\n\tbuttonStyleValidator,\n\tcustomIdValidator,\n\tdisabledValidator,\n\temojiValidator,\n\turlValidator,\n\tvalidateRequiredButtonParameters,\n} from '../Assertions';\nimport { ComponentBuilder } from '../Component';\n\n/**\n * Represents a button component\n */\nexport class ButtonBuilder extends ComponentBuilder<APIButtonComponent> {\n\tpublic constructor(data?: Partial<APIButtonComponent>) {\n\t\tsuper({ type: ComponentType.Button, ...data });\n\t}\n\n\t/**\n\t * Sets the style of this button\n\t *\n\t * @param style - The style of the button\n\t */\n\tpublic setStyle(style: ButtonStyle) {\n\t\tthis.data.style = buttonStyleValidator.parse(style);\n\t\treturn this;\n\t}\n\n\t/**\n\t * Sets the URL for this button\n\t *\n\t * @param url - The URL to open when this button is clicked\n\t */\n\tpublic setURL(url: string) {\n\t\t(this.data as APIButtonComponentWithURL).url = urlValidator.parse(url);\n\t\treturn this;\n\t}\n\n\t/**\n\t * Sets the custom id for this button\n\t *\n\t * @param customId - The custom id to use for this button\n\t */\n\tpublic setCustomId(customId: string) {\n\t\t(this.data as APIButtonComponentWithCustomId).custom_id = customIdValidator.parse(customId);\n\t\treturn this;\n\t}\n\n\t/**\n\t * Sets the emoji to display on this button\n\t *\n\t * @param emoji - The emoji to display on this button\n\t */\n\tpublic setEmoji(emoji: APIMessageComponentEmoji) {\n\t\tthis.data.emoji = emojiValidator.parse(emoji);\n\t\treturn this;\n\t}\n\n\t/**\n\t * Sets whether this button is disabled\n\t *\n\t * @param disabled - Whether to disable this button\n\t */\n\tpublic setDisabled(disabled = true) {\n\t\tthis.data.disabled = disabledValidator.parse(disabled);\n\t\treturn this;\n\t}\n\n\t/**\n\t * Sets the label for this button\n\t *\n\t * @param label - The label to display on this button\n\t */\n\tpublic setLabel(label: string) {\n\t\tthis.data.label = buttonLabelValidator.parse(label);\n\t\treturn this;\n\t}\n\n\tpublic toJSON(): APIButtonComponent {\n\t\tvalidateRequiredButtonParameters(\n\t\t\tthis.data.style,\n\t\t\tthis.data.label,\n\t\t\tthis.data.emoji,\n\t\t\t(this.data as APIButtonComponentWithCustomId).custom_id,\n\t\t\t(this.data as APIButtonComponentWithURL).url,\n\t\t);\n\t\t// eslint-disable-next-line @typescript-eslint/consistent-type-assertions\n\t\treturn {\n\t\t\t...this.data,\n\t\t} as APIButtonComponent;\n\t}\n}\n"],"names":[],"mappings":";;;;AAaO,MAAM,aAAa,SAAS,gBAAgB,CAAC;AACpD,EAAE,WAAW,CAAC,IAAI,EAAE;AACpB,IAAI,KAAK,CAAC,EAAE,IAAI,EAAE,aAAa,CAAC,MAAM,EAAE,GAAG,IAAI,EAAE,CAAC,CAAC;AACnD,GAAG;AACH,EAAE,QAAQ,CAAC,KAAK,EAAE;AAClB,IAAI,IAAI,CAAC,IAAI,CAAC,KAAK,GAAG,oBAAoB,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;AACxD,IAAI,OAAO,IAAI,CAAC;AAChB,GAAG;AACH,EAAE,MAAM,CAAC,GAAG,EA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sources":["../../../src/components/button/Button.ts"],"sourcesContent":["import {\n\tComponentType,\n\tButtonStyle,\n\ttype APIMessageComponentEmoji,\n\ttype APIButtonComponent,\n\ttype APIButtonComponentWithURL,\n\ttype APIButtonComponentWithCustomId,\n} from 'discord-api-types/v10';\nimport {\n\tbuttonLabelValidator,\n\tbuttonStyleValidator,\n\tcustomIdValidator,\n\tdisabledValidator,\n\temojiValidator,\n\turlValidator,\n\tvalidateRequiredButtonParameters,\n} from '../Assertions';\nimport { ComponentBuilder } from '../Component';\n\n/**\n * Represents a button component\n */\nexport class ButtonBuilder extends ComponentBuilder<APIButtonComponent> {\n\tpublic constructor(data?: Partial<APIButtonComponent>) {\n\t\tsuper({ type: ComponentType.Button, ...data });\n\t}\n\n\t/**\n\t * Sets the style of this button\n\t *\n\t * @param style - The style of the button\n\t */\n\tpublic setStyle(style: ButtonStyle) {\n\t\tthis.data.style = buttonStyleValidator.parse(style);\n\t\treturn this;\n\t}\n\n\t/**\n\t * Sets the URL for this button\n\t *\n\t * @param url - The URL to open when this button is clicked\n\t */\n\tpublic setURL(url: string) {\n\t\t(this.data as APIButtonComponentWithURL).url = urlValidator.parse(url);\n\t\treturn this;\n\t}\n\n\t/**\n\t * Sets the custom id for this button\n\t *\n\t * @param customId - The custom id to use for this button\n\t */\n\tpublic setCustomId(customId: string) {\n\t\t(this.data as APIButtonComponentWithCustomId).custom_id = customIdValidator.parse(customId);\n\t\treturn this;\n\t}\n\n\t/**\n\t * Sets the emoji to display on this button\n\t *\n\t * @param emoji - The emoji to display on this button\n\t */\n\tpublic setEmoji(emoji: APIMessageComponentEmoji) {\n\t\tthis.data.emoji = emojiValidator.parse(emoji);\n\t\treturn this;\n\t}\n\n\t/**\n\t * Sets whether this button is disabled\n\t *\n\t * @param disabled - Whether to disable this button\n\t */\n\tpublic setDisabled(disabled = true) {\n\t\tthis.data.disabled = disabledValidator.parse(disabled);\n\t\treturn this;\n\t}\n\n\t/**\n\t * Sets the label for this button\n\t *\n\t * @param label - The label to display on this button\n\t */\n\tpublic setLabel(label: string) {\n\t\tthis.data.label = buttonLabelValidator.parse(label);\n\t\treturn this;\n\t}\n\n\t/**\n\t * {@inheritDoc JSONEncodable.toJSON}\n\t */\n\tpublic toJSON(): APIButtonComponent {\n\t\tvalidateRequiredButtonParameters(\n\t\t\tthis.data.style,\n\t\t\tthis.data.label,\n\t\t\tthis.data.emoji,\n\t\t\t(this.data as APIButtonComponentWithCustomId).custom_id,\n\t\t\t(this.data as APIButtonComponentWithURL).url,\n\t\t);\n\t\t// eslint-disable-next-line @typescript-eslint/consistent-type-assertions\n\t\treturn {\n\t\t\t...this.data,\n\t\t} as APIButtonComponent;\n\t}\n}\n"],"names":[],"mappings":";;;;AAaO,MAAM,aAAa,SAAS,gBAAgB,CAAC;AACpD,EAAE,WAAW,CAAC,IAAI,EAAE;AACpB,IAAI,KAAK,CAAC,EAAE,IAAI,EAAE,aAAa,CAAC,MAAM,EAAE,GAAG,IAAI,EAAE,CAAC,CAAC;AACnD,GAAG;AACH,EAAE,QAAQ,CAAC,KAAK,EAAE;AAClB,IAAI,IAAI,CAAC,IAAI,CAAC,KAAK,GAAG,oBAAoB,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;AACxD,IAAI,OAAO,IAAI,CAAC;AAChB,GAAG;AACH,EAAE,MAAM,CAAC,GAAG,EAAE;AACd,IAAI,IAAI,CAAC,IAAI,CAAC,GAAG,GAAG,YAAY,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;AAC5C,IAAI,OAAO,IAAI,CAAC;AAChB,GAAG;AACH,EAAE,WAAW,CAAC,QAAQ,EAAE;AACxB,IAAI,IAAI,CAAC,IAAI,CAAC,SAAS,GAAG,iBAAiB,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;AAC5D,IAAI,OAAO,IAAI,CAAC;AAChB,GAAG;AACH,EAAE,QAAQ,CAAC,KAAK,EAAE;AAClB,IAAI,IAAI,CAAC,IAAI,CAAC,KAAK,GAAG,cAAc,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;AAClD,IAAI,OAAO,IAAI,CAAC;AAChB,GAAG;AACH,EAAE,WAAW,CAAC,QAAQ,GAAG,IAAI,EAAE;AAC/B,IAAI,IAAI,CAAC,IAAI,CAAC,QAAQ,GAAG,iBAAiB,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;AAC3D,IAAI,OAAO,IAAI,CAAC;AAChB,GAAG;AACH,EAAE,QAAQ,CAAC,KAAK,EAAE;AAClB,IAAI,IAAI,CAAC,IAAI,CAAC,KAAK,GAAG,oBAAoB,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;AACxD,IAAI,OAAO,IAAI,CAAC;AAChB,GAAG;AACH,EAAE,MAAM,GAAG;AACX,IAAI,gCAAgC;AACpC,MAAM,IAAI,CAAC,IAAI,CAAC,KAAK;AACrB,MAAM,IAAI,CAAC,IAAI,CAAC,KAAK;AACrB,MAAM,IAAI,CAAC,IAAI,CAAC,KAAK;AACrB,MAAM,IAAI,CAAC,IAAI,CAAC,SAAS;AACzB,MAAM,IAAI,CAAC,IAAI,CAAC,GAAG;AACnB,KAAK,CAAC;AACN,IAAI,OAAO;AACX,MAAM,GAAG,IAAI,CAAC,IAAI;AAClB,KAAK,CAAC;AACN,GAAG;AACH;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SelectMenu.cjs","sources":["../../../src/components/selectMenu/SelectMenu.ts"],"sourcesContent":["import { APISelectMenuOption, ComponentType, type APISelectMenuComponent } from 'discord-api-types/v10';\nimport { SelectMenuOptionBuilder } from './SelectMenuOption';\nimport { normalizeArray, type RestOrArray } from '../../util/normalizeArray';\nimport {\n\tcustomIdValidator,\n\tdisabledValidator,\n\tjsonOptionValidator,\n\tminMaxValidator,\n\toptionsLengthValidator,\n\tplaceholderValidator,\n\tvalidateRequiredSelectMenuParameters,\n} from '../Assertions';\nimport { ComponentBuilder } from '../Component';\n\n/**\n * Represents a select menu component\n */\nexport class SelectMenuBuilder extends ComponentBuilder<APISelectMenuComponent> {\n\t/**\n\t * The options within this select menu\n\t */\n\tpublic readonly options: SelectMenuOptionBuilder[];\n\n\tpublic constructor(data?: Partial<APISelectMenuComponent>) {\n\t\tconst { options, ...initData } = data ?? {};\n\t\tsuper({ type: ComponentType.SelectMenu, ...initData });\n\t\tthis.options = options?.map((o) => new SelectMenuOptionBuilder(o)) ?? [];\n\t}\n\n\t/**\n\t * Sets the placeholder for this select menu\n\t *\n\t * @param placeholder - The placeholder to use for this select menu\n\t */\n\tpublic setPlaceholder(placeholder: string) {\n\t\tthis.data.placeholder = placeholderValidator.parse(placeholder);\n\t\treturn this;\n\t}\n\n\t/**\n\t * Sets the minimum values that must be selected in the select menu\n\t *\n\t * @param minValues - The minimum values that must be selected\n\t */\n\tpublic setMinValues(minValues: number) {\n\t\tthis.data.min_values = minMaxValidator.parse(minValues);\n\t\treturn this;\n\t}\n\n\t/**\n\t * Sets the maximum values that must be selected in the select menu\n\t *\n\t * @param maxValues - The maximum values that must be selected\n\t */\n\tpublic setMaxValues(maxValues: number) {\n\t\tthis.data.max_values = minMaxValidator.parse(maxValues);\n\t\treturn this;\n\t}\n\n\t/**\n\t * Sets the custom id for this select menu\n\t *\n\t * @param customId - The custom id to use for this select menu\n\t */\n\tpublic setCustomId(customId: string) {\n\t\tthis.data.custom_id = customIdValidator.parse(customId);\n\t\treturn this;\n\t}\n\n\t/**\n\t * Sets whether this select menu is disabled\n\t *\n\t * @param disabled - Whether this select menu is disabled\n\t */\n\tpublic setDisabled(disabled = true) {\n\t\tthis.data.disabled = disabledValidator.parse(disabled);\n\t\treturn this;\n\t}\n\n\t/**\n\t * Adds options to this select menu\n\t *\n\t * @param options - The options to add to this select menu\n\t * @returns\n\t */\n\tpublic addOptions(...options: RestOrArray<SelectMenuOptionBuilder | APISelectMenuOption>) {\n\t\toptions = normalizeArray(options);\n\t\toptionsLengthValidator.parse(this.options.length + options.length);\n\t\tthis.options.push(\n\t\t\t...options.map((option) =>\n\t\t\t\toption instanceof SelectMenuOptionBuilder\n\t\t\t\t\t? option\n\t\t\t\t\t: new SelectMenuOptionBuilder(jsonOptionValidator.parse(option)),\n\t\t\t),\n\t\t);\n\t\treturn this;\n\t}\n\n\t/**\n\t * Sets the options on this select menu\n\t *\n\t * @param options - The options to set on this select menu\n\t */\n\tpublic setOptions(...options: RestOrArray<SelectMenuOptionBuilder | APISelectMenuOption>) {\n\t\toptions = normalizeArray(options);\n\t\toptionsLengthValidator.parse(options.length);\n\t\tthis.options.splice(\n\t\t\t0,\n\t\t\tthis.options.length,\n\t\t\t...options.map((option) =>\n\t\t\t\toption instanceof SelectMenuOptionBuilder\n\t\t\t\t\t? option\n\t\t\t\t\t: new SelectMenuOptionBuilder(jsonOptionValidator.parse(option)),\n\t\t\t),\n\t\t);\n\t\treturn this;\n\t}\n\n\tpublic toJSON(): APISelectMenuComponent {\n\t\tvalidateRequiredSelectMenuParameters(this.options, this.data.custom_id);\n\t\t// eslint-disable-next-line @typescript-eslint/consistent-type-assertions\n\t\treturn {\n\t\t\t...this.data,\n\t\t\toptions: this.options.map((o) => o.toJSON()),\n\t\t} as APISelectMenuComponent;\n\t}\n}\n"],"names":["ComponentBuilder","ComponentType","SelectMenuOptionBuilder","placeholderValidator","minMaxValidator","customIdValidator","disabledValidator","normalizeArray","optionsLengthValidator","jsonOptionValidator","validateRequiredSelectMenuParameters"],"mappings":";;;;;;;;;;AAaO,MAAM,iBAAiB,SAASA,0BAAgB,CAAC;AACxD,EAAE,WAAW,CAAC,IAAI,EAAE;AACpB,IAAI,MAAM,EAAE,OAAO,EAAE,GAAG,QAAQ,EAAE,GAAG,IAAI,IAAI,EAAE,CAAC;AAChD,IAAI,KAAK,CAAC,EAAE,IAAI,EAAEC,iBAAa,CAAC,UAAU,EAAE,GAAG,QAAQ,EAAE,CAAC,CAAC;AAC3D,IAAI,IAAI,CAAC,OAAO,GAAG,OAAO,EAAE,GAAG,CAAC,CAAC,CAAC,KAAK,IAAIC,wCAAu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CAAC,MAAM,KAAK,MAAM,YAAYN,wCAAuB,GAAG,MAAM,GAAG,IAAIA,wCAAuB,CAACO,8BAAmB,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;AACvI,OAAO;AACP,KAAK,CAAC;AACN,IAAI,OAAO,IAAI,CAAC;AAChB,GAAG;AACH,EAAE,UAAU,CAAC,GAAG,OAAO,EAAE;AACzB,IAAI,OAAO,GAAGF,6BAAc,CAAC,OAAO,CAAC,CAAC;AACtC,IAAIC,iCAAsB,CAAC,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;AACjD,IAAI,IAAI,CAAC,OAAO,CAAC,MAAM;AACvB,MAAM,CAAC;AACP,MAAM,IAAI,CAAC,OAAO,CAAC,MAAM;AACzB,MAAM,GAAG,OAAO,CAAC,GAAG;AACpB,QAAQ,CAAC,MAAM,KAAK,MAAM,YAAYN,wCAAuB,GAAG,MAAM,GAAG,IAAIA,wCAAuB,CAACO,8BAAmB,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;AACvI,OAAO;AACP,KAAK,CAAC;AACN,IAAI,OAAO,IAAI,CAAC;AAChB,GAAG;AACH,EAAE,MAAM,GAAG;AACX,IAAIC,+CAAoC,CAAC,IAAI,CAAC,OAAO,EAAE,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;AAC5E,IAAI,OAAO;AACX,MAAM,GAAG,IAAI,CAAC,IAAI;AAClB,MAAM,OAAO,EAAE,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,MAAM,EAAE,CAAC;AAClD,KAAK,CAAC;AACN,GAAG;AACH;;;;"}
|
|
1
|
+
{"version":3,"file":"SelectMenu.cjs","sources":["../../../src/components/selectMenu/SelectMenu.ts"],"sourcesContent":["import { APISelectMenuOption, ComponentType, type APISelectMenuComponent } from 'discord-api-types/v10';\nimport { SelectMenuOptionBuilder } from './SelectMenuOption';\nimport { normalizeArray, type RestOrArray } from '../../util/normalizeArray';\nimport {\n\tcustomIdValidator,\n\tdisabledValidator,\n\tjsonOptionValidator,\n\tminMaxValidator,\n\toptionsLengthValidator,\n\tplaceholderValidator,\n\tvalidateRequiredSelectMenuParameters,\n} from '../Assertions';\nimport { ComponentBuilder } from '../Component';\n\n/**\n * Represents a select menu component\n */\nexport class SelectMenuBuilder extends ComponentBuilder<APISelectMenuComponent> {\n\t/**\n\t * The options within this select menu\n\t */\n\tpublic readonly options: SelectMenuOptionBuilder[];\n\n\tpublic constructor(data?: Partial<APISelectMenuComponent>) {\n\t\tconst { options, ...initData } = data ?? {};\n\t\tsuper({ type: ComponentType.SelectMenu, ...initData });\n\t\tthis.options = options?.map((o) => new SelectMenuOptionBuilder(o)) ?? [];\n\t}\n\n\t/**\n\t * Sets the placeholder for this select menu\n\t *\n\t * @param placeholder - The placeholder to use for this select menu\n\t */\n\tpublic setPlaceholder(placeholder: string) {\n\t\tthis.data.placeholder = placeholderValidator.parse(placeholder);\n\t\treturn this;\n\t}\n\n\t/**\n\t * Sets the minimum values that must be selected in the select menu\n\t *\n\t * @param minValues - The minimum values that must be selected\n\t */\n\tpublic setMinValues(minValues: number) {\n\t\tthis.data.min_values = minMaxValidator.parse(minValues);\n\t\treturn this;\n\t}\n\n\t/**\n\t * Sets the maximum values that must be selected in the select menu\n\t *\n\t * @param maxValues - The maximum values that must be selected\n\t */\n\tpublic setMaxValues(maxValues: number) {\n\t\tthis.data.max_values = minMaxValidator.parse(maxValues);\n\t\treturn this;\n\t}\n\n\t/**\n\t * Sets the custom id for this select menu\n\t *\n\t * @param customId - The custom id to use for this select menu\n\t */\n\tpublic setCustomId(customId: string) {\n\t\tthis.data.custom_id = customIdValidator.parse(customId);\n\t\treturn this;\n\t}\n\n\t/**\n\t * Sets whether this select menu is disabled\n\t *\n\t * @param disabled - Whether this select menu is disabled\n\t */\n\tpublic setDisabled(disabled = true) {\n\t\tthis.data.disabled = disabledValidator.parse(disabled);\n\t\treturn this;\n\t}\n\n\t/**\n\t * Adds options to this select menu\n\t *\n\t * @param options - The options to add to this select menu\n\t * @returns\n\t */\n\tpublic addOptions(...options: RestOrArray<SelectMenuOptionBuilder | APISelectMenuOption>) {\n\t\toptions = normalizeArray(options);\n\t\toptionsLengthValidator.parse(this.options.length + options.length);\n\t\tthis.options.push(\n\t\t\t...options.map((option) =>\n\t\t\t\toption instanceof SelectMenuOptionBuilder\n\t\t\t\t\t? option\n\t\t\t\t\t: new SelectMenuOptionBuilder(jsonOptionValidator.parse(option)),\n\t\t\t),\n\t\t);\n\t\treturn this;\n\t}\n\n\t/**\n\t * Sets the options on this select menu\n\t *\n\t * @param options - The options to set on this select menu\n\t */\n\tpublic setOptions(...options: RestOrArray<SelectMenuOptionBuilder | APISelectMenuOption>) {\n\t\toptions = normalizeArray(options);\n\t\toptionsLengthValidator.parse(options.length);\n\t\tthis.options.splice(\n\t\t\t0,\n\t\t\tthis.options.length,\n\t\t\t...options.map((option) =>\n\t\t\t\toption instanceof SelectMenuOptionBuilder\n\t\t\t\t\t? option\n\t\t\t\t\t: new SelectMenuOptionBuilder(jsonOptionValidator.parse(option)),\n\t\t\t),\n\t\t);\n\t\treturn this;\n\t}\n\n\t/**\n\t * {@inheritDoc JSONEncodable.toJSON}\n\t */\n\tpublic toJSON(): APISelectMenuComponent {\n\t\tvalidateRequiredSelectMenuParameters(this.options, this.data.custom_id);\n\t\t// eslint-disable-next-line @typescript-eslint/consistent-type-assertions\n\t\treturn {\n\t\t\t...this.data,\n\t\t\toptions: this.options.map((o) => o.toJSON()),\n\t\t} as APISelectMenuComponent;\n\t}\n}\n"],"names":["ComponentBuilder","ComponentType","SelectMenuOptionBuilder","placeholderValidator","minMaxValidator","customIdValidator","disabledValidator","normalizeArray","optionsLengthValidator","jsonOptionValidator","validateRequiredSelectMenuParameters"],"mappings":";;;;;;;;;;AAaO,MAAM,iBAAiB,SAASA,0BAAgB,CAAC;AACxD,EAAE,WAAW,CAAC,IAAI,EAAE;AACpB,IAAI,MAAM,EAAE,OAAO,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AClD,KAAK,CAAC;AACN,GAAG;AACH;;;;"}
|
|
@@ -54,6 +54,9 @@ export declare class SelectMenuBuilder extends ComponentBuilder<APISelectMenuCom
|
|
|
54
54
|
* @param options - The options to set on this select menu
|
|
55
55
|
*/
|
|
56
56
|
setOptions(...options: RestOrArray<SelectMenuOptionBuilder | APISelectMenuOption>): this;
|
|
57
|
+
/**
|
|
58
|
+
* {@inheritDoc JSONEncodable.toJSON}
|
|
59
|
+
*/
|
|
57
60
|
toJSON(): APISelectMenuComponent;
|
|
58
61
|
}
|
|
59
62
|
//# sourceMappingURL=SelectMenu.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SelectMenu.d.ts","sourceRoot":"","sources":["../../../src/components/selectMenu/SelectMenu.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAiB,KAAK,sBAAsB,EAAE,MAAM,uBAAuB,CAAC;AACxG,OAAO,EAAE,uBAAuB,EAAE,MAAM,oBAAoB,CAAC;AAC7D,OAAO,EAAkB,KAAK,WAAW,EAAE,MAAM,2BAA2B,CAAC;AAU7E,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAEhD;;GAEG;AACH,qBAAa,iBAAkB,SAAQ,gBAAgB,CAAC,sBAAsB,CAAC;IAC9E;;OAEG;IACH,SAAgB,OAAO,EAAE,uBAAuB,EAAE,CAAC;gBAEhC,IAAI,CAAC,EAAE,OAAO,CAAC,sBAAsB,CAAC;IAMzD;;;;OAIG;IACI,cAAc,CAAC,WAAW,EAAE,MAAM;IAKzC;;;;OAIG;IACI,YAAY,CAAC,SAAS,EAAE,MAAM;IAKrC;;;;OAIG;IACI,YAAY,CAAC,SAAS,EAAE,MAAM;IAKrC;;;;OAIG;IACI,WAAW,CAAC,QAAQ,EAAE,MAAM;IAKnC;;;;OAIG;IACI,WAAW,CAAC,QAAQ,UAAO;IAKlC;;;;;OAKG;IACI,UAAU,CAAC,GAAG,OAAO,EAAE,WAAW,CAAC,uBAAuB,GAAG,mBAAmB,CAAC;IAaxF;;;;OAIG;IACI,UAAU,CAAC,GAAG,OAAO,EAAE,WAAW,CAAC,uBAAuB,GAAG,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"SelectMenu.d.ts","sourceRoot":"","sources":["../../../src/components/selectMenu/SelectMenu.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAiB,KAAK,sBAAsB,EAAE,MAAM,uBAAuB,CAAC;AACxG,OAAO,EAAE,uBAAuB,EAAE,MAAM,oBAAoB,CAAC;AAC7D,OAAO,EAAkB,KAAK,WAAW,EAAE,MAAM,2BAA2B,CAAC;AAU7E,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAEhD;;GAEG;AACH,qBAAa,iBAAkB,SAAQ,gBAAgB,CAAC,sBAAsB,CAAC;IAC9E;;OAEG;IACH,SAAgB,OAAO,EAAE,uBAAuB,EAAE,CAAC;gBAEhC,IAAI,CAAC,EAAE,OAAO,CAAC,sBAAsB,CAAC;IAMzD;;;;OAIG;IACI,cAAc,CAAC,WAAW,EAAE,MAAM;IAKzC;;;;OAIG;IACI,YAAY,CAAC,SAAS,EAAE,MAAM;IAKrC;;;;OAIG;IACI,YAAY,CAAC,SAAS,EAAE,MAAM;IAKrC;;;;OAIG;IACI,WAAW,CAAC,QAAQ,EAAE,MAAM;IAKnC;;;;OAIG;IACI,WAAW,CAAC,QAAQ,UAAO;IAKlC;;;;;OAKG;IACI,UAAU,CAAC,GAAG,OAAO,EAAE,WAAW,CAAC,uBAAuB,GAAG,mBAAmB,CAAC;IAaxF;;;;OAIG;IACI,UAAU,CAAC,GAAG,OAAO,EAAE,WAAW,CAAC,uBAAuB,GAAG,mBAAmB,CAAC;IAexF;;OAEG;IACI,MAAM,IAAI,sBAAsB;CAQvC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SelectMenu.mjs","sources":["../../../src/components/selectMenu/SelectMenu.ts"],"sourcesContent":["import { APISelectMenuOption, ComponentType, type APISelectMenuComponent } from 'discord-api-types/v10';\nimport { SelectMenuOptionBuilder } from './SelectMenuOption';\nimport { normalizeArray, type RestOrArray } from '../../util/normalizeArray';\nimport {\n\tcustomIdValidator,\n\tdisabledValidator,\n\tjsonOptionValidator,\n\tminMaxValidator,\n\toptionsLengthValidator,\n\tplaceholderValidator,\n\tvalidateRequiredSelectMenuParameters,\n} from '../Assertions';\nimport { ComponentBuilder } from '../Component';\n\n/**\n * Represents a select menu component\n */\nexport class SelectMenuBuilder extends ComponentBuilder<APISelectMenuComponent> {\n\t/**\n\t * The options within this select menu\n\t */\n\tpublic readonly options: SelectMenuOptionBuilder[];\n\n\tpublic constructor(data?: Partial<APISelectMenuComponent>) {\n\t\tconst { options, ...initData } = data ?? {};\n\t\tsuper({ type: ComponentType.SelectMenu, ...initData });\n\t\tthis.options = options?.map((o) => new SelectMenuOptionBuilder(o)) ?? [];\n\t}\n\n\t/**\n\t * Sets the placeholder for this select menu\n\t *\n\t * @param placeholder - The placeholder to use for this select menu\n\t */\n\tpublic setPlaceholder(placeholder: string) {\n\t\tthis.data.placeholder = placeholderValidator.parse(placeholder);\n\t\treturn this;\n\t}\n\n\t/**\n\t * Sets the minimum values that must be selected in the select menu\n\t *\n\t * @param minValues - The minimum values that must be selected\n\t */\n\tpublic setMinValues(minValues: number) {\n\t\tthis.data.min_values = minMaxValidator.parse(minValues);\n\t\treturn this;\n\t}\n\n\t/**\n\t * Sets the maximum values that must be selected in the select menu\n\t *\n\t * @param maxValues - The maximum values that must be selected\n\t */\n\tpublic setMaxValues(maxValues: number) {\n\t\tthis.data.max_values = minMaxValidator.parse(maxValues);\n\t\treturn this;\n\t}\n\n\t/**\n\t * Sets the custom id for this select menu\n\t *\n\t * @param customId - The custom id to use for this select menu\n\t */\n\tpublic setCustomId(customId: string) {\n\t\tthis.data.custom_id = customIdValidator.parse(customId);\n\t\treturn this;\n\t}\n\n\t/**\n\t * Sets whether this select menu is disabled\n\t *\n\t * @param disabled - Whether this select menu is disabled\n\t */\n\tpublic setDisabled(disabled = true) {\n\t\tthis.data.disabled = disabledValidator.parse(disabled);\n\t\treturn this;\n\t}\n\n\t/**\n\t * Adds options to this select menu\n\t *\n\t * @param options - The options to add to this select menu\n\t * @returns\n\t */\n\tpublic addOptions(...options: RestOrArray<SelectMenuOptionBuilder | APISelectMenuOption>) {\n\t\toptions = normalizeArray(options);\n\t\toptionsLengthValidator.parse(this.options.length + options.length);\n\t\tthis.options.push(\n\t\t\t...options.map((option) =>\n\t\t\t\toption instanceof SelectMenuOptionBuilder\n\t\t\t\t\t? option\n\t\t\t\t\t: new SelectMenuOptionBuilder(jsonOptionValidator.parse(option)),\n\t\t\t),\n\t\t);\n\t\treturn this;\n\t}\n\n\t/**\n\t * Sets the options on this select menu\n\t *\n\t * @param options - The options to set on this select menu\n\t */\n\tpublic setOptions(...options: RestOrArray<SelectMenuOptionBuilder | APISelectMenuOption>) {\n\t\toptions = normalizeArray(options);\n\t\toptionsLengthValidator.parse(options.length);\n\t\tthis.options.splice(\n\t\t\t0,\n\t\t\tthis.options.length,\n\t\t\t...options.map((option) =>\n\t\t\t\toption instanceof SelectMenuOptionBuilder\n\t\t\t\t\t? option\n\t\t\t\t\t: new SelectMenuOptionBuilder(jsonOptionValidator.parse(option)),\n\t\t\t),\n\t\t);\n\t\treturn this;\n\t}\n\n\tpublic toJSON(): APISelectMenuComponent {\n\t\tvalidateRequiredSelectMenuParameters(this.options, this.data.custom_id);\n\t\t// eslint-disable-next-line @typescript-eslint/consistent-type-assertions\n\t\treturn {\n\t\t\t...this.data,\n\t\t\toptions: this.options.map((o) => o.toJSON()),\n\t\t} as APISelectMenuComponent;\n\t}\n}\n"],"names":[],"mappings":";;;;;;AAaO,MAAM,iBAAiB,SAAS,gBAAgB,CAAC;AACxD,EAAE,WAAW,CAAC,IAAI,EAAE;AACpB,IAAI,MAAM,EAAE,OAAO,EAAE,GAAG,QAAQ,EAAE,GAAG,IAAI,I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SelectMenu.mjs","sources":["../../../src/components/selectMenu/SelectMenu.ts"],"sourcesContent":["import { APISelectMenuOption, ComponentType, type APISelectMenuComponent } from 'discord-api-types/v10';\nimport { SelectMenuOptionBuilder } from './SelectMenuOption';\nimport { normalizeArray, type RestOrArray } from '../../util/normalizeArray';\nimport {\n\tcustomIdValidator,\n\tdisabledValidator,\n\tjsonOptionValidator,\n\tminMaxValidator,\n\toptionsLengthValidator,\n\tplaceholderValidator,\n\tvalidateRequiredSelectMenuParameters,\n} from '../Assertions';\nimport { ComponentBuilder } from '../Component';\n\n/**\n * Represents a select menu component\n */\nexport class SelectMenuBuilder extends ComponentBuilder<APISelectMenuComponent> {\n\t/**\n\t * The options within this select menu\n\t */\n\tpublic readonly options: SelectMenuOptionBuilder[];\n\n\tpublic constructor(data?: Partial<APISelectMenuComponent>) {\n\t\tconst { options, ...initData } = data ?? {};\n\t\tsuper({ type: ComponentType.SelectMenu, ...initData });\n\t\tthis.options = options?.map((o) => new SelectMenuOptionBuilder(o)) ?? [];\n\t}\n\n\t/**\n\t * Sets the placeholder for this select menu\n\t *\n\t * @param placeholder - The placeholder to use for this select menu\n\t */\n\tpublic setPlaceholder(placeholder: string) {\n\t\tthis.data.placeholder = placeholderValidator.parse(placeholder);\n\t\treturn this;\n\t}\n\n\t/**\n\t * Sets the minimum values that must be selected in the select menu\n\t *\n\t * @param minValues - The minimum values that must be selected\n\t */\n\tpublic setMinValues(minValues: number) {\n\t\tthis.data.min_values = minMaxValidator.parse(minValues);\n\t\treturn this;\n\t}\n\n\t/**\n\t * Sets the maximum values that must be selected in the select menu\n\t *\n\t * @param maxValues - The maximum values that must be selected\n\t */\n\tpublic setMaxValues(maxValues: number) {\n\t\tthis.data.max_values = minMaxValidator.parse(maxValues);\n\t\treturn this;\n\t}\n\n\t/**\n\t * Sets the custom id for this select menu\n\t *\n\t * @param customId - The custom id to use for this select menu\n\t */\n\tpublic setCustomId(customId: string) {\n\t\tthis.data.custom_id = customIdValidator.parse(customId);\n\t\treturn this;\n\t}\n\n\t/**\n\t * Sets whether this select menu is disabled\n\t *\n\t * @param disabled - Whether this select menu is disabled\n\t */\n\tpublic setDisabled(disabled = true) {\n\t\tthis.data.disabled = disabledValidator.parse(disabled);\n\t\treturn this;\n\t}\n\n\t/**\n\t * Adds options to this select menu\n\t *\n\t * @param options - The options to add to this select menu\n\t * @returns\n\t */\n\tpublic addOptions(...options: RestOrArray<SelectMenuOptionBuilder | APISelectMenuOption>) {\n\t\toptions = normalizeArray(options);\n\t\toptionsLengthValidator.parse(this.options.length + options.length);\n\t\tthis.options.push(\n\t\t\t...options.map((option) =>\n\t\t\t\toption instanceof SelectMenuOptionBuilder\n\t\t\t\t\t? option\n\t\t\t\t\t: new SelectMenuOptionBuilder(jsonOptionValidator.parse(option)),\n\t\t\t),\n\t\t);\n\t\treturn this;\n\t}\n\n\t/**\n\t * Sets the options on this select menu\n\t *\n\t * @param options - The options to set on this select menu\n\t */\n\tpublic setOptions(...options: RestOrArray<SelectMenuOptionBuilder | APISelectMenuOption>) {\n\t\toptions = normalizeArray(options);\n\t\toptionsLengthValidator.parse(options.length);\n\t\tthis.options.splice(\n\t\t\t0,\n\t\t\tthis.options.length,\n\t\t\t...options.map((option) =>\n\t\t\t\toption instanceof SelectMenuOptionBuilder\n\t\t\t\t\t? option\n\t\t\t\t\t: new SelectMenuOptionBuilder(jsonOptionValidator.parse(option)),\n\t\t\t),\n\t\t);\n\t\treturn this;\n\t}\n\n\t/**\n\t * {@inheritDoc JSONEncodable.toJSON}\n\t */\n\tpublic toJSON(): APISelectMenuComponent {\n\t\tvalidateRequiredSelectMenuParameters(this.options, this.data.custom_id);\n\t\t// eslint-disable-next-line @typescript-eslint/consistent-type-assertions\n\t\treturn {\n\t\t\t...this.data,\n\t\t\toptions: this.options.map((o) => o.toJSON()),\n\t\t} as APISelectMenuComponent;\n\t}\n}\n"],"names":[],"mappings":";;;;;;AAaO,MAAM,iBAAiB,SAAS,gBAAgB,CAAC;AACxD,EAA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CAAC,CAAC,MAAM,EAAE,CAAC;AAClD,KAAK,CAAC;AACN,GAAG;AACH;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SelectMenuOption.cjs","sources":["../../../src/components/selectMenu/SelectMenuOption.ts"],"sourcesContent":["import type { APIMessageComponentEmoji, APISelectMenuOption } from 'discord-api-types/v10';\n\nimport {\n\tdefaultValidator,\n\temojiValidator,\n\tlabelValueDescriptionValidator,\n\tvalidateRequiredSelectMenuOptionParameters,\n} from '../Assertions';\n\n/**\n * Represents a option within a select menu component\n */\nexport class SelectMenuOptionBuilder {\n\tpublic constructor(public data: Partial<APISelectMenuOption> = {}) {}\n\n\t/**\n\t * Sets the label of this option\n\t *\n\t * @param label - The label to show on this option\n\t */\n\tpublic setLabel(label: string) {\n\t\tthis.data.label = labelValueDescriptionValidator.parse(label);\n\t\treturn this;\n\t}\n\n\t/**\n\t * Sets the value of this option\n\t *\n\t * @param value - The value of this option\n\t */\n\tpublic setValue(value: string) {\n\t\tthis.data.value = labelValueDescriptionValidator.parse(value);\n\t\treturn this;\n\t}\n\n\t/**\n\t * Sets the description of this option\n\t *\n\t * @param description - The description of this option\n\t */\n\tpublic setDescription(description: string) {\n\t\tthis.data.description = labelValueDescriptionValidator.parse(description);\n\t\treturn this;\n\t}\n\n\t/**\n\t * Sets whether this option is selected by default\n\t *\n\t * @param isDefault - Whether this option is selected by default\n\t */\n\tpublic setDefault(isDefault = true) {\n\t\tthis.data.default = defaultValidator.parse(isDefault);\n\t\treturn this;\n\t}\n\n\t/**\n\t * Sets the emoji to display on this option\n\t *\n\t * @param emoji - The emoji to display on this option\n\t */\n\tpublic setEmoji(emoji: APIMessageComponentEmoji) {\n\t\tthis.data.emoji = emojiValidator.parse(emoji);\n\t\treturn this;\n\t}\n\n\tpublic toJSON(): APISelectMenuOption {\n\t\tvalidateRequiredSelectMenuOptionParameters(this.data.label, this.data.value);\n\t\t// eslint-disable-next-line @typescript-eslint/consistent-type-assertions\n\t\treturn {\n\t\t\t...this.data,\n\t\t} as APISelectMenuOption;\n\t}\n}\n"],"names":["labelValueDescriptionValidator","defaultValidator","emojiValidator","validateRequiredSelectMenuOptionParameters"],"mappings":";;;;;;AAMO,MAAM,uBAAuB,CAAC;AACrC,EAAE,WAAW,CAAC,IAAI,GAAG,EAAE,EAAE;AACzB,IAAI,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;AACrB,GAAG;AACH,EAAE,QAAQ,CAAC,KAAK,EAAE;AAClB,IAAI,IAAI,CAAC,IAAI,CAAC,KAAK,GAAGA,yCAA8B,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;AAClE,IAAI,OAAO,IAAI,CAAC;AAChB,GAAG;AACH,EAAE,QAAQ,CAAC,KAAK,EAAE;AAClB,IAAI,IAAI,CAAC,IAAI,CAAC,KAAK,GAAGA,yCAA8B,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;AAClE,IAAI,OAAO,IAAI,CAAC;AAChB,GAAG;AACH,EAAE,cAAc,CAAC,WAAW,EAAE;AAC9B,IAAI,IAAI,CAAC,IAAI,CAAC,WAAW,GAAGA,yCAA8B,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC;AAC9E,IAAI,OAAO,IAAI,CAAC;AAChB,GAAG;AACH,EAAE,UAAU,CAAC,SAAS,GAAG,IAAI,EAAE;AAC/B,IAAI,IAAI,CAAC,IAAI,CAAC,OAAO,GAAGC,2BAAgB,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC;AAC1D,IAAI,OAAO,IAAI,CAAC;AAChB,GAAG;AACH,EAAE,QAAQ,CAAC,KAAK,EAAE;AAClB,IAAI,IAAI,CAAC,IAAI,CAAC,KAAK,GAAGC,yBAAc,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;AAClD,IAAI,OAAO,IAAI,CAAC;AAChB,GAAG;AACH,EAAE,MAAM,GAAG;AACX,IAAIC,qDAA0C,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;AACjF,IAAI,OAAO;AACX,MAAM,GAAG,IAAI,CAAC,IAAI;AAClB,KAAK,CAAC;AACN,GAAG;AACH;;;;"}
|
|
1
|
+
{"version":3,"file":"SelectMenuOption.cjs","sources":["../../../src/components/selectMenu/SelectMenuOption.ts"],"sourcesContent":["import type { APIMessageComponentEmoji, APISelectMenuOption } from 'discord-api-types/v10';\nimport type { JSONEncodable } from '../../util/jsonEncodable';\n\nimport {\n\tdefaultValidator,\n\temojiValidator,\n\tlabelValueDescriptionValidator,\n\tvalidateRequiredSelectMenuOptionParameters,\n} from '../Assertions';\n\n/**\n * Represents a option within a select menu component\n */\nexport class SelectMenuOptionBuilder implements JSONEncodable<APISelectMenuOption> {\n\tpublic constructor(public data: Partial<APISelectMenuOption> = {}) {}\n\n\t/**\n\t * Sets the label of this option\n\t *\n\t * @param label - The label to show on this option\n\t */\n\tpublic setLabel(label: string) {\n\t\tthis.data.label = labelValueDescriptionValidator.parse(label);\n\t\treturn this;\n\t}\n\n\t/**\n\t * Sets the value of this option\n\t *\n\t * @param value - The value of this option\n\t */\n\tpublic setValue(value: string) {\n\t\tthis.data.value = labelValueDescriptionValidator.parse(value);\n\t\treturn this;\n\t}\n\n\t/**\n\t * Sets the description of this option\n\t *\n\t * @param description - The description of this option\n\t */\n\tpublic setDescription(description: string) {\n\t\tthis.data.description = labelValueDescriptionValidator.parse(description);\n\t\treturn this;\n\t}\n\n\t/**\n\t * Sets whether this option is selected by default\n\t *\n\t * @param isDefault - Whether this option is selected by default\n\t */\n\tpublic setDefault(isDefault = true) {\n\t\tthis.data.default = defaultValidator.parse(isDefault);\n\t\treturn this;\n\t}\n\n\t/**\n\t * Sets the emoji to display on this option\n\t *\n\t * @param emoji - The emoji to display on this option\n\t */\n\tpublic setEmoji(emoji: APIMessageComponentEmoji) {\n\t\tthis.data.emoji = emojiValidator.parse(emoji);\n\t\treturn this;\n\t}\n\n\t/**\n\t * {@inheritDoc JSONEncodable.toJSON}\n\t */\n\tpublic toJSON(): APISelectMenuOption {\n\t\tvalidateRequiredSelectMenuOptionParameters(this.data.label, this.data.value);\n\t\t// eslint-disable-next-line @typescript-eslint/consistent-type-assertions\n\t\treturn {\n\t\t\t...this.data,\n\t\t} as APISelectMenuOption;\n\t}\n}\n"],"names":["labelValueDescriptionValidator","defaultValidator","emojiValidator","validateRequiredSelectMenuOptionParameters"],"mappings":";;;;;;AAMO,MAAM,uBAAuB,CAAC;AACrC,EAAE,WAAW,CAAC,IAAI,GAAG,EAAE,EAAE;AACzB,IAAI,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;AACrB,GAAG;AACH,EAAE,QAAQ,CAAC,KAAK,EAAE;AAClB,IAAI,IAAI,CAAC,IAAI,CAAC,KAAK,GAAGA,yCAA8B,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;AAClE,IAAI,OAAO,IAAI,CAAC;AAChB,GAAG;AACH,EAAE,QAAQ,CAAC,KAAK,EAAE;AAClB,IAAI,IAAI,CAAC,IAAI,CAAC,KAAK,GAAGA,yCAA8B,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;AAClE,IAAI,OAAO,IAAI,CAAC;AAChB,GAAG;AACH,EAAE,cAAc,CAAC,WAAW,EAAE;AAC9B,IAAI,IAAI,CAAC,IAAI,CAAC,WAAW,GAAGA,yCAA8B,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC;AAC9E,IAAI,OAAO,IAAI,CAAC;AAChB,GAAG;AACH,EAAE,UAAU,CAAC,SAAS,GAAG,IAAI,EAAE;AAC/B,IAAI,IAAI,CAAC,IAAI,CAAC,OAAO,GAAGC,2BAAgB,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC;AAC1D,IAAI,OAAO,IAAI,CAAC;AAChB,GAAG;AACH,EAAE,QAAQ,CAAC,KAAK,EAAE;AAClB,IAAI,IAAI,CAAC,IAAI,CAAC,KAAK,GAAGC,yBAAc,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;AAClD,IAAI,OAAO,IAAI,CAAC;AAChB,GAAG;AACH,EAAE,MAAM,GAAG;AACX,IAAIC,qDAA0C,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;AACjF,IAAI,OAAO;AACX,MAAM,GAAG,IAAI,CAAC,IAAI;AAClB,KAAK,CAAC;AACN,GAAG;AACH;;;;"}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import type { APIMessageComponentEmoji, APISelectMenuOption } from 'discord-api-types/v10';
|
|
2
|
+
import type { JSONEncodable } from '../../util/jsonEncodable';
|
|
2
3
|
/**
|
|
3
4
|
* Represents a option within a select menu component
|
|
4
5
|
*/
|
|
5
|
-
export declare class SelectMenuOptionBuilder {
|
|
6
|
+
export declare class SelectMenuOptionBuilder implements JSONEncodable<APISelectMenuOption> {
|
|
6
7
|
data: Partial<APISelectMenuOption>;
|
|
7
8
|
constructor(data?: Partial<APISelectMenuOption>);
|
|
8
9
|
/**
|
|
@@ -35,6 +36,9 @@ export declare class SelectMenuOptionBuilder {
|
|
|
35
36
|
* @param emoji - The emoji to display on this option
|
|
36
37
|
*/
|
|
37
38
|
setEmoji(emoji: APIMessageComponentEmoji): this;
|
|
39
|
+
/**
|
|
40
|
+
* {@inheritDoc JSONEncodable.toJSON}
|
|
41
|
+
*/
|
|
38
42
|
toJSON(): APISelectMenuOption;
|
|
39
43
|
}
|
|
40
44
|
//# sourceMappingURL=SelectMenuOption.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SelectMenuOption.d.ts","sourceRoot":"","sources":["../../../src/components/selectMenu/SelectMenuOption.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,wBAAwB,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"SelectMenuOption.d.ts","sourceRoot":"","sources":["../../../src/components/selectMenu/SelectMenuOption.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,wBAAwB,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC3F,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAS9D;;GAEG;AACH,qBAAa,uBAAwB,YAAW,aAAa,CAAC,mBAAmB,CAAC;IACvD,IAAI,EAAE,OAAO,CAAC,mBAAmB,CAAC;gBAAlC,IAAI,GAAE,OAAO,CAAC,mBAAmB,CAAM;IAEjE;;;;OAIG;IACI,QAAQ,CAAC,KAAK,EAAE,MAAM;IAK7B;;;;OAIG;IACI,QAAQ,CAAC,KAAK,EAAE,MAAM;IAK7B;;;;OAIG;IACI,cAAc,CAAC,WAAW,EAAE,MAAM;IAKzC;;;;OAIG;IACI,UAAU,CAAC,SAAS,UAAO;IAKlC;;;;OAIG;IACI,QAAQ,CAAC,KAAK,EAAE,wBAAwB;IAK/C;;OAEG;IACI,MAAM,IAAI,mBAAmB;CAOpC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SelectMenuOption.mjs","sources":["../../../src/components/selectMenu/SelectMenuOption.ts"],"sourcesContent":["import type { APIMessageComponentEmoji, APISelectMenuOption } from 'discord-api-types/v10';\n\nimport {\n\tdefaultValidator,\n\temojiValidator,\n\tlabelValueDescriptionValidator,\n\tvalidateRequiredSelectMenuOptionParameters,\n} from '../Assertions';\n\n/**\n * Represents a option within a select menu component\n */\nexport class SelectMenuOptionBuilder {\n\tpublic constructor(public data: Partial<APISelectMenuOption> = {}) {}\n\n\t/**\n\t * Sets the label of this option\n\t *\n\t * @param label - The label to show on this option\n\t */\n\tpublic setLabel(label: string) {\n\t\tthis.data.label = labelValueDescriptionValidator.parse(label);\n\t\treturn this;\n\t}\n\n\t/**\n\t * Sets the value of this option\n\t *\n\t * @param value - The value of this option\n\t */\n\tpublic setValue(value: string) {\n\t\tthis.data.value = labelValueDescriptionValidator.parse(value);\n\t\treturn this;\n\t}\n\n\t/**\n\t * Sets the description of this option\n\t *\n\t * @param description - The description of this option\n\t */\n\tpublic setDescription(description: string) {\n\t\tthis.data.description = labelValueDescriptionValidator.parse(description);\n\t\treturn this;\n\t}\n\n\t/**\n\t * Sets whether this option is selected by default\n\t *\n\t * @param isDefault - Whether this option is selected by default\n\t */\n\tpublic setDefault(isDefault = true) {\n\t\tthis.data.default = defaultValidator.parse(isDefault);\n\t\treturn this;\n\t}\n\n\t/**\n\t * Sets the emoji to display on this option\n\t *\n\t * @param emoji - The emoji to display on this option\n\t */\n\tpublic setEmoji(emoji: APIMessageComponentEmoji) {\n\t\tthis.data.emoji = emojiValidator.parse(emoji);\n\t\treturn this;\n\t}\n\n\tpublic toJSON(): APISelectMenuOption {\n\t\tvalidateRequiredSelectMenuOptionParameters(this.data.label, this.data.value);\n\t\t// eslint-disable-next-line @typescript-eslint/consistent-type-assertions\n\t\treturn {\n\t\t\t...this.data,\n\t\t} as APISelectMenuOption;\n\t}\n}\n"],"names":[],"mappings":";;AAMO,MAAM,uBAAuB,CAAC;AACrC,EAAE,WAAW,CAAC,IAAI,GAAG,EAAE,EAAE;AACzB,IAAI,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;AACrB,GAAG;AACH,EAAE,QAAQ,CAAC,KAAK,EAAE;AAClB,IAAI,IAAI,CAAC,IAAI,CAAC,KAAK,GAAG,8BAA8B,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;AAClE,IAAI,OAAO,IAAI,CAAC;AAChB,GAAG;AACH,EAAE,QAAQ,CAAC,KAAK,EAAE;AAClB,IAAI,IAAI,CAAC,IAAI,CAAC,KAAK,GAAG,8BAA8B,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;AAClE,IAAI,OAAO,IAAI,CAAC;AAChB,GAAG;AACH,EAAE,cAAc,CAAC,WAAW,EAAE;AAC9B,IAAI,IAAI,CAAC,IAAI,CAAC,WAAW,GAAG,8BAA8B,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC;AAC9E,IAAI,OAAO,IAAI,CAAC;AAChB,GAAG;AACH,EAAE,UAAU,CAAC,SAAS,GAAG,IAAI,EAAE;AAC/B,IAAI,IAAI,CAAC,IAAI,CAAC,OAAO,GAAG,gBAAgB,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC;AAC1D,IAAI,OAAO,IAAI,CAAC;AAChB,GAAG;AACH,EAAE,QAAQ,CAAC,KAAK,EAAE;AAClB,IAAI,IAAI,CAAC,IAAI,CAAC,KAAK,GAAG,cAAc,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;AAClD,IAAI,OAAO,IAAI,CAAC;AAChB,GAAG;AACH,EAAE,MAAM,GAAG;AACX,IAAI,0CAA0C,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;AACjF,IAAI,OAAO;AACX,MAAM,GAAG,IAAI,CAAC,IAAI;AAClB,KAAK,CAAC;AACN,GAAG;AACH;;;;"}
|
|
1
|
+
{"version":3,"file":"SelectMenuOption.mjs","sources":["../../../src/components/selectMenu/SelectMenuOption.ts"],"sourcesContent":["import type { APIMessageComponentEmoji, APISelectMenuOption } from 'discord-api-types/v10';\nimport type { JSONEncodable } from '../../util/jsonEncodable';\n\nimport {\n\tdefaultValidator,\n\temojiValidator,\n\tlabelValueDescriptionValidator,\n\tvalidateRequiredSelectMenuOptionParameters,\n} from '../Assertions';\n\n/**\n * Represents a option within a select menu component\n */\nexport class SelectMenuOptionBuilder implements JSONEncodable<APISelectMenuOption> {\n\tpublic constructor(public data: Partial<APISelectMenuOption> = {}) {}\n\n\t/**\n\t * Sets the label of this option\n\t *\n\t * @param label - The label to show on this option\n\t */\n\tpublic setLabel(label: string) {\n\t\tthis.data.label = labelValueDescriptionValidator.parse(label);\n\t\treturn this;\n\t}\n\n\t/**\n\t * Sets the value of this option\n\t *\n\t * @param value - The value of this option\n\t */\n\tpublic setValue(value: string) {\n\t\tthis.data.value = labelValueDescriptionValidator.parse(value);\n\t\treturn this;\n\t}\n\n\t/**\n\t * Sets the description of this option\n\t *\n\t * @param description - The description of this option\n\t */\n\tpublic setDescription(description: string) {\n\t\tthis.data.description = labelValueDescriptionValidator.parse(description);\n\t\treturn this;\n\t}\n\n\t/**\n\t * Sets whether this option is selected by default\n\t *\n\t * @param isDefault - Whether this option is selected by default\n\t */\n\tpublic setDefault(isDefault = true) {\n\t\tthis.data.default = defaultValidator.parse(isDefault);\n\t\treturn this;\n\t}\n\n\t/**\n\t * Sets the emoji to display on this option\n\t *\n\t * @param emoji - The emoji to display on this option\n\t */\n\tpublic setEmoji(emoji: APIMessageComponentEmoji) {\n\t\tthis.data.emoji = emojiValidator.parse(emoji);\n\t\treturn this;\n\t}\n\n\t/**\n\t * {@inheritDoc JSONEncodable.toJSON}\n\t */\n\tpublic toJSON(): APISelectMenuOption {\n\t\tvalidateRequiredSelectMenuOptionParameters(this.data.label, this.data.value);\n\t\t// eslint-disable-next-line @typescript-eslint/consistent-type-assertions\n\t\treturn {\n\t\t\t...this.data,\n\t\t} as APISelectMenuOption;\n\t}\n}\n"],"names":[],"mappings":";;AAMO,MAAM,uBAAuB,CAAC;AACrC,EAAE,WAAW,CAAC,IAAI,GAAG,EAAE,EAAE;AACzB,IAAI,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;AACrB,GAAG;AACH,EAAE,QAAQ,CAAC,KAAK,EAAE;AAClB,IAAI,IAAI,CAAC,IAAI,CAAC,KAAK,GAAG,8BAA8B,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;AAClE,IAAI,OAAO,IAAI,CAAC;AAChB,GAAG;AACH,EAAE,QAAQ,CAAC,KAAK,EAAE;AAClB,IAAI,IAAI,CAAC,IAAI,CAAC,KAAK,GAAG,8BAA8B,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;AAClE,IAAI,OAAO,IAAI,CAAC;AAChB,GAAG;AACH,EAAE,cAAc,CAAC,WAAW,EAAE;AAC9B,IAAI,IAAI,CAAC,IAAI,CAAC,WAAW,GAAG,8BAA8B,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC;AAC9E,IAAI,OAAO,IAAI,CAAC;AAChB,GAAG;AACH,EAAE,UAAU,CAAC,SAAS,GAAG,IAAI,EAAE;AAC/B,IAAI,IAAI,CAAC,IAAI,CAAC,OAAO,GAAG,gBAAgB,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC;AAC1D,IAAI,OAAO,IAAI,CAAC;AAChB,GAAG;AACH,EAAE,QAAQ,CAAC,KAAK,EAAE;AAClB,IAAI,IAAI,CAAC,IAAI,CAAC,KAAK,GAAG,cAAc,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;AAClD,IAAI,OAAO,IAAI,CAAC;AAChB,GAAG;AACH,EAAE,MAAM,GAAG;AACX,IAAI,0CAA0C,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;AACjF,IAAI,OAAO;AACX,MAAM,GAAG,IAAI,CAAC,IAAI;AAClB,KAAK,CAAC;AACN,GAAG;AACH;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TextInput.cjs","sources":["../../../src/components/textInput/TextInput.ts"],"sourcesContent":["import { ComponentType, type TextInputStyle, type APITextInputComponent } from 'discord-api-types/v10';\nimport isEqual from 'fast-deep-equal';\nimport {\n\tmaxLengthValidator,\n\tminLengthValidator,\n\tplaceholderValidator,\n\trequiredValidator,\n\tvalueValidator,\n\tvalidateRequiredParameters,\n\tlabelValidator,\n\ttextInputStyleValidator,\n} from './Assertions';\nimport { isJSONEncodable, type JSONEncodable } from '../../util/jsonEncodable';\nimport { customIdValidator } from '../Assertions';\nimport { ComponentBuilder } from '../Component';\n\nexport class TextInputBuilder
|
|
1
|
+
{"version":3,"file":"TextInput.cjs","sources":["../../../src/components/textInput/TextInput.ts"],"sourcesContent":["import { ComponentType, type TextInputStyle, type APITextInputComponent } from 'discord-api-types/v10';\nimport isEqual from 'fast-deep-equal';\nimport {\n\tmaxLengthValidator,\n\tminLengthValidator,\n\tplaceholderValidator,\n\trequiredValidator,\n\tvalueValidator,\n\tvalidateRequiredParameters,\n\tlabelValidator,\n\ttextInputStyleValidator,\n} from './Assertions';\nimport type { Equatable } from '../../util/equatable';\nimport { isJSONEncodable, type JSONEncodable } from '../../util/jsonEncodable';\nimport { customIdValidator } from '../Assertions';\nimport { ComponentBuilder } from '../Component';\n\nexport class TextInputBuilder\n\textends ComponentBuilder<APITextInputComponent>\n\timplements Equatable<JSONEncodable<APITextInputComponent> | APITextInputComponent>\n{\n\tpublic constructor(data?: APITextInputComponent & { type?: ComponentType.TextInput }) {\n\t\tsuper({ type: ComponentType.TextInput, ...data });\n\t}\n\n\t/**\n\t * Sets the custom id for this text input\n\t *\n\t * @param customId - The custom id of this text input\n\t */\n\tpublic setCustomId(customId: string) {\n\t\tthis.data.custom_id = customIdValidator.parse(customId);\n\t\treturn this;\n\t}\n\n\t/**\n\t * Sets the label for this text input\n\t *\n\t * @param label - The label for this text input\n\t */\n\tpublic setLabel(label: string) {\n\t\tthis.data.label = labelValidator.parse(label);\n\t\treturn this;\n\t}\n\n\t/**\n\t * Sets the style for this text input\n\t *\n\t * @param style - The style for this text input\n\t */\n\tpublic setStyle(style: TextInputStyle) {\n\t\tthis.data.style = textInputStyleValidator.parse(style);\n\t\treturn this;\n\t}\n\n\t/**\n\t * Sets the minimum length of text for this text input\n\t *\n\t * @param minLength - The minimum length of text for this text input\n\t */\n\tpublic setMinLength(minLength: number) {\n\t\tthis.data.min_length = minLengthValidator.parse(minLength);\n\t\treturn this;\n\t}\n\n\t/**\n\t * Sets the maximum length of text for this text input\n\t *\n\t * @param maxLength - The maximum length of text for this text input\n\t */\n\tpublic setMaxLength(maxLength: number) {\n\t\tthis.data.max_length = maxLengthValidator.parse(maxLength);\n\t\treturn this;\n\t}\n\n\t/**\n\t * Sets the placeholder of this text input\n\t *\n\t * @param placeholder - The placeholder of this text input\n\t */\n\tpublic setPlaceholder(placeholder: string) {\n\t\tthis.data.placeholder = placeholderValidator.parse(placeholder);\n\t\treturn this;\n\t}\n\n\t/**\n\t * Sets the value of this text input\n\t *\n\t * @param value - The value for this text input\n\t */\n\tpublic setValue(value: string) {\n\t\tthis.data.value = valueValidator.parse(value);\n\t\treturn this;\n\t}\n\n\t/**\n\t * Sets whether this text input is required\n\t *\n\t * @param required - Whether this text input is required\n\t */\n\tpublic setRequired(required = true) {\n\t\tthis.data.required = requiredValidator.parse(required);\n\t\treturn this;\n\t}\n\n\t/**\n\t * {@inheritDoc JSONEncodable.toJSON}\n\t */\n\tpublic toJSON(): APITextInputComponent {\n\t\tvalidateRequiredParameters(this.data.custom_id, this.data.style, this.data.label);\n\t\t// eslint-disable-next-line @typescript-eslint/consistent-type-assertions\n\t\treturn {\n\t\t\t...this.data,\n\t\t} as APITextInputComponent;\n\t}\n\n\t/**\n\t * {@inheritDoc Equatable.equals}\n\t */\n\tpublic equals(other: JSONEncodable<APITextInputComponent> | APITextInputComponent): boolean {\n\t\tif (isJSONEncodable(other)) {\n\t\t\treturn isEqual(other.toJSON(), this.data);\n\t\t}\n\n\t\treturn isEqual(other, this.data);\n\t}\n}\n"],"names":["ComponentBuilder","ComponentType","customIdValidator","labelValidator","textInputStyleValidator","minLengthValidator","maxLengthValidator","placeholderValidator","valueValidator","requiredValidator","validateRequiredParameters","isJSONEncodable","isEqual"],"mappings":";;;;;;;;;;;;;;;AAeO,MAAM,gBAAgB,SAASA,0BAAgB,CAAC;AACvD,EAAE,WAAW,CAAC,IAAI,EAAE;AACpB,IAAI,KAAK,CAAC,EAAE,IAAI,EAAEC,iBAAa,CAAC,SAAS,EAAE,GAAG,IAAI,EAAE,CAAC,CAAC;AACtD,GAAG;AACH,EAAE,WAAW,CAAC,QAAQ,EAAE;AACxB,IAAI,IAAI,CAAC,IAAI,CAAC,SAAS,GAAGC,4BAAiB,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;AAC5D,IAAI,OAAO,I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;AAChB,GAAG;AACH,EAAE,MAAM,GAAG;AACX,IAAIC,uCAA0B,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,IAAI,CAAC,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;AACtF,IAAI,OAAO;AACX,MAAM,GAAG,IAAI,CAAC,IAAI;AAClB,KAAK,CAAC;AACN,GAAG;AACH,EAAE,MAAM,CAAC,KAAK,EAAE;AAChB,IAAI,IAAIC,6BAAe,CAAC,KAAK,CAAC,EAAE;AAChC,MAAM,OAAOC,gBAAO,CAAC,KAAK,CAAC,MAAM,EAAE,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC;AAChD,KAAK;AACL,IAAI,OAAOA,gBAAO,CAAC,KAAK,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC;AACrC,GAAG;AACH;;;;"}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { ComponentType, type TextInputStyle, type APITextInputComponent } from 'discord-api-types/v10';
|
|
2
|
+
import type { Equatable } from '../../util/equatable';
|
|
2
3
|
import { type JSONEncodable } from '../../util/jsonEncodable';
|
|
3
4
|
import { ComponentBuilder } from '../Component';
|
|
4
|
-
export declare class TextInputBuilder extends ComponentBuilder<APITextInputComponent> {
|
|
5
|
+
export declare class TextInputBuilder extends ComponentBuilder<APITextInputComponent> implements Equatable<JSONEncodable<APITextInputComponent> | APITextInputComponent> {
|
|
5
6
|
constructor(data?: APITextInputComponent & {
|
|
6
7
|
type?: ComponentType.TextInput;
|
|
7
8
|
});
|
|
@@ -53,7 +54,13 @@ export declare class TextInputBuilder extends ComponentBuilder<APITextInputCompo
|
|
|
53
54
|
* @param required - Whether this text input is required
|
|
54
55
|
*/
|
|
55
56
|
setRequired(required?: boolean): this;
|
|
57
|
+
/**
|
|
58
|
+
* {@inheritDoc JSONEncodable.toJSON}
|
|
59
|
+
*/
|
|
56
60
|
toJSON(): APITextInputComponent;
|
|
61
|
+
/**
|
|
62
|
+
* {@inheritDoc Equatable.equals}
|
|
63
|
+
*/
|
|
57
64
|
equals(other: JSONEncodable<APITextInputComponent> | APITextInputComponent): boolean;
|
|
58
65
|
}
|
|
59
66
|
//# sourceMappingURL=TextInput.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TextInput.d.ts","sourceRoot":"","sources":["../../../src/components/textInput/TextInput.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,KAAK,cAAc,EAAE,KAAK,qBAAqB,EAAE,MAAM,uBAAuB,CAAC;AAYvG,OAAO,EAAmB,KAAK,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAE/E,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAEhD,qBAAa,
|
|
1
|
+
{"version":3,"file":"TextInput.d.ts","sourceRoot":"","sources":["../../../src/components/textInput/TextInput.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,KAAK,cAAc,EAAE,KAAK,qBAAqB,EAAE,MAAM,uBAAuB,CAAC;AAYvG,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAmB,KAAK,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAE/E,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAEhD,qBAAa,gBACZ,SAAQ,gBAAgB,CAAC,qBAAqB,CAC9C,YAAW,SAAS,CAAC,aAAa,CAAC,qBAAqB,CAAC,GAAG,qBAAqB,CAAC;gBAE/D,IAAI,CAAC,EAAE,qBAAqB,GAAG;QAAE,IAAI,CAAC,EAAE,aAAa,CAAC,SAAS,CAAA;KAAE;IAIpF;;;;OAIG;IACI,WAAW,CAAC,QAAQ,EAAE,MAAM;IAKnC;;;;OAIG;IACI,QAAQ,CAAC,KAAK,EAAE,MAAM;IAK7B;;;;OAIG;IACI,QAAQ,CAAC,KAAK,EAAE,cAAc;IAKrC;;;;OAIG;IACI,YAAY,CAAC,SAAS,EAAE,MAAM;IAKrC;;;;OAIG;IACI,YAAY,CAAC,SAAS,EAAE,MAAM;IAKrC;;;;OAIG;IACI,cAAc,CAAC,WAAW,EAAE,MAAM;IAKzC;;;;OAIG;IACI,QAAQ,CAAC,KAAK,EAAE,MAAM;IAK7B;;;;OAIG;IACI,WAAW,CAAC,QAAQ,UAAO;IAKlC;;OAEG;IACI,MAAM,IAAI,qBAAqB;IAQtC;;OAEG;IACI,MAAM,CAAC,KAAK,EAAE,aAAa,CAAC,qBAAqB,CAAC,GAAG,qBAAqB,GAAG,OAAO;CAO3F"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TextInput.mjs","sources":["../../../src/components/textInput/TextInput.ts"],"sourcesContent":["import { ComponentType, type TextInputStyle, type APITextInputComponent } from 'discord-api-types/v10';\nimport isEqual from 'fast-deep-equal';\nimport {\n\tmaxLengthValidator,\n\tminLengthValidator,\n\tplaceholderValidator,\n\trequiredValidator,\n\tvalueValidator,\n\tvalidateRequiredParameters,\n\tlabelValidator,\n\ttextInputStyleValidator,\n} from './Assertions';\nimport { isJSONEncodable, type JSONEncodable } from '../../util/jsonEncodable';\nimport { customIdValidator } from '../Assertions';\nimport { ComponentBuilder } from '../Component';\n\nexport class TextInputBuilder
|
|
1
|
+
{"version":3,"file":"TextInput.mjs","sources":["../../../src/components/textInput/TextInput.ts"],"sourcesContent":["import { ComponentType, type TextInputStyle, type APITextInputComponent } from 'discord-api-types/v10';\nimport isEqual from 'fast-deep-equal';\nimport {\n\tmaxLengthValidator,\n\tminLengthValidator,\n\tplaceholderValidator,\n\trequiredValidator,\n\tvalueValidator,\n\tvalidateRequiredParameters,\n\tlabelValidator,\n\ttextInputStyleValidator,\n} from './Assertions';\nimport type { Equatable } from '../../util/equatable';\nimport { isJSONEncodable, type JSONEncodable } from '../../util/jsonEncodable';\nimport { customIdValidator } from '../Assertions';\nimport { ComponentBuilder } from '../Component';\n\nexport class TextInputBuilder\n\textends ComponentBuilder<APITextInputComponent>\n\timplements Equatable<JSONEncodable<APITextInputComponent> | APITextInputComponent>\n{\n\tpublic constructor(data?: APITextInputComponent & { type?: ComponentType.TextInput }) {\n\t\tsuper({ type: ComponentType.TextInput, ...data });\n\t}\n\n\t/**\n\t * Sets the custom id for this text input\n\t *\n\t * @param customId - The custom id of this text input\n\t */\n\tpublic setCustomId(customId: string) {\n\t\tthis.data.custom_id = customIdValidator.parse(customId);\n\t\treturn this;\n\t}\n\n\t/**\n\t * Sets the label for this text input\n\t *\n\t * @param label - The label for this text input\n\t */\n\tpublic setLabel(label: string) {\n\t\tthis.data.label = labelValidator.parse(label);\n\t\treturn this;\n\t}\n\n\t/**\n\t * Sets the style for this text input\n\t *\n\t * @param style - The style for this text input\n\t */\n\tpublic setStyle(style: TextInputStyle) {\n\t\tthis.data.style = textInputStyleValidator.parse(style);\n\t\treturn this;\n\t}\n\n\t/**\n\t * Sets the minimum length of text for this text input\n\t *\n\t * @param minLength - The minimum length of text for this text input\n\t */\n\tpublic setMinLength(minLength: number) {\n\t\tthis.data.min_length = minLengthValidator.parse(minLength);\n\t\treturn this;\n\t}\n\n\t/**\n\t * Sets the maximum length of text for this text input\n\t *\n\t * @param maxLength - The maximum length of text for this text input\n\t */\n\tpublic setMaxLength(maxLength: number) {\n\t\tthis.data.max_length = maxLengthValidator.parse(maxLength);\n\t\treturn this;\n\t}\n\n\t/**\n\t * Sets the placeholder of this text input\n\t *\n\t * @param placeholder - The placeholder of this text input\n\t */\n\tpublic setPlaceholder(placeholder: string) {\n\t\tthis.data.placeholder = placeholderValidator.parse(placeholder);\n\t\treturn this;\n\t}\n\n\t/**\n\t * Sets the value of this text input\n\t *\n\t * @param value - The value for this text input\n\t */\n\tpublic setValue(value: string) {\n\t\tthis.data.value = valueValidator.parse(value);\n\t\treturn this;\n\t}\n\n\t/**\n\t * Sets whether this text input is required\n\t *\n\t * @param required - Whether this text input is required\n\t */\n\tpublic setRequired(required = true) {\n\t\tthis.data.required = requiredValidator.parse(required);\n\t\treturn this;\n\t}\n\n\t/**\n\t * {@inheritDoc JSONEncodable.toJSON}\n\t */\n\tpublic toJSON(): APITextInputComponent {\n\t\tvalidateRequiredParameters(this.data.custom_id, this.data.style, this.data.label);\n\t\t// eslint-disable-next-line @typescript-eslint/consistent-type-assertions\n\t\treturn {\n\t\t\t...this.data,\n\t\t} as APITextInputComponent;\n\t}\n\n\t/**\n\t * {@inheritDoc Equatable.equals}\n\t */\n\tpublic equals(other: JSONEncodable<APITextInputComponent> | APITextInputComponent): boolean {\n\t\tif (isJSONEncodable(other)) {\n\t\t\treturn isEqual(other.toJSON(), this.data);\n\t\t}\n\n\t\treturn isEqual(other, this.data);\n\t}\n}\n"],"names":[],"mappings":";;;;;;;AAeO,MAAM,gBAAgB,SAAS,gBAAgB,CAAC;AACvD,EAAE,WAAW,CAAC,IAAI,EAAE;AACpB,IAAI,KAAK,CAAC,EAAE,IAAI,EAAE,aAAa,CAAC,SAAS,EAAE,GAAG,IAAI,EAAE,CAAC,CAAC;AACtD,GAAG;AACH,EAAE,WAAW,CAAC,QAAQ,EAAE;AACxB,IAAI,IAAI,CAAC,IAAI,CAAC,SAAS,GAAG,iBAAiB,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;AAC5D,IAAI,OAAO,IAAI,CAAC;AAChB,GAAG;AACH,EAAE,QAAQ,CAAC,KAAK,EAAE;AAClB,IAAI,IAAI,CAAC,IAAI,CAAC,KAAK,GAAG,cAAc,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;AAClD,IAAI,OAAO,IAAI,CAAC;AAChB,GAAG;AACH,EAAE,QAAQ,CAAC,KAAK,EAAE;AAClB,IAAI,IAAI,CAAC,IAAI,CAAC,KAAK,GAAG,uBAAuB,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;AAC3D,IAAI,OAAO,IAAI,CAAC;AAChB,GAAG;AACH,EAAE,YAAY,CAAC,SAAS,EAAE;AAC1B,IAAI,IAAI,CAAC,IAAI,CAAC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L,IAAI,OAAO,OAAO,CAAC,KAAK,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC;AACrC,GAAG;AACH;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SlashCommandBuilder.cjs","sources":["../../../src/interactions/slashCommands/SlashCommandBuilder.ts"],"sourcesContent":["import type {\n\tAPIApplicationCommandOption,\n\tLocalizationMap,\n\tPermissions,\n\tRESTPostAPIApplicationCommandsJSONBody,\n} from 'discord-api-types/v10';\nimport { mix } from 'ts-mixer';\nimport {\n\tassertReturnOfBuilder,\n\tvalidateDefaultMemberPermissions,\n\tvalidateDefaultPermission,\n\tvalidateLocalizationMap,\n\tvalidateDMPermission,\n\tvalidateMaxOptionsLength,\n\tvalidateRequiredParameters,\n} from './Assertions';\nimport { SlashCommandSubcommandBuilder, SlashCommandSubcommandGroupBuilder } from './SlashCommandSubcommands';\nimport { SharedNameAndDescription } from './mixins/NameAndDescription';\nimport { SharedSlashCommandOptions } from './mixins/SharedSlashCommandOptions';\n\n@mix(SharedSlashCommandOptions, SharedNameAndDescription)\nexport class SlashCommandBuilder {\n\t/**\n\t * The name of this slash command\n\t */\n\tpublic readonly name: string = undefined!;\n\n\t/**\n\t * The localized names for this command\n\t */\n\tpublic readonly name_localizations?: LocalizationMap;\n\n\t/**\n\t * The description of this slash command\n\t */\n\tpublic readonly description: string = undefined!;\n\n\t/**\n\t * The localized descriptions for this command\n\t */\n\tpublic readonly description_localizations?: LocalizationMap;\n\n\t/**\n\t * The options of this slash command\n\t */\n\tpublic readonly options: ToAPIApplicationCommandOptions[] = [];\n\n\t/**\n\t * Whether the command is enabled by default when the app is added to a guild\n\t *\n\t * @deprecated This property is deprecated and will be removed in the future.\n\t * You should use `setDefaultMemberPermissions` or `setDMPermission` instead.\n\t */\n\tpublic readonly default_permission: boolean | undefined = undefined;\n\n\t/**\n\t * Set of permissions represented as a bit set for the command\n\t */\n\tpublic readonly default_member_permissions: Permissions | null | undefined = undefined;\n\n\t/**\n\t * Indicates whether the command is available in DMs with the application, only for globally-scoped commands.\n\t * By default, commands are visible.\n\t */\n\tpublic readonly dm_permission: boolean | undefined = undefined;\n\n\t/**\n\t * Returns the final data that should be sent to Discord.\n\t *\n\t * **Note:** Calling this function will validate required properties based on their conditions.\n\t */\n\tpublic toJSON(): RESTPostAPIApplicationCommandsJSONBody {\n\t\tvalidateRequiredParameters(this.name, this.description, this.options);\n\n\t\tvalidateLocalizationMap(this.name_localizations);\n\t\tvalidateLocalizationMap(this.description_localizations);\n\n\t\treturn {\n\t\t\t...this,\n\t\t\toptions: this.options.map((option) => option.toJSON()),\n\t\t};\n\t}\n\n\t/**\n\t * Sets whether the command is enabled by default when the application is added to a guild.\n\t *\n\t * **Note**: If set to `false`, you will have to later `PUT` the permissions for this command.\n\t *\n\t * @param value - Whether or not to enable this command by default\n\t *\n\t * @see https://discord.com/developers/docs/interactions/application-commands#permissions\n\t * @deprecated Use `setDefaultMemberPermissions` or `setDMPermission` instead.\n\t */\n\tpublic setDefaultPermission(value: boolean) {\n\t\t// Assert the value matches the conditions\n\t\tvalidateDefaultPermission(value);\n\n\t\tReflect.set(this, 'default_permission', value);\n\n\t\treturn this;\n\t}\n\n\t/**\n\t * Sets the default permissions a member should have in order to run the command.\n\t *\n\t * **Note:** You can set this to `'0'` to disable the command by default.\n\t *\n\t * @param permissions - The permissions bit field to set\n\t *\n\t * @see https://discord.com/developers/docs/interactions/application-commands#permissions\n\t */\n\tpublic setDefaultMemberPermissions(permissions: Permissions | bigint | number | null | undefined) {\n\t\t// Assert the value and parse it\n\t\tconst permissionValue = validateDefaultMemberPermissions(permissions);\n\n\t\tReflect.set(this, 'default_member_permissions', permissionValue);\n\n\t\treturn this;\n\t}\n\n\t/**\n\t * Sets if the command is available in DMs with the application, only for globally-scoped commands.\n\t * By default, commands are visible.\n\t *\n\t * @param enabled - If the command should be enabled in DMs\n\t *\n\t * @see https://discord.com/developers/docs/interactions/application-commands#permissions\n\t */\n\tpublic setDMPermission(enabled: boolean | null | undefined) {\n\t\t// Assert the value matches the conditions\n\t\tvalidateDMPermission(enabled);\n\n\t\tReflect.set(this, 'dm_permission', enabled);\n\n\t\treturn this;\n\t}\n\n\t/**\n\t * Adds a new subcommand group to this command\n\t *\n\t * @param input - A function that returns a subcommand group builder, or an already built builder\n\t */\n\tpublic addSubcommandGroup(\n\t\tinput:\n\t\t\t| SlashCommandSubcommandGroupBuilder\n\t\t\t| ((subcommandGroup: SlashCommandSubcommandGroupBuilder) => SlashCommandSubcommandGroupBuilder),\n\t): SlashCommandSubcommandsOnlyBuilder {\n\t\tconst { options } = this;\n\n\t\t// First, assert options conditions - we cannot have more than 25 options\n\t\tvalidateMaxOptionsLength(options);\n\n\t\t// Get the final result\n\t\tconst result = typeof input === 'function' ? input(new SlashCommandSubcommandGroupBuilder()) : input;\n\n\t\tassertReturnOfBuilder(result, SlashCommandSubcommandGroupBuilder);\n\n\t\t// Push it\n\t\toptions.push(result);\n\n\t\treturn this;\n\t}\n\n\t/**\n\t * Adds a new subcommand to this command\n\t *\n\t * @param input - A function that returns a subcommand builder, or an already built builder\n\t */\n\tpublic addSubcommand(\n\t\tinput:\n\t\t\t| SlashCommandSubcommandBuilder\n\t\t\t| ((subcommandGroup: SlashCommandSubcommandBuilder) => SlashCommandSubcommandBuilder),\n\t): SlashCommandSubcommandsOnlyBuilder {\n\t\tconst { options } = this;\n\n\t\t// First, assert options conditions - we cannot have more than 25 options\n\t\tvalidateMaxOptionsLength(options);\n\n\t\t// Get the final result\n\t\tconst result = typeof input === 'function' ? input(new SlashCommandSubcommandBuilder()) : input;\n\n\t\tassertReturnOfBuilder(result, SlashCommandSubcommandBuilder);\n\n\t\t// Push it\n\t\toptions.push(result);\n\n\t\treturn this;\n\t}\n}\n\nexport interface SlashCommandBuilder extends SharedNameAndDescription, SharedSlashCommandOptions {}\n\nexport interface SlashCommandSubcommandsOnlyBuilder\n\textends SharedNameAndDescription,\n\t\tPick<SlashCommandBuilder, 'toJSON' | 'addSubcommand' | 'addSubcommandGroup'> {}\n\nexport interface SlashCommandOptionsOnlyBuilder\n\textends SharedNameAndDescription,\n\t\tSharedSlashCommandOptions,\n\t\tPick<SlashCommandBuilder, 'toJSON'> {}\n\nexport interface ToAPIApplicationCommandOptions {\n\ttoJSON: () => APIApplicationCommandOption;\n}\n"],"names":["SlashCommandBuilder","validateRequiredParameters","validateLocalizationMap","validateDefaultPermission","validateDefaultMemberPermissions","validateDMPermission","validateMaxOptionsLength","SlashCommandSubcommandGroupBuilder","assertReturnOfBuilder","SlashCommandSubcommandBuilder","mix","SharedSlashCommandOptions","SharedNameAndDescription"],"mappings":";;;;;;;;;;AAAA,IAAI,SAAS,GAAG,MAAM,CAAC,cAAc,CAAC;AACtC,IAAI,gBAAgB,GAAG,MAAM,CAAC,wBAAwB,CAAC;AACvD,IAAI,eAAe,GAAG,CAAC,UAAU,EAAE,MAAM,EAAE,GAAG,EAAE,IAAI,KAAK;AACzD,EAAE,IAAI,MAAM,GAAG,IAAI,GAAG,CAAC,GAAG,KAAK,CAAC,GAAG,IAAI,GAAG,gBAAgB,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,MAAM,CAAC;AACjF,EAAE,KAAK,IAAI,CAAC,GAAG,UAAU,CAAC,MAAM,GAAG,CAAC,EAAE,SAAS,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE;AAC5D,IAAI,IAAI,SAAS,GAAG,UAAU,CAAC,CAAC,CAAC;AACjC,MAAM,MAAM,GAAG,CAAC,IAAI,GAAG,SAAS,CAAC,MAAM,EAAE,GAAG,EAAE,MAAM,CAAC,GAAG,SAAS,CAAC,MAAM,CAAC,KAAK,MAAM,CAAC;AACrF,EAAE,IAAI,IAAI,IAAI,MAAM;AACpB,IAAI,SAAS,CAAC,MAAM,EAAE,GAAG,EAAE,MAAM,CAAC,CAAC;AACnC,EAAE,OAAO,MAAM,CAAC;AAChB,CAAC,CAAC;AAcSA,2BAAmB,GAAG,MAAM;AACvC,EAAE,WAA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":["import type {\n\tAPIApplicationCommandOption,\n\tLocalizationMap,\n\tPermissions,\n\tRESTPostAPIApplicationCommandsJSONBody,\n} from 'discord-api-types/v10';\nimport { mix } from 'ts-mixer';\nimport {\n\tassertReturnOfBuilder,\n\tvalidateDefaultMemberPermissions,\n\tvalidateDefaultPermission,\n\tvalidateLocalizationMap,\n\tvalidateDMPermission,\n\tvalidateMaxOptionsLength,\n\tvalidateRequiredParameters,\n} from './Assertions';\nimport { SlashCommandSubcommandBuilder, SlashCommandSubcommandGroupBuilder } from './SlashCommandSubcommands';\nimport { SharedNameAndDescription } from './mixins/NameAndDescription';\nimport { SharedSlashCommandOptions } from './mixins/SharedSlashCommandOptions';\n\n@mix(SharedSlashCommandOptions, SharedNameAndDescription)\nexport class SlashCommandBuilder {\n\t/**\n\t * The name of this slash command\n\t */\n\tpublic readonly name: string = undefined!;\n\n\t/**\n\t * The localized names for this command\n\t */\n\tpublic readonly name_localizations?: LocalizationMap;\n\n\t/**\n\t * The description of this slash command\n\t */\n\tpublic readonly description: string = undefined!;\n\n\t/**\n\t * The localized descriptions for this command\n\t */\n\tpublic readonly description_localizations?: LocalizationMap;\n\n\t/**\n\t * The options of this slash command\n\t */\n\tpublic readonly options: ToAPIApplicationCommandOptions[] = [];\n\n\t/**\n\t * Whether the command is enabled by default when the app is added to a guild\n\t *\n\t * @deprecated This property is deprecated and will be removed in the future.\n\t * You should use {@link (SlashCommandBuilder:class).setDefaultMemberPermissions} or {@link (SlashCommandBuilder:class).setDMPermission} instead.\n\t */\n\tpublic readonly default_permission: boolean | undefined = undefined;\n\n\t/**\n\t * Set of permissions represented as a bit set for the command\n\t */\n\tpublic readonly default_member_permissions: Permissions | null | undefined = undefined;\n\n\t/**\n\t * Indicates whether the command is available in DMs with the application, only for globally-scoped commands.\n\t * By default, commands are visible.\n\t */\n\tpublic readonly dm_permission: boolean | undefined = undefined;\n\n\t/**\n\t * Returns the final data that should be sent to Discord.\n\t *\n\t * **Note:** Calling this function will validate required properties based on their conditions.\n\t */\n\tpublic toJSON(): RESTPostAPIApplicationCommandsJSONBody {\n\t\tvalidateRequiredParameters(this.name, this.description, this.options);\n\n\t\tvalidateLocalizationMap(this.name_localizations);\n\t\tvalidateLocalizationMap(this.description_localizations);\n\n\t\treturn {\n\t\t\t...this,\n\t\t\toptions: this.options.map((option) => option.toJSON()),\n\t\t};\n\t}\n\n\t/**\n\t * Sets whether the command is enabled by default when the application is added to a guild.\n\t *\n\t * **Note**: If set to `false`, you will have to later `PUT` the permissions for this command.\n\t *\n\t * @param value - Whether or not to enable this command by default\n\t *\n\t * @see https://discord.com/developers/docs/interactions/application-commands#permissions\n\t * @deprecated Use {@link (SlashCommandBuilder:class).setDefaultMemberPermissions} or {@link (SlashCommandBuilder:class).setDMPermission} instead.\n\t */\n\tpublic setDefaultPermission(value: boolean) {\n\t\t// Assert the value matches the conditions\n\t\tvalidateDefaultPermission(value);\n\n\t\tReflect.set(this, 'default_permission', value);\n\n\t\treturn this;\n\t}\n\n\t/**\n\t * Sets the default permissions a member should have in order to run the command.\n\t *\n\t * **Note:** You can set this to `'0'` to disable the command by default.\n\t *\n\t * @param permissions - The permissions bit field to set\n\t *\n\t * @see https://discord.com/developers/docs/interactions/application-commands#permissions\n\t */\n\tpublic setDefaultMemberPermissions(permissions: Permissions | bigint | number | null | undefined) {\n\t\t// Assert the value and parse it\n\t\tconst permissionValue = validateDefaultMemberPermissions(permissions);\n\n\t\tReflect.set(this, 'default_member_permissions', permissionValue);\n\n\t\treturn this;\n\t}\n\n\t/**\n\t * Sets if the command is available in DMs with the application, only for globally-scoped commands.\n\t * By default, commands are visible.\n\t *\n\t * @param enabled - If the command should be enabled in DMs\n\t *\n\t * @see https://discord.com/developers/docs/interactions/application-commands#permissions\n\t */\n\tpublic setDMPermission(enabled: boolean | null | undefined) {\n\t\t// Assert the value matches the conditions\n\t\tvalidateDMPermission(enabled);\n\n\t\tReflect.set(this, 'dm_permission', enabled);\n\n\t\treturn this;\n\t}\n\n\t/**\n\t * Adds a new subcommand group to this command\n\t *\n\t * @param input - A function that returns a subcommand group builder, or an already built builder\n\t */\n\tpublic addSubcommandGroup(\n\t\tinput:\n\t\t\t| SlashCommandSubcommandGroupBuilder\n\t\t\t| ((subcommandGroup: SlashCommandSubcommandGroupBuilder) => SlashCommandSubcommandGroupBuilder),\n\t): SlashCommandSubcommandsOnlyBuilder {\n\t\tconst { options } = this;\n\n\t\t// First, assert options conditions - we cannot have more than 25 options\n\t\tvalidateMaxOptionsLength(options);\n\n\t\t// Get the final result\n\t\tconst result = typeof input === 'function' ? input(new SlashCommandSubcommandGroupBuilder()) : input;\n\n\t\tassertReturnOfBuilder(result, SlashCommandSubcommandGroupBuilder);\n\n\t\t// Push it\n\t\toptions.push(result);\n\n\t\treturn this;\n\t}\n\n\t/**\n\t * Adds a new subcommand to this command\n\t *\n\t * @param input - A function that returns a subcommand builder, or an already built builder\n\t */\n\tpublic addSubcommand(\n\t\tinput:\n\t\t\t| SlashCommandSubcommandBuilder\n\t\t\t| ((subcommandGroup: SlashCommandSubcommandBuilder) => SlashCommandSubcommandBuilder),\n\t): SlashCommandSubcommandsOnlyBuilder {\n\t\tconst { options } = this;\n\n\t\t// First, assert options conditions - we cannot have more than 25 options\n\t\tvalidateMaxOptionsLength(options);\n\n\t\t// Get the final result\n\t\tconst result = typeof input === 'function' ? input(new SlashCommandSubcommandBuilder()) : input;\n\n\t\tassertReturnOfBuilder(result, SlashCommandSubcommandBuilder);\n\n\t\t// Push it\n\t\toptions.push(result);\n\n\t\treturn this;\n\t}\n}\n\nexport interface SlashCommandBuilder extends SharedNameAndDescription, SharedSlashCommandOptions {}\n\nexport interface SlashCommandSubcommandsOnlyBuilder\n\textends SharedNameAndDescription,\n\t\tPick<SlashCommandBuilder, 'toJSON' | 'addSubcommand' | 'addSubcommandGroup'> {}\n\nexport interface SlashCommandOptionsOnlyBuilder\n\textends SharedNameAndDescription,\n\t\tSharedSlashCommandOptions,\n\t\tPick<SlashCommandBuilder, 'toJSON'> {}\n\nexport interface ToAPIApplicationCommandOptions {\n\ttoJSON: () => APIApplicationCommandOption;\n}\n"],"names":["SlashCommandBuilder","validateRequiredParameters","validateLocalizationMap","validateDefaultPermission","validateDefaultMemberPermissions","validateDMPermission","validateMaxOptionsLength","SlashCommandSubcommandGroupBuilder","assertReturnOfBuilder","SlashCommandSubcommandBuilder","mix","SharedSlashCommandOptions","SharedNameAndDescription"],"mappings":";;;;;;;;;;AAAA,IAAI,SAAS,GAAG,MAAM,CAAC,cAAc,CAAC;AACtC,IAAI,gBAAgB,GAAG,MAAM,CAAC,wBAAwB,CAAC;AACvD,IAAI,eAAe,GAAG,CAAC,UAAU,EAAE,MAAM,EAAE,GAAG,EAAE,IAAI,KAAK;AACzD,EAAE,IAAI,MAAM,GAAG,IAAI,GAAG,CAAC,GAAG,KAAK,CAAC,GAAG,IAAI,GAAG,gBAAgB,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,MAAM,CAAC;AACjF,EAAE,KAAK,IAAI,CAAC,GAAG,UAAU,CAAC,MAAM,GAAG,CAAC,EAAE,SAAS,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE;AAC5D,IAAI,IAAI,SAAS,GAAG,UAAU,CAAC,CAAC,CAAC;AACjC,MAAM,MAAM,GAAG,CAAC,IAAI,GAAG,SAAS,CAAC,MAAM,EAAE,GAAG,EAAE,MAAM,CAAC,GAAG,SAAS,CAAC,MAAM,CAAC,KAAK,MAAM,CAAC;AACrF,EAAE,IAAI,IAAI,IAAI,MAAM;AACpB,IAAI,SAAS,CAAC,MAAM,EAAE,GAAG,EAAE,MAAM,CAAC,CAAC;AACnC,EAAE,OAAO,MAAM,CAAC;AAChB,CAAC,CAAC;AAcSA,2BAAmB,GAAG,MAAM;AACvC,EAAE,WAAW,GAAG;AAChB,IAAI,IAAI,CAAC,IAAI,GAAG,KAAK,CAAC,CAAC;AACvB,IAAI,IAAI,CAAC,WAAW,GAAG,KAAK,CAAC,CAAC;AAC9B,IAAI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,CAAC;AAChD,IAAI,OAAO,IAAI,CAAC;AAChB,GAAG;AACH,EAAE,kBAAkB,CAAC,KAAK,EAAE;AAC5B,IAAI,MAAM,EAAE,OAAO,EAAE,GAAG,IAAI,CAAC;AAC7B,IAAIC,mCAAwB,CAAC,OAAO,CAAC,CAAC;AACtC,IAAI,MAAM,MAAM,GAAG,OAAO,KAAK,KAAK,UAAU,GAAG,KAAK,CAAC,IAAIC,0DAAkC,EAAE,CAAC,GAAG,KAAK,CAAC;AACzG,IAAIC,gCAAqB,CAAC,MAAM,EAAED,0DAAkC,CAAC,CAAC;AACtE,IAAI,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;AACzB,IAAI,OAAO,IAAI,CAAC;AAChB,GAAG;AACH,EAAE,aAAa,CAAC,KAAK,EAAE;AACvB,IAAI,MAAM,EAAE,OAAO,EAAE,GAAG,IAAI,CAAC;AAC7B,IAAID,mCAAwB,CAAC,OAAO,CAAC,CAAC;AACtC,IAAI,MAAM,MAAM,GAAG,OAAO,KAAK,KAAK,UAAU,GAAG,KAAK,CAAC,IAAIG,qDAA6B,EAAE,CAAC,GAAG,KAAK,CAAC;AACpG,IAAID,gCAAqB,CAAC,MAAM,EAAEC,qDAA6B,CAAC,CAAC;AACjE,IAAI,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;AACzB,IAAI,OAAO,IAAI,CAAC;AAChB,GAAG;AACH,EAAE;AACFT,2BAAmB,GAAG,eAAe,CAAC;AACtC,EAAEU,WAAG,CAACC,mDAAyB,EAAEC,2CAAwB,CAAC;AAC1D,CAAC,EAAEZ,2BAAmB,CAAC;;"}
|
|
@@ -27,7 +27,7 @@ export declare class SlashCommandBuilder {
|
|
|
27
27
|
* Whether the command is enabled by default when the app is added to a guild
|
|
28
28
|
*
|
|
29
29
|
* @deprecated This property is deprecated and will be removed in the future.
|
|
30
|
-
* You should use
|
|
30
|
+
* You should use {@link (SlashCommandBuilder:class).setDefaultMemberPermissions} or {@link (SlashCommandBuilder:class).setDMPermission} instead.
|
|
31
31
|
*/
|
|
32
32
|
readonly default_permission: boolean | undefined;
|
|
33
33
|
/**
|
|
@@ -53,7 +53,7 @@ export declare class SlashCommandBuilder {
|
|
|
53
53
|
* @param value - Whether or not to enable this command by default
|
|
54
54
|
*
|
|
55
55
|
* @see https://discord.com/developers/docs/interactions/application-commands#permissions
|
|
56
|
-
* @deprecated Use
|
|
56
|
+
* @deprecated Use {@link (SlashCommandBuilder:class).setDefaultMemberPermissions} or {@link (SlashCommandBuilder:class).setDMPermission} instead.
|
|
57
57
|
*/
|
|
58
58
|
setDefaultPermission(value: boolean): this;
|
|
59
59
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SlashCommandBuilder.mjs","sources":["../../../src/interactions/slashCommands/SlashCommandBuilder.ts"],"sourcesContent":["import type {\n\tAPIApplicationCommandOption,\n\tLocalizationMap,\n\tPermissions,\n\tRESTPostAPIApplicationCommandsJSONBody,\n} from 'discord-api-types/v10';\nimport { mix } from 'ts-mixer';\nimport {\n\tassertReturnOfBuilder,\n\tvalidateDefaultMemberPermissions,\n\tvalidateDefaultPermission,\n\tvalidateLocalizationMap,\n\tvalidateDMPermission,\n\tvalidateMaxOptionsLength,\n\tvalidateRequiredParameters,\n} from './Assertions';\nimport { SlashCommandSubcommandBuilder, SlashCommandSubcommandGroupBuilder } from './SlashCommandSubcommands';\nimport { SharedNameAndDescription } from './mixins/NameAndDescription';\nimport { SharedSlashCommandOptions } from './mixins/SharedSlashCommandOptions';\n\n@mix(SharedSlashCommandOptions, SharedNameAndDescription)\nexport class SlashCommandBuilder {\n\t/**\n\t * The name of this slash command\n\t */\n\tpublic readonly name: string = undefined!;\n\n\t/**\n\t * The localized names for this command\n\t */\n\tpublic readonly name_localizations?: LocalizationMap;\n\n\t/**\n\t * The description of this slash command\n\t */\n\tpublic readonly description: string = undefined!;\n\n\t/**\n\t * The localized descriptions for this command\n\t */\n\tpublic readonly description_localizations?: LocalizationMap;\n\n\t/**\n\t * The options of this slash command\n\t */\n\tpublic readonly options: ToAPIApplicationCommandOptions[] = [];\n\n\t/**\n\t * Whether the command is enabled by default when the app is added to a guild\n\t *\n\t * @deprecated This property is deprecated and will be removed in the future.\n\t * You should use
|
|
1
|
+
{"version":3,"file":"SlashCommandBuilder.mjs","sources":["../../../src/interactions/slashCommands/SlashCommandBuilder.ts"],"sourcesContent":["import type {\n\tAPIApplicationCommandOption,\n\tLocalizationMap,\n\tPermissions,\n\tRESTPostAPIApplicationCommandsJSONBody,\n} from 'discord-api-types/v10';\nimport { mix } from 'ts-mixer';\nimport {\n\tassertReturnOfBuilder,\n\tvalidateDefaultMemberPermissions,\n\tvalidateDefaultPermission,\n\tvalidateLocalizationMap,\n\tvalidateDMPermission,\n\tvalidateMaxOptionsLength,\n\tvalidateRequiredParameters,\n} from './Assertions';\nimport { SlashCommandSubcommandBuilder, SlashCommandSubcommandGroupBuilder } from './SlashCommandSubcommands';\nimport { SharedNameAndDescription } from './mixins/NameAndDescription';\nimport { SharedSlashCommandOptions } from './mixins/SharedSlashCommandOptions';\n\n@mix(SharedSlashCommandOptions, SharedNameAndDescription)\nexport class SlashCommandBuilder {\n\t/**\n\t * The name of this slash command\n\t */\n\tpublic readonly name: string = undefined!;\n\n\t/**\n\t * The localized names for this command\n\t */\n\tpublic readonly name_localizations?: LocalizationMap;\n\n\t/**\n\t * The description of this slash command\n\t */\n\tpublic readonly description: string = undefined!;\n\n\t/**\n\t * The localized descriptions for this command\n\t */\n\tpublic readonly description_localizations?: LocalizationMap;\n\n\t/**\n\t * The options of this slash command\n\t */\n\tpublic readonly options: ToAPIApplicationCommandOptions[] = [];\n\n\t/**\n\t * Whether the command is enabled by default when the app is added to a guild\n\t *\n\t * @deprecated This property is deprecated and will be removed in the future.\n\t * You should use {@link (SlashCommandBuilder:class).setDefaultMemberPermissions} or {@link (SlashCommandBuilder:class).setDMPermission} instead.\n\t */\n\tpublic readonly default_permission: boolean | undefined = undefined;\n\n\t/**\n\t * Set of permissions represented as a bit set for the command\n\t */\n\tpublic readonly default_member_permissions: Permissions | null | undefined = undefined;\n\n\t/**\n\t * Indicates whether the command is available in DMs with the application, only for globally-scoped commands.\n\t * By default, commands are visible.\n\t */\n\tpublic readonly dm_permission: boolean | undefined = undefined;\n\n\t/**\n\t * Returns the final data that should be sent to Discord.\n\t *\n\t * **Note:** Calling this function will validate required properties based on their conditions.\n\t */\n\tpublic toJSON(): RESTPostAPIApplicationCommandsJSONBody {\n\t\tvalidateRequiredParameters(this.name, this.description, this.options);\n\n\t\tvalidateLocalizationMap(this.name_localizations);\n\t\tvalidateLocalizationMap(this.description_localizations);\n\n\t\treturn {\n\t\t\t...this,\n\t\t\toptions: this.options.map((option) => option.toJSON()),\n\t\t};\n\t}\n\n\t/**\n\t * Sets whether the command is enabled by default when the application is added to a guild.\n\t *\n\t * **Note**: If set to `false`, you will have to later `PUT` the permissions for this command.\n\t *\n\t * @param value - Whether or not to enable this command by default\n\t *\n\t * @see https://discord.com/developers/docs/interactions/application-commands#permissions\n\t * @deprecated Use {@link (SlashCommandBuilder:class).setDefaultMemberPermissions} or {@link (SlashCommandBuilder:class).setDMPermission} instead.\n\t */\n\tpublic setDefaultPermission(value: boolean) {\n\t\t// Assert the value matches the conditions\n\t\tvalidateDefaultPermission(value);\n\n\t\tReflect.set(this, 'default_permission', value);\n\n\t\treturn this;\n\t}\n\n\t/**\n\t * Sets the default permissions a member should have in order to run the command.\n\t *\n\t * **Note:** You can set this to `'0'` to disable the command by default.\n\t *\n\t * @param permissions - The permissions bit field to set\n\t *\n\t * @see https://discord.com/developers/docs/interactions/application-commands#permissions\n\t */\n\tpublic setDefaultMemberPermissions(permissions: Permissions | bigint | number | null | undefined) {\n\t\t// Assert the value and parse it\n\t\tconst permissionValue = validateDefaultMemberPermissions(permissions);\n\n\t\tReflect.set(this, 'default_member_permissions', permissionValue);\n\n\t\treturn this;\n\t}\n\n\t/**\n\t * Sets if the command is available in DMs with the application, only for globally-scoped commands.\n\t * By default, commands are visible.\n\t *\n\t * @param enabled - If the command should be enabled in DMs\n\t *\n\t * @see https://discord.com/developers/docs/interactions/application-commands#permissions\n\t */\n\tpublic setDMPermission(enabled: boolean | null | undefined) {\n\t\t// Assert the value matches the conditions\n\t\tvalidateDMPermission(enabled);\n\n\t\tReflect.set(this, 'dm_permission', enabled);\n\n\t\treturn this;\n\t}\n\n\t/**\n\t * Adds a new subcommand group to this command\n\t *\n\t * @param input - A function that returns a subcommand group builder, or an already built builder\n\t */\n\tpublic addSubcommandGroup(\n\t\tinput:\n\t\t\t| SlashCommandSubcommandGroupBuilder\n\t\t\t| ((subcommandGroup: SlashCommandSubcommandGroupBuilder) => SlashCommandSubcommandGroupBuilder),\n\t): SlashCommandSubcommandsOnlyBuilder {\n\t\tconst { options } = this;\n\n\t\t// First, assert options conditions - we cannot have more than 25 options\n\t\tvalidateMaxOptionsLength(options);\n\n\t\t// Get the final result\n\t\tconst result = typeof input === 'function' ? input(new SlashCommandSubcommandGroupBuilder()) : input;\n\n\t\tassertReturnOfBuilder(result, SlashCommandSubcommandGroupBuilder);\n\n\t\t// Push it\n\t\toptions.push(result);\n\n\t\treturn this;\n\t}\n\n\t/**\n\t * Adds a new subcommand to this command\n\t *\n\t * @param input - A function that returns a subcommand builder, or an already built builder\n\t */\n\tpublic addSubcommand(\n\t\tinput:\n\t\t\t| SlashCommandSubcommandBuilder\n\t\t\t| ((subcommandGroup: SlashCommandSubcommandBuilder) => SlashCommandSubcommandBuilder),\n\t): SlashCommandSubcommandsOnlyBuilder {\n\t\tconst { options } = this;\n\n\t\t// First, assert options conditions - we cannot have more than 25 options\n\t\tvalidateMaxOptionsLength(options);\n\n\t\t// Get the final result\n\t\tconst result = typeof input === 'function' ? input(new SlashCommandSubcommandBuilder()) : input;\n\n\t\tassertReturnOfBuilder(result, SlashCommandSubcommandBuilder);\n\n\t\t// Push it\n\t\toptions.push(result);\n\n\t\treturn this;\n\t}\n}\n\nexport interface SlashCommandBuilder extends SharedNameAndDescription, SharedSlashCommandOptions {}\n\nexport interface SlashCommandSubcommandsOnlyBuilder\n\textends SharedNameAndDescription,\n\t\tPick<SlashCommandBuilder, 'toJSON' | 'addSubcommand' | 'addSubcommandGroup'> {}\n\nexport interface SlashCommandOptionsOnlyBuilder\n\textends SharedNameAndDescription,\n\t\tSharedSlashCommandOptions,\n\t\tPick<SlashCommandBuilder, 'toJSON'> {}\n\nexport interface ToAPIApplicationCommandOptions {\n\ttoJSON: () => APIApplicationCommandOption;\n}\n"],"names":[],"mappings":";;;;;;AAAA,IAAI,SAAS,GAAG,MAAM,CAAC,cAAc,CAAC;AACtC,IAAI,gBAAgB,GAAG,MAAM,CAAC,wBAAwB,CAAC;AACvD,IAAI,eAAe,GAAG,CAAC,UAAU,EAAE,MAAM,EAAE,GAAG,EAAE,IAAI,KAAK;AACzD,EAAE,IAAI,MAAM,GAAG,IAAI,GAAG,CAAC,GAAG,KAAK,CAAC,GAAG,IAAI,GAAG,gBAAgB,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,MAAM,CAAC;AACjF,EAAE,KAAK,IAAI,CAAC,GAAG,UAAU,CAAC,MAAM,GAAG,CAAC,EAAE,SAAS,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE;AAC5D,IAAI,IAAI,SAAS,GAAG,UAAU,CAAC,CAAC,CAAC;AACjC,MAAM,MAAM,GAAG,CAAC,IAAI,GAAG,SAAS,CAAC,MAAM,EAAE,GAAG,EAAE,MAAM,CAAC,GAAG,SAAS,CAAC,MAAM,CAAC,KAAK,MAAM,CAAC;AACrF,EAAE,IAAI,IAAI,IAAI,MAAM;AACpB,IAAI,SAAS,CAAC,MAAM,EAAE,GAAG,EAAE,MAAM,CAAC,CAAC;AACnC,EAAE,OAAO,MAAM,CAAC;AAChB,CAAC,CAAC;AAcQ,IAAC,mBAAmB,GAAG,MAAM;AACvC,EAAE,WAAW,GAAG;AAChB,IAAI,IAAI,CAAC,IAAI,GAAG,KAAK,CAAC,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IAAI,OAAO,CAAC,GAAG,CAAC,IAAI,EAAE,eAAe,EAAE,OAAO,CAAC,CAAC;AAChD,IAAI,OAAO,IAAI,CAAC;AAChB,GAAG;AACH,EAAE,kBAAkB,CAAC,KAAK,EAAE;AAC5B,IAAI,MAAM,EAAE,OAAO,EAAE,GAAG,IAAI,CAAC;AAC7B,IAAI,wBAAwB,CAAC,OAAO,CAAC,CAAC;AACtC,IAAI,MAAM,MAAM,GAAG,OAAO,KAAK,KAAK,UAAU,GAAG,KAAK,CAAC,IAAI,kCAAkC,EAAE,CAAC,GAAG,KAAK,CAAC;AACzG,IAAI,qBAAqB,CAAC,MAAM,EAAE,kCAAkC,CAAC,CAAC;AACtE,IAAI,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;AACzB,IAAI,OAAO,IAAI,CAAC;AAChB,GAAG;AACH,EAAE,aAAa,CAAC,KAAK,EAAE;AACvB,IAAI,MAAM,EAAE,OAAO,EAAE,GAAG,IAAI,CAAC;AAC7B,IAAI,wBAAwB,CAAC,OAAO,CAAC,CAAC;AACtC,IAAI,MAAM,MAAM,GAAG,OAAO,KAAK,KAAK,UAAU,GAAG,KAAK,CAAC,IAAI,6BAA6B,EAAE,CAAC,GAAG,KAAK,CAAC;AACpG,IAAI,qBAAqB,CAAC,MAAM,EAAE,6BAA6B,CAAC,CAAC;AACjE,IAAI,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;AACzB,IAAI,OAAO,IAAI,CAAC;AAChB,GAAG;AACH,EAAE;AACF,mBAAmB,GAAG,eAAe,CAAC;AACtC,EAAE,GAAG,CAAC,yBAAyB,EAAE,wBAAwB,CAAC;AAC1D,CAAC,EAAE,mBAAmB,CAAC;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Embed.cjs","sources":["../../../src/messages/embed/Embed.ts"],"sourcesContent":["import type { APIEmbed, APIEmbedAuthor, APIEmbedField, APIEmbedFooter, APIEmbedImage } from 'discord-api-types/v10';\nimport {\n\tcolorPredicate,\n\tdescriptionPredicate,\n\tembedAuthorPredicate,\n\tembedFieldsArrayPredicate,\n\tembedFooterPredicate,\n\timageURLPredicate,\n\ttimestampPredicate,\n\ttitlePredicate,\n\turlPredicate,\n\tvalidateFieldLength,\n} from './Assertions';\nimport { normalizeArray, type RestOrArray } from '../../util/normalizeArray';\n\nexport type RGBTuple = [red: number, green: number, blue: number];\n\nexport interface IconData {\n\t/**\n\t * The URL of the icon\n\t */\n\ticonURL?: string;\n\t/**\n\t * The proxy URL of the icon\n\t */\n\tproxyIconURL?: string;\n}\n\nexport type EmbedAuthorData = Omit<APIEmbedAuthor, 'icon_url' | 'proxy_icon_url'> & IconData;\n\nexport type EmbedAuthorOptions = Omit<EmbedAuthorData, 'proxyIconURL'>;\n\nexport type EmbedFooterData = Omit<APIEmbedFooter, 'icon_url' | 'proxy_icon_url'> & IconData;\n\nexport type EmbedFooterOptions = Omit<EmbedFooterData, 'proxyIconURL'>;\n\nexport interface EmbedImageData extends Omit<APIEmbedImage, 'proxy_url'> {\n\t/**\n\t * The proxy URL for the image\n\t */\n\tproxyURL?: string;\n}\n/**\n * Represents a embed in a message (image/video preview, rich embed, etc.)\n */\nexport class EmbedBuilder {\n\tpublic readonly data: APIEmbed;\n\n\tpublic constructor(data: APIEmbed = {}) {\n\t\tthis.data = { ...data };\n\t\tif (data.timestamp) this.data.timestamp = new Date(data.timestamp).toISOString();\n\t}\n\n\t/**\n\t * Adds fields to the embed (max 25)\n\t *\n\t * @param fields The fields to add\n\t */\n\tpublic addFields(...fields: RestOrArray<APIEmbedField>): this {\n\t\tfields = normalizeArray(fields);\n\t\t// Ensure adding these fields won't exceed the 25 field limit\n\t\tvalidateFieldLength(fields.length, this.data.fields);\n\n\t\t// Data assertions\n\t\tembedFieldsArrayPredicate.parse(fields);\n\n\t\tif (this.data.fields) this.data.fields.push(...fields);\n\t\telse this.data.fields = fields;\n\t\treturn this;\n\t}\n\n\t/**\n\t * Removes, replaces, or inserts fields in the embed (max 25)\n\t *\n\t * @param index The index to start at\n\t * @param deleteCount The number of fields to remove\n\t * @param fields The replacing field objects\n\t */\n\tpublic spliceFields(index: number, deleteCount: number, ...fields: APIEmbedField[]): this {\n\t\t// Ensure adding these fields won't exceed the 25 field limit\n\t\tvalidateFieldLength(fields.length - deleteCount, this.data.fields);\n\n\t\t// Data assertions\n\t\tembedFieldsArrayPredicate.parse(fields);\n\t\tif (this.data.fields) this.data.fields.splice(index, deleteCount, ...fields);\n\t\telse this.data.fields = fields;\n\t\treturn this;\n\t}\n\n\t/**\n\t * Sets the embed's fields (max 25).\n\t * @param fields The fields to set\n\t */\n\tpublic setFields(...fields: RestOrArray<APIEmbedField>) {\n\t\tthis.spliceFields(0, this.data.fields?.length ?? 0, ...normalizeArray(fields));\n\t\treturn this;\n\t}\n\n\t/**\n\t * Sets the author of this embed\n\t *\n\t * @param options The options for the author\n\t */\n\n\tpublic setAuthor(options: EmbedAuthorOptions | null): this {\n\t\tif (options === null) {\n\t\t\tthis.data.author = undefined;\n\t\t\treturn this;\n\t\t}\n\n\t\t// Data assertions\n\t\tembedAuthorPredicate.parse(options);\n\n\t\tthis.data.author = { name: options.name, url: options.url, icon_url: options.iconURL };\n\t\treturn this;\n\t}\n\n\t/**\n\t * Sets the color of this embed\n\t *\n\t * @param color The color of the embed\n\t */\n\tpublic setColor(color: number | RGBTuple | null): this {\n\t\t// Data assertions\n\t\tcolorPredicate.parse(color);\n\n\t\tif (Array.isArray(color)) {\n\t\t\tconst [red, green, blue] = color;\n\t\t\tthis.data.color = (red << 16) + (green << 8) + blue;\n\t\t\treturn this;\n\t\t}\n\t\tthis.data.color = color ?? undefined;\n\t\treturn this;\n\t}\n\n\t/**\n\t * Sets the description of this embed\n\t *\n\t * @param description The description\n\t */\n\tpublic setDescription(description: string | null): this {\n\t\t// Data assertions\n\t\tdescriptionPredicate.parse(description);\n\n\t\tthis.data.description = description ?? undefined;\n\t\treturn this;\n\t}\n\n\t/**\n\t * Sets the footer of this embed\n\t *\n\t * @param options The options for the footer\n\t */\n\tpublic setFooter(options: EmbedFooterOptions | null): this {\n\t\tif (options === null) {\n\t\t\tthis.data.footer = undefined;\n\t\t\treturn this;\n\t\t}\n\n\t\t// Data assertions\n\t\tembedFooterPredicate.parse(options);\n\n\t\tthis.data.footer = { text: options.text, icon_url: options.iconURL };\n\t\treturn this;\n\t}\n\n\t/**\n\t * Sets the image of this embed\n\t *\n\t * @param url The URL of the image\n\t */\n\tpublic setImage(url: string | null): this {\n\t\t// Data assertions\n\t\timageURLPredicate.parse(url);\n\n\t\tthis.data.image = url ? { url } : undefined;\n\t\treturn this;\n\t}\n\n\t/**\n\t * Sets the thumbnail of this embed\n\t *\n\t * @param url The URL of the thumbnail\n\t */\n\tpublic setThumbnail(url: string | null): this {\n\t\t// Data assertions\n\t\timageURLPredicate.parse(url);\n\n\t\tthis.data.thumbnail = url ? { url } : undefined;\n\t\treturn this;\n\t}\n\n\t/**\n\t * Sets the timestamp of this embed\n\t *\n\t * @param timestamp The timestamp or date\n\t */\n\tpublic setTimestamp(timestamp: number | Date | null = Date.now()): this {\n\t\t// Data assertions\n\t\ttimestampPredicate.parse(timestamp);\n\n\t\tthis.data.timestamp = timestamp ? new Date(timestamp).toISOString() : undefined;\n\t\treturn this;\n\t}\n\n\t/**\n\t * Sets the title of this embed\n\t *\n\t * @param title The title\n\t */\n\tpublic setTitle(title: string | null): this {\n\t\t// Data assertions\n\t\ttitlePredicate.parse(title);\n\n\t\tthis.data.title = title ?? undefined;\n\t\treturn this;\n\t}\n\n\t/**\n\t * Sets the URL of this embed\n\t *\n\t * @param url The URL\n\t */\n\tpublic setURL(url: string | null): this {\n\t\t// Data assertions\n\t\turlPredicate.parse(url);\n\n\t\tthis.data.url = url ?? undefined;\n\t\treturn this;\n\t}\n\n\t/**\n\t * Transforms the embed to a plain object\n\t */\n\tpublic toJSON(): APIEmbed {\n\t\treturn { ...this.data };\n\t}\n}\n"],"names":["normalizeArray","validateFieldLength","embedFieldsArrayPredicate","embedAuthorPredicate","colorPredicate","descriptionPredicate","embedFooterPredicate","imageURLPredicate","timestampPredicate","titlePredicate","urlPredicate"],"mappings":";;;;;;;AAaO,MAAM,YAAY,CAAC;AAC1B,EAAE,WAAW,CAAC,IAAI,GAAG,EAAE,EAAE;AACzB,IAAI,IAAI,CAAC,IAAI,GAAG,EAAE,GAAG,IAAI,EAAE,CAAC;AAC5B,IAAI,IAAI,IAAI,CAAC,SAAS;AACtB,MAAM,IAAI,CAAC,IAAI,CAAC,SAAS,GAAG,IAAI,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,WAAW,EAAE,CAAC;AACnE,GAAG;AACH,EAAE,SAAS,CAAC,GAAG,MAAM,EAAE;AACvB,IAAI,MAAM,GAAGA,6BAAc,CAAC,MAAM,CAAC,CAAC;AACpC,IAAIC,8BAAmB,CAAC,MAAM,CAAC,MAAM,EAAE,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;AACzD,IAAIC,oCAAyB,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;AAC5C,IAAI,IAAI,IAAI,CAAC,IAAI,CAAC,MAAM;AACxB,MAAM,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC,CAAC;AACvC;AACA,MAAM,IAAI,CAAC,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;AAChC,IAAI,OAAO,IAAI,CAAC;AAChB,GAAG;AACH,EAAE,YAAY,CAAC,KAAK,EAAE,WAAW,EAAE,GAAG,MAAM,EAAE;AAC9C,IAAID,8BAAmB,CAAC,MAAM,CAAC,MAAM,GAAG,WAAW,EAAE,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;AACvE,IAAIC,oCAAyB,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;AAC5C,IAAI,IAAI,IAAI,CAAC,IAAI,CAAC,MAAM;AACxB,MAAM,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,M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I,CAAC;AAChB,GAAG;AACH,EAAE,YAAY,CAAC,SAAS,GAAG,IAAI,CAAC,GAAG,EAAE,EAAE;AACvC,IAAIC,6BAAkB,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC;AACxC,IAAI,IAAI,CAAC,IAAI,CAAC,SAAS,GAAG,SAAS,GAAG,IAAI,IAAI,CAAC,SAAS,CAAC,CAAC,WAAW,EAAE,GAAG,KAAK,CAAC,CAAC;AACjF,IAAI,OAAO,IAAI,CAAC;AAChB,GAAG;AACH,EAAE,QAAQ,CAAC,KAAK,EAAE;AAClB,IAAIC,yBAAc,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;AAChC,IAAI,IAAI,CAAC,IAAI,CAAC,KAAK,GAAG,KAAK,IAAI,KAAK,CAAC,CAAC;AACtC,IAAI,OAAO,IAAI,CAAC;AAChB,GAAG;AACH,EAAE,MAAM,CAAC,GAAG,EAAE;AACd,IAAIC,uBAAY,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;AAC5B,IAAI,IAAI,CAAC,IAAI,CAAC,GAAG,GAAG,GAAG,IAAI,KAAK,CAAC,CAAC;AAClC,IAAI,OAAO,IAAI,CAAC;AAChB,GAAG;AACH,EAAE,MAAM,GAAG;AACX,IAAI,OAAO,EAAE,GAAG,IAAI,CAAC,IAAI,EAAE,CAAC;AAC5B,GAAG;AACH;;;;"}
|
|
1
|
+
{"version":3,"file":"Embed.cjs","sources":["../../../src/messages/embed/Embed.ts"],"sourcesContent":["import type { APIEmbed, APIEmbedAuthor, APIEmbedField, APIEmbedFooter, APIEmbedImage } from 'discord-api-types/v10';\nimport {\n\tcolorPredicate,\n\tdescriptionPredicate,\n\tembedAuthorPredicate,\n\tembedFieldsArrayPredicate,\n\tembedFooterPredicate,\n\timageURLPredicate,\n\ttimestampPredicate,\n\ttitlePredicate,\n\turlPredicate,\n\tvalidateFieldLength,\n} from './Assertions';\nimport { normalizeArray, type RestOrArray } from '../../util/normalizeArray';\n\nexport type RGBTuple = [red: number, green: number, blue: number];\n\nexport interface IconData {\n\t/**\n\t * The URL of the icon\n\t */\n\ticonURL?: string;\n\t/**\n\t * The proxy URL of the icon\n\t */\n\tproxyIconURL?: string;\n}\n\nexport type EmbedAuthorData = Omit<APIEmbedAuthor, 'icon_url' | 'proxy_icon_url'> & IconData;\n\nexport type EmbedAuthorOptions = Omit<EmbedAuthorData, 'proxyIconURL'>;\n\nexport type EmbedFooterData = Omit<APIEmbedFooter, 'icon_url' | 'proxy_icon_url'> & IconData;\n\nexport type EmbedFooterOptions = Omit<EmbedFooterData, 'proxyIconURL'>;\n\nexport interface EmbedImageData extends Omit<APIEmbedImage, 'proxy_url'> {\n\t/**\n\t * The proxy URL for the image\n\t */\n\tproxyURL?: string;\n}\n/**\n * Represents a embed in a message (image/video preview, rich embed, etc.)\n */\nexport class EmbedBuilder {\n\tpublic readonly data: APIEmbed;\n\n\tpublic constructor(data: APIEmbed = {}) {\n\t\tthis.data = { ...data };\n\t\tif (data.timestamp) this.data.timestamp = new Date(data.timestamp).toISOString();\n\t}\n\n\t/**\n\t * Appends fields to the embed\n\t *\n\t * @remarks\n\t * This method accepts either an array of fields or a variable number of field parameters.\n\t * The maximum amount of fields that can be added is 25.\n\t *\n\t * @example\n\t * Using an array\n\t * ```ts\n\t * const fields: APIEmbedField[] = ...;\n\t * const embed = new EmbedBuilder()\n\t * \t.addFields(fields);\n\t * ```\n\t *\n\t * @example\n\t * Using rest parameters (variadic)\n\t * ```ts\n\t * const embed = new EmbedBuilder()\n\t * \t.addFields(\n\t * \t\t{ name: 'Field 1', value: 'Value 1' },\n\t * \t\t{ name: 'Field 2', value: 'Value 2' },\n\t * \t);\n\t * ```\n\t *\n\t * @param fields The fields to add\n\t */\n\tpublic addFields(...fields: RestOrArray<APIEmbedField>): this {\n\t\tfields = normalizeArray(fields);\n\t\t// Ensure adding these fields won't exceed the 25 field limit\n\t\tvalidateFieldLength(fields.length, this.data.fields);\n\n\t\t// Data assertions\n\t\tembedFieldsArrayPredicate.parse(fields);\n\n\t\tif (this.data.fields) this.data.fields.push(...fields);\n\t\telse this.data.fields = fields;\n\t\treturn this;\n\t}\n\n\t/**\n\t * Removes, replaces, or inserts fields in the embed.\n\t *\n\t * @remarks\n\t * This method behaves similarly\n\t * to {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/slice | Array.prototype.splice}.\n\t * The maximum amount of fields that can be added is 25.\n\t *\n\t * It's useful for modifying and adjusting order of the already-existing fields of an embed.\n\t *\n\t * @example\n\t * Remove the first field\n\t * ```ts\n\t * embed.spliceFields(0, 1);\n\t * ```\n\t *\n\t * @example\n\t * Remove the first n fields\n\t * ```ts\n\t * const n = 4\n\t * embed.spliceFields(0, n);\n\t * ```\n\t *\n\t * @example\n\t * Remove the last field\n\t * ```ts\n\t * embed.spliceFields(-1, 1);\n\t * ```\n\t *\n\t * @param index The index to start at\n\t * @param deleteCount The number of fields to remove\n\t * @param fields The replacing field objects\n\t */\n\tpublic spliceFields(index: number, deleteCount: number, ...fields: APIEmbedField[]): this {\n\t\t// Ensure adding these fields won't exceed the 25 field limit\n\t\tvalidateFieldLength(fields.length - deleteCount, this.data.fields);\n\n\t\t// Data assertions\n\t\tembedFieldsArrayPredicate.parse(fields);\n\t\tif (this.data.fields) this.data.fields.splice(index, deleteCount, ...fields);\n\t\telse this.data.fields = fields;\n\t\treturn this;\n\t}\n\n\t/**\n\t * Sets the embed's fields\n\t *\n\t * @remarks\n\t * This method is an alias for {@link EmbedBuilder.spliceFields}. More specifically,\n\t * it splices the entire array of fields, replacing them with the provided fields.\n\t *\n\t * You can set a maximum of 25 fields.\n\t *\n\t * @param fields The fields to set\n\t */\n\tpublic setFields(...fields: RestOrArray<APIEmbedField>) {\n\t\tthis.spliceFields(0, this.data.fields?.length ?? 0, ...normalizeArray(fields));\n\t\treturn this;\n\t}\n\n\t/**\n\t * Sets the author of this embed\n\t *\n\t * @param options The options for the author\n\t */\n\n\tpublic setAuthor(options: EmbedAuthorOptions | null): this {\n\t\tif (options === null) {\n\t\t\tthis.data.author = undefined;\n\t\t\treturn this;\n\t\t}\n\n\t\t// Data assertions\n\t\tembedAuthorPredicate.parse(options);\n\n\t\tthis.data.author = { name: options.name, url: options.url, icon_url: options.iconURL };\n\t\treturn this;\n\t}\n\n\t/**\n\t * Sets the color of this embed\n\t *\n\t * @param color The color of the embed\n\t */\n\tpublic setColor(color: number | RGBTuple | null): this {\n\t\t// Data assertions\n\t\tcolorPredicate.parse(color);\n\n\t\tif (Array.isArray(color)) {\n\t\t\tconst [red, green, blue] = color;\n\t\t\tthis.data.color = (red << 16) + (green << 8) + blue;\n\t\t\treturn this;\n\t\t}\n\t\tthis.data.color = color ?? undefined;\n\t\treturn this;\n\t}\n\n\t/**\n\t * Sets the description of this embed\n\t *\n\t * @param description The description\n\t */\n\tpublic setDescription(description: string | null): this {\n\t\t// Data assertions\n\t\tdescriptionPredicate.parse(description);\n\n\t\tthis.data.description = description ?? undefined;\n\t\treturn this;\n\t}\n\n\t/**\n\t * Sets the footer of this embed\n\t *\n\t * @param options The options for the footer\n\t */\n\tpublic setFooter(options: EmbedFooterOptions | null): this {\n\t\tif (options === null) {\n\t\t\tthis.data.footer = undefined;\n\t\t\treturn this;\n\t\t}\n\n\t\t// Data assertions\n\t\tembedFooterPredicate.parse(options);\n\n\t\tthis.data.footer = { text: options.text, icon_url: options.iconURL };\n\t\treturn this;\n\t}\n\n\t/**\n\t * Sets the image of this embed\n\t *\n\t * @param url The URL of the image\n\t */\n\tpublic setImage(url: string | null): this {\n\t\t// Data assertions\n\t\timageURLPredicate.parse(url);\n\n\t\tthis.data.image = url ? { url } : undefined;\n\t\treturn this;\n\t}\n\n\t/**\n\t * Sets the thumbnail of this embed\n\t *\n\t * @param url The URL of the thumbnail\n\t */\n\tpublic setThumbnail(url: string | null): this {\n\t\t// Data assertions\n\t\timageURLPredicate.parse(url);\n\n\t\tthis.data.thumbnail = url ? { url } : undefined;\n\t\treturn this;\n\t}\n\n\t/**\n\t * Sets the timestamp of this embed\n\t *\n\t * @param timestamp The timestamp or date\n\t */\n\tpublic setTimestamp(timestamp: number | Date | null = Date.now()): this {\n\t\t// Data assertions\n\t\ttimestampPredicate.parse(timestamp);\n\n\t\tthis.data.timestamp = timestamp ? new Date(timestamp).toISOString() : undefined;\n\t\treturn this;\n\t}\n\n\t/**\n\t * Sets the title of this embed\n\t *\n\t * @param title The title\n\t */\n\tpublic setTitle(title: string | null): this {\n\t\t// Data assertions\n\t\ttitlePredicate.parse(title);\n\n\t\tthis.data.title = title ?? undefined;\n\t\treturn this;\n\t}\n\n\t/**\n\t * Sets the URL of this embed\n\t *\n\t * @param url The URL\n\t */\n\tpublic setURL(url: string | null): this {\n\t\t// Data assertions\n\t\turlPredicate.parse(url);\n\n\t\tthis.data.url = url ?? undefined;\n\t\treturn this;\n\t}\n\n\t/**\n\t * Transforms the embed to a plain object\n\t */\n\tpublic toJSON(): APIEmbed {\n\t\treturn { ...this.data };\n\t}\n}\n"],"names":["normalizeArray","validateFieldLength","embedFieldsArrayPredicate","embedAuthorPredicate","colorPredicate","descriptionPredicate","embedFooterPredicate","imageURLPredicate","timestampPredicate","titlePredicate","urlPredicate"],"mappings":";;;;;;;AAaO,MAAM,YAAY,CAAC;AAC1B,EAAE,WAAW,CAAC,IAAI,GAAG,EAAE,EAAE;AACzB,IAAI,IAAI,CAAC,IAAI,GAAG,EAAE,GAAG,IAAI,EAAE,CAAC;AAC5B,IAAI,IAAI,IAAI,CAAC,SAAS;AACtB,MAAM,IAAI,CAAC,IAAI,CAAC,SAAS,GAAG,IAAI,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,WAAW,EAAE,CAAC;AACnE,GAAG;AACH,EAAE,SAAS,CAAC,GAAG,MAAM,EAAE;AACvB,IAAI,MAAM,GAAGA,6BAAc,CAAC,MAAM,CAAC,CAAC;AACpC,IAAIC,8BAAmB,CAAC,MAAM,CAAC,MAAM,EAAE,IAAI,CAAC,IAAI,CAAC,MAAM,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K,CAAC,GAAG,CAAC,CAAC;AAC5B,IAAI,IAAI,CAAC,IAAI,CAAC,GAAG,GAAG,GAAG,IAAI,KAAK,CAAC,CAAC;AAClC,IAAI,OAAO,IAAI,CAAC;AAChB,GAAG;AACH,EAAE,MAAM,GAAG;AACX,IAAI,OAAO,EAAE,GAAG,IAAI,CAAC,IAAI,EAAE,CAAC;AAC5B,GAAG;AACH;;;;"}
|
|
@@ -28,13 +28,61 @@ export declare class EmbedBuilder {
|
|
|
28
28
|
readonly data: APIEmbed;
|
|
29
29
|
constructor(data?: APIEmbed);
|
|
30
30
|
/**
|
|
31
|
-
*
|
|
31
|
+
* Appends fields to the embed
|
|
32
|
+
*
|
|
33
|
+
* @remarks
|
|
34
|
+
* This method accepts either an array of fields or a variable number of field parameters.
|
|
35
|
+
* The maximum amount of fields that can be added is 25.
|
|
36
|
+
*
|
|
37
|
+
* @example
|
|
38
|
+
* Using an array
|
|
39
|
+
* ```ts
|
|
40
|
+
* const fields: APIEmbedField[] = ...;
|
|
41
|
+
* const embed = new EmbedBuilder()
|
|
42
|
+
* .addFields(fields);
|
|
43
|
+
* ```
|
|
44
|
+
*
|
|
45
|
+
* @example
|
|
46
|
+
* Using rest parameters (variadic)
|
|
47
|
+
* ```ts
|
|
48
|
+
* const embed = new EmbedBuilder()
|
|
49
|
+
* .addFields(
|
|
50
|
+
* { name: 'Field 1', value: 'Value 1' },
|
|
51
|
+
* { name: 'Field 2', value: 'Value 2' },
|
|
52
|
+
* );
|
|
53
|
+
* ```
|
|
32
54
|
*
|
|
33
55
|
* @param fields The fields to add
|
|
34
56
|
*/
|
|
35
57
|
addFields(...fields: RestOrArray<APIEmbedField>): this;
|
|
36
58
|
/**
|
|
37
|
-
* Removes, replaces, or inserts fields in the embed
|
|
59
|
+
* Removes, replaces, or inserts fields in the embed.
|
|
60
|
+
*
|
|
61
|
+
* @remarks
|
|
62
|
+
* This method behaves similarly
|
|
63
|
+
* to {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/slice | Array.prototype.splice}.
|
|
64
|
+
* The maximum amount of fields that can be added is 25.
|
|
65
|
+
*
|
|
66
|
+
* It's useful for modifying and adjusting order of the already-existing fields of an embed.
|
|
67
|
+
*
|
|
68
|
+
* @example
|
|
69
|
+
* Remove the first field
|
|
70
|
+
* ```ts
|
|
71
|
+
* embed.spliceFields(0, 1);
|
|
72
|
+
* ```
|
|
73
|
+
*
|
|
74
|
+
* @example
|
|
75
|
+
* Remove the first n fields
|
|
76
|
+
* ```ts
|
|
77
|
+
* const n = 4
|
|
78
|
+
* embed.spliceFields(0, n);
|
|
79
|
+
* ```
|
|
80
|
+
*
|
|
81
|
+
* @example
|
|
82
|
+
* Remove the last field
|
|
83
|
+
* ```ts
|
|
84
|
+
* embed.spliceFields(-1, 1);
|
|
85
|
+
* ```
|
|
38
86
|
*
|
|
39
87
|
* @param index The index to start at
|
|
40
88
|
* @param deleteCount The number of fields to remove
|
|
@@ -42,7 +90,14 @@ export declare class EmbedBuilder {
|
|
|
42
90
|
*/
|
|
43
91
|
spliceFields(index: number, deleteCount: number, ...fields: APIEmbedField[]): this;
|
|
44
92
|
/**
|
|
45
|
-
* Sets the embed's fields
|
|
93
|
+
* Sets the embed's fields
|
|
94
|
+
*
|
|
95
|
+
* @remarks
|
|
96
|
+
* This method is an alias for {@link EmbedBuilder.spliceFields}. More specifically,
|
|
97
|
+
* it splices the entire array of fields, replacing them with the provided fields.
|
|
98
|
+
*
|
|
99
|
+
* You can set a maximum of 25 fields.
|
|
100
|
+
*
|
|
46
101
|
* @param fields The fields to set
|
|
47
102
|
*/
|
|
48
103
|
setFields(...fields: RestOrArray<APIEmbedField>): this;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Embed.d.ts","sourceRoot":"","sources":["../../../src/messages/embed/Embed.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,cAAc,EAAE,aAAa,EAAE,cAAc,EAAE,aAAa,E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IACI,cAAc,CAAC,WAAW,EAAE,MAAM,GAAG,IAAI,GAAG,IAAI;IAQvD;;;;OAIG;IACI,SAAS,CAAC,OAAO,EAAE,kBAAkB,GAAG,IAAI,GAAG,IAAI;IAa1D;;;;OAIG;IACI,QAAQ,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,GAAG,IAAI;IAQzC;;;;OAIG;IACI,YAAY,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,GAAG,IAAI;IAQ7C;;;;OAIG;IACI,YAAY,CAAC,SAAS,GAAE,MAAM,GAAG,IAAI,GAAG,IAAiB,GAAG,IAAI;IAQvE;;;;OAIG;IACI,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,GAAG,IAAI;IAQ3C;;;;OAIG;IACI,MAAM,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,GAAG,IAAI;IAQvC;;OAEG;IACI,MAAM,IAAI,QAAQ;CAGzB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Embed.mjs","sources":["../../../src/messages/embed/Embed.ts"],"sourcesContent":["import type { APIEmbed, APIEmbedAuthor, APIEmbedField, APIEmbedFooter, APIEmbedImage } from 'discord-api-types/v10';\nimport {\n\tcolorPredicate,\n\tdescriptionPredicate,\n\tembedAuthorPredicate,\n\tembedFieldsArrayPredicate,\n\tembedFooterPredicate,\n\timageURLPredicate,\n\ttimestampPredicate,\n\ttitlePredicate,\n\turlPredicate,\n\tvalidateFieldLength,\n} from './Assertions';\nimport { normalizeArray, type RestOrArray } from '../../util/normalizeArray';\n\nexport type RGBTuple = [red: number, green: number, blue: number];\n\nexport interface IconData {\n\t/**\n\t * The URL of the icon\n\t */\n\ticonURL?: string;\n\t/**\n\t * The proxy URL of the icon\n\t */\n\tproxyIconURL?: string;\n}\n\nexport type EmbedAuthorData = Omit<APIEmbedAuthor, 'icon_url' | 'proxy_icon_url'> & IconData;\n\nexport type EmbedAuthorOptions = Omit<EmbedAuthorData, 'proxyIconURL'>;\n\nexport type EmbedFooterData = Omit<APIEmbedFooter, 'icon_url' | 'proxy_icon_url'> & IconData;\n\nexport type EmbedFooterOptions = Omit<EmbedFooterData, 'proxyIconURL'>;\n\nexport interface EmbedImageData extends Omit<APIEmbedImage, 'proxy_url'> {\n\t/**\n\t * The proxy URL for the image\n\t */\n\tproxyURL?: string;\n}\n/**\n * Represents a embed in a message (image/video preview, rich embed, etc.)\n */\nexport class EmbedBuilder {\n\tpublic readonly data: APIEmbed;\n\n\tpublic constructor(data: APIEmbed = {}) {\n\t\tthis.data = { ...data };\n\t\tif (data.timestamp) this.data.timestamp = new Date(data.timestamp).toISOString();\n\t}\n\n\t/**\n\t * Adds fields to the embed (max 25)\n\t *\n\t * @param fields The fields to add\n\t */\n\tpublic addFields(...fields: RestOrArray<APIEmbedField>): this {\n\t\tfields = normalizeArray(fields);\n\t\t// Ensure adding these fields won't exceed the 25 field limit\n\t\tvalidateFieldLength(fields.length, this.data.fields);\n\n\t\t// Data assertions\n\t\tembedFieldsArrayPredicate.parse(fields);\n\n\t\tif (this.data.fields) this.data.fields.push(...fields);\n\t\telse this.data.fields = fields;\n\t\treturn this;\n\t}\n\n\t/**\n\t * Removes, replaces, or inserts fields in the embed (max 25)\n\t *\n\t * @param index The index to start at\n\t * @param deleteCount The number of fields to remove\n\t * @param fields The replacing field objects\n\t */\n\tpublic spliceFields(index: number, deleteCount: number, ...fields: APIEmbedField[]): this {\n\t\t// Ensure adding these fields won't exceed the 25 field limit\n\t\tvalidateFieldLength(fields.length - deleteCount, this.data.fields);\n\n\t\t// Data assertions\n\t\tembedFieldsArrayPredicate.parse(fields);\n\t\tif (this.data.fields) this.data.fields.splice(index, deleteCount, ...fields);\n\t\telse this.data.fields = fields;\n\t\treturn this;\n\t}\n\n\t/**\n\t * Sets the embed's fields (max 25).\n\t * @param fields The fields to set\n\t */\n\tpublic setFields(...fields: RestOrArray<APIEmbedField>) {\n\t\tthis.spliceFields(0, this.data.fields?.length ?? 0, ...normalizeArray(fields));\n\t\treturn this;\n\t}\n\n\t/**\n\t * Sets the author of this embed\n\t *\n\t * @param options The options for the author\n\t */\n\n\tpublic setAuthor(options: EmbedAuthorOptions | null): this {\n\t\tif (options === null) {\n\t\t\tthis.data.author = undefined;\n\t\t\treturn this;\n\t\t}\n\n\t\t// Data assertions\n\t\tembedAuthorPredicate.parse(options);\n\n\t\tthis.data.author = { name: options.name, url: options.url, icon_url: options.iconURL };\n\t\treturn this;\n\t}\n\n\t/**\n\t * Sets the color of this embed\n\t *\n\t * @param color The color of the embed\n\t */\n\tpublic setColor(color: number | RGBTuple | null): this {\n\t\t// Data assertions\n\t\tcolorPredicate.parse(color);\n\n\t\tif (Array.isArray(color)) {\n\t\t\tconst [red, green, blue] = color;\n\t\t\tthis.data.color = (red << 16) + (green << 8) + blue;\n\t\t\treturn this;\n\t\t}\n\t\tthis.data.color = color ?? undefined;\n\t\treturn this;\n\t}\n\n\t/**\n\t * Sets the description of this embed\n\t *\n\t * @param description The description\n\t */\n\tpublic setDescription(description: string | null): this {\n\t\t// Data assertions\n\t\tdescriptionPredicate.parse(description);\n\n\t\tthis.data.description = description ?? undefined;\n\t\treturn this;\n\t}\n\n\t/**\n\t * Sets the footer of this embed\n\t *\n\t * @param options The options for the footer\n\t */\n\tpublic setFooter(options: EmbedFooterOptions | null): this {\n\t\tif (options === null) {\n\t\t\tthis.data.footer = undefined;\n\t\t\treturn this;\n\t\t}\n\n\t\t// Data assertions\n\t\tembedFooterPredicate.parse(options);\n\n\t\tthis.data.footer = { text: options.text, icon_url: options.iconURL };\n\t\treturn this;\n\t}\n\n\t/**\n\t * Sets the image of this embed\n\t *\n\t * @param url The URL of the image\n\t */\n\tpublic setImage(url: string | null): this {\n\t\t// Data assertions\n\t\timageURLPredicate.parse(url);\n\n\t\tthis.data.image = url ? { url } : undefined;\n\t\treturn this;\n\t}\n\n\t/**\n\t * Sets the thumbnail of this embed\n\t *\n\t * @param url The URL of the thumbnail\n\t */\n\tpublic setThumbnail(url: string | null): this {\n\t\t// Data assertions\n\t\timageURLPredicate.parse(url);\n\n\t\tthis.data.thumbnail = url ? { url } : undefined;\n\t\treturn this;\n\t}\n\n\t/**\n\t * Sets the timestamp of this embed\n\t *\n\t * @param timestamp The timestamp or date\n\t */\n\tpublic setTimestamp(timestamp: number | Date | null = Date.now()): this {\n\t\t// Data assertions\n\t\ttimestampPredicate.parse(timestamp);\n\n\t\tthis.data.timestamp = timestamp ? new Date(timestamp).toISOString() : undefined;\n\t\treturn this;\n\t}\n\n\t/**\n\t * Sets the title of this embed\n\t *\n\t * @param title The title\n\t */\n\tpublic setTitle(title: string | null): this {\n\t\t// Data assertions\n\t\ttitlePredicate.parse(title);\n\n\t\tthis.data.title = title ?? undefined;\n\t\treturn this;\n\t}\n\n\t/**\n\t * Sets the URL of this embed\n\t *\n\t * @param url The URL\n\t */\n\tpublic setURL(url: string | null): this {\n\t\t// Data assertions\n\t\turlPredicate.parse(url);\n\n\t\tthis.data.url = url ?? undefined;\n\t\treturn this;\n\t}\n\n\t/**\n\t * Transforms the embed to a plain object\n\t */\n\tpublic toJSON(): APIEmbed {\n\t\treturn { ...this.data };\n\t}\n}\n"],"names":[],"mappings":";;;AAaO,MAAM,YAAY,CAAC;AAC1B,EAAE,WAAW,CAAC,IAAI,GAAG,EAAE,EAAE;AACzB,IAAI,IAAI,CAAC,IAAI,GAAG,EAAE,GAAG,IAAI,EAAE,CAAC;AAC5B,IAAI,IAAI,IAAI,CAAC,SAAS;AACtB,MAAM,IAAI,CAAC,IAAI,CAAC,SAAS,GAAG,IAAI,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,WAAW,EAAE,CAAC;AACnE,GAAG;AACH,EAAE,SAAS,CAAC,GAAG,MAAM,EAAE;AACvB,IAAI,MAAM,GAAG,cAAc,CAAC,MAAM,CAAC,CAAC;AACpC,IAAI,mBAAmB,CAAC,MAAM,CAAC,MAAM,EAAE,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;AACz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AAI,IAAI,CAAC,IAAI,CAAC,GAAG,GAAG,GAAG,IAAI,KAAK,CAAC,CAAC;AAClC,IAAI,OAAO,IAAI,CAAC;AAChB,GAAG;AACH,EAAE,MAAM,GAAG;AACX,IAAI,OAAO,EAAE,GAAG,IAAI,CAAC,IAAI,EAAE,CAAC;AAC5B,GAAG;AACH;;;;"}
|
|
1
|
+
{"version":3,"file":"Embed.mjs","sources":["../../../src/messages/embed/Embed.ts"],"sourcesContent":["import type { APIEmbed, APIEmbedAuthor, APIEmbedField, APIEmbedFooter, APIEmbedImage } from 'discord-api-types/v10';\nimport {\n\tcolorPredicate,\n\tdescriptionPredicate,\n\tembedAuthorPredicate,\n\tembedFieldsArrayPredicate,\n\tembedFooterPredicate,\n\timageURLPredicate,\n\ttimestampPredicate,\n\ttitlePredicate,\n\turlPredicate,\n\tvalidateFieldLength,\n} from './Assertions';\nimport { normalizeArray, type RestOrArray } from '../../util/normalizeArray';\n\nexport type RGBTuple = [red: number, green: number, blue: number];\n\nexport interface IconData {\n\t/**\n\t * The URL of the icon\n\t */\n\ticonURL?: string;\n\t/**\n\t * The proxy URL of the icon\n\t */\n\tproxyIconURL?: string;\n}\n\nexport type EmbedAuthorData = Omit<APIEmbedAuthor, 'icon_url' | 'proxy_icon_url'> & IconData;\n\nexport type EmbedAuthorOptions = Omit<EmbedAuthorData, 'proxyIconURL'>;\n\nexport type EmbedFooterData = Omit<APIEmbedFooter, 'icon_url' | 'proxy_icon_url'> & IconData;\n\nexport type EmbedFooterOptions = Omit<EmbedFooterData, 'proxyIconURL'>;\n\nexport interface EmbedImageData extends Omit<APIEmbedImage, 'proxy_url'> {\n\t/**\n\t * The proxy URL for the image\n\t */\n\tproxyURL?: string;\n}\n/**\n * Represents a embed in a message (image/video preview, rich embed, etc.)\n */\nexport class EmbedBuilder {\n\tpublic readonly data: APIEmbed;\n\n\tpublic constructor(data: APIEmbed = {}) {\n\t\tthis.data = { ...data };\n\t\tif (data.timestamp) this.data.timestamp = new Date(data.timestamp).toISOString();\n\t}\n\n\t/**\n\t * Appends fields to the embed\n\t *\n\t * @remarks\n\t * This method accepts either an array of fields or a variable number of field parameters.\n\t * The maximum amount of fields that can be added is 25.\n\t *\n\t * @example\n\t * Using an array\n\t * ```ts\n\t * const fields: APIEmbedField[] = ...;\n\t * const embed = new EmbedBuilder()\n\t * \t.addFields(fields);\n\t * ```\n\t *\n\t * @example\n\t * Using rest parameters (variadic)\n\t * ```ts\n\t * const embed = new EmbedBuilder()\n\t * \t.addFields(\n\t * \t\t{ name: 'Field 1', value: 'Value 1' },\n\t * \t\t{ name: 'Field 2', value: 'Value 2' },\n\t * \t);\n\t * ```\n\t *\n\t * @param fields The fields to add\n\t */\n\tpublic addFields(...fields: RestOrArray<APIEmbedField>): this {\n\t\tfields = normalizeArray(fields);\n\t\t// Ensure adding these fields won't exceed the 25 field limit\n\t\tvalidateFieldLength(fields.length, this.data.fields);\n\n\t\t// Data assertions\n\t\tembedFieldsArrayPredicate.parse(fields);\n\n\t\tif (this.data.fields) this.data.fields.push(...fields);\n\t\telse this.data.fields = fields;\n\t\treturn this;\n\t}\n\n\t/**\n\t * Removes, replaces, or inserts fields in the embed.\n\t *\n\t * @remarks\n\t * This method behaves similarly\n\t * to {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/slice | Array.prototype.splice}.\n\t * The maximum amount of fields that can be added is 25.\n\t *\n\t * It's useful for modifying and adjusting order of the already-existing fields of an embed.\n\t *\n\t * @example\n\t * Remove the first field\n\t * ```ts\n\t * embed.spliceFields(0, 1);\n\t * ```\n\t *\n\t * @example\n\t * Remove the first n fields\n\t * ```ts\n\t * const n = 4\n\t * embed.spliceFields(0, n);\n\t * ```\n\t *\n\t * @example\n\t * Remove the last field\n\t * ```ts\n\t * embed.spliceFields(-1, 1);\n\t * ```\n\t *\n\t * @param index The index to start at\n\t * @param deleteCount The number of fields to remove\n\t * @param fields The replacing field objects\n\t */\n\tpublic spliceFields(index: number, deleteCount: number, ...fields: APIEmbedField[]): this {\n\t\t// Ensure adding these fields won't exceed the 25 field limit\n\t\tvalidateFieldLength(fields.length - deleteCount, this.data.fields);\n\n\t\t// Data assertions\n\t\tembedFieldsArrayPredicate.parse(fields);\n\t\tif (this.data.fields) this.data.fields.splice(index, deleteCount, ...fields);\n\t\telse this.data.fields = fields;\n\t\treturn this;\n\t}\n\n\t/**\n\t * Sets the embed's fields\n\t *\n\t * @remarks\n\t * This method is an alias for {@link EmbedBuilder.spliceFields}. More specifically,\n\t * it splices the entire array of fields, replacing them with the provided fields.\n\t *\n\t * You can set a maximum of 25 fields.\n\t *\n\t * @param fields The fields to set\n\t */\n\tpublic setFields(...fields: RestOrArray<APIEmbedField>) {\n\t\tthis.spliceFields(0, this.data.fields?.length ?? 0, ...normalizeArray(fields));\n\t\treturn this;\n\t}\n\n\t/**\n\t * Sets the author of this embed\n\t *\n\t * @param options The options for the author\n\t */\n\n\tpublic setAuthor(options: EmbedAuthorOptions | null): this {\n\t\tif (options === null) {\n\t\t\tthis.data.author = undefined;\n\t\t\treturn this;\n\t\t}\n\n\t\t// Data assertions\n\t\tembedAuthorPredicate.parse(options);\n\n\t\tthis.data.author = { name: options.name, url: options.url, icon_url: options.iconURL };\n\t\treturn this;\n\t}\n\n\t/**\n\t * Sets the color of this embed\n\t *\n\t * @param color The color of the embed\n\t */\n\tpublic setColor(color: number | RGBTuple | null): this {\n\t\t// Data assertions\n\t\tcolorPredicate.parse(color);\n\n\t\tif (Array.isArray(color)) {\n\t\t\tconst [red, green, blue] = color;\n\t\t\tthis.data.color = (red << 16) + (green << 8) + blue;\n\t\t\treturn this;\n\t\t}\n\t\tthis.data.color = color ?? undefined;\n\t\treturn this;\n\t}\n\n\t/**\n\t * Sets the description of this embed\n\t *\n\t * @param description The description\n\t */\n\tpublic setDescription(description: string | null): this {\n\t\t// Data assertions\n\t\tdescriptionPredicate.parse(description);\n\n\t\tthis.data.description = description ?? undefined;\n\t\treturn this;\n\t}\n\n\t/**\n\t * Sets the footer of this embed\n\t *\n\t * @param options The options for the footer\n\t */\n\tpublic setFooter(options: EmbedFooterOptions | null): this {\n\t\tif (options === null) {\n\t\t\tthis.data.footer = undefined;\n\t\t\treturn this;\n\t\t}\n\n\t\t// Data assertions\n\t\tembedFooterPredicate.parse(options);\n\n\t\tthis.data.footer = { text: options.text, icon_url: options.iconURL };\n\t\treturn this;\n\t}\n\n\t/**\n\t * Sets the image of this embed\n\t *\n\t * @param url The URL of the image\n\t */\n\tpublic setImage(url: string | null): this {\n\t\t// Data assertions\n\t\timageURLPredicate.parse(url);\n\n\t\tthis.data.image = url ? { url } : undefined;\n\t\treturn this;\n\t}\n\n\t/**\n\t * Sets the thumbnail of this embed\n\t *\n\t * @param url The URL of the thumbnail\n\t */\n\tpublic setThumbnail(url: string | null): this {\n\t\t// Data assertions\n\t\timageURLPredicate.parse(url);\n\n\t\tthis.data.thumbnail = url ? { url } : undefined;\n\t\treturn this;\n\t}\n\n\t/**\n\t * Sets the timestamp of this embed\n\t *\n\t * @param timestamp The timestamp or date\n\t */\n\tpublic setTimestamp(timestamp: number | Date | null = Date.now()): this {\n\t\t// Data assertions\n\t\ttimestampPredicate.parse(timestamp);\n\n\t\tthis.data.timestamp = timestamp ? new Date(timestamp).toISOString() : undefined;\n\t\treturn this;\n\t}\n\n\t/**\n\t * Sets the title of this embed\n\t *\n\t * @param title The title\n\t */\n\tpublic setTitle(title: string | null): this {\n\t\t// Data assertions\n\t\ttitlePredicate.parse(title);\n\n\t\tthis.data.title = title ?? undefined;\n\t\treturn this;\n\t}\n\n\t/**\n\t * Sets the URL of this embed\n\t *\n\t * @param url The URL\n\t */\n\tpublic setURL(url: string | null): this {\n\t\t// Data assertions\n\t\turlPredicate.parse(url);\n\n\t\tthis.data.url = url ?? undefined;\n\t\treturn this;\n\t}\n\n\t/**\n\t * Transforms the embed to a plain object\n\t */\n\tpublic toJSON(): APIEmbed {\n\t\treturn { ...this.data };\n\t}\n}\n"],"names":[],"mappings":";;;A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CAAC,CAAC;AACxC,IAAI,IAAI,CAAC,IAAI,CAAC,SAAS,GAAG,SAAS,GAAG,IAAI,IAAI,CAAC,SAAS,CAAC,CAAC,WAAW,EAAE,GAAG,KAAK,CAAC,CAAC;AACjF,IAAI,OAAO,IAAI,CAAC;AAChB,GAAG;AACH,EAAE,QAAQ,CAAC,KAAK,EAAE;AAClB,IAAI,cAAc,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;AAChC,IAAI,IAAI,CAAC,IAAI,CAAC,KAAK,GAAG,KAAK,IAAI,KAAK,CAAC,CAAC;AACtC,IAAI,OAAO,IAAI,CAAC;AAChB,GAAG;AACH,EAAE,MAAM,CAAC,GAAG,EAAE;AACd,IAAI,YAAY,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;AAC5B,IAAI,IAAI,CAAC,IAAI,CAAC,GAAG,GAAG,GAAG,IAAI,KAAK,CAAC,CAAC;AAClC,IAAI,OAAO,IAAI,CAAC;AAChB,GAAG;AACH,EAAE,MAAM,GAAG;AACX,IAAI,OAAO,EAAE,GAAG,IAAI,CAAC,IAAI,EAAE,CAAC;AAC5B,GAAG;AACH;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"equatable.cjs","sources":["../../src/util/equatable.ts"],"sourcesContent":["
|
|
1
|
+
{"version":3,"file":"equatable.cjs","sources":["../../src/util/equatable.ts"],"sourcesContent":["/**\n * Represents a structure that can be checked against another\n * given structure for equality\n *\n * @typeParam T - The type of object to compare the current object to\n */\nexport interface Equatable<T> {\n\t/**\n\t * Whether or not this is equal to another structure\n\t */\n\tequals: (other: T) => boolean;\n}\n\n/**\n * Indicates if an object is equatable or not.\n * @param maybeEquatable - The object to check against\n */\nexport function isEquatable(maybeEquatable: unknown): maybeEquatable is Equatable<unknown> {\n\treturn maybeEquatable !== null && typeof maybeEquatable === 'object' && 'equals' in maybeEquatable;\n}\n"],"names":[],"mappings":";;;;AAAO,SAAS,WAAW,CAAC,cAAc,EAAE;AAC5C,EAAE,OAAO,cAAc,KAAK,IAAI,IAAI,OAAO,cAAc,KAAK,QAAQ,IAAI,QAAQ,IAAI,cAAc,CAAC;AACrG;;;;"}
|
package/dist/util/equatable.d.ts
CHANGED
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Represents a structure that can be checked against another
|
|
3
|
+
* given structure for equality
|
|
4
|
+
*
|
|
5
|
+
* @typeParam T - The type of object to compare the current object to
|
|
6
|
+
*/
|
|
1
7
|
export interface Equatable<T> {
|
|
2
8
|
/**
|
|
3
9
|
* Whether or not this is equal to another structure
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"equatable.d.ts","sourceRoot":"","sources":["../../src/util/equatable.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,SAAS,CAAC,CAAC;IAC3B;;OAEG;IACH,MAAM,EAAE,CAAC,KAAK,EAAE,CAAC,KAAK,OAAO,CAAC;CAC9B;AAED;;;GAGG;AACH,wBAAgB,WAAW,CAAC,cAAc,EAAE,OAAO,GAAG,cAAc,IAAI,SAAS,CAAC,OAAO,CAAC,CAEzF"}
|
|
1
|
+
{"version":3,"file":"equatable.d.ts","sourceRoot":"","sources":["../../src/util/equatable.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,MAAM,WAAW,SAAS,CAAC,CAAC;IAC3B;;OAEG;IACH,MAAM,EAAE,CAAC,KAAK,EAAE,CAAC,KAAK,OAAO,CAAC;CAC9B;AAED;;;GAGG;AACH,wBAAgB,WAAW,CAAC,cAAc,EAAE,OAAO,GAAG,cAAc,IAAI,SAAS,CAAC,OAAO,CAAC,CAEzF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"equatable.mjs","sources":["../../src/util/equatable.ts"],"sourcesContent":["
|
|
1
|
+
{"version":3,"file":"equatable.mjs","sources":["../../src/util/equatable.ts"],"sourcesContent":["/**\n * Represents a structure that can be checked against another\n * given structure for equality\n *\n * @typeParam T - The type of object to compare the current object to\n */\nexport interface Equatable<T> {\n\t/**\n\t * Whether or not this is equal to another structure\n\t */\n\tequals: (other: T) => boolean;\n}\n\n/**\n * Indicates if an object is equatable or not.\n * @param maybeEquatable - The object to check against\n */\nexport function isEquatable(maybeEquatable: unknown): maybeEquatable is Equatable<unknown> {\n\treturn maybeEquatable !== null && typeof maybeEquatable === 'object' && 'equals' in maybeEquatable;\n}\n"],"names":[],"mappings":"AAAO,SAAS,WAAW,CAAC,cAAc,EAAE;AAC5C,EAAE,OAAO,cAAc,KAAK,IAAI,IAAI,OAAO,cAAc,KAAK,QAAQ,IAAI,QAAQ,IAAI,cAAc,CAAC;AACrG;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"jsonEncodable.cjs","sources":["../../src/util/jsonEncodable.ts"],"sourcesContent":["
|
|
1
|
+
{"version":3,"file":"jsonEncodable.cjs","sources":["../../src/util/jsonEncodable.ts"],"sourcesContent":["/**\n * Represents an object capable of representing itself as a JSON object\n *\n * @typeParam T - The JSON type corresponding to {@link JSONEncodable.toJSON} outputs.\n */\nexport interface JSONEncodable<T> {\n\t/**\n\t * Transforms this object to its JSON format\n\t */\n\ttoJSON: () => T;\n}\n\n/**\n * Indicates if an object is encodable or not.\n * @param maybeEncodable - The object to check against\n */\nexport function isJSONEncodable(maybeEncodable: unknown): maybeEncodable is JSONEncodable<unknown> {\n\treturn maybeEncodable !== null && typeof maybeEncodable === 'object' && 'toJSON' in maybeEncodable;\n}\n"],"names":[],"mappings":";;;;AAAO,SAAS,eAAe,CAAC,cAAc,EAAE;AAChD,EAAE,OAAO,cAAc,KAAK,IAAI,IAAI,OAAO,cAAc,KAAK,QAAQ,IAAI,QAAQ,IAAI,cAAc,CAAC;AACrG;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"jsonEncodable.d.ts","sourceRoot":"","sources":["../../src/util/jsonEncodable.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,aAAa,CAAC,CAAC;IAC/B;;OAEG;IACH,MAAM,EAAE,MAAM,CAAC,CAAC;CAChB;AAED;;;GAGG;AACH,wBAAgB,eAAe,CAAC,cAAc,EAAE,OAAO,GAAG,cAAc,IAAI,aAAa,CAAC,OAAO,CAAC,CAEjG"}
|
|
1
|
+
{"version":3,"file":"jsonEncodable.d.ts","sourceRoot":"","sources":["../../src/util/jsonEncodable.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,MAAM,WAAW,aAAa,CAAC,CAAC;IAC/B;;OAEG;IACH,MAAM,EAAE,MAAM,CAAC,CAAC;CAChB;AAED;;;GAGG;AACH,wBAAgB,eAAe,CAAC,cAAc,EAAE,OAAO,GAAG,cAAc,IAAI,aAAa,CAAC,OAAO,CAAC,CAEjG"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"jsonEncodable.mjs","sources":["../../src/util/jsonEncodable.ts"],"sourcesContent":["
|
|
1
|
+
{"version":3,"file":"jsonEncodable.mjs","sources":["../../src/util/jsonEncodable.ts"],"sourcesContent":["/**\n * Represents an object capable of representing itself as a JSON object\n *\n * @typeParam T - The JSON type corresponding to {@link JSONEncodable.toJSON} outputs.\n */\nexport interface JSONEncodable<T> {\n\t/**\n\t * Transforms this object to its JSON format\n\t */\n\ttoJSON: () => T;\n}\n\n/**\n * Indicates if an object is encodable or not.\n * @param maybeEncodable - The object to check against\n */\nexport function isJSONEncodable(maybeEncodable: unknown): maybeEncodable is JSONEncodable<unknown> {\n\treturn maybeEncodable !== null && typeof maybeEncodable === 'object' && 'toJSON' in maybeEncodable;\n}\n"],"names":[],"mappings":"AAAO,SAAS,eAAe,CAAC,cAAc,EAAE;AAChD,EAAE,OAAO,cAAc,KAAK,IAAI,IAAI,OAAO,cAAc,KAAK,QAAQ,IAAI,QAAQ,IAAI,cAAc,CAAC;AACrG;;;;"}
|
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@discordjs/builders",
|
|
3
|
-
"version": "1.2.0-dev.
|
|
3
|
+
"version": "1.2.0-dev.1660910631-e475b63.0",
|
|
4
4
|
"description": "A set of builders that you can use when creating your bot",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"test": "vitest run",
|
|
7
7
|
"build": "unbuild",
|
|
8
|
-
"lint": "prettier --check . && eslint src __tests__ --ext mjs,js,ts",
|
|
9
|
-
"format": "prettier --write . && eslint src __tests__ --ext mjs,js,ts --fix",
|
|
8
|
+
"lint": "prettier --check . && TIMING=1 eslint src __tests__ --ext mjs,js,ts",
|
|
9
|
+
"format": "prettier --write . && TIMING=1 eslint src __tests__ --ext mjs,js,ts --fix",
|
|
10
10
|
"fmt": "yarn format",
|
|
11
11
|
"docs": "downlevel-dts . docs --to=3.7 && docgen -i src/index.ts -c docs/index.json -o docs/docs.json --typescript && api-extractor run --local",
|
|
12
12
|
"prepack": "yarn lint && yarn test && yarn build",
|
|
@@ -61,18 +61,24 @@
|
|
|
61
61
|
"tslib": "^2.4.0"
|
|
62
62
|
},
|
|
63
63
|
"devDependencies": {
|
|
64
|
-
"@discordjs/docgen": "^0.12.
|
|
64
|
+
"@discordjs/docgen": "^0.12.1",
|
|
65
65
|
"@favware/cliff-jumper": "^1.8.6",
|
|
66
66
|
"@microsoft/api-extractor": "^7.29.2",
|
|
67
|
-
"@types/node": "^16.11.
|
|
68
|
-
"
|
|
67
|
+
"@types/node": "^16.11.48",
|
|
68
|
+
"@typescript-eslint/eslint-plugin": "^5.33.0",
|
|
69
|
+
"@typescript-eslint/parser": "^5.33.0",
|
|
70
|
+
"@vitest/coverage-c8": "^0.22.0",
|
|
69
71
|
"downlevel-dts": "^0.10.0",
|
|
70
|
-
"eslint": "^8.
|
|
72
|
+
"eslint": "^8.22.0",
|
|
73
|
+
"eslint-config-marine": "^9.4.1",
|
|
74
|
+
"eslint-config-prettier": "^8.5.0",
|
|
75
|
+
"eslint-import-resolver-typescript": "^3.4.1",
|
|
76
|
+
"eslint-plugin-import": "^2.26.0",
|
|
71
77
|
"prettier": "^2.7.1",
|
|
72
78
|
"rollup-plugin-typescript2": "0.32.1",
|
|
73
79
|
"typescript": "^4.7.4",
|
|
74
|
-
"unbuild": "^0.8.
|
|
75
|
-
"vitest": "^0.
|
|
80
|
+
"unbuild": "^0.8.8",
|
|
81
|
+
"vitest": "^0.22.0"
|
|
76
82
|
},
|
|
77
83
|
"engines": {
|
|
78
84
|
"node": ">=16.9.0"
|