-
Notifications
You must be signed in to change notification settings - Fork 5
/
rip.js
319 lines (297 loc) · 14 KB
/
rip.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
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
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
///====================================================///
/*
⊙ BASE : SELF-BOT © 2K22
⊙ LIBRARY : BAILEYS [LATEST]
⊙ BROWSER : MICROSOFT EDGE
⊙ CREATOR : X-Arip͘⁴̅⁰͍⁴̵〆 // Jangan diubah
⊙ DEVELOPER : Zeeone OFC // Jangan diubah
⊙ THX CREATOR BOTWEA
⊙ THX PENYEDIA REST API
⊙ THX PENYEDIA MODULE
⊙ THX PENGGUNA BOTWEA
⊙ "ولا تبتعد وجهك عن الناس (بسبب الكبرياء) ولا تمش على الأرض بغرور. إِنَّ اللَّهُ لَا يُحِبُّ الْمَكْبُورِينَ ". (قس لقمان: 18)
⊙ “Artinya : Dan janganlah kamu memalingkan mukamu dari manusia (karena sombong) dan janganlah kamu berjalan di muka bumi dengan angkuh. Sesungguhnya Allah tidak menyukai orang-orang yang sombong lagi membanggakan diri.”( Q.S. Luqman : 18 )
*/
///====================================================///
const {
WAConnection: _WAConnection,
MessageType,
Presence,
MessageOptions,
Mimetype,
WALocationMessage,
WA_MESSAGE_STUB_TYPES,
ReconnectMode,
WAMessageProto,
relayWAMessage,
ProxyAgent,
GroupSettingChange,
waChatKey,
mentionedJid,
processTime,
processTicksAndRejections,
ECONNABORTED,
apikey,
WA_DEAFULT_EPHEMERAL,
DataView,
TypedArray,
device,
Browser
} = require('@adiwajshing/baileys')
const simple = require("./lib/simple.js");
const WAConnection = simple.WAConnection(_WAConnection);
const fs = require('fs')
const moment = require('moment-timezone')
const { wait,simih,getBuffer, h2k, generateMessageID, getGroupAdmins, getRandom, start, info, success, banner, close } = require('./lib/functions')
const setting = JSON.parse(fs.readFileSync('./setting.json'))
const gcdetect = JSON.parse(fs.readFileSync('./src/gcdetect.json'))
const gcrevoked = JSON.parse(fs.readFileSync('./src/gc-revoked.json'))
const { spawn, exec, execSync } = require("child_process")
const { color } = require('./lib/color')
const clc = require('chalk')
const { version, bugs } = require('./package.json')
require('./root.js')
nocache('./root.js', module => console.log(`${module} has been changed!`))
require('./rip.js')
nocache('./rip.js', module => console.log(`${module} has been changed!`))
require('./setting.json')
nocache('./setting.json', module => console.log(`${module} has been changed!`))
const starts = async (root = new WAConnection()) => {
root.logger.level = 'warn'
root.version = [2, 2143, 3]
root.browserDescription = [" Leviathan ","firefox","18.04"]
console.log(banner.string)
root.on('qr', () => {
console.log(color('[','red'), color('☭','red'), color(']','red'), color(' Please scan the QR code to whatsapp web \n'))
})
fs.existsSync('./skiuwers.json') && root.loadAuthInfo('./skiuwers.json')
root.on('connecting', () => {
start('2', 'Connecting . . .')
})
root.on('open', () => {
success('2' ,'[■■■■■■■■■■■■■■■] Connected')
setTimeout( () => {
console.log(color(`\nSucces login to whatsapp web\n`, 'yellow'))
console.log(color(`================================================`, 'red'))
console.log(color(`[ ☭ ] Made With Creator BotWea [ ☭ ]` ,'yellow'))
console.log(color(`================================================`, 'red'))
console.log(color(`[•]`, 'yellow'), color(`Creator : ${setting.ownername}`, 'green'))
console.log(color(`[•]`, 'yellow'), color(`Number : ${setting.ownerNumber} `, 'green'))
console.log(color(`[•]`, 'yellow'), color(`Status : Online`, 'green'))
console.log(color(`[•]`, 'yellow'), color(`Note : Subscribe youtube ItsMeArip`, 'green'))
console.log(color(`================================================`, 'red'))
console.log(color(` ${setting.fake}`, 'green'))
console.log(color(`================================================`, 'red'))
}, 1000)
})
await root.connect({timeoutMs: 30*1000})
fs.writeFileSync('./skiuwers.json', JSON.stringify(root.base64EncodedAuthInfo(), null, '\t'))
root.sendMessage(`${setting.ownerNumber}@s.whatsapp.net`,`\n\n====================================\n\nBot Telah Aktif Dan Berhasil Terhubung. \n\n====================================\n\n${JSON.stringify(root.user, null, 2)}\n`, MessageType.text, {contextInfo: { forwardingScore: 999, isForwarded: true, externalAdReply:{title: "© All Creator BotWea || ItsMeArip",body:"",previewType:"PHOTO",thumbnail:fs.readFileSync('./image/fake.jpg'),sourceUrl:"https://wa.me/6282311619167?text=Assalamu'alaikum, user bot verified."}}})
root.on('chat-update', async (message) => {
require('./root.js')(root, message)
})
root.on("CB:Call", json => {
if (antical === false) return
let call;
calling = JSON.parse(JSON.stringify(json))
call = calling[1].from
root.sendMessage(call, `Maaf , Bot tidak menerima panggilan apapun [ ! ] \nNlpn | Vc | Spam | Sarkas = Block permanen`, MessageType.text)
setTimeout(() => {
root.blockUser(call, "add")
}, 10000)
})
root.on('CB:Blocklist', json => {
if (blocked.length > 2) return
for (let i of json[1].blocklist) {
blocked.push(i.replace('c.us','s.whatsapp.net'))
}
})
isBattre = 'Not Detect'
isCharge = 'Not Detect'
root.on (`CB:action,,battery`, json => {
const batteryLevelStr = json[2][0][1].value
const batterylevel = parseInt (batteryLevelStr)
isBattre = batterylevel + "%"
isCharge = json[2][0][1].live
})
root.on('group-participants-update', async (anu) => {
console.log(anu)
if (welcome == false) return
try {
rip = {"key": { "fromMe": false,"participant":"0@s.whatsapp.net", "remoteJid": "6285945300923-1604595598@g.us" }, "message": {orderMessage: {itemCount: 2022,status: 200, thumbnail: fs.readFileSync(`image/${thumb}`), surface: 200, message: `▷ ${setting.botname}\n▷ ${setting.ownername} `, orderTitle: 'root', sellerJid: '0@s.whatsapp.net'}}, contextInfo: {"forwardingScore":999,"isForwarded":true},sendEphemeral: true}
const mdata = await root.groupMetadata(anu.jid)
console.log(anu)
const jamnyy = moment.tz('Asia/Jakarta').format('HH:mm')
const groupMet = await root.groupMetadata(anu.jid);
const groupMembers = groupMet.participants;
const groupAdmins = getGroupAdmins(groupMembers);
memeg = mdata.participants.length;
num = anu.participants[0];
if (anu.action == "add" && !num.includes(root.user.jid)) {
let v = root.contacts[num] || { notify: num.replace(/@.+/, "") };
anu_user = v.vname || v.notify || num.split("@")[0];
let p2 = await root.getStatus(num)
let p3 = `${p2? `${p2.status}` : '-'}`
teks = `
⊙─❲ WELCOME IN GROUP ❳
│
├⊙ Group : ${mdata.subject}
├⊙ Number : ${num.replace('@s.whatsapp.net', '')}
├⊙ User : wa.me/${num.split('@')[0]}
└⊙ Bio : ${p3}
⊙ Enjoy your life | Just fun >_<
`
root.sendMessage(mdata.id, teks, MessageType.text, {quoted:rip, contextInfo:{"externalAdReply":{"title": `Arip͘⁴̅⁰͍⁴̵〆︎ (@ItsMeArip) `,"body": `${setting.fake} `,"previewType": "PHOTO","thumbnailUrl": ``,"thumbnail": fs.readFileSync(`./image/fake.jpg`),"sourceUrl": `${setting.fakereply}`}}})
}
if (anu.action == "remove" && !num.includes(root.user.jid)) {
let w = root.contacts[num] || { notify: num.replace(/@.+/, "") };
anu_user = w.vname || w.notify || num.split("@")[0];
let p2 = await root.getStatus(num)
let p3 = `${p2? `${p2.status}` : '-'}`
teks = `
⊙─❲ LEAVE FROM GROUP ❳
│
├⊙ Group : ${mdata.subject}
├⊙ Number : ${num.replace('@s.whatsapp.net', '')}
├⊙ User : wa.me/${num.split('@')[0]}
└⊙ Bio : ${p3}
⊙ Goodbye | Don't back again >_<
`
root.sendMessage(mdata.id, teks, MessageType.text, {quoted:rip, contextInfo:{"externalAdReply":{"title": `Arip͘⁴̅⁰͍⁴̵〆︎ (@ItsMeArip) `,"body": `${setting.fake} `,"previewType": "PHOTO","thumbnailUrl": ``,"thumbnail": fs.readFileSync(`./image/fake.jpg`),"sourceUrl": `${setting.fakereply}`}}})
}
else if (anu.action == 'promote') {
const mdata = await root.groupMetadata(anu.jid)
num = anu.participants[0]
let p2 = await root.getStatus(num)
let p3 = `${p2? `${p2.status}` : '-'}`
teks = `
⊙─❲ PROMOTE DETECTED ❳
│
├⊙ Group : ${mdata.subject}
├⊙ Number : ${num.replace('@s.whatsapp.net', '')}
├⊙ User : wa.me/${num.split('@')[0]}
└⊙ Bio : ${p3}
⊙ You do not believe, please see for yourself.
`
root.sendMessage(mdata.id, teks, MessageType.text, {quoted:rip, contextInfo:{"externalAdReply":{"title": `Arip͘⁴̅⁰͍⁴̵〆︎ (@ItsMeArip) `,"body": `${setting.fake} `,"previewType": "PHOTO","thumbnailUrl": ``,"thumbnail": fs.readFileSync(`./image/fake.jpg`),"sourceUrl": `${setting.fakereply}`}}})
}
else if (anu.action == 'demote') {
num = anu.participants[0]
const mdata = await root.groupMetadata(anu.jid)
let p2 = await root.getStatus(num)
let p3 = `${p2? `${p2.status}` : '-'}`
teks = `
⊙─❲ DEMOTE DETECTED ❳
│
├⊙ Group : ${mdata.subject}
├⊙ Number : ${num.replace('@s.whatsapp.net', '')}
├⊙ User : wa.me/${num.split('@')[0]}
└⊙ Bio : ${p3}
⊙ You do not believe, please see for yourself.
`
root.sendMessage(mdata.id, teks, MessageType.text, {quoted:rip, contextInfo:{"externalAdReply":{"title": `Arip͘⁴̅⁰͍⁴̵〆︎ (@ItsMeArip) `,"body": `${setting.fake} `,"previewType": "PHOTO","thumbnailUrl": ``,"thumbnail": fs.readFileSync(`./image/fake.jpg`),"sourceUrl": `${setting.fakereply}`}}})
}
} catch (e) {
console.log('Error : %s', color(e, 'red'))
}
})
root.on('group-update', async (anu) => {
skiuuu = {"key": { "fromMe": false,"participant":"0@s.whatsapp.net", "remoteJid": "6285945300923-1604595598@g.us" }, "message": {orderMessage: {itemCount: 2022,status: 200, thumbnail: fs.readFileSync(`image/${thumb}`), surface: 200, message: `▷ ${setting.botname}\n▷ ${setting.ownername} `, orderTitle: 'root', sellerJid: '0@s.whatsapp.net'}}, contextInfo: {"forwardingScore":999,"isForwarded":true},sendEphemeral: true}
metdata = await root.groupMetadata(anu.jid)
if(anu.announce == 'false'){
teks = `
「 GROUP OPENED 」
Group telah dibuka oleh admin [ ! ]
`
root.sendMessage(metdata.id, teks, MessageType.text, {quoted: skiuuu, contextInfo:{"externalAdReply":{"title": `Arip͘⁴̅⁰͍⁴̵〆︎ (@ItsMeArip) `,"body": `${setting.fake} `,"previewType": "PHOTO","thumbnailUrl": ``,"thumbnail": fs.readFileSync(`./image/fake.jpg`),"sourceUrl": `${setting.fakereply}`}}})
console.log(clc.yellow(`[ Group Opened ] In ${metdata.subject}`))
}
else if(anu.announce == 'true'){
teks = `
「 GROUP CLOSED 」
Group telah ditutup oleh admin [ ! ]
`
root.sendMessage(metdata.id, teks, MessageType.text, {quoted: skiuuu, contextInfo:{"externalAdReply":{"title": `Arip͘⁴̅⁰͍⁴̵〆︎ (@ItsMeArip) `,"body": `${setting.fake} `,"previewType": "PHOTO","thumbnailUrl": ``,"thumbnail": fs.readFileSync(`./image/fake.jpg`),"sourceUrl": `${setting.fakereply}`}}})
console.log(clc.yellow(`[ Group Closed ] In ${metdata.subject}`))
}
else if(!anu.desc == 'true'){
tag = anu.descOwner.split('@')[0] + '@s.whatsapp.net'
teks = `
「 GROUP DESCRIPTION CHANGE 」
Deskripsi group telah diubah oleh admin [ ! ] \n\n${anu.desc}
`
root.sendMessage(metdata.id, teks, MessageType.text, {quoted: skiuuu, contextInfo:{"externalAdReply":{"title": `Arip͘⁴̅⁰͍⁴̵〆︎ (@ItsMeArip) `,"body": `${setting.fake} `,"previewType": "PHOTO","thumbnailUrl": ``,"thumbnail": fs.readFileSync(`./image/fake.jpg`),"sourceUrl": `${setting.fakereply}`}}})
console.log(clc.yellow(`[ Group Description Change ] In ${metdata.subject}`))
}
else if(anu.restrict == 'false'){
teks = `
「 GROUP SETTING CHANGE 」
Edit group info telah dibuka untuk member [ ! ]
`
root.sendMessage(metdata.id, teks, MessageType.text, {quoted: skiuuu, contextInfo:{"externalAdReply":{"title": `Arip͘⁴̅⁰͍⁴̵〆︎ (@ItsMeArip) `,"body": `${setting.fake} `,"previewType": "PHOTO","thumbnailUrl": ``,"thumbnail": fs.readFileSync(`./image/fake.jpg`),"sourceUrl": `${setting.fakereply}`}}})
console.log(clc.yellow(`[ Group Setting Change ] In ${metdata.subject}`))
}
else if(anu.restrict == 'true'){
teks = `
「 GROUP SETTING CHANGE 」
Edit group info telah ditutup untuk member [ ! ]
`
root.sendMessage(metdata.id, teks, MessageType.text, {quoted: skiuuu, contextInfo:{"externalAdReply":{"title": `Arip͘⁴̅⁰͍⁴̵〆︎ (@ItsMeArip) `,"body": `${setting.fake} `,"previewType": "PHOTO","thumbnailUrl": ``,"thumbnail": fs.readFileSync(`./image/fake.jpg`),"sourceUrl": `${setting.fakereply}`}}})
console.log(clc.yellow(`[ Group Setting Change ] In ${metdata.subject}`))
}
})
root.on('message-delete', async (m) => {
if (m.key.remoteJid == 'status@broadcast') return
if (!m.key.fromMe && m.key.fromMe) return
if (antidel === false) 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 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'
})
const type = Object.keys(m.message)[0]
root.sendMessage(m.key.remoteJid, `
⊙─❲ ANTI DELETE TERDETEKSI ❳
│
├⊙ Name : @${m.participant.split("@")[0]}
├⊙ Day : ${week} ${calender}
├⊙ Time : ${jam}
└⊙ Type : ${type}
`, MessageType.text, {quoted: m.message, contextInfo: {"mentionedJid": [m.participant]}})
root.copyNForward(m.key.remoteJid, m.message)
})
}
/**
* Uncache if there is file change
* @param {string} module Module name or path
* @param {function} cb <optional>
*/
function nocache(module, cb = () => { }) {
console.log('Module', `'${module}'`, 'is now being watched for changes')
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()