# discord-html-transcripts

> A nicely formatted html transcript generator for discord.js.

Latest version **3.3.0** (published 2025-09-12) · Apache-2.0 license · 0 weekly downloads

> **Deprecated.** This package is deprecated.

## Install

```sh
npm install discord-html-transcripts
pnpm add discord-html-transcripts
yarn add discord-html-transcripts
bun add discord-html-transcripts
```

## Health

**Score 10/100 (F)** — status: deprecated.

Negative: deprecated.

## Facts

| | |
|---|---|
| Version | 3.3.0 |
| Published | 2025-09-12 |
| First published | 2021-10-10 |
| Weekly downloads | 0 |
| License | Apache-2.0 |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 8 |
| Unpacked size | 166.3 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 299 |
| Author | Derock |
| Maintainers | derockdev |
| Keywords | discord.js, discord.js-transcripts, discord.js-html-transcripts, html-transcripts, discord-html-transcripts, discord-transcripts |

## Links

- npm: https://www.npmjs.com/package/discord-html-transcripts
- Repository: https://github.com/ItzDerock/discord-html-transcripts
- Issues: https://github.com/ItzDerock/discord-html-transcripts/issues
- npm.io page: https://npm.io/package/discord-html-transcripts

## Dependencies (8)

- [react](https://npm.io/package/react.md) 19.1.1
- [undici](https://npm.io/package/undici.md) ^7.15.0
- [twemoji](https://npm.io/package/twemoji.md) ^14.0.2
- [react-dom](https://npm.io/package/react-dom.md) 19.1.1
- [simple-markdown](https://npm.io/package/simple-markdown.md) ^0.7.3
- [discord-markdown-parser](https://npm.io/package/discord-markdown-parser.md) ~1.2.0
- [@derockdev/discord-components-core](https://npm.io/package/@derockdev/discord-components-core.md) ^3.6.1
- [@derockdev/discord-components-react](https://npm.io/package/@derockdev/discord-components-react.md) ^3.6.1

## Alternatives

- [@tsparticles/shape-image](https://npm.io/package/@tsparticles/shape-image.md) — 303.7K weekly downloads
- [@tsparticles/shape-line](https://npm.io/package/@tsparticles/shape-line.md) — 233.7K weekly downloads
- [stringify-attributes](https://npm.io/package/stringify-attributes.md) — 58.6K weekly downloads
- [mobile-drag-drop](https://npm.io/package/mobile-drag-drop.md) — 46.3K weekly downloads
- [@comunica/actor-rdf-parse-html](https://npm.io/package/@comunica/actor-rdf-parse-html.md) — 29.2K weekly downloads

## Recent versions

- 3.3.0 (latest) — 2025-09-12
- 3.3.0-next-5eed3d (next) — 2025-12-23
- 3.3.0-next-3deb7f — 2025-12-23
- 3.3.0-next-6fe628f — 2025-12-22
- 3.2.0 — 2023-09-16
- 3.1.5 — 2023-07-31
- 3.1.4 — 2023-03-18
- 3.1.3 — 2023-01-25
- 3.1.2 — 2022-10-20
- 3.1.1 — 2022-10-19
- 3.1.0 — 2022-09-29
- 3.0.0 — 2022-09-25
- 2.6.1 — 2022-08-21
- 2.6.0 — 2022-07-20
- 2.5.8 — 2022-06-19
- … 23 more at https://npm.io/package/discord-html-transcripts/versions

## README

# `discord-html-transcripts`

[![Discord](https://img.shields.io/discord/555474311637499955?label=discord)](https://discord.gg/rf5qN7C)
[![npm](https://img.shields.io/npm/dw/discord-html-transcripts)](http://npmjs.org/package/discord-html-transcripts)
![GitHub package.json version](https://img.shields.io/github/package-json/v/ItzDerock/discord-html-transcripts)
![GitHub Repo stars](https://img.shields.io/github/stars/ItzDerock/discord-html-transcripts?style=social)

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.

This module can format the following:

- Discord flavored markdown
  - Uses [discord-markdown-parser](https://github.com/ItzDerock/discord-markdown-parser)
  - Allows for complex markdown syntax to be parsed properly
- Embeds
- System messages
  - Join messages
  - Message Pins
  - Boost messages
- Slash commands
  - Will show the name of the command in the same style as Discord
- Buttons
- Reactions
- Attachments
  - Images, videos, audio, and generic files
- Replies
- Mentions
- Threads

**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**

Styles from [@derockdev/discord-components](https://github.com/ItzDerock/discord-components).
Behind the scenes, this package uses React SSR to generate a static site.

## 👋 Support

Please do not DM me requesting support with this package, I will not respond.
Instead, please open a thread on [this](https://discord.gg/MZQN8QMJg8) server.

## 🖨️ Example Output

![output](https://derock.media/r/6G6FIl.gif)

## 📝 Usage

### Example usage using the built in message fetcher.

```js
const discordTranscripts = require('discord-html-transcripts');
// or (if using typescript) import * as discordTranscripts from 'discord-html-transcripts';

const channel = message.channel; // or however you get your TextChannel

// Must be awaited
const attachment = await discordTranscripts.createTranscript(channel);

channel.send({
  files: [attachment],
});
```

### Or if you prefer, you can pass in your own messages.

```js
const discordTranscripts = require('discord-html-transcripts');
// or (if using typescript) import * as discordTranscripts from 'discord-html-transcripts';

const messages = someWayToGetMessages(); // Must be Collection<string, Message> or Message[]
const channel = someWayToGetChannel(); // Used for ticket name, guild icon, and guild name

// Must be awaited
const attachment = await discordTranscripts.generateFromMessages(messages, channel);

channel.send({
  files: [attachment],
});
```

## ⚙️ Configuration

Both methods of generating a transcript allow for an option object as the last parameter.
**All configuration options are optional!**

### Built in Message Fetcher

```js
const attachment = await discordTranscripts.createTranscript(channel, {
    limit: -1, // Max amount of messages to fetch. `-1` recursively fetches.
    returnType: 'attachment', // Valid options: 'buffer' | 'string' | 'attachment' Default: 'attachment' OR use the enum ExportReturnType
    filename: 'transcript.html', // Only valid with returnType is 'attachment'. Name of attachment.
    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 !)
    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
    callbacks: {
      // register custom callbacks for the following:
      resolveChannel: (channelId: string) => Awaitable<Channel | null>,
      resolveUser: (userId: string) => Awaitable<User | null>,
      resolveRole: (roleId: string) => Awaitable<Role | null>,
      resolveImageSrc: (
        attachment: APIAttachment,
        message: APIMessage
      ) => Awaitable<string | null | undefined>
    },
    poweredBy: true, // Whether to include the "Powered by discord-html-transcripts" footer
    hydrate: true, // Whether to hydrate the html server-side
    filter: (message) => true // Filter messages, e.g. (message) => !message.author.bot
});
```

### Providing your own messages

```js
const attachment = await discordTranscripts.generateFromMessages(messages, channel, {
  // Same as createTranscript, except no limit or filter
});
```

### Compressing images

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:

```js
callbacks: {
  resolveImageSrc: new TranscriptImageDownloader()
    .withMaxSize(5120) // 5MB in KB
    .withCompression(40, true) // 40% quality, convert to webp
    .build(),
},
```

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.

## 🤝 Enjoy the package?

Give it a star ⭐ and/or support me on [ko-fi](https://ko-fi.com/derock)

---
_Source: https://npm.io/package/discord-html-transcripts · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
