- Deleted final.md, fix_async_fixtures.py, fix_cog_tests.py, fix_fixture_scoping.py, and run_race_condition_tests.sh as they are no longer needed. - Updated main.py to enhance logging and error handling. - Refactored various components for improved performance and maintainability. - Introduced new logging utilities for better context and performance monitoring. - Ensured all datetime operations are timezone-aware and consistent across the codebase.
Disbord - Discord Voice Chat Quote Bot
An advanced AI-powered Discord bot that continuously records, analyzes, and curates memorable quotes from voice channel conversations using persistent 120-second audio clips.
Features
Core Functionality
- Continuous Voice Recording: Records 120-second rolling audio clips from voice channels
- AI-Powered Quote Analysis: Uses multiple AI providers to analyze and score quotes
- Speaker Recognition: Identifies and tracks speakers across conversations
- Smart Response Scheduling: Delivers quotes at optimal times (real-time, 6-hour rotation, daily summaries)
- Privacy-First Design: GDPR compliant with user consent management
Advanced Capabilities
- Multi-Provider AI Support: OpenAI, Anthropic, Groq, OpenRouter, Ollama, LMStudio
- Laughter Detection: Enhances quote scoring based on audience reactions
- Memory Management: Long-term conversation context and speaker profiles
- Plugin System: Extensible architecture with AI voice chat, personality engine, and research agents
- Performance Monitoring: Comprehensive metrics and health monitoring
Architecture
core/ # Core system managers
ai_manager.py # AI provider orchestration
memory_manager.py # Long-term context storage
consent_manager.py # Privacy and consent handling
database.py # Database management
services/ # Processing services
audio/ # Audio processing pipeline
quotes/ # Quote analysis and scoring
automation/ # Response scheduling
interaction/ # User feedback systems
monitoring/ # Health and metrics
plugins/ # Extensible plugins
ai_voice_chat/ # Voice interaction plugin
personality_engine/ # Dynamic personality system
research_agent/ # Information research plugin
config/ # Configuration and templates
Installation
Prerequisites
- Python 3.12+
- PostgreSQL database
- Redis (for caching)
- Qdrant (for vector storage)
- Discord Bot Token
Quick Start
-
Clone the repository
git clone <repository-url> cd disbord -
Set up virtual environment
make venv source .venv/bin/activate -
Install dependencies
make install -
Configure environment
cp .env.example .env # Edit .env with your API keys and configuration -
Set up database
make migrate -
Run the bot
make run
Docker Deployment
# Build and run with Docker
make docker-build
make docker-run
# Or use docker-compose
docker-compose up -d
Configuration
Required Environment Variables
# Discord
DISCORD_TOKEN=your_discord_bot_token
GUILD_ID=your_test_server_id # Optional for development
# Database
DATABASE_URL=postgresql://user:password@localhost:5432/quotes_db
REDIS_URL=redis://localhost:6379
QDRANT_URL=http://localhost:6333
# AI Providers (at least one required)
OPENAI_API_KEY=your_openai_key
ANTHROPIC_API_KEY=your_anthropic_key
GROQ_API_KEY=your_groq_key
# Optional Services
ELEVENLABS_API_KEY=your_elevenlabs_key # For TTS
AZURE_SPEECH_KEY=your_azure_key # For speaker recognition
Quote Scoring Configuration
The bot uses a sophisticated scoring system with configurable thresholds:
# Score thresholds (0-10 scale)
QUOTE_THRESHOLD_REALTIME=8.5 # Immediate responses
QUOTE_THRESHOLD_ROTATION=6.0 # 6-hour summaries
QUOTE_THRESHOLD_DAILY=3.0 # Daily compilations
# Scoring weights (0-1 scale)
SCORING_WEIGHT_FUNNY=0.3 # Humor detection
SCORING_WEIGHT_DARK=0.15 # Dark humor
SCORING_WEIGHT_SILLY=0.2 # Silly content
SCORING_WEIGHT_SUSPICIOUS=0.1 # Context awareness
SCORING_WEIGHT_ASININE=0.25 # Absurd content
Usage
Basic Commands
/start_recording- Begin recording in current voice channel/stop_recording- Stop recording/consent manage- Manage privacy settings/quote search <query>- Search historical quotes/stats- View bot statistics
Voice Channel Behavior
- Bot joins voice channels when invited
- Records 120-second rolling clips continuously
- Processes audio for transcription and speaker identification
- Analyzes quotes using AI providers
- Responds based on scoring thresholds:
- Real-time: High-quality quotes (8.5+) trigger immediate responses
- Rotation: Good quotes (6.0+) included in 6-hour summaries
- Daily: All notable quotes (3.0+) in daily compilations
Development
Development Setup
# Install development dependencies
make install
# Run in development mode with auto-reload
make run-dev
# Run tests
make test
# Code quality checks
make pre-commit
Testing
# Run all tests
make test
# Specific test types
make test-unit # Fast unit tests
make test-integration # Integration tests
make test-performance # Performance benchmarks
make test-coverage # Coverage report
Code Quality
# Format code
make format
# Lint checks
make lint
# Type checking
make type-check
# Security scan
make security
Deployment
Production Deployment
-
Environment Setup
# Production configuration cp docker-compose.production.yml docker-compose.yml -
Database Migration
make migrate -
Container Deployment
docker-compose up -d -
Health Monitoring
make health # Check system status make metrics # View performance metrics
Kubernetes Deployment
# Apply Kubernetes manifests
kubectl apply -f k8s/deployment.yaml
Monitoring & Maintenance
Health Checks
The bot exposes health endpoints at:
http://localhost:8080/health- System health statushttp://localhost:8080/metrics- Prometheus metrics
Logs
make logs # Follow all logs
make logs-error # Error logs only
Database Management
make migrate-create # Create new migration
make migrate # Apply migrations
make migrate-rollback # Rollback last migration
make db-reset # Reset database (CAUTION)
Privacy & Compliance
- GDPR Compliant: Built-in consent management and data retention policies
- User Control: Users can opt-out, delete data, and manage privacy settings
- Secure Storage: Encrypted data storage and automatic audio file cleanup
- Audit Logging: Comprehensive logging for compliance requirements
Contributing
- Fork the repository
- Create a feature branch:
git checkout -b feature/amazing-feature - Run tests:
make test - Run pre-commit checks:
make pre-commit - Commit changes:
git commit -m 'Add amazing feature' - Push to branch:
git push origin feature/amazing-feature - Open a Pull Request
License
This project is licensed under the MIT License - see the LICENSE file for details.
Support
For support, please:
- Check the documentation
- Search existing issues
- Create a new issue with detailed information
Acknowledgments
- Discord.py community for the excellent library
- AI providers for powerful language models
- Contributors and beta testers
Note: This bot processes voice conversations and uses AI services. Ensure compliance with your organization's privacy policies and local regulations before deployment.
Description
Languages
Python
99.1%
Shell
0.6%
Dockerfile
0.2%
Makefile
0.1%