discord-transcriptify 0.0.0-stage → 1.0.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/LICENSE +201 -0
  2. package/NOTICE +8 -0
  3. package/README.md +290 -2
  4. package/dist/downloader/budget.d.ts +26 -0
  5. package/dist/downloader/budget.js +68 -0
  6. package/dist/downloader/budget.js.map +1 -0
  7. package/dist/downloader/fetch.d.ts +22 -0
  8. package/dist/downloader/fetch.js +131 -0
  9. package/dist/downloader/fetch.js.map +1 -0
  10. package/dist/downloader/images.d.ts +107 -0
  11. package/dist/downloader/images.js +202 -0
  12. package/dist/downloader/images.js.map +1 -0
  13. package/dist/features/images.d.ts +2 -0
  14. package/dist/features/images.js +17 -0
  15. package/dist/features/images.js.map +1 -0
  16. package/dist/features/index.d.ts +9 -0
  17. package/dist/features/index.js +52 -0
  18. package/dist/features/index.js.map +1 -0
  19. package/dist/features/members/collect.d.ts +9 -0
  20. package/dist/features/members/collect.js +48 -0
  21. package/dist/features/members/collect.js.map +1 -0
  22. package/dist/features/members/index.d.ts +2 -0
  23. package/dist/features/members/index.js +9 -0
  24. package/dist/features/members/index.js.map +1 -0
  25. package/dist/features/resolve.d.ts +26 -0
  26. package/dist/features/resolve.js +51 -0
  27. package/dist/features/resolve.js.map +1 -0
  28. package/dist/features/threadMessages/collect.d.ts +3 -0
  29. package/dist/features/threadMessages/collect.js +80 -0
  30. package/dist/features/threadMessages/collect.js.map +1 -0
  31. package/dist/features/threadMessages/index.d.ts +2 -0
  32. package/dist/features/threadMessages/index.js +9 -0
  33. package/dist/features/threadMessages/index.js.map +1 -0
  34. package/dist/features/types.d.ts +77 -0
  35. package/dist/features/types.js +3 -0
  36. package/dist/features/types.js.map +1 -0
  37. package/dist/features/ui/imagePreview.d.ts +2 -0
  38. package/dist/features/ui/imagePreview.js +9 -0
  39. package/dist/features/ui/imagePreview.js.map +1 -0
  40. package/dist/features/ui/memberList.d.ts +2 -0
  41. package/dist/features/ui/memberList.js +9 -0
  42. package/dist/features/ui/memberList.js.map +1 -0
  43. package/dist/features/ui/pinnedMessages.d.ts +2 -0
  44. package/dist/features/ui/pinnedMessages.js +9 -0
  45. package/dist/features/ui/pinnedMessages.js.map +1 -0
  46. package/dist/features/ui/search.d.ts +2 -0
  47. package/dist/features/ui/search.js +9 -0
  48. package/dist/features/ui/search.js.map +1 -0
  49. package/dist/features/ui/selectMenus.d.ts +2 -0
  50. package/dist/features/ui/selectMenus.js +9 -0
  51. package/dist/features/ui/selectMenus.js.map +1 -0
  52. package/dist/features/ui/serverTags.d.ts +2 -0
  53. package/dist/features/ui/serverTags.js +9 -0
  54. package/dist/features/ui/serverTags.js.map +1 -0
  55. package/dist/features/ui/threadModal.d.ts +2 -0
  56. package/dist/features/ui/threadModal.js +9 -0
  57. package/dist/features/ui/threadModal.js.map +1 -0
  58. package/dist/features/ui/voicePlayer.d.ts +2 -0
  59. package/dist/features/ui/voicePlayer.js +9 -0
  60. package/dist/features/ui/voicePlayer.js.map +1 -0
  61. package/dist/features/voiceMessages.d.ts +15 -0
  62. package/dist/features/voiceMessages.js +37 -0
  63. package/dist/features/voiceMessages.js.map +1 -0
  64. package/dist/generator/discordComponents.d.ts +33 -0
  65. package/dist/generator/discordComponents.js +62 -0
  66. package/dist/generator/discordComponents.js.map +1 -0
  67. package/dist/generator/index.d.ts +24 -0
  68. package/dist/generator/index.js +89 -0
  69. package/dist/generator/index.js.map +1 -0
  70. package/dist/generator/renderers/attachment.d.ts +29 -0
  71. package/dist/generator/renderers/attachment.js +71 -0
  72. package/dist/generator/renderers/attachment.js.map +1 -0
  73. package/dist/generator/renderers/components/AttachmentGallery.d.ts +14 -0
  74. package/dist/generator/renderers/components/AttachmentGallery.js +55 -0
  75. package/dist/generator/renderers/components/AttachmentGallery.js.map +1 -0
  76. package/dist/generator/renderers/components/Button.d.ts +10 -0
  77. package/dist/generator/renderers/components/Button.js +27 -0
  78. package/dist/generator/renderers/components/Button.js.map +1 -0
  79. package/dist/generator/renderers/components/Checkbox.d.ts +7 -0
  80. package/dist/generator/renderers/components/Checkbox.js +34 -0
  81. package/dist/generator/renderers/components/Checkbox.js.map +1 -0
  82. package/dist/generator/renderers/components/Container.d.ts +8 -0
  83. package/dist/generator/renderers/components/Container.js +16 -0
  84. package/dist/generator/renderers/components/Container.js.map +1 -0
  85. package/dist/generator/renderers/components/Media Gallery.d.ts +11 -0
  86. package/dist/generator/renderers/components/Media Gallery.js +97 -0
  87. package/dist/generator/renderers/components/Media Gallery.js.map +1 -0
  88. package/dist/generator/renderers/components/RadioGroup.d.ts +12 -0
  89. package/dist/generator/renderers/components/RadioGroup.js +55 -0
  90. package/dist/generator/renderers/components/RadioGroup.js.map +1 -0
  91. package/dist/generator/renderers/components/Select Menu.d.ts +8 -0
  92. package/dist/generator/renderers/components/Select Menu.js +40 -0
  93. package/dist/generator/renderers/components/Select Menu.js.map +1 -0
  94. package/dist/generator/renderers/components/Spacing.d.ts +7 -0
  95. package/dist/generator/renderers/components/Spacing.js +13 -0
  96. package/dist/generator/renderers/components/Spacing.js.map +1 -0
  97. package/dist/generator/renderers/components/Thumbnail.d.ts +8 -0
  98. package/dist/generator/renderers/components/Thumbnail.js +16 -0
  99. package/dist/generator/renderers/components/Thumbnail.js.map +1 -0
  100. package/dist/generator/renderers/components/section/Section.d.ts +13 -0
  101. package/dist/generator/renderers/components/section/Section.js +16 -0
  102. package/dist/generator/renderers/components/section/Section.js.map +1 -0
  103. package/dist/generator/renderers/components/section/SectionAccessory.d.ts +6 -0
  104. package/dist/generator/renderers/components/section/SectionAccessory.js +13 -0
  105. package/dist/generator/renderers/components/section/SectionAccessory.js.map +1 -0
  106. package/dist/generator/renderers/components/section/SectionContent.d.ts +6 -0
  107. package/dist/generator/renderers/components/section/SectionContent.js +11 -0
  108. package/dist/generator/renderers/components/section/SectionContent.js.map +1 -0
  109. package/dist/generator/renderers/components/styles.d.ts +18 -0
  110. package/dist/generator/renderers/components/styles.js +2440 -0
  111. package/dist/generator/renderers/components/styles.js.map +1 -0
  112. package/dist/generator/renderers/components/utils.d.ts +34 -0
  113. package/dist/generator/renderers/components/utils.js +94 -0
  114. package/dist/generator/renderers/components/utils.js.map +1 -0
  115. package/dist/generator/renderers/components.d.ts +20 -0
  116. package/dist/generator/renderers/components.js +120 -0
  117. package/dist/generator/renderers/components.js.map +1 -0
  118. package/dist/generator/renderers/content.d.ts +26 -0
  119. package/dist/generator/renderers/content.js +163 -0
  120. package/dist/generator/renderers/content.js.map +1 -0
  121. package/dist/generator/renderers/embed.d.ts +14 -0
  122. package/dist/generator/renderers/embed.js +62 -0
  123. package/dist/generator/renderers/embed.js.map +1 -0
  124. package/dist/generator/renderers/message.d.ts +9 -0
  125. package/dist/generator/renderers/message.js +102 -0
  126. package/dist/generator/renderers/message.js.map +1 -0
  127. package/dist/generator/renderers/poll.d.ts +11 -0
  128. package/dist/generator/renderers/poll.js +49 -0
  129. package/dist/generator/renderers/poll.js.map +1 -0
  130. package/dist/generator/renderers/reply.d.ts +7 -0
  131. package/dist/generator/renderers/reply.js +63 -0
  132. package/dist/generator/renderers/reply.js.map +1 -0
  133. package/dist/generator/renderers/sticker.d.ts +12 -0
  134. package/dist/generator/renderers/sticker.js +40 -0
  135. package/dist/generator/renderers/sticker.js.map +1 -0
  136. package/dist/generator/renderers/systemMessage.d.ts +21 -0
  137. package/dist/generator/renderers/systemMessage.js +226 -0
  138. package/dist/generator/renderers/systemMessage.js.map +1 -0
  139. package/dist/generator/renderers/threadMessages.d.ts +21 -0
  140. package/dist/generator/renderers/threadMessages.js +31 -0
  141. package/dist/generator/renderers/threadMessages.js.map +1 -0
  142. package/dist/generator/renderers/voice.d.ts +20 -0
  143. package/dist/generator/renderers/voice.js +51 -0
  144. package/dist/generator/renderers/voice.js.map +1 -0
  145. package/dist/generator/transcript.d.ts +7 -0
  146. package/dist/generator/transcript.js +145 -0
  147. package/dist/generator/transcript.js.map +1 -0
  148. package/dist/index.d.ts +27 -0
  149. package/dist/index.js +133 -0
  150. package/dist/index.js.map +1 -0
  151. package/dist/static/client.d.ts +10 -0
  152. package/dist/static/client.js +957 -0
  153. package/dist/static/client.js.map +1 -0
  154. package/dist/static/prelude.d.ts +5 -0
  155. package/dist/static/prelude.js +172 -0
  156. package/dist/static/prelude.js.map +1 -0
  157. package/dist/types.d.ts +150 -0
  158. package/dist/types.js +10 -0
  159. package/dist/types.js.map +1 -0
  160. package/dist/utils/buildProfiles.d.ts +22 -0
  161. package/dist/utils/buildProfiles.js +64 -0
  162. package/dist/utils/buildProfiles.js.map +1 -0
  163. package/dist/utils/embeds.d.ts +2 -0
  164. package/dist/utils/embeds.js +17 -0
  165. package/dist/utils/embeds.js.map +1 -0
  166. package/dist/utils/extend.d.ts +8 -0
  167. package/dist/utils/extend.js +8 -0
  168. package/dist/utils/extend.js.map +1 -0
  169. package/dist/utils/filename.d.ts +8 -0
  170. package/dist/utils/filename.js +26 -0
  171. package/dist/utils/filename.js.map +1 -0
  172. package/dist/utils/messageGroups.d.ts +9 -0
  173. package/dist/utils/messageGroups.js +29 -0
  174. package/dist/utils/messageGroups.js.map +1 -0
  175. package/dist/utils/resolveImage.d.ts +14 -0
  176. package/dist/utils/resolveImage.js +32 -0
  177. package/dist/utils/resolveImage.js.map +1 -0
  178. package/dist/utils/ssrf.d.ts +25 -0
  179. package/dist/utils/ssrf.js +108 -0
  180. package/dist/utils/ssrf.js.map +1 -0
  181. package/dist/utils/utils.d.ts +28 -0
  182. package/dist/utils/utils.js +79 -0
  183. package/dist/utils/utils.js.map +1 -0
  184. package/package.json +91 -4
  185. package/src/downloader/budget.ts +60 -0
  186. package/src/downloader/fetch.ts +143 -0
  187. package/src/downloader/images.ts +262 -0
  188. package/src/features/images.ts +16 -0
  189. package/src/features/index.ts +56 -0
  190. package/src/features/members/collect.ts +46 -0
  191. package/src/features/members/index.ts +7 -0
  192. package/src/features/resolve.ts +59 -0
  193. package/src/features/threadMessages/collect.ts +86 -0
  194. package/src/features/threadMessages/index.ts +7 -0
  195. package/src/features/types.ts +59 -0
  196. package/src/features/ui/imagePreview.ts +7 -0
  197. package/src/features/ui/memberList.ts +7 -0
  198. package/src/features/ui/pinnedMessages.ts +7 -0
  199. package/src/features/ui/search.ts +7 -0
  200. package/src/features/ui/selectMenus.ts +7 -0
  201. package/src/features/ui/serverTags.ts +7 -0
  202. package/src/features/ui/threadModal.ts +7 -0
  203. package/src/features/ui/voicePlayer.ts +7 -0
  204. package/src/features/voiceMessages.ts +48 -0
  205. package/src/generator/discordComponents.ts +58 -0
  206. package/src/generator/index.tsx +141 -0
  207. package/src/generator/renderers/attachment.tsx +164 -0
  208. package/src/generator/renderers/components/AttachmentGallery.tsx +91 -0
  209. package/src/generator/renderers/components/Button.tsx +51 -0
  210. package/src/generator/renderers/components/Checkbox.tsx +48 -0
  211. package/src/generator/renderers/components/Container.tsx +29 -0
  212. package/src/generator/renderers/components/Media Gallery.tsx +139 -0
  213. package/src/generator/renderers/components/RadioGroup.tsx +91 -0
  214. package/src/generator/renderers/components/Select Menu.tsx +72 -0
  215. package/src/generator/renderers/components/Spacing.tsx +10 -0
  216. package/src/generator/renderers/components/Thumbnail.tsx +20 -0
  217. package/src/generator/renderers/components/section/Section.tsx +30 -0
  218. package/src/generator/renderers/components/section/SectionAccessory.tsx +13 -0
  219. package/src/generator/renderers/components/section/SectionContent.tsx +11 -0
  220. package/src/generator/renderers/components/styles.ts +2441 -0
  221. package/src/generator/renderers/components/utils.ts +170 -0
  222. package/src/generator/renderers/components.tsx +240 -0
  223. package/src/generator/renderers/content.tsx +283 -0
  224. package/src/generator/renderers/embed.tsx +75 -0
  225. package/src/generator/renderers/message.tsx +214 -0
  226. package/src/generator/renderers/poll.tsx +69 -0
  227. package/src/generator/renderers/reply.tsx +51 -0
  228. package/src/generator/renderers/sticker.tsx +71 -0
  229. package/src/generator/renderers/systemMessage.tsx +285 -0
  230. package/src/generator/renderers/threadMessages.tsx +65 -0
  231. package/src/generator/renderers/voice.tsx +70 -0
  232. package/src/generator/transcript.tsx +190 -0
  233. package/src/index.ts +152 -0
  234. package/src/static/client.ts +957 -0
  235. package/src/static/prelude.ts +168 -0
  236. package/src/types.ts +177 -0
  237. package/src/utils/buildProfiles.ts +108 -0
  238. package/src/utils/embeds.ts +17 -0
  239. package/src/utils/extend.ts +11 -0
  240. package/src/utils/filename.ts +26 -0
  241. package/src/utils/messageGroups.ts +25 -0
  242. package/src/utils/resolveImage.ts +36 -0
  243. package/src/utils/ssrf.ts +112 -0
  244. package/src/utils/types.d.ts +11 -0
  245. package/src/utils/utils.ts +80 -0
package/LICENSE ADDED
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright [yyyy] [name of copyright owner]
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
package/NOTICE ADDED
@@ -0,0 +1,8 @@
1
+ discord-transcriptify
2
+ Copyright 2024-2026 cauahzz
3
+
4
+ This product includes software developed as "discord-html-transcripts"
5
+ (https://github.com/ItzDerock/discord-html-transcripts),
6
+ Copyright Derock, licensed under the Apache License, Version 2.0.
7
+
8
+ The source files have been modified from that work.
package/README.md CHANGED
@@ -1,3 +1,291 @@
1
- # Temporary Holding Version
1
+ # discord-transcriptify
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ [![npm version](https://img.shields.io/npm/v/discord-transcriptify)](https://www.npmjs.com/package/discord-transcriptify)
4
+ [![npm downloads](https://img.shields.io/npm/dw/discord-transcriptify)](https://www.npmjs.com/package/discord-transcriptify)
5
+ [![license](https://img.shields.io/npm/l/discord-transcriptify)](./LICENSE)
6
+
7
+ Turn a Discord channel into a single HTML file that looks like Discord: same colours, same message
8
+ grouping, same components. Built for [discord.js](https://discord.js.org) v14 and v15.
9
+
10
+ ```shell
11
+ npm install discord-transcriptify
12
+ ```
13
+
14
+ ```js
15
+ const { createTranscript } = require('discord-transcriptify');
16
+
17
+ const attachment = await createTranscript(channel);
18
+ await channel.send({ files: [attachment] });
19
+ ```
20
+
21
+ ![A support ticket exported with discord-transcriptify: an embed with buttons and a select menu, a reply with a quote and reactions, a code block and a poll](./.github/assets/conversation.png)
22
+
23
+ ## What it renders
24
+
25
+ - **Messages** — Discord markdown (bold, quotes, code blocks, spoilers, timestamps), mentions in their
26
+ role colour, replies, edits, reactions, slash command headers, and consecutive messages from the
27
+ same author grouped under one header.
28
+ - **Embeds** — every field, including author, footer, thumbnail and image.
29
+ - **Components V2** — container (accent colour, spoiler), text display, section with a thumbnail or
30
+ button accessory, media gallery, file, separator, checkbox and radio group.
31
+ - **Buttons and select menus** — all styles, link buttons, emoji and the disabled state. A select
32
+ menu opens on a click and lists its options, with their emoji and descriptions.
33
+ - **Attachments** — images, videos and audio inline; several images as one grid; any other file as a
34
+ card with its name, size and a download link.
35
+ - **Voice messages** — waveform, duration and a play button.
36
+ - **Polls** — answers, vote bars and the poll result message. The closing time is shown as a date,
37
+ never as time left.
38
+ - **Forwarded messages** — content, attachments, embeds and components of the forwarded snapshot.
39
+ - **Threads** — the "started a thread" message with its preview, and optionally every message inside
40
+ the thread.
41
+ - **Stickers** — PNG, APNG and GIF as images. Lottie stickers show a placeholder with the sticker
42
+ name, since they need a player script.
43
+ - **System messages** — joins, pins, boosts and thread creation.
44
+ - **Server tags** next to author names.
45
+
46
+ ![A Components V2 container with a section, a thumbnail, a media gallery and buttons, followed by a voice message, a file card and a thread preview](./.github/assets/components.png)
47
+
48
+ The file also carries a small interface for whoever reads it: message search, a member list with
49
+ message counts, a list of pinned messages, a list of the saved threads, a full-screen image preview
50
+ and a side panel that opens a thread next to the channel. All of it can be [switched off](#interactive-ui).
51
+
52
+ ## Requirements
53
+
54
+ - Node.js 18.17 or newer
55
+ - discord.js v14 or v15
56
+ - [`sharp`](https://sharp.pixelplumbing.com/) is optional. Install it only if you want embedded
57
+ images resized or compressed.
58
+
59
+ ## Usage
60
+
61
+ ### From a channel
62
+
63
+ `createTranscript` fetches the messages for you.
64
+
65
+ ```js
66
+ const { createTranscript } = require('discord-transcriptify');
67
+
68
+ const attachment = await createTranscript(channel, {
69
+ limit: -1, // every message in the channel
70
+ saveImages: true, // embed images so the file does not depend on Discord's CDN
71
+ });
72
+
73
+ await channel.send({ files: [attachment] });
74
+ ```
75
+
76
+ ### From messages you already have
77
+
78
+ ```js
79
+ const { generateFromMessages } = require('discord-transcriptify');
80
+
81
+ const attachment = await generateFromMessages(messages, channel);
82
+ ```
83
+
84
+ `messages` is an array or a discord.js `Collection` of messages.
85
+
86
+ ### Getting a string or a buffer
87
+
88
+ ```js
89
+ const { createTranscript, ExportReturnType } = require('discord-transcriptify');
90
+
91
+ const html = await createTranscript(channel, { returnType: ExportReturnType.String });
92
+ ```
93
+
94
+ `returnType` accepts `'attachment'` (the default), `'buffer'` and `'string'`.
95
+
96
+ ## Options
97
+
98
+ Every option is optional. All of them work with both functions, except `limit` and `filter`, which
99
+ belong to `createTranscript`.
100
+
101
+ | Option | Default | What it does |
102
+ | -------------------- | ---------------------------------- | ---------------------------------------------------------------------------------------------------------------------------- |
103
+ | `limit` | `-1` | How many messages to fetch. `-1` fetches the whole channel. |
104
+ | `filter` | none | `(message) => boolean`. Messages that return `false` are left out, thread messages included. |
105
+ | `returnType` | `'attachment'` | `'attachment'`, `'buffer'` or `'string'`. |
106
+ | `filename` | `'transcript-{channel name}.html'` | File name of the attachment. |
107
+ | `saveImages` | `false` | Download images and embed them in the file. See [Embedding images](#embedding-images). |
108
+ | `saveVoiceMessages` | `false` | Download voice messages and embed them. Accepts `{ maxSizeKb, maxTotalSizeKb }`. See [Memory use](#memory-use). |
109
+ | `saveThreadMessages` | `false` | Fetch the messages of each thread and show them under its preview. Accepts `{ limit }`, default `500` per thread. |
110
+ | `fetchMembers` | `true` | Ask Discord for the members behind the authors, so names show in their role colour. See [Role colours](#role-colours). |
111
+ | `ui` | `true` | The interactive interface. `false` removes it; an object switches single features. See [Interactive UI](#interactive-ui). |
112
+ | `hydrate` | `false` | `true` renders the components on the server. With `false` the page loads the component scripts from a CDN when it is opened. |
113
+ | `footerText` | `'Exported {number} message{s}.'` | Text of the footer. |
114
+ | `poweredBy` | `true` | Show the "Powered by discord-transcriptify" line in the footer. |
115
+ | `favicon` | `'guild'` | `'guild'` uses the server icon; any other string is used as the icon URL. |
116
+ | `callbacks` | built in | Your own `resolveChannel`, `resolveUser`, `resolveRole`, `resolveImageSrc` and `resolveVoiceSrc`. |
117
+
118
+ ### Threads
119
+
120
+ `saveThreadMessages` covers both kinds of thread: one started from a message and one created on its
121
+ own, which the channel shows as a "started a thread" line. Each thread costs one extra API request
122
+ per 100 messages. Up to three
123
+ threads are fetched at a time. When a thread is longer than the limit, the most recent messages are
124
+ kept and the transcript says how many were left out. A limit below `1` means no limit.
125
+
126
+ ### Role colours
127
+
128
+ Messages fetched from a channel arrive without their member, and the role colour of an author lives
129
+ on the member. With `fetchMembers` on, the uncached authors are requested from the gateway, 100 per
130
+ request. If a request fails, the transcript is still generated and those names stay uncoloured. Pass
131
+ `fetchMembers: false` to send no request at all.
132
+
133
+ ### Interactive UI
134
+
135
+ By default the file includes a small amount of JavaScript. Each feature has its own switch:
136
+
137
+ ```js
138
+ await createTranscript(channel, {
139
+ ui: {
140
+ imagePreview: true, // click an image to see it full-screen
141
+ search: true, // search the messages
142
+ memberList: true, // members and how many messages each one sent
143
+ pinnedMessages: true, // list of pinned messages
144
+ voicePlayer: true, // play button and waveform on voice messages
145
+ threadModal: true, // open a thread in a panel beside the channel, and list the saved threads in the header
146
+ serverTags: true, // server tag next to the author's name
147
+ selectMenus: true, // close an open select menu on a click elsewhere or Escape
148
+ },
149
+ });
150
+ ```
151
+
152
+ `ui: false` removes all of it. The transcript stays complete without scripts: voice messages fall
153
+ back to the browser's audio controls and thread messages to a collapsible block. Select menus
154
+ still open and close on a click.
155
+
156
+ The scripts are self-contained: none is loaded from another site and none sends data anywhere. The
157
+ server tag badge is an image served by Discord, like an avatar. Server tags do not appear with
158
+ `hydrate: true`, because a server-rendered page carries no profile data for the script to read.
159
+
160
+ ### Embedding images
161
+
162
+ With `saveImages: true`, images are downloaded and written into the file as data URLs. This covers
163
+ image attachments, embed images, thumbnails, author and footer icons, and Components V2 media
164
+ galleries and thumbnails. By default:
165
+
166
+ - images are resized to fit 800×800 and compressed at 75% quality (JPEG and WebP; PNG stays lossless), if `sharp` is installed; without
167
+ it they are embedded untouched
168
+ - files over 10 MB are skipped and keep their original URL
169
+ - once the embedded images add up to 50 MB, the remaining ones keep their original URL
170
+ - four images are downloaded at a time
171
+ - GIF and SVG files are embedded as they are
172
+ - videos are not embedded
173
+
174
+ Pass an object to change the limits:
175
+
176
+ ```js
177
+ saveImages: {
178
+ maxSizeKb: 5120, // per image
179
+ maxTotalSizeKb: 20480, // all images together
180
+ concurrency: 2, // downloads at the same time
181
+ quality: 60,
182
+ maxWidth: 1200,
183
+ maxHeight: 1200,
184
+ },
185
+ ```
186
+
187
+ For full control, give `resolveImageSrc` your own function. It is called once per image and returns
188
+ a string to use as the image source, `undefined` to keep the original URL, or `null` to leave the
189
+ image out of the transcript.
190
+
191
+ The built-in downloader can also be configured and passed in:
192
+
193
+ ```js
194
+ const { createTranscript, TranscriptImageDownloader } = require('discord-transcriptify');
195
+
196
+ await createTranscript(channel, {
197
+ callbacks: {
198
+ resolveImageSrc: new TranscriptImageDownloader()
199
+ .withMaxSize(5120) // in KB, checked against the bytes actually received
200
+ .withMaxTotalSize(20480) // in KB, all images together
201
+ .withConcurrency(2) // downloads at the same time
202
+ .withMaxDimensions(1200, 1200) // resize to fit, needs sharp
203
+ .withCompression(60, true) // 60% quality, convert to webp, needs sharp
204
+ .withTimeout(10_000, 30_000) // headers and body timeouts, in ms
205
+ .build(),
206
+ },
207
+ });
208
+ ```
209
+
210
+ If neither `.withCompression()` nor `.withMaxDimensions()` is called, `sharp` is never loaded. The
211
+ total set with `.withMaxTotalSize()` belongs to the function `.build()` returns, so build one per
212
+ transcript.
213
+
214
+ ### Memory use
215
+
216
+ Everything a transcript embeds is held in memory until the file is written, so a channel with many
217
+ images can use more memory than a small bot has. Three limits keep that bounded, and all of them
218
+ apply by default when `saveImages` is on:
219
+
220
+ | Limit | Option | Default |
221
+ | --------------------------- | --------------------------- | --------------- |
222
+ | Size of one image | `saveImages.maxSizeKb` | `10240` (10 MB) |
223
+ | Size of all images together | `saveImages.maxTotalSizeKb` | `51200` (50 MB) |
224
+ | Downloads running at once | `saveImages.concurrency` | `4` |
225
+
226
+ Voice messages have their own pair: `saveVoiceMessages.maxSizeKb` (default `25600`) and
227
+ `saveVoiceMessages.maxTotalSizeKb` (default `51200`).
228
+
229
+ The totals are counted on what ends up in the file, after compression. When a total is reached, the
230
+ transcript is still generated: the remaining images or voice messages keep their Discord URL
231
+ instead of being embedded. Zero or less turns a total, or the concurrency limit, off.
232
+
233
+ On a bot with little memory, lower the totals and install `sharp`, which shrinks each image before
234
+ it is embedded:
235
+
236
+ ```js
237
+ await createTranscript(channel, {
238
+ saveImages: { maxTotalSizeKb: 10240, maxSizeKb: 2048, concurrency: 2 },
239
+ });
240
+ ```
241
+
242
+ The file itself is also built in memory, so expect a peak of a few times the size of the finished
243
+ transcript. If that is still too much, do not embed at all: give `resolveImageSrc` a function that
244
+ uploads the image to your own storage and returns its URL.
245
+
246
+ ## Security
247
+
248
+ A transcript is built from content that anyone in the channel can write, so the library treats all
249
+ of it as untrusted.
250
+
251
+ **Markup is escaped.** Message content, names and every other value from Discord are rendered
252
+ through React, so HTML in a message is shown as text and never executed.
253
+
254
+ **Downloads are guarded.** A Components V2 gallery, a thumbnail or an embed can point at any URL,
255
+ not only at Discord's CDN. When `saveImages` or `saveVoiceMessages` is on, the built-in downloader
256
+ refuses:
257
+
258
+ - any scheme other than `http:` and `https:`
259
+ - loopback, private, link-local and reserved addresses, including the cloud metadata address
260
+ `169.254.169.254`. This applies to addresses written literally and to hostnames that resolve to
261
+ one, and it is checked when the connection is made, so DNS rebinding does not get past it
262
+ - redirects
263
+ - responses over the size limit, measured on the bytes received and not on the size the message
264
+ claims
265
+
266
+ If your images really live on an internal host, opt out with
267
+ `new TranscriptImageDownloader().withAllowPrivateNetwork()`. Only the address rule is relaxed. Do
268
+ this only if you trust everyone who can post in the channel.
269
+
270
+ A `resolveImageSrc` or `resolveVoiceSrc` function of your own gets none of these checks: validating
271
+ the URLs it receives is up to you.
272
+
273
+ ## Development
274
+
275
+ ```shell
276
+ npm install
277
+ npm run build
278
+ npm test
279
+ ```
280
+
281
+ `npm test` needs no bot and no network. [tests/README.md](./tests/README.md) describes the rest.
282
+
283
+ ## Credits
284
+
285
+ discord-transcriptify started from
286
+ [discord-html-transcripts](https://github.com/ItzDerock/discord-html-transcripts), used under the
287
+ Apache-2.0 license.
288
+
289
+ ## License
290
+
291
+ Apache-2.0. See [LICENSE](./LICENSE) and [NOTICE](./NOTICE).
@@ -0,0 +1,26 @@
1
+ /**
2
+ * A running total with a ceiling. Everything a transcript embeds stays in
3
+ * memory until the file is written, so the sum is what has to be bounded, not
4
+ * only each download.
5
+ */
6
+ export declare class ByteBudget {
7
+ private readonly maxBytes;
8
+ private used;
9
+ private closed;
10
+ /** @param maxBytes Ceiling in bytes; zero or less means no ceiling. */
11
+ constructor(maxBytes: number);
12
+ private get limited();
13
+ get exhausted(): boolean;
14
+ /**
15
+ * Claims `bytes` if they still fit, and says whether they did. The first
16
+ * claim that does not fit closes the budget: looking for a smaller item that
17
+ * still fits would mean downloading every remaining one just to measure it.
18
+ */
19
+ take(bytes: number): boolean;
20
+ }
21
+ /**
22
+ * Runs at most `concurrency` tasks at a time and queues the rest, so the
23
+ * buffers of every download in a large transcript are not alive at once.
24
+ * Zero or less means no limit.
25
+ */
26
+ export declare function createLimiter(concurrency: number): <T>(task: () => Promise<T>) => Promise<T>;
@@ -0,0 +1,68 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ByteBudget = void 0;
4
+ exports.createLimiter = createLimiter;
5
+ /**
6
+ * A running total with a ceiling. Everything a transcript embeds stays in
7
+ * memory until the file is written, so the sum is what has to be bounded, not
8
+ * only each download.
9
+ */
10
+ class ByteBudget {
11
+ /** @param maxBytes Ceiling in bytes; zero or less means no ceiling. */
12
+ constructor(maxBytes) {
13
+ this.maxBytes = maxBytes;
14
+ this.used = 0;
15
+ this.closed = false;
16
+ }
17
+ get limited() {
18
+ return this.maxBytes > 0;
19
+ }
20
+ get exhausted() {
21
+ return this.closed;
22
+ }
23
+ /**
24
+ * Claims `bytes` if they still fit, and says whether they did. The first
25
+ * claim that does not fit closes the budget: looking for a smaller item that
26
+ * still fits would mean downloading every remaining one just to measure it.
27
+ */
28
+ take(bytes) {
29
+ if (this.closed)
30
+ return false;
31
+ if (this.limited && this.used + bytes > this.maxBytes) {
32
+ this.closed = true;
33
+ return false;
34
+ }
35
+ this.used += bytes;
36
+ return true;
37
+ }
38
+ }
39
+ exports.ByteBudget = ByteBudget;
40
+ /**
41
+ * Runs at most `concurrency` tasks at a time and queues the rest, so the
42
+ * buffers of every download in a large transcript are not alive at once.
43
+ * Zero or less means no limit.
44
+ */
45
+ function createLimiter(concurrency) {
46
+ if (!(concurrency > 0))
47
+ return (task) => task();
48
+ let running = 0;
49
+ const waiting = [];
50
+ return async (task) => {
51
+ // a finished task hands its slot straight to the next in line, so a newcomer cannot take it in between
52
+ if (running >= concurrency)
53
+ await new Promise((resolve) => waiting.push(resolve));
54
+ else
55
+ running++;
56
+ try {
57
+ return await task();
58
+ }
59
+ finally {
60
+ const next = waiting.shift();
61
+ if (next)
62
+ next();
63
+ else
64
+ running--;
65
+ }
66
+ };
67
+ }
68
+ //# sourceMappingURL=budget.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"budget.js","sourceRoot":"","sources":["../../src/downloader/budget.ts"],"names":[],"mappings":";;;AAyCA,sCAkBC;AA3DD;;;;GAIG;AACH,MAAa,UAAU;IAIrB,uEAAuE;IACvE,YAA6B,QAAgB;QAAhB,aAAQ,GAAR,QAAQ,CAAQ;QAJrC,SAAI,GAAG,CAAC,CAAC;QACT,WAAM,GAAG,KAAK,CAAC;IAGyB,CAAC;IAEjD,IAAY,OAAO;QACjB,OAAO,IAAI,CAAC,QAAQ,GAAG,CAAC,CAAC;IAC3B,CAAC;IAED,IAAI,SAAS;QACX,OAAO,IAAI,CAAC,MAAM,CAAC;IACrB,CAAC;IAED;;;;OAIG;IACH,IAAI,CAAC,KAAa;QAChB,IAAI,IAAI,CAAC,MAAM;YAAE,OAAO,KAAK,CAAC;QAC9B,IAAI,IAAI,CAAC,OAAO,IAAI,IAAI,CAAC,IAAI,GAAG,KAAK,GAAG,IAAI,CAAC,QAAQ,EAAE,CAAC;YACtD,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC;YACnB,OAAO,KAAK,CAAC;QACf,CAAC;QACD,IAAI,CAAC,IAAI,IAAI,KAAK,CAAC;QACnB,OAAO,IAAI,CAAC;IACd,CAAC;CACF;AA7BD,gCA6BC;AAED;;;;GAIG;AACH,SAAgB,aAAa,CAAC,WAAmB;IAC/C,IAAI,CAAC,CAAC,WAAW,GAAG,CAAC,CAAC;QAAE,OAAO,CAAI,IAAsB,EAAE,EAAE,CAAC,IAAI,EAAE,CAAC;IAErE,IAAI,OAAO,GAAG,CAAC,CAAC;IAChB,MAAM,OAAO,GAAmB,EAAE,CAAC;IAEnC,OAAO,KAAK,EAAK,IAAsB,EAAc,EAAE;QACrD,uGAAuG;QACvG,IAAI,OAAO,IAAI,WAAW;YAAE,MAAM,IAAI,OAAO,CAAO,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC;;YACnF,OAAO,EAAE,CAAC;QACf,IAAI,CAAC;YACH,OAAO,MAAM,IAAI,EAAE,CAAC;QACtB,CAAC;gBAAS,CAAC;YACT,MAAM,IAAI,GAAG,OAAO,CAAC,KAAK,EAAE,CAAC;YAC7B,IAAI,IAAI;gBAAE,IAAI,EAAE,CAAC;;gBACZ,OAAO,EAAE,CAAC;QACjB,CAAC;IACH,CAAC,CAAC;AACJ,CAAC"}
@@ -0,0 +1,22 @@
1
+ export type GuardedFetchOptions = {
2
+ /** Largest body to accept, in bytes. */
3
+ maxBytes: number;
4
+ /** Lifts the internal-address rule; the protocol check always applies. @default false */
5
+ allowPrivateNetwork?: boolean;
6
+ /** Time to wait for response headers, in milliseconds. @default 10000 */
7
+ headersTimeout?: number;
8
+ /** Time to wait for the response body, in milliseconds. @default 30000 */
9
+ bodyTimeout?: number;
10
+ };
11
+ export type GuardedFetchResult = {
12
+ buffer: Buffer;
13
+ contentType: string | undefined;
14
+ };
15
+ /**
16
+ * Downloads a URL with the SSRF guard and a size cap that holds regardless of
17
+ * what the server (or the message) claims. Every network fetch in this package
18
+ * goes through here.
19
+ *
20
+ * Resolves to null whenever the download is refused, fails or is too big.
21
+ */
22
+ export declare function fetchGuarded(url: string, options: GuardedFetchOptions): Promise<GuardedFetchResult | null>;