CLI Commands & Options

Usage: DiscordChatExporter.Cli [command] [options]

Global Options

All commands accept these options:

  • -t, --token <string>: Authentication token. (Env: DISCORD_TOKEN)
  • --respect-rate-limits: Default true. If disabled, ignores advisory rate limits (risky).

Commands

export

Exports a specific channel or list of channels.

Arguments:

  • -c, --channel <id>: Channel ID(s). Can specify multiple.

Export Options:

  • -f, --format <format>: PlainText, HtmlDark, HtmlLight, Json, Csv (Default: HtmlDark).
  • -o, --output <path>: Output file or directory. Supports template tokens (e.g., %G/%C.html).
  • --after <date>: Export messages after this date/snowflake.
  • --before <date>: Export messages before this date/snowflake.
  • -p, --partition <limit>: Split output (e.g., 100 messages or 10mb).
  • --filter <string>: Message filter query.
  • --media: Download assets (images, avatars).
  • --media-dir <path>: Directory for downloaded assets.
  • --reuse-media: Reuse existing media files.
  • --markdown: Default true. Process markdown tokens.
  • --locale <string>: Date formatting locale (e.g., en-US).
  • --utc: Normalize timestamps to UTC.

exportguild

Exports all channels in a specific server.

Arguments:

  • -g, --guild <id>: Server ID.
  • --include-vc: Include voice channels (text chat). Default true.
  • --include-threads <mode>: none, active, all.

exportall

Exports all accessible channels (Servers + DMs).

Options:

  • --include-dm: Include Direct Messages. Default true.
  • --include-guilds: Include Servers. Default true.
  • --data-package <path>: Path to Discord Data Package (ZIP) to identify channels.

exportdm

Exports all Direct Message channels.

channels

Lists channels in a specific server.

Arguments:

  • -g, --guild <id>: Server ID.

guilds

Lists all servers the token has access to.

Template Tokens for Output Path

When specifying -o, you can use these tokens to dynamically name files:

Token Description
%g Server ID
%G Server Name
%t Category ID
%T Category Name
%c Channel ID
%C Channel Name
%p Channel Position
%d Current Date

Example: -o "Exports/%G/%C.html"