npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@discord-chat-exporter/cli

v0.2.0

Published

CLI for exporting Discord chat history (synced with C# DiscordChatExporter v2.47)

Readme

@discord-chat-exporter/cli

Command-line interface for exporting Discord chat history to various formats.

npm License: MIT

Installation

npm install -g @discord-chat-exporter/cli

Or run directly with npx:

npx @discord-chat-exporter/cli --help

Requirements

  • Node.js >= 20.0.0
  • Discord authentication token (user or bot)

Quick Start

# Export a single channel
discord-chat-exporter export -t "YOUR_TOKEN" -c "CHANNEL_ID"

# Export entire guild
discord-chat-exporter exportguild -t "YOUR_TOKEN" -g "GUILD_ID"

# List your guilds
discord-chat-exporter guilds -t "YOUR_TOKEN"

Commands

export

Export one or more channels to a file.

discord-chat-exporter export [options]

Required:

  • -t, --token <token> - Discord authentication token
  • -c, --channel <ids...> - Channel ID(s) to export

Options:

  • -o, --output <path> - Output file path or directory (default: current directory)
  • -f, --format <format> - Export format (default: html-dark)
  • --after <date> - Only include messages after this date or message ID
  • --before <date> - Only include messages before this date or message ID
  • --filter <expression> - Message filter expression
  • --partition <limit> - Split output by message count or file size
  • --media - Download media attachments
  • --reuse-media - Reuse previously downloaded media
  • --media-dir <path> - Directory to download media to
  • --no-markdown - Disable markdown processing
  • --utc - Normalize timestamps to UTC
  • --locale <locale> - Locale for date/number formatting
  • --parallel <count> - Number of channels to export in parallel (default: 1)

Examples:

# Export to JSON
discord-chat-exporter export -t TOKEN -c 123456789 -f json -o ./export.json

# Export with date range
discord-chat-exporter export -t TOKEN -c 123456789 \
  --after "2024-01-01" --before "2024-12-31"

# Export with filter and media download
discord-chat-exporter export -t TOKEN -c 123456789 \
  --filter "has:attachment" --media --media-dir ./media

# Export multiple channels in parallel
discord-chat-exporter export -t TOKEN -c 111 222 333 \
  -o ./exports/ --parallel 3

exportguild

Export all channels in a guild.

discord-chat-exporter exportguild [options]

Required:

  • -t, --token <token> - Discord authentication token
  • -g, --guild <id> - Guild ID

Options: Same as export command, plus:

  • --threads - Include threads

Examples:

# Export entire guild with threads
discord-chat-exporter exportguild -t TOKEN -g 123456789 \
  --threads -o ./guild-export/

# Export guild in parallel
discord-chat-exporter exportguild -t TOKEN -g 123456789 \
  --parallel 5 -f json

guilds

List available guilds.

discord-chat-exporter guilds -t <token>

Output:

Found 3 guild(s):
  123456789012345678 | My Server
  234567890123456789 | Another Server
  345678901234567890 | Third Server

channels

List channels in a guild.

discord-chat-exporter channels -t <token> -g <guild_id> [--threads]

Options:

  • --threads - Include threads

Output:

Found 10 channel(s):
  111111111111111111 | Text | general
  222222222222222222 | Voice | Voice Chat
  333333333333333333 | Category | Information
    444444444444444444 | Thread | Discussion Thread

dms

List direct message channels.

discord-chat-exporter dms -t <token>

Output:

Found 5 DM channel(s):
  111111111111111111 | DM | User#1234
  222222222222222222 | Group | Group Chat Name

Export Formats

| Format | Value | Description | |--------|-------|-------------| | HTML Dark | html-dark | Styled HTML with dark theme (default) | | HTML Light | html-light | Styled HTML with light theme | | JSON | json | Structured JSON for data processing | | CSV | csv | Tabular format for spreadsheets | | Plain Text | txt | Simple text format |

Filter Expressions

Filter messages during export using expressions:

# Messages from a specific user
--filter "from:username"
--filter "from:123456789012345678"  # By user ID

# Messages with specific content
--filter "has:attachment"
--filter "has:embed"
--filter "has:image"
--filter "has:video"
--filter "has:link"
--filter "has:mention"
--filter "has:sticker"

# Messages containing text
--filter "contains:hello"

# Pinned messages
--filter "is:pinned"

# Combine filters
--filter "from:username and has:image"
--filter "has:attachment or has:embed"
--filter "(from:user1 or from:user2) and has:image"

# Exclude messages
--filter "-has:embed"
--filter "from:username -has:link"

Partition Limits

Split large exports into multiple files:

# By message count
--partition 1000     # 1000 messages per file
--partition 5000     # 5000 messages per file

# By file size
--partition 10mb     # 10 megabytes per file
--partition 500kb    # 500 kilobytes per file
--partition 1gb      # 1 gigabyte per file

Output files are named with part numbers: export [part 1].html, export [part 2].html, etc.

Output Path Templates

When exporting multiple channels, use template placeholders:

| Placeholder | Description | |-------------|-------------| | %g | Guild ID | | %G | Guild name | | %c | Channel ID | | %C | Channel name | | %t | Channel type | | %p | Channel category ID | | %P | Channel category name | | %a | After date | | %b | Before date | | %d | Export date | | %% | Literal % |

Example:

discord-chat-exporter exportguild -t TOKEN -g GUILD \
  -o "./exports/%G/%C.html"

Authentication

User Token

  1. Open Discord in browser
  2. Press F12 for Developer Tools
  3. Go to Console tab
  4. Paste and run:
    (webpackChunkdiscord_app.push([[''],{},e=>{m=[];for(let c in e.c)m.push(e.c[c])}]),m).find(m=>m?.exports?.default?.getToken!==void 0).exports.default.getToken()

Bot Token

  1. Create application at Discord Developer Portal
  2. Go to Bot settings
  3. Enable "Message Content Intent"
  4. Copy the token
  5. Use with Bot prefix:
    discord-chat-exporter export -t "Bot YOUR_BOT_TOKEN" -c CHANNEL_ID

Troubleshooting

Authentication Errors

  • Verify your token is correct and not expired
  • For bot tokens, include the Bot prefix
  • Regenerate token if compromised

Rate Limit Errors

  • Reduce --parallel count
  • Wait a few minutes before retrying
  • Bot tokens generally have higher rate limits

Missing Messages

  • For bot tokens, ensure "Message Content Intent" is enabled
  • Check that you have permission to read the channel
  • Deleted messages cannot be recovered

Empty Export

  • Verify the channel contains messages in the specified date range
  • Check if your filter expression is too restrictive

Related Packages

License

MIT