Skip to content

Latest commit

Β 

History

7 Commits

Folders and files

NameName
Last commit message
Last commit date
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ€– WhatsApp Bot V2

Advanced WhatsApp Bot with modular architecture, built with Node.js and whatsapp-web.js.

✨ Features

  • πŸ”§ Modular command system
  • πŸ“Š Built-in dashboard
  • ⚑ Rate limiting
  • πŸ”„ Auto-restart functionality
  • πŸ‘₯ Group management
  • 🎯 Role-based permissions
  • πŸ“± Multi-device support
  • πŸš€ Cloud deployment ready

πŸš€ Quick Deploy to Render

Option 1: One-Click Deploy

Deploy to Render

Option 2: Manual Setup

  1. Run the deployment script:

    # On Windows
    ./deploy.bat
    
    # On Linux/Mac
    chmod +x deploy.sh
    ./deploy.sh
  2. Follow the script instructions to push to GitHub

  3. Connect your GitHub repository to Render

πŸ“‹ Local Development

Prerequisites

  • Node.js 16+
  • npm or yarn
  • Git

Installation

# Clone the repository
git clone https://github.com/YOUR_USERNAME/whatsapp-bot.git
cd whatsapp-bot

# Install dependencies
npm install

# Configure the bot
cp config.json config.local.json
# Edit config.local.json with your settings

# Start the bot
npm start

βš™οΈ Configuration

Basic Settings

{
  "bot": {
    "name": "WhatsApp Bot",
    "prefix": "!",
    "version": "2.0.0"
  },
  "adminBot": [
    "YOUR_PHONE_NUMBER@c.us"
  ]
}

Environment Variables (Production)

NODE_ENV=production
PORT=10000
BOT_PREFIX=!
DASHBOARD_ENABLED=true

πŸ”§ Commands

Basic Commands

  • !help - Show available commands
  • !prefix - Show current prefix
  • !ping - Check bot responsiveness

Admin Commands

  • !restart - Restart the bot
  • !eval <code> - Execute JavaScript code
  • !cmd <command> - Execute system commands

πŸ“Š Dashboard

Access the web dashboard at:

  • Local: http://localhost:3000
  • Production: https://your-app-name.onrender.com

🌐 Deployment

Render (Recommended)

  1. Fork this repository
  2. Connect to Render
  3. Configure environment variables
  4. Deploy!

Heroku

# Install Heroku CLI
heroku create your-app-name
git push heroku main

VPS/Cloud Server

# Using PM2
npm install -g pm2
pm2 start ecosystem.config.js
pm2 save
pm2 startup

πŸ” Security

  • Never commit sensitive data
  • Use environment variables for production
  • Implement rate limiting
  • Validate all inputs
  • Keep dependencies updated

πŸ› οΈ Development

Project Structure

whatsapp-bot/
β”œβ”€β”€ commands/          # Bot commands
β”œβ”€β”€ events/           # Event handlers
β”œβ”€β”€ scripts/          # Helper scripts
β”œβ”€β”€ data/            # Bot data storage
β”œβ”€β”€ logs/            # Log files
β”œβ”€β”€ config.json      # Configuration
└── index.js         # Main bot file

Adding Commands

  1. Create a new file in commands/
  2. Export command configuration
  3. Implement onStart function
  4. Restart bot to load

Adding Events

  1. Create a new file in events/
  2. Export event configuration
  3. Implement event handlers
  4. Restart bot to load

πŸ“š API Reference

Command Structure

module.exports = {
  config: {
    name: "commandname",
    role: 0, // 0: User, 1: Admin, 2: Owner
    shortDescription: "Command description",
    longDescription: "Detailed description",
    category: "category",
    guide: "Usage guide",
    coolDown: 5
  },
  onStart: async ({ message, args, client }) => {
    // Command logic here
  }
};

Event Structure

module.exports = {
  config: {
    name: "eventname",
    version: "1.0.0",
    description: "Event description"
  },
  execute: async (client, ...args) => {
    // Event logic here
  }
};

πŸ”„ Updates

Automatic Updates

The bot checks for updates automatically. To update:

git pull origin main
npm install
npm restart

Manual Updates

  1. Download latest version
  2. Backup your config
  3. Replace files
  4. Restore config
  5. Restart bot

πŸ› Troubleshooting

Common Issues

  1. QR Code not appearing: Check logs for errors
  2. Commands not working: Verify prefix and permissions
  3. Bot not responding: Check WhatsApp Web connection
  4. Memory issues: Restart bot or upgrade hosting

Debug Mode

NODE_ENV=development npm start

πŸ“ž Support

  • Documentation: Check the deployment guide
  • Issues: Report on GitHub Issues
  • Community: Join our Discord/Telegram group

πŸ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.

🀝 Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Submit a pull request

⭐ Star History

If you find this project useful, please consider giving it a star!

πŸ™ Acknowledgments


Made with ❀️ by Rahaman Leon

Happy Botting! πŸ€–

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages