127 lines
3.0 KiB
Markdown

# Discord TLDR Bot (Standalone)
A standalone Discord bot that automatically summarizes server conversations and posts digests to a dedicated channel.
## Features
- 📋 Automatic scheduled summaries (configurable times)
- 🤖 AI-powered summarization (Claude or GPT)
- 📊 Channel-by-channel breakdown
- ⚡ Manual trigger via `!tldr` command
- 🐳 Docker-ready for easy deployment
- 🔒 Respects channel permissions
## Quick Start
### 1. Create a Discord Bot
1. Go to [Discord Developer Portal](https://discord.com/developers/applications)
2. Create a new application
3. Go to Bot → Add Bot
4. Enable these Privileged Intents:
- Message Content Intent
- Server Members Intent (optional)
5. Copy the bot token
### 2. Invite the Bot
Generate an invite URL with these permissions:
- Read Messages/View Channels
- Send Messages
- Read Message History
```
https://discord.com/api/oauth2/authorize?client_id=YOUR_CLIENT_ID&permissions=68608&scope=bot
```
### 3. Configure Environment
```bash
cp .env.example .env
# Edit .env with your values
```
### 4. Run
**Direct:**
```bash
pip install -r requirements.txt
python discord_tldr.py
```
**Docker:**
```bash
docker build -t discord-tldr .
docker run --env-file .env discord-tldr
```
**Docker Compose:**
```yaml
version: '3.8'
services:
tldr:
build: .
env_file: .env
restart: unless-stopped
```
## Commands
| Command | Description |
|---------|-------------|
| `!tldr` | Generate summary now (uses default lookback) |
| `!tldr 24` | Generate summary for last 24 hours |
| `!tldr-status` | Check bot status and schedule |
## Configuration
| Variable | Default | Description |
|----------|---------|-------------|
| `DISCORD_TOKEN` | required | Bot token |
| `DISCORD_GUILD_ID` | required | Server ID |
| `DISCORD_TLDR_CHANNEL_ID` | required | Channel for summaries |
| `LLM_PROVIDER` | `anthropic` | `anthropic` or `openai` |
| `ANTHROPIC_API_KEY` | - | Claude API key |
| `OPENAI_API_KEY` | - | GPT API key |
| `SUMMARY_HOURS` | `6,13,22` | Hours to post (24h format) |
| `LOOKBACK_HOURS` | `8` | Hours to look back |
| `EXCLUDE_CHANNELS` | - | Channel IDs to skip |
## Example Output
```
📋 **TLDR Summary** (Jan 25, 2026 - 6:00 AM)
Quick catch-up: Active discussions about the new API launch and some
spirited debate about code review practices.
**#general**
• Team welcomed new member @sarah
• Discussion about Q1 roadmap priorities
• Decided to postpone the demo to next week
**#dev**
• Merged the authentication refactor (PR #142)
• Debugging session for the webhook timeout issue
• @jake will investigate the memory leak
**#random**
• Friday lunch plans: Thai food won the vote
• Shared some quality memes about merge conflicts
**Action Items:**
- @jake: Investigate memory leak by EOD Monday
- @team: Review roadmap doc before Wednesday standup
```
## Hosting Options
- **VPS**: Any cheap VPS (DigitalOcean, Linode, Vultr)
- **Railway/Render**: Easy container deployment
- **Home server**: Run in Docker with auto-restart
- **Raspberry Pi**: Works great for small servers
## License
MIT