-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathindex.js
More file actions
45 lines (34 loc) · 1010 Bytes
/
Copy pathindex.js
File metadata and controls
45 lines (34 loc) · 1010 Bytes
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
35
36
37
38
39
40
41
42
43
const { Client, Buttons, LocalAuth } = require('whatsapp-web.js');
const { menu, reponseMenu } = require("./ai/menu")
const client = new Client({
authStrategy: new LocalAuth()
});
const qrcode = require('qrcode-terminal');
const { getCategories } = require('./controller');
const { produitsNew } = require('./ai/produits');
const { reponseCategorie } = require('./ai/categorie');
client.on('qr', qr => {
qrcode.generate(qr, { small: true });
});
client.on('ready', () => {
console.log('Client is ready!');
});
client.on('message', async msg => {
if (msg.body === '!test') {
produitsNew({ client, msg })
}
if (msg.body.toLowerCase().includes('tu as une copine')) {
msg.reply("Oui elle s'appelle Charité, je l'aime trop ❤️");
}
if (msg.hasQuotedMsg) {
//reponse
console.log('Réponse')
reponseMenu({ msg, client })
reponseCategorie({ msg, client })
} else {
//demande
console.log('Demande')
menu({ msg, client })
}
});
client.initialize();