-
-
Notifications
You must be signed in to change notification settings - Fork 2
/
qr.js
50 lines (42 loc) · 1.81 KB
/
qr.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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
const chalk = require('chalk');
const {WAConnection, MessageOptions, MessageType} = require('@adiwajshing/baileys');
const {StringSession} = require('./stella/');
const fs = require('fs');
async function whatsAsena () {
const conn = new WAConnection();
const Session = new StringSession();
conn.version = [3, 3234, 9]
conn.logger.level = 'warn';
conn.regenerateQRIntervalMs = 50000;
conn.on('connecting', async () => {
console.log(`${chalk.green.bold('Whats')}${chalk.blue.bold('Asena')}
${chalk.white.italic('AsenaString Kodu Alıcı')}
${chalk.blue.italic('ℹ️ Connecting to Whatsapp... Please Wait.')}`);
});
conn.on('open', async () => {
var st = Session.createStringSession(conn.base64EncodedAuthInfo());
console.log(
chalk.green.bold('Asena String Kodunuz: '), Session.createStringSession(conn.base64EncodedAuthInfo())
);
if (!fs.existsSync('config.env')) {
fs.writeFileSync('config.env', `STELLA_STRING="${st}"`);
}
if (conn.user.jid.startsWith('90')) {
await conn.sendMessage(conn.user.jid,st, MessageType.text)
await conn.sendMessage(conn.user.jid,'*Bu Kodu Kimseyle Paylaşmayın!*', MessageType.text)
console.log(
chalk.blue.bold('Locale kuruyorsanız node bot.js ile botu başlatabilirsiniz.')
);
}
else {
await conn.sendMessage(conn.user.jid,st, MessageType.text)
await conn.sendMessage(conn.user.jid,'*Do Not Share This Code With Anyone!*', MessageType.text)
console.log(
chalk.blue.bold('If you are installing locale, you can start the bot with node bot.js')
);
}
process.exit(0);
});
await conn.connect();
}
whatsAsena()