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.

Overview

The AI digest feature uses Anthropic’s Claude to analyze Discord conversations and generate structured summaries. This transforms raw message exports into actionable insights for team managers, highlighting individual updates, blockers, decisions, and action items.

How Digest Generation Works

The digest pipeline follows these steps:
  1. Export messages from Discord channels
  2. Filter bot messages to focus on human conversations
  3. Prepare transcript in a format Claude can analyze
  4. Send to Claude API with structured prompt
  5. Format output as Obsidian markdown document

Core Digest Function

The generate_daily_digest function orchestrates the Claude API interaction:
async def generate_daily_digest(export_data: dict, config: Config) -> Optional[str]:
    """Use Claude to generate structured daily digest."""
    if not config.anthropic_api_key:
        logger.error("ANTHROPIC_API_KEY not set")
        return None

    transcript = prepare_transcript(export_data)

    try:
        client = get_anthropic_client(config.anthropic_api_key)

        prompt = f"""Analyze this Discord transcript from the last 24 hours and create a structured daily digest for a team manager.

Focus on extracting:

1. **Individual Updates** - What each team member worked on, completed, or made progress on
2. **Upcoming Work** - What team members mentioned they're planning to work on next
3. **Blockers & Challenges** - Any obstacles, issues, or requests for help
4. **Key Decisions & Ideas** - Important discussions, decisions made, or ideas that shouldn't be lost
5. **Action Items** - Specific TODOs or follow-ups mentioned

Be concise but don't lose important technical details. Organize by person where possible.
If there's very little activity, just note that briefly.

Transcript:
{transcript}
"""

        message = client.messages.create(
            model=config.digest_model,
            max_tokens=config.digest_max_tokens,
            messages=[{"role": "user", "content": prompt}]
        )

        return message.content[0].text

    except Exception as e:
        logger.error(f"Error calling Claude API: {e}")
        return None
Error handling:
  • Returns None if API key is missing
  • Catches and logs all exceptions
  • Gracefully fails without crashing the bot

Transcript Preparation

The prepare_transcript function converts export data into a clean, readable format for Claude:
def prepare_transcript(export_data: dict) -> str:
    """Prepare transcript for Claude analysis from export data."""
    channel_summaries = []

    for channel_name, channel_data in export_data["channels"].items():
        non_bot_messages = filter_bot_messages(channel_data["messages"])
        if not non_bot_messages:
            continue

        messages_text = "\n".join([
            f"[{msg['timestamp'][:19]}] {msg['author']['display_name']}: {msg['content_clean']}"
            for msg in non_bot_messages
        ])

        channel_summaries.append(f"## Channel: #{channel_name}\n{messages_text}\n")

    return "\n".join(channel_summaries) if channel_summaries else "No messages to analyze."
Transcript format example:
## Channel: #general
[2026-03-04T09:15:30] John Doe: Finished the authentication refactor, pushing to PR
[2026-03-04T09:17:45] Jane Smith: Great! I'll review it this afternoon
[2026-03-04T10:23:12] John Doe: Thanks! Also starting work on the API rate limiting

## Channel: #engineering
[2026-03-04T11:30:00] Mike Johnson: Hitting an issue with the database migration
[2026-03-04T11:32:15] Sarah Lee: What's the error message?
[2026-03-04T11:35:45] Mike Johnson: Foreign key constraint failing on user_id
Key features:
  • Uses content_clean which has mentions resolved (see Message Export)
  • Truncates timestamps to YYYY-MM-DDTHH:MM:SS format for readability
  • Groups by channel with markdown headers
  • Skips channels with no human messages

Bot Message Filtering

The bot filters out automated messages to focus Claude’s analysis on human conversations:
def filter_bot_messages(messages: list) -> list:
    """Filter out messages from bots."""
    return [m for m in messages if not m["author"]["bot"]]
Why filter bots:
  • Reduces noise from automated notifications
  • Focuses on actual team discussions
  • Saves Claude API tokens
  • Improves digest relevance
What gets filtered:
  • GitHub notifications
  • CI/CD status updates
  • Other bot announcements
What remains:
  • All human messages
  • Team discussions
  • Questions and answers
  • Status updates and blockers

Claude API Configuration

The bot uses specific Claude settings optimized for digest generation:
# From Config class in bot.py:31-32
digest_model: str = "claude-haiku-4-5-20251001"
digest_max_tokens: int = 4096
Model choice: Claude Haiku
  • Fast response times (typically 2-5 seconds)
  • Cost-effective for daily automated tasks
  • Sufficient intelligence for summarization
  • 200k token context window
Max tokens: 4096
  • Allows comprehensive digests (typically 1000-1500 words)
  • Handles large servers with many channels
  • Balances detail vs. conciseness

API Client Initialization

def get_anthropic_client(api_key: str) -> anthropic.Anthropic:
    """Get or create Anthropic client (reusable)."""
    return anthropic.Anthropic(api_key=api_key)

The Claude Prompt

The prompt is carefully crafted to extract specific information types:
prompt = f"""Analyze this Discord transcript from the last 24 hours and create a structured daily digest for a team manager.

Focus on extracting:

1. **Individual Updates** - What each team member worked on, completed, or made progress on
2. **Upcoming Work** - What team members mentioned they're planning to work on next
3. **Blockers & Challenges** - Any obstacles, issues, or requests for help
4. **Key Decisions & Ideas** - Important discussions, decisions made, or ideas that shouldn't be lost
5. **Action Items** - Specific TODOs or follow-ups mentioned

Be concise but don't lose important technical details. Organize by person where possible.
If there's very little activity, just note that briefly.

Transcript:
{transcript}
"""
Prompt design principles:
  • Numbered sections guide Claude to structure output consistently
  • “Team manager” audience ensures appropriate detail level
  • “Organize by person” creates actionable, attributable summaries
  • “Don’t lose technical details” preserves important context
  • “If very little activity” handles low-volume days gracefully

Digest Structure and Sections

Claude typically generates digests with these sections:

1. Individual Updates

**John Doe**
- Completed authentication refactor (PR #234)
- Fixed database migration issue with foreign key constraints
- Deployed staging environment updates

**Jane Smith**
- Code review on authentication PR
- Started work on API documentation
- Updated test coverage to 85%

2. Upcoming Work

- John: Starting API rate limiting implementation
- Sarah: Planning to tackle the search optimization
- Mike: Will address the mobile responsive issues

3. Blockers & Challenges

- Mike blocked on database migration foreign key issue (resolved by Sarah)
- Team needs decision on which logging framework to use
- Waiting on design mockups for new dashboard

4. Key Decisions & Ideas

- Decided to use PostgreSQL instead of MySQL for better JSON support
- Idea: Implement feature flags for gradual rollout
- Agreement to move to weekly deploys instead of daily

5. Action Items

- [ ] John to create documentation for new API endpoints
- [ ] Sarah to schedule architecture review meeting
- [ ] Team to review and vote on logging framework by Friday

Example Digest Output

Here’s what Claude typically generates:
## Individual Updates

**John Doe**
- Completed the authentication refactor and pushed to PR #234
- Fixed the database migration foreign key constraint issue
- Starting work on API rate limiting implementation

**Jane Smith**
- Reviewed authentication PR, left comments on error handling
- Updated API documentation with new endpoints
- Increased test coverage from 72% to 85%

**Mike Johnson**
- Worked through database migration issues (resolved with Sarah's help)
- Fixed mobile responsive issues on dashboard
- Deployed updates to staging environment

## Upcoming Work

- John: API rate limiting and throttling implementation
- Sarah: Search optimization and indexing improvements
- Mike: Dashboard redesign based on new mockups

## Blockers & Challenges

- Migration foreign key constraint (resolved)
- Waiting on design team for dashboard mockups
- Need to decide on logging framework (discussion ongoing)

## Key Decisions & Ideas

- **Decided**: Moving from MySQL to PostgreSQL for better JSON support
- **Idea**: Implement feature flags for gradual feature rollout
- **Agreement**: Shift to weekly deployment cadence

## Action Items

- [ ] John to document new API endpoints
- [ ] Sarah to schedule architecture review
- [ ] Team to vote on logging framework by Friday
- [ ] Mike to follow up with design team on mockups

Usage Examples

Manual Digest Generation

# In Discord
!digest          # Last 24 hours
!digest 48       # Last 48 hours
!digest 168      # Last week
Bot response:
✅ Daily Digest Generated

## Individual Updates

**John Doe**
- Completed the authentication refactor and pushed to PR #234
- Fixed the database migration foreign key constraint issue...

[truncated preview]

📁 Full digest: `Daily Digests/2026-03-04 - Team Digest.md`

Automatic Daily Digests

The bot automatically generates digests at midnight Eastern Time:
@tasks.loop(hours=24)
async def daily_digest_task():
    """Automatically generate daily digest at scheduled time."""
    logger.info("Running scheduled daily digest")

    result = await run_digest_pipeline(bot, config, config.default_hours)

    if result["success"]:
        logger.info("✅ Daily digest completed successfully")
    else:
        logger.error(f"Daily digest failed: {result.get('error', 'Unknown error')}")
See Obsidian Integration for details on how digests are formatted and saved.

API Costs

Claude Haiku pricing (as of 2024):
  • Input: $0.25 per million tokens
  • Output: $1.25 per million tokens
Typical digest costs:
  • Small team (10 messages/day): ~$0.001-0.002 per digest
  • Medium team (100 messages/day): ~$0.005-0.010 per digest
  • Large team (500 messages/day): ~$0.020-0.040 per digest
Monthly costs for daily digests:
  • Small team: ~$0.03-0.06/month
  • Medium team: ~$0.15-0.30/month
  • Large team: ~$0.60-1.20/month

Performance

Typical response times:
  • Small transcript (< 5k tokens): 2-3 seconds
  • Medium transcript (5-15k tokens): 4-7 seconds
  • Large transcript (15-50k tokens): 8-15 seconds
Rate limits:
  • Claude Haiku: 10,000 requests per minute (tier 1)
  • Bot typically makes 1 request per day (scheduled) + manual requests
  • No risk of hitting rate limits in normal usage