1.0.1 • Published 11 months ago
wa-bot-template v1.0.1
About
- see my website for guides!
or see example.js
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 = messages0;
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();