Quick Starts
๐ก
Please note: That whatscode.js functions code runs from the ground up. Need help? Join our Discord at: https://discord.gg/CzqHbx7rdU
Install the library
First of all, install whatscode.js library:
# Install via npmnpm install whatscode.js# or install it from Github for more new features, some bug fixes, and mybe theres some bugs too.npm i github:JastinXyz/whatscode.js
Make your first simple bot
Create your first bot using whatscode.js with just a few lines:
const { Client } = require("whatscode.js");const bot = new Client({ name: "Your bot name", prefix: "Your bot prefix",});// required callbackbot.onConnectionUpdate(); // connection updatebot.onCredsUpdate(); // credentials updatebot.onMessage(); // message update// example ping commandbot.command({ name: "ping", code: `๐ | $ping ms`});
Callbacks
Callbacks can be used to run events, sort of logging and the like. There are several callbacks that are needed when creating a bot with whatscode.js. But there are still some other callbacks that you can use.
// here are examples of callbacks for user join and user leave.// it can be used like Welcomer or Goodbye.// callbackbot.onUserJoin()bot.onUserLeave()// code breakdown is in the docs...// This command will run when someone joins the groupbot.userJoinCommand({ groupJid: '123@g.us', code: `hello {user}, welcome to {group}`})// This will run when a user leaves the group.bot.userLeaveCommand({ groupJid: '123@g.us', code: `goodbye {user} from {group}`})
Variables
Variables can be used to store data, you can also use this for like system economics, leveling and others.
bot.variables({ name: "value", name2: "value2"})