Giter Club home page Giter Club logo

whatsapp_client's Introduction

Whatsapp client

Lightweight library to make application or bot for whatsapp without selenium

Docs

Just Read on wiki or read library native on Baileys

install

npm install whatsapp_client

Quick-Start

var { Whatsapp } = require("whatsapp_client");
var wa = new Whatsapp();
wa.on("update", async function (update, update_origin) {
    if (typeof update == "object") {
        if (typeof update["message"] == "object") {
            var msg = update["message"];
            var chat_id = msg["chat_id"];
            var text = msg["text"] ?? "";
            var is_outgoing = msg["is_outgoing"];
            if (text) {
                if (RegExp("^/start$", "i").exec(text)) {
                    var data = {
                        "chat_id": chat_id,
                        "text": `Hay perkenalkan saya adalah bot`,
                        "reply_markup": {
                            "inline_keyboard": [
                                [
                                    {
                                        "text": "GITHUB",
                                        "url": "https://github.com/azkadev"
                                    }
                                ],
                                [
                                    {
                                        "text": "callback",
                                        "callback_data": "https://github.com/azkadev"
                                    },
                                    {
                                        "text": "callback",
                                        "callback_data": "https://github.com/azkadev"
                                    }
                                ]
                            ]
                        }
                    };
                    return await wa.request("sendMessage", data);
                }
                
                if (RegExp("^/photo$", "i").exec(text)) {
                    var data = {
                        "chat_id": chat_id,
                        "photo": `https://user-images.githubusercontent.com/38845275/128774296-40a55843-1893-44e6-936e-5e71c7cf72de.png`,
                        "caption": "ini pesan photo"
                    };
                    return await wa.request("sendPhoto", data);
                }

                if (RegExp("^/jsondumpraw$", "i").exec(text)) {
                    return await wa.request("sendMessage", {
                        "chat_id": chat_id,
                        "text": JSON.stringify(update_origin, null, 2)
                    });
                }

                if (RegExp("^/jsondump$", "i").exec(text)) {
                    return await wa.request("sendMessage", {
                        "chat_id": chat_id,
                        "text": JSON.stringify(update, null, 2)
                    });
                }

                if (RegExp("^/ping$", "i").exec(text)) {
                    var time = (Date.now() / 1000) - msg.date;
                    var data = {
                        "chat_id": chat_id,
                        "text": `Pong ${time.toFixed(3)}`
                    };
                    return await wa.request("sendMessage", data);
                }
            }
            if (!is_outgoing) {
                var data = {
                    "chat_id": chat_id,
                    "text": `Hay perkenalkan saya adalah bot\nTolong gunakan perintah /start ya!`,
                };
                return await wa.request("sendMessage", data);
            }
        }
    }
});

Demo

simplescreenrecorder-201-12-24_12.28.52-2022-02-06_21.56.29.mp4

Feature

  1. Multi device ( without phone active internet)

tutor

https://youtu.be/XEDuynClElM

whatsapp_client's People

Contributors

azkadev avatar

Forkers

baronrustamov

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.