-
Notifications
You must be signed in to change notification settings - Fork 10
/
main.js
80 lines (70 loc) · 2.61 KB
/
main.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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
//follow ya @m1n1.php5
const { WAConnection, Browsers } = require('@adiwajshing/baileys')
const { color, bgcolor } = require('./lib/color')
const fs = require("fs-extra")
const figlet = require('figlet')
const { uncache, nocache } = require('./lib/loader')
const setting = JSON.parse(fs.readFileSync('./setting.json'))
const welcome = require('./message/group')
baterai = 'unknown'
charging = 'unknown'
//nocache
require('./Arif.js')
nocache('../Arif.js', module => console.log(color('[WATCH]', 'yellow'), color(`'${module}'`, 'cyan'), 'File is updated!'))
require('./message/group.js')
nocache('../message/group.js', module => console.log(color('[WATCH]', 'yellow'), color(`'${module}'`, 'yellow'), 'File is updated!'))
const starts = async (Arif = new WAConnection()) => {
Arif.logger.level = 'warn'
console.log(color(figlet.textSync('ArifGans', {
font: 'Standard',
horizontalLayout: 'default',
vertivalLayout: 'default',
width: 80,
whitespaceBreak: false
}), 'cyan'))
console.log(color('kalo mau pake pake aja jan lupa taroh credits title', 'yellow'))
console.log(color('recode gpp asal tinggalin creator', 'yellow'))
Arif.browserDescription = ["Ershinbot", "Chrome", "3.0.0"];
// Menunggu QR
Arif.on('qr', () => {
console.log(color('[', 'pink'), color('!', 'red'), color(']', 'pink'), color('SCAN KODE NYA WAKTU 20 DETIK!'))
})
// Menghubungkan
fs.existsSync(`./${setting.sessionName}.json`) && Arif.loadAuthInfo(`./${setting.sessionName}.json`)
Arif.on('connecting', () => {
console.log(color('[ ArifGans ]', 'yellow'), color('PROSES NYAMBUNG...'));
})
//connect
Arif.on('open', () => {
console.log(color('[HC]', 'white'), color('DAH CONNECT NOH TINGGAL PAKE'));
})
// session
await Arif.connect({
timeoutMs: 30 * 1000
})
fs.writeFileSync(`./${setting.sessionName}.json`, JSON.stringify(Arif.base64EncodedAuthInfo(), null, '\t'))
// Baterai
Arif.on('CB:action,,battery', json => {
global.batteryLevelStr = json[2][0][1].value
global.batterylevel = parseInt(batteryLevelStr)
baterai = batterylevel
if (json[2][0][1].live == 'true') charging = true
if (json[2][0][1].live == 'false') charging = false
console.log(json[2][0][1])
console.log('Baterai : ' + batterylevel + '%')
})
global.batrei = global.batrei ? global.batrei : []
Arif.on('CB:action,,battery', json => {
const batteryLevelStr = json[2][0][1].value
const batterylevel = parseInt(batteryLevelStr)
global.batrei.push(batterylevel)
})
// welcome
Arif.on('group-participants-update', async (anu) => {
await welcome(Arif, anu)
})
Arif.on('chat-update', async (message) => {
require('./Arif.js')(Arif, message)
})
}
starts()