-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconnect.js
62 lines (58 loc) · 2.46 KB
/
connect.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
/*
HAI NAMAKU ZAINUDIN ANGGARA
YAH DISINI AKU SEBAGAI PEMULA MAU MENCOBA MEMBUAT BOT KU SENDIRI
YANG PASTINYA BANYAK COPY PASTE
OKE TERIMA KASIH
*/
const { WAConnection, MessageType } = require("@adiwajshing/baileys")
const qrcode = require("qrcode-terminal")
const figlet = require('figlet')
const fs = require('fs')
const { color } = require('../lib/color')
const udin = new WAConnection()
exports.udin = udin
exports.connect = async() => {
let authofile = './zainudin.json'
udin.version = [2, 2140, 12]
udin.browserDescription = [ 'XZN', 'Firefox', '3.0' ]
udin.logger.level = 'warn'
console.log(color(figlet.textSync('XZN SENPAI', {
font: 'Standard',
horizontalLayout: 'default',
vertivalLayout: 'default',
width: 80,
whitespaceBreak: false
}), 'cyan'))
console.log(color('[ ITS ME ZAINUDIN]'))
udin.on('qr', qr => {
qrcode.generate(qr, { small: true })
console.log(color('[UDIN]', 'yellow'), color('Scan Qr'))
})
udin.on('credentials-updated', () => {
fs.writeFileSync(authofile, JSON.stringify(udin.base64EncodedAuthInfo(), null, '\t'))
console.log(color('Wait....'))
})
fs.existsSync(authofile) && udin.loadAuthInfo(authofile)
console.log(color(`[ • BOT Creator By XZNSENPAI • ]` ,'cyan'))
console.log(color(`< ================================================== >`, 'cyan'))
console.log(color(`[•]`, 'aqua'), color(`Nama : ZAINUDIN ANGGARA`, 'white'))
console.log(color(`[•]`, 'aqua'), color(`Bot Version : 0.0.1`, 'white'))
console.log(color(`[•]`, 'aqua'), color(`Status : Online!`, 'white'))
console.log(color(`[•]`, 'aqua'), color(`Owner : XZN`, 'white'))
console.log(color(`< ================================================== >`, 'cyan'))
udin.on('connecting', () => {
console.log(color('[Connecting]', 'aqua'), color('Menghubungkan Whatsapp'))
})
udin.on('open', () => {
console.log(color('[Connec]', 'aqua'), color('Terhubung Mhehehe'))
})
await udin.connect({timeoutMs: 30*1000})
fs.writeFileSync(authofile, JSON.stringify(udin.base64EncodedAuthInfo(), null, '\t'))
/*console.log(color(' ===================================================='))
console.log(color('│ + IG : Its_me_xzn','yellow'))
console.log(color('│ + WA : 082256080304','green'))
console.log(color(' ===================================================='))
console.log(color('Its_me_xzn'))*/
udin.sendMessage("[email protected]" , "BOT TELAH AKTIF\n\nXᴢɴ々Bᴏᴛ" , MessageType.text)
return udin
}