Whats-app bot which tags(mentions) all the participants in a group when '@team' or '@everyone' is sent.
Installing the library from npm requires first installing node.js 12
or higher, followed by installing library from the npm package.
Installing whatsapp-web.js
:
$ npm install whatsapp-web.js
or
$ yarn add whatsapp-web.js
Installing qr-code-terminal
:
$ npm install qr-code-terminal
or
$ yarn add qr-code-terminal
Create a file called app.js
in the project and paste this code into it.
const qrcode = require("qrcode-terminal");
const { Client } = require("whatsapp-web.js");
const client = new Client();
client.initialize();
client.on("qr", (qr) => {
qrcode.generate(qr, { small: true });
});
client.on("ready", () => {
console.log("Client is ready!");
});
Then, on the terminal or command prompt, type this command.
$ node app
or
$ node app.js
When the command is executed, a QR code appears, which we will scan with the Whatsapp account we used to create the bot.
Once, installation is done, go to the group chat and send '@team' or '@everyone'.
References: https://github.com/jagadyudha/yugioh-whatsapp-bot, https://wwebjs.dev/guide/
Credits: https://github.com/jagadyudha/yugioh-whatsapp-bot