wa-bot-template
v1.0.1
Published
Template bot whatsapp use @whiskeysockets/baileys
Downloads
7
Readme
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();