Ismananda / open-wabot

Simple lightweight whatsapp bot made with baileys

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

-----------------------------------------------------

Open WABOT

Open WABOT is a WhatsApp bot designed to be as lightweight as possible using the Baileys module.

Install Instructions

Here are the instructions for installing Open WABOT on multiple platforms.

Arch Linux

  1. Install nodejs, npm, and git.

    sudo pacman -S nodejs npm git
  2. Clone the Open WABOT repository.

    git clone https://github.com/Ismananda/open-wabot
  3. Navigate to the open-wabot directory and run npm install.

    cd open-wabot
    npm install

Debian / Ubuntu

  1. Install curl and git.

    sudo apt-get install -y curl git
  2. Download and run the Node.js setup.

    curl -fsSL https://deb.nodesource.com/setup_20.x -o nodesource_setup.sh
    sudo -E bash nodesource_setup.sh
    sudo apt-get install -y nodejs
  3. Clone the Open WABOT repository.

    git clone https://github.com/Ismananda/open-wabot
  4. Navigate to the open-wabot directory and run npm install.

    cd open-wabot
    npm install

Configuration

For configuration, copy config-sample.js to config.js in the root directory. Then, adjust the configuration as needed.

module.exports = {
    // Debug mode configuration
    debug: false, // Set to true to enable debug mode

    // Anti-call feature configuration
    antiCall: true, // Set to true to enable anti-call feature

    // Pairing mode configuration
    usePairing: false, // Set to true to use pairing mode

    // Prefix configuration
    prefixes: ["!", ">", "$", ".", "-", "+", "?", "#", "@", "/", "&", ",", "ow!"], // Add the character you want to use as a prefix

    // Session configuration
    session: {
        type: "local",  // Options: "mongodb", "local"
        url: "mongodb://username:password@host:port/database?options" // Required for MongoDB (optional)
    },

    // Bot information
    botName: "Open WABOT", // Name of the bot
    botNumber: "6285176765422", // Phone number of the bot

    // Administrators list
    administrator: [
        "6281654976901", // Phone number of the first administrator
        "6285175023755"  // Phone number of the second administrator
    ],

    // Whitelist configuration
    whitelist: false, // Set to true to enable whitelist feature
    whitelistSrv: "http://localhost:8080/whitelist", // Servers that provide whitelists
    whitelistMsg: "You are not allowed to use this bot", // Messages to be sent to users when they are not allowed to use bots 
    whitelistUsr: [
        "6285176765422" // Phone number of the whitelisted user
    ]
};

Using MongoDB Sessions

To use MongoDB sessions, please follow these steps:

  1. Install MongoDB session driver
    Run the following command to install the MongoDB session driver:

    npm run install:mongo
  2. Configure MongoDB URL
    Add your MongoDB URL to the configuration like this:

    session: {
        type: "mongodb",
        url: "mongodb://username:password@host:port/database?options",
    },

    Example:

    session: {
        type: "mongodb",
        url: "mongodb://myUser:myPassword@localhost:27017/myDatabase?retryWrites=true&w=majority",
    },
  3. Start the bot
    Start the bot with the following command:

    npm start

Whitelist

The numbers entered into the whitelist array in the configuration file are permanent until the configuration file is changed. If you want to add a whitelist within a certain period of time, you can use the following command.

.whitelist <phone> <duration in days>

Example:

.whitelist 6285176765422 30

In the whitelist configuration, Srv can be filled with a server url that will receive and return json data as follows.

Data to be received by the server.

{
    "user": "6285176765422"
}

Data to be returned by the server.

{
    "whitelisted": true
}
{
    "whitelisted": true
}

Usage

Run the bot with the command

node controller.js

Adding Plugins

To add a plugin, please use the following format:

module.exports = {
    admin: false, // Is the plugin administrator-only
    name: 'name', // Added feature names
    alias: ['alias1', 'alias2'], // Other names of the feature can be used as alternative commands
    category: 'test', // Categories of added features
    run: async (m, plugins) => {
        // Here is your code
        m.reply(result)
    }
}

Links

WhatsApp Community Github Discussion

License

This project is licensed under the terms of the LICENSE file.

Thanks To


Ismananda

Author of open-wabot

Rusdi Greyrat

General assistant

WhiskeySockets - Baileys

Library used

Adhiraj Singh

Baileys Founder

Amirul Dev

Author of mongodb session

About

Simple lightweight whatsapp bot made with baileys

License:GNU General Public License v3.0


Languages

Language:JavaScript 100.0%