-
Notifications
You must be signed in to change notification settings - Fork 0
/
ABHI-BUG-BOT.js
2206 lines (2160 loc) · 95.2 KB
/
ABHI-BUG-BOT.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
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
const { BufferJSON, WA_DEFAULT_EPHEMERAL, generateWAMessageFromContent, proto, generateWAMessageContent, generateWAMessage, prepareWAMessageMedia, areJidsSameUser, getContentType } = require('@whiskeysockets/baileys')
const os = require('os')
const fs = require('fs')
const fsx = require('fs-extra')
const path = require('path')
const util = require('util')
const chalk = require('chalk')
const moment = require('moment-timezone')
const speed = require('performance-now')
const ms = toMs = require('ms')
const axios = require('axios')
const fetch = require('node-fetch')
const { exec, spawn, execSync } = require("child_process")
const { performance } = require('perf_hooks')
const more = String.fromCharCode(8206)
const readmore = more.repeat(4001)
const { TelegraPh, UploadFileUgu, webp2mp4File, floNime } = require('./lib/uploader')
const { toAudio, toPTT, toVideo, ffmpeg, addExifAvatar } = require('./lib/converter')
const { smsg, getGroupAdmins, formatp, jam, formatDate, getTime, isUrl, await, sleep, clockString, msToDate, sort, toNumber, enumGetKey, runtime, fetchJson, getBuffer, json, delay, format, logic, generateProfilePicture, parseMention, getRandom, pickRandom, reSize } = require('./lib/myfunc')
let afk = require("./lib/afk");
const { addPremiumUser, getPremiumExpired, getPremiumPosition, expiredCheck, checkPremiumUser, getAllPremiumUser } = require('./lib/premiun')
const { fetchBuffer, buffergif } = require("./lib/myfunc2")
//bug database
const { bugtext1 } = require('./BUGS/bugtext1')
const { bugtext2 } = require('./BUGS/bugtext2')
const { bugtext3 } = require('./BUGS/bugtext3')
const { bugtext4 } = require('./BUGS/bugtext4')
const { bugtext5 } = require('./BUGS/bugtext5')
//database
let premium = JSON.parse(fs.readFileSync('./database/premium.json'))
let _owner = JSON.parse(fs.readFileSync('./database/owner.json'))
let owner = JSON.parse(fs.readFileSync('./database/owner.json'))
let _afk = JSON.parse(fs.readFileSync('./database/afk-user.json'))
let hit = JSON.parse(fs.readFileSync('./database/total-hit-user.json'))
//autorep
const VoiceNoteXeon = JSON.parse(fs.readFileSync('./database/autoreply/vn.json'))
const StickerXeon = JSON.parse(fs.readFileSync('./database/autoreply/sticker.json'))
const ImageXeon = JSON.parse(fs.readFileSync('./database/autoreply/image.json'))
const VideoXeon = JSON.parse(fs.readFileSync('./database/autoreply/video.json'))
const DocXeon = JSON.parse(fs.readFileSync('./database/autoreply/doc.json'))
const ZipXeon = JSON.parse(fs.readFileSync('./database/autoreply/zip.json'))
const ApkXeon = JSON.parse(fs.readFileSync('./database/autoreply/apk.json'))
//time
const xtime = moment.tz('Asia/Kolkata').format('HH:mm:ss')
const xdate = moment.tz('Asia/Kolkata').format('DD/MM/YYYY')
const time2 = moment().tz('Asia/Kolkata').format('HH:mm:ss')
if(time2 < "23:59:00"){
var xeonytimewisher = `Good Night 🌆`
}
if(time2 < "19:00:00"){
var xeonytimewisher = `Good Evening 🌆`
}
if(time2 < "18:00:00"){
var xeonytimewisher = `Good Evening 🌆`
}
if(time2 < "15:00:00"){
var xeonytimewisher = `Good Afternoon 🌅`
}
if(time2 < "11:00:00"){
var xeonytimewisher = `Good Morning 🌄`
}
if(time2 < "05:00:00"){
var xeonytimewisher = `Good Morning 🌄`
}
module.exports = XeonBotInc = async (XeonBotInc, m, msg, chatUpdate, store) => {
try {
const {
type,
quotedMsg,
mentioned,
now,
fromMe
} = m
var body = (m.mtype === 'conversation') ? m.message.conversation : (m.mtype == 'imageMessage') ? m.message.imageMessage.caption : (m.mtype == 'videoMessage') ? m.message.videoMessage.caption : (m.mtype == 'extendedTextMessage') ? m.message.extendedTextMessage.text : (m.mtype == 'buttonsResponseMessage') ? m.message.buttonsResponseMessage.selectedButtonId : (m.mtype == 'listResponseMessage') ? m.message.listResponseMessage.singleSelectreplygcxeon.selectedRowId : (m.mtype == 'templateButtonreplygcxeonMessage') ? m.message.templateButtonreplygcxeonMessage.selectedId : (m.mtype === 'messageContextInfo') ? (m.message.buttonsResponseMessage?.selectedButtonId || m.message.listResponseMessage?.singleSelectreplygcxeon.selectedRowId || m.text) : ''
var budy = (typeof m.text == 'string' ? m.text : '')
var prefix = prefa ? /^[°•π÷׶∆£¢€¥®™+✓_=|~!?@#$%^&.©^]/gi.test(body) ? body.match(/^[°•π÷׶∆£¢€¥®™+✓_=|~!?@#$%^&.©^]/gi)[0] : "" : prefa ?? global.prefix
const isCmd = body.startsWith(prefix)
const command = body.replace(prefix, '').trim().split(/ +/).shift().toLowerCase()
const args = body.trim().split(/ +/).slice(1)
const full_args = body.replace(command, '').slice(1).trim()
const pushname = m.pushName || "No Name"
const botNumber = await XeonBotInc.decodeJid(XeonBotInc.user.id)
const itsMe = m.sender == botNumber ? true : false
const sender = m.sender
const text = q = args.join(" ")
const from = m.key.remoteJid
const fatkuns = (m.quoted || m)
const quoted = (fatkuns.mtype == 'buttonsMessage') ? fatkuns[Object.keys(fatkuns)[1]] : (fatkuns.mtype == 'templateMessage') ? fatkuns.hydratedTemplate[Object.keys(fatkuns.hydratedTemplate)[1]] : (fatkuns.mtype == 'product') ? fatkuns[Object.keys(fatkuns)[0]] : m.quoted ? m.quoted : m
const mime = (quoted.msg || quoted).mimetype || ''
const qmsg = (quoted.msg || quoted)
const isMedia = /image|video|sticker|audio/.test(mime)
const isImage = (type == 'imageMessage')
const isVideo = (type == 'videoMessage')
const isAudio = (type == 'audioMessage')
const isText = (type == 'textMessage')
const isSticker = (type == 'stickerMessage')
const isQuotedText = type === 'extendexTextMessage' && content.includes('textMessage')
const isQuotedImage = type === 'extendedTextMessage' && content.includes('imageMessage')
const isQuotedLocation = type === 'extendedTextMessage' && content.includes('locationMessage')
const isQuotedVideo = type === 'extendedTextMessage' && content.includes('videoMessage')
const isQuotedSticker = type === 'extendedTextMessage' && content.includes('stickerMessage')
const isQuotedAudio = type === 'extendedTextMessage' && content.includes('audioMessage')
const isQuotedContact = type === 'extendedTextMessage' && content.includes('contactMessage')
const isQuotedDocument = type === 'extendedTextMessage' && content.includes('documentMessage')
const sticker = []
const isAfkOn = afk.checkAfkUser(m.sender, _afk)
const isGroup = m.key.remoteJid.endsWith('@g.us')
const groupMetadata = m.isGroup ? await XeonBotInc.groupMetadata(m.chat).catch(e => {}) : ''
const groupName = m.isGroup ? groupMetadata.subject : ''
const participants = m.isGroup ? await groupMetadata.participants : ''
const groupAdmins = m.isGroup ? await getGroupAdmins(participants) : ''
const isBotAdmins = m.isGroup ? groupAdmins.includes(botNumber) : false
const isAdmins = m.isGroup ? groupAdmins.includes(m.sender) : false
const groupOwner = m.isGroup ? groupMetadata.owner : ''
const isGroupOwner = m.isGroup ? (groupOwner ? groupOwner : groupAdmins).includes(m.sender) : false
const isCreator = [ownernumber, ..._owner].map(v => v.replace(/[^0-9]/g, '') + '@s.whatsapp.net').includes(m.sender)
const isPremium = isCreator || isCreator || checkPremiumUser(m.sender, premium);
expiredCheck(XeonBotInc, m, premium);
//group chat msg by xeon
const replygcxeon = (teks) => {
XeonBotInc.sendMessage(m.chat,
{ text: teks,
contextInfo:{
mentionedJid:[sender],
forwardingScore: 9999999,
isForwarded: true,
"externalAdReply": {
"showAdAttribution": true,
"containsAutoReply": true,
"title": ` ${global.botname}`,
"body": `${ownername}`,
"previewType": "PHOTO",
"AbhinailUrl": ``,
"Abhinail": fs.readFileSync(`./Media/Abhi.jpg`),
"sourceUrl": `${link}`}}},
{ quoted: m})
}
async function loading () {
var xeonlod = [
"《 █▒▒▒▒▒▒▒▒▒▒▒》10%",
"《 ████▒▒▒▒▒▒▒▒》30%",
"《 ███████▒▒▒▒▒》50%",
"《 ██████████▒▒》80%",
"《 ████████████》100%",
"Loading Completed✅"
]
let { key } = await XeonBotInc.sendMessage(from, {text: 'Loading Please Wait'})
for (let i = 0; i < xeonlod.length; i++) {
await XeonBotInc.sendMessage(from, {text: xeonlod[i], edit: key });
}
}
if (!XeonBotInc.public) {
if (!isCreator && !m.key.fromMe) return
}
if (autoread) {
XeonBotInc.readMessages([m.key])
}
if (global.autoTyping) {
XeonBotInc.sendPresenceUpdate('composing', from)
}
if (global.autoRecording) {
XeonBotInc.sendPresenceUpdate('recording', from)
}
//bot number online status, available=online, unavailable=offline
XeonBotInc.sendPresenceUpdate('unavailable', from)
if (global.autorecordtype) {
let xeonrecordin = ['recording','composing']
let xeonrecordinfinal = xeonrecordin[Math.floor(Math.random() * xeonrecordin.length)]
XeonBotInc.sendPresenceUpdate(xeonrecordinfinal, from)
}
if (autobio) {
XeonBotInc.updateProfileStatus(`24/7 Online Bot By ${ownername}`).catch(_ => _)
}
if (m.sender.startsWith('92') && global.anti92 === true) {
return XeonBotInc.updateBlockStatus(m.sender, 'block')
}
let list = []
for (let i of owner) {
list.push({
displayName: await XeonBotInc.getName(i),
vcard: `BEGIN:VCARD\nVERSION:3.0\nN:${await XeonBotInc.getName(i)}\nFN:${await XeonBotInc.getName(i)}\nitem1.TEL;waid=${i}:${i}\nitem1.X-ABLabel:Click here to chat\nitem2.EMAIL;type=INTERNET:${ytname}\nitem2.X-ABLabel:YouTube\nitem3.URL:${socialm}\nitem3.X-ABLabel:GitHub\nitem4.ADR:;;${location};;;;\nitem4.X-ABLabel:Region\nEND:VCARD`
})
}
//chat counter (console log)
if (m.message && m.isGroup) {
console.log(chalk.cyan(`\n< ================================================== >\n`))
console.log(chalk.green(`Group Chat:`))
console.log(chalk.black(chalk.bgWhite('[ MESSAGE ]')), chalk.black(chalk.bgGreen(new Date)), chalk.black(chalk.bgBlue(budy || m.mtype)) + '\n' + chalk.magenta('=> From'), chalk.green(pushname), chalk.yellow(m.sender) + '\n' + chalk.blueBright('=> In'), chalk.green(groupName, m.chat))
} else {
console.log(chalk.cyan(`\n< ================================================== >\n`))
console.log(chalk.green(`Private Chat:`))
console.log(chalk.black(chalk.bgWhite('[ MESSAGE ]')), chalk.black(chalk.bgGreen(new Date)), chalk.black(chalk.bgBlue(budy || m.mtype)) + '\n' + chalk.magenta('=> From'), chalk.green(pushname), chalk.yellow(m.sender))
}
if (command) {
const cmdadd = () => {
hit[0].hit_cmd += 1
fs.writeFileSync('./database/total-hit-user.json', JSON.stringify(hit))
}
cmdadd()
const totalhit = JSON.parse(fs.readFileSync('./database/total-hit-user.json'))[0].hit_cmd
}
for (let BhosdikaXeon of VoiceNoteXeon) {
if (budy === BhosdikaXeon) {
let audiobuffy = fs.readFileSync(`./Media/audio/${BhosdikaXeon}.mp3`)
XeonBotInc.sendMessage(m.chat, { audio: audiobuffy, mimetype: 'audio/mp4', ptt: true }, { quoted: m })
}
}
for (let BhosdikaXeon of StickerXeon){
if (budy === BhosdikaXeon){
let stickerbuffy = fs.readFileSync(`./Media/sticker/${BhosdikaXeon}.webp`)
XeonBotInc.sendMessage(m.chat, { sticker: stickerbuffy }, { quoted: m })
}
}
for (let BhosdikaXeon of ImageXeon){
if (budy === BhosdikaXeon){
let imagebuffy = fs.readFileSync(`./Media/image/${BhosdikaXeon}.jpg`)
XeonBotInc.sendMessage(m.chat, { image: imagebuffy }, { quoted: m })
}
}
for (let BhosdikaXeon of VideoXeon){
if (budy === BhosdikaXeon){
let videobuffy = fs.readFileSync(`./Media/video/${BhosdikaXeon}.mp4`)
XeonBotInc.sendMessage(m.chat, { video: videobuffy }, { quoted: m })
}
}
const sendapk = (teks) => {
XeonBotInc.sendMessage(from, { document: teks, mimetype: 'application/vnd.android.package-archive'}, {quoted:m})
}
for (let BhosdikaXeon of ApkXeon) {
if (budy === BhosdikaXeon) {
let buffer = fs.readFileSync(`./Media/apk/${BhosdikaXeon}.apk`)
sendapk(buffer)
}
}
const sendzip = (teks) => {
XeonBotInc.sendMessage(from, { document: teks, mimetype: 'application/zip'}, {quoted:m})
}
for (let BhosdikaXeon of ZipXeon) {
if (budy === BhosdikaXeon) {
let buffer = fs.readFileSync(`./Media/zip/${BhosdikaXeon}.zip`)
sendzip(buffer)
}
}
const senddocu = (teks) => {
haikal.sendMessage(from, { document: teks, mimetype: 'application/pdf'}, {quoted:m})
}
for (let BhosdikaXeon of DocXeon) {
if (budy === BhosdikaXeon) {
let buffer = fs.readFileSync(`./Media/doc/${BhosdikaXeon}.pdf`)
senddocu(buffer)
}
}
if (m.isGroup && !m.key.fromMe) {
let mentionUser = [...new Set([...(m.mentionedJid || []), ...(m.quoted ? [m.quoted.sender] : [])])]
for (let ment of mentionUser) {
if (afk.checkAfkUser(ment, _afk)) {
let getId2 = afk.getAfkId(ment, _afk)
let getReason2 = afk.getAfkReason(getId2, _afk)
let getTimee = Date.now() - afk.getAfkTime(getId2, _afk)
let heheh2 = ms(getTimee)
replygcxeon(`Don't tag him, he's afk\n\n*Reason :* ${getReason2}`)
}
}
if (afk.checkAfkUser(m.sender, _afk)) {
let getId = afk.getAfkId(m.sender, _afk)
let getReason = afk.getAfkReason(getId, _afk)
let getTime = Date.now() - afk.getAfkTime(getId, _afk)
let heheh = ms(getTime)
_afk.splice(afk.getAfkPosition(m.sender, _afk), 1)
fs.writeFileSync('./database/afk-user.json', JSON.stringify(_afk))
XeonBotInc.sendTextWithMentions(m.chat, `@${m.sender.split('@')[0]} have returned from afk`, m)
}
}
switch (command) {
case 'addprem':
if (!isCreator) return replygcxeon(mess.owner)
if (args.length < 2)
return replygcxeon(`Use :\n*#addprem* @tag time\n*#addprem* number time\n\nExample : #addprem @tag 30d`);
if (m.mentionedJid.length !== 0) {
for (let i = 0; i < m.mentionedJid.length; i++) {
addPremiumUser(m.mentionedJid[0], args[1], premium);
}
replygcxeon("Premium Success")
} else {
addPremiumUser(args[0] + "@s.whatsapp.net", args[1], premium);
replygcxeon("Success")
}
break
case 'delprem':
if (!isCreator) return replygcxeon(mess.owner)
if (args.length < 1) return replygcxeon(`Use :\n*#delprem* @tag\n*#delprem* number`);
if (m.mentionedJid.length !== 0) {
for (let i = 0; i < m.mentionedJid.length; i++) {
premium.splice(getPremiumPosition(m.mentionedJid[i], premium), 1);
fs.writeFileSync("./database/premium.json", JSON.stringify(premium));
}
replygcxeon("Delete success")
} else {
premium.splice(getPremiumPosition(args[0] + "@s.whatsapp.net", premium), 1);
fs.writeFileSync("./database/premium.json", JSON.stringify(premium));
replygcxeon("Success")
}
break
case 'listprem': {
if (!isCreator) return replygcxeon(mess.owner)
let data = require("./database/premium.json")
let txt = `*------「 LIST PREMIUM 」------*\n\n`
for (let i of data) {
txt += `Number : ${i.id}\n`
txt += `Expired : ${i.expired} Second\n`
}
XeonBotInc.sendMessage(m.chat, {
text: txt,
mentions: i
}, {
quoted: m
})
}
break
case 'deletesession':
case 'delsession':
case 'clearsession': {
if (!isCreator) return replygcxeon(mess.owner)
fs.readdir("./session", async function(err, files) {
if (err) {
console.log('Unable to scan directory: ' + err);
return replygcxeon('Unable to scan directory: ' + err);
}
let filteredArray = await files.filter(item => item.startsWith("pre-key") ||
item.startsWith("sender-key") || item.startsWith("session-") || item.startsWith("app-state")
)
console.log(filteredArray.length);
let teks = `Detected ${filteredArray.length} junk files\n\n`
if (filteredArray.length == 0) return replygcxeon(teks)
filteredArray.map(function(e, i) {
teks += (i + 1) + `. ${e}\n`
})
replygcxeon(teks)
await sleep(2000)
replygcxeon("Delete junk files...")
await filteredArray.forEach(function(file) {
fs.unlinkSync(`./session/${file}`)
});
await sleep(2000)
replygcxeon("Successfully deleted all the trash in the session folder")
});
}
break
case 'join':
try {
if (!isCreator) return replygcxeon(mess.owner)
if (!text) return replygcxeon('Enter Group Link!')
if (!isUrl(args[0]) && !args[0].includes('whatsapp.com')) return replygcxeon('Link Invalid!')
replygcxeon(mess.wait)
let result = args[0].split('https://chat.whatsapp.com/')[1]
await XeonBotInc.groupAcceptInvite(result).then((res) => replygcxeon(json(res))).catch((err) => replygcxeon(json(err)))
} catch {
replygcxeon('Failed to join the Group')
}
break
case 'getsession':
if (!isCreator) return replygcxeon(mess.owner)
replygcxeon('Wait a moment, currently retrieving your session file')
let sesi = await fs.readFileSync('./session/creds.json')
XeonBotInc.sendMessage(m.chat, {
document: sesi,
mimetype: 'application/json',
fileName: 'creds.json'
}, {
quoted: m
})
break
case 'shutdown':
if (!isCreator) return replygcxeon(mess.owner)
replygcxeon(`Goodbye🖐`)
await sleep(3000)
process.exit()
break
case 'restart':
if (!isCreator) return replygcxeon(mess.owner)
replygcxeon('In Process....')
exec('pm2 restart all')
break
case 'autoread':
if (!isCreator) return replygcxeon(mess.owner)
if (args.length < 1) return replygcxeon(`Example ${prefix + command} on/off`)
if (q === 'on') {
autoread = true
replygcxeon(`Successfully changed autoread to ${q}`)
} else if (q === 'off') {
autoread = false
replygcxeon(`Successfully changed autoread to ${q}`)
}
break
case 'autotyping':
if (!isCreator) return replygcxeon(mess.owner)
if (args.length < 1) return replygcxeon(`Example ${prefix + command} on/off`)
if (q === 'on') {
autoTyping = true
replygcxeon(`Successfully changed auto-typing to ${q}`)
} else if (q === 'off') {
autoTyping = false
replygcxeon(`Successfully changed auto-typing to ${q}`)
}
break
case 'autorecording':
if (!isCreator) return replygcxeon(mess.owner)
if (args.length < 1) return replygcxeon(`Example ${prefix + command} on/off`)
if (q === 'on') {
autoRecording = true
replygcxeon(`Successfully changed auto-recording to ${q}`)
} else if (q === 'off') {
autoRecording = false
replygcxeon(`Successfully changed auto-recording to ${q}`)
}
break
case 'autorecordtyp':
if (!isCreator) return replygcxeon(mess.owner)
if (args.length < 1) return replygcxeon(`Example ${prefix + command} on/off`)
if (q === 'on') {
autorecordtype = true
replygcxeon(`Successfully changed auto recording and typing to ${q}`)
} else if (q === 'off') {
autorecordtype = false
replygcxeon(`Successfully changed auto recording and typing to ${q}`)
}
break
case 'autoswview':
if (!isCreator) return replygcxeon(mess.owner)
if (args.length < 1) return replygcxeon(`Example ${prefix + command} on/off`)
if (q === 'on') {
autoread_status = true
replygcxeon(`Successfully changed auto status/story view to ${q}`)
} else if (q === 'off') {
autoread_status = false
replygcxeon(`Successfully changed auto status/story view to ${q}`)
}
break
case 'autobio':
if (!isCreator) return replygcxeon(mess.owner)
if (args.length < 1) return replygcxeon(`Example ${prefix + command} on/off`)
if (q == 'on') {
autobio = true
replygcxeon(`Successfully Changed AutoBio To ${q}`)
} else if (q == 'off') {
autobio = false
replygcxeon(`Successfully Changed AutoBio To ${q}`)
}
break
case 'mode':
if (!isCreator) return replygcxeon(mess.owner)
if (args.length < 1) return replygcxeon(`Example ${prefix + command} public/self`)
if (q == 'public') {
XeonBotInc.public = true
replygcxeon(mess.done)
} else if (q == 'self') {
XeonBotInc.public = false
replygcxeon(mess.done)
}
break
case 'setexif':
if (!isCreator) return replygcxeon(mess.owner)
if (!text) return replygcxeon(`Example : ${prefix + command} packname|author`)
global.packname = text.split("|")[0]
global.author = text.split("|")[1]
replygcxeon(`Exif successfully changed to\n\n• Packname : ${global.packname}\n• Author : ${global.author}`)
break
case 'setpp':
case 'setpp':
case 'setppbot':
if (!isCreator) return replygcxeon(mess.owner)
if (!quoted) return replygcxeon(`Send/Reply Image With Caption ${prefix + command}`)
if (!/image/.test(mime)) return replygcxeon(`Send/Reply Image With Caption ${prefix + command}`)
if (/webp/.test(mime)) return replygcxeon(`Send/Reply Image With Caption ${prefix + command}`)
var medis = await XeonBotInc.downloadAndSaveMediaMessage(quoted, 'ppbot.jpeg')
if (args[0] == 'full') {
var {
img
} = await generateProfilePicture(medis)
await XeonBotInc.query({
tag: 'iq',
attrs: {
to: botNumber,
type: 'set',
xmlns: 'w:profile:picture'
},
content: [{
tag: 'picture',
attrs: {
type: 'image'
},
content: img
}]
})
fs.unlinkSync(medis)
replygcxeon(mess.done)
} else {
var memeg = await XeonBotInc.updateProfilePicture(botNumber, {
url: medis
})
fs.unlinkSync(medis)
replygcxeon(mess.done)
}
break
case 'block':
if (!isCreator) return replygcxeon(mess.owner)
let blockw = m.mentionedJid[0] ? m.mentionedJid[0] : m.quoted ? m.quoted.sender : text.replace(/[^0-9]/g, '') + '@s.whatsapp.net'
await XeonBotInc.updateBlockStatus(blockw, 'block').then((res) => replygcxeon(json(res))).catch((err) => replygcxeon(json(err)))
break
case 'unblock':
if (!isCreator) return replygcxeon(mess.owner)
let blockww = m.mentionedJid[0] ? m.mentionedJid[0] : m.quoted ? m.quoted.sender : text.replace(/[^0-9]/g, '') + '@s.whatsapp.net'
await XeonBotInc.updateBlockStatus(blockww, 'unblock').then((res) => replygcxeon(json(res))).catch((err) => replygcxeon(json(err)))
break
case 'leave':
if (!isCreator) return replygcxeon(mess.owner)
if (!m.isGroup) return replygcxeon(mess.group)
replygcxeon('Bye Everyone 🥺')
await XeonBotInc.groupLeave(m.chat)
break
case 'backup':
if (!isCreator) return replygcxeon(mess.owner)
if (m.isGroup) return replygcxeon(mess.private)
replygcxeon(mess.wait)
exec('zip backup.zip *')
let malas = await fs.readFileSync('./backup.zip')
await XeonBotInc.sendMessage(m.chat, {
document: malas,
mimetype: 'application/zip',
fileName: 'backup.zip'
}, {
quoted: m
})
break
case 'bcgc':
case 'bcgroup': {
if (!isCreator) return replygcxeon(mess.owner)
if (!text) return replygcxeon(`Which text?\n\nExample : ${prefix + command} It's holiday tomorrow `)
let getGroups = await XeonBotInc.groupFetchAllParticipating()
let groups = Object.entries(getGroups).slice(0).map(entry => entry[1])
let anu = groups.map(v => v.id)
replygcxeon(`Send Broadcast To ${anu.length} Group Chat, End Time ${anu.length * 1.5} second`)
for (let i of anu) {
await sleep(1500)
let a = '```' + `\n\n${text}\n\n` + '```' + '\n\n\nʙʀᴏᴀᴅᴄᴀsᴛ'
XeonBotInc.sendMessage(i, {
text: a,
contextInfo: {
externalAdReply: {
showAdAttribution: true,
title: 'Broadcast By Owner',
body: `Sent ${i.length} Group`,
AbhinailUrl: 'https://i.ibb.co/7bPPRQ0/4bf4b7e0b042.jpg',
sourceUrl: global.link,
mediaType: 1,
renderLargerAbhinail: true
}
}
})
}
replygcxeon(`Successfully Sent Broadcast To ${anu.length} Group`)
}
break
case 'getcase':
if (!isCreator) return replygcxeon(mess.owner)
const getCase = (cases) => {
return "case" + `'${cases}'` + fs.readFileSync("ABHI-BUG-BOT.js").toString().split('case \'' + cases + '\'')[1].split("break")[0] + "break"
}
replygcxeon(`${getCase(q)}`)
break
case 'delete':
case 'del': {
if (!isCreator) return replygcxeon(mess.done)
if (!m.quoted) throw false
let {
chat,
fromMe,
id,
isBaileys
} = m.quoted
if (!isBaileys) return replygcxeon('The message was not sent by a bot!')
XeonBotInc.sendMessage(m.chat, {
delete: {
remoteJid: m.chat,
fromMe: true,
id: m.quoted.id,
participant: m.quoted.sender
}
})
}
break
case 'closetime':
if (!m.isGroup) return replygcxeon(mess.group)
if (!isAdmins && !isCreator) return replygcxeon(mess.admin)
if (!isBotAdmins) return replygcxeon(mess.botAdmin)
if (args[1] == 'second') {
var timer = args[0] * `1000`
} else if (args[1] == 'minute') {
var timer = args[0] * `60000`
} else if (args[1] == 'hour') {
var timer = args[0] * `3600000`
} else if (args[1] == 'day') {
var timer = args[0] * `86400000`
} else {
return replygcxeon('*Choose:*\nsecond\nminute\nhour\nday\n\n*Example*\n10 second')
}
replygcxeon(`Close time ${q} starting from now`)
setTimeout(() => {
var nomor = m.participant
const close = `*Closed* group closed by admin\nnow only admin can send messages`
XeonBotInc.groupSettingUpdate(m.chat, 'announcement')
replygcxeon(close)
}, timer)
break
case 'opentime':
if (!m.isGroup) return replygcxeon(mess.group)
if (!isAdmins && !isCreator) return replygcxeon(mess.admin)
if (!isBotAdmins) return replygcxeon(mess.botAdmin)
if (args[1] == 'second') {
var timer = args[0] * `1000`
} else if (args[1] == 'minute') {
var timer = args[0] * `60000`
} else if (args[1] == 'hour') {
var timer = args[0] * `3600000`
} else if (args[1] == 'day') {
var timer = args[0] * `86400000`
} else {
return replygcxeon('*Choose:*\nsecond\nminute\nhour\nday\n\n*Example*\n10 second')
}
replygcxeon(`Open time ${q} starting from now`)
setTimeout(() => {
var nomor = m.participant
const open = `*Opened* The group is opened by admin\nNow members can send messages`
XeonBotInc.groupSettingUpdate(m.chat, 'not_announcement')
replygcxeon(open)
}, timer)
break
case 'kick':
if (!m.isGroup) return replygcxeon(mess.group)
if (!isAdmins && !isGroupOwner && !isCreator) return replygcxeon(mess.admin)
if (!isBotAdmins) return replygcxeon(mess.botAdmin)
let blockwww = m.mentionedJid[0] ? m.mentionedJid[0] : m.quoted ? m.quoted.sender : text.replace(/[^0-9]/g, '') + '@s.whatsapp.net'
await XeonBotInc.groupParticipantsUpdate(m.chat, [blockwww], 'remove').then((res) => replygcxeon(json(res))).catch((err) => replygcxeon(json(err)))
break
case 'add':
if (!m.isGroup) return replygcxeon(mess.group)
if (!isAdmins && !isGroupOwner && !isCreator) return replygcxeon(mess.admin)
if (!isBotAdmins) return replygcxeon(mess.botAdmin)
let blockwwww = m.quoted ? m.quoted.sender : text.replace(/[^0-9]/g, '') + '@s.whatsapp.net'
await XeonBotInc.groupParticipantsUpdate(m.chat, [blockwwww], 'add').then((res) => replygcxeon(json(res))).catch((err) => replygcxeon(json(err)))
break
case 'promote':
if (!m.isGroup) return replygcxeon(mess.group)
if (!isAdmins && !isGroupOwner && !isCreator) return replygcxeon(mess.admin)
if (!isBotAdmins) return replygcxeon(mess.botAdmin)
let blockwwwww = m.mentionedJid[0] ? m.mentionedJid[0] : m.quoted ? m.quoted.sender : text.replace(/[^0-9]/g, '') + '@s.whatsapp.net'
await XeonBotInc.groupParticipantsUpdate(m.chat, [blockwwwww], 'promote').then((res) => replygcxeon(json(res))).catch((err) => replygcxeon(json(err)))
break
case 'demote':
if (!m.isGroup) return replygcxeon(mess.group)
if (!isAdmins && !isGroupOwner && !isCreator) return replygcxeon(mess.admin)
if (!isBotAdmins) return replygcxeon(mess.botAdmin)
let blockwwwwwa = m.mentionedJid[0] ? m.mentionedJid[0] : m.quoted ? m.quoted.sender : text.replace(/[^0-9]/g, '') + '@s.whatsapp.net'
await XeonBotInc.groupParticipantsUpdate(m.chat, [blockwwwwwa], 'demote').then((res) => replygcxeon(json(res))).catch((err) => replygcxeon(json(err)))
break
case 'setname':
case 'setsubject':
if (!m.isGroup) return replygcxeon(mess.group)
if (!isAdmins && !isGroupOwner && !isCreator) return replygcxeon(mess.admin)
if (!isBotAdmins) return replygcxeon(mess.botAdmin)
if (!text) return 'Text ?'
await XeonBotInc.groupUpdateSubject(m.chat, text).then((res) => replygcxeon(mess.success)).catch((err) => replygcxeon(json(err)))
break
case 'setdesc':
case 'setdesk':
if (!m.isGroup) return replygcxeon(mess.group)
if (!isAdmins && !isGroupOwner && !isCreator) return replygcxeon(mess.admin)
if (!isBotAdmins) return replygcxeon(mess.botAdmin)
if (!text) return 'Text ?'
await XeonBotInc.groupUpdateDescription(m.chat, text).then((res) => replygcxeon(mess.success)).catch((err) => replygcxeon(json(err)))
break
case 'setppgroup':
case 'setppgrup':
case 'setppgc':
if (!m.isGroup) return replygcxeon(mess.group)
if (!isAdmins) return replygcxeon(mess.admin)
if (!isBotAdmins) return replygcxeon(mess.botAdmin)
if (!quoted) return replygcxeon(`Send/Reply Image With Caption ${prefix + command}`)
if (!/image/.test(mime)) return replygcxeon(`Send/Reply Image With Caption ${prefix + command}`)
if (/webp/.test(mime)) return replygcxeon(`Send/Reply Image With Caption ${prefix + command}`)
var medis = await XeonBotInc.downloadAndSaveMediaMessage(quoted, 'ppbot.jpeg')
if (args[0] == 'full') {
var {
img
} = await generateProfilePicture(medis)
await XeonBotInc.query({
tag: 'iq',
attrs: {
to: m.chat,
type: 'set',
xmlns: 'w:profile:picture'
},
content: [{
tag: 'picture',
attrs: {
type: 'image'
},
content: img
}]
})
fs.unlinkSync(medis)
replygcxeon(mess.done)
} else {
var memeg = await XeonBotInc.updateProfilePicture(m.chat, {
url: medis
})
fs.unlinkSync(medis)
replygcxeon(mess.done)
}
break
case 'tagall':
if (!m.isGroup) return replygcxeon(mess.group)
if (!isAdmins && !isGroupOwner && !isCreator) return replygcxeon(mess.admin)
if (!isBotAdmins) return replygcxeon(mess.botAdmin)
let teks = `*👥 Tag All*
🗞️ *Message : ${q ? q : 'blank'}*\n\n`
for (let mem of participants) {
teks += `• @${mem.id.split('@')[0]}\n`
}
XeonBotInc.sendMessage(m.chat, {
text: teks,
mentions: participants.map(a => a.id)
}, {
quoted: m
})
break
case 'hidetag':
if (!m.isGroup) return replygcxeon(mess.group)
if (!isAdmins && !isGroupOwner && !isCreator) return replygcxeon(mess.admin)
if (!isBotAdmins) return replygcxeon(mess.botAdmin)
XeonBotInc.sendMessage(m.chat, {
text: q ? q : '',
mentions: participants.map(a => a.id)
}, {
quoted: m
})
break
case 'totag':
if (!m.isGroup) return replygcxeon(mess.group)
if (!isBotAdmins) return replygcxeon(mess.botAdmin)
if (!isAdmins) return replygcxeon(mess.admin)
if (!m.quoted) return replygcxeon(`Reply messages with captions ${prefix + command}`)
XeonBotInc.sendMessage(m.chat, {
forward: m.quoted.fakeObj,
mentions: participants.map(a => a.id)
})
break
case 'group':
case 'grup':
if (!m.isGroup) return replygcxeon(mess.group)
if (!isAdmins && !isGroupOwner && !isCreator) return replygcxeon(mess.admin)
if (!isBotAdmins) return replygcxeon(mess.botAdmin)
if (args[0] === 'close') {
await XeonBotInc.groupSettingUpdate(m.chat, 'announcement').then((res) => replygcxeon(`Success In Closing The Group 🕊️`)).catch((err) => replygcxeon(json(err)))
} else if (args[0] === 'open') {
await XeonBotInc.groupSettingUpdate(m.chat, 'not_announcement').then((res) => replygcxeon(`Success In Opening The Group 🕊️`)).catch((err) => replygcxeon(json(err)))
} else {
replygcxeon(`Mode ${command}\n\n\nType ${prefix + command}open/close`)
}
break
case 'editinfo':
if (!m.isGroup) return replygcxeon(mess.group)
if (!isAdmins && !isGroupOwner && !isCreator) return replygcxeon(mess.admin)
if (!isBotAdmins) return replygcxeon(mess.botAdmin)
if (args[0] === 'open') {
await XeonBotInc.groupSettingUpdate(m.chat, 'unlocked').then((res) => replygcxeon(`Successfully Opened Group Edit Info 🕊️`)).catch((err) => replygcxeon(json(err)))
} else if (args[0] === 'close') {
await XeonBotInc.groupSettingUpdate(m.chat, 'locked').then((res) => replygcxeon(`Successfully Closed Group Edit Info🕊️`)).catch((err) => replygcxeon(json(err)))
} else {
replygcxeon(`Mode ${command}\n\n\nType ${prefix + command}on/off`)
}
break
case 'linkgroup':
case 'grouplink':
case 'linkgrup':
case 'linkgc':
if (!m.isGroup) return replygcxeon(mess.group)
if (!isAdmins && !isGroupOwner && !isCreator) return replygcxeon(mess.admin)
if (!isBotAdmins) return replygcxeon(mess.botAdmin)
let response = await XeonBotInc.groupInviteCode(m.chat)
XeonBotInc.sendText(m.chat, `👥 *GROUP LINK INFO*\n📛 *Name :* ${groupMetadata.subject}\n👤 *Group Owner :* ${groupMetadata.owner !== undefined ? '@' + groupMetadata.owner.split`@`[0] : 'Not known'}\n🌱 *ID :* ${groupMetadata.id}\n🔗 *Chat Link :* https://chat.whatsapp.com/${response}\n👥 *Member :* ${groupMetadata.participants.length}\n`, m, {
detectLink: true
})
break
case 'revoke':
case 'resetlink':
if (!m.isGroup) return replygcxeon(mess.group)
if (!isAdmins && !isGroupOwner && !isCreator) return replygcxeon(mess.admin)
if (!isBotAdmins) return replygcxeon(mess.botAdmin)
await XeonBotInc.groupRevokeInvite(m.chat)
.then(res => {
replygcxeon(`Successful Reset, Group Invite Link ${groupMetadata.subject}`)
}).catch((err) => replygcxeon(json(err)))
break
case 'p':
case 'ping':{
const used = process.memoryUsage()
const cpus = os.cpus().map(cpu => {
cpu.total = Object.keys(cpu.times).reduce((last, type) => last + cpu.times[type], 0)
return cpu
})
const cpu = cpus.reduce((last, cpu, _, {
length
}) => {
last.total += cpu.total
last.speed += cpu.speed / length
last.times.user += cpu.times.user
last.times.nice += cpu.times.nice
last.times.sys += cpu.times.sys
last.times.idle += cpu.times.idle
last.times.irq += cpu.times.irq
return last
}, {
speed: 0,
total: 0,
times: {
user: 0,
nice: 0,
sys: 0,
idle: 0,
irq: 0
}
})
let timestamp = speed()
let latensi = speed() - timestamp
neww = performance.now()
oldd = performance.now()
respon = `
Response Speed ${latensi.toFixed(4)} _Second_ \n ${oldd - neww} _miliseconds_\n\nRuntime : ${runtime(process.uptime())}
💻 Info Server
RAM: ${formatp(os.totalmem() - os.freemem())} / ${formatp(os.totalmem())}
_NodeJS Memory Usaage_
${Object.keys(used).map((key, _, arr) => `${key.padEnd(Math.max(...arr.map(v=>v.length)),' ')}: ${formatp(used[key])}`).join('\n')}
${cpus[0] ? `_Total CPU Usage_
${cpus[0].model.trim()} (${cpu.speed} MHZ)\n${Object.keys(cpu.times).map(type => `- *${(type + '*').padEnd(6)}: ${(100 * cpu.times[type] / cpu.total).toFixed(2)}%`).join('\n')}
_CPU Core(s) Usage (${cpus.length} Core CPU)_
${cpus.map((cpu, i) => `${i + 1}. ${cpu.model.trim()} (${cpu.speed} MHZ)\n${Object.keys(cpu.times).map(type => `- *${(type + '*').padEnd(6)}: ${(100 * cpu.times[type] / cpu.total).toFixed(2)}%`).join('\n')}`).join('\n\n')}` : ''}
`.trim()
await XeonBotInc.sendMessage(m.chat, {
text: respon,
contextInfo: {
externalAdReply: {
showAdAttribution: true,
title: `${botname}`,
body: `${latensi.toFixed(4)} Second`,
AbhinailUrl: 'hhttps://i.ibb.co/7bPPRQ0/4bf4b7e0b042.jpg',
sourceUrl: global.link,
mediaType: 1,
renderLargerAbhinail: true
}
}
}, {
quoted: m
})
}
break
case 'buypremium':
case 'buyprem':
case 'premium': {
let teks = `Hi ${pushname}👋\nWant to Buy Premium? Just chat with the owner😉`
await XeonBotInc.sendMessage(m.chat, {
text: teks,
contextInfo: {
externalAdReply: {
showAdAttribution: true,
title: `${botname}`,
body: `${ownername}`,
AbhinailUrl: 'https://i.ibb.co/7bPPRQ0/4bf4b7e0b042.jpg',
sourceUrl: global.link,
mediaType: 1,
renderLargerAbhinail: true
}
}
}, {
quoted: m
})
}
break
case 'runtime':
let runtimetext = `Bots Have Been Running For ${runtime(process.uptime())}`
XeonBotInc.sendMessage(m.chat, {
text: runtimetext,
contextInfo: {
externalAdReply: {
showAdAttribution: true,
title: `${botname}`,
body: `FORGET DONATE`,
AbhinailUrl: 'https://i.ibb.co/7bPPRQ0/4bf4b7e0b042.jpg',
sourceUrl: global.link,
mediaType: 1,
renderLargerAbhinail: true
}
}
}, {
quoted: m
})
break
case 'sc':
case 'script':
case 'repo':
case 'git':
XeonBotInc.sendMessage(m.chat, {
text: `*🎯𝙰𝙱𝙷𝙸-𝙱𝚄𝙶-𝙱𝙾𝚃 𝚂𝚌𝚛𝚒𝚙𝚝:* https://github.com/AbhishekSuresh2/ABHI-BUG-BOT`,
contextInfo: {
externalAdReply: {
showAdAttribution: true,
title: `${botname}`,
body: `SCRIPT OF ${botname} `,
AbhinailUrl: 'https://i.ibb.co/7bPPRQ0/4bf4b7e0b042.jpg',
sourceUrl: global.link,
mediaType: 1,
renderLargerAbhinail: true
}
}
}, {
quoted: m
})
break
case 'donate':
case 'donasi':
let textnate = `Hello Brother ${pushname}\n\nNot Need Money I Just Need Your Support❤`
XeonBotInc.sendMessage(m.chat, {
image: fs.readFileSync('./Media/donate.jpg'),
caption: textnate
}, {
quoted: m
})
break
case 'owner': {
const repf = await XeonBotInc.sendMessage(from, {
contacts: {
displayName: `${list.length} Contact`,
contacts: list }, mentions: [sender] }, { quoted: m })
XeonBotInc.sendMessage(from, { text : `Hi @${sender.split("@")[0]}, Here Is My Owner😊`, mentions: [sender]}, { quoted: repf })
}
break
case 'sticker':
case 'stiker':
case 's': {
if (!quoted) return replygcxeon(`Reply to Video/Image With Caption ${prefix + command}`)
if (/image/.test(mime)) {
let media = await quoted.download()
let encmedia = await XeonBotInc.sendImageAsSticker(m.chat, media, m, {
packname: packname,
author: author
})
await fs.unlinkSync(encmedia)
} else if (isVideo || /video/.test(mime)) {
if ((quoted.msg || quoted).seconds > 11) return replygcxeon('Maximum 10 seconds!')
let media = await quoted.download()
let encmedia = await XeonBotInc.sendVideoAsSticker(m.chat, media, m, {
packname: packname,
author: author
})
await fs.unlinkSync(encmedia)
} else {
return replygcxeon(`Send Images/Videos With Captions ${prefix + command}\nVideo Duration 1-9 Seconds`)
}