A powerful and modern open-source community WhatsApp bot built with @whiskeysockets/baileys v6.7.9+ featuring clean architecture, modular plugins, and production-ready deployment options.
- π Auto-Reconnection - Intelligent reconnection with exponential backoff
- π§© Modular Plugins - Easy-to-add plugin system with auto-loading
- ποΈ Database Support - SQLite for development, PostgreSQL for production
- π€ AI Integration - ChatGPT, Google Gemini support
- π€ AI Auto-Responder - Gemini-powered automatic responses with context awareness
- ποΈ Auto Status Viewer - Automatically view and react to WhatsApp statuses
- π₯ Media Downloads - YouTube, Instagram, TikTok, and more
- π₯ Group Management - Complete admin tools for groups
- π¨ Media Processing - Stickers, image editing, and more
- π Permission System - Sudo users, admin-only commands
- π Production Ready - PM2, Docker, Heroku support
- β‘ CPU Optimized - ~70-80% CPU reduction with caching and parallel processing
- Node.js: v20.0.0 or higher
- FFmpeg: For media processing
- PostgreSQL: For production (optional, SQLite by default)
git clone https://github.com/Starland9/OpenWhatsappBot
cd OpenWhatsappBotyarn installCreate a config.env file:
cp config.env.example config.envEdit config.env with your settings:
SESSION_ID=
PREFIX=.
SUDO=your_number_here
OPENAI_API_KEY=your_openai_key
GEMINI_API_KEY=your_gemini_keyyarn startScan the QR code with WhatsApp to authenticate.
.ping- Check bot latency.help- Display all commands.alive- Show bot status
.gpt <query>- Chat with ChatGPT.gemini <query>- Chat with Google Gemini
.tag <text>- Tag all members.kick @user- Remove member (admin only).promote @user- Promote to admin (admin only).demote @user- Demote from admin (admin only)
.sticker- Create sticker from image/video (reply to media).qr <text>- Generate QR code
.ytdl <url>- Download YouTube video.yta <url>- Download YouTube audio
open-whatsapp-bot/
βββ config.js # Configuration management
βββ index.js # Entry point
βββ ecosystem.config.js # PM2 configuration
βββ lib/
β βββ baileys/
β β βββ client.js # WhatsApp client
β βββ classes/
β β βββ Message.js # Message abstraction
β βββ plugins/
β β βββ loader.js # Plugin loader
β β βββ registry.js # Command registry
β βββ database/
β βββ index.js # Database initialization
β βββ models/ # Sequelize models
β βββ User.js
β βββ Group.js
β βββ Filter.js
β βββ Warn.js
βββ plugins/ # Plugin files
βββ ping.js
βββ help.js
βββ chatgpt.js
βββ ...
Create a new file in /plugins directory:
module.exports = {
command: {
pattern: 'mycommand', // Command pattern
desc: 'My command description', // Description
type: 'general', // Category
fromMe: false, // Sudo only
onlyGroup: false, // Group only
onlyPm: false // PM only
},
async execute(message, args) {
// Your command logic
await message.reply('Hello!')
}
}// Reply to message
await message.reply('Text')
// Send media
await message.sendImage(buffer, 'caption')
await message.sendVideo(buffer, 'caption')
await message.sendSticker(buffer)
await message.sendAudio(buffer)
// React to message
await message.react('β
')
// Delete message
await message.delete()
// Download media
const buffer = await message.downloadMedia()
// Group operations
await message.kick(['jid1', 'jid2'])
await message.promote(['jid1'])
await message.demote(['jid1'])
// Check permissions
message.isSudo()
await message.isBotAdmin()
await message.isSenderAdmin()
// Get group info
const metadata = await message.getGroupMetadata()Automatically view and/or react to WhatsApp statuses with random emojis.
Configuration:
AUTO_STATUS_VIEW=true # Auto-view statuses
AUTO_STATUS_REACT=false # Auto-react to statuses
STATUS_EMOJIS=π,π,β€οΈ,π₯,π―,β¨,π,π,πͺ,πFeatures:
AUTO_STATUS_VIEW: Automatically mark statuses as viewedAUTO_STATUS_REACT: Automatically react to statuses with random emojis from the configured list- Both features can be enabled independently
- Prevents duplicate reactions with smart tracking
Intelligent auto-responder that uses Google Gemini AI with conversation context management.
Configuration:
AUTO_RESPONDER_ENABLED=true
AUTO_RESPONDER_IGNORE_NUMBERS=1234567890,0987654321
AUTO_RESPONDER_PERSONALITY=You are a helpful and friendly assistant.
GEMINI_API_KEY=your_gemini_api_keyCommands:
.ar status- View current settings.ar on/off- Enable/disable auto-responder.ar ignore add <number>- Add number to ignore list.ar ignore remove <number>- Remove number from ignore list.ar ignore list- Show ignored numbers.ar ignore clear- Clear ignore list.ar personality <text>- Set AI personality
Features:
- Context-aware conversations (remembers last 10 messages)
- 30-minute context timeout
- Customizable AI personality
- Ignore list management
- Private messages only
- Typing indicator
See AUTO_RESPONDER_GUIDE.md for detailed documentation.
For panel-based hosting platforms like bot-hosting.net:
# Clone and install
git clone https://github.com/Starland9/OpenWhatsappBot .
yarn install
# Configure
cp config.env.example config.env
# Edit config.env with PANEL_ENABLED=true
# Start with panel server
node panel.jsThe panel.js file provides:
- π₯ Health check endpoint (
/health) - π Metrics endpoint (
/metrics) - π Keep-alive ping mechanism
- π Status page accessible via browser
See Bot-Hosting Guide for detailed instructions.
pm2 start ecosystem.config.js
pm2 logs open-whatsapp-bot
pm2 stop open-whatsapp-botdocker build -t open-whatsapp-bot .
docker run -d --env-file config.env open-whatsapp-botheroku create your-app-name
heroku addons:create heroku-postgresql:mini
git push heroku mainDeploy using the web UI or CLI with the provided app.json.
# Install Node.js 20
curl -fsSL https://deb.nodesource.com/setup_20.x | sudo -E bash -
sudo apt install nodejs ffmpeg -y
# Install Yarn and PM2
npm install -g yarn pm2
# Clone and setup
git clone https://github.com/Starland9/OpenWhatsappBot
cd OpenWhatsappBot
yarn install
# Configure
cp config.env.example config.env
nano config.env
# Start with PM2
pm2 start ecosystem.config.js
pm2 save
pm2 startup| Variable | Description | Default |
|---|---|---|
SESSION_ID |
Session authentication data | - |
PREFIX |
Command prefix | . |
SUDO |
Sudo user numbers (comma-separated) | - |
ALWAYS_ONLINE |
Keep bot always online | false |
AUTO_READ |
Auto-read messages | true |
AUTO_STATUS_VIEW |
Auto-view statuses | true |
AUTO_STATUS_REACT |
Auto-react to statuses | false |
OPENAI_API_KEY |
OpenAI API key for ChatGPT | - |
GEMINI_API_KEY |
Google Gemini API key | - |
DATABASE_URL |
PostgreSQL URL (optional) | SQLite |
LOG_LEVEL |
Logging level | info |
See config.env.example for all available options.
The bot has been extensively optimized for low CPU and memory usage:
- Smart Caching: Database settings cached with 5-minute TTL
- Parallel Processing: Messages and plugins processed in parallel
- Memory Management: Automatic cleanup of old cached data
- Database Optimization: Connection pooling and indexed queries
- Batch Operations: Conversation updates batched every 2 seconds
| Metric | Improvement |
|---|---|
| CPU Usage | ~70-80% reduction |
| Memory Usage | ~40-50% reduction |
| Startup Time | 40% faster |
| Message Latency | 70% faster |
| DB Queries | 90% reduction |
For detailed optimization information, see CPU_OPTIMIZATION_GUIDE.md.
Monitor bot performance with PM2:
# Real-time monitoring
pm2 monit
# View detailed stats
pm2 show open-whatsapp-bot
# Check logs
pm2 logs --lines 100The bot uses Sequelize ORM with support for:
- SQLite (default) - For development and small deployments
- PostgreSQL - For production deployments
Models:
User- User data and AFK statusGroup- Group settings (antilink, mute, welcome)Filter- Auto-reply filtersWarn- Warning system
- No obfuscated code - fully transparent and auditable
- Official Baileys library - no custom forks
- Environment-based configuration - no hardcoded secrets
- Permission system - sudo and admin controls
- Input validation - sanitized user inputs
Contributions are welcome! Please:
- Fork the repository
- Create a feature branch
- Write clean, documented code
- Test thoroughly
- Submit a pull request
MIT License - see LICENSE file
- WhiskeySockets/Baileys - WhatsApp Web API
- lyfe00011 - Original inspiration
- Issues: GitHub Issues
- Discussions: GitHub Discussions
Note: This is an unofficial WhatsApp bot. Use responsibly and in accordance with WhatsApp's Terms of Service.