Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const { Client } = require('whatsapp-web.js');
- var qrcode = require('qrcode-terminal');
- const client = new Client();
- client.on('authenticated', (session) => {
- console.log('AUTHENTICATED', session);
- });
- client.on('qr', (qr) => {
- // Generate and scan this code with your phone
- console.log('QR RECEIVED', qr);
- qrcode.generate(qr, {small: true}, function (qrcode) {
- console.log(qrcode)
- });
- });
- client.on('ready', () => {
- console.log('Client is ready!');
- });
- client.on('message', msg => {
- if (msg.body == '!ping') {
- msg.reply('pong');
- }
- if (msg.body == "selamat pagi") {
- client.sendMessage(msg.from, 'selamat pagi juga');
- }
- });
- client.initialize();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement