@discordjs/builders 1.2.1-dev.1661947462-4bdb059.0 → 1.2.1-dev.1662077397-8a91d7c.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.
Files changed (158) hide show
  1. package/dist/components/ActionRow.cjs +2 -2
  2. package/dist/components/ActionRow.cjs.map +1 -1
  3. package/dist/components/ActionRow.d.ts +8 -8
  4. package/dist/components/ActionRow.d.ts.map +1 -1
  5. package/dist/components/ActionRow.mjs +2 -2
  6. package/dist/components/ActionRow.mjs.map +1 -1
  7. package/dist/components/Assertions.cjs +1 -1
  8. package/dist/components/Assertions.cjs.map +1 -1
  9. package/dist/components/Assertions.d.ts +2 -2
  10. package/dist/components/Assertions.d.ts.map +1 -1
  11. package/dist/components/Assertions.mjs +1 -1
  12. package/dist/components/Assertions.mjs.map +1 -1
  13. package/dist/components/Component.cjs.map +1 -1
  14. package/dist/components/Component.d.ts +1 -1
  15. package/dist/components/Component.d.ts.map +1 -1
  16. package/dist/components/Component.mjs.map +1 -1
  17. package/dist/components/Components.cjs.map +1 -1
  18. package/dist/components/Components.d.ts +6 -6
  19. package/dist/components/Components.d.ts.map +1 -1
  20. package/dist/components/Components.mjs.map +1 -1
  21. package/dist/components/button/Button.cjs.map +1 -1
  22. package/dist/components/button/Button.d.ts +3 -6
  23. package/dist/components/button/Button.d.ts.map +1 -1
  24. package/dist/components/button/Button.mjs.map +1 -1
  25. package/dist/components/selectMenu/SelectMenu.cjs +3 -3
  26. package/dist/components/selectMenu/SelectMenu.cjs.map +1 -1
  27. package/dist/components/selectMenu/SelectMenu.d.ts +6 -6
  28. package/dist/components/selectMenu/SelectMenu.d.ts.map +1 -1
  29. package/dist/components/selectMenu/SelectMenu.mjs +3 -3
  30. package/dist/components/selectMenu/SelectMenu.mjs.map +1 -1
  31. package/dist/components/selectMenu/SelectMenuOption.cjs.map +1 -1
  32. package/dist/components/selectMenu/SelectMenuOption.d.ts +1 -1
  33. package/dist/components/selectMenu/SelectMenuOption.d.ts.map +1 -1
  34. package/dist/components/selectMenu/SelectMenuOption.mjs.map +1 -1
  35. package/dist/components/textInput/Assertions.cjs.map +1 -1
  36. package/dist/components/textInput/Assertions.d.ts.map +1 -1
  37. package/dist/components/textInput/Assertions.mjs.map +1 -1
  38. package/dist/components/textInput/TextInput.cjs +1 -1
  39. package/dist/components/textInput/TextInput.cjs.map +1 -1
  40. package/dist/components/textInput/TextInput.d.ts +4 -4
  41. package/dist/components/textInput/TextInput.d.ts.map +1 -1
  42. package/dist/components/textInput/TextInput.mjs +1 -1
  43. package/dist/components/textInput/TextInput.mjs.map +1 -1
  44. package/dist/index.d.ts +39 -39
  45. package/dist/index.d.ts.map +1 -1
  46. package/dist/interactions/contextMenuCommands/Assertions.cjs.map +1 -1
  47. package/dist/interactions/contextMenuCommands/Assertions.d.ts +1 -1
  48. package/dist/interactions/contextMenuCommands/Assertions.d.ts.map +1 -1
  49. package/dist/interactions/contextMenuCommands/Assertions.mjs.map +1 -1
  50. package/dist/interactions/contextMenuCommands/ContextMenuCommandBuilder.cjs +3 -4
  51. package/dist/interactions/contextMenuCommands/ContextMenuCommandBuilder.cjs.map +1 -1
  52. package/dist/interactions/contextMenuCommands/ContextMenuCommandBuilder.d.ts +1 -4
  53. package/dist/interactions/contextMenuCommands/ContextMenuCommandBuilder.d.ts.map +1 -1
  54. package/dist/interactions/contextMenuCommands/ContextMenuCommandBuilder.mjs +3 -4
  55. package/dist/interactions/contextMenuCommands/ContextMenuCommandBuilder.mjs.map +1 -1
  56. package/dist/interactions/modals/Assertions.cjs.map +1 -1
  57. package/dist/interactions/modals/Assertions.d.ts +2 -2
  58. package/dist/interactions/modals/Assertions.d.ts.map +1 -1
  59. package/dist/interactions/modals/Assertions.mjs.map +1 -1
  60. package/dist/interactions/modals/Modal.cjs +2 -2
  61. package/dist/interactions/modals/Modal.cjs.map +1 -1
  62. package/dist/interactions/modals/Modal.d.ts +2 -2
  63. package/dist/interactions/modals/Modal.d.ts.map +1 -1
  64. package/dist/interactions/modals/Modal.mjs +2 -2
  65. package/dist/interactions/modals/Modal.mjs.map +1 -1
  66. package/dist/interactions/slashCommands/Assertions.cjs.map +1 -1
  67. package/dist/interactions/slashCommands/Assertions.d.ts +4 -4
  68. package/dist/interactions/slashCommands/Assertions.d.ts.map +1 -1
  69. package/dist/interactions/slashCommands/Assertions.mjs.map +1 -1
  70. package/dist/interactions/slashCommands/SlashCommandBuilder.cjs.map +1 -1
  71. package/dist/interactions/slashCommands/SlashCommandBuilder.d.ts +5 -8
  72. package/dist/interactions/slashCommands/SlashCommandBuilder.d.ts.map +1 -1
  73. package/dist/interactions/slashCommands/SlashCommandBuilder.mjs.map +1 -1
  74. package/dist/interactions/slashCommands/SlashCommandSubcommands.cjs.map +1 -1
  75. package/dist/interactions/slashCommands/SlashCommandSubcommands.d.ts +5 -5
  76. package/dist/interactions/slashCommands/SlashCommandSubcommands.d.ts.map +1 -1
  77. package/dist/interactions/slashCommands/SlashCommandSubcommands.mjs.map +1 -1
  78. package/dist/interactions/slashCommands/mixins/ApplicationCommandNumericOptionMinMaxValueMixin.cjs.map +1 -1
  79. package/dist/interactions/slashCommands/mixins/ApplicationCommandNumericOptionMinMaxValueMixin.d.ts.map +1 -1
  80. package/dist/interactions/slashCommands/mixins/ApplicationCommandNumericOptionMinMaxValueMixin.mjs.map +1 -1
  81. package/dist/interactions/slashCommands/mixins/ApplicationCommandOptionBase.cjs +1 -1
  82. package/dist/interactions/slashCommands/mixins/ApplicationCommandOptionBase.cjs.map +1 -1
  83. package/dist/interactions/slashCommands/mixins/ApplicationCommandOptionBase.d.ts +1 -1
  84. package/dist/interactions/slashCommands/mixins/ApplicationCommandOptionBase.d.ts.map +1 -1
  85. package/dist/interactions/slashCommands/mixins/ApplicationCommandOptionBase.mjs +1 -1
  86. package/dist/interactions/slashCommands/mixins/ApplicationCommandOptionBase.mjs.map +1 -1
  87. package/dist/interactions/slashCommands/mixins/ApplicationCommandOptionWithChoicesAndAutocompleteMixin.cjs +1 -1
  88. package/dist/interactions/slashCommands/mixins/ApplicationCommandOptionWithChoicesAndAutocompleteMixin.cjs.map +1 -1
  89. package/dist/interactions/slashCommands/mixins/ApplicationCommandOptionWithChoicesAndAutocompleteMixin.d.ts +3 -2
  90. package/dist/interactions/slashCommands/mixins/ApplicationCommandOptionWithChoicesAndAutocompleteMixin.d.ts.map +1 -1
  91. package/dist/interactions/slashCommands/mixins/ApplicationCommandOptionWithChoicesAndAutocompleteMixin.mjs +1 -1
  92. package/dist/interactions/slashCommands/mixins/ApplicationCommandOptionWithChoicesAndAutocompleteMixin.mjs.map +1 -1
  93. package/dist/interactions/slashCommands/mixins/NameAndDescription.cjs +6 -6
  94. package/dist/interactions/slashCommands/mixins/NameAndDescription.cjs.map +1 -1
  95. package/dist/interactions/slashCommands/mixins/NameAndDescription.d.ts.map +1 -1
  96. package/dist/interactions/slashCommands/mixins/NameAndDescription.mjs +6 -6
  97. package/dist/interactions/slashCommands/mixins/NameAndDescription.mjs.map +1 -1
  98. package/dist/interactions/slashCommands/mixins/SharedSlashCommandOptions.cjs.map +1 -1
  99. package/dist/interactions/slashCommands/mixins/SharedSlashCommandOptions.d.ts +12 -12
  100. package/dist/interactions/slashCommands/mixins/SharedSlashCommandOptions.d.ts.map +1 -1
  101. package/dist/interactions/slashCommands/mixins/SharedSlashCommandOptions.mjs.map +1 -1
  102. package/dist/interactions/slashCommands/options/attachment.cjs.map +1 -1
  103. package/dist/interactions/slashCommands/options/attachment.d.ts +2 -2
  104. package/dist/interactions/slashCommands/options/attachment.d.ts.map +1 -1
  105. package/dist/interactions/slashCommands/options/attachment.mjs.map +1 -1
  106. package/dist/interactions/slashCommands/options/boolean.cjs.map +1 -1
  107. package/dist/interactions/slashCommands/options/boolean.d.ts +2 -2
  108. package/dist/interactions/slashCommands/options/boolean.d.ts.map +1 -1
  109. package/dist/interactions/slashCommands/options/boolean.mjs.map +1 -1
  110. package/dist/interactions/slashCommands/options/channel.cjs.map +1 -1
  111. package/dist/interactions/slashCommands/options/channel.d.ts +3 -3
  112. package/dist/interactions/slashCommands/options/channel.d.ts.map +1 -1
  113. package/dist/interactions/slashCommands/options/channel.mjs.map +1 -1
  114. package/dist/interactions/slashCommands/options/integer.cjs.map +1 -1
  115. package/dist/interactions/slashCommands/options/integer.d.ts +4 -4
  116. package/dist/interactions/slashCommands/options/integer.d.ts.map +1 -1
  117. package/dist/interactions/slashCommands/options/integer.mjs.map +1 -1
  118. package/dist/interactions/slashCommands/options/mentionable.cjs.map +1 -1
  119. package/dist/interactions/slashCommands/options/mentionable.d.ts +2 -2
  120. package/dist/interactions/slashCommands/options/mentionable.d.ts.map +1 -1
  121. package/dist/interactions/slashCommands/options/mentionable.mjs.map +1 -1
  122. package/dist/interactions/slashCommands/options/number.cjs.map +1 -1
  123. package/dist/interactions/slashCommands/options/number.d.ts +4 -4
  124. package/dist/interactions/slashCommands/options/number.d.ts.map +1 -1
  125. package/dist/interactions/slashCommands/options/number.mjs.map +1 -1
  126. package/dist/interactions/slashCommands/options/role.cjs.map +1 -1
  127. package/dist/interactions/slashCommands/options/role.d.ts +2 -2
  128. package/dist/interactions/slashCommands/options/role.d.ts.map +1 -1
  129. package/dist/interactions/slashCommands/options/role.mjs.map +1 -1
  130. package/dist/interactions/slashCommands/options/string.cjs.map +1 -1
  131. package/dist/interactions/slashCommands/options/string.d.ts +3 -3
  132. package/dist/interactions/slashCommands/options/string.d.ts.map +1 -1
  133. package/dist/interactions/slashCommands/options/string.mjs.map +1 -1
  134. package/dist/interactions/slashCommands/options/user.cjs.map +1 -1
  135. package/dist/interactions/slashCommands/options/user.d.ts +2 -2
  136. package/dist/interactions/slashCommands/options/user.d.ts.map +1 -1
  137. package/dist/interactions/slashCommands/options/user.mjs.map +1 -1
  138. package/dist/messages/embed/Assertions.cjs.map +1 -1
  139. package/dist/messages/embed/Assertions.mjs.map +1 -1
  140. package/dist/messages/embed/Embed.cjs +1 -1
  141. package/dist/messages/embed/Embed.cjs.map +1 -1
  142. package/dist/messages/embed/Embed.d.ts +5 -13
  143. package/dist/messages/embed/Embed.d.ts.map +1 -1
  144. package/dist/messages/embed/Embed.mjs +1 -1
  145. package/dist/messages/embed/Embed.mjs.map +1 -1
  146. package/dist/messages/formatters.cjs.map +1 -1
  147. package/dist/messages/formatters.d.ts +1 -1
  148. package/dist/messages/formatters.d.ts.map +1 -1
  149. package/dist/messages/formatters.mjs.map +1 -1
  150. package/dist/util/equatable.cjs.map +1 -1
  151. package/dist/util/equatable.d.ts +2 -1
  152. package/dist/util/equatable.d.ts.map +1 -1
  153. package/dist/util/equatable.mjs.map +1 -1
  154. package/dist/util/jsonEncodable.cjs.map +1 -1
  155. package/dist/util/jsonEncodable.d.ts +2 -1
  156. package/dist/util/jsonEncodable.d.ts.map +1 -1
  157. package/dist/util/jsonEncodable.mjs.map +1 -1
  158. package/package.json +2 -8
@@ -3,14 +3,14 @@
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  const v10 = require('discord-api-types/v10');
6
+ const normalizeArray = require('../util/normalizeArray.cjs');
6
7
  const Component = require('./Component.cjs');
7
8
  const Components = require('./Components.cjs');
8
- const normalizeArray = require('../util/normalizeArray.cjs');
9
9
 
10
10
  class ActionRowBuilder extends Component.ComponentBuilder {
11
11
  constructor({ components, ...data } = {}) {
12
12
  super({ type: v10.ComponentType.ActionRow, ...data });
13
- this.components = components?.map((c) => Components.createComponentBuilder(c)) ?? [];
13
+ this.components = components?.map((component) => Components.createComponentBuilder(component)) ?? [];
14
14
  }
15
15
  addComponents(...components) {
16
16
  this.components.push(...normalizeArray.normalizeArray(components));
@@ -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 *\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 ComponentBuilder.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;;;;"}
1
+ {"version":3,"file":"ActionRow.cjs","sources":["../../src/components/ActionRow.ts"],"sourcesContent":["import {\n\ttype APIActionRowComponent,\n\tComponentType,\n\ttype APIMessageActionRowComponent,\n\ttype APIModalActionRowComponent,\n\ttype APIActionRowComponentTypes,\n} from 'discord-api-types/v10';\nimport { normalizeArray, type RestOrArray } from '../util/normalizeArray.js';\nimport { ComponentBuilder } from './Component.js';\nimport { createComponentBuilder } from './Components.js';\nimport type { ButtonBuilder } from './button/Button.js';\nimport type { SelectMenuBuilder } from './selectMenu/SelectMenu.js';\nimport type { TextInputBuilder } from './textInput/TextInput.js';\n\nexport type MessageComponentBuilder =\n\t| ActionRowBuilder<MessageActionRowComponentBuilder>\n\t| MessageActionRowComponentBuilder;\nexport type ModalComponentBuilder = ActionRowBuilder<ModalActionRowComponentBuilder> | 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((component) => createComponentBuilder(component)) ?? []) 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 ComponentBuilder.toJSON}\n\t */\n\tpublic toJSON(): APIActionRowComponent<ReturnType<T['toJSON']>> {\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,SAAS,KAAKC,iCAAsB,CAAC,SAAS,CAAC,CAAC,IAAI,EAAE,CAAC;AAC9F,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,11 +1,11 @@
1
- import { type APIActionRowComponent, APIMessageActionRowComponent, APIModalActionRowComponent, APIActionRowComponentTypes } from 'discord-api-types/v10';
2
- import { ComponentBuilder } from './Component';
3
- import type { ButtonBuilder } from './button/Button';
4
- import type { SelectMenuBuilder } from './selectMenu/SelectMenu';
5
- import type { TextInputBuilder } from './textInput/TextInput';
6
- import { type RestOrArray } from '../util/normalizeArray';
7
- export declare type MessageComponentBuilder = MessageActionRowComponentBuilder | ActionRowBuilder<MessageActionRowComponentBuilder>;
8
- export declare type ModalComponentBuilder = ModalActionRowComponentBuilder | ActionRowBuilder<ModalActionRowComponentBuilder>;
1
+ import { type APIActionRowComponent, type APIMessageActionRowComponent, type APIModalActionRowComponent, type APIActionRowComponentTypes } from 'discord-api-types/v10';
2
+ import { type RestOrArray } from '../util/normalizeArray.js';
3
+ import { ComponentBuilder } from './Component.js';
4
+ import type { ButtonBuilder } from './button/Button.js';
5
+ import type { SelectMenuBuilder } from './selectMenu/SelectMenu.js';
6
+ import type { TextInputBuilder } from './textInput/TextInput.js';
7
+ export declare type MessageComponentBuilder = ActionRowBuilder<MessageActionRowComponentBuilder> | MessageActionRowComponentBuilder;
8
+ export declare type ModalComponentBuilder = ActionRowBuilder<ModalActionRowComponentBuilder> | ModalActionRowComponentBuilder;
9
9
  export declare type MessageActionRowComponentBuilder = ButtonBuilder | SelectMenuBuilder;
10
10
  export declare type ModalActionRowComponentBuilder = TextInputBuilder;
11
11
  export declare type AnyComponentBuilder = MessageActionRowComponentBuilder | ModalActionRowComponentBuilder;
@@ -1 +1 @@
1
- {"version":3,"file":"ActionRow.d.ts","sourceRoot":"","sources":["../../src/components/ActionRow.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,KAAK,qBAAqB,EAE1B,4BAA4B,EAC5B,0BAA0B,EAC1B,0BAA0B,EAC1B,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAE/C,OAAO,KAA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types/v10';
2
+ import { normalizeArray } from '../util/normalizeArray.mjs';
2
3
  import { ComponentBuilder } from './Component.mjs';
3
4
  import { createComponentBuilder } from './Components.mjs';
4
- import { normalizeArray } from '../util/normalizeArray.mjs';
5
5
 
6
6
  class ActionRowBuilder extends ComponentBuilder {
7
7
  constructor({ components, ...data } = {}) {
8
8
  super({ type: ComponentType.ActionRow, ...data });
9
- this.components = components?.map((c) => createComponentBuilder(c)) ?? [];
9
+ this.components = components?.map((component) => createComponentBuilder(component)) ?? [];
10
10
  }
11
11
  addComponents(...components) {
12
12
  this.components.push(...normalizeArray(components));
@@ -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 *\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 ComponentBuilder.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
+ {"version":3,"file":"ActionRow.mjs","sources":["../../src/components/ActionRow.ts"],"sourcesContent":["import {\n\ttype APIActionRowComponent,\n\tComponentType,\n\ttype APIMessageActionRowComponent,\n\ttype APIModalActionRowComponent,\n\ttype APIActionRowComponentTypes,\n} from 'discord-api-types/v10';\nimport { normalizeArray, type RestOrArray } from '../util/normalizeArray.js';\nimport { ComponentBuilder } from './Component.js';\nimport { createComponentBuilder } from './Components.js';\nimport type { ButtonBuilder } from './button/Button.js';\nimport type { SelectMenuBuilder } from './selectMenu/SelectMenu.js';\nimport type { TextInputBuilder } from './textInput/TextInput.js';\n\nexport type MessageComponentBuilder =\n\t| ActionRowBuilder<MessageActionRowComponentBuilder>\n\t| MessageActionRowComponentBuilder;\nexport type ModalComponentBuilder = ActionRowBuilder<ModalActionRowComponentBuilder> | 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((component) => createComponentBuilder(component)) ?? []) 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 ComponentBuilder.toJSON}\n\t */\n\tpublic toJSON(): APIActionRowComponent<ReturnType<T['toJSON']>> {\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,SAAS,KAAK,sBAAsB,CAAC,SAAS,CAAC,CAAC,IAAI,EAAE,CAAC;AAC9F,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;;;;"}
@@ -4,8 +4,8 @@ Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  const shapeshift = require('@sapphire/shapeshift');
6
6
  const v10 = require('discord-api-types/v10');
7
- const SelectMenuOption = require('./selectMenu/SelectMenuOption.cjs');
8
7
  const validation = require('../util/validation.cjs');
8
+ const SelectMenuOption = require('./selectMenu/SelectMenuOption.cjs');
9
9
 
10
10
  const customIdValidator = shapeshift.s.string.lengthGreaterThanOrEqual(1).lengthLessThanOrEqual(100).setValidationEnabled(validation.isValidationEnabled);
11
11
  const emojiValidator = shapeshift.s.object({
@@ -1 +1 @@
1
- {"version":3,"file":"Assertions.cjs","sources":["../../src/components/Assertions.ts"],"sourcesContent":["import { s } from '@sapphire/shapeshift';\nimport { APIMessageComponentEmoji, ButtonStyle } from 'discord-api-types/v10';\nimport { SelectMenuOptionBuilder } from './selectMenu/SelectMenuOption';\nimport { isValidationEnabled } from '../util/validation';\n\nexport const customIdValidator = s.string\n\t.lengthGreaterThanOrEqual(1)\n\t.lengthLessThanOrEqual(100)\n\t.setValidationEnabled(isValidationEnabled);\n\nexport const emojiValidator = s\n\t.object({\n\t\tid: s.string,\n\t\tname: s.string,\n\t\tanimated: s.boolean,\n\t})\n\t.partial.strict.setValidationEnabled(isValidationEnabled);\n\nexport const disabledValidator = s.boolean;\n\nexport const buttonLabelValidator = s.string\n\t.lengthGreaterThanOrEqual(1)\n\t.lengthLessThanOrEqual(80)\n\t.setValidationEnabled(isValidationEnabled);\n\nexport const buttonStyleValidator = s.nativeEnum(ButtonStyle);\n\nexport const placeholderValidator = s.string.lengthLessThanOrEqual(150).setValidationEnabled(isValidationEnabled);\nexport const minMaxValidator = s.number.int\n\t.greaterThanOrEqual(0)\n\t.lessThanOrEqual(25)\n\t.setValidationEnabled(isValidationEnabled);\n\nexport const labelValueDescriptionValidator = s.string\n\t.lengthGreaterThanOrEqual(1)\n\t.lengthLessThanOrEqual(100)\n\t.setValidationEnabled(isValidationEnabled);\n\nexport const jsonOptionValidator = s\n\t.object({\n\t\tlabel: labelValueDescriptionValidator,\n\t\tvalue: labelValueDescriptionValidator,\n\t\tdescription: labelValueDescriptionValidator.optional,\n\t\temoji: emojiValidator.optional,\n\t\tdefault: s.boolean.optional,\n\t})\n\t.setValidationEnabled(isValidationEnabled);\n\nexport const optionValidator = s.instance(SelectMenuOptionBuilder).setValidationEnabled(isValidationEnabled);\n\nexport const optionsValidator = optionValidator.array\n\t.lengthGreaterThanOrEqual(0)\n\t.setValidationEnabled(isValidationEnabled);\nexport const optionsLengthValidator = s.number.int\n\t.greaterThanOrEqual(0)\n\t.lessThanOrEqual(25)\n\t.setValidationEnabled(isValidationEnabled);\n\nexport function validateRequiredSelectMenuParameters(options: SelectMenuOptionBuilder[], customId?: string) {\n\tcustomIdValidator.parse(customId);\n\toptionsValidator.parse(options);\n}\n\nexport const defaultValidator = s.boolean;\n\nexport function validateRequiredSelectMenuOptionParameters(label?: string, value?: string) {\n\tlabelValueDescriptionValidator.parse(label);\n\tlabelValueDescriptionValidator.parse(value);\n}\n\nexport const urlValidator = s.string\n\t.url({\n\t\tallowedProtocols: ['http:', 'https:', 'discord:'],\n\t})\n\t.setValidationEnabled(isValidationEnabled);\n\nexport function validateRequiredButtonParameters(\n\tstyle?: ButtonStyle,\n\tlabel?: string,\n\temoji?: APIMessageComponentEmoji,\n\tcustomId?: string,\n\turl?: string,\n) {\n\tif (url && customId) {\n\t\tthrow new RangeError('URL and custom id are mutually exclusive');\n\t}\n\n\tif (!label && !emoji) {\n\t\tthrow new RangeError('Buttons must have a label and/or an emoji');\n\t}\n\n\tif (style === ButtonStyle.Link) {\n\t\tif (!url) {\n\t\t\tthrow new RangeError('Link buttons must have a url');\n\t\t}\n\t} else if (url) {\n\t\tthrow new RangeError('Non-link buttons cannot have a url');\n\t}\n}\n"],"names":["s","isValidationEnabled","ButtonStyle","SelectMenuOptionBuilder"],"mappings":";;;;;;;;;AAIY,MAAC,iBAAiB,GAAGA,YAAC,CAAC,MAAM,CAAC,wBAAwB,CAAC,CAAC,CAAC,CAAC,qBAAqB,CAAC,GAAG,CAAC,CAAC,oBAAoB,CAACC,8BAAmB,EAAE;AAC/H,MAAC,cAAc,GAAGD,YAAC,CAAC,MAAM,CAAC;AACvC,EAAE,EAAE,EAAEA,YAAC,CAAC,MAAM;AACd,EAAE,IAAI,EAAEA,YAAC,CAAC,MAAM;AAChB,EAAE,QAAQ,EAAEA,YAAC,CAAC,OAAO;AACrB,CAAC,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC,oBAAoB,CAACC,8BAAmB,EAAE;AAChD,MAAC,iBAAiB,GAAGD,YAAC,CAAC,QAAQ;AAC/B,MAAC,oBAAoB,GAAGA,YAAC,CAAC,MAAM,CAAC,wBAAwB,CAAC,CAAC,CAAC,CAAC,qBAAqB,CAAC,EAAE,CAAC,CAAC,oBAAoB,CAACC,8BAAmB,EAAE;AACjI,MAAC,oBAAoB,GAAGD,YAAC,CAAC,UAAU,CAACE,eAAW,EAAE;AAClD,MAAC,oBAAoB,GAAGF,YAAC,CAAC,MAAM,CAAC,qBAAqB,CAAC,GAAG,CAAC,CAAC,oBAAoB,CAACC,8BAAmB,EAAE;AACtG,M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,EAAE,KAAK,EAAE;AACzE,EAAE,8BAA8B,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;AAC9C,EAAE,8BAA8B,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;AAC9C,CAAC;AACW,MAAC,YAAY,GAAGA,YAAC,CAAC,MAAM,CAAC,GAAG,CAAC;AACzC,EAAE,gBAAgB,EAAE,CAAC,OAAO,EAAE,QAAQ,EAAE,UAAU,CAAC;AACnD,CAAC,CAAC,CAAC,oBAAoB,CAACC,8BAAmB,EAAE;AACtC,SAAS,gCAAgC,CAAC,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,QAAQ,EAAE,GAAG,EAAE;AACrF,EAAE,IAAI,GAAG,IAAI,QAAQ,EAAE;AACvB,IAAI,MAAM,IAAI,UAAU,CAAC,0CAA0C,CAAC,CAAC;AACrE,GAAG;AACH,EAAE,IAAI,CAAC,KAAK,IAAI,CAAC,KAAK,EAAE;AACxB,IAAI,MAAM,IAAI,UAAU,CAAC,2CAA2C,CAAC,CAAC;AACtE,GAAG;AACH,EAAE,IAAI,KAAK,KAAKC,eAAW,CAAC,IAAI,EAAE;AAClC,IAAI,IAAI,CAAC,GAAG,EAAE;AACd,MAAM,MAAM,IAAI,UAAU,CAAC,8BAA8B,CAAC,CAAC;AAC3D,KAAK;AACL,GAAG,MAAM,IAAI,GAAG,EAAE;AAClB,IAAI,MAAM,IAAI,UAAU,CAAC,oCAAoC,CAAC,CAAC;AAC/D,GAAG;AACH;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"Assertions.cjs","sources":["../../src/components/Assertions.ts"],"sourcesContent":["import { s } from '@sapphire/shapeshift';\nimport { ButtonStyle, type APIMessageComponentEmoji } from 'discord-api-types/v10';\nimport { isValidationEnabled } from '../util/validation.js';\nimport { SelectMenuOptionBuilder } from './selectMenu/SelectMenuOption.js';\n\nexport const customIdValidator = s.string\n\t.lengthGreaterThanOrEqual(1)\n\t.lengthLessThanOrEqual(100)\n\t.setValidationEnabled(isValidationEnabled);\n\nexport const emojiValidator = s\n\t.object({\n\t\tid: s.string,\n\t\tname: s.string,\n\t\tanimated: s.boolean,\n\t})\n\t.partial.strict.setValidationEnabled(isValidationEnabled);\n\nexport const disabledValidator = s.boolean;\n\nexport const buttonLabelValidator = s.string\n\t.lengthGreaterThanOrEqual(1)\n\t.lengthLessThanOrEqual(80)\n\t.setValidationEnabled(isValidationEnabled);\n\nexport const buttonStyleValidator = s.nativeEnum(ButtonStyle);\n\nexport const placeholderValidator = s.string.lengthLessThanOrEqual(150).setValidationEnabled(isValidationEnabled);\nexport const minMaxValidator = s.number.int\n\t.greaterThanOrEqual(0)\n\t.lessThanOrEqual(25)\n\t.setValidationEnabled(isValidationEnabled);\n\nexport const labelValueDescriptionValidator = s.string\n\t.lengthGreaterThanOrEqual(1)\n\t.lengthLessThanOrEqual(100)\n\t.setValidationEnabled(isValidationEnabled);\n\nexport const jsonOptionValidator = s\n\t.object({\n\t\tlabel: labelValueDescriptionValidator,\n\t\tvalue: labelValueDescriptionValidator,\n\t\tdescription: labelValueDescriptionValidator.optional,\n\t\temoji: emojiValidator.optional,\n\t\tdefault: s.boolean.optional,\n\t})\n\t.setValidationEnabled(isValidationEnabled);\n\nexport const optionValidator = s.instance(SelectMenuOptionBuilder).setValidationEnabled(isValidationEnabled);\n\nexport const optionsValidator = optionValidator.array\n\t.lengthGreaterThanOrEqual(0)\n\t.setValidationEnabled(isValidationEnabled);\nexport const optionsLengthValidator = s.number.int\n\t.greaterThanOrEqual(0)\n\t.lessThanOrEqual(25)\n\t.setValidationEnabled(isValidationEnabled);\n\nexport function validateRequiredSelectMenuParameters(options: SelectMenuOptionBuilder[], customId?: string) {\n\tcustomIdValidator.parse(customId);\n\toptionsValidator.parse(options);\n}\n\nexport const defaultValidator = s.boolean;\n\nexport function validateRequiredSelectMenuOptionParameters(label?: string, value?: string) {\n\tlabelValueDescriptionValidator.parse(label);\n\tlabelValueDescriptionValidator.parse(value);\n}\n\nexport const urlValidator = s.string\n\t.url({\n\t\tallowedProtocols: ['http:', 'https:', 'discord:'],\n\t})\n\t.setValidationEnabled(isValidationEnabled);\n\nexport function validateRequiredButtonParameters(\n\tstyle?: ButtonStyle,\n\tlabel?: string,\n\temoji?: APIMessageComponentEmoji,\n\tcustomId?: string,\n\turl?: string,\n) {\n\tif (url && customId) {\n\t\tthrow new RangeError('URL and custom id are mutually exclusive');\n\t}\n\n\tif (!label && !emoji) {\n\t\tthrow new RangeError('Buttons must have a label and/or an emoji');\n\t}\n\n\tif (style === ButtonStyle.Link) {\n\t\tif (!url) {\n\t\t\tthrow new RangeError('Link buttons must have a url');\n\t\t}\n\t} else if (url) {\n\t\tthrow new RangeError('Non-link buttons cannot have a url');\n\t}\n}\n"],"names":["s","isValidationEnabled","ButtonStyle","SelectMenuOptionBuilder"],"mappings":";;;;;;;;;AAIY,MAAC,iBAAiB,GAAGA,YAAC,CAAC,MAAM,CAAC,wBAAwB,CAAC,CAAC,CAAC,CAAC,qBAAqB,CAAC,GAAG,CAAC,CAAC,oBAAoB,CAACC,8BAAmB,EAAE;AAC/H,MAAC,cAAc,GAAGD,YAAC,CAAC,MAAM,CAAC;AACvC,EAAE,EAAE,EAAEA,YAAC,CAAC,MAAM;AACd,EAAE,IAAI,EAAEA,YAAC,CAAC,MAAM;AAChB,EAAE,QAAQ,EAAEA,YAAC,CAAC,OAAO;AACrB,CAAC,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC,oBAAoB,CAACC,8BAAmB,EAAE;AAChD,MAAC,iBAAiB,GAAGD,YAAC,CAAC,QAAQ;AAC/B,MAAC,oBAAoB,GAAGA,YAAC,CAAC,MAAM,CAAC,wBAAwB,CAAC,CAAC,CAAC,CAAC,qBAAqB,CAAC,EAAE,CAAC,CAAC,oBAAoB,CAACC,8BAAmB,EAAE;AACjI,MAAC,oBAAoB,GAAGD,YAAC,CAAC,UAAU,CAACE,eAAW,EAAE;AAClD,MAAC,oBAAoB,GAAGF,YAAC,CAAC,MAAM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ACW,MAAC,gBAAgB,GAAGD,YAAC,CAAC,QAAQ;AACnC,SAAS,0CAA0C,CAAC,KAAK,EAAE,KAAK,EAAE;AACzE,EAAE,8BAA8B,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;AAC9C,EAAE,8BAA8B,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;AAC9C,CAAC;AACW,MAAC,YAAY,GAAGA,YAAC,CAAC,MAAM,CAAC,GAAG,CAAC;AACzC,EAAE,gBAAgB,EAAE,CAAC,OAAO,EAAE,QAAQ,EAAE,UAAU,CAAC;AACnD,CAAC,CAAC,CAAC,oBAAoB,CAACC,8BAAmB,EAAE;AACtC,SAAS,gCAAgC,CAAC,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,QAAQ,EAAE,GAAG,EAAE;AACrF,EAAE,IAAI,GAAG,IAAI,QAAQ,EAAE;AACvB,IAAI,MAAM,IAAI,UAAU,CAAC,0CAA0C,CAAC,CAAC;AACrE,GAAG;AACH,EAAE,IAAI,CAAC,KAAK,IAAI,CAAC,KAAK,EAAE;AACxB,IAAI,MAAM,IAAI,UAAU,CAAC,2CAA2C,CAAC,CAAC;AACtE,GAAG;AACH,EAAE,IAAI,KAAK,KAAKC,eAAW,CAAC,IAAI,EAAE;AAClC,IAAI,IAAI,CAAC,GAAG,EAAE;AACd,MAAM,MAAM,IAAI,UAAU,CAAC,8BAA8B,CAAC,CAAC;AAC3D,KAAK;AACL,GAAG,MAAM,IAAI,GAAG,EAAE;AAClB,IAAI,MAAM,IAAI,UAAU,CAAC,oCAAoC,CAAC,CAAC;AAC/D,GAAG;AACH;;;;;;;;;;;;;;;;;;;;"}
@@ -1,5 +1,5 @@
1
- import { APIMessageComponentEmoji, ButtonStyle } from 'discord-api-types/v10';
2
- import { SelectMenuOptionBuilder } from './selectMenu/SelectMenuOption';
1
+ import { ButtonStyle, type APIMessageComponentEmoji } from 'discord-api-types/v10';
2
+ import { SelectMenuOptionBuilder } from './selectMenu/SelectMenuOption.js';
3
3
  export declare const customIdValidator: import("@sapphire/shapeshift").StringValidator<string>;
4
4
  export declare const emojiValidator: import("@sapphire/shapeshift").ObjectValidator<{
5
5
  id?: string | undefined;
@@ -1 +1 @@
1
- {"version":3,"file":"Assertions.d.ts","sourceRoot":"","sources":["../../src/components/Assertions.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,wBAAwB,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAC9E,OAAO,EAAE,uBAAuB,EAAE,MAAM,+BAA+B,CAAC;AAGxE,eAAO,MAAM,iBAAiB,wDAGa,CAAC;AAE5C,eAAO,MAAM,cAAc;;;;;;;;GAM+B,CAAC;AAE3D,eAAO,MAAM,iBAAiB,0DAAY,CAAC;AAE3C,eAAO,MAAM,oBAAoB,wDAGU,CAAC;AAE5C,eAAO,MAAM,oBAAoB,wEAA4B,CAAC;AAE9D,eAAO,MAAM,oBAAoB,wDAAgF,CAAC;AAClH,eAAO,MAAM,eAAe,wDAGe,CAAC;AAE5C,eAAO,MAAM,8BAA8B,wDAGA,CAAC;AAE5C,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;GAQW,CAAC;AAE5C,eAAO,MAAM,eAAe,2EAAgF,CAAC;AAE7G,eAAO,MAAM,gBAAgB,mGAEc,CAAC;AAC5C,eAAO,MAAM,sBAAsB,wDAGQ,CAAC;AAE5C,wBAAgB,oCAAoC,CAAC,OAAO,EAAE,uBAAuB,EAAE,EAAE,QAAQ,CAAC,EAAE,MAAM,QAGzG;AAED,eAAO,MAAM,gBAAgB,0DAAY,CAAC;AAE1C,wBAAgB,0CAA0C,CAAC,KAAK,CAAC,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM,QAGxF;AAED,eAAO,MAAM,YAAY,wDAIkB,CAAC;AAE5C,wBAAgB,gCAAgC,CAC/C,KAAK,CAAC,EAAE,WAAW,EACnB,KAAK,CAAC,EAAE,MAAM,EACd,KAAK,CAAC,EAAE,wBAAwB,EAChC,QAAQ,C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,7 +1,7 @@
1
1
  import { s } from '@sapphire/shapeshift';
2
2
  import { ButtonStyle } from 'discord-api-types/v10';
3
- import { SelectMenuOptionBuilder } from './selectMenu/SelectMenuOption.mjs';
4
3
  import { isValidationEnabled } from '../util/validation.mjs';
4
+ import { SelectMenuOptionBuilder } from './selectMenu/SelectMenuOption.mjs';
5
5
 
6
6
  const customIdValidator = s.string.lengthGreaterThanOrEqual(1).lengthLessThanOrEqual(100).setValidationEnabled(isValidationEnabled);
7
7
  const emojiValidator = s.object({
@@ -1 +1 @@
1
- {"version":3,"file":"Assertions.mjs","sources":["../../src/components/Assertions.ts"],"sourcesContent":["import { s } from '@sapphire/shapeshift';\nimport { APIMessageComponentEmoji, ButtonStyle } from 'discord-api-types/v10';\nimport { SelectMenuOptionBuilder } from './selectMenu/SelectMenuOption';\nimport { isValidationEnabled } from '../util/validation';\n\nexport const customIdValidator = s.string\n\t.lengthGreaterThanOrEqual(1)\n\t.lengthLessThanOrEqual(100)\n\t.setValidationEnabled(isValidationEnabled);\n\nexport const emojiValidator = s\n\t.object({\n\t\tid: s.string,\n\t\tname: s.string,\n\t\tanimated: s.boolean,\n\t})\n\t.partial.strict.setValidationEnabled(isValidationEnabled);\n\nexport const disabledValidator = s.boolean;\n\nexport const buttonLabelValidator = s.string\n\t.lengthGreaterThanOrEqual(1)\n\t.lengthLessThanOrEqual(80)\n\t.setValidationEnabled(isValidationEnabled);\n\nexport const buttonStyleValidator = s.nativeEnum(ButtonStyle);\n\nexport const placeholderValidator = s.string.lengthLessThanOrEqual(150).setValidationEnabled(isValidationEnabled);\nexport const minMaxValidator = s.number.int\n\t.greaterThanOrEqual(0)\n\t.lessThanOrEqual(25)\n\t.setValidationEnabled(isValidationEnabled);\n\nexport const labelValueDescriptionValidator = s.string\n\t.lengthGreaterThanOrEqual(1)\n\t.lengthLessThanOrEqual(100)\n\t.setValidationEnabled(isValidationEnabled);\n\nexport const jsonOptionValidator = s\n\t.object({\n\t\tlabel: labelValueDescriptionValidator,\n\t\tvalue: labelValueDescriptionValidator,\n\t\tdescription: labelValueDescriptionValidator.optional,\n\t\temoji: emojiValidator.optional,\n\t\tdefault: s.boolean.optional,\n\t})\n\t.setValidationEnabled(isValidationEnabled);\n\nexport const optionValidator = s.instance(SelectMenuOptionBuilder).setValidationEnabled(isValidationEnabled);\n\nexport const optionsValidator = optionValidator.array\n\t.lengthGreaterThanOrEqual(0)\n\t.setValidationEnabled(isValidationEnabled);\nexport const optionsLengthValidator = s.number.int\n\t.greaterThanOrEqual(0)\n\t.lessThanOrEqual(25)\n\t.setValidationEnabled(isValidationEnabled);\n\nexport function validateRequiredSelectMenuParameters(options: SelectMenuOptionBuilder[], customId?: string) {\n\tcustomIdValidator.parse(customId);\n\toptionsValidator.parse(options);\n}\n\nexport const defaultValidator = s.boolean;\n\nexport function validateRequiredSelectMenuOptionParameters(label?: string, value?: string) {\n\tlabelValueDescriptionValidator.parse(label);\n\tlabelValueDescriptionValidator.parse(value);\n}\n\nexport const urlValidator = s.string\n\t.url({\n\t\tallowedProtocols: ['http:', 'https:', 'discord:'],\n\t})\n\t.setValidationEnabled(isValidationEnabled);\n\nexport function validateRequiredButtonParameters(\n\tstyle?: ButtonStyle,\n\tlabel?: string,\n\temoji?: APIMessageComponentEmoji,\n\tcustomId?: string,\n\turl?: string,\n) {\n\tif (url && customId) {\n\t\tthrow new RangeError('URL and custom id are mutually exclusive');\n\t}\n\n\tif (!label && !emoji) {\n\t\tthrow new RangeError('Buttons must have a label and/or an emoji');\n\t}\n\n\tif (style === ButtonStyle.Link) {\n\t\tif (!url) {\n\t\t\tthrow new RangeError('Link buttons must have a url');\n\t\t}\n\t} else if (url) {\n\t\tthrow new RangeError('Non-link buttons cannot have a url');\n\t}\n}\n"],"names":[],"mappings":";;;;;AAIY,MAAC,iBAAiB,GAAG,CAAC,CAAC,MAAM,CAAC,wBAAwB,CAAC,CAAC,CAAC,CAAC,qBAAqB,CAAC,GAAG,CAAC,CAAC,oBAAoB,CAAC,mBA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,UAAU,CAAC,2CAA2C,CAAC,CAAC;AACtE,GAAG;AACH,EAAE,IAAI,KAAK,KAAK,WAAW,CAAC,IAAI,EAAE;AAClC,IAAI,IAAI,CAAC,GAAG,EAAE;AACd,MAAM,MAAM,IAAI,UAAU,CAAC,8BAA8B,CAAC,CAAC;AAC3D,KAAK;AACL,GAAG,MAAM,IAAI,GAAG,EAAE;AAClB,IAAI,MAAM,IAAI,UAAU,CAAC,oCAAoC,CAAC,CAAC;AAC/D,GAAG;AACH;;;;"}
1
+ {"version":3,"file":"Assertions.mjs","sources":["../../src/components/Assertions.ts"],"sourcesContent":["import { s } from '@sapphire/shapeshift';\nimport { ButtonStyle, type APIMessageComponentEmoji } from 'discord-api-types/v10';\nimport { isValidationEnabled } from '../util/validation.js';\nimport { SelectMenuOptionBuilder } from './selectMenu/SelectMenuOption.js';\n\nexport const customIdValidator = s.string\n\t.lengthGreaterThanOrEqual(1)\n\t.lengthLessThanOrEqual(100)\n\t.setValidationEnabled(isValidationEnabled);\n\nexport const emojiValidator = s\n\t.object({\n\t\tid: s.string,\n\t\tname: s.string,\n\t\tanimated: s.boolean,\n\t})\n\t.partial.strict.setValidationEnabled(isValidationEnabled);\n\nexport const disabledValidator = s.boolean;\n\nexport const buttonLabelValidator = s.string\n\t.lengthGreaterThanOrEqual(1)\n\t.lengthLessThanOrEqual(80)\n\t.setValidationEnabled(isValidationEnabled);\n\nexport const buttonStyleValidator = s.nativeEnum(ButtonStyle);\n\nexport const placeholderValidator = s.string.lengthLessThanOrEqual(150).setValidationEnabled(isValidationEnabled);\nexport const minMaxValidator = s.number.int\n\t.greaterThanOrEqual(0)\n\t.lessThanOrEqual(25)\n\t.setValidationEnabled(isValidationEnabled);\n\nexport const labelValueDescriptionValidator = s.string\n\t.lengthGreaterThanOrEqual(1)\n\t.lengthLessThanOrEqual(100)\n\t.setValidationEnabled(isValidationEnabled);\n\nexport const jsonOptionValidator = s\n\t.object({\n\t\tlabel: labelValueDescriptionValidator,\n\t\tvalue: labelValueDescriptionValidator,\n\t\tdescription: labelValueDescriptionValidator.optional,\n\t\temoji: emojiValidator.optional,\n\t\tdefault: s.boolean.optional,\n\t})\n\t.setValidationEnabled(isValidationEnabled);\n\nexport const optionValidator = s.instance(SelectMenuOptionBuilder).setValidationEnabled(isValidationEnabled);\n\nexport const optionsValidator = optionValidator.array\n\t.lengthGreaterThanOrEqual(0)\n\t.setValidationEnabled(isValidationEnabled);\nexport const optionsLengthValidator = s.number.int\n\t.greaterThanOrEqual(0)\n\t.lessThanOrEqual(25)\n\t.setValidationEnabled(isValidationEnabled);\n\nexport function validateRequiredSelectMenuParameters(options: SelectMenuOptionBuilder[], customId?: string) {\n\tcustomIdValidator.parse(customId);\n\toptionsValidator.parse(options);\n}\n\nexport const defaultValidator = s.boolean;\n\nexport function validateRequiredSelectMenuOptionParameters(label?: string, value?: string) {\n\tlabelValueDescriptionValidator.parse(label);\n\tlabelValueDescriptionValidator.parse(value);\n}\n\nexport const urlValidator = s.string\n\t.url({\n\t\tallowedProtocols: ['http:', 'https:', 'discord:'],\n\t})\n\t.setValidationEnabled(isValidationEnabled);\n\nexport function validateRequiredButtonParameters(\n\tstyle?: ButtonStyle,\n\tlabel?: string,\n\temoji?: APIMessageComponentEmoji,\n\tcustomId?: string,\n\turl?: string,\n) {\n\tif (url && customId) {\n\t\tthrow new RangeError('URL and custom id are mutually exclusive');\n\t}\n\n\tif (!label && !emoji) {\n\t\tthrow new RangeError('Buttons must have a label and/or an emoji');\n\t}\n\n\tif (style === ButtonStyle.Link) {\n\t\tif (!url) {\n\t\t\tthrow new RangeError('Link buttons must have a url');\n\t\t}\n\t} else if (url) {\n\t\tthrow new RangeError('Non-link buttons cannot have a url');\n\t}\n}\n"],"names":[],"mappings":";;;;;AAIY,MAAC,iBAAiB,GAAG,CAAC,CAAC,MAAM,CAAC,wBAAwB,CAAC,CAAC,CAAC,CAAC,qBAAqB,CAAC,GAAG,CAAC,CAAC,oBAAoB,CAAC,mBAAmB,EAAE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AC,2CAA2C,CAAC,CAAC;AACtE,GAAG;AACH,EAAE,IAAI,KAAK,KAAK,WAAW,CAAC,IAAI,EAAE;AAClC,IAAI,IAAI,CAAC,GAAG,EAAE;AACd,MAAM,MAAM,IAAI,UAAU,CAAC,8BAA8B,CAAC,CAAC;AAC3D,KAAK;AACL,GAAG,MAAM,IAAI,GAAG,EAAE;AAClB,IAAI,MAAM,IAAI,UAAU,CAAC,oCAAoC,CAAC,CAAC;AAC/D,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 *\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 * Serializes this component to an API-compatible JSON object\n\t *\n\t * @remarks\n\t * This method runs validations on the data before serializing it.\n\t * As such, it may throw an error if the data is invalid.\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
+ {"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 = APIActionRowComponent<APIActionRowComponentTypes> | 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 * Serializes this component to an API-compatible JSON object\n\t *\n\t * @remarks\n\t * This method runs validations on the data before serializing it.\n\t * As such, it may throw an error if the data is invalid.\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,6 +1,6 @@
1
1
  import type { APIActionRowComponent, APIActionRowComponentTypes, APIBaseComponent, ComponentType } from 'discord-api-types/v10';
2
2
  import type { JSONEncodable } from '../util/jsonEncodable';
3
- export declare type AnyAPIActionRowComponent = APIActionRowComponentTypes | APIActionRowComponent<APIActionRowComponentTypes>;
3
+ export declare type AnyAPIActionRowComponent = APIActionRowComponent<APIActionRowComponentTypes> | APIActionRowComponentTypes;
4
4
  /**
5
5
  * Represents a discord component
6
6
  *
@@ -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;;;;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;;;;;;OAMG;aACa,MAAM,IAAI,wBAAwB;gBAE/B,IAAI,EAAE,OAAO,CAAC,QAAQ,CAAC;CAG1C"}
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,qBAAqB,CAAC,0BAA0B,CAAC,GAAG,0BAA0B,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;;;;;;OAMG;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 *\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 * Serializes this component to an API-compatible JSON object\n\t *\n\t * @remarks\n\t * This method runs validations on the data before serializing it.\n\t * As such, it may throw an error if the data is invalid.\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
+ {"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 = APIActionRowComponent<APIActionRowComponentTypes> | 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 * Serializes this component to an API-compatible JSON object\n\t *\n\t * @remarks\n\t * This method runs validations on the data before serializing it.\n\t * As such, it may throw an error if the data is invalid.\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":"Components.cjs","sources":["../../src/components/Components.ts"],"sourcesContent":["import { APIMessageComponent, APIModalComponent, ComponentType } from 'discord-api-types/v10';\nimport {\n\tActionRowBuilder,\n\ttype AnyComponentBuilder,\n\ttype MessageComponentBuilder,\n\ttype ModalComponentBuilder,\n} from './ActionRow';\nimport { ComponentBuilder } from './Component';\nimport { ButtonBuilder } from './button/Button';\nimport { SelectMenuBuilder } from './selectMenu/SelectMenu';\nimport { TextInputBuilder } from './textInput/TextInput';\n\nexport interface MappedComponentTypes {\n\t[ComponentType.ActionRow]: ActionRowBuilder<AnyComponentBuilder>;\n\t[ComponentType.Button]: ButtonBuilder;\n\t[ComponentType.SelectMenu]: SelectMenuBuilder;\n\t[ComponentType.TextInput]: TextInputBuilder;\n}\n\n/**\n * Factory for creating components from API data\n *\n * @param data - The api data to transform to a component class\n */\nexport function createComponentBuilder<T extends keyof MappedComponentTypes>(\n\tdata: (APIMessageComponent | APIModalComponent) & { type: T },\n): MappedComponentTypes[T];\nexport function createComponentBuilder<C extends MessageComponentBuilder | ModalComponentBuilder>(data: C): C;\nexport function createComponentBuilder(\n\tdata: APIMessageComponent | APIModalComponent | MessageComponentBuilder,\n): ComponentBuilder {\n\tif (data instanceof ComponentBuilder) {\n\t\treturn data;\n\t}\n\n\tswitch (data.type) {\n\t\tcase ComponentType.ActionRow:\n\t\t\treturn new ActionRowBuilder(data);\n\t\tcase ComponentType.Button:\n\t\t\treturn new ButtonBuilder(data);\n\t\tcase ComponentType.SelectMenu:\n\t\t\treturn new SelectMenuBuilder(data);\n\t\tcase ComponentType.TextInput:\n\t\t\treturn new TextInputBuilder(data);\n\t\tdefault:\n\t\t\t// @ts-expect-error\n\t\t\t// eslint-disable-next-line @typescript-eslint/restrict-template-expressions\n\t\t\tthrow new Error(`Cannot properly serialize component type: ${data.type}`);\n\t}\n}\n"],"names":["ComponentBuilder","ComponentType","ActionRowBuilder","ButtonBuilder","SelectMenuBuilder","TextInputBuilder"],"mappings":";;;;;;;;;;;AAQO,SAAS,sBAAsB,CAAC,IAAI,EAAE;AAC7C,EAAE,IAAI,IAAI,YAAYA,0BAAgB,EAAE;AACxC,IAAI,OAAO,IAAI,CAAC;AAChB,GAAG;AACH,EAAE,QAAQ,IAAI,CAAC,IAAI;AACnB,IAAI,KAAKC,iBAAa,CAAC,SAAS;AAChC,MAAM,OAAO,IAAIC,0BAAgB,CAAC,IAAI,CAAC,CAAC;AACxC,IAAI,KAAKD,iBAAa,CAAC,MAAM;AAC7B,MAAM,OAAO,IAAIE,oBAAa,CAAC,IAAI,CAAC,CAAC;AACrC,IAAI,KAAKF,iBAAa,CAAC,UAAU;AACjC,MAAM,OAAO,IAAIG,4BAAiB,CAAC,IAAI,CAAC,CAAC;AACzC,IAAI,KAAKH,iBAAa,CAAC,SAAS;AAChC,MAAM,OAAO,IAAII,0BAAgB,CAAC,IAAI,CAAC,CAAC;AACxC,IAAI;AACJ,MAAM,MAAM,IAAI,KAAK,CAAC,CAAC,0CAA0C,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAChF,GAAG;AACH;;;;"}
1
+ {"version":3,"file":"Components.cjs","sources":["../../src/components/Components.ts"],"sourcesContent":["import { ComponentType, type APIMessageComponent, type APIModalComponent } from 'discord-api-types/v10';\nimport {\n\tActionRowBuilder,\n\ttype AnyComponentBuilder,\n\ttype MessageComponentBuilder,\n\ttype ModalComponentBuilder,\n} from './ActionRow.js';\nimport { ComponentBuilder } from './Component.js';\nimport { ButtonBuilder } from './button/Button.js';\nimport { SelectMenuBuilder } from './selectMenu/SelectMenu.js';\nimport { TextInputBuilder } from './textInput/TextInput.js';\n\nexport interface MappedComponentTypes {\n\t[ComponentType.ActionRow]: ActionRowBuilder<AnyComponentBuilder>;\n\t[ComponentType.Button]: ButtonBuilder;\n\t[ComponentType.SelectMenu]: SelectMenuBuilder;\n\t[ComponentType.TextInput]: TextInputBuilder;\n}\n\n/**\n * Factory for creating components from API data\n *\n * @param data - The api data to transform to a component class\n */\nexport function createComponentBuilder<T extends keyof MappedComponentTypes>(\n\t// eslint-disable-next-line @typescript-eslint/sort-type-union-intersection-members\n\tdata: (APIModalComponent | APIMessageComponent) & { type: T },\n): MappedComponentTypes[T];\nexport function createComponentBuilder<C extends MessageComponentBuilder | ModalComponentBuilder>(data: C): C;\nexport function createComponentBuilder(\n\tdata: APIMessageComponent | APIModalComponent | MessageComponentBuilder,\n): ComponentBuilder {\n\tif (data instanceof ComponentBuilder) {\n\t\treturn data;\n\t}\n\n\tswitch (data.type) {\n\t\tcase ComponentType.ActionRow:\n\t\t\treturn new ActionRowBuilder(data);\n\t\tcase ComponentType.Button:\n\t\t\treturn new ButtonBuilder(data);\n\t\tcase ComponentType.SelectMenu:\n\t\t\treturn new SelectMenuBuilder(data);\n\t\tcase ComponentType.TextInput:\n\t\t\treturn new TextInputBuilder(data);\n\t\tdefault:\n\t\t\t// @ts-expect-error: This case can still occur if we get a newer unsupported component type\n\t\t\tthrow new Error(`Cannot properly serialize component type: ${data.type}`);\n\t}\n}\n"],"names":["ComponentBuilder","ComponentType","ActionRowBuilder","ButtonBuilder","SelectMenuBuilder","TextInputBuilder"],"mappings":";;;;;;;;;;;AAQO,SAAS,sBAAsB,CAAC,IAAI,EAAE;AAC7C,EAAE,IAAI,IAAI,YAAYA,0BAAgB,EAAE;AACxC,IAAI,OAAO,IAAI,CAAC;AAChB,GAAG;AACH,EAAE,QAAQ,IAAI,CAAC,IAAI;AACnB,IAAI,KAAKC,iBAAa,CAAC,SAAS;AAChC,MAAM,OAAO,IAAIC,0BAAgB,CAAC,IAAI,CAAC,CAAC;AACxC,IAAI,KAAKD,iBAAa,CAAC,MAAM;AAC7B,MAAM,OAAO,IAAIE,oBAAa,CAAC,IAAI,CAAC,CAAC;AACrC,IAAI,KAAKF,iBAAa,CAAC,UAAU;AACjC,MAAM,OAAO,IAAIG,4BAAiB,CAAC,IAAI,CAAC,CAAC;AACzC,IAAI,KAAKH,iBAAa,CAAC,SAAS;AAChC,MAAM,OAAO,IAAII,0BAAgB,CAAC,IAAI,CAAC,CAAC;AACxC,IAAI;AACJ,MAAM,MAAM,IAAI,KAAK,CAAC,CAAC,0CAA0C,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAChF,GAAG;AACH;;;;"}
@@ -1,8 +1,8 @@
1
- import { APIMessageComponent, APIModalComponent, ComponentType } from 'discord-api-types/v10';
2
- import { ActionRowBuilder, type AnyComponentBuilder, type MessageComponentBuilder, type ModalComponentBuilder } from './ActionRow';
3
- import { ButtonBuilder } from './button/Button';
4
- import { SelectMenuBuilder } from './selectMenu/SelectMenu';
5
- import { TextInputBuilder } from './textInput/TextInput';
1
+ import { ComponentType, type APIMessageComponent, type APIModalComponent } from 'discord-api-types/v10';
2
+ import { ActionRowBuilder, type AnyComponentBuilder, type MessageComponentBuilder, type ModalComponentBuilder } from './ActionRow.js';
3
+ import { ButtonBuilder } from './button/Button.js';
4
+ import { SelectMenuBuilder } from './selectMenu/SelectMenu.js';
5
+ import { TextInputBuilder } from './textInput/TextInput.js';
6
6
  export interface MappedComponentTypes {
7
7
  [ComponentType.ActionRow]: ActionRowBuilder<AnyComponentBuilder>;
8
8
  [ComponentType.Button]: ButtonBuilder;
@@ -14,7 +14,7 @@ export interface MappedComponentTypes {
14
14
  *
15
15
  * @param data - The api data to transform to a component class
16
16
  */
17
- export declare function createComponentBuilder<T extends keyof MappedComponentTypes>(data: (APIMessageComponent | APIModalComponent) & {
17
+ export declare function createComponentBuilder<T extends keyof MappedComponentTypes>(data: (APIModalComponent | APIMessageComponent) & {
18
18
  type: T;
19
19
  }): MappedComponentTypes[T];
20
20
  export declare function createComponentBuilder<C extends MessageComponentBuilder | ModalComponentBuilder>(data: C): C;
@@ -1 +1 @@
1
- {"version":3,"file":"Components.d.ts","sourceRoot":"","sources":["../../src/components/Components.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,iBAAiB,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAC9F,OAAO,EACN,gBAAgB,EAChB,KAAK,mBAAmB,EACxB,KAAK,uBAAuB,EAC5B,KAAK,qBAAqB,EAC1B,MAAM,aAAa,CAAC;AAErB,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAC5D,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAEzD,MAAM,WAAW,oBAAoB;IACpC,CAAC,aAAa,CAAC,SAAS,CAAC,EAAE,gBAAgB,CAAC,mBAAmB,CAAC,CAAC;IACjE,CAAC,aAAa,CAAC,MAAM,CAAC,EAAE,aAAa,CAAC;IACtC,CAAC,aAAa,CAAC,UAAU,CAAC,EAAE,iBAAiB,CAAC;IAC9C,CAAC,aAAa,CAAC,SAAS,CAAC,EAAE,gBAAgB,CAAC;CAC5C;AAED;;;;GAIG;AACH,wBAAgB,sBAAsB,CAAC,CAAC,SAAS,MAAM,oBAAoB,EAC1E,IAAI,EAAE,CAAC,mBAAmB,GAAG,iBAAiB,CAAC,GAAG;IAAE,IAAI,EAAE,CAAC,CAAA;CAAE,GAC3D,oBAAoB,CAAC,CAAC,CAAC,CAAC;AAC3B,wBAAgB,sBAAsB,CAAC,CAAC,SAAS,uBAAuB,GAAG,qBAAqB,EAAE,IAAI,EAAE,CAAC,GAAG,CAAC,CAAC"}
1
+ {"version":3,"file":"Components.d.ts","sourceRoot":"","sources":["../../src/components/Components.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,KAAK,mBAAmB,EAAE,KAAK,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AACxG,OAAO,EACN,gBAAgB,EAChB,KAAK,mBAAmB,EACxB,KAAK,uBAAuB,EAC5B,KAAK,qBAAqB,EAC1B,MAAM,gBAAgB,CAAC;AAExB,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AAC/D,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAE5D,MAAM,WAAW,oBAAoB;IACpC,CAAC,aAAa,CAAC,SAAS,CAAC,EAAE,gBAAgB,CAAC,mBAAmB,CAAC,CAAC;IACjE,CAAC,aAAa,CAAC,MAAM,CAAC,EAAE,aAAa,CAAC;IACtC,CAAC,aAAa,CAAC,UAAU,CAAC,EAAE,iBAAiB,CAAC;IAC9C,CAAC,aAAa,CAAC,SAAS,CAAC,EAAE,gBAAgB,CAAC;CAC5C;AAED;;;;GAIG;AACH,wBAAgB,sBAAsB,CAAC,CAAC,SAAS,MAAM,oBAAoB,EAE1E,IAAI,EAAE,CAAC,iBAAiB,GAAG,mBAAmB,CAAC,GAAG;IAAE,IAAI,EAAE,CAAC,CAAA;CAAE,GAC3D,oBAAoB,CAAC,CAAC,CAAC,CAAC;AAC3B,wBAAgB,sBAAsB,CAAC,CAAC,SAAS,uBAAuB,GAAG,qBAAqB,EAAE,IAAI,EAAE,CAAC,GAAG,CAAC,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"Components.mjs","sources":["../../src/components/Components.ts"],"sourcesContent":["import { APIMessageComponent, APIModalComponent, ComponentType } from 'discord-api-types/v10';\nimport {\n\tActionRowBuilder,\n\ttype AnyComponentBuilder,\n\ttype MessageComponentBuilder,\n\ttype ModalComponentBuilder,\n} from './ActionRow';\nimport { ComponentBuilder } from './Component';\nimport { ButtonBuilder } from './button/Button';\nimport { SelectMenuBuilder } from './selectMenu/SelectMenu';\nimport { TextInputBuilder } from './textInput/TextInput';\n\nexport interface MappedComponentTypes {\n\t[ComponentType.ActionRow]: ActionRowBuilder<AnyComponentBuilder>;\n\t[ComponentType.Button]: ButtonBuilder;\n\t[ComponentType.SelectMenu]: SelectMenuBuilder;\n\t[ComponentType.TextInput]: TextInputBuilder;\n}\n\n/**\n * Factory for creating components from API data\n *\n * @param data - The api data to transform to a component class\n */\nexport function createComponentBuilder<T extends keyof MappedComponentTypes>(\n\tdata: (APIMessageComponent | APIModalComponent) & { type: T },\n): MappedComponentTypes[T];\nexport function createComponentBuilder<C extends MessageComponentBuilder | ModalComponentBuilder>(data: C): C;\nexport function createComponentBuilder(\n\tdata: APIMessageComponent | APIModalComponent | MessageComponentBuilder,\n): ComponentBuilder {\n\tif (data instanceof ComponentBuilder) {\n\t\treturn data;\n\t}\n\n\tswitch (data.type) {\n\t\tcase ComponentType.ActionRow:\n\t\t\treturn new ActionRowBuilder(data);\n\t\tcase ComponentType.Button:\n\t\t\treturn new ButtonBuilder(data);\n\t\tcase ComponentType.SelectMenu:\n\t\t\treturn new SelectMenuBuilder(data);\n\t\tcase ComponentType.TextInput:\n\t\t\treturn new TextInputBuilder(data);\n\t\tdefault:\n\t\t\t// @ts-expect-error\n\t\t\t// eslint-disable-next-line @typescript-eslint/restrict-template-expressions\n\t\t\tthrow new Error(`Cannot properly serialize component type: ${data.type}`);\n\t}\n}\n"],"names":[],"mappings":";;;;;;;AAQO,SAAS,sBAAsB,CAAC,IAAI,EAAE;AAC7C,EAAE,IAAI,IAAI,YAAY,gBAAgB,EAAE;AACxC,IAAI,OAAO,IAAI,CAAC;AAChB,GAAG;AACH,EAAE,QAAQ,IAAI,CAAC,IAAI;AACnB,IAAI,KAAK,aAAa,CAAC,SAAS;AAChC,MAAM,OAAO,IAAI,gBAAgB,CAAC,IAAI,CAAC,CAAC;AACxC,IAAI,KAAK,aAAa,CAAC,MAAM;AAC7B,MAAM,OAAO,IAAI,aAAa,CAAC,IAAI,CAAC,CAAC;AACrC,IAAI,KAAK,aAAa,CAAC,UAAU;AACjC,MAAM,OAAO,IAAI,iBAAiB,CAAC,IAAI,CAAC,CAAC;AACzC,IAAI,KAAK,aAAa,CAAC,SAAS;AAChC,MAAM,OAAO,IAAI,gBAAgB,CAAC,IAAI,CAAC,CAAC;AACxC,IAAI;AACJ,MAAM,MAAM,IAAI,KAAK,CAAC,CAAC,0CAA0C,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAChF,GAAG;AACH;;;;"}
1
+ {"version":3,"file":"Components.mjs","sources":["../../src/components/Components.ts"],"sourcesContent":["import { ComponentType, type APIMessageComponent, type APIModalComponent } from 'discord-api-types/v10';\nimport {\n\tActionRowBuilder,\n\ttype AnyComponentBuilder,\n\ttype MessageComponentBuilder,\n\ttype ModalComponentBuilder,\n} from './ActionRow.js';\nimport { ComponentBuilder } from './Component.js';\nimport { ButtonBuilder } from './button/Button.js';\nimport { SelectMenuBuilder } from './selectMenu/SelectMenu.js';\nimport { TextInputBuilder } from './textInput/TextInput.js';\n\nexport interface MappedComponentTypes {\n\t[ComponentType.ActionRow]: ActionRowBuilder<AnyComponentBuilder>;\n\t[ComponentType.Button]: ButtonBuilder;\n\t[ComponentType.SelectMenu]: SelectMenuBuilder;\n\t[ComponentType.TextInput]: TextInputBuilder;\n}\n\n/**\n * Factory for creating components from API data\n *\n * @param data - The api data to transform to a component class\n */\nexport function createComponentBuilder<T extends keyof MappedComponentTypes>(\n\t// eslint-disable-next-line @typescript-eslint/sort-type-union-intersection-members\n\tdata: (APIModalComponent | APIMessageComponent) & { type: T },\n): MappedComponentTypes[T];\nexport function createComponentBuilder<C extends MessageComponentBuilder | ModalComponentBuilder>(data: C): C;\nexport function createComponentBuilder(\n\tdata: APIMessageComponent | APIModalComponent | MessageComponentBuilder,\n): ComponentBuilder {\n\tif (data instanceof ComponentBuilder) {\n\t\treturn data;\n\t}\n\n\tswitch (data.type) {\n\t\tcase ComponentType.ActionRow:\n\t\t\treturn new ActionRowBuilder(data);\n\t\tcase ComponentType.Button:\n\t\t\treturn new ButtonBuilder(data);\n\t\tcase ComponentType.SelectMenu:\n\t\t\treturn new SelectMenuBuilder(data);\n\t\tcase ComponentType.TextInput:\n\t\t\treturn new TextInputBuilder(data);\n\t\tdefault:\n\t\t\t// @ts-expect-error: This case can still occur if we get a newer unsupported component type\n\t\t\tthrow new Error(`Cannot properly serialize component type: ${data.type}`);\n\t}\n}\n"],"names":[],"mappings":";;;;;;;AAQO,SAAS,sBAAsB,CAAC,IAAI,EAAE;AAC7C,EAAE,IAAI,IAAI,YAAY,gBAAgB,EAAE;AACxC,IAAI,OAAO,IAAI,CAAC;AAChB,GAAG;AACH,EAAE,QAAQ,IAAI,CAAC,IAAI;AACnB,IAAI,KAAK,aAAa,CAAC,SAAS;AAChC,MAAM,OAAO,IAAI,gBAAgB,CAAC,IAAI,CAAC,CAAC;AACxC,IAAI,KAAK,aAAa,CAAC,MAAM;AAC7B,MAAM,OAAO,IAAI,aAAa,CAAC,IAAI,CAAC,CAAC;AACrC,IAAI,KAAK,aAAa,CAAC,UAAU;AACjC,MAAM,OAAO,IAAI,iBAAiB,CAAC,IAAI,CAAC,CAAC;AACzC,IAAI,KAAK,aAAa,CAAC,SAAS;AAChC,MAAM,OAAO,IAAI,gBAAgB,CAAC,IAAI,CAAC,CAAC;AACxC,IAAI;AACJ,MAAM,MAAM,IAAI,KAAK,CAAC,CAAC,0CAA0C,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAChF,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\t/**\n\t * Creates a new button from API data\n\t * @param data - The API data to create this button with\n\t *\n\t * @example\n\t * Creating a button from an API data object\n\t * ```ts\n\t * const button = new ButtonBuilder({\n\t * \tstyle: 'primary',\n\t * \tlabel: 'Click Me',\n\t * \temoji: {\n\t * \t\tname: ':smile:',\n\t * \t\tid: '12345678901234567890123456789012',\n\t * \t},\n\t * custom_id: '12345678901234567890123456789012',\n\t * });\n\t * ```\n\t *\n\t * @example\n\t * Creating a button using setters and API data\n\t * ```ts\n\t * const button = new ButtonBuilder({\n\t * \tstyle: 'primary',\n\t * \tlabel: 'Click Me',\n\t * })\n\t * .setEmoji({ name: ':smile:', id: '12345678901234567890123456789012' })\n\t * .setCustomId('12345678901234567890123456789012');\n\t * ```\n\t */\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 * @remarks\n\t * This method is only available to buttons using the `Link` button style.\n\t * Only three types of URL schemes are currently supported: `https://`, `http://` and `discord://`\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 * @remarks\n\t * This method is only applicable to buttons that are not using the `Link` button style.\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 ComponentBuilder.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,CA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,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\ttype APIMessageComponentEmoji,\n\ttype APIButtonComponent,\n\ttype APIButtonComponentWithURL,\n\ttype APIButtonComponentWithCustomId,\n\ttype ButtonStyle,\n} from 'discord-api-types/v10';\nimport {\n\tbuttonLabelValidator,\n\tbuttonStyleValidator,\n\tcustomIdValidator,\n\tdisabledValidator,\n\temojiValidator,\n\turlValidator,\n\tvalidateRequiredButtonParameters,\n} from '../Assertions.js';\nimport { ComponentBuilder } from '../Component.js';\n\n/**\n * Represents a button component\n */\nexport class ButtonBuilder extends ComponentBuilder<APIButtonComponent> {\n\t/**\n\t * Creates a new button from API data\n\t *\n\t * @param data - The API data to create this button with\n\t * @example\n\t * Creating a button from an API data object\n\t * ```ts\n\t * const button = new ButtonBuilder({\n\t * \tstyle: 'primary',\n\t * \tlabel: 'Click Me',\n\t * \temoji: {\n\t * \t\tname: ':smile:',\n\t * \t\tid: '12345678901234567890123456789012',\n\t * \t},\n\t * custom_id: '12345678901234567890123456789012',\n\t * });\n\t * ```\n\t * @example\n\t * Creating a button using setters and API data\n\t * ```ts\n\t * const button = new ButtonBuilder({\n\t * \tstyle: 'primary',\n\t * \tlabel: 'Click Me',\n\t * })\n\t * .setEmoji({ name: ':smile:', id: '12345678901234567890123456789012' })\n\t * .setCustomId('12345678901234567890123456789012');\n\t * ```\n\t */\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 * @remarks\n\t * This method is only available to buttons using the `Link` button style.\n\t * Only three types of URL schemes are currently supported: `https://`, `http://` and `discord://`\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 * @remarks\n\t * This method is only applicable to buttons that are not using the `Link` button style.\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 ComponentBuilder.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\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","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CAAC,CAAC;AACxD,IAAI,OAAO,IAAI,CAAC;AAChB,GAAG;AACH,EAAE,MAAM,GAAG;AACX,IAAIC,2CAAgC;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,13 +1,13 @@
1
- import { ButtonStyle, type APIMessageComponentEmoji, type APIButtonComponent } from 'discord-api-types/v10';
2
- import { ComponentBuilder } from '../Component';
1
+ import { type APIMessageComponentEmoji, type APIButtonComponent, type ButtonStyle } from 'discord-api-types/v10';
2
+ import { ComponentBuilder } from '../Component.js';
3
3
  /**
4
4
  * Represents a button component
5
5
  */
6
6
  export declare class ButtonBuilder extends ComponentBuilder<APIButtonComponent> {
7
7
  /**
8
8
  * Creates a new button from API data
9
- * @param data - The API data to create this button with
10
9
  *
10
+ * @param data - The API data to create this button with
11
11
  * @example
12
12
  * Creating a button from an API data object
13
13
  * ```ts
@@ -21,7 +21,6 @@ export declare class ButtonBuilder extends ComponentBuilder<APIButtonComponent>
21
21
  * custom_id: '12345678901234567890123456789012',
22
22
  * });
23
23
  * ```
24
- *
25
24
  * @example
26
25
  * Creating a button using setters and API data
27
26
  * ```ts
@@ -46,7 +45,6 @@ export declare class ButtonBuilder extends ComponentBuilder<APIButtonComponent>
46
45
  * @remarks
47
46
  * This method is only available to buttons using the `Link` button style.
48
47
  * Only three types of URL schemes are currently supported: `https://`, `http://` and `discord://`
49
- *
50
48
  * @param url - The URL to open when this button is clicked
51
49
  */
52
50
  setURL(url: string): this;
@@ -55,7 +53,6 @@ export declare class ButtonBuilder extends ComponentBuilder<APIButtonComponent>
55
53
  *
56
54
  * @remarks
57
55
  * This method is only applicable to buttons that are not using the `Link` button style.
58
- *
59
56
  * @param customId - The custom id to use for this button
60
57
  */
61
58
  setCustomId(customId: string): this;
@@ -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;IACtE;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA4BG;gBACgB,IAAI,CAAC,EAAE,OAAO,CAAC,kBAAkB,CAAC;IAIrD;;;;OAIG;IACI,QAAQ,CAAC,KAAK,EAAE,WAAW;IAKlC;;;;;;;;OAQG;IACI,MAAM,CAAC,GAAG,EAAE,MAAM;IAKzB;;;;;;;OAOG;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
+ {"version":3,"file":"Button.d.ts","sourceRoot":"","sources":["../../../src/components/button/Button.ts"],"names":[],"mappings":"AAAA,OAAO,EAEN,KAAK,wBAAwB,EAC7B,KAAK,kBAAkB,EAGvB,KAAK,WAAW,EAChB,MAAM,uBAAuB,CAAC;AAU/B,OAAO,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAEnD;;GAEG;AACH,qBAAa,aAAc,SAAQ,gBAAgB,CAAC,kBAAkB,CAAC;IACtE;;;;;;;;;;;;;;;;;;;;;;;;;;;OA2BG;gBACgB,IAAI,CAAC,EAAE,OAAO,CAAC,kBAAkB,CAAC;IAIrD;;;;OAIG;IACI,QAAQ,CAAC,KAAK,EAAE,WAAW;IAKlC;;;;;;;OAOG;IACI,MAAM,CAAC,GAAG,EAAE,MAAM;IAKzB;;;;;;OAMG;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\t/**\n\t * Creates a new button from API data\n\t * @param data - The API data to create this button with\n\t *\n\t * @example\n\t * Creating a button from an API data object\n\t * ```ts\n\t * const button = new ButtonBuilder({\n\t * \tstyle: 'primary',\n\t * \tlabel: 'Click Me',\n\t * \temoji: {\n\t * \t\tname: ':smile:',\n\t * \t\tid: '12345678901234567890123456789012',\n\t * \t},\n\t * custom_id: '12345678901234567890123456789012',\n\t * });\n\t * ```\n\t *\n\t * @example\n\t * Creating a button using setters and API data\n\t * ```ts\n\t * const button = new ButtonBuilder({\n\t * \tstyle: 'primary',\n\t * \tlabel: 'Click Me',\n\t * })\n\t * .setEmoji({ name: ':smile:', id: '12345678901234567890123456789012' })\n\t * .setCustomId('12345678901234567890123456789012');\n\t * ```\n\t */\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 * @remarks\n\t * This method is only available to buttons using the `Link` button style.\n\t * Only three types of URL schemes are currently supported: `https://`, `http://` and `discord://`\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 * @remarks\n\t * This method is only applicable to buttons that are not using the `Link` button style.\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 ComponentBuilder.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
+ {"version":3,"file":"Button.mjs","sources":["../../../src/components/button/Button.ts"],"sourcesContent":["import {\n\tComponentType,\n\ttype APIMessageComponentEmoji,\n\ttype APIButtonComponent,\n\ttype APIButtonComponentWithURL,\n\ttype APIButtonComponentWithCustomId,\n\ttype ButtonStyle,\n} from 'discord-api-types/v10';\nimport {\n\tbuttonLabelValidator,\n\tbuttonStyleValidator,\n\tcustomIdValidator,\n\tdisabledValidator,\n\temojiValidator,\n\turlValidator,\n\tvalidateRequiredButtonParameters,\n} from '../Assertions.js';\nimport { ComponentBuilder } from '../Component.js';\n\n/**\n * Represents a button component\n */\nexport class ButtonBuilder extends ComponentBuilder<APIButtonComponent> {\n\t/**\n\t * Creates a new button from API data\n\t *\n\t * @param data - The API data to create this button with\n\t * @example\n\t * Creating a button from an API data object\n\t * ```ts\n\t * const button = new ButtonBuilder({\n\t * \tstyle: 'primary',\n\t * \tlabel: 'Click Me',\n\t * \temoji: {\n\t * \t\tname: ':smile:',\n\t * \t\tid: '12345678901234567890123456789012',\n\t * \t},\n\t * custom_id: '12345678901234567890123456789012',\n\t * });\n\t * ```\n\t * @example\n\t * Creating a button using setters and API data\n\t * ```ts\n\t * const button = new ButtonBuilder({\n\t * \tstyle: 'primary',\n\t * \tlabel: 'Click Me',\n\t * })\n\t * .setEmoji({ name: ':smile:', id: '12345678901234567890123456789012' })\n\t * .setCustomId('12345678901234567890123456789012');\n\t * ```\n\t */\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 * @remarks\n\t * This method is only available to buttons using the `Link` button style.\n\t * Only three types of URL schemes are currently supported: `https://`, `http://` and `discord://`\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 * @remarks\n\t * This method is only applicable to buttons that are not using the `Link` button style.\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 ComponentBuilder.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\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;;;;"}
@@ -3,16 +3,16 @@
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  const v10 = require('discord-api-types/v10');
6
- const SelectMenuOption = require('./SelectMenuOption.cjs');
7
6
  const normalizeArray = require('../../util/normalizeArray.cjs');
8
7
  const Assertions = require('../Assertions.cjs');
9
8
  const Component = require('../Component.cjs');
9
+ const SelectMenuOption = require('./SelectMenuOption.cjs');
10
10
 
11
11
  class SelectMenuBuilder extends Component.ComponentBuilder {
12
12
  constructor(data) {
13
13
  const { options, ...initData } = data ?? {};
14
14
  super({ type: v10.ComponentType.SelectMenu, ...initData });
15
- this.options = options?.map((o) => new SelectMenuOption.SelectMenuOptionBuilder(o)) ?? [];
15
+ this.options = options?.map((option) => new SelectMenuOption.SelectMenuOptionBuilder(option)) ?? [];
16
16
  }
17
17
  setPlaceholder(placeholder) {
18
18
  this.data.placeholder = Assertions.placeholderValidator.parse(placeholder);
@@ -60,7 +60,7 @@ class SelectMenuBuilder extends Component.ComponentBuilder {
60
60
  Assertions.validateRequiredSelectMenuParameters(this.options, this.data.custom_id);
61
61
  return {
62
62
  ...this.data,
63
- options: this.options.map((o) => o.toJSON())
63
+ options: this.options.map((option) => option.toJSON())
64
64
  };
65
65
  }
66
66
  }
@@ -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\t/**\n\t * {@inheritDoc ComponentBuilder.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,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,wCAAuB,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;AAC7E,GAAG;AACH,EAAE,cAAc,CAAC,WAAW,EAAE;AAC9B,IAAI,IAAI,CAAC,IAAI,CAAC,WAAW,GAAGC,+BAAoB,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC;AACpE,IAAI,OAAO,IAAI,CAAC;AAChB,GAAG;AACH,EAAE,YAAY,CAAC,SAAS,EAAE;AAC1B,IAAI,IAAI,CAAC,IAAI,CAAC,UAAU,GAAGC,0BAAe,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC;AAC5D,IAAI,OAAO,IAAI,CAAC;AAChB,GAAG;AACH,EAAE,YAAY,CAAC,SAAS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M,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 { ComponentType, type APISelectMenuComponent, type APISelectMenuOption } from 'discord-api-types/v10';\nimport { normalizeArray, type RestOrArray } from '../../util/normalizeArray.js';\nimport {\n\tcustomIdValidator,\n\tdisabledValidator,\n\tjsonOptionValidator,\n\tminMaxValidator,\n\toptionsLengthValidator,\n\tplaceholderValidator,\n\tvalidateRequiredSelectMenuParameters,\n} from '../Assertions.js';\nimport { ComponentBuilder } from '../Component.js';\nimport { SelectMenuOptionBuilder } from './SelectMenuOption.js';\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((option) => new SelectMenuOptionBuilder(option)) ?? [];\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<APISelectMenuOption | SelectMenuOptionBuilder>) {\n\t\t// eslint-disable-next-line no-param-reassign\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<APISelectMenuOption | SelectMenuOptionBuilder>) {\n\t\t// eslint-disable-next-line no-param-reassign\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 ComponentBuilder.toJSON}\n\t */\n\tpublic toJSON(): APISelectMenuComponent {\n\t\tvalidateRequiredSelectMenuParameters(this.options, this.data.custom_id);\n\n\t\treturn {\n\t\t\t...this.data,\n\t\t\toptions: this.options.map((option) => option.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,MAAM,KAAK,IAAIC,wCAAuB,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,CAAC;AACvF,GAAG;AACH,EAAE,cAAc,CAAC,WAAW,EAAE;AAC9B,IAAI,IAAI,CAAC,IAAI,CAAC,WAAW,GAAGC,+BAAoB,CAAC,KA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AI,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,MAAM,KAAK,MAAM,CAAC,MAAM,EAAE,CAAC;AAC5D,KAAK,CAAC;AACN,GAAG;AACH;;;;"}
@@ -1,7 +1,7 @@
1
- import { APISelectMenuOption, type APISelectMenuComponent } from 'discord-api-types/v10';
2
- import { SelectMenuOptionBuilder } from './SelectMenuOption';
3
- import { type RestOrArray } from '../../util/normalizeArray';
4
- import { ComponentBuilder } from '../Component';
1
+ import { type APISelectMenuComponent, type APISelectMenuOption } from 'discord-api-types/v10';
2
+ import { type RestOrArray } from '../../util/normalizeArray.js';
3
+ import { ComponentBuilder } from '../Component.js';
4
+ import { SelectMenuOptionBuilder } from './SelectMenuOption.js';
5
5
  /**
6
6
  * Represents a select menu component
7
7
  */
@@ -47,13 +47,13 @@ export declare class SelectMenuBuilder extends ComponentBuilder<APISelectMenuCom
47
47
  * @param options - The options to add to this select menu
48
48
  * @returns
49
49
  */
50
- addOptions(...options: RestOrArray<SelectMenuOptionBuilder | APISelectMenuOption>): this;
50
+ addOptions(...options: RestOrArray<APISelectMenuOption | SelectMenuOptionBuilder>): this;
51
51
  /**
52
52
  * Sets the options on this select menu
53
53
  *
54
54
  * @param options - The options to set on this select menu
55
55
  */
56
- setOptions(...options: RestOrArray<SelectMenuOptionBuilder | APISelectMenuOption>): this;
56
+ setOptions(...options: RestOrArray<APISelectMenuOption | SelectMenuOptionBuilder>): this;
57
57
  /**
58
58
  * {@inheritDoc ComponentBuilder.toJSON}
59
59
  */
@@ -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;;;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"}
@@ -1,14 +1,14 @@
1
1
  import { ComponentType } from 'discord-api-types/v10';
2
- import { SelectMenuOptionBuilder } from './SelectMenuOption.mjs';
3
2
  import { normalizeArray } from '../../util/normalizeArray.mjs';
4
3
  import { placeholderValidator, minMaxValidator, customIdValidator, disabledValidator, optionsLengthValidator, jsonOptionValidator, validateRequiredSelectMenuParameters } from '../Assertions.mjs';
5
4
  import { ComponentBuilder } from '../Component.mjs';
5
+ import { SelectMenuOptionBuilder } from './SelectMenuOption.mjs';
6
6
 
7
7
  class SelectMenuBuilder extends ComponentBuilder {
8
8
  constructor(data) {
9
9
  const { options, ...initData } = data ?? {};
10
10
  super({ type: ComponentType.SelectMenu, ...initData });
11
- this.options = options?.map((o) => new SelectMenuOptionBuilder(o)) ?? [];
11
+ this.options = options?.map((option) => new SelectMenuOptionBuilder(option)) ?? [];
12
12
  }
13
13
  setPlaceholder(placeholder) {
14
14
  this.data.placeholder = placeholderValidator.parse(placeholder);
@@ -56,7 +56,7 @@ class SelectMenuBuilder extends ComponentBuilder {
56
56
  validateRequiredSelectMenuParameters(this.options, this.data.custom_id);
57
57
  return {
58
58
  ...this.data,
59
- options: this.options.map((o) => o.toJSON())
59
+ options: this.options.map((option) => option.toJSON())
60
60
  };
61
61
  }
62
62
  }