rust cli + tui to download discord chats
  • Rust 99.2%
  • Nix 0.8%
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
Neel Sani 5fdca3f620
All checks were successful
ci / nix-ci (push) Successful in 3m55s
Skip threads when searching for threads
A thread cannot have threads of its own, but update searched every
tracked entry, threads included. With a user token each search is rate
limited to about one per 5 s, so a folder tracking 287 threads and 43
channels spent about 85% of thread discovery on empty searches.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-13 18:36:17 +00:00
.forgejo/workflows Add CI workflow 2026-10-03 06:05:17 +00:00
src Skip threads when searching for threads 2026-10-13 18:36:17 +00:00
.gitignore Ignore the exports folder 2026-10-03 03:55:40 +00:00
Cargo.lock Add discord-dl: Discord channel exporter with TUI and top-off 2026-10-03 03:35:47 +00:00
Cargo.toml Add MIT license 2026-10-03 05:54:03 +00:00
flake.lock Add discord-dl: Discord channel exporter with TUI and top-off 2026-10-03 03:35:47 +00:00
flake.nix Add discord-dl: Discord channel exporter with TUI and top-off 2026-10-03 03:35:47 +00:00
LICENSE Add MIT license 2026-10-03 05:54:03 +00:00
README.md README: use placeholder server in config example 2026-10-03 05:54:37 +00:00

discord-dl

Downloads Discord channel history as JSON and keeps it up to date. The output format is the same as DiscordChatExporter's JSON export, so existing DCE exports can be updated with it.

Building

nix build
./result/bin/discord-dl --help

nix develop gives a shell with cargo and friends.

Token

Set DISCORD_TOKEN in the environment or in a .env file in the directory you run it from. User and bot tokens both work.

Usage

Running discord-dl with no arguments opens a picker: choose a server, select channels with space, press enter to download. Each server gets its own folder under ./exports.

discord-dl                          # interactive picker
discord-dl update                   # update everything under ./exports
discord-dl export -c <channel id>   # export channels (category ids work too)
discord-dl export -g <server id>    # export a whole server
discord-dl attachments              # download missing attachments
discord-dl guilds                   # list servers
discord-dl channels -g <server id>  # list channels

Use -o <dir> to write somewhere other than ./exports.

If a channel already has an export in the folder, only messages newer than the last one in the file are downloaded and appended to it.

Config

Each export folder has a discord-dl.toml, created on the first export:

guild = "123456789012345678"
guild_name = "My Server"
timezone = "America/New_York"
parallel = 1
markdown = true
reaction_users = true
include_threads = "none"
attachments = false

[[channel]]
id = "234567890123456789"
guild = "123456789012345678"
name = "My Server / general / chat"

update downloads new messages for every [[channel]] listed there. Command line flags override the config values. discord-dl init <dir> creates a config for a folder of existing exports.

Notes

  • Timestamps are written in the folder's timezone. If you are updating exports made on another machine, set it to the time zone they were made in.
  • reaction_users = true makes one request per reaction to list who reacted. It is the slowest part of a download; turn it off if you only need the counts.
  • Attachments are saved as attachments/<channel id>/<attachment id>-<file name>. They are downloaded from the links in the export without using the token. Those links expire about a day after the export, so turn attachments on when exporting if you want the files.
  • Downloading with a user token is against Discord's terms of service.

The emoji tables in src/data come from DiscordChatExporter (MIT).

License

MIT, see LICENSE.