forked from mrfzvx12/lexav3
-
Notifications
You must be signed in to change notification settings - Fork 0
/
lexa.js
1707 lines (1543 loc) · 59.3 KB
/
lexa.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
// Kalau ada typo atau sesuatu yang masih kurang bantu perbaiki ya, Pull Request aja
//-- Whatsapp Connecting
const {
WAConnection,
MessageType,
Presence,
Mimetype,
GroupSettingChange,
MessageOptions,
WALocationMessage,
ReconnectMode,
ProxyAgent,
waChatKey,
mentionedJid,
processTime,
ChatModification,
whatsappID,
WAConnectionTest,
} = require('@adiwajshing/baileys');
//-- Functions
const {color, bgcolor} = require('./fs/color');
const {fetchJson, fetchText} = require('./fs/fetcher');
const {recognize} = require('./fs/ocr');
const {_wait, getBuffer, h2k, generateMessageID, getGroupAdmins, getRandom, start, success, close } = require('./fs/functions');
//-- Modules
const fs = require('fs');
const moment = require('moment-timezone');
const {exec} = require('child_process');
const fetch = require('node-fetch');
const ffmpeg = require('fluent-ffmpeg');
const imgbb = require('imgbb-uploader');
const speed = require('performance-now');
const cd = 4.32e+7 ;
const crypto = require('crypto');
const qrcode = require("qrcode-terminal");
const axios = require('axios');
const path = require('path');
const {removeBackgroundFromImageFile} = require('remove.bg');
//-- Data
const up = JSON.parse(fs.readFileSync('./data/setting.json'));
const _welcom = JSON.parse(fs.readFileSync('./data/welcom.json'));
const _user = JSON.parse(fs.readFileSync('./data/user.json'));
const _antilink = JSON.parse(fs.readFileSync('./data/antilink.json'));
const hit = JSON.parse(fs.readFileSync('./data/totalhit.json'))
//-- Media
const _stik = JSON.parse(fs.readFileSync('./media/stik.json'))
const _vid = JSON.parse(fs.readFileSync('./media/vid.json'))
const _vn = JSON.parse(fs.readFileSync('./media/vn.json'))
const _img = JSON.parse(fs.readFileSync('./media/image.json'))
//-- Result
const _truth = JSON.parse(fs.readFileSync('./result/truth.json'));
const _dare = JSON.parse(fs.readFileSync('./result/dare.json'));
const _fakta = JSON.parse(fs.readFileSync('./result/fakta.json'));
const _ilham = JSON.parse(fs.readFileSync('./result/ilham.json'));
const _dilan = JSON.parse(fs.readFileSync('./result/dilan.json'));
const _gombal = JSON.parse(fs.readFileSync('./result/gombal.json'));
const _hacker = JSON.parse(fs.readFileSync('./result/hacker.json'));
const { bahasa } = require('./result/kodebahasa');
const { negara } = require('./result/kodenegara');
//-- Report
const _lapor = JSON.parse(fs.readFileSync('./report/lapor.json'));
const _request = JSON.parse(fs.readFileSync('./report/request.json'));
//-- Help
const { menu, menu1, menu2, menuOwner, menuGrup} = require('./help/menu');
const { info } = require('./help/info');
const { termux } = require('./help/termux');
const { wait, stick, err, group, ban, ownerB, premi, userB, admin, Badmin } = require('./help/respon');
//-- Setting
const prefix = up.prefix
const memberlimit = up.memberlimit;
const banned = [
];
const premium = [
];
const ownerNumber = [
];
//-- Apikey
const Vkey = 'apivinz'
const Xinz = 'XinzBot'
const Pkode = 'pais'
//-- Waktu dan tanggal
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)}`
}
function tanggal(){
myMonths = ["Januari","Februari","Maret","April","Mei","Juni","Juli","Agustus","September","Oktober","November","Desember"];
myDays = ['Minggu','Senin','Selasa','Rabu','Kamis','Jum\'at','Sabtu'];
var tgl = new Date();
var day = tgl.getDate()
bulan = tgl.getMonth()
var thisDay = tgl.getDay(),
thisDay = myDays[thisDay];
var yy = tgl.getYear()
var year = (yy < 1000) ? yy + 1900 : yy;
return `${thisDay}, ${day} - ${myMonths[bulan]} - ${year}`
}
//--Whatsapp start connect
async function starts() {
const Lxa = new WAConnection()
Lxa.logger.level = 'warn'
Lxa.on('qr', () => {
console.log(color('[LEXA]','aqua'), color("Scan QR code for Connecting...", "yellow"))
})
fs.existsSync('./session/Lexa.json') && Lxa.loadAuthInfo('./session/Lexa.json')
Lxa.on('connecting', () => {
const time_connecting = moment.tz('Asia/Jakarta').format('HH:mm:ss')
console.log(color('[LEXA]','aqua'), color("Wait For Connecting...", "yellow"))
})
Lxa.on('open', () => {
const time_connect = moment.tz('Asia/Jakarta').format('HH:mm:ss')
console.log(color('[LEXA]','aqua'), color(`Done Connecting`, "aqua"))
start('')
})
await Lxa.connect({timeoutMs: 30*1000})
fs.writeFileSync('./session/Lexa.json', JSON.stringify(Lxa.base64EncodedAuthInfo(), null, '\t'))
Lxa.on('group-participants-update', async (anu) => {
if (!_welcom.includes(anu.jid)) return
try {
const mdata = await Lxa.groupMetadata(anu.jid)
if (anu.action == 'add') {
num = anu.participants[0]
hai = `Hai @${num.split('@')[0]}
Selamat datang di
Group *${mdata.subject}*
Ketik ${prefix}verify untuk memulai menggunakan bot.`
Lxa.sendMessage(mdata.id, hai, MessageType.text, { contextInfo: {"mentionedJid": [num]}})
} else if (anu.action == 'remove') {
num = anu.participants[0]
bye = `Selamat tinggal @${num.split('@')[0]}👋`
Lxa.sendMessage(mdata.id, bye, MessageType.text, {contextInfo: {"mentionedJid": [num]}})
}
} catch (e) {
console.log('Error : %s', color(e, 'red'))
}
})
const blocked = []
Lxa.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'))
}
})
Lxa.on('chat-update', async (mek) => {
if (!mek.hasNewMessage) return
mek = mek.messages.all()[0]
if (!mek.message) return
if (mek.key && mek.key.remoteJid == 'status@broadcast') return
if (mek.key.fromMe) return
global.prefix
global.blocked
const content = JSON.stringify(mek.message)
const from = mek.key.remoteJid
const type = Object.keys(mek.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')
const jam = moment.tz('Asia/Jakarta').format('HH:mm')
//--
const body = (type === 'conversation' && mek.message.conversation.startsWith(prefix)) ? mek.message.conversation : (type == 'imageMessage') && mek.message.imageMessage.caption.startsWith(prefix) ? mek.message.imageMessage.caption : (type == 'videoMessage') && mek.message.videoMessage.caption.startsWith(prefix) ? mek.message.videoMessage.caption : (type == 'extendedTextMessage') && mek.message.extendedTextMessage.text.startsWith(prefix) ? mek.message.extendedTextMessage.text : ''
const budy = (type === 'conversation') ? mek.message.conversation : (type === 'extendedTextMessage') ? mek.message.extendedTextMessage.text : ''
const command = body.slice(1).trim().split(/ +/).shift().toLowerCase()
const is = budy.slice(0).trim().split(/ +/).shift().toLowerCase()
const args = body.trim().split(/ +/).slice(1)
const value = args.join(' ')
const isCmd = body.startsWith(prefix)
const totalchat = await Lxa.chats.all()
const botNumber = Lxa.user.jid
//-- Group Metadata
const isGroup = from.endsWith('@g.us')
const sender = isGroup ? mek.participant : mek.key.remoteJid
const groupMetadata = isGroup ? await Lxa.groupMetadata(from) : ''
const groupName = isGroup ? groupMetadata.subject : ''
const groupId = isGroup ? groupMetadata.jid : ''
const groupMembers = isGroup ? groupMetadata.participants : ''
const groupAdmins = isGroup ? getGroupAdmins(groupMembers) : ''
const isOwner = ownerNumber.includes(sender)
const isVerify = _user.includes(sender)
const isPrem = premium.includes(sender) || isOwner
const isBan = blocked.includes(sender)
const isBotGroupAdmins = groupAdmins.includes(botNumber) || false
const isGroupAdmins = groupAdmins.includes(sender) || false
const isWelcom = isGroup ? _welcom.includes(from) : false
const isAnti = isGroup ? _antilink.includes(from) : false
const pushname = Lxa.contacts[sender] != undefined ? Lxa.contacts[sender].vname || Lxa.contacts[sender].notify: undefined
//-- other
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 { wa_version, mcc, mnc, os_version, device_manufacturer, device_model } = Lxa.user.phone
//-- function reply
const reply = (teks) => {
Lxa.sendMessage(from, teks, text, {quoted:mek })
}
const sendMess = (hehe, teks) => {
Lxa.sendMessage(hehe, teks, text)
}
const mentions = (teks, memberr, id) => {
(id == null || id == undefined || id == false) ? Lxa.sendMessage(from, teks.trim(), extendedText, {contextInfo: {"mentionedJid": memberr}}) : Lxa.sendMessage(from, teks.trim(), extendedText, {quoted: mek, contextInfo: {"mentionedJid": memberr}})
}
const replyimg = (pesan, tipe, rep1, rep2) => {
Lxa.sendMessage(from, pesan, tipe, { quoted: { key: { fromMe: false, participant: `[email protected]`, ...(from ? { remoteJid: "status@broadcast" } : {}) }, message: {
"imageMessage": {
"mimetype": "image/jpeg",
"caption": `${rep1}`,
"fileLength": "201809",
"jpegThumbnail": `${rep2}` } } }})
}
//--MessageType
const isMedia = (type === 'imageMessage' || type === 'videoMessage')
const isQuotedText = type === 'extendedTextMessage' && content.includes('textMessage')
const isQuotedImage = type === 'extendedTextMessage' && content.includes('imageMessage')
const isQuotedVideo = type === 'extendedTextMessage' && content.includes('videoMessage')
const isQuotedAudio = type === 'extendedTextMessage' && content.includes('audioMessage')
const isQuotedSticker = type === 'extendedTextMessage' && content.includes('stickerMessage')
//-- watermark stiker
function addMetadata(packname, author) {
if (!packname) packname = 'Lexa'; if (!author) author = pushname ;
author = author.replace(/[^a-zA-Z0-9]/g, '');
let name = `${author}_${packname}`
if (fs.existsSync(`./exif/${name}.exif`)) return `./exif/${name}.exif`
const json = {
"sticker-pack-name": packname,
"sticker-pack-publisher": author,
}
const littleEndian = Buffer.from([0x49, 0x49, 0x2A, 0x00, 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x41, 0x57, 0x07, 0x00])
const bytes = [0x00, 0x00, 0x16, 0x00, 0x00, 0x00]
let len = JSON.stringify(json).length
let last
if (len > 256) {
len = len - 256
bytes.unshift(0x01)
} else {
bytes.unshift(0x00)
}
if (len < 16) {
last = len.toString(16)
last = "0" + len
} else {
last = len.toString(16)
}
const buf2 = Buffer.from(last, "hex")
const buf3 = Buffer.from(bytes)
const buf4 = Buffer.from(JSON.stringify(json))
const buffer = Buffer.concat([littleEndian, buf2, buf3, buf4])
fs.writeFile(`./exif/${name}.exif`, buffer, (err) => {
return `./exif/${name}.exif`
})
}
//--Colors
colors = ['red','white','black','blue','yellow','green']
//--Console log grup
if (!isGroup && isCmd) console.log(color('[Lexa]','aqua'), "CP", color(command, "orange"), "from", (sender.split('@')[0]), args.length)
//--Console log chat pribadi
if (isGroup && isCmd) console.log(color('[Lexa]','aqua'), "GC", color(command, "orange"), "from", (sender.split('@')[0]), "in", (groupName), args.length)
//-- Cek fitur
let prem_ = 'User Free'
if (isPrem) {
prem_ = 'User Premium'
}
if (isOwner) {
prem_ = '*VVIP*'
}
let Welcome_ = 'Off'
if (isWelcom) {
Welcome_ = 'On'
}
let AntiLink_ = 'Off'
if (isAnti) {
AntiLink_ = 'On'
}
//--- Total command
const cmdadd = () => {
hit[0].totalcmd += 1
fs.writeFileSync('./data/totalhit.json', JSON.stringify(hit))
}
if (isCmd) cmdadd()
const reqcmd = JSON.parse(fs.readFileSync('./data/totalhit.json'))[0].totalcmd
//--Member limit
if (isGroup) {
try {
const getmemex = groupMembers.length
if (getmemex <= memberlimit) {
Lxa.sendMessage(from, `Maaf syarat member harus di atas ${memberlimit}, selamat tinggal 👋🏻`, text)
setTimeout(() => {
Lxa.groupLeave(from) // ur cods
}, 5000) // 1000 = 1s,
}
} catch {
console.error(err)
}
}
// ---- Antilink
const linkwa = 'https://chat.whatsapp.com/'
if (budy.includes(`${linkwa}`)){
if (!isGroup) return
if (!isAnti) return
if (!isBotGroupAdmins) return reply('Untung Lexa bukan admin, kalo iya gua kick lu')
linkgc = await Lxa.groupInviteCode (from)
if (budy.includes(`${linkwa}${linkgc}`)) return reply('Untung Link group ini')
if (isGroupAdmins) return reply(`Hmm mantap min`)
Lxa.updatePresence(from, Presence.composing)
var Kick = `${sender.split("@")[0]}@s.whatsapp.net`
setTimeout( () => {
reply('byee')
}, 1100)
setTimeout( () => {
Lxa.groupRemove(from, [Kick]).catch((e) => {console.log(`*ERROR:* ${e}`)})
}, 1000)
setTimeout( () => {
reply(`Antilink menyala & link Group Terdeteksi maaf *${pushname}* anda akan di kick`)
}, 0)
}
//-- Anti user ban
if (isCmd && isBan) return reply(banned())
//-- Auto read jika ada pesan
if (isCmd) Lxa.chatRead(from)
//--Auto respon
switch(is) {
case 'assalamualaikum':
reply('waalaikumsallam')
}
//-- Command
switch(command) {
//-- List menu
case 'menu':
case 'help':
if (!isVerify) return reply(userB(prefix))
uptime = process.uptime()
capt = `Total Hits : ${reqcmd} \n‣ Rating : ★★★★☆\n‣ Jumlah User : ${_user.length}`
thum = await fs.readFileSync('./docs/mrf.jpeg').toString('base64')
if (args.length < 1) return replyimg(menu(tanggal, jam, pushname, sender, prem_, Lxa, prefix, _user, uptime, isGroupAdmins, groupMetadata, groupAdmins, Welcome_, AntiLink_, isGroup, process), text, capt, thum)
if (args[0] === '1' ) {
return replyimg(menu1(prefix, tanggal, jam), text, capt, thum)
} else if (args[0] === '2' ) {
return replyimg(menu2(prefix, tanggal, jam), text, capt, thum)
/* } else if (args[0] === '3' ) {
return reply(menu3(prefix, tanggal, jam))
} else if (args[0] === 'premium' ) {
return reply(menuPrem(prefix, tanggal, jam))
*/} else if (args[0] === 'owner' ) {
return replyimg(menuOwner(prefix, tanggal, jam), text, capt, thum)
} else if (args[0] === 'group' ) {
return replyimg(menuGrup(prefix, tanggal, jam), text, capt, thum)
}
break
//-- informasi bot
case 'info':
uptime = process.uptime()
reply(info(Lxa, uptime, process, wa_version, mcc, mnc, os_version, device_manufacturer, device_model))
break
//-- kecepatan respon
case 'speed':
case 'ping':
const timestamp = speed();
const latensi = speed() - timestamp
uptime = process.uptime()
reply(`Pong !! *Speed* : ${latensi.toFixed(4)} _Second_`)
break
//-- Simsimi
case 'bot':
case 'simi':
if (!isVerify) return reply(userB())
if (args.length < 1) return reply(`Hai ${pushname}`)
sims = value
simt = await fs.readFileSync('./media/mrf.jpeg').toString('base64')
try {
anu = await fetchJson(`https://fdciabdul.tech/api/ayla/?pesan=${sims}`, {method: 'get'})
jawab = anu.jawab
replyimg(jawab, text, sims, simt)
} catch (e) {
reply(err())
console.log('Error : %s', color(e, 'orange'))
}
break
//-- kode bahasa
case 'kodebahasa':
if (!isVerify) return reply(userB())
reply(bahasa())
break
//-- kode negara
case 'kodebahasa':
if (!isVerify) return reply(userB())
reply(negara())
break
//-- quotes senja
case 'senja':
if (!isVerify) return reply(userB())
try {
data = await fetchJson(`https://pencarikode.xyz/api/katasenja?apikey=${Pkode}`)
reply(data.message)
} catch (e) {
console.log('Error : %s', color(e, 'orange'))
reply(err())
}
break
//-- quotes islam
case 'quotesislam':
if (!isVerify) return reply(userB())
try {
data = await fetchJson(`https://xinzbot-api.herokuapp.com/api/randomquote/muslim?apikey=${Xinz}`)
reply(data.result.text_id)
} catch (e) {
console.log('Error : %s', color(e, 'orange'))
reply(err())
}
break
//-- ganteng cek
case 'gantengcek':
if (args.length < 1) return reply(`Contoh : ${prefix}gantengcek Lexa`)
if (!isVerify) return reply(userB())
random = `${Math.floor(Math.random() * 100)}`
gan = value
cek = `Target : *${gan}*
Persentase : ${random}%`
Lxa.sendMessage(from, cek, text, {quoted: mek})
break
//--- cantik cek
case 'cantikcek':
if (args.length < 1) return reply(`Contoh : ${prefix}cantikcek Lexa`)
if (!isVerify) return reply(userB())
random = `${Math.floor(Math.random() * 100)}`
can = value
cek = `Target : *${can}*
Persentase : ${random}%`
Lxa.sendMessage(from, cek, text, {quoted: mek})
break
//--- apakah
case 'apakah':
if (!isVerify) return reply(userB())
if (args.length < 1) return reply(`Contoh : ${prefix}apakah aku jelek`)
apa = value
naon = ["Iya","Tidak","Mungkin"]
random = naon[Math.floor(Math.random() * (naon.length))]
apakah = `Apakah *${apa}*
Jawaban : ${random}`
reply(apakah)
break
//--- rate
case 'rate':
if (!isVerify) return reply(userB())
if (args.length < 1) return reply(`Contoh : ${prefix}rate aku jelek`)
rate = value
random = `${Math.floor(Math.random() * 100)}`
rating = `Rate ${rate}
Persentase : ${random}%`
reply(rating)
break
//--- bisakah
case 'bisakah':
if (!isVerify) return reply(userB())
if (args.length < 1) return reply(`Contoh : ${prefix}bisakah aku terbang`)
bisa = value
naon = ["Iya","Tidak","Mungkin"]
random = naon[Math.floor(Math.random() * (naon.length))]
bisakah = `Bisakah ${bisa}
Jawaban : ${random}`
reply(bisakah)
break
//--- kapankah
case 'kapankah':
if (!isVerify) return reply(userB())
if (args.length < 1) return reply(`Contoh : ${prefix}kapankah aku menikah`)
kapan = value
no = `${Math.floor(Math.random() * 100)}`
naon = ["Jam lagi","Hari lagi","Minggu lagi","Bulan lagi","Tahun lagi"]
random = naon[Math.floor(Math.random() * (naon.length))]
kapan = `Kapankah ${kapan}
Jawaban : ${no} ${random}`
reply(kapan)
break
//--- ciee
case 'ciee':
case 'cie':
if (!isVerify) return reply(userB())
if (!isGroup) return reply(group())
jds = []
meh = ["Putus","Jadian","Tunangan","Menikah","Cerai","Gelud","Ciuman di pinggir jalan"]
yoyo = meh[Math.floor(Math.random() * meh.length)]
jdii = groupMembers
koss = groupMembers
akuu = jdii[Math.floor(Math.random() * jdii.length)]
diaa = koss[Math.floor(Math.random() * koss.length)]
teks = `Ciee @${akuu.jid.split('@')[0]} & @${diaa.jid.split('@')[0]} yang abis ${yoyo}`
jds.push(akuu.jid)
jds.push(diaa.jid)
mentions(teks, jds, true)
break
//--- cantik
case 'ganteng':
if (!isVerify) return reply(userB())
if (!isGroup) return reply(group())
jds = []
jdii = groupMembers
diaa = jdii[Math.floor(Math.random() * jdii.length)]
teks = `Yang paling *Ganteng* disini adalah @${diaa.jid.split('@')[0]}`
jds.push(diaa.jid)
mentions(teks, jds, true)
break
//--- cantik
case 'cantik':
if (!isVerify) return reply(userB())
if (!isGroup) return reply(group())
jds = []
jdii = groupMembers
diaa = jdii[Math.floor(Math.random() * jdii.length)]
teks = `Yang paling *Cantik* disini adalah @${diaa.jid.split('@')[0]}`
jds.push(diaa.jid)
mentions(teks, jds, true)
break
//--- jelek
case 'jelek':
if (!isVerify) return reply(userB())
if (!isGroup) return reply(group())
jds = []
jdii = groupMembers
diaa = jdii[Math.floor(Math.random() * jdii.length)]
teks = `Yang paling *Jelek* disini adalah @${diaa.jid.split('@')[0]}`
jds.push(diaa.jid)
mentions(teks, jds, true)
break
//--- sadboy
case 'sadboy':
if (!isVerify) return reply(userB())
if (!isGroup) return reply(group())
jds = []
jdii = groupMembers
diaa = jdii[Math.floor(Math.random() * jdii.length)]
teks = `Yang paling *Sadboy* disini adalah @${diaa.jid.split('@')[0]}`
jds.push(diaa.jid)
mentions(teks, jds, true)
break
//--- sadgirl
case 'sadgirl':
if (!isVerify) return reply(userB())
if (!isGroup) return reply(group())
jds = []
jdii = groupMembers
diaa = jdii[Math.floor(Math.random() * jdii.length)]
teks = `Yang paling *Sadgirl* disini adalah @${diaa.jid.split('@')[0]}`
jds.push(diaa.jid)
mentions(teks, jds, true)
break
//--- wibu
case 'wibu':
if (!isVerify) return reply(userB())
if (!isGroup) return reply(group())
jds = []
jdii = groupMembers
diaa = jdii[Math.floor(Math.random() * jdii.length)]
teks = `Yang paling *Wibu* disini adalah @${diaa.jid.split('@')[0]}`
jds.push(diaa.jid)
mentions(teks, jds, true)
break
//--kutuk
case 'kutuk':
if (!isVerify) return reply(userB())
if (args.length < 1) return reply('Tag Target')
if (!isGroup) return reply(group())
if (mek.message.extendedTextMessage === undefined || mek.message.extendedTextMessage === null) return
mentioned = mek.message.extendedTextMessage.contextInfo.mentionedJid
karn = ["Jelek","Ganteng","Miskin","Kaya","Cantik","Tukang PHO","Sering Di PHP in","Wibu","Tolol","Mirip Monyet"]
karna = karn[Math.floor(Math.random() * karn.length)]
jad = ["Monyet","Pengusaha","Pacar Kekeyi","Lonthe","Jelek","Patung","Kodok","Babi","Anak Anjing","Istriku","Suamiku","Setan"]
jadi = jad[Math.floor(Math.random() * jad.length)]
if (mentioned.length > 1) {
teks = ''
for (let _ of mentioned) {
teks += `@${_.split('@')[0]}\n`
}
mentions(from, mentioned, true)
} else {
mentions(`Karna @${mentioned[0].split('@')[0]} *${karna}*, Akan ku kutuk dia jadi *${jadi}*`, mentioned, true)
}
break
//-- suit
case 'suit':
if (!isVerify) return reply(userB())
if (!isGroup) return reply(group())
if (args.length < 1) return reply('Pilih Gunting/Batu/Kertas')
if (args[0] === 'gunting' ) {
gunting = [
"Kamu *Gunting*\nLexa *Kertas*\nKamu Menang 😔",
"Kamu *Gunting*\nLexa *Batu*\nKamu Kalah 🙂",
"Kamu *Gunting*\nLexa *Gunting*\nKita Seri 😏"
]
gun = gunting[Math.floor(Math.random() * gunting.length)]
reply(gun)
} else if (args[0] === 'kertas') {
ker = [
"Kamu *Kertas*\nLexa *Batu*\nKamu Menang 😔",
"Kamu *Kertas*\nLexa *Gunting*\nKamu Kalah 🙂",
"Kamu *Kertas*\nLexa *Kertas*\nKita Seri 😏"
]
kertas = ker[Math.floor(Math.random() * ker.length)]
reply(kertas)
} else if (args[0] === 'batu') {
bat = [
"Kamu *Batu*\nLexa *Gunting*\nKamu Menang 😔",
"Kamu *Batu*\nLexa *Kertas*\nKamu Kalah 🙂",
"Kamu *Batu*\nLexa *Batu*\nKita Seri 😏"
]
batu = bat[Math.floor(Math.random() * bat.length)]
reply(batu)
} else {
reply('Pilih Gunting/Batu/Kertas')
}
break
//-- Tod truth
case 'truth':
if (!isVerify) return reply(userB())
const truth = _truth[Math.floor(Math.random() * _truth.length)]
reply(`‣ *Dare*\n${truth}`)
break
//-- Tod dare
case 'dare':
if (!isVerify) return reply(userB())
const dare = _dare[Math.floor(Math.random() * _dare.length)]
reply(`‣ *Dare*\n${dare}`)
break
//-- quotes dilan
case 'dilan':
if (!isVerify) return reply(userB())
const dilan = _dilan[Math.floor(Math.random() * _dilan.length)]
reply(dilan)
break
//-- quotes ilham
case 'ilham':
if (!isVerify) return reply(userB())
const ilham = _ilham[Math.floor(Math.random() * _ilham.length)]
reply(ilham)
break
//-- gombal
case 'gombal':
if (!isVerify) return reply(userB())
const gombal = _gombal[Math.floor(Math.random() * _gombal.length)]
reply(gombal)
break
//-- hacker
case 'hacker':
if (!isVerify) return reply(userB())
const hacker = _hacker[Math.floor(Math.random() * _hacker.length)]
reply(hacker)
break
//-- fakta
case 'fakta':
if (!isVerify) return reply(userB())
const fakta = _fakta[Math.floor(Math.random() * _fakta.length)]
reply(fakta)
break
case 'pantun':
fetch('https://raw.githubusercontent.com/pajaar/grabbed-results/master/pajaar-2020-pantun-pakboy.txt')
.then(res => res.text())
.then(body =>
{
let tod = body.split("\n");
let pjr = tod[Math.floor(Math.random() * tod.length)];
let pantun = pjr.replace(/pjrx-line/g, "\n");
reply(pantun)
})
break
//-- link whatsapp
case 'wame':
if (!isVerify) return reply(userB())
reply(`wa.me/${sender.split('@')[0]}\nAtau\napi.whatsapp.com/send?phone=${sender.split('@')[0]}`)
break
//-- Pengucapan ulang
case 'say':
if (!isVerify) return reply(userB())
sendMess(from, value)
break
//-- salin teks dalam gambar
case 'ocr':
if (!isVerify) return reply(userB())
if ((isMedia && !mek.message.videoMessage || isQuotedImage) && args.length == 0) {
const encmedia = isQuotedImage ? JSON.parse(JSON.stringify(mek).replace('quotedM','m')).message.extendedTextMessage.contextInfo : mek
const media = await Lxa.downloadAndSaveMediaMessage(encmedia)
reply(wait())
await recognize(media, {lang: 'eng+ind', oem: 1, psm: 3})
.then(teks => {
reply(teks.trim())
fs.unlinkSync(media)
})
.catch(err => {
reply(err(prefix))
fs.unlinkSync(media)
})
} else {
reply('Gunakan foto')
}
break
//-- Merubah video jadi audio
case 'tomp3':
if (!isQuotedVideo && isMedia) return reply('Silahkan reply video yang sudah dikirim')
reply(wait())
encmedia = JSON.parse(JSON.stringify(mek).replace('quotedM','m')).message.extendedTextMessage.contextInfo
media = await Lxa.downloadAndSaveMediaMessage(encmedia)
ran = getRandom('.mp4')
exec(`ffmpeg -i ${media} ${ran}`, (err) => {
fs.unlinkSync(media)
if (err) return reply('Gagal, pada saat mengkonversi video ke mp3')
bufferlkj = fs.readFileSync(ran)
Lxa.sendMessage(from, bufferlkj, audio, {mimetype: 'audio/mp4', quoted: mek})
fs.unlinkSync(ran)
})
break
//-- slow
case 'slow':
if (!isQuotedAudio) return reply('Reply Audionya')
if (!isVerify) return reply(userB())
encmedia = JSON.parse(JSON.stringify(mek).replace('quotedM','m')).message.extendedTextMessage.contextInfo
media = await Lxa.downloadAndSaveMediaMessage(encmedia)
ran = getRandom('.mp3')
exec(`ffmpeg -i ${media} -filter:a "atempo=0.7,asetrate=44100" ${ran}`, (err, stderr, stdout) => {
fs.unlinkSync(media)
if (err) return reply('Error!')
hah = fs.readFileSync(ran)
Lxa.sendMessage(from, hah, audio, {mimetype: 'audio/mp4', ptt:true, quoted: mek})
fs.unlinkSync(ran)
})
break
//-- gemuk
case 'gemuk':
if (!isQuotedAudio) return reply('Reply Audionya')
if (!isVerify) return reply(userB())
encmedia = JSON.parse(JSON.stringify(mek).replace('quotedM','m')).message.extendedTextMessage.contextInfo
media = await Lxa.downloadAndSaveMediaMessage(encmedia)
ran = getRandom('.mp3')
exec(`ffmpeg -i ${media} -filter:a "atempo=1.6,asetrate=22100" ${ran}`, (err, stderr, stdout) => {
fs.unlinkSync(media)
if (err) return reply('Error!')
hah = fs.readFileSync(ran)
Lxa.sendMessage(from, hah, audio, {mimetype: 'audio/mp4', ptt:true, quoted: mek})
fs.unlinkSync(ran)
})
break
//-- tupai
case 'tupai':
if (!isQuotedAudio) return reply('Reply Audionya')
if (!isVerify) return reply(userB())
encmedia = JSON.parse(JSON.stringify(mek).replace('quotedM','m')).message.extendedTextMessage.contextInfo
media = await Lxa.downloadAndSaveMediaMessage(encmedia)
ran = getRandom('.mp3')
exec(`ffmpeg -i ${media} -filter:a "atempo=0.5,asetrate=65100" ${ran}`, (err, stderr, stdout) => {
fs.unlinkSync(media)
if (err) return reply('Error!')
hah = fs.readFileSync(ran)
Lxa.sendMessage(from, hah, audio, {mimetype: 'audio/mp4', ptt:true, quoted: mek})
fs.unlinkSync(ran)
})
break
//-- to vn
case 'tovn':
if (!isQuotedAudio) return reply('Reply Audionya')
if (!isPrem) return reply(premi())
reply(wait())
encmedia = JSON.parse(JSON.stringify(mek).replace('quotedM','m')).message.extendedTextMessage.contextInfo
media = await Lxa.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)
Lxa.sendMessage(from, topt, audio, {mimetype: 'audio/mp4', quoted: mek, ptt:true})
})
break
//--- bass
case 'bass':
if (!isQuotedAudio) return reply('Reply Audionya')
if (!isVerify) return reply(userB())
encmedia = JSON.parse(JSON.stringify(mek).replace('quotedM','m')).message.extendedTextMessage.contextInfo
media = await Lxa.downloadAndSaveMediaMessage(encmedia)
ran = getRandom('.mp3')
exec(`ffmpeg -i ${media} -af equalizer=f=94:width_type=o:width=2:g=30 ${ran}`, (err, stderr, stdout) => {
fs.unlinkSync(media)
if (err) return reply('Error!')
hah = fs.readFileSync(ran)
Lxa.sendMessage(from, hah, audio, {mimetype: 'audio/mp4', ptt:true, quoted: mek})
fs.unlinkSync(ran)
})
break
//--- nighcore
case 'nightcore':
if (!isVerify) return reply(userB())
if (!isPrem) return reply(premi())
if (!isQuotedAudio) return reply('Reply Audionya')
night = JSON.parse(JSON.stringify(mek).replace('quotedM','m')).message.extendedTextMessage.contextInfo
core = await Lxa.downloadAndSaveMediaMessage(night)
ran = getRandom('.mp3')
reply(wait())
exec(`ffmpeg -i ${core} -filter:a atempo=1.06,asetrate=44100*1.25 ${ran}`, (err, stderr, stdout) => {
fs.unlinkSync(core)
if (err) return reply('Error!')
hah = fs.readFileSync(ran)
Lxa.sendMessage(from, hah, audio, {mimetype: 'audio/mp4', ptt:false, quoted: mek, ptt: true})
fs.unlinkSync(ran)
})
break
//-- add stiker
case 'gets': case 'getstick': case 'getstik':
if (args.length < 1) return reply(`Masukan juga nama stiker pada ${prefix}liststik`)
stik = value
try {
result = fs.readFileSync(`./media/stick/${stik}.webp`)
Lxa.sendMessage(from, result, sticker, selepbot)
} catch {
reply('Pack tidak terdaftar')
}
break
//--- menampilkan list stiker
case 'liststik':
if (!isVerify) return reply(userB())
teks = ` ≡ *STICKER PACK*\nGunakan perintah ${prefix}getstik untuk mengambil stiker\n*Total* : ${_stik.length}\n┌───⊷ *LIST* ⊶\n`
for (let stik of _stik) {
teks += `├╼ ${stik}\n`
}
teks += `└──────────────`
reply(teks.trim())
break
//-- menambah stiker
case 'addstik':
if (!isQuotedSticker) return reply('Reply stiker nya')
if (!isOwner) return reply(ownerB())
stik = value
if (!stik) return reply('Nama sticker nya apa?')
boij = JSON.parse(JSON.stringify(mek).replace('quotedM', 'm')).message.extendedTextMessage.contextInfo
delb = await Lxa.downloadMediaMessage(boij)
_stik.push(`${stik}`)
fs.writeFileSync(`./media/stick/${stik}.webp`, delb)
fs.writeFileSync('./media/stik.json', JSON.stringify(_stik))
Lxa.sendMessage(from, `Sukses Menambahkan Sticker\nCek dengan cara ${prefix}liststik`, MessageType.text, { quoted: mek })
break
//--- menambah vn
case 'addvn':
if (!isQuotedAudio) return reply('Reply vnnya')
if (!isOwner) return reply(ownerB())
vn = value
if (!vn) return reply('Nama audionya apa')
boij = JSON.parse(JSON.stringify(mek).replace('quotedM', 'm')).message.extendedTextMessage.contextInfo
delb = await Lxa.downloadMediaMessage(boij)
_vn.push(`${vn}`)
fs.writeFileSync(`./media/audio/${vn}.mp3`, delb)
fs.writeFileSync('./media/vn.json', JSON.stringify(_vn))
Lxa.sendMessage(from, `Sukses Menambahkan Audio\nCek dengan cara ${prefix}listvn`, MessageType.text, { quoted: mek })
break
//--- mengambil vn
case 'getvn':
if (args.length < 1) return reply(`Masukan juga nama vn pada ${prefix}listvn`)
vn = value
try {
buffer = fs.readFileSync(`./media/audio/${vn}.mp3`)
Lxa.sendMessage(from, buffer, audio, { mimetype: 'audio/mp4', quoted: mek, ptt: true })
} catch {
reply('Pack tidak terdaftar')
}
break
//-- list vn
case 'listvn':
case 'vnlist':
teks = ` ≡ *VN PACK*\nGunakan perintah ${prefix}getvn untuk mengambil vn\n*Total* : ${_vn.length}\n┌───⊷ *LIST* ⊶\n`
for (let vn of _vn) {
teks += `├╼ ${vn}\n`
}
teks += `└──────────────`
reply(teks.trim())
break
//-- menambah foto
case 'addimg':
if (!isQuotedImage && isMedia) return reply('Reply imagenya')
if (!isOwner) return reply(ownerB())
img = value
if (!img) return reply('Nama imagenya apa')
fto = JSON.parse(JSON.stringify(mek).replace('quotedM', 'm')).message.extendedTextMessage.contextInfo
delb = await Lxa.downloadMediaMessage(fto)
_img.push(`${img}`)
fs.writeFileSync(`./media/foto/${img}.jpeg`, delb)
fs.writeFileSync('./media/image.json', JSON.stringify(_img))
Lxa.sendMessage(from, `Sukses Menambahkan Foto\nCek dengan cara ${prefix}listimg`, MessageType.text, { quoted: mek })
break
//--- mengambil foto
case 'getimg':
if (args.length < 1) return reply(`Masukan juga nama image pada ${prefix}listimg`)
img = value
try {
buffer = fs.readFileSync(`./media/foto/${img}.jpeg`)
Lxa.sendMessage(from, buffer, image, { quoted: mek })
} catch {
reply('Pack tidak terdaftar')
}
break
//--- list foto