A migration utility that replays DiscordChatExporter JSON history into a Discord channel/thread using webhooks.
- Sends messages with original username/avatar via webhook identity override.
- Adds date separator banners every N days.
- Simulates replies by quoting referenced messages.
- Simulates reactions in a footer line.
- Appends attachment URLs to message content.
- Handles webhook rate limits (
429) with retry logic. - Supports checkpoint/resume so reruns avoid duplicate sends.
- Logs non-retryable send failures to a file.
- Supports dry-run mode.
python -m venv .venv
source .venv/bin/activate
pip install requests emojiSet configuration through environment variables (recommended):
export JSON_FILE="general.json"
export WEBHOOK_URL="https://discord.com/api/webhooks/..."
export THREAD_ID="" # optional
export DAYS_BETWEEN_DATES="7" # optional
export SLEEP_SECONDS="1.5" # optional
export CHECKPOINT_FILE=".migration_checkpoint.json"
export ERROR_LOG_FILE=".migration_errors.log"
export DRY_RUN="false" # true = no network calls
python discord_migration.py- Do not commit live webhook URLs.
- Treat webhook URL as a secret credential.
- Rotate webhook immediately if exposed.