discord-html-transcripts-v2 3.3.1 → 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 (2) hide show
  1. package/README.md +0 -101
  2. package/package.json +8 -8
package/README.md CHANGED
@@ -33,104 +33,3 @@ This module can format the following:
33
33
  Styles from [@derockdev/discord-components](https://github.com/ItzDerock/discord-components).
34
34
  Behind the scenes, this package uses React SSR to generate a static site.
35
35
 
36
- ## 👋 Support
37
-
38
- Please do not DM me requesting support with this package, I will not respond.
39
- Instead, please open a thread on [this](https://discord.gg/MZQN8QMJg8) server.
40
-
41
- ## 🖨️ Example Output
42
-
43
- ![output](https://derock.media/r/6G6FIl.gif)
44
-
45
- ## 📝 Usage
46
-
47
- ### Example usage using the built in message fetcher.
48
-
49
- ```js
50
- const discordTranscripts = require('discord-html-transcripts-v2');
51
- // or (if using typescript) import * as discordTranscripts from 'discord-html-transcripts-v2';
52
-
53
- const channel = message.channel; // or however you get your TextChannel
54
-
55
- // Must be awaited
56
- const attachment = await discordTranscripts.createTranscript(channel);
57
-
58
- channel.send({
59
- files: [attachment],
60
- });
61
- ```
62
-
63
- ### Or if you prefer, you can pass in your own messages.
64
-
65
- ```js
66
- const discordTranscripts = require('discord-html-transcripts-v2');
67
- // or (if using typescript) import * as discordTranscripts from 'discord-html-transcripts-v2';
68
-
69
- const messages = someWayToGetMessages(); // Must be Collection<string, Message> or Message[]
70
- const channel = someWayToGetChannel(); // Used for ticket name, guild icon, and guild name
71
-
72
- // Must be awaited
73
- const attachment = await discordTranscripts.generateFromMessages(messages, channel);
74
-
75
- channel.send({
76
- files: [attachment],
77
- });
78
- ```
79
-
80
- ## ⚙️ Configuration
81
-
82
- Both methods of generating a transcript allow for an option object as the last parameter.
83
- **All configuration options are optional!**
84
-
85
- ### Built in Message Fetcher
86
-
87
- ```js
88
- const attachment = await discordTranscripts.createTranscript(channel, {
89
- limit: -1, // Max amount of messages to fetch. `-1` recursively fetches.
90
- returnType: 'attachment', // Valid options: 'buffer' | 'string' | 'attachment' Default: 'attachment' OR use the enum ExportReturnType
91
- filename: 'transcript.html', // Only valid with returnType is 'attachment'. Name of attachment.
92
- 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 !)
93
- 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
94
- callbacks: {
95
- // register custom callbacks for the following:
96
- resolveChannel: (channelId: string) => Awaitable<Channel | null>,
97
- resolveUser: (userId: string) => Awaitable<User | null>,
98
- resolveRole: (roleId: string) => Awaitable<Role | null>,
99
- resolveImageSrc: (
100
- attachment: APIAttachment,
101
- message: APIMessage
102
- ) => Awaitable<string | null | undefined>
103
- },
104
- poweredBy: true, // Whether to include the "Powered by discord-html-transcripts-v2" footer
105
- hydrate: true, // Whether to hydrate the html server-side
106
- filter: (message) => true // Filter messages, e.g. (message) => !message.author.bot
107
- });
108
- ```
109
-
110
- ### Providing your own messages
111
-
112
- ```js
113
- const attachment = await discordTranscripts.generateFromMessages(messages, channel, {
114
- // Same as createTranscript, except no limit or filter
115
- });
116
- ```
117
-
118
- ### Compressing images
119
-
120
- 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:
121
-
122
- ```js
123
- callbacks: {
124
- resolveImageSrc: new TranscriptImageDownloader()
125
- .withMaxSize(5120) // 5MB in KB
126
- .withCompression(40, true) // 40% quality, convert to webp
127
- .build(),
128
- },
129
- ```
130
-
131
- 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.
132
-
133
- ## 🤝 Enjoy the package?
134
-
135
- Give it a star ⭐ and/or support me on [ko-fi](https://ko-fi.com/derock)
136
-
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "discord-html-transcripts-v2",
3
- "version": "3.3.1",
3
+ "version": "3.3.2",
4
4
  "description": "A nicely formatted html transcript generator for discord.js.",
5
5
  "main": "dist/index.js",
6
6
  "homepage": "https://github.com/Exodo0/discord-html-transcripts-v2",
@@ -38,18 +38,18 @@
38
38
  "dist/**/*.js.map"
39
39
  ],
40
40
  "devDependencies": {
41
- "@eslint/eslintrc": "^3.3.3",
42
- "@eslint/js": "^9.39.3",
41
+ "@eslint/eslintrc": "^3.3.5",
42
+ "@eslint/js": "^9.39.4",
43
43
  "@types/debug": "^4.1.12",
44
- "@types/node": "^24.10.13",
44
+ "@types/node": "^24.12.0",
45
45
  "@types/react": "^19.2.14",
46
46
  "@types/react-dom": "^19.2.3",
47
- "@typescript-eslint/eslint-plugin": "^8.56.0",
48
- "@typescript-eslint/parser": "^8.56.0",
47
+ "@typescript-eslint/eslint-plugin": "^8.57.0",
48
+ "@typescript-eslint/parser": "^8.57.0",
49
49
  "debug": "^4.4.3",
50
50
  "discord.js": "^14.25.1",
51
51
  "dotenv": "^17.3.1",
52
- "eslint": "^9.39.3",
52
+ "eslint": "^9.39.4",
53
53
  "globals": "^16.5.0",
54
54
  "husky": "^9.1.7",
55
55
  "prettier": "^3.8.1",
@@ -66,7 +66,7 @@
66
66
  "react-dom": "19.1.1",
67
67
  "simple-markdown": "^0.7.3",
68
68
  "twemoji": "^14.0.2",
69
- "undici": "^7.22.0"
69
+ "undici": "^7.24.4"
70
70
  },
71
71
  "peerDependencies": {
72
72
  "discord.js": "^14.0.0 || ^15.0.0"