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 can automatically commit and push daily digests to a GitHub repository, providing version control, backup, and easy sharing of your team’s activity summaries.

Overview

When GitHub integration is enabled, the bot:
  1. Clones your repository on first run (bot.py:429-454)
  2. Pulls latest changes before each digest (bot.py:407-427)
  3. Commits each new digest with a descriptive message (bot.py:526-532)
  4. Pushes to the main branch automatically (bot.py:540-545)
GitHub integration is optional. Without it, digests are only saved locally.

Prerequisites

1

Create a GitHub repository

Create a new repository to store your digests:
  1. Go to github.com/new
  2. Choose a repository name (e.g., team-discord-digests)
  3. Set to Private (recommended for team data)
  4. Important: Initialize with a README or make an initial commit
  5. Click “Create repository”
The bot expects the repository to already exist with at least one commit on the main branch. It will not create the repository for you.
2

Generate a Personal Access Token

Create a token with repository access:
  1. Go to GitHub Settings → Developer settings → Personal access tokens → Tokens (classic)
  2. Click “Generate new token (classic)”
  3. Configure the token:
    • Note: Discord Bot Digest Sync
    • Expiration: Choose based on your security policy
    • Scopes: Select repo (Full control of private repositories)
  4. Click “Generate token”
  5. Copy the token immediately - you won’t be able to see it again
The token must have repo scope to clone private repositories and push commits.
3

Configure environment variables

Add to your .env file:
GITHUB_REPO_URL=https://github.com/username/team-discord-digests.git
GITHUB_TOKEN=ghp_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Replace:
  • username with your GitHub username or organization
  • team-discord-digests with your repository name
  • ghp_xxx with your actual token

Configuration

GITHUB_REPO_URL
string
Full HTTPS URL to your GitHub repository.Format:
https://github.com/{owner}/{repo}.git
Examples:
# Personal repository
GITHUB_REPO_URL=https://github.com/johndoe/discord-digests.git

# Organization repository
GITHUB_REPO_URL=https://github.com/acme-corp/team-digests.git
Must use HTTPS URL (starting with https://), not SSH URL (starting with git@).
GITHUB_TOKEN
string
Personal Access Token for authentication.Format: ghp_ followed by 36 alphanumeric charactersSecurity best practices:
  • Never commit this token to version control
  • Use a token with minimal required permissions (repo scope only)
  • Set an expiration date and rotate tokens regularly
  • Use different tokens for different bots/services
GITHUB_TOKEN=ghp_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

How It Works

First Run: Repository Clone

When the bot runs for the first time with GitHub configured, it clones your repository (bot.py:429-494):
# The bot constructs an authenticated URL
auth_url = config.github_repo_url.replace(
    "https://",
    f"https://{config.github_token}@"
)
# Result: https://TOKEN@github.com/user/repo.git

# Clone the repository
subprocess.run(["git", "clone", auth_url, output_path])
What happens:
  1. Bot checks if .git directory exists
  2. If not, creates output directory (e.g., /app/data/Daily Digests)
  3. Clones repository into that directory
  4. Logs: "Git repo cloned successfully"
Fallback behavior: If the directory already has files, the bot tries an alternative initialization:
git init
git remote add origin <auth_url>
git fetch
git checkout -b main origin/main

Subsequent Runs: Pull Latest Changes

Before creating each digest, the bot pulls updates (bot.py:407-427):
# Fetch latest changes
subprocess.run(["git", "-C", output_path, "fetch"])

# Merge into current branch
subprocess.run(["git", "-C", output_path, "merge", "origin/main"])
Why this matters: If you manually edit digests in GitHub’s web interface or from another location, the bot will pull those changes before adding new commits.

Commit and Push: Saving Digests

After generating a digest, the bot commits and pushes (bot.py:497-552):
# Configure git identity
git config user.name "Discord Bot"
git config user.email "bot@discord.local"

# Stage the file
git add "2026-03-04 - Team Digest.md"

# Commit with descriptive message
git commit -m "Daily digest for 2026-03-04"

# Push to remote
git push <auth_url> main
Commit metadata:
  • Author: Discord Bot <bot@discord.local>
  • Message format: Daily digest for YYYY-MM-DD
  • Branch: main

Repository Structure

Your GitHub repository will be organized like this:
your-repo/
├── .git/
├── README.md
├── 2026-03-04 - Team Digest.md
├── 2026-03-03 - Team Digest.md
├── 2026-03-02 - Team Digest.md
├── 2026-03-01 - Team Digest.md
└── ...
File naming: YYYY-MM-DD - Team Digest.md (bot.py:387) Directory name: Daily Digests (configurable via config.digests_dir)

Example Digest File

Each digest is a fully-formatted Markdown file with frontmatter:
2026-03-04 - Team Digest.md
---
date: 2026-03-04
type: daily-digest
tags: [team, standup, daily]
contributors: 5
messages: 42
channels: 3
---

# Team Digest - 2026-03-04

**📊 Activity Summary**
- 42 messages across 3 channels
- 5 active team members
- Time range: Last 24 hours

---

## Individual Updates

**Alice** worked on:
- Implemented user authentication flow
- Fixed bug in password reset

**Bob** completed:
- Database migration for new schema
- Performance optimization on queries

## Blockers & Challenges

**Charlie** mentioned:
- Waiting on API access from vendor
- Need design review for new dashboard

---

**🔗 Links**
- [[2026-03-03 - Team Digest|← Previous Day]]
- [[2026-03-05 - Team Digest|Next Day →]]

---
*Auto-generated at 12:00 AM ET from Discord*
Features:
  • YAML frontmatter for metadata
  • Structured sections (Updates, Blockers, Decisions, etc.)
  • Activity statistics
  • Obsidian-style wiki links to previous/next days
  • Timestamp of generation

Git Configuration

The bot automatically configures git with these settings (bot.py:506-516):
git config user.name "Discord Bot"
git config user.email "bot@discord.local"
Why these values?
  • Identifies commits as bot-generated
  • Prevents conflicts with your personal git config
  • No GitHub account required for this email
Customization: To change these values, edit git_commit_and_push() function in bot.py:
subprocess.run(
    ["git", "-C", output_path, "config", "user.name", "Your Team Bot"],
    check=True
)
subprocess.run(
    ["git", "-C", output_path, "config", "user.email", "bot@yourteam.com"],
    check=True
)

Troubleshooting

Authentication Fails

Error: fatal: Authentication failed for 'https://github.com/...' Causes:
  1. Invalid or expired token
  2. Token lacks repo scope
  3. Token hasn’t been copied correctly (missing characters)
Solutions:
# Test your token manually
curl -H "Authorization: token ghp_xxx" https://api.github.com/user

# Should return your GitHub user info
Regenerate token if needed:
  1. Go to GitHub tokens page
  2. Delete old token
  3. Create new token with repo scope
  4. Update .env file
  5. Restart bot

Repository Not Found

Error: fatal: repository 'https://github.com/...' not found Causes:
  1. Repository doesn’t exist
  2. URL is misspelled
  3. Token doesn’t have access to private repository
Solutions:
# Verify repository exists
curl https://github.com/username/repo

# Check token has access
curl -H "Authorization: token ghp_xxx" https://api.github.com/repos/username/repo

Push Rejected

Error: error: failed to push some refs to 'https://github.com/...' Causes:
  1. Remote has commits that local doesn’t have
  2. Branch protection rules prevent push
Solutions:
# Check bot's git status
docker exec discord-bot git -C /app/data/Daily\ Digests status

# Pull latest changes
docker exec discord-bot git -C /app/data/Daily\ Digests pull origin main

# Restart bot to retry
docker restart discord-bot

Clone Fails (Directory Not Empty)

Error: fatal: destination path '...' already exists and is not an empty directory Solution: The bot has fallback logic (bot.py:460-494), but if it still fails:
# Remove existing directory
rm -rf ./data/Daily\ Digests

# Restart bot to re-clone
docker restart discord-bot

Git Not Installed

Error: git: command not found Solution: This should never happen with the provided Dockerfile (includes git installation), but if you’re running without Docker:
# Ubuntu/Debian
sudo apt-get update && sudo apt-get install -y git

# macOS
brew install git

# Alpine Linux (if using different base image)
apk add --no-cache git

Viewing Digests on GitHub

Web Interface

Navigate to your repository: https://github.com/username/repo GitHub will render Markdown files beautifully:
  • Click any YYYY-MM-DD - Team Digest.md file
  • View formatted content with headings, lists, and links
  • See commit history for each file

Commit History

View all digest commits:
https://github.com/username/repo/commits/main
Each commit shows:
  • Date: When the digest was created
  • Message: Daily digest for YYYY-MM-DD
  • Author: Discord Bot
  • Files changed: 1 file (the digest)

Clone Locally

Clone the repository to view digests offline:
git clone https://github.com/username/team-discord-digests.git
cd team-discord-digests

# View all digests
ls -lh *.md

# Read a specific digest
cat 2026-03-04\ -\ Team\ Digest.md

Advanced: Multiple Bots

If you run multiple Discord bots for different servers, you can:

Option 1: Different Repositories

Each bot pushes to its own repository:
# Bot 1 (.env)
GITHUB_REPO_URL=https://github.com/myorg/team-a-digests.git
GITHUB_TOKEN=ghp_xxx

# Bot 2 (.env)
GITHUB_REPO_URL=https://github.com/myorg/team-b-digests.git
GITHUB_TOKEN=ghp_yyy

Option 2: Different Branches

All bots push to the same repository but different branches: Limitation: Current implementation hardcodes main branch (bot.py:486, 541). You’d need to modify the code:
# bot.py - make branch configurable
branch_name = os.getenv("GITHUB_BRANCH", "main")

# In init_git_repo()
subprocess.run(
    ["git", "checkout", "-b", branch_name, f"origin/{branch_name}"]
)

# In git_commit_and_push()
subprocess.run(
    ["git", "-C", output_path, "push", auth_url, branch_name]
)
Then in .env:
GITHUB_BRANCH=team-a

Option 3: Subdirectories

Customize digests_dir to organize by team:
# bot.py
digests_dir: str = "Daily Digests/Team A"  # or from env var
your-repo/
├── Daily Digests/
│   ├── Team A/
│   │   ├── 2026-03-04 - Team Digest.md
│   │   └── ...
│   └── Team B/
│       ├── 2026-03-04 - Team Digest.md
│       └── ...

Best Practices

Create a separate repository just for digests rather than mixing with code. This makes it easier to share access with team leads without exposing source code.
Discord conversations may contain sensitive information. Always use a private repository unless your team explicitly approves public sharing.
Set token expiration to 90 days and create calendar reminders to rotate before expiry.
Explain what the repository contains and how digests are generated:
# Team Discord Digests

This repository contains automatically generated daily summaries of our Discord server activity.

## How it works
- Bot runs at midnight ET every day
- Analyzes last 24 hours of messages
- Uses Claude AI to extract key updates, blockers, and decisions
- Commits digest as Markdown file

## Viewing digests
Click any `YYYY-MM-DD - Team Digest.md` file to view that day's summary.
Give team leads and managers Read access to the repository so they can review digests without being in Discord.
Each digest is ~2-10 KB. At 365 days/year:
  • 1 year: ~1-4 MB
  • 5 years: ~5-20 MB
Repository will stay small and fast indefinitely.

Integration with Other Tools

Obsidian

The digests are formatted for Obsidian with:
  • YAML frontmatter
  • Wiki-style internal links
  • Daily note structure
Setup:
# Clone your digest repo into Obsidian vault
cd ~/ObsidianVault
git clone https://github.com/username/team-digests.git "Team Digests"

# Pull daily to get latest digests
cd "Team Digests" && git pull

Notion

Import digests to Notion:
  1. Use Notion’s “Import” feature
  2. Select “Markdown & CSV”
  3. Upload digest files
  4. Notion will preserve formatting and frontmatter

Slack/Email Notifications

Use GitHub Actions to notify on new commits:
.github/workflows/notify.yml
name: Notify on Digest
on:
  push:
    paths:
      - '*.md'

jobs:
  notify:
    runs-on: ubuntu-latest
    steps:
      - name: Send Slack notification
        uses: slackapi/slack-github-action@v1
        with:
          webhook: ${{ secrets.SLACK_WEBHOOK }}
          message: "New team digest available: ${{ github.event.head_commit.message }}"

Disabling GitHub Integration

To disable GitHub sync:
  1. Remove from .env:
    #GITHUB_REPO_URL=
    #GITHUB_TOKEN=
    
  2. Or set to empty:
    GITHUB_REPO_URL=
    GITHUB_TOKEN=
    
  3. Restart bot:
    docker restart discord-bot
    
Digests will still be saved locally to /app/digests/ but won’t be pushed to GitHub. Bot logs will show:
GitHub not configured, skipping push

Build docs developers (and LLMs) love