Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/trustlessmatt/discord-exporter-bot/llms.txt

Use this file to discover all available pages before exploring further.

The Discord Exporter Bot is configured entirely through environment variables. Create a .env file in your project root based on .env.example.

Required Variables

These variables must be set for the bot to function.
DISCORD_TOKEN
string
required
Your Discord bot token for authentication.Where to get it:
  1. Go to the Discord Developer Portal
  2. Create a new application or select an existing one
  3. Navigate to the “Bot” section
  4. Click “Reset Token” to generate a new token
  5. Copy the token immediately (it won’t be shown again)
Security Note: Never commit this token to version control or share it publicly.
DISCORD_TOKEN=MTIzNDU2Nzg5MDEyMzQ1Njc4OQ.GhIjKl.MnOpQrStUvWxYzAbCdEfGhIjKlMnOpQrStUvWxYz
GUILD_ID
integer
required
The Discord server (guild) ID where the bot will operate.Where to get it:
  1. Enable Developer Mode in Discord (User Settings → Advanced → Developer Mode)
  2. Right-click on your server icon
  3. Select “Copy Server ID”
The bot will only export messages from this specific server.
GUILD_ID=123456789012345678

Optional Variables

These variables enable additional features but are not required for basic export functionality.
ANTHROPIC_API_KEY
string
Anthropic API key for Claude AI-powered digest generation.What it enables:
  • The !digest command for AI-generated summaries
  • Automatic daily digest generation at midnight ET
  • Smart analysis of team conversations, extracting updates, blockers, and action items
Where to get it:
  1. Sign up at Anthropic Console
  2. Navigate to API Keys
  3. Create a new API key
Model used: claude-haiku-4-5-20251001 (configured in bot.py:31)Token limit: 4096 tokens per digest (configured in bot.py:32)
ANTHROPIC_API_KEY=sk-ant-api03-...
Without this key, only the !export command will work. The !digest command will fail with “ANTHROPIC_API_KEY not set” (bot.py:290).
DOKPLOY_VOLUME_PATH
string
Path to a Dokploy volume mount for persistent digest storage.What it enables:
  • Saves daily digests to a persistent volume that survives container restarts
  • Useful for Dokploy deployments where local storage is ephemeral
How it works: The bot checks if this path exists at runtime (bot.py:334-338). If found, digests are saved to {DOKPLOY_VOLUME_PATH}/Daily Digests/. If not found, falls back to local ./Daily Digests/ directory.
DOKPLOY_VOLUME_PATH=/mnt/data
Directory structure:
/mnt/data/
└── Daily Digests/
    ├── 2026-03-04 - Team Digest.md
    ├── 2026-03-03 - Team Digest.md
    └── ...
GITHUB_REPO_URL
string
GitHub repository URL for automatic digest backup and version control.What it enables:
  • Automatic git commits and pushes after each digest is generated
  • Version history of all team digests
  • Easy sharing and access to digest archive
Format:
GITHUB_REPO_URL=https://github.com/username/team-digests.git
Requirements:
  • Must be used with GITHUB_TOKEN
  • Repository must already exist (bot doesn’t create repos)
  • Bot will clone the repo on first run (bot.py:429-454)
  • On subsequent runs, bot pulls latest changes before committing (bot.py:407-427)
If you set GITHUB_REPO_URL without GITHUB_TOKEN, the bot will log warnings and skip GitHub sync (bot.py:500).
GITHUB_TOKEN
string
GitHub Personal Access Token (PAT) for repository authentication.What it enables:
  • Authenticates bot to push commits to your digest repository
  • Required for GITHUB_REPO_URL to work
Where to get it:
  1. Go to GitHub Settings → Developer settings → Personal access tokens → Tokens (classic)
  2. Click “Generate new token (classic)”
  3. Give it a descriptive name (e.g., “Discord Bot Digest Sync”)
  4. Set expiration (or “No expiration” for convenience)
  5. Select scopes:
    • repo (Full control of private repositories)
  6. Click “Generate token” and copy it immediately
GITHUB_TOKEN=ghp_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
How it’s used: The bot constructs authenticated URLs by inserting the token (bot.py:435-438, 535-538):
# Converts https://github.com/user/repo.git
# Into https://TOKEN@github.com/user/repo.git
Security Note: This token grants access to your repositories. Never commit it to version control.

Configuration Object

The bot loads these environment variables into a Config dataclass (bot.py:21-61) with additional defaults:
@dataclass
class Config:
    # From environment
    discord_token: str
    guild_id: int
    anthropic_api_key: Optional[str] = None
    dokploy_volume_path: Optional[str] = None
    github_repo_url: Optional[str] = None
    github_token: Optional[str] = None
    
    # Built-in defaults
    eastern_tz: ZoneInfo = "America/New_York"  # Auto-handles DST
    digest_model: str = "claude-haiku-4-5-20251001"
    digest_max_tokens: int = 4096
    default_hours: int = 24
    min_hours: int = 1
    max_hours: int = 720  # 30 days
    exports_dir: str = "exports"
    digests_dir: str = "Daily Digests"
    digest_preview_length: int = 1500
    scheduled_hour: int = 0  # 12am ET

Example Configuration

DISCORD_TOKEN=MTIzNDU2Nzg5MDEyMzQ1Njc4OQ.GhIjKl.MnOpQrStUvWxYzAbCdEfGhIjKlMnOpQrStUvWxYz
GUILD_ID=123456789012345678
ANTHROPIC_API_KEY=
DOKPLOY_VOLUME_PATH=
GITHUB_REPO_URL=
GITHUB_TOKEN=

Validation

The bot validates required variables on startup (bot.py:49-52):
if not token:
    raise ValueError("DISCORD_TOKEN not found in .env file")
if not guild_id:
    raise ValueError("GUILD_ID not found in .env file")
If either required variable is missing, the bot will crash with a clear error message.

Feature Matrix

FeatureRequired VariablesOptional Variables
Message Export (!export)DISCORD_TOKEN, GUILD_ID-
AI Digests (!digest)DISCORD_TOKEN, GUILD_ID, ANTHROPIC_API_KEY-
Scheduled Daily DigestsDISCORD_TOKEN, GUILD_ID, ANTHROPIC_API_KEY-
Persistent StorageDISCORD_TOKEN, GUILD_IDDOKPLOY_VOLUME_PATH
GitHub BackupDISCORD_TOKEN, GUILD_IDGITHUB_REPO_URL, GITHUB_TOKEN
Full StackDISCORD_TOKEN, GUILD_ID, ANTHROPIC_API_KEYDOKPLOY_VOLUME_PATH, GITHUB_REPO_URL, GITHUB_TOKEN

Build docs developers (and LLMs) love