-
Notifications
You must be signed in to change notification settings - Fork 35
/
index.js
1039 lines (979 loc) ยท 49.1 KB
/
index.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
{
WAConnection,
MessageType,
Presence,
MessageOptions,
Mimetype,
WALocationMessage,
WA_MESSAGE_STUB_TYPES,
ReconnectMode,
ProxyAgent,
GroupSettingChange,
waChatKey,
mentionedJid,
processTime,
} = require("@adiwajshing/baileys")
const qrcode = require("qrcode-terminal")
const moment = require("moment-timezone")
const fs = require("fs")
const { color, bgcolor } = require('./lib/color')
const { help } = require('./lib/help')
const { donasi } = require('./lib/donasi')
const { fetchJson } = require('./lib/fetcher')
const { recognize } = require('./lib/ocr')
const { wait, simih, getBuffer, h2k, generateMessageID, getGroupAdmins, getRandom, banner, start, info, success, close } = require('./lib/functions')
const ffmpeg = require('fluent-ffmpeg')
const { removeBackgroundFromImageFile } = require('remove.bg')
const welkom = JSON.parse(fs.readFileSync('./src/welkom.json'))
const nsfw = JSON.parse(fs.readFileSync('./src/nsfw.json'))
const samih = JSON.parse(fs.readFileSync('./src/simi.json'))
// API KEY
const apiKey = 'APIKEY' // get in https://mhankbarbar.tech/api
const tobzkey = 'BotWeA'// GET IN https://tobz-api.herokuapp.com/api
const vhtearkey = 'APIKEY'// GET IN https://api.vhtear.com/
const zekskey = 'apivinz' //GET IN https://api.zeks.xyz
const techkey = 'APIKEY' //GET IN https://api.i-tech.id
const vcard = 'BEGIN:VCARD\n'
+ 'VERSION:3.0\n'
+ 'FN:Ownerbot\n'
+ 'ORG:Creator SELF BOT;\n'
+ 'TEL;type=CELL;type=VOICE;waid=6285959375675:+62 877-7545-2636\n'
+ 'END:VCARD'
prefix = '!'
blocked = []
const time = moment().tz('Asia/Jakarta').format("HH:mm:ss")
const arrayBulan = ['Januari', 'Februari', 'Maret', 'April', 'Mei', 'Juni', 'Juli', 'Agustus', 'September', 'Oktober', 'November', 'Desember']
const bulan = arrayBulan[moment().format('MM') - 1]
function kyun(seconds){
function pad(s){
return (s < 10 ? '0' : '') + s;
}
var hours = Math.floor(seconds / (60*60));
var minutes = Math.floor(seconds % (60*60) / 60);
var seconds = Math.floor(seconds % 60);
//return pad(hours) + ':' + pad(minutes) + ':' + pad(seconds)
return `${pad(hours)}H, ${pad(minutes)}Min, ${pad(seconds)}Sec `
}
function monospace(string) {
return '```' + string + '```'
}
const { exec } = require("child_process")
const hafizh = new WAConnection()
hafizh.on('qr', qr => {
qrcode.generate(qr, { small: true })
console.log(`[ ${time} ] QR code is ready`)
})
hafizh.on('credentials-updated', () => {
const authInfo = hafizh.base64EncodedAuthInfo()
console.log(`credentials updated!`)
fs.writeFileSync('./session.json', JSON.stringify(authInfo, null, '\t'))
})
fs.existsSync('./session.json') && hafizh.loadAuthInfo('./session.json')
hafizh.connect();
// hafizh.on('user-presence-update', json => console.log(json.id + ' presence is => ' + json.type)) || console.log(`${time}: Bot by ig:@kingg_squard028`)
hafizh.on('group-participants-update', async (anu) => {
if (!welkom.includes(anu.jid)) return
try {
const mdata = await hafizh.groupMetadata(anu.jid)
console.log(anu)
if (anu.action == 'add') {
num = anu.participants[0]
try {
ppimg = await hafizh.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'
}
teks = `@${num.split('@')[0]}\nwelcome to group *${mdata.subject}* semoga betah`
let buff = await getBuffer(ppimg)
hafizh.sendMessage(mdata.id, buff, MessageType.image, {caption: teks, contextInfo: {"mentionedJid": [num]}})
} else if (anu.action == 'remove') {
num = anu.participants[0]
try {
ppimg = await hafizh.getProfilePicture(`${num.split('@')[0]}@c.us`)
} catch {
ppimg = 'https://i0.wp.com/www.gambarunik.id/wp-content/uploads/2019/06/Top-Gambar-Foto-Profil-Kosong-Lucu-Tergokil-.jpg'
}
teks = `alhamdulillah, beban hilang 1 @${num.split('@')[0]} `
let buff = await getBuffer(ppimg)
hafizh.sendMessage(mdata.id, buff, MessageType.image, {caption: teks, contextInfo: {"mentionedJid": [num]}})
}
} catch (e) {
console.log('Error : %s', color(e, 'red'))
}
})
hafizh.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'))
}
})
hafizh.on('message-new', async (tod) => {
try {
if (!tod.message) return
if (tod.key && tod.key.remoteJid == 'status@broadcast') return
if (!tod.key.fromMe) return
global.prefix
global.blocked
const content = JSON.stringify(tod.message)
const from = tod.key.remoteJid
const type = Object.keys(tod.message)[0]
const { text, extendedText, contact, location, liveLocation, image, video, sticker, document, audio, product } = MessageType
const time = moment.tz('Asia/Jakarta').format('DD/MM HH:mm:ss')
body = (type === 'conversation' && tod.message.conversation.startsWith(prefix)) ? tod.message.conversation : (type == 'imageMessage') && tod.message.imageMessage.caption.startsWith(prefix) ? tod.message.imageMessage.caption : (type == 'videoMessage') && tod.message.videoMessage.caption.startsWith(prefix) ? tod.message.videoMessage.caption : (type == 'extendedTextMessage') && tod.message.extendedTextMessage.text.startsWith(prefix) ? tod.message.extendedTextMessage.text : ''
budy = (type === 'conversation') ? tod.message.conversation : (type === 'extendedTextMessage') ? tod.message.extendedTextMessage.text : ''
const command = body.slice(1).trim().split(/ +/).shift().toLowerCase()
const args = body.trim().split(/ +/).slice(1)
const isCmd = body.startsWith(prefix)
mess = {
wait: 'Loading...',
success: '๏ธsuccess โ ',
error: {
stick: 'error gan',
Iv: 'Link ga valid gan'
},
only: {
group: 'only gc',
ownerG: 'only owner gc',
ownerB: 'only owner bot',
admin: 'only admin gc',
Badmin: 'jadikan ot admin udin'
}
}
const botNumber = hafizh.user.jid
const ownerNumber = ["6285959375675@s.whatsapp.net"] // ganti nomer lu
const isGroup = from.endsWith('@g.us')
const sender = isGroup ? tod.participant : tod.key.remoteJid
const groupMetadata = isGroup ? await hafizh.groupMetadata(from) : ''
const groupName = isGroup ? groupMetadata.subject : ''
const groupId = isGroup ? groupMetadata.jid : ''
const groupMembers = isGroup ? groupMetadata.participants : ''
const groupAdmins = isGroup ? getGroupAdmins(groupMembers) : ''
const isBotGroupAdmins = groupAdmins.includes(botNumber) || false
const isGroupAdmins = groupAdmins.includes(sender) || false
const isWelkom = isGroup ? welkom.includes(from) : false
const isNsfw = isGroup ? nsfw.includes(from) : false
const isSimi = isGroup ? samih.includes(from) : false
const isOwner = ownerNumber.includes(sender)
const isUrl = (url) => {
return url.match(new RegExp(/https?:\/\/(www\.)?[-a-zA-Z0-9@:%._+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()@:%_+.~#?&/=]*)/, 'gi'))
}
const reply = (teks) => {
hafizh.sendMessage(from, teks, text, {quoted:tod})
}
const sendMess = (hehe, teks) => {
hafizh.sendMessage(hehe, teks, text)
}
const mentions = (teks, memberr, id) => {
(id == null || id == undefined || id == false) ? hafizh.sendMessage(from, teks.trim(), extendedText, {contextInfo: {"mentionedJid": memberr}}) : hafizh.sendMessage(from, teks.trim(), extendedText, {quoted: tod, contextInfo: {"mentionedJid": memberr}})
}
colors = ['red','white','black','blue','yellow','green']
const isMedia = (type === 'imageMessage' || type === 'videoMessage')
const isQuotedImage = type === 'extendedTextMessage' && content.includes('imageMessage')
const isQuotedVideo = type === 'extendedTextMessage' && content.includes('videoMessage')
const isQuotedSticker = type === 'extendedTextMessage' && content.includes('stickerMessage')
if (!isGroup && isCmd) console.log('\x1b[1;31m~\x1b[1;37m>', '[\x1b[1;32mEXEC\x1b[1;37m]', time, color(command), 'from', color(sender.split('@')[0]), 'args :', color(args.length))
if (isCmd && isGroup) console.log('\x1b[1;31m~\x1b[1;37m>', '[\x1b[1;32mEXEC\x1b[1;37m]', time, color(command), 'from', color(sender.split('@')[0]), 'in', color(groupName), 'args :', color(args.length))
switch(command) {
case 'help':
case 'menu':
hafizh.sendMessage(from, `${monospace(help(prefix))}`, text)
break
case 'donasi':
case 'donate':
hafizh.sendMessage(from, donasi(), text)
break
case 'info':
me = hafizh.user
uptime = process.uptime()
teks = `๐ก๐ฎ๐บ๐ฎ ๐ฏ๐ผ๐ : ${me.name}\n*๐ก๐ผ๐บ๐ฒ๐ฟ ๐ฏ๐ผ๐* : @${me.jid.split('@')[0]}\n*๐ฃ๐ฟ๐ฒ๐ณ๐ถ๐
* : ${prefix}\n๐ง๐ผ๐๐ฎ๐น ๐๐น๐ผ๐ฐ๐ธ ๐๐ผ๐ป๐๐ฎ๐ฐ๐ : ${blocked.length}\n๐ง๐ต๐ฒ ๐ฏ๐ผ๐ ๐ถ๐ ๐ฎ๐ฐ๐๐ถ๐๐ฒ ๐ผ๐ป : ${kyun(uptime)}`
buffer = await getBuffer(me.imgUrl)
hafizh.sendMessage(from, buffer, image, {caption: teks, contextInfo:{mentionedJid: [me.jid]}})
break
case 'runtime':
runtime = process.uptime()
teks = `${monospace(`Runtime:\nโช ${kyun(runtime)}`)}`
hafizh.sendMessage(from, `${teks}`, MessageType.text, {quoted: tod})
break
case 'xl':
data = await fetchJson(`https://api.i-tech.id/tagihan/xl?key=${techkey}&no=${body.slice(4)}`)
teks = `Nomor: ${data.nomor}\nNama: ${data.nama}\nTotal: ${data.total}\nStatus: ${data.status}\ntagihan: ${data.lembar_tagihan}`
hafizh.sendMessage(from, `${teks}`, MessageType.text, {quoted: tod})
break
case 'bass':
encmedia = JSON.parse(JSON.stringify(tod).replace('quotedM','m')).message.extendedTextMessage.contextInfo
media = await hafizh.downloadAndSaveMediaMessage(encmedia)
ran = getRandom('.mp3')
exec(`ffmpeg -i ${media} -af equalizer=f=64:width_type=o:width=2:g=56 ${ran}`, (err, stderr, stdout) => {
fs.unlinkSync(media)
if (err) return reply('Error!')
hah = fs.readFileSync(ran)
hafizh.sendMessage(from, hah, audio, {mimetype: 'audio/mp4', ptt:true, quoted: tod})
fs.unlinkSync(ran)
})
break
case 'halo':
data = await fetchJson(`https://api.i-tech.id/tagihan/halo?key=${techkey}&no=${body.slice(6)}`)
teks = `Nomor: ${data.nomor}\nNama: ${data.nama}\nTotal: ${data.total}\nStatus: ${data.status}\ntagihan: ${data.lembar_tagihan}`
client.sendMessage(from, `${teks}`, MessageType.text, {quoted: tod})
break
case 'gas':
data = await fetchJson(`https://api.i-tech.id/tagihan/gas?key=${techkey}&no=${body.slice(5)}`)
teks = `Nomor: ${data.nomor}\nNama: ${data.nama}\nTotal: ${data.total}\nStatus: ${data.status}\ntagihan: ${data.lembar_tagihan}`
hafizh.sendMessage(from, `${teks}`, MessageType.text, {quoted: tod})
break
case 'readall':
if (!isOwner)return reply(mess.only.ownerB)
var chats = await hafizh.chats.all()
chats.map( async ({ jid }) => {
await hafizh.chatRead(jid)
})
teks = `\`\`\`Berhasil membaca ${chats.length} Chat !\`\`\``
await hafizh.sendMessage(from, teks, MessageType.text, {quoted: tod})
console.log(chats.length)
break
case 'setstatus':
hafizh.setStatus(`${body.slice(11)}`)
.then(data => {
reply(JSON.stringify(data))
}).catch(err => console.log(err))
break
case 'cgc':
var gc = body.slice(5)
mentioned = mek.message.extendedTextMessage.contextInfo.mentionedJid
hafizh.groupCreate (`${gc}`, [`${sender}`, `${mentioned}`])
console.log ("created group with id: " + group.gid)
break
case 'blocklist':
teks = 'BLOCK LIST :\n'
for (let block of blocked) {
teks += `โฃโข @${block.split('@')[0]}\n`
}
teks += `๐ง๐ผ๐๐ฎ๐น : ${blocked.length}`
hafizh.sendMessage(from, teks.trim(), extendedText, {quoted: tod, contextInfo: {"mentionedJid": blocked}})
break
case 'fordward':
hafizh.sendMessage(from, `${body.slice(10)}`, MessageType.text, {contextInfo: { forwardingScore: 508, isForwarded: true }})
break
case 'fordward1':
hafizh.sendMessage(from, `${body.slice(11)}`, MessageType.text, {contextInfo: { forwardingScore: 2, isForwarded: true }})
break
case 'moddroid':
data = await fetchJson(`https://tobz-api.herokuapp.com/api/moddroid?q=${body.slice(10)}&apikey=${tobzkey}`)
hepi = data.result[0]
teks = `*Nama*: ${data.result[0].title}\n*publisher*: ${hepi.publisher}\n*mod info:* ${hepi.mod_info}\n*size*: ${hepi.size}\n*latest version*: ${hepi.latest_version}\n*genre*: ${hepi.genre}\n*link:* ${hepi.link}\n*download*: ${hepi.download}`
buff = await getBuffer(hepi.image)
hafizh.sendMessage(from, buff, image, {quoted: tod, caption: `${teks}`})
break
case 'film':
data = await fetchJson(`https://api.zeks.xyz/api/film?q=${body.slice(6)}&apikey=${zekskey}`)
teks = '\n'
for (let i of data.result) {
teks += `Judul: ${i.tile}\nLink: ${i.url}`
buffs = await getBufer(data.result[0].thumb)
hafizh.sendMessage(from, buffs, image, {quoted: tod, caption: teks})
}
break
case 'setstatus':
client.setStatus(`${body.slice(11)}`)
.then(data => {
reply(JSON.stringify(data))
}).catch(err => console.log(err))
break
case 'toptt':
reply(mess.wait)
encmedia = JSON.parse(JSON.stringify(tod).replace('quotedM','m')).message.extendedTextMessage.contextInfo
media = await client.downloadAndSaveMediaMessage(encmedia)
ran = getRandom('.mp3')
exec(`ffmpeg -i ${media} ${ran}`, (err) => {
fs.unlinkSync(media)
if (err) return reply('Gagal mengkonversi audio ke ptt')
topt = fs.readFileSync(ran)
hafizh.sendMessage(from, topt, audio, {mimetype: 'audio/mp4', quoted: tod, ptt:true})
})
break
case 'randomquran':
data = await fetchJson(`https://api.zeks.xyz/api/randomquran`)
teks = `Nama: ${data.result.nama}\nArti: ${data.result.arti}\nayat: ${data.result.ayat}\nAsma: ${data.result.asma}\nRukuk: ${data.result.rukuk}\nNomor: ${data.result.nomor}\nType: ${data.result.type}\nKeterangan: ${data.result.keterangan}`
buffs = await getBuffer(data.result.audio)
hafizh.sendMessage(from, `${teks}`, MessageType.text, {quoted: tod})
hafizh.sendMessage(from, buffs, audio, {mimetype: 'audio/mp4', filename: `quran.mp3`, quoted: tod})
break
case 'speed':
const timestamp = speed();
const latensi = speed() - timestamp
const pingnya = `${teks}\nSpeed: ${latensi.toFixed(4)} Second`
hafizh.sendMessage(from, `Speed: ${latensi.toFixed(4)} Second\n\n`, MessageType.text, {quoted: tod})
break
case 'ocr':
if ((isMedia && !tod.message.videoMessage || isQuotedImage) && args.length == 0) {
const encmedia = isQuotedImage ? JSON.parse(JSON.stringify(tod).replace('quotedM','m')).message.extendedTextMessage.contextInfo : tod
const media = await hafizh.downloadAndSaveMediaMessage(encmedia)
reply(mess.wait)
await recognize(media, {lang: 'eng+ind', oem: 1, psm: 3})
.then(teks => {
reply(teks.trim())
fs.unlinkSync(media)
})
.catch(err => {
reply(err.message)
fs.unlinkSync(media)
})
} else {
reply(`๐ธ๐ถ๐ฟ๐ถ๐บ ๐ณ๐ผ๐๐ผ ๐ฑ๐ฒ๐ป๐ด๐ฎ๐ป ๐ฐ๐ฎ๐ฝ๐๐ถ๐ผ๐ป ${prefix}๐ผ๐ฐ๐ฟ`)
}
break
case 'fml':
data = await fetchJson(`https://api.zeks.xyz/api/fml`)
teks = `Fml: ${data.result}`
hafizh.sendMessage(from, `${teks}`, MessageType.text, {quoted: tod})
break
case 'stiker':
case 'sticker':
case 's':
if ((isMedia && !tod.message.videoMessage || isQuotedImage) && args.length == 0) {
const encmedia = isQuotedImage ? JSON.parse(JSON.stringify(tod).replace('quotedM','m')).message.extendedTextMessage.contextInfo : tod
const media = await hafizh.downloadAndSaveMediaMessage(encmedia)
ran = getRandom('.webp')
await ffmpeg(`./${media}`)
.input(media)
.on('start', function (cmd) {
console.log(`Started : ${cmd}`)
})
.on('error', function (err) {
console.log(`Error : ${err}`)
fs.unlinkSync(media)
reply(mess.error.stick)
})
.on('end', function () {
console.log('Finish')
buff = fs.readFileSync(ran)
hafizh.sendMessage(from, buff, sticker, {quoted: tod})
fs.unlinkSync(media)
fs.unlinkSync(ran)
})
.addOutputOptions([`-vcodec`,`libwebp`,`-vf`,`scale='min(320,iw)':min'(320,ih)':force_original_aspect_ratio=decrease,fps=15, pad=320:320:-1:-1:color=white@0.0, split [a][b]; [a] palettegen=reserve_transparent=on:transparency_color=ffffff [p]; [b][p] paletteuse`])
.toFormat('webp')
.save(ran)
} else if ((isMedia && tod.message.videoMessage.seconds < 11 || isQuotedVideo && tod.message.extendedTextMessage.contextInfo.quotedMessage.videoMessage.seconds < 11) && args.length == 0) {
const encmedia = isQuotedVideo ? JSON.parse(JSON.stringify(tod).replace('quotedM','m')).message.extendedTextMessage.contextInfo : tod
const media = await hafizh.downloadAndSaveMediaMessage(encmedia)
ran = getRandom('.webp')
reply(mess.wait)
await ffmpeg(`./${media}`)
.inputFormat(media.split('.')[1])
.on('start', function (cmd) {
console.log(`Started : ${cmd}`)
})
.on('error', function (err) {
console.log(`Error : ${err}`)
fs.unlinkSync(media)
tipe = media.endsWith('.mp4') ? 'video' : 'gif'
reply(`๐ฌ๐ฎ๐ต ๐ด๐ฎ๐ด๐ฎ๐น, ๐๐น๐ฎ๐ป๐ด๐ถ ๐น๐ฎ๐ด๐ถ ๐๐ฎ ๐๐ฎ๐๐ฎ๐ป๐ด`)
})
.on('end', function () {
console.log('Finish')
buff = fs.readFileSync(ran)
hafizh.sendMessage(from, buff, sticker, {quoted: tod})
fs.unlinkSync(media)
fs.unlinkSync(ran)
})
.addOutputOptions([`-vcodec`,`libwebp`,`-vf`,`scale='min(320,iw)':min'(320,ih)':force_original_aspect_ratio=decrease,fps=15, pad=320:320:-1:-1:color=white@0.0, split [a][b]; [a] palettegen=reserve_transparent=on:transparency_color=ffffff [p]; [b][p] paletteuse`])
.toFormat('webp')
.save(ran)
} else if ((isMedia || isQuotedImage) && args[0] == 'nobg') {
const encmedia = isQuotedImage ? JSON.parse(JSON.stringify(tod).replace('quotedM','m')).message.extendedTextMessage.contextInfo : tod
const media = await hafizh.downloadAndSaveMediaMessage(encmedia)
ranw = getRandom('.webp')
ranp = getRandom('.png')
reply(mess.wait)
keyrmbg = 'Your-ApiKey'
await removeBackgroundFromImageFile({path: media, apiKey: keyrmbg.result, size: 'auto', type: 'auto', ranp}).then(res => {
fs.unlinkSync(media)
let buffer = Buffer.from(res.base64img, 'base64')
fs.writeFileSync(ranp, buffer, (err) => {
if (err) return reply('๐ฌ๐ฎ๐ต ๐ด๐ฎ๐ด๐ฎ๐น, ๐๐น๐ฎ๐ป๐ด๐ถ ๐น๐ฎ๐ด๐ถ ๐๐ฎ ๐๐ฎ๐๐ฎ๐ป๐ด')
})
exec(`ffmpeg -i ${ranp} -vcodec libwebp -filter:v fps=fps=20 -lossless 1 -loop 0 -preset default -an -vsync 0 -s 512:512 ${ranw}`, (err) => {
fs.unlinkSync(ranp)
if (err) return reply(mess.error.stick)
buff = fs.readFileSync(ranw)
hafizh.sendMessage(from, buff, sticker, {quoted: tod})
})
})
} else {
reply(`๐ธ๐ถ๐ฟ๐ถ๐บ ๐ด๐ฎ๐บ๐ฏ๐ฎ๐ฟ ๐ฑ๐ฒ๐ป๐ด๐ฎ๐ป ๐ฐ๐ฎ๐ฝ๐๐ถ๐ผ๐ป ${prefix}๐๐๐ถ๐ฐ๐ธ๐ฒ๐ฟ ๐ฎ๐๐ฎ๐ ๐ฟ๐ฒ๐ฝ๐น๐/๐๐ฎ๐ด ๐ด๐ฎ๐บ๐ฏ๐ฎ๐ฟ`)
}
break
case 'gtts':
case 'tts':
if (args.length < 1) return hafizh.sendMessage(from, '๐ฑ๐ถ๐ฝ๐ฒ๐ฟ๐น๐๐ธ๐ฎ๐ป ๐ธ๐ผ๐ฑ๐ฒ ๐ฏ๐ฎ๐ต๐ฎ๐๐ฎ!', text, {quoted: tod})
const gtts = require('./lib/gtts')(args[0])
if (args.length < 2) return hafizh.sendMessage(from, '๐ง๐ฒ๐ธ๐ ๐บ๐ฎ๐ป๐ฎ ๐๐ฒ๐ธ๐?', text, {quoted: tod})
dtt = body.slice(9)
ranm = getRandom('.mp3')
rano = getRandom('.ogg')
dtt.length > 300
? reply('๐๐ฒ๐ธ๐๐ป๐๐ฎ ๐ท๐ฎ๐ป๐ด๐ฎ๐ป ๐ธ๐ฒ๐ฝ๐ฎ๐ป๐ท๐ฎ๐ป๐ด๐ฎ๐ป')
: gtts.save(ranm, dtt, function() {
exec(`ffmpeg -i ${ranm} -ar 48000 -vn -c:a libopus ${rano}`, (err) => {
fs.unlinkSync(ranm)
buff = fs.readFileSync(rano)
if (err) return reply('๐ฌ๐ฎ๐ต ๐ด๐ฎ๐ด๐ฎ๐น, ๐๐น๐ฎ๐ป๐ด๐ถ ๐น๐ฎ๐ด๐ถ ๐๐ฎ ๐๐ฎ๐๐ฎ๐ป๐ด')
hafizh.sendMessage(from, buff, audio, {quoted: tod, ptt:true})
fs.unlinkSync(rano)
})
})
break
case 'setprefix':
if (args.length < 1) return
prefix = args[0]
reply(`๐ฃ๐ฟ๐ฒ๐ณ๐ถ๐
๐ฏ๐ฒ๐ฟ๐ต๐ฎ๐๐ถ๐น ๐ฑ๐ถ ๐๐ฏ๐ฎ๐ต ๐บ๐ฒ๐ป๐ท๐ฎ๐ฑ๐ถ : ${prefix}`)
break
case 'pussy':
ranp = getRandom('.gif')
rano = getRandom('.webp')
anu = await fetchJson('https://nekos.life/api/v2/img/pussy', {method: 'get'})
if (anu.error) return reply(anu.error)
exec(`wget ${anu.url} -O ${ranp} && ffmpeg -i ${ranp} -vcodec libwebp -filter:v fps=fps=15 -lossless 1 -loop 0 -preset default -an -vsync 0 -s 512:512 ${rano}`, (err) => {
fs.unlinkSync(ranp)
if (err) return reply(mess.error.stick)
buffer = fs.readFileSync(rano)
hafizh.sendMessage(from, buffer, sticker, {quoted: tod})
fs.unlinkSync(rano)
})
break
case 'nsfwgif':
ranp = getRandom('.gif')
rano = getRandom('.webp')
anu = await fetchJson('https://nekos.life/api/v2/img/nsfw_neko_gif', {method: 'get'})
if (anu.error) return reply(anu.error)
exec(`wget ${anu.url} -O ${ranp} && ffmpeg -i ${ranp} -vcodec libwebp -filter:v fps=fps=15 -lossless 1 -loop 0 -preset default -an -vsync 0 -s 512:512 ${rano}`, (err) => {
fs.unlinkSync(ranp)
if (err) return reply(mess.error.stick)
buffer = fs.readFileSync(rano)
hafizh.sendMessage(from, buffer, sticker, {quoted: tod})
fs.unlinkSync(rano)
})
break
case 'tabok':
ranp = getRandom('.gif')
rano = getRandom('.webp')
anu = await fetchJson('https://nekos.life/api/v2/img/spank', {method: 'get'})
if (anu.error) return reply(anu.error)
exec(`wget ${anu.url} -O ${ranp} && ffmpeg -i ${ranp} -vcodec libwebp -filter:v fps=fps=15 -lossless 1 -loop 0 -preset default -an -vsync 0 -s 512:512 ${rano}`, (err) => {
fs.unlinkSync(ranp)
if (err) return reply(mess.error.stick)
buffer = fs.readFileSync(rano)
hafizh.sendMessage(from, buffer, sticker, {quoted: tod})
fs.unlinkSync(rano)
})
break
case 'kiss':
ranp = getRandom('.gif')
rano = getRandom('.webp')
anu = await fetchJson('https://nekos.life/api/v2/img/kiss', {method: 'get'})
if (anu.error) return reply(anu.error)
exec(`wget ${anu.url} -O ${ranp} && ffmpeg -i ${ranp} -vcodec libwebp -filter:v fps=fps=15 -lossless 1 -loop 0 -preset default -an -vsync 0 -s 512:512 ${rano}`, (err) => {
fs.unlinkSync(ranp)
if (err) return reply(mess.error.stick)
buffer = fs.readFileSync(rano)
hafizh.sendMessage(from, buffer, sticker, {quoted: tod})
fs.unlinkSync(rano)
})
break
case 'meme':
meme = await kagApi.memes()
buffer = await getBuffer(`https://imgur.com/${meme.hash}.jpg`)
hafizh.sendMessage(from, buffer, image, {quoted: tod, caption: '.......'})
break
case 'memeindo':
memein = await kagApi.memeindo()
buffer = await getBuffer(`https://imgur.com/${memein.hash}.jpg`)
hafizh.sendMessage(from, buffer, image, {quoted: tod, caption: '.......'})
break
case 'ssphone':
buff = await getBuffer(`https://api.vhtear.com/ssweb?link=${body.slice(9)}&type=phone&apikey=${vhtearkey}`)
hafizh.sendMessage(from, buff, image, {quoted: tod})
break
case 'sspc':
buff = await getBuffer(`https://api.vhtear.com/ssweb?link=${body.slice(6)}&type=pc&apikey=${vhtearkey}`)
hafizh.sendMessage(from, buff, image, {quoted: tod})
break
case 'puisi':
buff = await getBuffer(`https://api.vhtear.com/puisi_image&apikey=${vhtearkey}`)
hafizh.sendMessage(from, buff, image, {quoted: tod})
break
case 'kapankah':
const kapan1 = body.slice(1)
const kapan2 = [
'Hari ini',
'Mungkin besok',
'1 Minggu lagi',
'Masih lama',
'3 Bulan lagi',
'7 Bulan lagi',
'3 Tahun lagi',
'4 Bulan lagi',
'2 Bulan lagi',
'1 Tahun lagi',
'1 Bulan lagi',
'Coba ulangi',
]
const kpnkh = kapan2[Math.floor(Math.random() * (kapan2.length))]
const jawab1 = `Pertanyaan : *${kapan1}*\n\nJawaban: ${kpnkh}`
hafizh.sendMessage(from, jawab1, text, {quoted: tod})
break
case 'apakah':
const tanya = body.slice(1)
const apa = [
'Ya',
'Mungkin',
'Tidak',
'Coba Ulangi',
]
const apkh = apa[Math.floor(Math.random() * (apa.length))]
const jawab = `Pertanyaan : *${tanya}*\n\nJawaban: ${apkh}`
hafizh.sendMessage(from, jawab, text, {quoted: tod})
break
case 'darkjoke':
data = await fetchJson(`https://api.zeks.xyz/api/darkjokes?apikey=${zekskey}`)
dark = data.result
thumb = await getBuffer(dark)
hafizh.sendMessage(from, thumb, image, {quoted: tod})
break
case 'memeind':
data = await fetchJson(`https://api.zeks.xyz/api/memeindo?apikey=${zekskey}`)
dark = data.result
thumb = await getBuffer(dark)
hafizh.sendMessage(from, thumb, image, {quoted: tod})
break
case 'harta':
buff = await getBuffer(`https://api.vhtear.com/hartatahta?text=${body.slice(7)}&apikey=${vhtearkey}`)
hafizh.sendMessage(from, buff, image, {quoted: tod})
break
case 'lovetext':
buff = await getBuffer(`https://api.vhtear.com/lovemessagetext?text=${body.slice(10)}&apikey=${vhtearkey}`)
hafizh.sendMessage(from, buff, image, {quoted: tod})
break
case 'loli':
try {
res = await fetchJson(`https://api.lolis.life/random`, {method: 'get'})
buffer = await getBuffer(res.url)
hafizh.sendMessage(from, buffer, image, {quoted: tod, caption: 'ingat! Cintai lolimu'})
} catch (e) {
console.log(`Error :`, color(e,'red'))
reply('๐๐ฅ๐ฅ๐ข๐ฅ')
}
break
case 'nsfwloli':
try {
if (!isNsfw) return reply('๐ ๐ฎ๐ฎ๐ณ ๐ณ๐ถ๐๐๐ฟ ๐ถ๐ป๐ถ ๐ฏ๐ฒ๐น๐๐บ ๐ฑ๐ถ ๐ฎ๐ธ๐๐ถ๐ณ๐ธ๐ฎ๐ป/๐ธ๐ฒ๐๐ฎ๐น๐ฎ๐ต๐ฎ๐ป ๐๐ฒ๐ฟ๐๐ฒ๐ฟ๐ป๐๐ฎ')
res = await fetchJson(`https://api.lolis.life/random?nsfw=true`, {method: 'get'})
buffer = await getBuffer(res.url)
hafizh.sendMessage(from, buffer, image, {quoted: tod, caption: 'Jangan jadiin bahan buat comli'})
} catch (e) {
console.log(`Error :`, color(e,'red'))
reply('๐๐ฅ๐ฅ๐ข๐ฅ')
}
break
case 'holoh':
if (args.length < 1) return reply('๐ธ๐ฎ๐๐ถ๐ต ๐๐ฒ๐ธ๐ ๐น๐ฎ๐ต!!!')
anu = await fetchJson(`https://shirayuki-api.herokuapp.com/api/v1/holoh?kata=${body.slice(7)}`, {method: 'get'})
reply(anu.result)
break
case 'terbalik':
if (args.length < 1) return reply('๐ธ๐ฎ๐๐ถ๐ต ๐๐ฒ๐ธ๐ ๐น๐ฎ๐ต!!!')
meki = await fetchJson(`https://videfikri.com/api/hurufterbalik/?query=${body.slice(10)}`)
hafizh.sendMessage(from, `Input: ${body.slice(10)}\nOutput: ${meki.result.kata}`, MessageType.text, {quoted: tod})
break
case 'huruf':
if (args.length < 1) return reply('๐ธ๐ฎ๐๐ถ๐ต ๐๐ฒ๐ธ๐ ๐น๐ฎ๐ต!!!')
meki = await fetchJson(`https://videfikri.com/api/jumlahhuruf/?query=${body.slice(7)}`)
client.sendMessage(from, `Input: ${body.slice(7)}\nJumlah Huruf: ${meki.result.jumlah}`, MessageType.text, {quoted: tod})
break
case 'hilih':
if (args.length < 1) return reply('๐ธ๐ฎ๐๐ถ๐ต ๐๐ฒ๐ธ๐ ๐น๐ฎ๐ต!!!')
anu = await fetchJson(`https://mhankbarbar.tech/api/hilih?teks=${body.slice(7)}`, {method: 'get'})
reply(anu.result)
break
case 'yt':
if (args.length < 1) return reply('๐๐ฟ๐น๐ป๐๐ฎ ๐บ๐ฎ๐ป๐ฎ?')
if(!isUrl(args[0]) && !args[0].includes('youtube.com')) return reply(mess.error.Iv)
anu = await fetchJson(`https://mhankbarbar.tech/api/yta?url=${args[0]}&apiKey=${apikey}`, {method: 'get'})
if (anu.error) return reply(anu.error)
teks = `*Title* : ${anu.title}\n*Filesize* : ${anu.filesize}`
thumb = await getBuffer(anu.thumb)
hafizh.sendMessage(from, thumb, image, {quoted: tod, caption: teks})
buffer = await getBuffer(anu.result)
hafizh.sendMessage(from, buffer, audio, {mimetype: 'audio/mp4', filename: `${anu.title}.mp3`, quoted: tod})
break
case 'ytsearch':
if (args.length < 1) return reply('๐ง๐ฒ๐ธ๐๐ป๐๐ฎ ๐บ๐ฎ๐ป๐ฎ ๐๐ฒ๐ธ๐?')
anu = await fetchJson(`https://mhankbarbar.tech/api/ytsearch?q=${body.slice(10)}&apiKey=${apikey}`, {method: 'get'})
if (anu.error) return reply(anu.error)
teks = '=================\n'
for (let i of anu.result) {
teks += `*Title* : ${i.title}\n*Id* : ${i.id}\n*Published* : ${i.publishTime}\n*Duration* : ${i.duration}\n*Views* : ${h2k(i.views)}\n=================\n`
}
reply(teks.trim())
break
case 'yt2mp3':
if (args.length < 1) return reply('Urlnya mana um?')
if(!isUrl(args[0]) && !args[0].includes('youtu')) return reply(mess.error.Iv)
anu = await fetchJson(`https://mhankbarbar.tech/api/yta?url=${args[0]}&apiKey=${apikey}`, {method: 'get'})
if (anu.error) return reply(anu.error)
teks = `*Title* : ${anu.title}\n*Filesize* : ${anu.filesize}`
thumb = await getBuffer(anu.thumb)
hafizh.sendMessage(from, thumb, image, {quoted: tod, caption: teks})
buffer = await getBuffer(anu.result)
hafizh.sendMessage(from, buffer, audio, ytmp3, {mimetype: 'audio/mp4', filename: `${anu.title}.mp3`, quoted: tod})
break
case 'joox':
data = await fetchJson(`https://tobz-api.herokuapp.com/api/joox?q=${body.slice(6)}&apikey=${tobzkey}`, {method: 'get'})
teks = '=================\n'
const joox = data.result
teks += `*Judul:* ${joox.title}\n*Album:* ${joox.album}\n*dipublikasian pada*: ${joox.dipublikasi}\n*Download sendiri:* ${joox.mp3}\n=================\n`
thumb = await getBuffer(joox.thumb)
hafizh.sendMessage(from, thumb, image, {quoted: tod, caption: teks})
buffer = await getBuffer(joox.mp3)
hafizh.sendMessage(from, buffer, audio, {mimetype: 'audio/mp4', filename: `${joox.title}.mp3`, quoted: tod})
break
case 'play':
data = await fetchJson(`https://api.vhtear.com/ytmp3?query=${body.slice(6)}&apikey=${vhtearkey}`, {method: 'get'})
teks = '=================\n'
const play = data.result
teks += `*Judul:* ${play.title}\n*Durasi:* ${play.duration}\n*size*: ${play.size}\n*Download sendiri:* ${play.mp3}\n=================\n`
thumb = await getBuffer(play.image)
hafizh.sendMessage(from, thumb, image, {quoted: tod, caption: teks})
buffer = await getBuffer(play.mp3)
hafizh.sendMessage(from, buffer, audio, {mimetype: 'audio/mp4', filename: `${play.title}.mp3`, quoted: tod})
break
case 'tiktok':
if (args.length < 1) return reply('๐๐ฟ๐น๐ป๐๐ฎ ๐บ๐ฎ๐ป๐ฎ?')
if (!isUrl(args[0]) && !args[0].includes('tiktok.com')) return reply(mess.error.Iv)
reply(mess.wait)
anu = await fetchJson(`https://mhankbarbar.tech/api/tiktok?url=${args[0]}&apiKey=${apikey}`, {method: 'get'})
if (anu.error) return reply(anu.error)
buffer = await getBuffer(anu.result)
hafizh.sendMessage(from, buffer, video, {quoted: tod})
break
case 'nulis':
case 'tulis':
if (args.length < 1) return reply('๐ง๐ฒ๐ธ๐๐ป๐๐ฎ ๐บ๐ฎ๐ป๐ฎ ๐๐ฒ๐ธ๐?')
teks = body.slice(7)
reply(mess.wait)
anu = await fetchJson(`https://mhankbarbar.tech/nulis?text=${teks}&apiKey=${apikey}`, {method: 'get'})
if (anu.error) return reply(anu.error)
buff = await getBuffer(anu.result)
hafizh.sendMessage(from, buff, image, {quoted: tod, caption: mess.success})
break
case 'url2img':
tipelist = ['desktop','tablet','mobile']
if (args.length < 1) return reply('๐ง๐ถ๐ฝ๐ฒ๐ป๐๐ฎ ๐ฎ๐ฝ๐ฎ??')
if (!tipelist.includes(args[0])) return reply('๐ง๐ถ๐ฝ๐ฒ ๐ฑ๐ฒ๐๐ธ๐๐ผ๐ฝ|๐๐ฎ๐ฏ๐น๐ฒ๐|๐บ๐ผ๐ฏ๐ถ๐น๐ฒ')
if (args.length < 2) return reply('๐๐ฟ๐น๐ป๐๐ฎ ๐บ๐ฎ๐ป๐ฎ?')
if (!isUrl(args[1])) return reply(mess.error.Iv)
reply(mess.wait)
anu = await fetchJson(`https://mhankbarbar.tech/api/url2image?tipe=${args[0]}&url=${args[1]}&apiKey=${apikey}`, {method: 'get'})
if (anu.error) return reply(anu.error)
buff = await getBuffer(anu.result)
hafizh.sendMessage(from, buff, image, {quoted: tod})
break
case 'carbon':
if (args.length < 1)return reply('Sertakan teks nya')
targed = mek.participant
teks = body.slice(8)
drc = await getBuffer(`https://carbonnowsh.herokuapp.com/?code=${teks}`)
hafizh.sendMessage(from, drc, image, {quoted: tod})
break
case 'tstiker':
case 'tsticker':
if (args.length < 1) return reply('๐ธ๐ฎ๐๐ถ๐ต ๐๐ฒ๐ธ๐ ๐น๐ฎ๐ต!!!')
ranp = getRandom('.png')
rano = getRandom('.webp')
teks = body.slice(9).trim()
anu = await fetchJson(`https://mhankbarbar.tech/api/text2image?text=${teks}&apiKey=${apikey}`, {method: 'get'})
if (anu.error) return reply(anu.error)
exec(`wget ${anu.result} -O ${ranp} && ffmpeg -i ${ranp} -vcodec libwebp -filter:v fps=fps=20 -lossless 1 -loop 0 -preset default -an -vsync 0 -s 512:512 ${rano}`, (err) => {
fs.unlinkSync(ranp)
if (err) return reply(mess.error.stick)
buffer = fs.readFileSync(rano)
hafizh.sendMessage(from, buffer, sticker, {quoted: tod})
fs.unlinkSync(rano)
})
break
case 'fitnah':
case 'fake': // tuh costum reply
costum('Ini', '6287775452636@s.whatsapp.com')
break
case 'tagall':
members_id = []
teks = (args.length > 1) ? body.slice(8).trim() : ''
teks += '\n\n'
for (let mem of groupMembers) {
rchoice = Math.floor(Math.random() * list_emoji.length)
teks += `โฃโฅ @${mem.jid.split('@')[0]}\n`
members_id.push(mem.jid)
}
mentions(teks, members_id, true)
break
case 'clearall':
if (!isOwner) return reply('๐ก๐ช ๐จ๐๐๐ฅ๐?')
anu = await hafizh.chats.all()
hafizh.setMaxListeners(25)
for (let _ of anu) {
hafizh.deleteChat(_.jid)
}
reply('๐ฐ๐น๐ฒ๐ฎ๐ฟ ๐ฎ๐น๐น ๐๐๐ธ๐๐ฒ๐ ๐๐ฎ๐ต :)')
break
case 'block':
hafizh.blockUser (`${body.slice(7)}@c.us`, "add")
hafizh.sendMessage(from, `๐ฝ๐ฒ๐ฟ๐ถ๐ป๐๐ฎ๐ต ๐๐ถ๐๐ฒ๐ฟ๐ถ๐บ๐ฎ, ๐บ๐ฒ๐บ๐ฏ๐น๐ผ๐ธ๐ถ๐ฟ ${body.slice(7)}@c.us`, text)
break
case 'unblock':
hafizh.blockUser (`${body.slice(9)}@c.us`, "remove")
hafizh.sendMessage(from, `๐ฝ๐ฒ๐ฟ๐ถ๐ป๐๐ฎ๐ต ๐๐ถ๐๐ฒ๐ฟ๐ถ๐บ๐ฎ, ๐บ๐ฒ๐บ๐ฏ๐๐ธ๐ฎ ${body.slice(9)}@c.us`, text)
break
case 'leave':
if (!isGroup) return reply(mess.only.group)
if (!isOwner) return reply(mess.only.ownerB)
await hafizh.hafizh.leaveGroup(from, '๐๐๐ฒ๐ฒ', groupId)
break
case 'bc':
if (args.length < 1) return reply('.......')
anu = await hafizh.chats.all()
if (isMedia && !tod.message.videoMessage || isQuotedImage) {
const encmedia = isQuotedImage ? JSON.parse(JSON.stringify(tod).replace('quotedM','m')).message.extendedTextMessage.contextInfo : tod
buff = await hafizh.downloadMediaMessage(encmedia)
for (let _ of anu) {
hafizh.sendMessage(_.jid, buff, image, {caption: `โฎ ๐ฝ๐๐ ๐ฝ๐๐๐ผ๐ฟ๐พ๐ผ๐๐ โฏ\n\n${body.slice(4)}`})
}
reply('๐จ๐ช๐๐๐๐จ๐จ ๐๐ง๐ค๐๐๐๐๐จ๐ฉ ')
} else {
for (let _ of anu) {
sendMess(_.jid, `โฎ ๐ฝ๐๐ ๐ฝ๐๐๐ผ๐ฟ๐พ๐ผ๐๐ โฏ\n\n${body.slice(4)}`)
}
reply('๐จ๐ช๐๐๐๐จ๐จ ๐๐ง๐ค๐๐๐๐๐จ๐ฉ ')
}
break
case 'setpp':
media = await hafizh.downloadAndSaveMediaMessage(tod)
await hafizh.updateProfilePicture (from, media)
reply('๐ฆ๐๐ธ๐๐ฒ๐ ๐บ๐ฒ๐ป๐ด๐ด๐ฎ๐ป๐๐ถ ๐ถ๐ฐ๐ผ๐ป ๐๐ฟ๐๐ฝ')
break
case 'add':
if (args.length < 1) return reply('๐ฝ๐ฎ๐๐๐ถ ๐๐ฎ๐ป๐ด ๐บ๐ฎ๐ ๐ฑ๐ถ ๐ฎ๐ฑ๐ฑ ๐ฎ๐ป๐ฎ๐ธ ๐ฝ๐๐ป๐ด๐๐?')
if (args[0].startsWith('08')) return reply('๐๐๐ป๐ฎ๐ธ๐ฎ๐ป ๐ธ๐ผ๐ฑ๐ฒ ๐ป๐ฒ๐ด๐ฎ๐ฟ๐ฎ')
try {
num = `${args[0].replace(/ /g, '')}@s.whatsapp.net`
hafizh.groupAdd(from, [num])
} catch (e) {
console.log('Error :', e)
reply('๐ด๐ฎ๐ด๐ฎ๐น ๐บ๐ฒ๐ป๐ฎ๐บ๐ฏ๐ฎ๐ต๐ธ๐ฎ๐ป, ๐บ๐๐ป๐ด๐ธ๐ถ๐ป ๐ธ๐ฎ๐ฟ๐ฒ๐ป๐ฎ ๐ฑ๐ถ ๐ฝ๐ฟ๐ถ๐๐ฎ๐๐ฒ')
}
break
case 'grup':
case 'group':
if (args[0] === 'buka') {
reply(`๐๐ฒ๐ฟ๐ต๐ฎ๐๐ถ๐น ๐ ๐ฒ๐บ๐ฏ๐๐ธ๐ฎ ๐๐ฟ๐ผ๐๐ฝ`)
hafizh.groupSettingChange(from, GroupSettingChange.messageSend, false)
} else if (args[0] === 'tutup') {
reply(`๐๐ฒ๐ฟ๐ต๐ฎ๐๐ถ๐น ๐ ๐ฒ๐ป๐๐๐๐ฝ ๐๐ฟ๐ผ๐๐ฝ`)
hafizh.groupSettingChange(from, GroupSettingChange.messageSend, true)
}
break
case 'admin':
case 'owner':
case 'creator':
hafizh.sendMessage(from, {displayname: "Jeff", vcard: vcard}, MessageType.contact, { quoted: tod})
hafizh.sendMessage(from, 'wa.me/+6287775452636',MessageType.text, { quoted: tod} )
break
case 'demote':
if (tod.message.extendedTextMessage === undefined || tod.message.extendedTextMessage === null) return reply('๐ง๐ฎ๐ด ๐๐ฎ๐ฟ๐ด๐ฒ๐ ๐๐ฎ๐ป๐ด ๐ถ๐ป๐ด๐ถ๐ป ๐ฑ๐ถ ๐๐ฒ๐ป๐ฑ๐ฎ๐ป๐ด!')
mentioned = tod.message.extendedTextMessage.contextInfo.mentionedJid
if (mentioned.length > 1) {
teks = ''
for (let _ of mentioned) {
teks += `๐๐ฎ๐ต๐ต ๐ท๐ฎ๐ฏ๐ฎ๐๐ฎ๐ป ๐ฎ๐ฑ๐บ๐ถ๐ป ๐ธ๐ฎ๐บ๐ ๐๐๐ฑ๐ฎ๐ต ๐ฑ๐ถ ๐ฐ๐ผ๐ฝ๐ผ๐ :\n`
teks += `@_.split('@')[0]`
}
mentions(teks, mentioned, true)
hafizh.groupDemoteAdmin(from, mentioned)
} else {
mentions(`๐๐ฎ๐ต๐ต @${mentioned[0].split('@')[0]} ๐ท๐ฎ๐ฏ๐ฎ๐๐ฎ๐ป ๐ฎ๐ฑ๐บ๐ถ๐ป ๐ธ๐ฎ๐บ๐ ๐๐๐ฑ๐ฎ๐ต ๐ฑ๐ถ ๐ฐ๐ผ๐ฝ๐ผ๐`, mentioned, true)
hafizh.groupDemoteAdmin(from, mentioned)
}
break
case 'promote':
if (tod.message.extendedTextMessage === undefined || tod.message.extendedTextMessage === null) return reply('๐ง๐ฎ๐ด ๐๐ฎ๐ฟ๐ด๐ฒ๐ ๐๐ฎ๐ป๐ด ๐ถ๐ป๐ด๐ถ๐ป ๐ฑ๐ถ ๐๐ฒ๐ป๐ฑ๐ฎ๐ป๐ด!')
mentioned = tod.message.extendedTextMessage.contextInfo.mentionedJid
if (mentioned.length > 1) {
teks = ''
for (let _ of mentioned) {
teks += `DONE :\n`
teks += `@_.split('@')[0]`
}
mentions(teks, mentioned, true)
hafizh.groupMakeAdmin(from, mentioned)
} else {
mentions(`DONE @${mentioned[0].split('@')[0]}`, mentioned, true)
hafizh.groupMakeAdmin(from, mentioned)
}
break
case 'kick':
if (tod.message.extendedTextMessage === undefined || tod.message.extendedTextMessage === null) return reply('๐ง๐ฎ๐ด ๐๐ฎ๐ฟ๐ด๐ฒ๐ ๐๐ฎ๐ป๐ด ๐ถ๐ป๐ด๐ถ๐ป ๐ฑ๐ถ ๐๐ฒ๐ป๐ฑ๐ฎ๐ป๐ด!')
mentioned = tod.message.extendedTextMessage.contextInfo.mentionedJid
if (mentioned.length > 1) {
teks = ''
for (let _ of mentioned) {
teks += `Otw.... :\n`
teks += `@_.split('@')[0]`
}
mentions(teks, mentioned, true)
hafizh.groupRemove(from, mentioned)
} else {
mentions(`Otw... @${mentioned[0].split('@')[0]} ๐๐ฎ๐๐ฎ๐ป๐ด`, mentioned, true)
hafizh.groupRemove(from, mentioned)
}
break
case 'listadmin':
teks = `๐๐ถ๐๐ ๐ฎ๐ฑ๐บ๐ถ๐ป ๐ผ๐ณ ๐ด๐ฟ๐ผ๐๐ฝ *${groupMetadata.subject}*\n๐ง๐ผ๐๐ฎ๐น : ${groupAdmins.length}\n\n`
no = 0
for (let admon of groupAdmins) {
no += 1
teks += `[${no.toString()}] @${admon.split('@')[0]}\n`
}
mentions(teks, groupAdmins, true)
break
case 'toimg':
if (!isQuotedSticker) return reply('๐ฅ๐ฒ๐ฝ๐น๐/๐๐ฎ๐ด ๐๐๐ถ๐ฐ๐ธ๐ฒ๐ฟ!')
reply(mess.wait)
encmedia = JSON.parse(JSON.stringify(tod).replace('quotedM','m')).message.extendedTextMessage.contextInfo
media = await hafizh.downloadAndSaveMediaMessage(encmedia)
ran = getRandom('.png')
exec(`ffmpeg -i ${media} ${ran}`, (err) => {
fs.unlinkSync(media)
if (err) return reply('๐ฌ๐ฎ๐ต ๐ด๐ฎ๐ด๐ฎ๐น, ๐๐น๐ฎ๐ป๐ด๐ถ ๐น๐ฎ๐ด๐ถ ๐๐ฎ๐๐ฎ๐ป๐ด')
buffer = fs.readFileSync(ran)
hafizh.sendMessage(from, buffer, image, {quoted: tod, caption: '๐ก๐ถ๐ต ๐ฆ๐ฎ๐๐ฎ๐ป๐ด'})
fs.unlinkSync(ran)
})
break
case 'simi':
if (args.length < 1) return reply('๐ธ๐ฎ๐๐ถ๐ต ๐๐ฒ๐ธ๐ ๐น๐ฎ๐ต!!!')
teks = body.slice(5)
anu = await simih(teks) //fetchJson(`https://mhankbarbar.tech/api/samisami?text=${teks}`, {method: 'get'})
//if (anu.error) return reply('Simi ga tau kak')
reply(anu)
break
case 'simih':
if (!isGroup) return reply(mess.only.group)
if (!isGroupAdmins) return reply(mess.only.admin)
if (args.length < 1) return reply('๐๐๐ฎ ๐๐ฎ๐๐ฎ๐ป๐ด')
if (Number(args[0]) === 1) {
if (isSimi) return reply('๐๐๐ฑ๐ฎ๐ต ๐ฎ๐ธ๐๐ถ๐ณ!!!')
samih.push(from)
fs.writeFileSync('./src/simi.json', JSON.stringify(samih))
reply('โฌ ๐ฆ๐จ๐๐ฆ๐๐ฆ โญ ๐ ๐ฒ๐ป๐ด๐ฎ๐ธ๐๐ถ๐ณ๐ธ๐ฎ๐ป ๐ณ๐ถ๐๐๐ฟ ๐๐ถ๐บ๐ถ ๐ฑ๐ถ ๐ด๐ฟ๐ผ๐๐ฝ ๐ถ๐ป๐ถ๏ธ')
} else if (Number(args[0]) === 0) {
samih.splice(from, 1)
fs.writeFileSync('./src/simi.json', JSON.stringify(samih))
reply('โฌ ๐ฆ๐จ๐๐ฆ๐๐ฆ โญ ๐ ๐ฒ๐ป๐ผ๐ป๐ฎ๐ธ๐๐ถ๐ณ๐ธ๐ฎ๐ป ๐ณ๐ถ๐๐๐ฟ ๐๐ถ๐บ๐ถ ๐ฑ๐ถ ๐ด๐ฟ๐ผ๐๐ฝ ๐ถ๐ป๐ถ๏ธ๏ธ')
} else {
reply('๐ธ๐ฒ๐๐ถ๐ธ ๐ฝ๐ฒ๐ฟ๐ถ๐ป๐๐ฎ๐ต ๐ญ ๐๐ป๐๐๐ธ ๐บ๐ฒ๐ป๐ด๐ฎ๐ธ๐๐ถ๐ณ๐ธ๐ฎ๐ป, ๐ฌ ๐๐ป๐๐๐ธ ๐บ๐ฒ๐ป๐ผ๐ป๐ฎ๐ธ๐๐ถ๐ณ๐ธ๐ฎ๐ป\n๐ฐ๐ผ๐ป๐๐ผ๐ต: ๐๐ถ๐บ๐ถ๐ต ๐ญ')
}
break
case 'nsfw':
if (!isGroup) return reply(mess.only.group)
if (!isGroupAdmins) return reply(mess.only.admin)
if (args.length < 1) return reply('๐๐๐ฎ ๐๐ฎ๐๐ฎ๐ป๐ด')
if (Number(args[0]) === 1) {
if (isNsfw) return reply('๐๐๐ฑ๐ฎ๐ต ๐ฎ๐ธ๐๐ถ๐ณ!!!')
nsfw.push(from)
fs.writeFileSync('./src/nsfw.json', JSON.stringify(nsfw))
reply('โฌ ๐ฆ๐จ๐๐ฆ๐๐ฆ โญ ๐ ๐ฒ๐ป๐ด๐ฎ๐ธ๐๐ถ๐ณ๐ธ๐ฎ๐ป ๐ณ๐ถ๐๐๐ฟ ๐ป๐๐ณ๐ ๐ฑ๐ถ ๐ด๐ฟ๐ผ๐๐ฝ ๐ถ๐ป๐ถ')
} else if (Number(args[0]) === 0) {
nsfw.splice(from, 1)
fs.writeFileSync('./src/nsfw.json', JSON.stringify(nsfw))
reply('โฌ ๐ฆ๐จ๐๐ฆ๐๐ฆ โญ ๐ ๐ฒ๐ป๐ผ๐ป๐ฎ๐ธ๐๐ถ๐ณ๐ธ๐ฎ๐ป ๐ณ๐ถ๐๐๐ฟ ๐ป๐๐ณ๐ ๐ฑ๐ถ ๐ด๐ฟ๐ผ๐๐ฝ ๐ถ๐ป๐ถ๏ธ')
} else {
reply('๐ธ๐ฒ๐๐ถ๐ธ ๐ฝ๐ฒ๐ฟ๐ถ๐ป๐๐ฎ๐ต ๐ญ ๐๐ป๐๐๐ธ ๐บ๐ฒ๐ป๐ด๐ฎ๐ธ๐๐ถ๐ณ๐ธ๐ฎ๐ป, ๐ฌ ๐๐ป๐๐๐ธ ๐บ๐ฒ๐ป๐ผ๐ป๐ฎ๐ธ๐๐ถ๐ณ๐ธ๐ฎ๐ป\n๐ฐ๐ผ๐ป๐๐ผ๐ต: ๐ป๐๐ณ๐ ๐ญ')
}
break
case 'welcome':
if (args.length < 1) return reply('๐๐๐ฎ ๐๐ฎ๐๐ฎ๐ป๐ด')
if (Number(args[0]) === 1) {
if (isWelkom) return reply('๐๐๐ฑ๐ฎ๐ต ๐ฎ๐ธ๐๐ถ๐ณ!!!')
welkom.push(from)
fs.writeFileSync('./src/welkom.json', JSON.stringify(welkom))
reply('โฌ ๐ฆ๐จ๐๐ฆ๐๐ฆ โญ ๐ ๐ฒ๐ป๐ด๐ฎ๐ธ๐๐ถ๐ณ๐ธ๐ฎ๐ป ๐ณ๐ถ๐๐๐ฟ ๐๐ฒ๐น๐ฐ๐ผ๐บ๐ฒ/๐น๐ฒ๐ณ๐ ๐ฑ๐ถ ๐ด๐ฟ๐ผ๐๐ฝ ๐ถ๐ป๐ถ๏ธ')
} else if (Number(args[0]) === 0) {
welkom.splice(from, 1)
fs.writeFileSync('./src/welkom.json', JSON.stringify(welkom))
reply('โฌ ๐ฆ๐จ๐๐ฆ๐๐ฆ โญ ๐ ๐ฒ๐ป๐ผ๐ป๐ฎ๐ธ๐๐ถ๐ณ๐ธ๐ฎ๐ป ๐ณ๐ถ๐๐๐ฟ ๐๐ฒ๐น๐ฐ๐ผ๐บ๐ฒ/๐น๐ฒ๐ณ๐ ๐ฑ๐ถ ๐ด๐ฟ๐ผ๐๐ฝ ๐ถ๐ป๐ถ๏ธ')
} else {
reply('๐ธ๐ฒ๐๐ถ๐ธ ๐ฝ๐ฒ๐ฟ๐ถ๐ป๐๐ฎ๐ต ๐ญ ๐๐ป๐๐๐ธ ๐บ๐ฒ๐ป๐ด๐ฎ๐ธ๐๐ถ๐ณ๐ธ๐ฎ๐ป, ๐ฌ ๐๐ป๐๐๐ธ ๐บ๐ฒ๐ป๐ผ๐ป๐ฎ๐ธ๐๐ถ๐ณ๐ธ๐ฎ๐ป\n๐ฐ๐ผ๐ป๐๐ผ๐ต: ${prefix}๐๐ฒ๐น๐ฐ๐ผ๐บ๐ฒ ๐ญ')
}
break
case 'tagall2':
members_id = []
teks = (args.length > 1) ? body.slice(8).trim() : ''
teks += '\n\n'
for (let mem of groupMembers) {
teks += `โ โฅ @${mem.jid.split('@')[0]}\n`
members_id.push(mem.jid)
}
reply(teks)
break
case 'tagall3':
members_id = []
teks = (args.length > 1) ? body.slice(8).trim() : ''
teks += '\n\n'
for (let mem of groupMembers) {
teks += `โ โฅ https://wa.me/${mem.jid.split('@')[0]}\n`
members_id.push(mem.jid)
}
hafizh.sendMessage(from, teks, text, {detectLinks: false, quoted: tod})
break
case 'clone':
if (args.length < 1) return reply('๐๐ฎ๐ด ๐๐ฎ๐ฟ๐ด๐ฒ๐ ๐๐ฎ๐ป๐ด ๐บ๐ฎ๐ ๐ฑ๐ถ ๐ฐ๐น๐ผ๐ป๐ฒ!!!')
if (tod.message.extendedTextMessage === undefined || tod.message.extendedTextMessage === null) return reply('Tag cvk')
mentioned = tod.message.extendedTextMessage.contextInfo.mentionedJid[0]
let { jid, id, notify } = groupMembers.find(x => x.jid === mentioned)