@discordjs/builders 1.1.0-dev.1658102995-dda2895 → 1.1.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 (245) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/README.md +5 -2
  3. package/dist/components/ActionRow.cjs +32 -0
  4. package/dist/components/ActionRow.cjs.map +1 -0
  5. package/dist/components/ActionRow.d.ts +35 -0
  6. package/dist/components/ActionRow.d.ts.map +1 -0
  7. package/dist/components/ActionRow.mjs +28 -0
  8. package/dist/components/ActionRow.mjs.map +1 -0
  9. package/dist/components/Assertions.cjs +77 -0
  10. package/dist/components/Assertions.cjs.map +1 -0
  11. package/dist/components/Assertions.d.ts +48 -0
  12. package/dist/components/Assertions.d.ts.map +1 -0
  13. package/dist/components/Assertions.mjs +57 -0
  14. package/dist/components/Assertions.mjs.map +1 -0
  15. package/dist/components/Component.cjs +12 -0
  16. package/dist/components/Component.cjs.map +1 -0
  17. package/dist/components/Component.d.ts +15 -0
  18. package/dist/components/Component.d.ts.map +1 -0
  19. package/dist/components/Component.mjs +8 -0
  20. package/dist/components/Component.mjs.map +1 -0
  21. package/dist/components/Components.cjs +31 -0
  22. package/dist/components/Components.cjs.map +1 -0
  23. package/dist/components/Components.d.ts +21 -0
  24. package/dist/components/Components.d.ts.map +1 -0
  25. package/dist/components/Components.mjs +27 -0
  26. package/dist/components/Components.mjs.map +1 -0
  27. package/dist/components/button/Button.cjs +46 -0
  28. package/dist/components/button/Button.cjs.map +1 -0
  29. package/dist/components/button/Button.d.ts +46 -0
  30. package/dist/components/button/Button.d.ts.map +1 -0
  31. package/dist/components/button/Button.mjs +42 -0
  32. package/dist/components/button/Button.mjs.map +1 -0
  33. package/dist/components/selectMenu/SelectMenu.cjs +59 -0
  34. package/dist/components/selectMenu/SelectMenu.cjs.map +1 -0
  35. package/dist/components/selectMenu/SelectMenu.d.ts +59 -0
  36. package/dist/components/selectMenu/SelectMenu.d.ts.map +1 -0
  37. package/dist/components/selectMenu/SelectMenu.mjs +55 -0
  38. package/dist/components/selectMenu/SelectMenu.mjs.map +1 -0
  39. package/dist/components/selectMenu/SelectMenuOption.cjs +40 -0
  40. package/dist/components/selectMenu/SelectMenuOption.cjs.map +1 -0
  41. package/dist/components/selectMenu/SelectMenuOption.d.ts +40 -0
  42. package/dist/components/selectMenu/SelectMenuOption.d.ts.map +1 -0
  43. package/dist/components/selectMenu/SelectMenuOption.mjs +36 -0
  44. package/dist/components/selectMenu/SelectMenuOption.mjs.map +1 -0
  45. package/dist/components/textInput/Assertions.cjs +31 -0
  46. package/dist/components/textInput/Assertions.cjs.map +1 -0
  47. package/dist/components/textInput/Assertions.d.ts +10 -0
  48. package/dist/components/textInput/Assertions.d.ts.map +1 -0
  49. package/dist/components/textInput/Assertions.mjs +20 -0
  50. package/dist/components/textInput/Assertions.mjs.map +1 -0
  51. package/dist/components/textInput/TextInput.cjs +67 -0
  52. package/dist/components/textInput/TextInput.cjs.map +1 -0
  53. package/dist/components/textInput/TextInput.d.ts +59 -0
  54. package/dist/components/textInput/TextInput.d.ts.map +1 -0
  55. package/dist/components/textInput/TextInput.mjs +59 -0
  56. package/dist/components/textInput/TextInput.mjs.map +1 -0
  57. package/dist/index.cjs +129 -0
  58. package/dist/index.cjs.map +1 -0
  59. package/dist/index.d.ts +40 -1406
  60. package/dist/index.d.ts.map +1 -0
  61. package/dist/index.mjs +46 -1482
  62. package/dist/index.mjs.map +1 -1
  63. package/dist/interactions/contextMenuCommands/Assertions.cjs +40 -0
  64. package/dist/interactions/contextMenuCommands/Assertions.cjs.map +1 -0
  65. package/dist/interactions/contextMenuCommands/Assertions.d.ts +8 -0
  66. package/dist/interactions/contextMenuCommands/Assertions.d.ts.map +1 -0
  67. package/dist/interactions/contextMenuCommands/Assertions.mjs +31 -0
  68. package/dist/interactions/contextMenuCommands/Assertions.mjs.map +1 -0
  69. package/dist/interactions/contextMenuCommands/ContextMenuCommandBuilder.cjs +71 -0
  70. package/dist/interactions/contextMenuCommands/ContextMenuCommandBuilder.cjs.map +1 -0
  71. package/dist/interactions/contextMenuCommands/ContextMenuCommandBuilder.d.ts +94 -0
  72. package/dist/interactions/contextMenuCommands/ContextMenuCommandBuilder.d.ts.map +1 -0
  73. package/dist/interactions/contextMenuCommands/ContextMenuCommandBuilder.mjs +67 -0
  74. package/dist/interactions/contextMenuCommands/ContextMenuCommandBuilder.mjs.map +1 -0
  75. package/dist/interactions/modals/Assertions.cjs +21 -0
  76. package/dist/interactions/modals/Assertions.cjs.map +1 -0
  77. package/dist/interactions/modals/Assertions.d.ts +5 -0
  78. package/dist/interactions/modals/Assertions.d.ts.map +1 -0
  79. package/dist/interactions/modals/Assertions.mjs +15 -0
  80. package/dist/interactions/modals/Assertions.mjs.map +1 -0
  81. package/dist/interactions/modals/Modal.cjs +43 -0
  82. package/dist/interactions/modals/Modal.cjs.map +1 -0
  83. package/dist/interactions/modals/Modal.d.ts +35 -0
  84. package/dist/interactions/modals/Modal.d.ts.map +1 -0
  85. package/dist/interactions/modals/Modal.mjs +39 -0
  86. package/dist/interactions/modals/Modal.mjs.map +1 -0
  87. package/dist/interactions/slashCommands/Assertions.cjs +70 -0
  88. package/dist/interactions/slashCommands/Assertions.cjs.map +1 -0
  89. package/dist/interactions/slashCommands/Assertions.d.ts +18 -0
  90. package/dist/interactions/slashCommands/Assertions.d.ts.map +1 -0
  91. package/dist/interactions/slashCommands/Assertions.mjs +54 -0
  92. package/dist/interactions/slashCommands/Assertions.mjs.map +1 -0
  93. package/dist/interactions/slashCommands/SlashCommandBuilder.cjs +75 -0
  94. package/dist/interactions/slashCommands/SlashCommandBuilder.cjs.map +1 -0
  95. package/dist/interactions/slashCommands/SlashCommandBuilder.d.ts +100 -0
  96. package/dist/interactions/slashCommands/SlashCommandBuilder.d.ts.map +1 -0
  97. package/dist/interactions/slashCommands/SlashCommandBuilder.mjs +73 -0
  98. package/dist/interactions/slashCommands/SlashCommandBuilder.mjs.map +1 -0
  99. package/dist/interactions/slashCommands/SlashCommandSubcommands.cjs +72 -0
  100. package/dist/interactions/slashCommands/SlashCommandSubcommands.cjs.map +1 -0
  101. package/dist/interactions/slashCommands/SlashCommandSubcommands.d.ts +56 -0
  102. package/dist/interactions/slashCommands/SlashCommandSubcommands.d.ts.map +1 -0
  103. package/dist/interactions/slashCommands/SlashCommandSubcommands.mjs +70 -0
  104. package/dist/interactions/slashCommands/SlashCommandSubcommands.mjs.map +1 -0
  105. package/dist/interactions/slashCommands/mixins/ApplicationCommandNumericOptionMinMaxValueMixin.cjs +9 -0
  106. package/dist/interactions/slashCommands/mixins/ApplicationCommandNumericOptionMinMaxValueMixin.cjs.map +1 -0
  107. package/dist/interactions/slashCommands/mixins/ApplicationCommandNumericOptionMinMaxValueMixin.d.ts +17 -0
  108. package/dist/interactions/slashCommands/mixins/ApplicationCommandNumericOptionMinMaxValueMixin.d.ts.map +1 -0
  109. package/dist/interactions/slashCommands/mixins/ApplicationCommandNumericOptionMinMaxValueMixin.mjs +5 -0
  110. package/dist/interactions/slashCommands/mixins/ApplicationCommandNumericOptionMinMaxValueMixin.mjs.map +1 -0
  111. package/dist/interactions/slashCommands/mixins/ApplicationCommandOptionBase.cjs +27 -0
  112. package/dist/interactions/slashCommands/mixins/ApplicationCommandOptionBase.cjs.map +1 -0
  113. package/dist/interactions/slashCommands/mixins/ApplicationCommandOptionBase.d.ts +15 -0
  114. package/dist/interactions/slashCommands/mixins/ApplicationCommandOptionBase.d.ts.map +1 -0
  115. package/dist/interactions/slashCommands/mixins/ApplicationCommandOptionBase.mjs +23 -0
  116. package/dist/interactions/slashCommands/mixins/ApplicationCommandOptionBase.mjs.map +1 -0
  117. package/dist/interactions/slashCommands/mixins/ApplicationCommandOptionChannelTypesMixin.cjs +30 -0
  118. package/dist/interactions/slashCommands/mixins/ApplicationCommandOptionChannelTypesMixin.cjs.map +1 -0
  119. package/dist/interactions/slashCommands/mixins/ApplicationCommandOptionChannelTypesMixin.d.ts +14 -0
  120. package/dist/interactions/slashCommands/mixins/ApplicationCommandOptionChannelTypesMixin.d.ts.map +1 -0
  121. package/dist/interactions/slashCommands/mixins/ApplicationCommandOptionChannelTypesMixin.mjs +26 -0
  122. package/dist/interactions/slashCommands/mixins/ApplicationCommandOptionChannelTypesMixin.mjs.map +1 -0
  123. package/dist/interactions/slashCommands/mixins/ApplicationCommandOptionWithChoicesAndAutocompleteMixin.cjs +57 -0
  124. package/dist/interactions/slashCommands/mixins/ApplicationCommandOptionWithChoicesAndAutocompleteMixin.cjs.map +1 -0
  125. package/dist/interactions/slashCommands/mixins/ApplicationCommandOptionWithChoicesAndAutocompleteMixin.d.ts +19 -0
  126. package/dist/interactions/slashCommands/mixins/ApplicationCommandOptionWithChoicesAndAutocompleteMixin.d.ts.map +1 -0
  127. package/dist/interactions/slashCommands/mixins/ApplicationCommandOptionWithChoicesAndAutocompleteMixin.mjs +53 -0
  128. package/dist/interactions/slashCommands/mixins/ApplicationCommandOptionWithChoicesAndAutocompleteMixin.mjs.map +1 -0
  129. package/dist/interactions/slashCommands/mixins/NameAndDescription.cjs +65 -0
  130. package/dist/interactions/slashCommands/mixins/NameAndDescription.cjs.map +1 -0
  131. package/dist/interactions/slashCommands/mixins/NameAndDescription.d.ts +46 -0
  132. package/dist/interactions/slashCommands/mixins/NameAndDescription.d.ts.map +1 -0
  133. package/dist/interactions/slashCommands/mixins/NameAndDescription.mjs +61 -0
  134. package/dist/interactions/slashCommands/mixins/NameAndDescription.mjs.map +1 -0
  135. package/dist/interactions/slashCommands/mixins/SharedSlashCommandOptions.cjs +55 -0
  136. package/dist/interactions/slashCommands/mixins/SharedSlashCommandOptions.cjs.map +1 -0
  137. package/dist/interactions/slashCommands/mixins/SharedSlashCommandOptions.d.ts +69 -0
  138. package/dist/interactions/slashCommands/mixins/SharedSlashCommandOptions.d.ts.map +1 -0
  139. package/dist/interactions/slashCommands/mixins/SharedSlashCommandOptions.mjs +51 -0
  140. package/dist/interactions/slashCommands/mixins/SharedSlashCommandOptions.mjs.map +1 -0
  141. package/dist/interactions/slashCommands/options/attachment.cjs +20 -0
  142. package/dist/interactions/slashCommands/options/attachment.cjs.map +1 -0
  143. package/dist/interactions/slashCommands/options/attachment.d.ts +7 -0
  144. package/dist/interactions/slashCommands/options/attachment.d.ts.map +1 -0
  145. package/dist/interactions/slashCommands/options/attachment.mjs +16 -0
  146. package/dist/interactions/slashCommands/options/attachment.mjs.map +1 -0
  147. package/dist/interactions/slashCommands/options/boolean.cjs +20 -0
  148. package/dist/interactions/slashCommands/options/boolean.cjs.map +1 -0
  149. package/dist/interactions/slashCommands/options/boolean.d.ts +7 -0
  150. package/dist/interactions/slashCommands/options/boolean.d.ts.map +1 -0
  151. package/dist/interactions/slashCommands/options/boolean.mjs +16 -0
  152. package/dist/interactions/slashCommands/options/boolean.mjs.map +1 -0
  153. package/dist/interactions/slashCommands/options/channel.cjs +34 -0
  154. package/dist/interactions/slashCommands/options/channel.cjs.map +1 -0
  155. package/dist/interactions/slashCommands/options/channel.d.ts +10 -0
  156. package/dist/interactions/slashCommands/options/channel.d.ts.map +1 -0
  157. package/dist/interactions/slashCommands/options/channel.mjs +32 -0
  158. package/dist/interactions/slashCommands/options/channel.mjs.map +1 -0
  159. package/dist/interactions/slashCommands/options/integer.cjs +50 -0
  160. package/dist/interactions/slashCommands/options/integer.cjs.map +1 -0
  161. package/dist/interactions/slashCommands/options/integer.d.ts +13 -0
  162. package/dist/interactions/slashCommands/options/integer.d.ts.map +1 -0
  163. package/dist/interactions/slashCommands/options/integer.mjs +48 -0
  164. package/dist/interactions/slashCommands/options/integer.mjs.map +1 -0
  165. package/dist/interactions/slashCommands/options/mentionable.cjs +20 -0
  166. package/dist/interactions/slashCommands/options/mentionable.cjs.map +1 -0
  167. package/dist/interactions/slashCommands/options/mentionable.d.ts +7 -0
  168. package/dist/interactions/slashCommands/options/mentionable.d.ts.map +1 -0
  169. package/dist/interactions/slashCommands/options/mentionable.mjs +16 -0
  170. package/dist/interactions/slashCommands/options/mentionable.mjs.map +1 -0
  171. package/dist/interactions/slashCommands/options/number.cjs +50 -0
  172. package/dist/interactions/slashCommands/options/number.cjs.map +1 -0
  173. package/dist/interactions/slashCommands/options/number.d.ts +13 -0
  174. package/dist/interactions/slashCommands/options/number.d.ts.map +1 -0
  175. package/dist/interactions/slashCommands/options/number.mjs +48 -0
  176. package/dist/interactions/slashCommands/options/number.mjs.map +1 -0
  177. package/dist/interactions/slashCommands/options/role.cjs +20 -0
  178. package/dist/interactions/slashCommands/options/role.cjs.map +1 -0
  179. package/dist/interactions/slashCommands/options/role.d.ts +7 -0
  180. package/dist/interactions/slashCommands/options/role.d.ts.map +1 -0
  181. package/dist/interactions/slashCommands/options/role.mjs +16 -0
  182. package/dist/interactions/slashCommands/options/role.mjs.map +1 -0
  183. package/dist/interactions/slashCommands/options/string.cjs +50 -0
  184. package/dist/interactions/slashCommands/options/string.cjs.map +1 -0
  185. package/dist/interactions/slashCommands/options/string.d.ts +24 -0
  186. package/dist/interactions/slashCommands/options/string.d.ts.map +1 -0
  187. package/dist/interactions/slashCommands/options/string.mjs +48 -0
  188. package/dist/interactions/slashCommands/options/string.mjs.map +1 -0
  189. package/dist/interactions/slashCommands/options/user.cjs +20 -0
  190. package/dist/interactions/slashCommands/options/user.cjs.map +1 -0
  191. package/dist/interactions/slashCommands/options/user.d.ts +7 -0
  192. package/dist/interactions/slashCommands/options/user.d.ts.map +1 -0
  193. package/dist/interactions/slashCommands/options/user.mjs +16 -0
  194. package/dist/interactions/slashCommands/options/user.mjs.map +1 -0
  195. package/dist/messages/embed/Assertions.cjs +62 -0
  196. package/dist/messages/embed/Assertions.cjs.map +1 -0
  197. package/dist/messages/embed/Assertions.d.ts +50 -0
  198. package/dist/messages/embed/Assertions.d.ts.map +1 -0
  199. package/dist/messages/embed/Assertions.mjs +41 -0
  200. package/dist/messages/embed/Assertions.mjs.map +1 -0
  201. package/dist/messages/embed/Embed.cjs +101 -0
  202. package/dist/messages/embed/Embed.cjs.map +1 -0
  203. package/dist/messages/embed/Embed.d.ts +108 -0
  204. package/dist/messages/embed/Embed.d.ts.map +1 -0
  205. package/dist/messages/embed/Embed.mjs +97 -0
  206. package/dist/messages/embed/Embed.mjs.map +1 -0
  207. package/dist/messages/formatters.cjs +102 -0
  208. package/dist/messages/formatters.cjs.map +1 -0
  209. package/dist/messages/formatters.d.ts +246 -0
  210. package/dist/messages/formatters.d.ts.map +1 -0
  211. package/dist/messages/formatters.mjs +79 -0
  212. package/dist/messages/formatters.mjs.map +1 -0
  213. package/dist/util/componentUtil.cjs +10 -0
  214. package/dist/util/componentUtil.cjs.map +1 -0
  215. package/dist/util/componentUtil.d.ts +3 -0
  216. package/dist/util/componentUtil.d.ts.map +1 -0
  217. package/dist/util/componentUtil.mjs +6 -0
  218. package/dist/util/componentUtil.mjs.map +1 -0
  219. package/dist/util/equatable.cjs +10 -0
  220. package/dist/util/equatable.cjs.map +1 -0
  221. package/dist/util/equatable.d.ts +12 -0
  222. package/dist/util/equatable.d.ts.map +1 -0
  223. package/dist/util/equatable.mjs +6 -0
  224. package/dist/util/equatable.mjs.map +1 -0
  225. package/dist/util/jsonEncodable.cjs +10 -0
  226. package/dist/util/jsonEncodable.cjs.map +1 -0
  227. package/dist/util/jsonEncodable.d.ts +12 -0
  228. package/dist/util/jsonEncodable.d.ts.map +1 -0
  229. package/dist/util/jsonEncodable.mjs +6 -0
  230. package/dist/util/jsonEncodable.mjs.map +1 -0
  231. package/dist/util/normalizeArray.cjs +12 -0
  232. package/dist/util/normalizeArray.cjs.map +1 -0
  233. package/dist/util/normalizeArray.d.ts +3 -0
  234. package/dist/util/normalizeArray.d.ts.map +1 -0
  235. package/dist/util/normalizeArray.mjs +8 -0
  236. package/dist/util/normalizeArray.mjs.map +1 -0
  237. package/dist/util/validation.cjs +13 -0
  238. package/dist/util/validation.cjs.map +1 -0
  239. package/dist/util/validation.d.ts +4 -0
  240. package/dist/util/validation.d.ts.map +1 -0
  241. package/dist/util/validation.mjs +7 -0
  242. package/dist/util/validation.mjs.map +1 -0
  243. package/package.json +17 -16
  244. package/dist/index.js +0 -1557
  245. package/dist/index.js.map +0 -1
@@ -0,0 +1,59 @@
1
+ import { ComponentType, type TextInputStyle, type APITextInputComponent } from 'discord-api-types/v10';
2
+ import { type JSONEncodable } from '../../util/jsonEncodable';
3
+ import { ComponentBuilder } from '../Component';
4
+ export declare class TextInputBuilder extends ComponentBuilder<APITextInputComponent> {
5
+ constructor(data?: APITextInputComponent & {
6
+ type?: ComponentType.TextInput;
7
+ });
8
+ /**
9
+ * Sets the custom id for this text input
10
+ *
11
+ * @param customId - The custom id of this text input
12
+ */
13
+ setCustomId(customId: string): this;
14
+ /**
15
+ * Sets the label for this text input
16
+ *
17
+ * @param label - The label for this text input
18
+ */
19
+ setLabel(label: string): this;
20
+ /**
21
+ * Sets the style for this text input
22
+ *
23
+ * @param style - The style for this text input
24
+ */
25
+ setStyle(style: TextInputStyle): this;
26
+ /**
27
+ * Sets the minimum length of text for this text input
28
+ *
29
+ * @param minLength - The minimum length of text for this text input
30
+ */
31
+ setMinLength(minLength: number): this;
32
+ /**
33
+ * Sets the maximum length of text for this text input
34
+ *
35
+ * @param maxLength - The maximum length of text for this text input
36
+ */
37
+ setMaxLength(maxLength: number): this;
38
+ /**
39
+ * Sets the placeholder of this text input
40
+ *
41
+ * @param placeholder - The placeholder of this text input
42
+ */
43
+ setPlaceholder(placeholder: string): this;
44
+ /**
45
+ * Sets the value of this text input
46
+ *
47
+ * @param value - The value for this text input
48
+ */
49
+ setValue(value: string): this;
50
+ /**
51
+ * Sets whether this text input is required
52
+ *
53
+ * @param required - Whether this text input is required
54
+ */
55
+ setRequired(required?: boolean): this;
56
+ toJSON(): APITextInputComponent;
57
+ equals(other: JSONEncodable<APITextInputComponent> | APITextInputComponent): boolean;
58
+ }
59
+ //# sourceMappingURL=TextInput.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TextInput.d.ts","sourceRoot":"","sources":["../../../src/components/textInput/TextInput.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,KAAK,cAAc,EAAE,KAAK,qBAAqB,EAAE,MAAM,uBAAuB,CAAC;AAYvG,OAAO,EAAmB,KAAK,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAE/E,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAEhD,qBAAa,gBAAiB,SAAQ,gBAAgB,CAAC,qBAAqB,CAAC;gBACzD,IAAI,CAAC,EAAE,qBAAqB,GAAG;QAAE,IAAI,CAAC,EAAE,aAAa,CAAC,SAAS,CAAA;KAAE;IAIpF;;;;OAIG;IACI,WAAW,CAAC,QAAQ,EAAE,MAAM;IAKnC;;;;OAIG;IACI,QAAQ,CAAC,KAAK,EAAE,MAAM;IAK7B;;;;OAIG;IACI,QAAQ,CAAC,KAAK,EAAE,cAAc;IAKrC;;;;OAIG;IACI,YAAY,CAAC,SAAS,EAAE,MAAM;IAKrC;;;;OAIG;IACI,YAAY,CAAC,SAAS,EAAE,MAAM;IAKrC;;;;OAIG;IACI,cAAc,CAAC,WAAW,EAAE,MAAM;IAKzC;;;;OAIG;IACI,QAAQ,CAAC,KAAK,EAAE,MAAM;IAK7B;;;;OAIG;IACI,WAAW,CAAC,QAAQ,UAAO;IAK3B,MAAM,IAAI,qBAAqB;IAQ/B,MAAM,CAAC,KAAK,EAAE,aAAa,CAAC,qBAAqB,CAAC,GAAG,qBAAqB,GAAG,OAAO;CAO3F"}
@@ -0,0 +1,59 @@
1
+ import { ComponentType } from 'discord-api-types/v10';
2
+ import isEqual from 'fast-deep-equal';
3
+ import { labelValidator, textInputStyleValidator, minLengthValidator, maxLengthValidator, placeholderValidator, valueValidator, requiredValidator, validateRequiredParameters } from './Assertions.mjs';
4
+ import { isJSONEncodable } from '../../util/jsonEncodable.mjs';
5
+ import { customIdValidator } from '../Assertions.mjs';
6
+ import { ComponentBuilder } from '../Component.mjs';
7
+
8
+ class TextInputBuilder extends ComponentBuilder {
9
+ constructor(data) {
10
+ super({ type: ComponentType.TextInput, ...data });
11
+ }
12
+ setCustomId(customId) {
13
+ this.data.custom_id = customIdValidator.parse(customId);
14
+ return this;
15
+ }
16
+ setLabel(label) {
17
+ this.data.label = labelValidator.parse(label);
18
+ return this;
19
+ }
20
+ setStyle(style) {
21
+ this.data.style = textInputStyleValidator.parse(style);
22
+ return this;
23
+ }
24
+ setMinLength(minLength) {
25
+ this.data.min_length = minLengthValidator.parse(minLength);
26
+ return this;
27
+ }
28
+ setMaxLength(maxLength) {
29
+ this.data.max_length = maxLengthValidator.parse(maxLength);
30
+ return this;
31
+ }
32
+ setPlaceholder(placeholder) {
33
+ this.data.placeholder = placeholderValidator.parse(placeholder);
34
+ return this;
35
+ }
36
+ setValue(value) {
37
+ this.data.value = valueValidator.parse(value);
38
+ return this;
39
+ }
40
+ setRequired(required = true) {
41
+ this.data.required = requiredValidator.parse(required);
42
+ return this;
43
+ }
44
+ toJSON() {
45
+ validateRequiredParameters(this.data.custom_id, this.data.style, this.data.label);
46
+ return {
47
+ ...this.data
48
+ };
49
+ }
50
+ equals(other) {
51
+ if (isJSONEncodable(other)) {
52
+ return isEqual(other.toJSON(), this.data);
53
+ }
54
+ return isEqual(other, this.data);
55
+ }
56
+ }
57
+
58
+ export { TextInputBuilder };
59
+ //# sourceMappingURL=TextInput.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TextInput.mjs","sources":["../../../src/components/textInput/TextInput.ts"],"sourcesContent":["import { ComponentType, type TextInputStyle, type APITextInputComponent } from 'discord-api-types/v10';\nimport isEqual from 'fast-deep-equal';\nimport {\n\tmaxLengthValidator,\n\tminLengthValidator,\n\tplaceholderValidator,\n\trequiredValidator,\n\tvalueValidator,\n\tvalidateRequiredParameters,\n\tlabelValidator,\n\ttextInputStyleValidator,\n} from './Assertions';\nimport { isJSONEncodable, type JSONEncodable } from '../../util/jsonEncodable';\nimport { customIdValidator } from '../Assertions';\nimport { ComponentBuilder } from '../Component';\n\nexport class TextInputBuilder extends ComponentBuilder<APITextInputComponent> {\n\tpublic constructor(data?: APITextInputComponent & { type?: ComponentType.TextInput }) {\n\t\tsuper({ type: ComponentType.TextInput, ...data });\n\t}\n\n\t/**\n\t * Sets the custom id for this text input\n\t *\n\t * @param customId - The custom id of this text input\n\t */\n\tpublic setCustomId(customId: string) {\n\t\tthis.data.custom_id = customIdValidator.parse(customId);\n\t\treturn this;\n\t}\n\n\t/**\n\t * Sets the label for this text input\n\t *\n\t * @param label - The label for this text input\n\t */\n\tpublic setLabel(label: string) {\n\t\tthis.data.label = labelValidator.parse(label);\n\t\treturn this;\n\t}\n\n\t/**\n\t * Sets the style for this text input\n\t *\n\t * @param style - The style for this text input\n\t */\n\tpublic setStyle(style: TextInputStyle) {\n\t\tthis.data.style = textInputStyleValidator.parse(style);\n\t\treturn this;\n\t}\n\n\t/**\n\t * Sets the minimum length of text for this text input\n\t *\n\t * @param minLength - The minimum length of text for this text input\n\t */\n\tpublic setMinLength(minLength: number) {\n\t\tthis.data.min_length = minLengthValidator.parse(minLength);\n\t\treturn this;\n\t}\n\n\t/**\n\t * Sets the maximum length of text for this text input\n\t *\n\t * @param maxLength - The maximum length of text for this text input\n\t */\n\tpublic setMaxLength(maxLength: number) {\n\t\tthis.data.max_length = maxLengthValidator.parse(maxLength);\n\t\treturn this;\n\t}\n\n\t/**\n\t * Sets the placeholder of this text input\n\t *\n\t * @param placeholder - The placeholder of this text input\n\t */\n\tpublic setPlaceholder(placeholder: string) {\n\t\tthis.data.placeholder = placeholderValidator.parse(placeholder);\n\t\treturn this;\n\t}\n\n\t/**\n\t * Sets the value of this text input\n\t *\n\t * @param value - The value for this text input\n\t */\n\tpublic setValue(value: string) {\n\t\tthis.data.value = valueValidator.parse(value);\n\t\treturn this;\n\t}\n\n\t/**\n\t * Sets whether this text input is required\n\t *\n\t * @param required - Whether this text input is required\n\t */\n\tpublic setRequired(required = true) {\n\t\tthis.data.required = requiredValidator.parse(required);\n\t\treturn this;\n\t}\n\n\tpublic toJSON(): APITextInputComponent {\n\t\tvalidateRequiredParameters(this.data.custom_id, this.data.style, this.data.label);\n\t\t// eslint-disable-next-line @typescript-eslint/consistent-type-assertions\n\t\treturn {\n\t\t\t...this.data,\n\t\t} as APITextInputComponent;\n\t}\n\n\tpublic equals(other: JSONEncodable<APITextInputComponent> | APITextInputComponent): boolean {\n\t\tif (isJSONEncodable(other)) {\n\t\t\treturn isEqual(other.toJSON(), this.data);\n\t\t}\n\n\t\treturn isEqual(other, this.data);\n\t}\n}\n"],"names":[],"mappings":";;;;;;;AAeO,MAAM,gBAAgB,SAAS,gBAAgB,CAAC;AACvD,EAAE,WAAW,CAAC,IAAI,EAAE;AACpB,IAAI,KAAK,CAAC,EAAE,IAAI,EAAE,aAAa,CAAC,SAAS,EAAE,GAAG,IAAI,EAAE,CAAC,CAAC;AACtD,GAAG;AACH,EAAE,WAAW,CAAC,QAAQ,EAAE;AACxB,IAAI,IAAI,CAAC,IAAI,CAAC,SAAS,GAAG,iBAAiB,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;AAC5D,IAAI,OAAO,IAAI,CAAC;AAChB,GAAG;AACH,EAAE,QAAQ,CAAC,KAAK,EAAE;AAClB,IAAI,IAAI,CAAC,IAAI,CAAC,KAAK,GAAG,cAAc,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;AAClD,IAAI,OAAO,IAAI,CAAC;AAChB,GAAG;AACH,EAAE,QAAQ,CAAC,KAAK,EAAE;AAClB,IAAI,IAAI,CAAC,IAAI,CAAC,KAAK,GAAG,uBAAuB,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;AAC3D,IAAI,OAAO,IAAI,CAAC;AAChB,GAAG;AACH,EAAE,YAAY,CAAC,SAAS,EAAE;AAC1B,IAAI,IAAI,CAAC,IAAI,CAAC,UAAU,GAAG,kBAAkB,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC;AAC/D,IAAI,OAAO,IAAI,CAAC;AAChB,GAAG;AACH,EAAE,YAAY,CAAC,SAAS,EAAE;AAC1B,IAAI,IAAI,CAAC,IAAI,CAAC,UAAU,GAAG,kBAAkB,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC;AAC/D,IAAI,OAAO,IAAI,CAAC;AAChB,GAAG;AACH,EAAE,cAAc,CAAC,WAAW,EAAE;AAC9B,IAAI,IAAI,CAAC,IAAI,CAAC,WAAW,GAAG,oBAAoB,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC;AACpE,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,MAAM,GAAG;AACX,IAAI,0BAA0B,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,IAAI,CAAC,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;AACtF,IAAI,OAAO;AACX,MAAM,GAAG,IAAI,CAAC,IAAI;AAClB,KAAK,CAAC;AACN,GAAG;AACH,EAAE,MAAM,CAAC,KAAK,EAAE;AAChB,IAAI,IAAI,eAAe,CAAC,KAAK,CAAC,EAAE;AAChC,MAAM,OAAO,OAAO,CAAC,KAAK,CAAC,MAAM,EAAE,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC;AAChD,KAAK;AACL,IAAI,OAAO,OAAO,CAAC,KAAK,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC;AACrC,GAAG;AACH;;;;"}
package/dist/index.cjs ADDED
@@ -0,0 +1,129 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ const Assertions = require('./messages/embed/Assertions.cjs');
6
+ const Embed = require('./messages/embed/Embed.cjs');
7
+ const formatters = require('./messages/formatters.cjs');
8
+ const Assertions$1 = require('./components/Assertions.cjs');
9
+ const ActionRow = require('./components/ActionRow.cjs');
10
+ const Button = require('./components/button/Button.cjs');
11
+ const Component = require('./components/Component.cjs');
12
+ const Components = require('./components/Components.cjs');
13
+ const TextInput = require('./components/textInput/TextInput.cjs');
14
+ const Assertions$2 = require('./components/textInput/Assertions.cjs');
15
+ const Modal = require('./interactions/modals/Modal.cjs');
16
+ const Assertions$3 = require('./interactions/modals/Assertions.cjs');
17
+ const SelectMenu = require('./components/selectMenu/SelectMenu.cjs');
18
+ const SelectMenuOption = require('./components/selectMenu/SelectMenuOption.cjs');
19
+ const Assertions$4 = require('./interactions/slashCommands/Assertions.cjs');
20
+ const SlashCommandBuilder = require('./interactions/slashCommands/SlashCommandBuilder.cjs');
21
+ const SlashCommandSubcommands = require('./interactions/slashCommands/SlashCommandSubcommands.cjs');
22
+ const boolean = require('./interactions/slashCommands/options/boolean.cjs');
23
+ const channel = require('./interactions/slashCommands/options/channel.cjs');
24
+ const integer = require('./interactions/slashCommands/options/integer.cjs');
25
+ const mentionable = require('./interactions/slashCommands/options/mentionable.cjs');
26
+ const number = require('./interactions/slashCommands/options/number.cjs');
27
+ const role = require('./interactions/slashCommands/options/role.cjs');
28
+ const attachment = require('./interactions/slashCommands/options/attachment.cjs');
29
+ const string = require('./interactions/slashCommands/options/string.cjs');
30
+ const user = require('./interactions/slashCommands/options/user.cjs');
31
+ const ApplicationCommandNumericOptionMinMaxValueMixin = require('./interactions/slashCommands/mixins/ApplicationCommandNumericOptionMinMaxValueMixin.cjs');
32
+ const ApplicationCommandOptionBase = require('./interactions/slashCommands/mixins/ApplicationCommandOptionBase.cjs');
33
+ const ApplicationCommandOptionChannelTypesMixin = require('./interactions/slashCommands/mixins/ApplicationCommandOptionChannelTypesMixin.cjs');
34
+ const ApplicationCommandOptionWithChoicesAndAutocompleteMixin = require('./interactions/slashCommands/mixins/ApplicationCommandOptionWithChoicesAndAutocompleteMixin.cjs');
35
+ const NameAndDescription = require('./interactions/slashCommands/mixins/NameAndDescription.cjs');
36
+ const SharedSlashCommandOptions = require('./interactions/slashCommands/mixins/SharedSlashCommandOptions.cjs');
37
+ const Assertions$5 = require('./interactions/contextMenuCommands/Assertions.cjs');
38
+ const ContextMenuCommandBuilder = require('./interactions/contextMenuCommands/ContextMenuCommandBuilder.cjs');
39
+ const jsonEncodable = require('./util/jsonEncodable.cjs');
40
+ const equatable = require('./util/equatable.cjs');
41
+ const componentUtil = require('./util/componentUtil.cjs');
42
+ const normalizeArray = require('./util/normalizeArray.cjs');
43
+ const validation = require('./util/validation.cjs');
44
+
45
+
46
+
47
+ exports.EmbedAssertions = Assertions;
48
+ exports.EmbedBuilder = Embed.EmbedBuilder;
49
+ exports.Faces = formatters.Faces;
50
+ exports.TimestampStyles = formatters.TimestampStyles;
51
+ exports.blockQuote = formatters.blockQuote;
52
+ exports.bold = formatters.bold;
53
+ exports.channelLink = formatters.channelLink;
54
+ exports.channelMention = formatters.channelMention;
55
+ exports.codeBlock = formatters.codeBlock;
56
+ exports.formatEmoji = formatters.formatEmoji;
57
+ exports.hideLinkEmbed = formatters.hideLinkEmbed;
58
+ exports.hyperlink = formatters.hyperlink;
59
+ exports.inlineCode = formatters.inlineCode;
60
+ exports.italic = formatters.italic;
61
+ exports.messageLink = formatters.messageLink;
62
+ exports.quote = formatters.quote;
63
+ exports.roleMention = formatters.roleMention;
64
+ exports.spoiler = formatters.spoiler;
65
+ exports.strikethrough = formatters.strikethrough;
66
+ exports.time = formatters.time;
67
+ exports.underscore = formatters.underscore;
68
+ exports.userMention = formatters.userMention;
69
+ exports.ComponentAssertions = Assertions$1;
70
+ exports.ActionRowBuilder = ActionRow.ActionRowBuilder;
71
+ exports.ButtonBuilder = Button.ButtonBuilder;
72
+ exports.ComponentBuilder = Component.ComponentBuilder;
73
+ exports.createComponentBuilder = Components.createComponentBuilder;
74
+ exports.TextInputBuilder = TextInput.TextInputBuilder;
75
+ exports.TextInputAssertions = Assertions$2;
76
+ exports.ModalBuilder = Modal.ModalBuilder;
77
+ exports.ModalAssertions = Assertions$3;
78
+ exports.SelectMenuBuilder = SelectMenu.SelectMenuBuilder;
79
+ exports.SelectMenuOptionBuilder = SelectMenuOption.SelectMenuOptionBuilder;
80
+ exports.SlashCommandAssertions = Assertions$4;
81
+ Object.defineProperty(exports, 'SlashCommandBuilder', {
82
+ enumerable: true,
83
+ get: function () { return SlashCommandBuilder.SlashCommandBuilder; }
84
+ });
85
+ Object.defineProperty(exports, 'SlashCommandSubcommandBuilder', {
86
+ enumerable: true,
87
+ get: function () { return SlashCommandSubcommands.SlashCommandSubcommandBuilder; }
88
+ });
89
+ Object.defineProperty(exports, 'SlashCommandSubcommandGroupBuilder', {
90
+ enumerable: true,
91
+ get: function () { return SlashCommandSubcommands.SlashCommandSubcommandGroupBuilder; }
92
+ });
93
+ exports.SlashCommandBooleanOption = boolean.SlashCommandBooleanOption;
94
+ Object.defineProperty(exports, 'SlashCommandChannelOption', {
95
+ enumerable: true,
96
+ get: function () { return channel.SlashCommandChannelOption; }
97
+ });
98
+ Object.defineProperty(exports, 'SlashCommandIntegerOption', {
99
+ enumerable: true,
100
+ get: function () { return integer.SlashCommandIntegerOption; }
101
+ });
102
+ exports.SlashCommandMentionableOption = mentionable.SlashCommandMentionableOption;
103
+ Object.defineProperty(exports, 'SlashCommandNumberOption', {
104
+ enumerable: true,
105
+ get: function () { return number.SlashCommandNumberOption; }
106
+ });
107
+ exports.SlashCommandRoleOption = role.SlashCommandRoleOption;
108
+ exports.SlashCommandAttachmentOption = attachment.SlashCommandAttachmentOption;
109
+ Object.defineProperty(exports, 'SlashCommandStringOption', {
110
+ enumerable: true,
111
+ get: function () { return string.SlashCommandStringOption; }
112
+ });
113
+ exports.SlashCommandUserOption = user.SlashCommandUserOption;
114
+ exports.ApplicationCommandNumericOptionMinMaxValueMixin = ApplicationCommandNumericOptionMinMaxValueMixin.ApplicationCommandNumericOptionMinMaxValueMixin;
115
+ exports.ApplicationCommandOptionBase = ApplicationCommandOptionBase.ApplicationCommandOptionBase;
116
+ exports.ApplicationCommandOptionChannelTypesMixin = ApplicationCommandOptionChannelTypesMixin.ApplicationCommandOptionChannelTypesMixin;
117
+ exports.ApplicationCommandOptionWithChoicesAndAutocompleteMixin = ApplicationCommandOptionWithChoicesAndAutocompleteMixin.ApplicationCommandOptionWithChoicesAndAutocompleteMixin;
118
+ exports.SharedNameAndDescription = NameAndDescription.SharedNameAndDescription;
119
+ exports.SharedSlashCommandOptions = SharedSlashCommandOptions.SharedSlashCommandOptions;
120
+ exports.ContextMenuCommandAssertions = Assertions$5;
121
+ exports.ContextMenuCommandBuilder = ContextMenuCommandBuilder.ContextMenuCommandBuilder;
122
+ exports.isJSONEncodable = jsonEncodable.isJSONEncodable;
123
+ exports.isEquatable = equatable.isEquatable;
124
+ exports.embedLength = componentUtil.embedLength;
125
+ exports.normalizeArray = normalizeArray.normalizeArray;
126
+ exports.disableValidators = validation.disableValidators;
127
+ exports.enableValidators = validation.enableValidators;
128
+ exports.isValidationEnabled = validation.isValidationEnabled;
129
+ //# sourceMappingURL=index.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}