@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,108 @@
1
+ import type { APIEmbed, APIEmbedAuthor, APIEmbedField, APIEmbedFooter, APIEmbedImage } from 'discord-api-types/v10';
2
+ import { type RestOrArray } from '../../util/normalizeArray';
3
+ export declare type RGBTuple = [red: number, green: number, blue: number];
4
+ export interface IconData {
5
+ /**
6
+ * The URL of the icon
7
+ */
8
+ iconURL?: string;
9
+ /**
10
+ * The proxy URL of the icon
11
+ */
12
+ proxyIconURL?: string;
13
+ }
14
+ export declare type EmbedAuthorData = Omit<APIEmbedAuthor, 'icon_url' | 'proxy_icon_url'> & IconData;
15
+ export declare type EmbedAuthorOptions = Omit<EmbedAuthorData, 'proxyIconURL'>;
16
+ export declare type EmbedFooterData = Omit<APIEmbedFooter, 'icon_url' | 'proxy_icon_url'> & IconData;
17
+ export declare type EmbedFooterOptions = Omit<EmbedFooterData, 'proxyIconURL'>;
18
+ export interface EmbedImageData extends Omit<APIEmbedImage, 'proxy_url'> {
19
+ /**
20
+ * The proxy URL for the image
21
+ */
22
+ proxyURL?: string;
23
+ }
24
+ /**
25
+ * Represents a embed in a message (image/video preview, rich embed, etc.)
26
+ */
27
+ export declare class EmbedBuilder {
28
+ readonly data: APIEmbed;
29
+ constructor(data?: APIEmbed);
30
+ /**
31
+ * Adds fields to the embed (max 25)
32
+ *
33
+ * @param fields The fields to add
34
+ */
35
+ addFields(...fields: RestOrArray<APIEmbedField>): this;
36
+ /**
37
+ * Removes, replaces, or inserts fields in the embed (max 25)
38
+ *
39
+ * @param index The index to start at
40
+ * @param deleteCount The number of fields to remove
41
+ * @param fields The replacing field objects
42
+ */
43
+ spliceFields(index: number, deleteCount: number, ...fields: APIEmbedField[]): this;
44
+ /**
45
+ * Sets the embed's fields (max 25).
46
+ * @param fields The fields to set
47
+ */
48
+ setFields(...fields: RestOrArray<APIEmbedField>): this;
49
+ /**
50
+ * Sets the author of this embed
51
+ *
52
+ * @param options The options for the author
53
+ */
54
+ setAuthor(options: EmbedAuthorOptions | null): this;
55
+ /**
56
+ * Sets the color of this embed
57
+ *
58
+ * @param color The color of the embed
59
+ */
60
+ setColor(color: number | RGBTuple | null): this;
61
+ /**
62
+ * Sets the description of this embed
63
+ *
64
+ * @param description The description
65
+ */
66
+ setDescription(description: string | null): this;
67
+ /**
68
+ * Sets the footer of this embed
69
+ *
70
+ * @param options The options for the footer
71
+ */
72
+ setFooter(options: EmbedFooterOptions | null): this;
73
+ /**
74
+ * Sets the image of this embed
75
+ *
76
+ * @param url The URL of the image
77
+ */
78
+ setImage(url: string | null): this;
79
+ /**
80
+ * Sets the thumbnail of this embed
81
+ *
82
+ * @param url The URL of the thumbnail
83
+ */
84
+ setThumbnail(url: string | null): this;
85
+ /**
86
+ * Sets the timestamp of this embed
87
+ *
88
+ * @param timestamp The timestamp or date
89
+ */
90
+ setTimestamp(timestamp?: number | Date | null): this;
91
+ /**
92
+ * Sets the title of this embed
93
+ *
94
+ * @param title The title
95
+ */
96
+ setTitle(title: string | null): this;
97
+ /**
98
+ * Sets the URL of this embed
99
+ *
100
+ * @param url The URL
101
+ */
102
+ setURL(url: string | null): this;
103
+ /**
104
+ * Transforms the embed to a plain object
105
+ */
106
+ toJSON(): APIEmbed;
107
+ }
108
+ //# sourceMappingURL=Embed.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Embed.d.ts","sourceRoot":"","sources":["../../../src/messages/embed/Embed.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,cAAc,EAAE,aAAa,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAapH,OAAO,EAAkB,KAAK,WAAW,EAAE,MAAM,2BAA2B,CAAC;AAE7E,oBAAY,QAAQ,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,CAAC,CAAC;AAElE,MAAM,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,OAAO,EAAE,kBAAkB,GAAG,IAAI,GAAG,IAAI;IAa1D;;;;OAIG;IACI,QAAQ,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,GAAG,IAAI;IAQzC;;;;OAIG;IACI,YAAY,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,GAAG,IAAI;IAQ7C;;;;OAIG;IACI,YAAY,CAAC,SAAS,GAAE,MAAM,GAAG,IAAI,GAAG,IAAiB,GAAG,IAAI;IAQvE;;;;OAIG;IACI,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,GAAG,IAAI;IAQ3C;;;;OAIG;IACI,MAAM,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,GAAG,IAAI;IAQvC;;OAEG;IACI,MAAM,IAAI,QAAQ;CAGzB"}
@@ -0,0 +1,97 @@
1
+ import { validateFieldLength, embedFieldsArrayPredicate, embedAuthorPredicate, colorPredicate, descriptionPredicate, embedFooterPredicate, imageURLPredicate, timestampPredicate, titlePredicate, urlPredicate } from './Assertions.mjs';
2
+ import { normalizeArray } from '../../util/normalizeArray.mjs';
3
+
4
+ class EmbedBuilder {
5
+ constructor(data = {}) {
6
+ this.data = { ...data };
7
+ if (data.timestamp)
8
+ this.data.timestamp = new Date(data.timestamp).toISOString();
9
+ }
10
+ addFields(...fields) {
11
+ fields = normalizeArray(fields);
12
+ validateFieldLength(fields.length, this.data.fields);
13
+ embedFieldsArrayPredicate.parse(fields);
14
+ if (this.data.fields)
15
+ this.data.fields.push(...fields);
16
+ else
17
+ this.data.fields = fields;
18
+ return this;
19
+ }
20
+ spliceFields(index, deleteCount, ...fields) {
21
+ validateFieldLength(fields.length - deleteCount, this.data.fields);
22
+ embedFieldsArrayPredicate.parse(fields);
23
+ if (this.data.fields)
24
+ this.data.fields.splice(index, deleteCount, ...fields);
25
+ else
26
+ this.data.fields = fields;
27
+ return this;
28
+ }
29
+ setFields(...fields) {
30
+ this.spliceFields(0, this.data.fields?.length ?? 0, ...normalizeArray(fields));
31
+ return this;
32
+ }
33
+ setAuthor(options) {
34
+ if (options === null) {
35
+ this.data.author = void 0;
36
+ return this;
37
+ }
38
+ embedAuthorPredicate.parse(options);
39
+ this.data.author = { name: options.name, url: options.url, icon_url: options.iconURL };
40
+ return this;
41
+ }
42
+ setColor(color) {
43
+ colorPredicate.parse(color);
44
+ if (Array.isArray(color)) {
45
+ const [red, green, blue] = color;
46
+ this.data.color = (red << 16) + (green << 8) + blue;
47
+ return this;
48
+ }
49
+ this.data.color = color ?? void 0;
50
+ return this;
51
+ }
52
+ setDescription(description) {
53
+ descriptionPredicate.parse(description);
54
+ this.data.description = description ?? void 0;
55
+ return this;
56
+ }
57
+ setFooter(options) {
58
+ if (options === null) {
59
+ this.data.footer = void 0;
60
+ return this;
61
+ }
62
+ embedFooterPredicate.parse(options);
63
+ this.data.footer = { text: options.text, icon_url: options.iconURL };
64
+ return this;
65
+ }
66
+ setImage(url) {
67
+ imageURLPredicate.parse(url);
68
+ this.data.image = url ? { url } : void 0;
69
+ return this;
70
+ }
71
+ setThumbnail(url) {
72
+ imageURLPredicate.parse(url);
73
+ this.data.thumbnail = url ? { url } : void 0;
74
+ return this;
75
+ }
76
+ setTimestamp(timestamp = Date.now()) {
77
+ timestampPredicate.parse(timestamp);
78
+ this.data.timestamp = timestamp ? new Date(timestamp).toISOString() : void 0;
79
+ return this;
80
+ }
81
+ setTitle(title) {
82
+ titlePredicate.parse(title);
83
+ this.data.title = title ?? void 0;
84
+ return this;
85
+ }
86
+ setURL(url) {
87
+ urlPredicate.parse(url);
88
+ this.data.url = url ?? void 0;
89
+ return this;
90
+ }
91
+ toJSON() {
92
+ return { ...this.data };
93
+ }
94
+ }
95
+
96
+ export { EmbedBuilder };
97
+ //# sourceMappingURL=Embed.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Embed.mjs","sources":["../../../src/messages/embed/Embed.ts"],"sourcesContent":["import type { APIEmbed, APIEmbedAuthor, APIEmbedField, APIEmbedFooter, APIEmbedImage } from 'discord-api-types/v10';\nimport {\n\tcolorPredicate,\n\tdescriptionPredicate,\n\tembedAuthorPredicate,\n\tembedFieldsArrayPredicate,\n\tembedFooterPredicate,\n\timageURLPredicate,\n\ttimestampPredicate,\n\ttitlePredicate,\n\turlPredicate,\n\tvalidateFieldLength,\n} from './Assertions';\nimport { normalizeArray, type RestOrArray } from '../../util/normalizeArray';\n\nexport type RGBTuple = [red: number, green: number, blue: number];\n\nexport interface IconData {\n\t/**\n\t * The URL of the icon\n\t */\n\ticonURL?: string;\n\t/**\n\t * The proxy URL of the icon\n\t */\n\tproxyIconURL?: string;\n}\n\nexport type EmbedAuthorData = Omit<APIEmbedAuthor, 'icon_url' | 'proxy_icon_url'> & IconData;\n\nexport type EmbedAuthorOptions = Omit<EmbedAuthorData, 'proxyIconURL'>;\n\nexport type EmbedFooterData = Omit<APIEmbedFooter, 'icon_url' | 'proxy_icon_url'> & IconData;\n\nexport type EmbedFooterOptions = Omit<EmbedFooterData, 'proxyIconURL'>;\n\nexport interface EmbedImageData extends Omit<APIEmbedImage, 'proxy_url'> {\n\t/**\n\t * The proxy URL for the image\n\t */\n\tproxyURL?: string;\n}\n/**\n * Represents a embed in a message (image/video preview, rich embed, etc.)\n */\nexport class EmbedBuilder {\n\tpublic readonly data: APIEmbed;\n\n\tpublic constructor(data: APIEmbed = {}) {\n\t\tthis.data = { ...data };\n\t\tif (data.timestamp) this.data.timestamp = new Date(data.timestamp).toISOString();\n\t}\n\n\t/**\n\t * Adds fields to the embed (max 25)\n\t *\n\t * @param fields The fields to add\n\t */\n\tpublic addFields(...fields: RestOrArray<APIEmbedField>): this {\n\t\tfields = normalizeArray(fields);\n\t\t// Ensure adding these fields won't exceed the 25 field limit\n\t\tvalidateFieldLength(fields.length, this.data.fields);\n\n\t\t// Data assertions\n\t\tembedFieldsArrayPredicate.parse(fields);\n\n\t\tif (this.data.fields) this.data.fields.push(...fields);\n\t\telse this.data.fields = fields;\n\t\treturn this;\n\t}\n\n\t/**\n\t * Removes, replaces, or inserts fields in the embed (max 25)\n\t *\n\t * @param index The index to start at\n\t * @param deleteCount The number of fields to remove\n\t * @param fields The replacing field objects\n\t */\n\tpublic spliceFields(index: number, deleteCount: number, ...fields: APIEmbedField[]): this {\n\t\t// Ensure adding these fields won't exceed the 25 field limit\n\t\tvalidateFieldLength(fields.length - deleteCount, this.data.fields);\n\n\t\t// Data assertions\n\t\tembedFieldsArrayPredicate.parse(fields);\n\t\tif (this.data.fields) this.data.fields.splice(index, deleteCount, ...fields);\n\t\telse this.data.fields = fields;\n\t\treturn this;\n\t}\n\n\t/**\n\t * Sets the embed's fields (max 25).\n\t * @param fields The fields to set\n\t */\n\tpublic setFields(...fields: RestOrArray<APIEmbedField>) {\n\t\tthis.spliceFields(0, this.data.fields?.length ?? 0, ...normalizeArray(fields));\n\t\treturn this;\n\t}\n\n\t/**\n\t * Sets the author of this embed\n\t *\n\t * @param options The options for the author\n\t */\n\n\tpublic setAuthor(options: EmbedAuthorOptions | null): this {\n\t\tif (options === null) {\n\t\t\tthis.data.author = undefined;\n\t\t\treturn this;\n\t\t}\n\n\t\t// Data assertions\n\t\tembedAuthorPredicate.parse(options);\n\n\t\tthis.data.author = { name: options.name, url: options.url, icon_url: options.iconURL };\n\t\treturn this;\n\t}\n\n\t/**\n\t * Sets the color of this embed\n\t *\n\t * @param color The color of the embed\n\t */\n\tpublic setColor(color: number | RGBTuple | null): this {\n\t\t// Data assertions\n\t\tcolorPredicate.parse(color);\n\n\t\tif (Array.isArray(color)) {\n\t\t\tconst [red, green, blue] = color;\n\t\t\tthis.data.color = (red << 16) + (green << 8) + blue;\n\t\t\treturn this;\n\t\t}\n\t\tthis.data.color = color ?? undefined;\n\t\treturn this;\n\t}\n\n\t/**\n\t * Sets the description of this embed\n\t *\n\t * @param description The description\n\t */\n\tpublic setDescription(description: string | null): this {\n\t\t// Data assertions\n\t\tdescriptionPredicate.parse(description);\n\n\t\tthis.data.description = description ?? undefined;\n\t\treturn this;\n\t}\n\n\t/**\n\t * Sets the footer of this embed\n\t *\n\t * @param options The options for the footer\n\t */\n\tpublic setFooter(options: EmbedFooterOptions | null): this {\n\t\tif (options === null) {\n\t\t\tthis.data.footer = undefined;\n\t\t\treturn this;\n\t\t}\n\n\t\t// Data assertions\n\t\tembedFooterPredicate.parse(options);\n\n\t\tthis.data.footer = { text: options.text, icon_url: options.iconURL };\n\t\treturn this;\n\t}\n\n\t/**\n\t * Sets the image of this embed\n\t *\n\t * @param url The URL of the image\n\t */\n\tpublic setImage(url: string | null): this {\n\t\t// Data assertions\n\t\timageURLPredicate.parse(url);\n\n\t\tthis.data.image = url ? { url } : undefined;\n\t\treturn this;\n\t}\n\n\t/**\n\t * Sets the thumbnail of this embed\n\t *\n\t * @param url The URL of the thumbnail\n\t */\n\tpublic setThumbnail(url: string | null): this {\n\t\t// Data assertions\n\t\timageURLPredicate.parse(url);\n\n\t\tthis.data.thumbnail = url ? { url } : undefined;\n\t\treturn this;\n\t}\n\n\t/**\n\t * Sets the timestamp of this embed\n\t *\n\t * @param timestamp The timestamp or date\n\t */\n\tpublic setTimestamp(timestamp: number | Date | null = Date.now()): this {\n\t\t// Data assertions\n\t\ttimestampPredicate.parse(timestamp);\n\n\t\tthis.data.timestamp = timestamp ? new Date(timestamp).toISOString() : undefined;\n\t\treturn this;\n\t}\n\n\t/**\n\t * Sets the title of this embed\n\t *\n\t * @param title The title\n\t */\n\tpublic setTitle(title: string | null): this {\n\t\t// Data assertions\n\t\ttitlePredicate.parse(title);\n\n\t\tthis.data.title = title ?? undefined;\n\t\treturn this;\n\t}\n\n\t/**\n\t * Sets the URL of this embed\n\t *\n\t * @param url The URL\n\t */\n\tpublic setURL(url: string | null): this {\n\t\t// Data assertions\n\t\turlPredicate.parse(url);\n\n\t\tthis.data.url = url ?? undefined;\n\t\treturn this;\n\t}\n\n\t/**\n\t * Transforms the embed to a plain object\n\t */\n\tpublic toJSON(): APIEmbed {\n\t\treturn { ...this.data };\n\t}\n}\n"],"names":[],"mappings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SAAS,CAAC,CAAC;AACxC,IAAI,IAAI,CAAC,IAAI,CAAC,SAAS,GAAG,SAAS,GAAG,IAAI,IAAI,CAAC,SAAS,CAAC,CAAC,WAAW,EAAE,GAAG,KAAK,CAAC,CAAC;AACjF,IAAI,OAAO,IAAI,CAAC;AAChB,GAAG;AACH,EAAE,QAAQ,CAAC,KAAK,EAAE;AAClB,IAAI,cAAc,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;AAChC,IAAI,IAAI,CAAC,IAAI,CAAC,KAAK,GAAG,KAAK,IAAI,KAAK,CAAC,CAAC;AACtC,IAAI,OAAO,IAAI,CAAC;AAChB,GAAG;AACH,EAAE,MAAM,CAAC,GAAG,EAAE;AACd,IAAI,YAAY,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;AAC5B,IAAI,IAAI,CAAC,IAAI,CAAC,GAAG,GAAG,GAAG,IAAI,KAAK,CAAC,CAAC;AAClC,IAAI,OAAO,IAAI,CAAC;AAChB,GAAG;AACH,EAAE,MAAM,GAAG;AACX,IAAI,OAAO,EAAE,GAAG,IAAI,CAAC,IAAI,EAAE,CAAC;AAC5B,GAAG;AACH;;;;"}
@@ -0,0 +1,102 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ function codeBlock(language, content) {
6
+ return typeof content === "undefined" ? `\`\`\`
7
+ ${language}
8
+ \`\`\`` : `\`\`\`${language}
9
+ ${content}
10
+ \`\`\``;
11
+ }
12
+ function inlineCode(content) {
13
+ return `\`${content}\``;
14
+ }
15
+ function italic(content) {
16
+ return `_${content}_`;
17
+ }
18
+ function bold(content) {
19
+ return `**${content}**`;
20
+ }
21
+ function underscore(content) {
22
+ return `__${content}__`;
23
+ }
24
+ function strikethrough(content) {
25
+ return `~~${content}~~`;
26
+ }
27
+ function quote(content) {
28
+ return `> ${content}`;
29
+ }
30
+ function blockQuote(content) {
31
+ return `>>> ${content}`;
32
+ }
33
+ function hideLinkEmbed(url) {
34
+ return `<${url}>`;
35
+ }
36
+ function hyperlink(content, url, title) {
37
+ return title ? `[${content}](${url} "${title}")` : `[${content}](${url})`;
38
+ }
39
+ function spoiler(content) {
40
+ return `||${content}||`;
41
+ }
42
+ function userMention(userId) {
43
+ return `<@${userId}>`;
44
+ }
45
+ function channelMention(channelId) {
46
+ return `<#${channelId}>`;
47
+ }
48
+ function roleMention(roleId) {
49
+ return `<@&${roleId}>`;
50
+ }
51
+ function formatEmoji(emojiId, animated = false) {
52
+ return `<${animated ? "a" : ""}:_:${emojiId}>`;
53
+ }
54
+ function channelLink(channelId, guildId) {
55
+ return `https://discord.com/channels/${guildId ?? "@me"}/${channelId}`;
56
+ }
57
+ function messageLink(channelId, messageId, guildId) {
58
+ return `${typeof guildId === "undefined" ? channelLink(channelId) : channelLink(channelId, guildId)}/${messageId}`;
59
+ }
60
+ function time(timeOrSeconds, style) {
61
+ if (typeof timeOrSeconds !== "number") {
62
+ timeOrSeconds = Math.floor((timeOrSeconds?.getTime() ?? Date.now()) / 1e3);
63
+ }
64
+ return typeof style === "string" ? `<t:${timeOrSeconds}:${style}>` : `<t:${timeOrSeconds}>`;
65
+ }
66
+ const TimestampStyles = {
67
+ ShortTime: "t",
68
+ LongTime: "T",
69
+ ShortDate: "d",
70
+ LongDate: "D",
71
+ ShortDateTime: "f",
72
+ LongDateTime: "F",
73
+ RelativeTime: "R"
74
+ };
75
+ var Faces = /* @__PURE__ */ ((Faces2) => {
76
+ Faces2["Shrug"] = "\xAF\\_(\u30C4)\\_/\xAF";
77
+ Faces2["Tableflip"] = "(\u256F\xB0\u25A1\xB0\uFF09\u256F\uFE35 \u253B\u2501\u253B";
78
+ Faces2["Unflip"] = "\u252C\u2500\u252C \u30CE( \u309C-\u309C\u30CE)";
79
+ return Faces2;
80
+ })(Faces || {});
81
+
82
+ exports.Faces = Faces;
83
+ exports.TimestampStyles = TimestampStyles;
84
+ exports.blockQuote = blockQuote;
85
+ exports.bold = bold;
86
+ exports.channelLink = channelLink;
87
+ exports.channelMention = channelMention;
88
+ exports.codeBlock = codeBlock;
89
+ exports.formatEmoji = formatEmoji;
90
+ exports.hideLinkEmbed = hideLinkEmbed;
91
+ exports.hyperlink = hyperlink;
92
+ exports.inlineCode = inlineCode;
93
+ exports.italic = italic;
94
+ exports.messageLink = messageLink;
95
+ exports.quote = quote;
96
+ exports.roleMention = roleMention;
97
+ exports.spoiler = spoiler;
98
+ exports.strikethrough = strikethrough;
99
+ exports.time = time;
100
+ exports.underscore = underscore;
101
+ exports.userMention = userMention;
102
+ //# sourceMappingURL=formatters.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"formatters.cjs","sources":["../../src/messages/formatters.ts"],"sourcesContent":["import type { URL } from 'url';\nimport type { Snowflake } from 'discord-api-types/globals';\n\n/**\n * Wraps the content inside a codeblock with no language\n *\n * @param content - The content to wrap\n */\nexport function codeBlock<C extends string>(content: C): `\\`\\`\\`\\n${C}\\n\\`\\`\\``;\n\n/**\n * Wraps the content inside a codeblock with the specified language\n *\n * @param language - The language for the codeblock\n * @param content - The content to wrap\n */\nexport function codeBlock<L extends string, C extends string>(language: L, content: C): `\\`\\`\\`${L}\\n${C}\\n\\`\\`\\``;\nexport function codeBlock(language: string, content?: string): string {\n\treturn typeof content === 'undefined' ? `\\`\\`\\`\\n${language}\\n\\`\\`\\`` : `\\`\\`\\`${language}\\n${content}\\n\\`\\`\\``;\n}\n\n/**\n * Wraps the content inside \\`backticks\\`, which formats it as inline code\n *\n * @param content - The content to wrap\n */\nexport function inlineCode<C extends string>(content: C): `\\`${C}\\`` {\n\treturn `\\`${content}\\``;\n}\n\n/**\n * Formats the content into italic text\n *\n * @param content - The content to wrap\n */\nexport function italic<C extends string>(content: C): `_${C}_` {\n\treturn `_${content}_`;\n}\n\n/**\n * Formats the content into bold text\n *\n * @param content - The content to wrap\n */\nexport function bold<C extends string>(content: C): `**${C}**` {\n\treturn `**${content}**`;\n}\n\n/**\n * Formats the content into underscored text\n *\n * @param content - The content to wrap\n */\nexport function underscore<C extends string>(content: C): `__${C}__` {\n\treturn `__${content}__`;\n}\n\n/**\n * Formats the content into strike-through text\n *\n * @param content - The content to wrap\n */\nexport function strikethrough<C extends string>(content: C): `~~${C}~~` {\n\treturn `~~${content}~~`;\n}\n\n/**\n * Formats the content into a quote. This needs to be at the start of the line for Discord to format it\n *\n * @param content - The content to wrap\n */\nexport function quote<C extends string>(content: C): `> ${C}` {\n\treturn `> ${content}`;\n}\n\n/**\n * Formats the content into a block quote. This needs to be at the start of the line for Discord to format it\n *\n * @param content - The content to wrap\n */\nexport function blockQuote<C extends string>(content: C): `>>> ${C}` {\n\treturn `>>> ${content}`;\n}\n\n/**\n * Wraps the URL into `<>`, which stops it from embedding\n *\n * @param url - The URL to wrap\n */\nexport function hideLinkEmbed<C extends string>(url: C): `<${C}>`;\n\n/**\n * Wraps the URL into `<>`, which stops it from embedding\n *\n * @param url - The URL to wrap\n */\nexport function hideLinkEmbed(url: URL): `<${string}>`;\nexport function hideLinkEmbed(url: string | URL) {\n\t// eslint-disable-next-line @typescript-eslint/restrict-template-expressions\n\treturn `<${url}>`;\n}\n\n/**\n * Formats the content and the URL into a masked URL\n *\n * @param content - The content to display\n * @param url - The URL the content links to\n */\nexport function hyperlink<C extends string>(content: C, url: URL): `[${C}](${string})`;\n\n/**\n * Formats the content and the URL into a masked URL\n *\n * @param content - The content to display\n * @param url - The URL the content links to\n */\nexport function hyperlink<C extends string, U extends string>(content: C, url: U): `[${C}](${U})`;\n\n/**\n * Formats the content and the URL into a masked URL\n *\n * @param content - The content to display\n * @param url - The URL the content links to\n * @param title - The title shown when hovering on the masked link\n */\nexport function hyperlink<C extends string, T extends string>(\n\tcontent: C,\n\turl: URL,\n\ttitle: T,\n): `[${C}](${string} \"${T}\")`;\n\n/**\n * Formats the content and the URL into a masked URL\n *\n * @param content - The content to display\n * @param url - The URL the content links to\n * @param title - The title shown when hovering on the masked link\n */\nexport function hyperlink<C extends string, U extends string, T extends string>(\n\tcontent: C,\n\turl: U,\n\ttitle: T,\n): `[${C}](${U} \"${T}\")`;\nexport function hyperlink(content: string, url: string | URL, title?: string) {\n\t// eslint-disable-next-line @typescript-eslint/restrict-template-expressions\n\treturn title ? `[${content}](${url} \"${title}\")` : `[${content}](${url})`;\n}\n\n/**\n * Wraps the content inside spoiler (hidden text)\n *\n * @param content - The content to wrap\n */\nexport function spoiler<C extends string>(content: C): `||${C}||` {\n\treturn `||${content}||`;\n}\n\n/**\n * Formats a user ID into a user mention\n *\n * @param userId - The user ID to format\n */\nexport function userMention<C extends Snowflake>(userId: C): `<@${C}>` {\n\treturn `<@${userId}>`;\n}\n\n/**\n * Formats a channel ID into a channel mention\n *\n * @param channelId - The channel ID to format\n */\nexport function channelMention<C extends Snowflake>(channelId: C): `<#${C}>` {\n\treturn `<#${channelId}>`;\n}\n\n/**\n * Formats a role ID into a role mention\n *\n * @param roleId - The role ID to format\n */\nexport function roleMention<C extends Snowflake>(roleId: C): `<@&${C}>` {\n\treturn `<@&${roleId}>`;\n}\n\n/**\n * Formats an emoji ID into a fully qualified emoji identifier\n *\n * @param emojiId - The emoji ID to format\n */\nexport function formatEmoji<C extends Snowflake>(emojiId: C, animated?: false): `<:_:${C}>`;\n\n/**\n * Formats an emoji ID into a fully qualified emoji identifier\n *\n * @param emojiId - The emoji ID to format\n * @param animated - Whether the emoji is animated or not. Defaults to `false`\n */\nexport function formatEmoji<C extends Snowflake>(emojiId: C, animated?: true): `<a:_:${C}>`;\n\n/**\n * Formats an emoji ID into a fully qualified emoji identifier\n *\n * @param emojiId - The emoji ID to format\n * @param animated - Whether the emoji is animated or not. Defaults to `false`\n */\nexport function formatEmoji<C extends Snowflake>(emojiId: C, animated = false): `<a:_:${C}>` | `<:_:${C}>` {\n\treturn `<${animated ? 'a' : ''}:_:${emojiId}>`;\n}\n\n/**\n * Formats a channel link for a direct message channel.\n *\n * @param channelId - The channel's id\n */\nexport function channelLink<C extends Snowflake>(channelId: C): `https://discord.com/channels/@me/${C}`;\n\n/**\n * Formats a channel link for a guild channel.\n *\n * @param channelId - The channel's id\n * @param guildId - The guild's id\n */\nexport function channelLink<C extends Snowflake, G extends Snowflake>(\n\tchannelId: C,\n\tguildId: G,\n): `https://discord.com/channels/${G}/${C}`;\n\nexport function channelLink<C extends Snowflake, G extends Snowflake>(\n\tchannelId: C,\n\tguildId?: G,\n): `https://discord.com/channels/@me/${C}` | `https://discord.com/channels/${G}/${C}` {\n\treturn `https://discord.com/channels/${guildId ?? '@me'}/${channelId}`;\n}\n\n/**\n * Formats a message link for a direct message channel.\n *\n * @param channelId - The channel's id\n * @param messageId - The message's id\n */\nexport function messageLink<C extends Snowflake, M extends Snowflake>(\n\tchannelId: C,\n\tmessageId: M,\n): `https://discord.com/channels/@me/${C}/${M}`;\n\n/**\n * Formats a message link for a guild channel.\n *\n * @param channelId - The channel's id\n * @param messageId - The message's id\n * @param guildId - The guild's id\n */\nexport function messageLink<C extends Snowflake, M extends Snowflake, G extends Snowflake>(\n\tchannelId: C,\n\tmessageId: M,\n\tguildId: G,\n): `https://discord.com/channels/${G}/${C}/${M}`;\n\nexport function messageLink<C extends Snowflake, M extends Snowflake, G extends Snowflake>(\n\tchannelId: C,\n\tmessageId: M,\n\tguildId?: G,\n): `https://discord.com/channels/@me/${C}/${M}` | `https://discord.com/channels/${G}/${C}/${M}` {\n\treturn `${typeof guildId === 'undefined' ? channelLink(channelId) : channelLink(channelId, guildId)}/${messageId}`;\n}\n\n/**\n * Formats a date into a short date-time string\n *\n * @param date - The date to format, defaults to the current time\n */\nexport function time(date?: Date): `<t:${bigint}>`;\n\n/**\n * Formats a date given a format style\n *\n * @param date - The date to format\n * @param style - The style to use\n */\nexport function time<S extends TimestampStylesString>(date: Date, style: S): `<t:${bigint}:${S}>`;\n\n/**\n * Formats the given timestamp into a short date-time string\n *\n * @param seconds - The time to format, represents an UNIX timestamp in seconds\n */\nexport function time<C extends number>(seconds: C): `<t:${C}>`;\n\n/**\n * Formats the given timestamp into a short date-time string\n *\n * @param seconds - The time to format, represents an UNIX timestamp in seconds\n * @param style - The style to use\n */\nexport function time<C extends number, S extends TimestampStylesString>(seconds: C, style: S): `<t:${C}:${S}>`;\nexport function time(timeOrSeconds?: number | Date, style?: TimestampStylesString): string {\n\tif (typeof timeOrSeconds !== 'number') {\n\t\ttimeOrSeconds = Math.floor((timeOrSeconds?.getTime() ?? Date.now()) / 1000);\n\t}\n\n\treturn typeof style === 'string' ? `<t:${timeOrSeconds}:${style}>` : `<t:${timeOrSeconds}>`;\n}\n\n/**\n * The {@link https://discord.com/developers/docs/reference#message-formatting-timestamp-styles | message formatting timestamp styles} supported by Discord\n */\nexport const TimestampStyles = {\n\t/**\n\t * Short time format, consisting of hours and minutes, e.g. 16:20\n\t */\n\tShortTime: 't',\n\n\t/**\n\t * Long time format, consisting of hours, minutes, and seconds, e.g. 16:20:30\n\t */\n\tLongTime: 'T',\n\n\t/**\n\t * Short date format, consisting of day, month, and year, e.g. 20/04/2021\n\t */\n\tShortDate: 'd',\n\n\t/**\n\t * Long date format, consisting of day, month, and year, e.g. 20 April 2021\n\t */\n\tLongDate: 'D',\n\n\t/**\n\t * Short date-time format, consisting of short date and short time formats, e.g. 20 April 2021 16:20\n\t */\n\tShortDateTime: 'f',\n\n\t/**\n\t * Long date-time format, consisting of long date and short time formats, e.g. Tuesday, 20 April 2021 16:20\n\t */\n\tLongDateTime: 'F',\n\n\t/**\n\t * Relative time format, consisting of a relative duration format, e.g. 2 months ago\n\t */\n\tRelativeTime: 'R',\n} as const;\n\n/**\n * The possible values, see {@link TimestampStyles} for more information\n */\nexport type TimestampStylesString = typeof TimestampStyles[keyof typeof TimestampStyles];\n\n/**\n * An enum with all the available faces from Discord's native slash commands\n */\nexport enum Faces {\n\t/**\n\t * ¯\\\\_(ツ)\\\\_/¯\n\t */\n\tShrug = '¯\\\\_(ツ)\\\\_/¯',\n\n\t/**\n\t * (╯°□°)╯︵ ┻━┻\n\t */\n\tTableflip = '(╯°□°)╯︵ ┻━┻',\n\n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AC,GAAG,WAAW,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC,CAAC,EAAE,SAAS,CAAC,CAAC,CAAC;AACrH,CAAC;AACM,SAAS,IAAI,CAAC,aAAa,EAAE,KAAK,EAAE;AAC3C,EAAE,IAAI,OAAO,aAAa,KAAK,QAAQ,EAAE;AACzC,IAAI,aAAa,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,aAAa,EAAE,OAAO,EAAE,IAAI,IAAI,CAAC,GAAG,EAAE,IAAI,GAAG,CAAC,CAAC;AAC/E,GAAG;AACH,EAAE,OAAO,OAAO,KAAK,KAAK,QAAQ,GAAG,CAAC,GAAG,EAAE,aAAa,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,EAAE,aAAa,CAAC,CAAC,CAAC,CAAC;AAC9F,CAAC;AACW,MAAC,eAAe,GAAG;AAC/B,EAAE,SAAS,EAAE,GAAG;AAChB,EAAE,QAAQ,EAAE,GAAG;AACf,EAAE,SAAS,EAAE,GAAG;AAChB,EAAE,QAAQ,EAAE,GAAG;AACf,EAAE,aAAa,EAAE,GAAG;AACpB,EAAE,YAAY,EAAE,GAAG;AACnB,EAAE,YAAY,EAAE,GAAG;AACnB,EAAE;AACQ,IAAC,KAAK,mBAAmB,CAAC,CAAC,MAAM,KAAK;AAChD,EAAE,MAAM,CAAC,OAAO,CAAC,GAAG,yBAAyB,CAAC;AAC9C,EAAE,MAAM,CAAC,WAAW,CAAC,GAAG,4DAA4D,CAAC;AACrF,EAAE,MAAM,CAAC,QAAQ,CAAC,GAAG,iDAAiD,CAAC;AACvE,EAAE,OAAO,MAAM,CAAC;AAChB,CAAC,EAAE,KAAK,IAAI,EAAE;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -0,0 +1,246 @@
1
+ /// <reference types="node" />
2
+ import type { URL } from 'url';
3
+ import type { Snowflake } from 'discord-api-types/globals';
4
+ /**
5
+ * Wraps the content inside a codeblock with no language
6
+ *
7
+ * @param content - The content to wrap
8
+ */
9
+ export declare function codeBlock<C extends string>(content: C): `\`\`\`\n${C}\n\`\`\``;
10
+ /**
11
+ * Wraps the content inside a codeblock with the specified language
12
+ *
13
+ * @param language - The language for the codeblock
14
+ * @param content - The content to wrap
15
+ */
16
+ export declare function codeBlock<L extends string, C extends string>(language: L, content: C): `\`\`\`${L}\n${C}\n\`\`\``;
17
+ /**
18
+ * Wraps the content inside \`backticks\`, which formats it as inline code
19
+ *
20
+ * @param content - The content to wrap
21
+ */
22
+ export declare function inlineCode<C extends string>(content: C): `\`${C}\``;
23
+ /**
24
+ * Formats the content into italic text
25
+ *
26
+ * @param content - The content to wrap
27
+ */
28
+ export declare function italic<C extends string>(content: C): `_${C}_`;
29
+ /**
30
+ * Formats the content into bold text
31
+ *
32
+ * @param content - The content to wrap
33
+ */
34
+ export declare function bold<C extends string>(content: C): `**${C}**`;
35
+ /**
36
+ * Formats the content into underscored text
37
+ *
38
+ * @param content - The content to wrap
39
+ */
40
+ export declare function underscore<C extends string>(content: C): `__${C}__`;
41
+ /**
42
+ * Formats the content into strike-through text
43
+ *
44
+ * @param content - The content to wrap
45
+ */
46
+ export declare function strikethrough<C extends string>(content: C): `~~${C}~~`;
47
+ /**
48
+ * Formats the content into a quote. This needs to be at the start of the line for Discord to format it
49
+ *
50
+ * @param content - The content to wrap
51
+ */
52
+ export declare function quote<C extends string>(content: C): `> ${C}`;
53
+ /**
54
+ * Formats the content into a block quote. This needs to be at the start of the line for Discord to format it
55
+ *
56
+ * @param content - The content to wrap
57
+ */
58
+ export declare function blockQuote<C extends string>(content: C): `>>> ${C}`;
59
+ /**
60
+ * Wraps the URL into `<>`, which stops it from embedding
61
+ *
62
+ * @param url - The URL to wrap
63
+ */
64
+ export declare function hideLinkEmbed<C extends string>(url: C): `<${C}>`;
65
+ /**
66
+ * Wraps the URL into `<>`, which stops it from embedding
67
+ *
68
+ * @param url - The URL to wrap
69
+ */
70
+ export declare function hideLinkEmbed(url: URL): `<${string}>`;
71
+ /**
72
+ * Formats the content and the URL into a masked URL
73
+ *
74
+ * @param content - The content to display
75
+ * @param url - The URL the content links to
76
+ */
77
+ export declare function hyperlink<C extends string>(content: C, url: URL): `[${C}](${string})`;
78
+ /**
79
+ * Formats the content and the URL into a masked URL
80
+ *
81
+ * @param content - The content to display
82
+ * @param url - The URL the content links to
83
+ */
84
+ export declare function hyperlink<C extends string, U extends string>(content: C, url: U): `[${C}](${U})`;
85
+ /**
86
+ * Formats the content and the URL into a masked URL
87
+ *
88
+ * @param content - The content to display
89
+ * @param url - The URL the content links to
90
+ * @param title - The title shown when hovering on the masked link
91
+ */
92
+ export declare function hyperlink<C extends string, T extends string>(content: C, url: URL, title: T): `[${C}](${string} "${T}")`;
93
+ /**
94
+ * Formats the content and the URL into a masked URL
95
+ *
96
+ * @param content - The content to display
97
+ * @param url - The URL the content links to
98
+ * @param title - The title shown when hovering on the masked link
99
+ */
100
+ export declare function hyperlink<C extends string, U extends string, T extends string>(content: C, url: U, title: T): `[${C}](${U} "${T}")`;
101
+ /**
102
+ * Wraps the content inside spoiler (hidden text)
103
+ *
104
+ * @param content - The content to wrap
105
+ */
106
+ export declare function spoiler<C extends string>(content: C): `||${C}||`;
107
+ /**
108
+ * Formats a user ID into a user mention
109
+ *
110
+ * @param userId - The user ID to format
111
+ */
112
+ export declare function userMention<C extends Snowflake>(userId: C): `<@${C}>`;
113
+ /**
114
+ * Formats a channel ID into a channel mention
115
+ *
116
+ * @param channelId - The channel ID to format
117
+ */
118
+ export declare function channelMention<C extends Snowflake>(channelId: C): `<#${C}>`;
119
+ /**
120
+ * Formats a role ID into a role mention
121
+ *
122
+ * @param roleId - The role ID to format
123
+ */
124
+ export declare function roleMention<C extends Snowflake>(roleId: C): `<@&${C}>`;
125
+ /**
126
+ * Formats an emoji ID into a fully qualified emoji identifier
127
+ *
128
+ * @param emojiId - The emoji ID to format
129
+ */
130
+ export declare function formatEmoji<C extends Snowflake>(emojiId: C, animated?: false): `<:_:${C}>`;
131
+ /**
132
+ * Formats an emoji ID into a fully qualified emoji identifier
133
+ *
134
+ * @param emojiId - The emoji ID to format
135
+ * @param animated - Whether the emoji is animated or not. Defaults to `false`
136
+ */
137
+ export declare function formatEmoji<C extends Snowflake>(emojiId: C, animated?: true): `<a:_:${C}>`;
138
+ /**
139
+ * Formats a channel link for a direct message channel.
140
+ *
141
+ * @param channelId - The channel's id
142
+ */
143
+ export declare function channelLink<C extends Snowflake>(channelId: C): `https://discord.com/channels/@me/${C}`;
144
+ /**
145
+ * Formats a channel link for a guild channel.
146
+ *
147
+ * @param channelId - The channel's id
148
+ * @param guildId - The guild's id
149
+ */
150
+ export declare function channelLink<C extends Snowflake, G extends Snowflake>(channelId: C, guildId: G): `https://discord.com/channels/${G}/${C}`;
151
+ /**
152
+ * Formats a message link for a direct message channel.
153
+ *
154
+ * @param channelId - The channel's id
155
+ * @param messageId - The message's id
156
+ */
157
+ export declare function messageLink<C extends Snowflake, M extends Snowflake>(channelId: C, messageId: M): `https://discord.com/channels/@me/${C}/${M}`;
158
+ /**
159
+ * Formats a message link for a guild channel.
160
+ *
161
+ * @param channelId - The channel's id
162
+ * @param messageId - The message's id
163
+ * @param guildId - The guild's id
164
+ */
165
+ export declare function messageLink<C extends Snowflake, M extends Snowflake, G extends Snowflake>(channelId: C, messageId: M, guildId: G): `https://discord.com/channels/${G}/${C}/${M}`;
166
+ /**
167
+ * Formats a date into a short date-time string
168
+ *
169
+ * @param date - The date to format, defaults to the current time
170
+ */
171
+ export declare function time(date?: Date): `<t:${bigint}>`;
172
+ /**
173
+ * Formats a date given a format style
174
+ *
175
+ * @param date - The date to format
176
+ * @param style - The style to use
177
+ */
178
+ export declare function time<S extends TimestampStylesString>(date: Date, style: S): `<t:${bigint}:${S}>`;
179
+ /**
180
+ * Formats the given timestamp into a short date-time string
181
+ *
182
+ * @param seconds - The time to format, represents an UNIX timestamp in seconds
183
+ */
184
+ export declare function time<C extends number>(seconds: C): `<t:${C}>`;
185
+ /**
186
+ * Formats the given timestamp into a short date-time string
187
+ *
188
+ * @param seconds - The time to format, represents an UNIX timestamp in seconds
189
+ * @param style - The style to use
190
+ */
191
+ export declare function time<C extends number, S extends TimestampStylesString>(seconds: C, style: S): `<t:${C}:${S}>`;
192
+ /**
193
+ * The {@link https://discord.com/developers/docs/reference#message-formatting-timestamp-styles | message formatting timestamp styles} supported by Discord
194
+ */
195
+ export declare const TimestampStyles: {
196
+ /**
197
+ * Short time format, consisting of hours and minutes, e.g. 16:20
198
+ */
199
+ readonly ShortTime: "t";
200
+ /**
201
+ * Long time format, consisting of hours, minutes, and seconds, e.g. 16:20:30
202
+ */
203
+ readonly LongTime: "T";
204
+ /**
205
+ * Short date format, consisting of day, month, and year, e.g. 20/04/2021
206
+ */
207
+ readonly ShortDate: "d";
208
+ /**
209
+ * Long date format, consisting of day, month, and year, e.g. 20 April 2021
210
+ */
211
+ readonly LongDate: "D";
212
+ /**
213
+ * Short date-time format, consisting of short date and short time formats, e.g. 20 April 2021 16:20
214
+ */
215
+ readonly ShortDateTime: "f";
216
+ /**
217
+ * Long date-time format, consisting of long date and short time formats, e.g. Tuesday, 20 April 2021 16:20
218
+ */
219
+ readonly LongDateTime: "F";
220
+ /**
221
+ * Relative time format, consisting of a relative duration format, e.g. 2 months ago
222
+ */
223
+ readonly RelativeTime: "R";
224
+ };
225
+ /**
226
+ * The possible values, see {@link TimestampStyles} for more information
227
+ */
228
+ export declare type TimestampStylesString = typeof TimestampStyles[keyof typeof TimestampStyles];
229
+ /**
230
+ * An enum with all the available faces from Discord's native slash commands
231
+ */
232
+ export declare enum Faces {
233
+ /**
234
+ * ¯\\_(ツ)\\_/¯
235
+ */
236
+ Shrug = "\u00AF\\_(\u30C4)\\_/\u00AF",
237
+ /**
238
+ * (╯°□°)╯︵ ┻━┻
239
+ */
240
+ Tableflip = "(\u256F\u00B0\u25A1\u00B0\uFF09\u256F\uFE35 \u253B\u2501\u253B",
241
+ /**
242
+ * ┬─┬ ノ( ゜-゜ノ)
243
+ */
244
+ Unflip = "\u252C\u2500\u252C \u30CE( \u309C-\u309C\u30CE)"
245
+ }
246
+ //# sourceMappingURL=formatters.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"formatters.d.ts","sourceRoot":"","sources":["../../src/messages/formatters.ts"],"names":[],"mappings":";AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAC/B,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AAE3D;;;;GAIG;AACH,wBAAgB,SAAS,CAAC,CAAC,SAAS,MAAM,EAAE,OAAO,EAAE,CAAC,GAAG,WAAW,CAAC,UAAU,CAAC;AAEhF;;;;;GAKG;AACH,wBAAgB,SAAS,CAAC,CAAC,SAAS,MAAM,EAAE,CAAC,SAAS,MAAM,EAAE,QAAQ,EAAE,CAAC,EAAE,OAAO,EAAE,CAAC,GAAG,SAAS,CAAC,KAAK,CAAC,UAAU,CAAC;AAKnH;;;;GAIG;AACH,wBAAgB,UAAU,CAAC,CAAC,SAAS,MAAM,EAAE,OAAO,EAAE,CAAC,GAAG,KAAK,CAAC,IAAI,CAEnE;AAED;;;;GAIG;AACH,wBAAgB,MAAM,CAAC,CAAC,SAAS,MAAM,EAAE,OAAO,EAAE,CAAC,GAAG,IAAI,CAAC,GAAG,CAE7D;AAED;;;;GAIG;AACH,wBAAgB,IAAI,CAAC,CAAC,SAAS,MAAM,EAAE,OAAO,EAAE,CAAC,GAAG,KAAK,CAAC,IAAI,CAE7D;AAED;;;;GAIG;AACH,wBAAgB,UAAU,CAAC,CAAC,SAAS,MAAM,EAAE,OAAO,EAAE,CAAC,GAAG,KAAK,CAAC,IAAI,CAEnE;AAED;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,CAAC,SAAS,MAAM,EAAE,OAAO,EAAE,CAAC,GAAG,KAAK,CAAC,IAAI,CAEtE;AAED;;;;GAIG;AACH,wBAAgB,KAAK,CAAC,CAAC,SAAS,MAAM,EAAE,OAAO,EAAE,C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