A modular, performance-oriented Discord bot designed to boost productivity through task management, Pomodoro timers, and a gamified house points system. Transform your Discord server into a productivity hub with comprehensive tracking and engaging competition features.
- Personal To-Do Lists: Add, view, complete, and remove tasks
- Points Reward: Earn 2 points for each completed task
- Persistent Storage: All tasks saved to PostgreSQL database
- User-Specific: Each user maintains their own task list
- Customizable Sessions: Set custom study and break durations
- Shared Experience: One timer per voice channel for group productivity
- Smart Notifications: DM alerts for session start/end
- Automatic Cycling: Seamlessly loops between study and break periods
- Voice Chat Rewards: Earn 2 points per hour in voice channels
- House System: Users assigned to houses (Ravenclaw, Hufflepuff, etc.)
- Live Leaderboards: Real-time house standings and user statistics
- Performance Tracking: Detailed stats and time tracking
- Performance Metrics: Built-in performance monitoring and optimization
- Debug Tools: Comprehensive debugging and system information
- Usage Statistics: Track bot usage and user engagement
- Monthly Resets: Automatic point resets with historical preservation
- Node.js: v18.0.0 or higher
- PostgreSQL: v12.0 or higher
- Discord Application: Bot token and application ID
- Git: For cloning the repository
git clone https://github.com/yourusername/discord-productivity-bot.git
cd discord-productivity-botnpm installsudo apt update
sudo apt install postgresql postgresql-contrib
sudo systemctl start postgresql
sudo systemctl enable postgresqlsudo -u postgres psql
-- In PostgreSQL shell:
CREATE DATABASE botd_production;
CREATE USER botd_user WITH PASSWORD 'your_secure_password';
GRANT ALL PRIVILEGES ON DATABASE botd_production TO botd_user;
\qThe bot will automatically create required tables on first run, including:
users- User profiles and pointstasks- Personal task listsvc_sessions- Voice chat trackinghouses- House points and leaderboardstimers- Active Pomodoro sessions
- Go to Discord Developer Portal
- Click "New Application" and name your bot
- Navigate to "Bot" section
- Click "Add Bot" and copy the token
- Enable required intents:
- Presence Intent
- Server Members Intent
- Message Content Intent
- Go to "OAuth2 > URL Generator"
- Select scopes:
botandapplications.commands - Select permissions:
- Send Messages
- Use Slash Commands
- Connect to Voice Channels
- View Channels
- Read Message History
- Copy generated URL and invite bot to your server
Create a .env file in the project root:
# Discord Configuration
DISCORD_TOKEN=your_bot_token_here
CLIENT_ID=your_application_id_here
GUILD_ID=your_server_id_here
# Database Configuration
DB_HOST=localhost
DB_PORT=5432
DB_NAME=botd_production
DB_USER=botd_user
DB_PASSWORD=your_secure_password
# Optional: Performance Monitoring
ENABLE_PERFORMANCE_MONITORING=true
LOG_LEVEL=infonpm run registernpm startnpm run devAdd a new task to your personal to-do list.
/addtask Complete project documentation
Display all your current tasks with their IDs and status.
Mark a task as complete and earn 2 points.
/completetask 5
Remove a task from your list (no points awarded).
/removetask 3
Start a Pomodoro timer in the current voice channel.
/timer 25 5 # 25min study, 5min break
/timer 45 # 45min study, default 5min break
Stop the active timer in your voice channel.
Check remaining time in current Pomodoro session.
View your personal statistics:
- Total points earned
- Tasks completed
- Voice chat time
- Current house ranking
Display current house standings and total points.
Show top users by points in your house.
View bot performance metrics (admin only):
- Memory usage
- Database query times
- Active connections
- System health
Display detailed system information for troubleshooting.
discord-productivity-bot/
βββ src/
β βββ commands/ # Slash command implementations
β β βββ addtask.js
β β βββ completetask.js
β β βββ viewtasks.js
β β βββ removetask.js
β β βββ timer.js
β β βββ stoptimer.js
β β βββ time.js
β β βββ stats.js
β β βββ housepoints.js
β β βββ leaderboard.js
β β βββ performance.js
β β βββ debug.js
β βββ events/ # Discord event handlers
β β βββ voiceStateUpdate.js
β βββ models/ # Database models
β β βββ db.js
β βββ services/ # Business logic
β β βββ taskService.js
β β βββ voiceService.js
β βββ utils/ # Utility functions
β β βββ databaseOptimizer.js
β β βββ monthlyReset.js
β β βββ performanceBenchmark.js
β β βββ performanceMonitor.js
β β βββ voiceUtils.js
β βββ index.js # Main bot entry point
β βββ register-commands.js # Command registration
βββ docs/ # Documentation
βββ package.json
βββ .env.example
βββ README.md
The bot automatically assigns users to houses. To customize houses, modify the database:
-- Example house setup
INSERT INTO houses (name, total_points) VALUES
('Gryffindor', 0),
('Hufflepuff', 0),
('Ravenclaw', 0),
('Slytherin', 0);For large servers (500+ users), consider:
- Database Indexing: The bot includes automatic index creation
- Connection Pooling: Configured automatically via
pgpool - Query Optimization: Built-in query optimization utilities
- Monitoring: Enable performance monitoring in
.env
The bot includes automatic maintenance features:
- Monthly Resets: Points reset monthly with history preservation
- Database Optimization: Regular cleanup of old sessions
- Performance Monitoring: Real-time performance tracking
We welcome contributions! Please see our Contributing Guidelines for details.
- Fork the repository
- Create a feature branch:
git checkout -b feature/new-feature - Install dependencies:
npm install - Set up development environment with
.env - Make your changes and test thoroughly
- Submit a pull request
- Use ESLint configuration provided
- Follow existing code style and patterns
- Add appropriate error handling
- Include JSDoc comments for new functions
- Write tests for new features
- β Core task management
- β Pomodoro timer system
- β House points and leaderboards
- β Voice chat tracking
- β Performance monitoring
- π User profiles with detailed statistics
- π Advanced admin controls
- π Streak tracking and badges
- π Web-based dashboard
- π Advanced analytics
- Mobile companion app
- Integration with productivity tools
- Custom achievement system
- Advanced reporting features
- Check bot token in
.env - Verify bot has required permissions
- Ensure slash commands are registered
- Check console for error messages
- Verify PostgreSQL is running:
sudo systemctl status postgresql - Check database credentials in
.env - Ensure database and user exist
- Test connection:
psql -h localhost -U botd_user -d botd_production
- Verify bot has necessary Discord permissions
- Check role hierarchy in Discord server
- Ensure bot role is above users it needs to manage
- Check the Issues page
- Join our Discord Support Server
- Read the Documentation
This project is licensed under the ISC License - see the LICENSE file for details.
- discord.js - Discord API wrapper
- PostgreSQL - Database system
- Day.js - Date manipulation library
- Contributors and beta testers
| Component | Status | Version |
|---|---|---|
| Core Bot | β Stable | 1.0.0 |
| Database | β Stable | PostgreSQL 12+ |
| Commands | β Complete | 12 commands |
| Documentation | β Complete | Latest |
Last Updated: June 2025