starter-zaileys is a robust and ready-to-use template for building WhatsApp automation bots using the Zaileys library. It comes pre-configured with essential features, best practices, and a modular structure to help you kickstart your project immediately.
- Node.js: Version 20 or higher.
- npm or pnpm: Package manager.
-
Clone the repository:
git clone https://github.com/zeative/starter-zaileys.git cd starter-zaileys -
Install dependencies:
npm install # or pnpm install
Run the bot in development mode with hot-reloading:
npm run devStart the bot in production mode:
npm startHere's a quick look at how to initialize the client and handle messages:
import { Client } from "zaileys";
const wa = new Client({
authType: "qr",
fakeReply: {
provider: "chatgpt",
},
});
// Middleware to prevent spam
wa.use(async (ctx, next) => {
if (ctx.messages.isSpam) {
return await wa.send(ctx.messages.roomId, "Don't spam!");
}
await next();
});
// Handle incoming messages
wa.on("messages", async (ctx) => {
if (ctx.text === ".ping") {
await wa.send(ctx.roomId, "Pong!");
}
});If you encounter any problems or have feature requests, please open an issue
- Buy me coffee ☕
- Ko-Fi
- Trakteer
- ⭐ Star the repo on GitHub
Distributed under the MIT License. See LICENSE for details.