Generate beautiful HTML transcripts from Discord text channels using Discord.Js.
Lightweight, customizable and easy to use.
- Generate full HTML transcripts with Discord-like UI
- Locale & timezone support
- Custom Mustache template support
- Fast message fetching with message grouping
- Media embedding — store images and videos as base64 for CDN-free HTML files
- Built for Discord.Js
- TypeScript support
npm install @kazami-devs/transcriptsconst { createTranscript } = require('@kazami-devs/transcripts')
const { AttachmentBuilder } = require('discord.js')
const transcript = await createTranscript(channel)
const attachment = new AttachmentBuilder(
Buffer.from(transcript.html, 'utf-8'),
{ name: transcript.fileName }
)
await interaction.reply({
content: 'Transcript created successfully!',
files: [attachment],
})const transcript = await createTranscript(channel, {
guildName: interaction.guild.name,
locale: 'pt-BR',
timezone: 'America/Sao_Paulo',
limit: -1, // fetch all messages
embedMedia: true, // embed images as base64 (self-contained HTML)
})| Option | Type | Default | Description |
|---|---|---|---|
limit |
number | 100 | Number of messages to fetch (-1 = all) |
guildName |
string | — | Guild name displayed in transcript |
locale |
string | en-US | Date formatting locale |
timezone |
string | UTC | Timezone for timestamps |
returnType |
string | "string" | Return type: "string" or "buffer" |
embedMedia |
boolean | false | Embed images and videos as base64 data URIs (self-contained HTML) |
embedTypes |
string[] | ["image","video"] | Media types to embed: "image", "video", or both. Only used when embedMedia is true |
maxFileSize |
number | 26214400 | Max HTML file size in bytes (25 MB). Only used when embedMedia is true |
{
fileName: string
html: string | Buffer
}When embedMedia: true is enabled, the library will:
- Fetch each media attachment from Discord's CDN
- Convert it to a base64 data URI
- Embed it directly in the HTML file
This makes the HTML file self-contained — it won't depend on Discord CDN URLs that expire.
| Type | Extensions | Per-File Limit |
|---|---|---|
| Images | png, jpg, gif, webp, bmp, svg, avif | 30% of budget |
| Videos | mp4, webm, mov, mkv, avi, m4v | 15% of budget |
Discord has a 25 MB file upload limit. The embedding algorithm uses an 80% safety margin (20 MB target) to ensure the final HTML can be sent by any user.
- Embedded: Media that fits within the per-file and total budget
- Skipped: Files that would exceed limits stay as CDN links
- Graceful fallback: If a file can't be fetched, it stays as a CDN link
// Embed all media, respecting Discord's 25 MB limit
const transcript = await createTranscript(channel, {
embedMedia: true,
maxFileSize: 25 * 1024 * 1024, // optional, defaults to 25 MB
})
// Embed only images (skip videos)
const transcript = await createTranscript(channel, {
embedMedia: true,
embedTypes: ['image'],
})
// Embed only videos (skip images)
const transcript = await createTranscript(channel, {
embedMedia: true,
embedTypes: ['video'],
})discord.js ^14.0.0
This project is licensed under the MIT license. Feel free to contribute!
Developed with love by Camilla Viana 💜
Pull requests are welcome. If you'd like to suggest improvements, feel free to open an issue.