An intelligent Discord bot that recommends music based on your mood using natural language processing and the Spotify API. Simply tell the bot how you're feeling, and it will curate the perfect tracks to match your vibe!
- 🤖 Natural Language Processing: Understands emotions from casual conversation
- 🎵 Spotify Integration: Real-time music search and recommendations
- 🎯 Mood Detection: Recognizes 6+ emotional states (happy, sad, energetic, calm, romantic, focused)
- 💬 Rich Discord Experience: Beautiful embeds with track previews and Spotify links
- ⚡ Dual Interface: Both slash commands and natural conversation
- 🔄 Intelligent Fallback: Robust error handling with alternative search methods
- 🏗️ Extensible Architecture: Clean, modular design ready for additional platforms
# Get mood-based recommendations
!mood happy # Upbeat, energetic tracks
!mood sad # Emotional, melancholic songs
!mood energetic # Workout and pump-up music
!mood calm # Chill, relaxing vibes
# Search for specific tracks
!search bohemian rhapsody queen
# Get help
!help"I'm feeling really sad today"
"Need some energetic music for my workout"
"Looking for something romantic"
"I want to focus and study"
🎯 Happy Vibes for You!
Clean, Production-Ready Design:
- Modular Bot System: Extensible base classes for multiple platforms
- Intelligent Mood Mapping: NLP-powered emotion detection
- Robust Error Handling: Graceful degradation with fallback systems
- Async/Await Pattern: High-performance Discord.py implementation
- Environment-Based Config: Secure API key management
- Python 3.8+
- Discord Developer Account
- Spotify Developer Account
-
Clone the repository
git clone https://github.com/yourusername/music-mood-bot.git cd music-mood-bot -
Create virtual environment
python -m venv venv # Windows venv\Scripts\activate # Linux/Mac source venv/bin/activate
-
Install dependencies
pip install -r requirements.txt
-
Set up API credentials
cp .env.template .env # Edit .env with your actual API keys (see setup guide below) -
Run the bot
python src/main.py
- Go to Discord Developer Portal
- Create a new application
- Go to "Bot" section and create a bot
- Enable "Message Content Intent" (required!)
- Copy the bot token to your
.envfile:DISCORD_BOT_TOKEN=your_discord_bot_token_here - Generate an invite link with proper permissions:
- Go to OAuth2 → URL Generator
- Select scopes:
bot,applications.commands - Select permissions: Send Messages, Embed Links, Read Message History
- Go to Spotify Developer Dashboard
- Create a new app
- Set redirect URI to:
http://localhost:8888/callback - Copy credentials to your
.envfile:SPOTIFY_CLIENT_ID=your_spotify_client_id_here SPOTIFY_CLIENT_SECRET=your_spotify_client_secret_here
music-mood-bot/
├── src/
│ ├── bot/
│ │ ├── base_bot.py # Abstract base class for bots
│ │ ├── discord_bot.py # Discord implementation
│ │ └── bot_manager.py # Multi-platform orchestrator
│ ├── spotify/
│ │ └── spotify_client.py # Spotify API integration
│ ├── config/
│ │ └── settings.py # Configuration management
│ └── main.py # Application entry point
├── requirements.txt # Python dependencies
├── .env.template # Environment variables template
├── WARP.md # Development guide
└── README.md
- Python 3.8+: Modern async/await patterns
- Discord.py 2.3.2: Advanced Discord bot framework
- Spotipy 2.23.0: Official Spotify Web API wrapper
- OpenAI API: Ready for advanced NLP features
- Mood Detection Algorithm: Maps natural language to 6 emotional states
- Intelligent Search Fallback: Switches to keyword search when recommendations fail
- Rich Discord Embeds: Professional UI with track previews and links
- Async Architecture: Non-blocking operations for optimal performance
- Multi-Platform Ready: Extensible design for Telegram, Slack, etc.
This project includes comprehensive development documentation:
- WARP.md: Complete development guide with commands and architecture
- Modular Design: Easy to extend with new features
- Error Handling: Robust fallback systems
- Logging: Comprehensive logging for debugging
Contributions are welcome! Please feel free to:
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests if applicable
- Submit a pull request
MIT License - see LICENSE for details.
- Bot Development: Discord.py with advanced features
- API Integration: RESTful APIs with proper error handling
- Natural Language Processing: Emotion detection from text
- Software Architecture: Clean, extensible, production-ready code
- Async Programming: High-performance concurrent operations
- DevOps: Environment management, configuration, deployment
Built with ❤️ to showcase modern software development practices and create something genuinely useful!
Made by [Your Name] - [Your LinkedIn] - [Your Portfolio]