Resources

Transcript

Our automatic transcription system.

Generate beautiful HTML transcripts from Discord text channels using Discord.Js.

Lightweight, customizable and easy to use.


Features

  • 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

Installation

npm install @kazami-devs/transcripts

Basic Usage

const { 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],
})

Advanced Usage

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)
})

Options

OptionTypeDefaultDescription
limitnumber100Number of messages to fetch (-1 = all)
guildNamestringGuild name displayed in transcript
localestringen-USDate formatting locale
timezonestringUTCTimezone for timestamps
returnTypestring"string"Return type: "string" or "buffer"
embedMediabooleanfalseEmbed images and videos as base64 data URIs (self-contained HTML)
embedTypesstring[]["image","video"]Media types to embed: "image", "video", or both. Only used when embedMedia is true
maxFileSizenumber26214400Max HTML file size in bytes (25 MB). Only used when embedMedia is true

Return Value

{
  fileName: string
  html: string | Buffer
}

Media Embedding

When embedMedia: true is enabled, the library will:

  1. Fetch each media attachment from Discord's CDN
  2. Convert it to a base64 data URI
  3. Embed it directly in the HTML file

This makes the HTML file self-contained — it won't depend on Discord CDN URLs that expire.

Supported Media Types

TypeExtensionsPer-File Limit
Imagespng, jpg, gif, webp, bmp, svg, avif30% of budget
Videosmp4, webm, mov, mkv, avi, m4v15% of budget

Size Limits

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'],
})

Peer Dependencies

discord.js ^14.0.0

On this page