# `safeness-html-transcripts`

[![Discord](https://img.shields.io/discord/555474311637499955?label=discord)](https://discord.gg/rf5qN7C)
[![npm](https://img.shields.io/npm/dw/safeness-html-transcripts)](http://npmjs.org/package/safeness-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)

Safeness HTML Transcripts is a complete overhaul of the discord-html-transcript module. It's a Node.js module designed to generate HTML backups of Discord conversations, including direct messages (DMs) and group DMs. It processes Discord formatting such as **bold**, *italics*, ~~strikethroughs~~, and more. It also formats attachments and embeds.

This module can format the following:

- Discord flavored markdown
- Embeds
- System messages
- Slash commands
- Buttons
- Reactions
- Attachments
  - Images, videos, audio, and generic files
- Replies
- Mentions
- Threads

**This module is designed to work with [discord.js-selfbot-v13](https://github.com/aiko-chan-ai/discord.js-selfbot-v13) only.**

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

## 📝 Usage

### Example usage with the built-in message fetcher

```js
const { createTranscript } = require('safeness-html-transcripts');

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

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

// Save the transcript to a file
const fs = require('fs');
fs.writeFileSync('transcript.html', attachment);
```

### Configuration

The transcript generation method allows for an options object as the last parameter.  
**All configuration options are optional!**

```js
const attachment = await createTranscript(channel, {
    limit: -1, // Max number of messages to fetch. `-1` fetches recursively.
    fileName: 'transcript.html', // Name of the backup file.
    saveImages: false, // Download all images and include image data in the HTML (allows viewing the image even after deletion) (! WILL INCREASE FILE SIZE !)
    poweredBy: false // Whether to include the "Powered by discord-html-transcripts" footer
});
```

## ⚠️ Warning

Using selfbots (like this module) may be against Discord's Terms of Service. Use this module at your own risk.

## 🤝 Enjoy the package?

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

---

This package is a complete overhaul of the original [discord-html-transcripts](https://github.com/ItzDerock/discord-html-transcripts) package by ItzDerock. All credits for the original concept and base code go to him.
