Big News: Socket raises $60M Series C at a $1B valuation to secure software supply chains for AI-driven development.Announcement
Sign In

wa-bot-template

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

wa-bot-template

Template bot whatsapp use @whiskeysockets/baileys

latest
npmnpm
Version
1.0.1
Version published
Maintainers
1
Created
Source

About

  • see my website for guides!

  • or see example.js

  • https://alvinqid.sytes.net/pkg/wa-bot

Example

//import
const botwa = require("wa-bot-template");

//async funtion;
async function fun() {
const socket = await botwa("my-bot");

socket.ev.on("messages.upsert", async ({ messages, type }) => {
        const chat = messages[0];
        const pesan = (chat.message?.extendedTextMessage?.text ?? chat.message?.ephemeralMessage?.message?.extendedTextMessage?.text ?? chat.message?.conversation)?.toLowerCase()||"";
        const command = pesan.split(" ")[0];
        const args = pesan.split(" ").slice(1).join(" ");
        console.log(`${chat.pushName}: ${pesan}`);

        switch (command) {
          case ".ping":
            await socket.sendMessage(chat.key.remoteJid, { text: "Hello World." }, { quoted: chat })
            await socket.sendMessage(chat.key.remoteJid, { text: "Hello World2." }) //buat tanpa quoted
            break;
        }
  });
}

fun();

Keywords

bot-wa

FAQs

Package last updated on 14 Aug 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts