- Rust 99.2%
- Nix 0.8%
| Filename | Latest commit message | Latest commit date |
|---|---|---|
|
All checks were successful
ci / nix-ci (push) Successful in 3m55s
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]> |
||
| .forgejo/workflows | ||
| src | ||
| .gitignore | ||
| Cargo.lock | ||
| Cargo.toml | ||
| flake.lock | ||
| flake.nix | ||
| LICENSE | ||
| README.md | ||
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 = truemakes 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.