-
Notifications
You must be signed in to change notification settings - Fork 1
/
script.js
34 lines (25 loc) · 1.11 KB
/
script.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
const { Client, LocalAuth } = require('whatsapp-web.js')
const qrcode = require('qrcode-terminal');
const client = new Client({
authStrategy: new LocalAuth()
});
client.on('qr', (qr) => {
qrcode.generate(qr, {small: true});
});
client.on('ready', () => {
console.log('Walabi Walabom');
const number = "xxxxxxxxx"; // Change to the number will send the message when the bot goes online dont forget use your country code like +62 or +1
const text = "..."; // The Message
const chatId = number.substring(1) + "@c.us";
// Kirim Pesan.
client.sendMessage(chatId, text);
});
client.on('message', message => {
if(message.body === '!help') {
message.reply(`There's no commands available, then read the message bellow to see the *problem* \n \n Message From *Developer* :- \n \n Dear, Users.\n We couldn't add command before update 1.2.5, some problematics happens when try to send a message, please wait the next update to see the next features! \n - Regards, Developers`);
}
});
client.on('disconnected', (reason) => {
console.log('disconnect Whatsapp-bot', reason);
});
client.initialize();