ckptw
easy way to create a Whatsapp Bot. Fork version of whatscode.js but we make it not a string-based command. We just need an package to create Whatsapp Bot with some lines of code, so we create this package.
Documentation is comming soon!
install
npm i @mengkodingan/ckptw
example
const { Client } = require("@mengkodingan/ckptw");
const bot = new Client({
name: "something",
prefix: "!",
autoRead: true,
});
bot.init().then(() => {
bot.onConnectionUpdate();
bot.onCredsUpdate();
bot.onMessage();
bot.command({
name: "ping",
code: async (ctx) => {
ctx.sendMessage(ctx.id, { text: "pong!" });
},
});
});
misc
-
Buttons
const { ButtonBuilder } = require("@mengkodingan/ckptw");
const btn = new ButtonBuilder()
.setId('id1')
.setDisplayText('button 1')
.setType(1);
ctx.sendMessage(ctx.id, { text: "buttons", buttons: [btn] });
-
Sections
const { SectionBuilder } = require("@mengkodingan/ckptw");
const a = new SectionBuilder()
.setTitle("title")
.setRows(
{ title: "abc", rowId: 1 },
{ title: "b", rowId: 2, description: "a" }
);
ctx.sendMessage(ctx.id, { text: "buttons", buttonText: 'button text', sections: [a] });
-
React
ctx.react(id, '🎈')