discord.js-html-transcript 4.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.
- package/LICENSE +201 -0
- package/README.md +470 -0
- package/dist/downloader/assets.d.ts +18 -0
- package/dist/downloader/assets.js +53 -0
- package/dist/downloader/assets.js.map +1 -0
- package/dist/downloader/images.d.ts +28 -0
- package/dist/downloader/images.js +119 -0
- package/dist/downloader/images.js.map +1 -0
- package/dist/generator/index.d.ts +24 -0
- package/dist/generator/index.js +112 -0
- package/dist/generator/index.js.map +1 -0
- package/dist/generator/renderers/attachment.d.ts +23 -0
- package/dist/generator/renderers/attachment.js +154 -0
- package/dist/generator/renderers/attachment.js.map +1 -0
- package/dist/generator/renderers/components/Attachment Gallery.d.ts +9 -0
- package/dist/generator/renderers/components/Attachment Gallery.js +26 -0
- package/dist/generator/renderers/components/Attachment Gallery.js.map +1 -0
- package/dist/generator/renderers/components/Button.d.ts +9 -0
- package/dist/generator/renderers/components/Button.js +23 -0
- package/dist/generator/renderers/components/Button.js.map +1 -0
- package/dist/generator/renderers/components/Container.d.ts +6 -0
- package/dist/generator/renderers/components/Container.js +26 -0
- package/dist/generator/renderers/components/Container.js.map +1 -0
- package/dist/generator/renderers/components/Media Gallery.d.ts +8 -0
- package/dist/generator/renderers/components/Media Gallery.js +45 -0
- package/dist/generator/renderers/components/Media Gallery.js.map +1 -0
- package/dist/generator/renderers/components/Select Menu.d.ts +10 -0
- package/dist/generator/renderers/components/Select Menu.js +34 -0
- package/dist/generator/renderers/components/Select Menu.js.map +1 -0
- package/dist/generator/renderers/components/Spacing.d.ts +7 -0
- package/dist/generator/renderers/components/Spacing.js +17 -0
- package/dist/generator/renderers/components/Spacing.js.map +1 -0
- package/dist/generator/renderers/components/Thumbnail.d.ts +7 -0
- package/dist/generator/renderers/components/Thumbnail.js +21 -0
- package/dist/generator/renderers/components/Thumbnail.js.map +1 -0
- package/dist/generator/renderers/components/poll.d.ts +7 -0
- package/dist/generator/renderers/components/poll.js +78 -0
- package/dist/generator/renderers/components/poll.js.map +1 -0
- package/dist/generator/renderers/components/section/Section.d.ts +11 -0
- package/dist/generator/renderers/components/section/Section.js +21 -0
- package/dist/generator/renderers/components/section/Section.js.map +1 -0
- package/dist/generator/renderers/components/section/SectionAccessory.d.ts +6 -0
- package/dist/generator/renderers/components/section/SectionAccessory.js +20 -0
- package/dist/generator/renderers/components/section/SectionAccessory.js.map +1 -0
- package/dist/generator/renderers/components/section/SectionContent.d.ts +6 -0
- package/dist/generator/renderers/components/section/SectionContent.js +21 -0
- package/dist/generator/renderers/components/section/SectionContent.js.map +1 -0
- package/dist/generator/renderers/components/styles.d.ts +21 -0
- package/dist/generator/renderers/components/styles.js +1639 -0
- package/dist/generator/renderers/components/styles.js.map +1 -0
- package/dist/generator/renderers/components/utils.d.ts +36 -0
- package/dist/generator/renderers/components/utils.js +98 -0
- package/dist/generator/renderers/components/utils.js.map +1 -0
- package/dist/generator/renderers/components/voice.d.ts +5 -0
- package/dist/generator/renderers/components/voice.js +50 -0
- package/dist/generator/renderers/components/voice.js.map +1 -0
- package/dist/generator/renderers/components.d.ts +13 -0
- package/dist/generator/renderers/components.js +78 -0
- package/dist/generator/renderers/components.js.map +1 -0
- package/dist/generator/renderers/content.d.ts +26 -0
- package/dist/generator/renderers/content.js +396 -0
- package/dist/generator/renderers/content.js.map +1 -0
- package/dist/generator/renderers/embed.d.ts +59 -0
- package/dist/generator/renderers/embed.js +216 -0
- package/dist/generator/renderers/embed.js.map +1 -0
- package/dist/generator/renderers/message.d.ts +7 -0
- package/dist/generator/renderers/message.js +106 -0
- package/dist/generator/renderers/message.js.map +1 -0
- package/dist/generator/renderers/reply.d.ts +7 -0
- package/dist/generator/renderers/reply.js +74 -0
- package/dist/generator/renderers/reply.js.map +1 -0
- package/dist/generator/renderers/systemMessage.d.ts +15 -0
- package/dist/generator/renderers/systemMessage.js +168 -0
- package/dist/generator/renderers/systemMessage.js.map +1 -0
- package/dist/generator/transcript.d.ts +3 -0
- package/dist/generator/transcript.js +148 -0
- package/dist/generator/transcript.js.map +1 -0
- package/dist/index.d.ts +26 -0
- package/dist/index.js +159 -0
- package/dist/index.js.map +1 -0
- package/dist/options.d.ts +37 -0
- package/dist/options.js +89 -0
- package/dist/options.js.map +1 -0
- package/dist/static/client.d.ts +6 -0
- package/dist/static/client.js +626 -0
- package/dist/static/client.js.map +1 -0
- package/dist/types.d.ts +193 -0
- package/dist/types.js +10 -0
- package/dist/types.js.map +1 -0
- package/dist/utils/buildProfiles.d.ts +14 -0
- package/dist/utils/buildProfiles.js +136 -0
- package/dist/utils/buildProfiles.js.map +1 -0
- package/dist/utils/embeds.d.ts +2 -0
- package/dist/utils/embeds.js +17 -0
- package/dist/utils/embeds.js.map +1 -0
- package/dist/utils/extend.d.ts +8 -0
- package/dist/utils/extend.js +8 -0
- package/dist/utils/extend.js.map +1 -0
- package/dist/utils/utils.d.ts +9 -0
- package/dist/utils/utils.js +44 -0
- package/dist/utils/utils.js.map +1 -0
- package/package.json +100 -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/README.md
ADDED
|
@@ -0,0 +1,470 @@
|
|
|
1
|
+
<p align="center">
|
|
2
|
+
<img src="https://i.imgur.com/hNAL2yY.png" width="300" alt="discord.js-html-transcript" />
|
|
3
|
+
</p>
|
|
4
|
+
|
|
5
|
+
<h1 align="center">discord.js-html-transcript</h1>
|
|
6
|
+
|
|
7
|
+
<p align="center">
|
|
8
|
+
<strong>Generate pixel-perfect, native-looking Discord HTML transcripts.</strong>
|
|
9
|
+
</p>
|
|
10
|
+
|
|
11
|
+
<p align="center">
|
|
12
|
+
<a href="https://www.npmjs.com/package/discord.js-html-transcript"><img src="https://img.shields.io/npm/v/discord.js-html-transcript?color=5865F2&label=npm&logo=npm&logoColor=white" alt="npm version" /></a>
|
|
13
|
+
<a href="https://www.npmjs.com/package/discord.js-html-transcript"><img src="https://img.shields.io/npm/dw/discord.js-html-transcript?color=5865F2&logo=npm&logoColor=white" alt="npm downloads" /></a>
|
|
14
|
+
<a href="https://discord.gg/wicks"><img src="https://img.shields.io/discord/1061971978845700176?color=5865F2&label=discord&logo=discord&logoColor=white" alt="Discord" /></a>
|
|
15
|
+
<a href="https://github.com/wickstudio/discord.js-html-transcript"><img src="https://img.shields.io/github/stars/wickstudio/discord.js-html-transcript?style=social" alt="GitHub stars" /></a>
|
|
16
|
+
<a href="https://github.com/wickstudio/discord.js-html-transcript/blob/main/LICENSE"><img src="https://img.shields.io/badge/license-Apache%202.0-blue" alt="License" /></a>
|
|
17
|
+
</p>
|
|
18
|
+
|
|
19
|
+
<p align="center">
|
|
20
|
+
<a href="https://demo.linkux.xyz/"><strong>📖 Official Documentation</strong></a> •
|
|
21
|
+
<a href="https://demo.linkux.xyz/demo.html"><strong>🖥️ Live Demo</strong></a><br>
|
|
22
|
+
<br>
|
|
23
|
+
<a href="#-installation">Installation</a> •
|
|
24
|
+
<a href="#-quick-start">Quick Start</a> •
|
|
25
|
+
<a href="#%EF%B8%8F-configuration">Configuration</a> •
|
|
26
|
+
<a href="#-api-reference">API Reference</a>
|
|
27
|
+
</p>
|
|
28
|
+
|
|
29
|
+
---
|
|
30
|
+
|
|
31
|
+
## ✨ What's New in v4
|
|
32
|
+
|
|
33
|
+
This package is a **completely modernized fork** of [`discord-html-transcripts`](https://github.com/ItzDerock/discord-html-transcripts) by **ItzDerock**, rebuilt from the ground up with a native Discord UI that is indistinguishable from the real thing.
|
|
34
|
+
|
|
35
|
+
### 🆕 New Features
|
|
36
|
+
|
|
37
|
+
| Feature | Description |
|
|
38
|
+
|---------|-------------|
|
|
39
|
+
| 🔀 **Forwarded Messages** | Full support for Discord's forwarded message format with origin info |
|
|
40
|
+
| 🎙️ **Voice Messages** | Waveform visualization with play button, duration, and speed controls |
|
|
41
|
+
| 📊 **Polls / Voting** | Native poll rendering with answer options, vote counts, and progress bars |
|
|
42
|
+
| 🏷️ **Server Tags** | APP badges, role icons, and server tag badges on user profiles |
|
|
43
|
+
| 🔘 **Buttons & Select Menus** | Primary, secondary, success, danger, and link button styles + dropdown menus |
|
|
44
|
+
| 🔗 **Invite Link Previews** | Rich invite cards with server icon, member counts, and join button |
|
|
45
|
+
| 🖼️ **Image Preview Lightbox** | Click any image to open a full-screen lightbox overlay |
|
|
46
|
+
| 🔍 **Message Search** | Built-in search bar to find messages within transcripts |
|
|
47
|
+
| 🧵 **Thread Previews** | Thread starter messages with preview boxes and participant info |
|
|
48
|
+
| 📎 **File Attachments** | Native-styled file attachment cards with download buttons |
|
|
49
|
+
| 🎨 **ANSI Code Blocks** | Full ANSI escape sequence rendering with colors and formatting |
|
|
50
|
+
| 📱 **Fully Responsive** | Mobile-first responsive design that works perfectly on all screen sizes |
|
|
51
|
+
| 📌 **Sticky Header** | Channel header stays visible while scrolling, just like Discord |
|
|
52
|
+
| ⚙️ **Configurable Features** | Toggle search, image preview, spoiler reveal, and more on/off |
|
|
53
|
+
| 💾 **Granular Asset Saving** | Fine-grained control over which remote assets (images, avatars, emojis, etc.) are preserved |
|
|
54
|
+
|
|
55
|
+
### 🎨 UI Improvements
|
|
56
|
+
|
|
57
|
+
- Redesigned button and select menu components matching Discord's current design
|
|
58
|
+
- Modern dark theme background (`#070709`) matching native Discord
|
|
59
|
+
- Improved embed border styling with subtle transparency
|
|
60
|
+
- Enhanced markdown rendering (headings, lists, block quotes, code blocks)
|
|
61
|
+
- Responsive image galleries with multi-image grid layouts
|
|
62
|
+
- Native vote/poll UI with interactive styling
|
|
63
|
+
- Voice message capsule with amplitude-proportional waveform bars
|
|
64
|
+
- Custom file attachment cards with file type icons
|
|
65
|
+
|
|
66
|
+
---
|
|
67
|
+
|
|
68
|
+
## 📦 Installation
|
|
69
|
+
|
|
70
|
+
```bash
|
|
71
|
+
# npm
|
|
72
|
+
npm install discord.js-html-transcript
|
|
73
|
+
|
|
74
|
+
# pnpm
|
|
75
|
+
pnpm add discord.js-html-transcript
|
|
76
|
+
|
|
77
|
+
# yarn
|
|
78
|
+
yarn add discord.js-html-transcript
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
> **Requirements:** Node.js 16+ and **discord.js v14 or v15**
|
|
82
|
+
|
|
83
|
+
---
|
|
84
|
+
|
|
85
|
+
## 🛠️ Get Started
|
|
86
|
+
|
|
87
|
+
### Using the built-in message fetcher
|
|
88
|
+
|
|
89
|
+
```javascript
|
|
90
|
+
const discordTranscripts = require('discord.js-html-transcript');
|
|
91
|
+
|
|
92
|
+
const channel = message.channel;
|
|
93
|
+
|
|
94
|
+
const attachment = await discordTranscripts.createTranscript(channel);
|
|
95
|
+
|
|
96
|
+
channel.send({
|
|
97
|
+
files: [attachment],
|
|
98
|
+
});
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
### Using your own messages
|
|
102
|
+
|
|
103
|
+
```javascript
|
|
104
|
+
const discordTranscripts = require('discord.js-html-transcript');
|
|
105
|
+
|
|
106
|
+
const messages = await channel.messages.fetch({ limit: 100 });
|
|
107
|
+
|
|
108
|
+
const attachment = await discordTranscripts.generateFromMessages(messages, channel);
|
|
109
|
+
|
|
110
|
+
channel.send({
|
|
111
|
+
files: [attachment],
|
|
112
|
+
});
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
### TypeScript
|
|
116
|
+
|
|
117
|
+
```typescript
|
|
118
|
+
import * as discordTranscripts from 'discord.js-html-transcript';
|
|
119
|
+
|
|
120
|
+
const attachment = await discordTranscripts.createTranscript(channel, {
|
|
121
|
+
returnType: discordTranscripts.ExportReturnType.Attachment,
|
|
122
|
+
filename: `transcript-${channel.id}.html`,
|
|
123
|
+
});
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
---
|
|
127
|
+
|
|
128
|
+
## ⚙️ Configuration
|
|
129
|
+
|
|
130
|
+
Both `createTranscript` and `generateFromMessages` accept an options object.
|
|
131
|
+
**All options are optional** - sensible defaults are used when omitted.
|
|
132
|
+
|
|
133
|
+
```javascript
|
|
134
|
+
const attachment = await discordTranscripts.createTranscript(channel, {
|
|
135
|
+
// ── Output ────────────────────────────────────────────────
|
|
136
|
+
returnType: 'attachment', // 'buffer' | 'string' | 'attachment'
|
|
137
|
+
filename: 'transcript.html', // output filename (when returnType is 'attachment')
|
|
138
|
+
|
|
139
|
+
// ── Message Fetching (createTranscript only) ──────────────
|
|
140
|
+
limit: -1, // max messages to fetch (-1 = all)
|
|
141
|
+
filter: (message) => true, // filter which messages to include
|
|
142
|
+
|
|
143
|
+
// ── Asset Preservation ────────────────────────────────────
|
|
144
|
+
saveImages: false, // legacy: save image attachments as data URIs
|
|
145
|
+
saveAssets: false, // save ALL remote assets as data URIs
|
|
146
|
+
assets: {
|
|
147
|
+
attachments: false, // images, videos, audio, and files
|
|
148
|
+
embeds: false, // embed media + author/footer icons
|
|
149
|
+
components: false, // media gallery items, thumbnails, component files
|
|
150
|
+
avatars: false, // user avatars
|
|
151
|
+
emojis: false, // custom emoji + twemoji assets
|
|
152
|
+
guildIcons: false, // header + favicon guild icon
|
|
153
|
+
inviteIcons: false, // invite preview server icons
|
|
154
|
+
roleIcons: false, // highest-role icon images
|
|
155
|
+
serverTagBadges: false, // server tag badge images
|
|
156
|
+
},
|
|
157
|
+
|
|
158
|
+
// ── Feature Toggles ───────────────────────────────────────
|
|
159
|
+
features: {
|
|
160
|
+
search: true, // built-in message search UI
|
|
161
|
+
imagePreview: true, // click-to-open image lightbox
|
|
162
|
+
spoilerReveal: true, // click spoilers to reveal
|
|
163
|
+
messageLinks: true, // reply click-to-scroll behavior
|
|
164
|
+
profileBadges: true, // APP badges, server tags, role icons
|
|
165
|
+
embedTweaks: true, // client-side embed border/style fixes
|
|
166
|
+
},
|
|
167
|
+
|
|
168
|
+
// ── Appearance ────────────────────────────────────────────
|
|
169
|
+
footerText: 'Exported {number} message{s}.',
|
|
170
|
+
poweredBy: true, // show "Powered by" footer credit
|
|
171
|
+
favicon: 'guild', // 'guild' or a custom URL string
|
|
172
|
+
hydrate: false, // server-side hydrate the HTML
|
|
173
|
+
|
|
174
|
+
// ── Callbacks ─────────────────────────────────────────────
|
|
175
|
+
callbacks: {
|
|
176
|
+
resolveChannel: (channelId) => channel.client.channels.fetch(channelId),
|
|
177
|
+
resolveUser: (userId) => channel.client.users.fetch(userId),
|
|
178
|
+
resolveRole: (roleId) => channel.guild?.roles.fetch(roleId),
|
|
179
|
+
resolveInvite: (code) => /* return { name, icon, online, members, url } */,
|
|
180
|
+
resolveImageSrc: (attachment, message) => /* return data URI or URL */,
|
|
181
|
+
resolveAssetSrc: (asset) => /* return data URI or URL */,
|
|
182
|
+
},
|
|
183
|
+
});
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
### Image Compression
|
|
187
|
+
|
|
188
|
+
Install `sharp` as a dev dependency to enable image compression:
|
|
189
|
+
|
|
190
|
+
```bash
|
|
191
|
+
npm install sharp --save-dev
|
|
192
|
+
```
|
|
193
|
+
|
|
194
|
+
```javascript
|
|
195
|
+
const { TranscriptImageDownloader } = require('discord.js-html-transcript');
|
|
196
|
+
|
|
197
|
+
const attachment = await discordTranscripts.createTranscript(channel, {
|
|
198
|
+
callbacks: {
|
|
199
|
+
resolveImageSrc: new TranscriptImageDownloader()
|
|
200
|
+
.withMaxSize(5120) // 5MB max per image (in KB)
|
|
201
|
+
.withCompression(40, true) // 40% quality, convert to webp
|
|
202
|
+
.build(),
|
|
203
|
+
},
|
|
204
|
+
});
|
|
205
|
+
```
|
|
206
|
+
|
|
207
|
+
### Saving All Assets (Offline Transcripts)
|
|
208
|
+
|
|
209
|
+
For transcripts that survive Discord CDN expiration:
|
|
210
|
+
|
|
211
|
+
```javascript
|
|
212
|
+
const { TranscriptAssetDownloader } = require('discord.js-html-transcript');
|
|
213
|
+
|
|
214
|
+
const attachment = await discordTranscripts.createTranscript(channel, {
|
|
215
|
+
saveAssets: true,
|
|
216
|
+
// Or for fine-grained control:
|
|
217
|
+
assets: {
|
|
218
|
+
attachments: true,
|
|
219
|
+
embeds: true,
|
|
220
|
+
avatars: true,
|
|
221
|
+
emojis: true,
|
|
222
|
+
guildIcons: true,
|
|
223
|
+
},
|
|
224
|
+
callbacks: {
|
|
225
|
+
resolveAssetSrc: new TranscriptAssetDownloader()
|
|
226
|
+
.withMaxSize(10240) // 10MB per asset
|
|
227
|
+
.build(),
|
|
228
|
+
},
|
|
229
|
+
});
|
|
230
|
+
```
|
|
231
|
+
|
|
232
|
+
---
|
|
233
|
+
|
|
234
|
+
## 🖼️ Preview
|
|
235
|
+
|
|
236
|
+
### Messages & Attachments
|
|
237
|
+
|
|
238
|
+
| Normal Image | Multi Images | File Attachment |
|
|
239
|
+
|:---:|:---:|:---:|
|
|
240
|
+
|  |  |  |
|
|
241
|
+
|
|
242
|
+
### Forwarded Messages & Reactions
|
|
243
|
+
|
|
244
|
+
| Forwarded Image | Forwarded + Reactions |
|
|
245
|
+
|:---:|:---:|
|
|
246
|
+
|  |  |
|
|
247
|
+
|
|
248
|
+
### Polls, Threads & Mentions
|
|
249
|
+
|
|
250
|
+
| Poll | Thread | Mentions |
|
|
251
|
+
|:---:|:---:|:---:|
|
|
252
|
+
|  |  |  |
|
|
253
|
+
|
|
254
|
+
### Buttons, Select Menus & Slash Commands
|
|
255
|
+
|
|
256
|
+
| Buttons & Select Menu | Slash Command & Voice |
|
|
257
|
+
|:---:|:---:|
|
|
258
|
+
|  |  |
|
|
259
|
+
|
|
260
|
+
### Embeds
|
|
261
|
+
|
|
262
|
+
| Embed 1 | Embed 2 | Embed 3 |
|
|
263
|
+
|:---:|:---:|:---:|
|
|
264
|
+
|  |  |  |
|
|
265
|
+
|
|
266
|
+
### Links & Invites
|
|
267
|
+
|
|
268
|
+
| Links | Invite Preview |
|
|
269
|
+
|:---:|:---:|
|
|
270
|
+
|  |  |
|
|
271
|
+
|
|
272
|
+
### Markdown Formatting
|
|
273
|
+
|
|
274
|
+
| Basic Formatting | Code Blocks | Headings |
|
|
275
|
+
|:---:|:---:|:---:|
|
|
276
|
+
|  |  |  |
|
|
277
|
+
|
|
278
|
+
| Block Quotes | Lists | ANSI Styling |
|
|
279
|
+
|:---:|:---:|:---:|
|
|
280
|
+
|  |  |  |
|
|
281
|
+
|
|
282
|
+
---
|
|
283
|
+
|
|
284
|
+
## 📚 API Reference
|
|
285
|
+
|
|
286
|
+
### `createTranscript(channel, options?)`
|
|
287
|
+
|
|
288
|
+
Fetches messages from a channel and generates an HTML transcript.
|
|
289
|
+
|
|
290
|
+
| Parameter | Type | Description |
|
|
291
|
+
|-----------|------|-------------|
|
|
292
|
+
| `channel` | `TextBasedChannel` | The channel to export |
|
|
293
|
+
| `options` | `CreateTranscriptOptions` | Configuration options (see above) |
|
|
294
|
+
|
|
295
|
+
**Returns:** `Promise<AttachmentBuilder | Buffer | string>`
|
|
296
|
+
|
|
297
|
+
```javascript
|
|
298
|
+
const transcript = await discordTranscripts.createTranscript(channel, {
|
|
299
|
+
limit: 500,
|
|
300
|
+
filter: (msg) => !msg.author.bot,
|
|
301
|
+
returnType: 'attachment',
|
|
302
|
+
});
|
|
303
|
+
```
|
|
304
|
+
|
|
305
|
+
---
|
|
306
|
+
|
|
307
|
+
### `generateFromMessages(messages, channel, options?)`
|
|
308
|
+
|
|
309
|
+
Generates a transcript from a pre-fetched array of messages.
|
|
310
|
+
|
|
311
|
+
| Parameter | Type | Description |
|
|
312
|
+
|-----------|------|-------------|
|
|
313
|
+
| `messages` | `Message[] \| Collection<string, Message>` | Messages to include |
|
|
314
|
+
| `channel` | `Channel` | Channel for header/guild info |
|
|
315
|
+
| `options` | `GenerateFromMessagesOptions` | Configuration options (see above) |
|
|
316
|
+
|
|
317
|
+
**Returns:** `Promise<AttachmentBuilder | Buffer | string>`
|
|
318
|
+
|
|
319
|
+
```javascript
|
|
320
|
+
const messages = await channel.messages.fetch({ limit: 100 });
|
|
321
|
+
const transcript = await discordTranscripts.generateFromMessages(messages, channel);
|
|
322
|
+
```
|
|
323
|
+
|
|
324
|
+
---
|
|
325
|
+
|
|
326
|
+
### Return Types
|
|
327
|
+
|
|
328
|
+
Use the `ExportReturnType` enum for type-safe return values:
|
|
329
|
+
|
|
330
|
+
```typescript
|
|
331
|
+
import { ExportReturnType } from 'discord.js-html-transcript';
|
|
332
|
+
|
|
333
|
+
// Returns a Buffer
|
|
334
|
+
const buffer = await discordTranscripts.createTranscript(channel, {
|
|
335
|
+
returnType: ExportReturnType.Buffer,
|
|
336
|
+
});
|
|
337
|
+
|
|
338
|
+
// Returns a string
|
|
339
|
+
const html = await discordTranscripts.createTranscript(channel, {
|
|
340
|
+
returnType: ExportReturnType.String,
|
|
341
|
+
});
|
|
342
|
+
|
|
343
|
+
// Returns an AttachmentBuilder (default)
|
|
344
|
+
const attachment = await discordTranscripts.createTranscript(channel, {
|
|
345
|
+
returnType: ExportReturnType.Attachment,
|
|
346
|
+
});
|
|
347
|
+
```
|
|
348
|
+
|
|
349
|
+
---
|
|
350
|
+
|
|
351
|
+
### Asset Classes
|
|
352
|
+
|
|
353
|
+
#### `TranscriptImageDownloader`
|
|
354
|
+
|
|
355
|
+
```javascript
|
|
356
|
+
const downloader = new TranscriptImageDownloader()
|
|
357
|
+
.withMaxSize(5120) // max file size in KB
|
|
358
|
+
.withCompression(40, true) // quality %, convert to webp
|
|
359
|
+
.build(); // returns a resolveImageSrc callback
|
|
360
|
+
```
|
|
361
|
+
|
|
362
|
+
#### `TranscriptAssetDownloader`
|
|
363
|
+
|
|
364
|
+
```javascript
|
|
365
|
+
const downloader = new TranscriptAssetDownloader()
|
|
366
|
+
.withMaxSize(10240) // max file size in KB
|
|
367
|
+
.build(); // returns a resolveAssetSrc callback
|
|
368
|
+
```
|
|
369
|
+
|
|
370
|
+
---
|
|
371
|
+
|
|
372
|
+
## 📖 Full Example
|
|
373
|
+
|
|
374
|
+
```javascript
|
|
375
|
+
const discordTranscripts = require('discord.js-html-transcript');
|
|
376
|
+
const { TranscriptAssetDownloader } = require('discord.js-html-transcript');
|
|
377
|
+
|
|
378
|
+
client.on('messageCreate', async (message) => {
|
|
379
|
+
if (message.content === '!transcript') {
|
|
380
|
+
const transcript = await discordTranscripts.createTranscript(message.channel, {
|
|
381
|
+
returnType: 'attachment',
|
|
382
|
+
filename: `transcript-${message.channel.id}.html`,
|
|
383
|
+
limit: -1,
|
|
384
|
+
assets: {
|
|
385
|
+
attachments: true,
|
|
386
|
+
embeds: true,
|
|
387
|
+
avatars: true,
|
|
388
|
+
emojis: true,
|
|
389
|
+
guildIcons: true,
|
|
390
|
+
inviteIcons: true,
|
|
391
|
+
roleIcons: true,
|
|
392
|
+
serverTagBadges: true,
|
|
393
|
+
},
|
|
394
|
+
features: {
|
|
395
|
+
search: true,
|
|
396
|
+
imagePreview: true,
|
|
397
|
+
spoilerReveal: true,
|
|
398
|
+
messageLinks: true,
|
|
399
|
+
profileBadges: true,
|
|
400
|
+
embedTweaks: true,
|
|
401
|
+
},
|
|
402
|
+
callbacks: {
|
|
403
|
+
resolveAssetSrc: new TranscriptAssetDownloader()
|
|
404
|
+
.withMaxSize(10240)
|
|
405
|
+
.build(),
|
|
406
|
+
},
|
|
407
|
+
footerText: 'Exported {number} message{s}.',
|
|
408
|
+
poweredBy: true,
|
|
409
|
+
});
|
|
410
|
+
|
|
411
|
+
await message.reply({
|
|
412
|
+
content: '📄 Here is your transcript!',
|
|
413
|
+
files: [transcript],
|
|
414
|
+
});
|
|
415
|
+
}
|
|
416
|
+
});
|
|
417
|
+
```
|
|
418
|
+
|
|
419
|
+
---
|
|
420
|
+
|
|
421
|
+
## 🆚 Comparison with Original
|
|
422
|
+
|
|
423
|
+
| Feature | `discord-html-transcripts` | `discord.js-html-transcript` |
|
|
424
|
+
|---------|:---:|:---:|
|
|
425
|
+
| Basic Messages & Embeds | ✅ | ✅ |
|
|
426
|
+
| Forwarded Messages | ❌ | ✅ |
|
|
427
|
+
| Voice Messages | ❌ | ✅ |
|
|
428
|
+
| Polls / Voting | ❌ | ✅ |
|
|
429
|
+
| Server Tags & Role Icons | ❌ | ✅ |
|
|
430
|
+
| Buttons & Select Menus (Modern) | ❌ | ✅ |
|
|
431
|
+
| Discord Invite Previews | ❌ | ✅ |
|
|
432
|
+
| Image Preview Lightbox | ❌ | ✅ |
|
|
433
|
+
| Message Search | ❌ | ✅ |
|
|
434
|
+
| ANSI Code Block Styling | ❌ | ✅ |
|
|
435
|
+
| Thread Preview Cards | ❌ | ✅ |
|
|
436
|
+
| Fully Responsive Mobile UI | ❌ | ✅ |
|
|
437
|
+
| Sticky Channel Header | ❌ | ✅ |
|
|
438
|
+
| Feature Toggle System | ❌ | ✅ |
|
|
439
|
+
| Granular Asset Saving | ❌ | ✅ |
|
|
440
|
+
| Native File Attachment Cards | ❌ | ✅ |
|
|
441
|
+
| Image Compression (sharp) | ❌ | ✅ |
|
|
442
|
+
| Multi-Image Gallery Grid | ❌ | ✅ |
|
|
443
|
+
|
|
444
|
+
---
|
|
445
|
+
|
|
446
|
+
## 🤝 Credits
|
|
447
|
+
|
|
448
|
+
This package is built upon the excellent foundation of [`discord-html-transcripts`](https://github.com/ItzDerock/discord-html-transcripts) by [**ItzDerock**](https://github.com/ItzDerock). Original styles powered by [`@derockdev/discord-components`](https://github.com/ItzDerock/discord-components).
|
|
449
|
+
|
|
450
|
+
All new features, UI modernization, mobile responsiveness, and component redesigns by [**Wick Studio**](https://github.com/wickstudio).
|
|
451
|
+
|
|
452
|
+
---
|
|
453
|
+
|
|
454
|
+
## 💬 Support
|
|
455
|
+
|
|
456
|
+
- 🌐 **Discord Server:** [discord.gg/wicks](https://discord.gg/wicks)
|
|
457
|
+
- 🐛 **Bug Reports:** [GitHub Issues](https://github.com/wickstudio/discord.js-html-transcript/issues)
|
|
458
|
+
- 📦 **NPM:** [discord.js-html-transcript](https://www.npmjs.com/package/discord.js-html-transcript)
|
|
459
|
+
|
|
460
|
+
---
|
|
461
|
+
|
|
462
|
+
## 📜 License
|
|
463
|
+
|
|
464
|
+
This project is licensed under the [Apache License 2.0](./LICENSE).
|
|
465
|
+
|
|
466
|
+
---
|
|
467
|
+
|
|
468
|
+
<p align="center">
|
|
469
|
+
Made with ❤️ by <a href="https://github.com/wickstudio">Wick Studio</a>
|
|
470
|
+
</p>
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { ResolveAssetCallback } from '../types';
|
|
2
|
+
/**
|
|
3
|
+
* Builder to build a generic asset saving callback.
|
|
4
|
+
*/
|
|
5
|
+
export declare class TranscriptAssetDownloader {
|
|
6
|
+
private static log;
|
|
7
|
+
private log;
|
|
8
|
+
private maxFileSize?;
|
|
9
|
+
/**
|
|
10
|
+
* Sets the maximum file size for each downloaded asset.
|
|
11
|
+
* @param size The maximum file size in kilobytes
|
|
12
|
+
*/
|
|
13
|
+
withMaxSize(size: number): this;
|
|
14
|
+
/**
|
|
15
|
+
* Builds the asset saving callback.
|
|
16
|
+
*/
|
|
17
|
+
build(): ResolveAssetCallback;
|
|
18
|
+
}
|