@libstermynal/transcript-v2 3.3.2

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 (96) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +134 -0
  3. package/dist/downloader/images.d.ts +36 -0
  4. package/dist/downloader/images.js +114 -0
  5. package/dist/downloader/images.js.map +1 -0
  6. package/dist/generator/index.d.ts +18 -0
  7. package/dist/generator/index.js +71 -0
  8. package/dist/generator/index.js.map +1 -0
  9. package/dist/generator/renderers/attachment.d.ts +21 -0
  10. package/dist/generator/renderers/attachment.js +67 -0
  11. package/dist/generator/renderers/attachment.js.map +1 -0
  12. package/dist/generator/renderers/components/Button.d.ts +9 -0
  13. package/dist/generator/renderers/components/Button.js +9 -0
  14. package/dist/generator/renderers/components/Button.js.map +1 -0
  15. package/dist/generator/renderers/components/Container.d.ts +5 -0
  16. package/dist/generator/renderers/components/Container.js +19 -0
  17. package/dist/generator/renderers/components/Container.js.map +1 -0
  18. package/dist/generator/renderers/components/DiscordHighlightedCode.d.ts +6 -0
  19. package/dist/generator/renderers/components/DiscordHighlightedCode.js +199 -0
  20. package/dist/generator/renderers/components/DiscordHighlightedCode.js.map +1 -0
  21. package/dist/generator/renderers/components/DiscordImage.d.ts +6 -0
  22. package/dist/generator/renderers/components/DiscordImage.js +21 -0
  23. package/dist/generator/renderers/components/DiscordImage.js.map +1 -0
  24. package/dist/generator/renderers/components/Media Gallery.d.ts +5 -0
  25. package/dist/generator/renderers/components/Media Gallery.js +32 -0
  26. package/dist/generator/renderers/components/Media Gallery.js.map +1 -0
  27. package/dist/generator/renderers/components/Select Menu.d.ts +7 -0
  28. package/dist/generator/renderers/components/Select Menu.js +31 -0
  29. package/dist/generator/renderers/components/Select Menu.js.map +1 -0
  30. package/dist/generator/renderers/components/Spacing.d.ts +6 -0
  31. package/dist/generator/renderers/components/Spacing.js +14 -0
  32. package/dist/generator/renderers/components/Spacing.js.map +1 -0
  33. package/dist/generator/renderers/components/Thumbnail.d.ts +4 -0
  34. package/dist/generator/renderers/components/Thumbnail.js +13 -0
  35. package/dist/generator/renderers/components/Thumbnail.js.map +1 -0
  36. package/dist/generator/renderers/components/TranscriptHeader.d.ts +8 -0
  37. package/dist/generator/renderers/components/TranscriptHeader.js +13 -0
  38. package/dist/generator/renderers/components/TranscriptHeader.js.map +1 -0
  39. package/dist/generator/renderers/components/section/Section.d.ts +9 -0
  40. package/dist/generator/renderers/components/section/Section.js +19 -0
  41. package/dist/generator/renderers/components/section/Section.js.map +1 -0
  42. package/dist/generator/renderers/components/section/SectionAccessory.d.ts +6 -0
  43. package/dist/generator/renderers/components/section/SectionAccessory.js +16 -0
  44. package/dist/generator/renderers/components/section/SectionAccessory.js.map +1 -0
  45. package/dist/generator/renderers/components/section/SectionContent.d.ts +6 -0
  46. package/dist/generator/renderers/components/section/SectionContent.js +12 -0
  47. package/dist/generator/renderers/components/section/SectionContent.js.map +1 -0
  48. package/dist/generator/renderers/components/styles.d.ts +21 -0
  49. package/dist/generator/renderers/components/styles.js +147 -0
  50. package/dist/generator/renderers/components/styles.js.map +1 -0
  51. package/dist/generator/renderers/components/utils.d.ts +36 -0
  52. package/dist/generator/renderers/components/utils.js +98 -0
  53. package/dist/generator/renderers/components/utils.js.map +1 -0
  54. package/dist/generator/renderers/components.d.ts +11 -0
  55. package/dist/generator/renderers/components.js +65 -0
  56. package/dist/generator/renderers/components.js.map +1 -0
  57. package/dist/generator/renderers/content.d.ts +31 -0
  58. package/dist/generator/renderers/content.js +163 -0
  59. package/dist/generator/renderers/content.js.map +1 -0
  60. package/dist/generator/renderers/embed.d.ts +11 -0
  61. package/dist/generator/renderers/embed.js +44 -0
  62. package/dist/generator/renderers/embed.js.map +1 -0
  63. package/dist/generator/renderers/message.d.ts +6 -0
  64. package/dist/generator/renderers/message.js +59 -0
  65. package/dist/generator/renderers/message.js.map +1 -0
  66. package/dist/generator/renderers/reply.d.ts +6 -0
  67. package/dist/generator/renderers/reply.js +53 -0
  68. package/dist/generator/renderers/reply.js.map +1 -0
  69. package/dist/generator/renderers/systemMessage.d.ts +13 -0
  70. package/dist/generator/renderers/systemMessage.js +115 -0
  71. package/dist/generator/renderers/systemMessage.js.map +1 -0
  72. package/dist/generator/transcript.d.ts +9 -0
  73. package/dist/generator/transcript.js +76 -0
  74. package/dist/generator/transcript.js.map +1 -0
  75. package/dist/index.d.ts +25 -0
  76. package/dist/index.js +138 -0
  77. package/dist/index.js.map +1 -0
  78. package/dist/static/client.d.ts +3 -0
  79. package/dist/static/client.js +31 -0
  80. package/dist/static/client.js.map +1 -0
  81. package/dist/types.d.ts +68 -0
  82. package/dist/types.js +17 -0
  83. package/dist/types.js.map +1 -0
  84. package/dist/utils/buildProfiles.d.ts +11 -0
  85. package/dist/utils/buildProfiles.js +42 -0
  86. package/dist/utils/buildProfiles.js.map +1 -0
  87. package/dist/utils/embeds.d.ts +2 -0
  88. package/dist/utils/embeds.js +17 -0
  89. package/dist/utils/embeds.js.map +1 -0
  90. package/dist/utils/extend.d.ts +8 -0
  91. package/dist/utils/extend.js +8 -0
  92. package/dist/utils/extend.js.map +1 -0
  93. package/dist/utils/utils.d.ts +15 -0
  94. package/dist/utils/utils.js +50 -0
  95. package/dist/utils/utils.js.map +1 -0
  96. package/package.json +70 -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,134 @@
1
+ # `discord-html-transcripts`
2
+
3
+ [![Discord](https://img.shields.io/discord/555474311637499955?label=discord)](https://discord.gg/rf5qN7C)
4
+ [![npm](https://img.shields.io/npm/dw/discord-html-transcripts)](http://npmjs.org/package/discord-html-transcripts)
5
+ ![GitHub package.json version](https://img.shields.io/github/package-json/v/ItzDerock/discord-html-transcripts)
6
+ ![GitHub Repo stars](https://img.shields.io/github/stars/ItzDerock/discord-html-transcripts?style=social)
7
+
8
+ Discord HTML Transcripts is a node.js module to generate nice looking HTML transcripts. Processes discord markdown like **bold**, _italics_, ~~strikethroughs~~, and more. Nicely formats attachments and embeds. Built in XSS protection, preventing users from inserting arbitrary html tags.
9
+
10
+ This module can format the following:
11
+
12
+ - Discord flavored markdown
13
+ - Uses [discord-markdown-parser](https://github.com/ItzDerock/discord-markdown-parser)
14
+ - Allows for complex markdown syntax to be parsed properly
15
+ - Embeds
16
+ - System messages
17
+ - Join messages
18
+ - Message Pins
19
+ - Boost messages
20
+ - Slash commands
21
+ - Will show the name of the command in the same style as Discord
22
+ - Buttons
23
+ - Reactions
24
+ - Attachments
25
+ - Images, videos, audio, and generic files
26
+ - Replies
27
+ - Mentions
28
+ - Threads
29
+
30
+ **This module is designed to work with [discord.js](https://discord.js.org/#/) v14/v15 _only_. If you need v13 support, roll back to v2.X.X**
31
+
32
+ Styles from [@derockdev/discord-components](https://github.com/ItzDerock/discord-components).
33
+ Behind the scenes, this package uses React SSR to generate a static site.
34
+
35
+ ## 👋 Support
36
+
37
+ Please do not DM me requesting support with this package, I will not respond.
38
+ Instead, please open a thread on [this](https://discord.gg/MZQN8QMJg8) server.
39
+
40
+ ## 🖨️ Example Output
41
+
42
+ ![output](https://derock.media/r/6G6FIl.gif)
43
+
44
+ ## 📝 Usage
45
+
46
+ ### Example usage using the built in message fetcher.
47
+
48
+ ```js
49
+ const discordTranscripts = require('discord-html-transcripts');
50
+ // or (if using typescript) import * as discordTranscripts from 'discord-html-transcripts';
51
+
52
+ const channel = message.channel; // or however you get your TextChannel
53
+
54
+ // Must be awaited
55
+ const attachment = await discordTranscripts.createTranscript(channel);
56
+
57
+ channel.send({
58
+ files: [attachment],
59
+ });
60
+ ```
61
+
62
+ ### Or if you prefer, you can pass in your own messages.
63
+
64
+ ```js
65
+ const discordTranscripts = require('discord-html-transcripts');
66
+ // or (if using typescript) import * as discordTranscripts from 'discord-html-transcripts';
67
+
68
+ const messages = someWayToGetMessages(); // Must be Collection<string, Message> or Message[]
69
+ const channel = someWayToGetChannel(); // Used for ticket name, guild icon, and guild name
70
+
71
+ // Must be awaited
72
+ const attachment = await discordTranscripts.generateFromMessages(messages, channel);
73
+
74
+ channel.send({
75
+ files: [attachment],
76
+ });
77
+ ```
78
+
79
+ ## ⚙️ Configuration
80
+
81
+ Both methods of generating a transcript allow for an option object as the last parameter.
82
+ **All configuration options are optional!**
83
+
84
+ ### Built in Message Fetcher
85
+
86
+ ```js
87
+ const attachment = await discordTranscripts.createTranscript(channel, {
88
+ limit: -1, // Max amount of messages to fetch. `-1` recursively fetches.
89
+ returnType: 'attachment', // Valid options: 'buffer' | 'string' | 'attachment' Default: 'attachment' OR use the enum ExportReturnType
90
+ filename: 'transcript.html', // Only valid with returnType is 'attachment'. Name of attachment.
91
+ saveImages: false, // Download all images and include the image data in the HTML (allows viewing the image even after it has been deleted) (! WILL INCREASE FILE SIZE !)
92
+ footerText: "Exported {number} message{s}", // Change text at footer, don't forget to put {number} to show how much messages got exported, and {s} for plural
93
+ callbacks: {
94
+ // register custom callbacks for the following:
95
+ resolveChannel: (channelId: string) => Awaitable<Channel | null>,
96
+ resolveUser: (userId: string) => Awaitable<User | null>,
97
+ resolveRole: (roleId: string) => Awaitable<Role | null>,
98
+ resolveImageSrc: (
99
+ attachment: APIAttachment,
100
+ message: APIMessage
101
+ ) => Awaitable<string | null | undefined>
102
+ },
103
+ poweredBy: true, // Whether to include the "Powered by discord-html-transcripts" footer
104
+ hydrate: true, // Whether to hydrate the html server-side
105
+ filter: (message) => true // Filter messages, e.g. (message) => !message.author.bot
106
+ });
107
+ ```
108
+
109
+ ### Providing your own messages
110
+
111
+ ```js
112
+ const attachment = await discordTranscripts.generateFromMessages(messages, channel, {
113
+ // Same as createTranscript, except no limit or filter
114
+ });
115
+ ```
116
+
117
+ ### Compressing images
118
+
119
+ If `saveImages` is set to `true`, all images will be downloaded and stored in the file _as-is_. You can optionally enable compression by installing the `sharp` module and setting the following options:
120
+
121
+ ```js
122
+ callbacks: {
123
+ resolveImageSrc: new TranscriptImageDownloader()
124
+ .withMaxSize(5120) // 5MB in KB
125
+ .withCompression(40, true) // 40% quality, convert to webp
126
+ .build(),
127
+ },
128
+ ```
129
+
130
+ Note that, in a more advanced setup, you could store a copy of the files and return an entirely new URL pointing to your own image hosting site by implementing a custom `resolveImageSrc` function.
131
+
132
+ ## 🤝 Enjoy the package?
133
+
134
+ Give it a star ⭐ and/or support me on [ko-fi](https://ko-fi.com/derock)
@@ -0,0 +1,36 @@
1
+ import type { APIAttachment, APIMessage, Awaitable } from 'discord.js';
2
+ import type { WebpOptions } from 'sharp';
3
+ /**
4
+ * Callback used to save an image attachment.
5
+ * The returned string is the URL that will be used in the transcript.
6
+ *
7
+ * `undefined` indicates to use the original attachment URL.
8
+ * `null` indicates to not include the attachment in the transcript.
9
+ * `string` indicates to use the returned URL as the attachment URL (base64 or remote image).
10
+ */
11
+ export type ResolveImageCallback = (attachment: APIAttachment, message: APIMessage) => Awaitable<string | null | undefined>;
12
+ /**
13
+ * Builder to build a image saving callback.
14
+ */
15
+ export declare class TranscriptImageDownloader {
16
+ private static log;
17
+ private log;
18
+ private maxFileSize?;
19
+ private compression?;
20
+ /**
21
+ * Sets the maximum file size for *each* individual image.
22
+ * @param size The maximum file size in kilobytes
23
+ */
24
+ withMaxSize(size: number): this;
25
+ /**
26
+ * Sets the compression quality for each image. This requires `sharp` to be installed.
27
+ * Optionally, images can be converted to WebP format which is smaller in size.
28
+ * @param quality The quality of the image (1 lowest - 100 highest). Lower quality means smaller file size.
29
+ * @param convertToWebP Whether to convert the image to WebP format
30
+ */
31
+ withCompression(quality?: number, convertToWebP?: boolean, options?: Omit<WebpOptions, 'quality' | 'force'>): this;
32
+ /**
33
+ * Builds the image saving callback.
34
+ */
35
+ build(): ResolveImageCallback;
36
+ }
@@ -0,0 +1,114 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ var __importDefault = (this && this.__importDefault) || function (mod) {
36
+ return (mod && mod.__esModule) ? mod : { "default": mod };
37
+ };
38
+ Object.defineProperty(exports, "__esModule", { value: true });
39
+ exports.TranscriptImageDownloader = void 0;
40
+ const undici_1 = require("undici");
41
+ const debug_1 = __importDefault(require("debug"));
42
+ /**
43
+ * Builder to build a image saving callback.
44
+ */
45
+ class TranscriptImageDownloader {
46
+ constructor() {
47
+ this.log = TranscriptImageDownloader.log;
48
+ }
49
+ /**
50
+ * Sets the maximum file size for *each* individual image.
51
+ * @param size The maximum file size in kilobytes
52
+ */
53
+ withMaxSize(size) {
54
+ this.maxFileSize = size;
55
+ return this;
56
+ }
57
+ /**
58
+ * Sets the compression quality for each image. This requires `sharp` to be installed.
59
+ * Optionally, images can be converted to WebP format which is smaller in size.
60
+ * @param quality The quality of the image (1 lowest - 100 highest). Lower quality means smaller file size.
61
+ * @param convertToWebP Whether to convert the image to WebP format
62
+ */
63
+ withCompression(quality = 80, convertToWebP = false, options = {}) {
64
+ if (quality < 1 || quality > 100)
65
+ throw new Error('Quality must be between 1 and 100');
66
+ // try and import sharp
67
+ Promise.resolve().then(() => __importStar(require('sharp'))).catch((err) => {
68
+ console.error(err);
69
+ console.error(`[discord-html-transcripts] Failed to import 'sharp'. Image compression requires the 'sharp' package to be installed. Either install sharp or remove the compression options.`);
70
+ });
71
+ this.compression = { quality, convertToWebP, options };
72
+ return this;
73
+ }
74
+ /**
75
+ * Builds the image saving callback.
76
+ */
77
+ build() {
78
+ return async (attachment) => {
79
+ // if the attachment is not an image, return null
80
+ if (!attachment.width || !attachment.height)
81
+ return undefined;
82
+ // if the max file size is set, check if the file size is within the limit
83
+ if (this.maxFileSize && attachment.size > this.maxFileSize * 1024)
84
+ return undefined;
85
+ // fetch the image
86
+ this.log(`Fetching attachment ${attachment.id}: ${attachment.url}`);
87
+ const response = await (0, undici_1.request)(attachment.url).catch((err) => {
88
+ console.error(`[discord-html-transcripts] Failed to download image for transcript: `, err);
89
+ return null;
90
+ });
91
+ if (!response)
92
+ return undefined;
93
+ const mimetype = response.headers['content-type'];
94
+ const buffer = await response.body.arrayBuffer().then((res) => Buffer.from(res));
95
+ this.log(`Finished fetching ${attachment.id} (${buffer.length} bytes)`);
96
+ // if the compression options are set, compress the image
97
+ if (this.compression) {
98
+ const sharp = await Promise.resolve().then(() => __importStar(require('sharp')));
99
+ this.log(`Compressing ${attachment.id} with 'sharp'`);
100
+ const sharpbuf = await sharp
101
+ .default(buffer)
102
+ .webp(Object.assign({ quality: this.compression.quality, force: this.compression.convertToWebP, effort: 2 }, this.compression.options))
103
+ .toBuffer({ resolveWithObject: true });
104
+ this.log(`Finished compressing ${attachment.id} (${sharpbuf.info.size} bytes)`);
105
+ return `data:image/${sharpbuf.info.format};base64,${sharpbuf.data.toString('base64')}`;
106
+ }
107
+ // return the base64 string
108
+ return `data:${mimetype};base64,${buffer.toString('base64')}`;
109
+ };
110
+ }
111
+ }
112
+ exports.TranscriptImageDownloader = TranscriptImageDownloader;
113
+ TranscriptImageDownloader.log = (0, debug_1.default)('discord-html-transcripts:TranscriptImageDownloader');
114
+ //# sourceMappingURL=images.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"images.js","sourceRoot":"","sources":["../../src/downloader/images.ts"],"names":[],"mappings":"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"}
@@ -0,0 +1,18 @@
1
+ import { type Awaitable, type Channel, type Message, type Role, type User } from 'discord.js';
2
+ import type { ResolveImageCallback } from '../downloader/images';
3
+ export type RenderMessageContext = {
4
+ messages: Message[];
5
+ channel: Channel;
6
+ callbacks: {
7
+ resolveImageSrc: ResolveImageCallback;
8
+ resolveChannel: (channelId: string) => Awaitable<Channel | null>;
9
+ resolveUser: (userId: string) => Awaitable<User | null>;
10
+ resolveRole: (roleId: string) => Awaitable<Role | null>;
11
+ };
12
+ poweredBy?: boolean;
13
+ footerText?: string;
14
+ saveImages: boolean;
15
+ favicon: 'guild' | string;
16
+ hydrate: boolean;
17
+ };
18
+ export default function render({ messages, channel, callbacks, ...options }: RenderMessageContext): Promise<string>;
@@ -0,0 +1,71 @@
1
+ "use strict";
2
+ var __rest = (this && this.__rest) || function (s, e) {
3
+ var t = {};
4
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
5
+ t[p] = s[p];
6
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
7
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
8
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
9
+ t[p[i]] = s[p[i]];
10
+ }
11
+ return t;
12
+ };
13
+ var __importDefault = (this && this.__importDefault) || function (mod) {
14
+ return (mod && mod.__esModule) ? mod : { "default": mod };
15
+ };
16
+ var _a;
17
+ Object.defineProperty(exports, "__esModule", { value: true });
18
+ exports.default = render;
19
+ const jsx_runtime_1 = require("react/jsx-runtime");
20
+ const static_1 = require("react-dom/static");
21
+ const buildProfiles_1 = require("../utils/buildProfiles");
22
+ const client_1 = require("../static/client");
23
+ const fs_1 = require("fs");
24
+ const path_1 = __importDefault(require("path"));
25
+ const ssr_1 = require("@lit-labs/ssr");
26
+ const transcript_1 = __importDefault(require("./transcript"));
27
+ const utils_1 = require("../utils/utils");
28
+ const render_result_1 = require("@lit-labs/ssr/lib/render-result");
29
+ const styles_1 = require("./renderers/components/styles");
30
+ const DiscordImage_1 = require("./renderers/components/DiscordImage");
31
+ const DiscordHighlightedCode_1 = require("./renderers/components/DiscordHighlightedCode");
32
+ // read the package.json file and get the @derockdev/discord-components-core version
33
+ let discordComponentsVersion = '^4.0.2';
34
+ try {
35
+ const packagePath = path_1.default.join(__dirname, '..', '..', 'package.json');
36
+ const packageJSON = JSON.parse((0, fs_1.readFileSync)(packagePath, 'utf8'));
37
+ discordComponentsVersion = (_a = packageJSON.dependencies['@skyra/discord-components-core']) !== null && _a !== void 0 ? _a : discordComponentsVersion;
38
+ // eslint-disable-next-line no-empty
39
+ }
40
+ catch (_b) { } // ignore errors
41
+ async function render(_a) {
42
+ var _b;
43
+ var { messages, channel, callbacks } = _a, options = __rest(_a, ["messages", "channel", "callbacks"]);
44
+ const profiles = (0, buildProfiles_1.buildProfiles)(messages);
45
+ const { prelude } = await (0, static_1.prerenderToNodeStream)((0, jsx_runtime_1.jsxs)("html", { children: [(0, jsx_runtime_1.jsxs)("head", { children: [(0, jsx_runtime_1.jsx)("meta", { charSet: "utf-8" }), (0, jsx_runtime_1.jsx)("meta", { name: "viewport", content: "width=device-width, initial-scale=1" }), (0, jsx_runtime_1.jsx)("link", { rel: "preconnect", href: "https://cdn.jsdelivr.net/" }), (0, jsx_runtime_1.jsx)("link", { rel: "preconnect", href: "https://cdn.discordapp.com" }), (0, jsx_runtime_1.jsx)("style", { dangerouslySetInnerHTML: { __html: client_1.ggSansFont } }), (0, jsx_runtime_1.jsx)("style", { dangerouslySetInnerHTML: { __html: styles_1.globalStyles } }), (0, jsx_runtime_1.jsx)("style", { dangerouslySetInnerHTML: { __html: DiscordImage_1.DiscordAttachmentStyles } }), (0, jsx_runtime_1.jsx)("style", { dangerouslySetInnerHTML: { __html: DiscordHighlightedCode_1.DiscordHighlightStyles } }), (0, jsx_runtime_1.jsx)("link", { rel: "icon", type: "image/png", href: options.favicon === 'guild'
46
+ ? channel.isDMBased()
47
+ ? undefined
48
+ : ((_b = channel.guild.iconURL({ size: 16, extension: 'png' })) !== null && _b !== void 0 ? _b : undefined)
49
+ : options.favicon }), (0, jsx_runtime_1.jsx)("title", { children: channel.isDMBased() ? 'Direct Messages' : channel.name }), (0, jsx_runtime_1.jsx)("script", { dangerouslySetInnerHTML: {
50
+ __html: client_1.scrollToMessage,
51
+ } }), !options.hydrate && ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)("script", { dangerouslySetInnerHTML: {
52
+ __html: `globalThis.$discordMessage={profiles:${JSON.stringify(await profiles)}}`,
53
+ } }), (0, jsx_runtime_1.jsx)("script", { type: "module", src: `https://cdn.jsdelivr.net/npm/@skyra/discord-components-core@${discordComponentsVersion}/+esm` })] }))] }), (0, jsx_runtime_1.jsx)("body", { style: {
54
+ margin: 0,
55
+ minHeight: '100vh',
56
+ }, children: (0, jsx_runtime_1.jsx)(transcript_1.default, Object.assign({ messages: messages, channel: channel, callbacks: callbacks }, options)) }), options.hydrate && (0, jsx_runtime_1.jsx)("script", { dangerouslySetInnerHTML: { __html: client_1.revealSpoiler } })] }));
57
+ const markup = await (0, utils_1.streamToString)(prelude);
58
+ if (options.hydrate) {
59
+ const result = (0, ssr_1.render)(markup);
60
+ // const result = await renderToString(markup, {
61
+ // beforeHydrate: async (document) => {
62
+ // document.defaultView.$discordMessage = {
63
+ // profiles: await profiles,
64
+ // };
65
+ // },
66
+ // });
67
+ return await (0, render_result_1.collectResult)(result);
68
+ }
69
+ return markup;
70
+ }
71
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/generator/index.tsx"],"names":[],"mappings":"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"}
@@ -0,0 +1,21 @@
1
+ import type { Attachment as AttachmentType, Message } from 'discord.js';
2
+ import type { RenderMessageContext } from '..';
3
+ /**
4
+ * Renders all attachments for a message
5
+ * @param message
6
+ * @param context
7
+ * @returns
8
+ */
9
+ export declare function Attachments(props: {
10
+ message: Message;
11
+ context: RenderMessageContext;
12
+ }): Promise<import("react/jsx-runtime").JSX.Element | import("react/jsx-runtime").JSX.Element[]>;
13
+ /**
14
+ * Renders one Discord Attachment
15
+ * @param props - the attachment and rendering context
16
+ */
17
+ export declare function Attachment({ attachment, context, message, }: {
18
+ attachment: AttachmentType;
19
+ context: RenderMessageContext;
20
+ message: Message;
21
+ }): Promise<import("react/jsx-runtime").JSX.Element>;