Statsify, an making use of easy tracking of Spotify statistics straight through Discord
A powerful Discord bot that integrates with Spotify to provide user statistics and music insights. Built with JDA and featuring a secure API system.
To test out Statsify, be sure to invite him to your server by clicking here
⭐ If your a fan of this repository or have used it or any of it's code, please consider leaving us a star. It would be greatly appreciated and allows us to see if users value the bot! ⭐
- Features
- Prerequisites
- Configuration
- Local Development
- Deployment
- API Usage
- Bot Commands
- Security
- Contributing
- Troubleshooting
- Support
- License
- Acknowledgments
-
🎵 Spotify Integration
- User authentication via OAuth2
- Fetch user statistics and profile information
- Secure data handling
-
🤖 Bot Commands
/spotify
- View your Spotify statistics- Modern slash command support
- Intuitive command handling
-
🔒 Secure API
- Protected endpoints with API key authentication
- Rate limiting and error handling
- CORS support for web integration
- Java 17 or higher
- Maven
- Discord Bot Token
- Spotify Developer Account
- Railway Account (for deployment)
-
Discord Setup
- Create a new application at Discord Developer Portal
- Create a bot and copy the token
- Enable necessary intents (Presence, Server Members, Message Content)
-
Spotify Setup
- Create a new app at Spotify Developer Dashboard
- Add
https://your-railway-app.up.railway.app/callback
to Redirect URIs - Copy Client ID and Client Secret
-
Environment Variables Create a
.env
file in the root directory:BOT_TOKEN=your_discord_bot_token SPOTIFY_CLIENT_ID=your_spotify_client_id SPOTIFY_CLIENT_SECRET=your_spotify_client_secret SPOTIFY_REDIRECT_URI=https://your-railway-app.up.railway.app/callback API_KEY=your_secure_api_key
-
Clone and Build
git clone https://github.com/Kkkermit/statsify.git cd statsify mvn clean package
-
Run Locally
java -jar target/bot.jar
-
Railway Setup
- Create new project in Railway
- Connect your GitHub repository
- Add environment variables from your
.env
file
-
Deploy
railway up
The bot provides a REST API for accessing Spotify statistics:
# Get user stats
curl -H "X-API-Key: your_api_key" \
"https://your-railway-app.up.railway.app/api/stats?userId=discord_user_id"
- Spotify Stats
/spotify
- Shows your Spotify profile information
- Displays follower count and profile URL
- Requires one-time authorization
- API endpoints are protected with an API key
- OAuth2 flow for Spotify authentication
- Secure environment variable handling
- CORS protection
- Fork the repository
- Create a feature branch
- Commit your changes
- Push to the branch
- Open a Pull Request
- Bot Not Responding: Check Discord token and intents
- Spotify Auth Failed: Verify redirect URI in Spotify Dashboard
- API 401 Error: Ensure API key is properly set
- Railway Deploy Failed: Check environment variables
This project is licensed under the MIT License - see the LICENSE file for details.
For issues and feature requests, please open an issue.
- JDA (Java Discord API)
- Spotify Web API Java
- SparkJava
- Railway for hosting