-
Notifications
You must be signed in to change notification settings - Fork 173
/
Fxc7.js
4663 lines (4437 loc) · 202 KB
/
Fxc7.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
/*
* Tambahin nama author lah
* Author MhankBarBar, Farhan
* Tambahin ya Cape Gan ngefix² Yg Ga work
* Jan numpang nama doank
- What's New?
* New Features
*/
// KALO NGUBAH YG TELITI NTAR GA WORK MALAH NYALAHIN HADEHH
// DAN YG NYURI TANPA KASIH CREDIT INGAT BRO LU SAMPAH🚮
const {
WAConnection,
MessageType,
Presence,
MessageOptions,
Mimetype,
WALocationMessage,
WA_MESSAGE_STUB_TYPES,
ReconnectMode,
ProxyAgent,
GroupSettingChange,
waChatKey,
mentionedJid,
processTime,
} = require('@adiwajshing/baileys')
const fs = require("fs")
const axios = require('axios')
const util = require('util')
const crypto = require('crypto')
const request = require('request')
const moment = require('moment-timezone')
const { exec, spawn } = require('child_process')
const fetch = require('node-fetch')
const FileType = require('file-type')
const tiktod = require('tiktok-scraper')
const ffmpeg = require('fluent-ffmpeg')
const emojiUnicode = require('emoji-unicode')
const cheerio = require('cheerio')
const imageToBase64 = require('image-to-base64')
const speed = require('performance-now')
const imgbb = require('imgbb-uploader')
const { removeBackgroundFromImageFile } = require('remove.bg')
const brainly = require('brainly-scraper')
const vapor = require('vapor-text')
const toMs = require('ms')
const ms = require('parse-ms')
const path = require('path')
const cd = 4.32e+7
const lolcatjs = require('lolcatjs')
const figlet = require('figlet')
// menu all
const { mediaa } = require('./menu/media.js')
const { creator, listephoto, listtextpro } = require('./menu/creator.js')
const { fun } = require('./menu/fun.js')
const { informasi } = require('./menu/informasi.js')
const { spam } = require('./menu/spam.js')
const { scrapper } = require('./menu/scrapper.js')
const { encrypt } = require('./menu/encrypt.js')
const { groupp } = require('./menu/group.js')
const { menupremium } = require('./menu/premium.js')
const { others } = require('./menu/others.js')
const { primbon } = require('./menu/primbon.js')
const { ownerrr } = require('./menu/owner.js')
const { antivirtexx } = require('./menu/antivirtex.js')
const { help, bahasa, donasi, limitcount, bottt, listsurah } = require('./menu/help')
// json read file
const { BarBarApi, ZeksApi, TobzApi, VthearApi, LolApi, Fxc7Api } = JSON.parse(fs.readFileSync('./database/json/apikey.json'))
const _welkom = JSON.parse(fs.readFileSync('./database/json/welkom.json'))
const _nsfw = JSON.parse(fs.readFileSync('./database/json/nsfw.json'))
const _samih = JSON.parse(fs.readFileSync('./database/json/simi.json'))
const _anime = JSON.parse(fs.readFileSync('./database/json/anime.json'))
const _antilink = JSON.parse(fs.readFileSync('./database/json/antilink.json'))
const _antivirtex = JSON.parse(fs.readFileSync('./database/json/antivirtex.json'))
const _badword = JSON.parse(fs.readFileSync('./database/json/badword.json'))
const _limit = JSON.parse(fs.readFileSync('./database/json/limit.json'))
const user = JSON.parse(fs.readFileSync('./database/json/user.json'))
const bucinrandom = JSON.parse(fs.readFileSync('./database/json/bucin.json'))
const randomdilan = JSON.parse(fs.readFileSync('./database/json/dilan.json'))
const hekerbucin = JSON.parse(fs.readFileSync('./database/json/hekerbucin.json'))
const katailham = JSON.parse(fs.readFileSync('./database/json/katailham.json'))
const blocked = JSON.parse(fs.readFileSync('./database/json/blocked.json'))
const setting = JSON.parse(fs.readFileSync('./database/json/setting.json'))
const bad = JSON.parse(fs.readFileSync('./database/json/bad.json'))
const premium = JSON.parse(fs.readFileSync('./database/json/premium.json'))
memberLimit = setting.memberlimit
OwnerNumber = setting.OwnerNumber
instagram = setting.instagram
limitt = setting.limitt
botinfo = setting.botinfo
prefix = setting.prefix
name = setting.name
yt = setting.yt
ban = []
//function
const zalgo = require('./Fxc7/zalgo')
const { fetchFxc7, fetchText } = require('./lib/fetcher')
const { recognize } = require('./lib/ocr')
const { exif } = require('./lib/exif')
const { color, bgcolor } = require('./lib/color')
const { wait, simih, getBuffer, h2k, banner, generateMessageID, getGroupAdmins, getRandom, start, info, success, close } = require('./lib/functions')
const vcard = 'BEGIN:VCARD\n'
+ 'VERSION:3.0\n'
+ 'FN:Farhan\n'
+ 'ORG:Owner FXC7;\n'
+ 'TEL;type=CELL;type=VOICE;waid=628311800241:+62 831-1800-241\n'
+ 'END:VCARD'
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)} Jam ${pad(minutes)} Menit ${pad(seconds)} Detik`
}
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}`
}
function monospace(string) {
return '```' + string + '```'
}
function addMetadata(packname, author) {
if (!packname) packname = 'termux-bot-wa'; if (!author) author = ' Fxc7';
author = author.replace(/[^a-zA-Z0-9]/g, '');
let name = `${author}_${packname}`
if (fs.existsSync(`./src/stickers/${name}.exif`)) {
return `./src/stickers/${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(`./src/stickers/${name}.exif`, buffer, (err) => {
return `./src/stickers/${name}.exif`
}
)
}
const createSerial = (size) => {
return crypto.randomBytes(size).toString('hex').slice(0, size)
}
const limitAdd = (sender) => {
let position = false
Object.keys(_limit).forEach((i) => {
if (_limit[i].id == sender) {
position = i
}
}
)
if (position !== false) {
_limit[position].limit += 1
fs.writeFileSync('./database/json/limit.json', JSON.stringify(_limit))
}
}
const getAllPremiumUser = () => {
const array = []
Object.keys(premium).forEach((i) => {
array.push(premium[i].id)
})
return array
}
const getPremiumExpired = (sender) => {
let position = null
Object.keys(premium).forEach((i) => {
if (premium[i].id === sender) {
position = i
}
})
if (position !== null) {
return premium[position].expired
}
}
const expiredCheck = () => {
setInterval(() => {
let position = null
Object.keys(premium).forEach((i) => {
if (Date.now() >= premium[i].expired) {
position = i
}
}
)
if (position !== null) {
console.log(`Premium expired: ${premium[position].id}`)
premium.splice(position, 1)
fs.writeFileSync('./database/json/premium.json', JSON.stringify(premium))
}
}, 1000)
}
async function starts() {
const frhan = new WAConnection()
frhan.logger.level = 'warn'
console.log(banner.string)
frhan.on('qr', () => {
lolcatjs.fromString('[SYSTEM] SCAN THIS QR CODE...')
})
fs.existsSync('./Fxc7.json') && frhan.loadAuthInfo('./Fxc7.json')
frhan.on('connecting', () => {
start('2', 'Connecting...')
})
frhan.on('open', () => {
success('2', 'Connected:)')
})
await frhan.connect({timeoutMs: 30*1000})
fs.writeFileSync('./Fxc7.json', JSON.stringify(frhan.base64EncodedAuthInfo(), null, '\t'))
frhan.on('group-participants-update', async (anu) => {
if (!_welkom.includes(anu.jid)) return
try {
const mdata = await frhan.groupMetadata(anu.jid)
console.log(anu)
if (anu.action == 'add') {
num = anu.participants[0]
try {
ppimg = await frhan.getProfilePicture(`${num.split('@')[0]}@c.us`)
} catch {
ppimg = 'https://i.ibb.co/Gp4H47k/7dba54f7e250.jpg'
}
teks = `@${num.split('@')[0]} \nWelcome Di Group *${mdata.subject}*\nJangan Lupa Intro!!`
let buff = await getBuffer(ppimg)
frhan.sendMessage(mdata.id, buff, MessageType.image, {caption: teks, contextInfo: {"mentionedJid": [num]}})
} else if (anu.action == 'remove') {
num = anu.participants[0]
try {
ppimg = await frhan.getProfilePicture(`${num.split('@')[0]}@c.us`)
} catch {
ppimg = 'https://i.ibb.co/Gp4H47k/7dba54f7e250.jpg'
}
teks = `Sayonara @${num.split('@')[0]} IRENE MISS YOU:D`
let buff = await getBuffer(ppimg)
frhan.sendMessage(mdata.id, buff, MessageType.image, {caption: teks, contextInfo: {"mentionedJid": [num]}})
}
} catch (e) {
console.log('Error : %s', color(e, 'yellow'))
}
}
)
frhan.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'))
}
}
)
frhan.on('chat-update', async (mek) => {
try {
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 insom = from.endsWith('@g.us')
const nameReq = insom ? mek.participant : mek.key.remoteJid
pushname2 = frhan.contacts[nameReq] != undefined ? frhan.contacts[nameReq].vname || frhan.contacts[nameReq].notify : undefined
var Link = (type === 'conversation' && mek.message.conversation) ? mek.message.conversation : (type == 'imageMessage') && mek.message.imageMessage.caption ? mek.message.imageMessage.caption : (type == 'videoMessage') && mek.message.videoMessage.caption ? mek.message.videoMessage.caption : (type == 'extendedTextMessage') && mek.message.extendedTextMessage.text ? mek.message.extendedTextMessage.text : ''
const { text, extendedText, contact, location, liveLocation, image, video, sticker, document, audio, product, quotedMsg } = MessageType
const date = new Date().toLocaleDateString()
const time = moment.tz('Asia/Jakarta').format('HH:mm:ss')
const jam = moment.tz('Asia/Jakarta').format('HH:mm')
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 : ''
budy = (type === 'conversation') ? mek.message.conversation : (type === 'extendedTextMessage') ? mek.message.extendedTextMessage.text : ''
const FXC7 = Link.slice(0).trim().split(/ +/).shift().toLowerCase()
const command = body.slice(1).trim().split(/ +/).shift().toLowerCase()
const args = body.trim().split(/ +/).slice(1)
const Far = args.join(' ')
const txt = mek.message.conversation
const isCmd = body.startsWith(prefix)
frhan.chatRead(from)
mess = {
wait: '*⏳ ᴡᴀɪᴛ ꜱᴇᴅᴀɴɢ ᴅɪ ᴩʀᴏꜱᴇꜱ...*',
success: '*ꜱᴜᴋꜱᴇꜱ...*',
error: {
bug: '*Terjadi Kesalahan Coba Hubungi Owner Untuk Melaporkan Kesalahan*',
stick: ' *ɢᴀɢᴀʟ, ᴛᴇʀᴊᴀᴅɪ ᴋᴇꜱᴀʟᴀʜᴀɴ ꜱᴀᴀᴛ ᴍᴇɴɢᴋᴏɴᴠᴇʀꜱɪ ɢᴀᴍʙᴀʀ ᴋᴇ ꜱᴛɪᴄᴋᴇʀ*\n*ᴄᴏʙᴀ ᴜʟᴀɴɢɪ ᴅᴇɴɢᴀɴ ʀᴇᴩʟy ꜰᴏᴛᴏ yɢ ꜱᴜᴅᴀʜ ᴛᴇʀᴋɪʀɪᴍ*',
Iv: '*ᴍᴀᴀꜰ ʟɪɴᴋ ᴛɪᴅᴀᴋ ᴠᴀʟɪᴅ!!*'
},
only: {
group: '*ᴍᴀᴀꜰ ᴩᴇʀɪɴᴛᴀʜ ɪɴɪ ʜᴀɴyᴀ ʙɪꜱᴀ ᴅɪ ɢᴜɴᴀᴋᴀɴ ᴅᴀʟᴀᴍ ɢʀᴏᴜᴩ!*',
benned: '*ᴍᴀᴀꜰ ɴᴏᴍᴇʀ ᴋᴀᴍᴜ ᴋᴇ ʙᴀɴɴᴇᴅ ꜱɪʟᴀʜᴋᴀɴ ʜᴜʙᴜɴɢɪ ᴏᴡɴᴇʀ ᴀɢᴀʀ ᴍᴇᴍʙᴜᴋᴀ ʙᴀɴɴᴇᴅ ᴀɴᴅᴀ*',
ownerG: '*ᴍᴀᴀꜰ ᴩᴇʀɪɴᴛᴀʜ ɪɴɪ ʜᴀɴyᴀ ʙɪꜱᴀ ᴅɪ ɢᴜɴᴀᴋᴀɴ ᴏʟᴇʜ ᴏᴡɴᴇʀ ɢʀᴏᴜᴩ!*',
ownerB: '*ᴍᴀᴀꜰ ᴩᴇʀɪɴᴛᴀʜ ɪɴɪ ʜᴀɴyᴀ ʙɪꜱᴀ ᴅɪ ɢᴜɴᴀᴋᴀɴ ᴏʟᴇʜ ᴏᴡɴᴇʀ ʙᴏᴛ!* ',
premium: '*ᴍᴀᴀꜰ ꜰɪᴛᴜʀ ɪɴɪ ᴋʜᴜꜱᴜꜱ ᴜꜱᴇʀ ᴩʀᴇᴍɪᴜᴍ!!*',
userB: `Hai Kak ${pushname2} Kamu Belom Terdaftar Didatabase Silahkan Ketik \n${prefix}daftar`,
admin: '*ᴍᴀᴀꜰ ᴩᴇʀɪɴᴛᴀʜ ɪɴɪ ʜᴀɴyᴀ ʙɪꜱᴀ ᴅɪ ɢᴜɴᴀᴋᴀɴ ᴏʟᴇʜ ᴀᴅᴍɪɴ ɢʀᴏᴜᴩ!*',
Badmin: '*ᴍᴀᴀꜰ ᴩᴇʀɪɴᴛᴀʜ ɪɴɪ ʜᴀɴyᴀ ʙɪꜱᴀ ᴅɪ ɢᴜɴᴀᴋᴀɴ ᴋᴇᴛɪᴋᴀ ʙᴏᴛ ᴍᴇɴᴊᴀᴅɪ ᴀᴅᴍɪɴ!*',
}
}
const botNumber = frhan.user.jid
const ownerNumber = [`${OwnerNumber}@s.whatsapp.net`] // owner number ubah aja
const ownerInfo = `${OwnerNumber}`
const isGroup = from.endsWith('@g.us')
const sender = isGroup ? mek.participant : mek.key.remoteJid
const groupMetadata = isGroup ? await frhan.groupMetadata(from) : ''
const groupName = isGroup ? groupMetadata.subject : ''
const groupId = isGroup ? groupMetadata.jid : ''
const groupMembers = isGroup ? groupMetadata.participants : ''
const groupDesc = isGroup ? groupMetadata.desc : ''
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 isAnime = isGroup ? _anime.includes(from) : false
const isNsfw = isGroup ? _nsfw.includes(from) : false
const isSimi = isGroup ? _samih.includes(from) : false
const isBadWord = isGroup ? _badword.includes(from) : false
const isAntiLink = isGroup ? _antilink.includes(from) : false
const isAntiVirtex = isGroup ? _antivirtex.includes(from) : false
const isOwner = ownerNumber.includes(sender)
const isUser = user.includes(sender)
const isBanned = ban.includes(sender)
const isPrem = premium.includes(sender) || isOwner
const FarhanGans = ["[email protected]"]
const FarhanGans2 = " ~ 𝐂𝐫𝐞𝐚𝐭𝐞𝐝 𝐁𝐲 𝐅𝐚𝐫𝐡𝐚𝐧𝐗𝐂𝐨𝐝𝐞𝟳"
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) => {
frhan.sendMessage(from, teks, text, {quoted:mek})
}
const sendMess = (hehe, teks) => {
frhan.sendMessage(hehe, teks, text)
}
const mentions = (teks, memberr, id) => {
(id == null || id == undefined || id == false) ? frhan.sendMessage(from, teks.trim(), extendedText, {contextInfo: {"mentionedJid": memberr}}) : frhan.sendMessage(from, teks.trim(), extendedText, {quoted: mek, contextInfo: {"mentionedJid": memberr}})
}
const costum = (pesan, tipe, target, target2) => {
frhan.sendMessage(from, pesan, tipe, {quoted: { key: { fromMe: false, participant: `${target}`, ...(from ? { remoteJid: from } : {}) }, message: { conversation: `${target2}` }}})
}
if (isGroup) {
try {
const getmemex = groupMembers.length
if (getmemex <= memberLimit) {
setTimeout( () => {
frhan.groupLeave(from)
}, 2000)
setTimeout ( () => {
frhan.sendMessage(from, `Maaf Yaa Bye All👋`, text)
}, 1000)
setTimeout( () => {
frhan.sendMessage(from, `Maaf ${name} Tidak Bisa Masuk Group Karna Member Group ${groupMetadata.subject} Tidak Memenuhi Limit Member\n\nMinimal Member ${memberLimit}`, text)
}, 0)
}
} catch (err) { console.error(err) }
}
if (FXC7.includes("://chat.whatsapp.com/")){
if (!isGroup) return
if (!isAntiLink) return
if (isGroupAdmins) return reply(`${pushname2} Adalah Admin Group Kamu Tidak Akan Di kick`)
frhan.updatePresence(from, Presence.composing)
var Kick = `${sender.split("@")[0]}@s.whatsapp.net`
setTimeout( () => {
reply('byee👋')
}, 1100)
setTimeout( () => {
frhan.groupRemove(from, [Kick]).catch((e) => {reply(`*ERROR:* ${e}`)})
}, 1000)
setTimeout( () => {
reply(`Link Group Terdeteksi maaf *${pushname2}* anda akan di kick`)
}, 0)
}
if (txt.length > 500){
if (!isGroup) return
if (!isAntiVirtex) return
if (isGroupAdmins) return reply(`${pushname2} Adalah Admin Group Kamu Tidak Akan Di kick`)
frhan.updatePresence(from, Presence.composing)
var kic = `${sender.split("@")[0]}@s.whatsapp.net`
costum(monospace(`Virtex Terdeteksi maaf ${sender.split("@")[0]} anda akan di kick dari group`))
setTimeout( () => {
frhan.groupRemove(from, [kic]).catch((e)=>{reply(`*ERR:* ${e}`)})
frhan.blockUser(sender, "add")
}, 0)
}
if (isGroup && isBadWord) {
if (bad.includes(FXC7)) {
if (!isGroupAdmins) {
return reply("JAGA UCAPAN DONG!!")
.then(() => frhan.groupRemove(from, sender))
.then(() => {
frhan.sendMessage(from, `*「 ANTI BADWORD 」*\nKamu dikick karena berkata kasar!`, text ,{quoted: mek})
}).catch(() => frhan.sendMessage(from, `Untung iren bukan admin, kalo admin udah irenn kick!`, text , {quoted : mek}))
} else {
return reply( "Tolong Jaga Ucapan Min👍")
}
}
}
const checkLimit = (sender) => {
let found = false
for (let lmt of _limit) {
if (lmt.id === sender) {
let limitCounts = limitt - lmt.limit
if (limitCounts <= 0) return frhan.sendMessage(from,`Limit request anda sudah habis\n`, text, { quoted: mek})
frhan.sendMessage(from, `limit anda : ${limitCounts}`, text, { quoted : mek})
found = true
}
}
if (found === false) {
let obj = { id: sender, limit: 0 }
_limit.push(obj)
fs.writeFileSync('./database/json/limit.json', JSON.stringify(_limit))
frhan.sendMessage(from, `limit anda : ${limitCounts}`, text, { quoted : mek})
}
}
//funtion limited
const isLimit = (sender) =>{
if (isOwner && isPrem) {return false;}
let position = false
for (let i of _limit) {
if (i.id === sender) {
let limits = i.limit
if (limits >= limitt ) {
position = true
reply('*Limit Anda Sudah Habis*')
return true
} else {
_limit
position = true
return false
}
}
}
if (position === false) {
const obj = { id: sender, limit: 0 }
_limit.push(obj)
fs.writeFileSync('./database/json/limit.json',JSON.stringify(_limit))
return false
}
}
expiredCheck()
var premi = '*NOT PREMIUM*'
if (isPrem) {
premi = '*YES PREMIUM*'
}
if (isOwner) {
premi = '*UNLIMITED PREMIUM*'
}
var Simihh = 'OFF'
if(isSimi) {
Simihh = 'ON'
}
var Welcomee = 'OFF'
if (isWelkom) {
Welcomee = 'ON'
}
var ModeAnime = 'OFF'
if (isAnime) {
ModeAnime = 'ON'
}
var Nsfww = 'OFF'
if (isNsfw) {
Nsfww = 'ON'
}
var BadWordd = 'OFF'
if (isBadWord) {
BadWordd = 'ON'
}
var AntiLinkk = 'OFF'
if (isAntiLink) {
AntiLinkk = 'ON'
}
var AntiVirtexx = 'OFF'
if (isAntiVirtex) {
AntiVirtexx = 'ON'
}
const sleep = async (ms) => {
return new Promise(resolve => setTimeout(resolve, ms));
}
colors = ['red','white','black','blue','yellow','green', 'aqua']
const isMedia = (type === 'imageMessage' || type === 'videoMessage')
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')
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 (!isGroup && !isCmd) console.log('\x1b[1;31m~\x1b[1;37m>', '[\x1b[1;31mRECV\x1b[1;37m]', time, color('Message'), '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))
if (!isCmd && isGroup) console.log('\x1b[1;31m~\x1b[1;37m>', '[\x1b[1;31mRECV\x1b[1;37m]', time, color('Message'), 'from', color(sender.split('@')[0]), 'in', color(groupName), 'args :', color(args.length))
let authorname = frhan.contacts[from] != undefined ? frhan.contacts[from].vname || frhan.contacts[from].notify : undefined
if (authorname != undefined) { } else { authorname = groupName }
switch(command) {
case 'mutualan':
if (!isUser) return reply(mess.only.userB)
if (isGroup) return reply( 'Command ini tidak bisa digunakan di dalam grup,silahkan gunakan di private chat bot')
const anug = fs.readFileSync('./database/json/user.json')
const anugJson = JSON.parse(anug)
const rondIndox = Math.floor(Math.random() * anugJson.length)
const rondKoy = anugJson[rondIndox]
await reply('Looking for a partner...')
await sleep(3000)
await reply(`wa.me/${rondKoy.split("@")[0]}`)
await sleep(1000)
await reply( `Partner found: 🙉\n*${prefix}next* — find a new partner`)
break
case 'next':
if (!isUser) return reply(mess.only.userB)
if (isGroup) return reply( 'Command ini tidak bisa digunakan di dalam grup,silahkan gunakan di private chat bot')
const aanug = fs.readFileSync('./database/json/user.json')
const aanugJson = JSON.parse(aanug)
const rondIndoxx = Math.floor(Math.random() * aanugJson.length)
const rondKoyy = aanugJson[rondIndoxx]
await reply('Looking for a partner...')
await sleep(3000)
await reply(`wa.me/${rondKoyy.split("@")[0]}`)
await sleep(1000)
await reply( `Partner found: 🙉\n*${prefix}next* — find a new partner`)
break
case 'vapor':
if (!isOwner) return reply(mess.only.owner)
if (args.length < 1) return reply("text nya mana ?")
reply(vapor(`${args[0]}`))
break
case 'zalgo':
if (!isOwner) return reply(mess.only.owner)
if (args.length < 1) return reply("text nya mana ?")
reply(zalgo(`${args[0]}`))
break
case 'pitch':
if (!isOwner) return reply(mess.only.owner)
if (!isQuotedAudio) return reply('reply sound nya!!!')
pitch = isQuotedAudio ? JSON.parse(JSON.stringify(mek).replace('quotedM','m')).message.extendedTextMessage.contextInfo : mek
if (!Number(args[0])) return reply(`Contoh Penggunaan : ${prefix}pitch 4`)
if (args[0] > 12) return reply("Max 12")
const pitchsave = await frhan.downloadAndSaveMediaMessage(pitch, `./database/audio/${args[1]}.mp3`)
exec(`ffmpeg -i ${pitchsave} -filter_complex \`asetrate=48000*2^(${args[0]}/12),atempo=1/2^(${args[0]}/12)\` database/audio/${args[1]}.mp3 -y`, (err, stderr, stdout) => {
if (err) return reply('ERROR')
frhan.sendMessage(from, `./database/audio/${args[1]}.mp3`, MessageType.audio, {quoted: mek})
})
await limitAdd(sender)
break
case 'listephoto':
frhan.sendMessage(from, monospace(listephoto()), text, {quoted: mek})
break
case 'listtextpro':
frhan.sendMessage(from, monospace(listtextpro()), text, {quoted: mek})
break
case 'cekpremium':
const cekExp = ms(getPremiumExpired(sender) - Date.now())
reply(`*「 PREMIUM EXPIRED 」*\n\n➸ *ID*: ${sender.split('@')[0]}\n➸ *Premium left*: ${cekExp.days} day(s) ${cekExp.hours} hour(s) ${cekExp.minutes} minute(s)`)
break
case 'wame':
reply(`wa.me/${sender.split('@')[0]}\nAtau\napi.whatsapp.com/send?phone=${sender.split('@')[0]}`)
break
case 'slow':
encmedia = JSON.parse(JSON.stringify(mek).replace('quotedM','m')).message.extendedTextMessage.contextInfo
media = await frhan.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)
frhan.sendMessage(from, hah, audio, {mimetype: 'audio/mp4', ptt:true, quoted: mek})
fs.unlinkSync(ran)
})
break
case 'gemuk':
encmedia = JSON.parse(JSON.stringify(mek).replace('quotedM','m')).message.extendedTextMessage.contextInfo
media = await frhan.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)
frhan.sendMessage(from, hah, audio, {mimetype: 'audio/mp4', ptt:true, quoted: mek})
fs.unlinkSync(ran)
})
break
case 'tupai':
encmedia = JSON.parse(JSON.stringify(mek).replace('quotedM','m')).message.extendedTextMessage.contextInfo
media = await frhan.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)
frhan.sendMessage(from, hah, audio, {mimetype: 'audio/mp4', ptt:true, quoted: mek})
fs.unlinkSync(ran)
})
break
case 'toptt':
reply(mess.wait)
encmedia = JSON.parse(JSON.stringify(mek).replace('quotedM','m')).message.extendedTextMessage.contextInfo
media = await frhan.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)
frhan.sendMessage(from, topt, audio, {mimetype: 'audio/mp4', quoted: mek, ptt:true})
})
break
case 'bass':
encmedia = JSON.parse(JSON.stringify(mek).replace('quotedM','m')).message.extendedTextMessage.contextInfo
media = await frhan.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)
frhan.sendMessage(from, hah, audio, {mimetype: 'audio/mp4', ptt:true, quoted: mek})
fs.unlinkSync(ran)
})
break
case 'brainly':
if (!isUser) return reply(mess.only.userB)
if (isBanned) return reply(mess.only.benned)
if (isLimit(sender)) return reply(limitend(pushname2))
brien = body.slice(9)
brainly(`${brien}`).then(res => {
teks = '❉───────────────────────❉\n'
for (let Y of res.data) {
teks += `\n*「 _BRAINLY_ 」*\n\n*➸ Pertanyaan:* ${Y.pertanyaan}\n\n*➸ Jawaban:* ${Y.jawaban[0].text}\n❉───────────────────────❉\n`
}
costum(teks, text, FarhanGans, `Ciee Cari Jawaban Yaa😂\nFollow IG: @_farhan_xcode7`)
console.log(res)
})
await limitAdd(sender)
break
case 'daftar':
case 'verify':
frhan.updatePresence(from, Presence.composing)
if (isUser) return reply('kamu sudah Menjadi Temen IRIENEBOT:D')
if (isBanned) return reply(mess.only.benned)
user.push(sender)
fs.writeFileSync('./database/json/user.json', JSON.stringify(user))
try {
ppimg = await frhan.getProfilePicture(`${sender.split('@')[0]}@s.whatsapp.net`)
} catch {
ppimg = 'https://i.ibb.co/Gp4H47k/7dba54f7e250.jpg'
}
const noSeri = createSerial(15)
captionnya = `╭─「 *PENDAFTARAN USER* 」\n│ \`\`\`Pendaftaran berhasil dengan\`\`\` \n│ \`\`\`SN: ${noSeri}\`\`\`\n│\n│\`\`\`Pada ${date} ${time}\`\`\`\n│\`\`\`[Nama]: ${pushname2}\`\`\`\n│\`\`\`[Nomor]: wa.me/${sender.split("@")[0]}\`\`\`\n│\`\`\`Untuk menggunakan bot\`\`\`\n│\`\`\`silahkan\`\`\`\n│\`\`\`kirim ${prefix}help/menu\`\`\`\n│\`\`\`\n│Total Pengguna: ${user.length} Orang\`\`\`\n╰─────────────────────────`
daftarimg = await getBuffer(ppimg)
frhan.sendMessage(from, daftarimg, image, {quoted: mek, caption: captionnya})
break
case 'menu':
case 'help':
if (isBanned) return reply(mess.only.benned)
if (!isUser) return reply(mess.only.userB)
uptime = process.uptime()
user.push(sender)
costum(help(prefix, instagram, yt, name, pushname2, user, limitt, uptime, jam, tanggal(), groupName, premi, Simihh, Welcomee, ModeAnime, Nsfww, BadWordd, AntiLinkk, AntiVirtexx), text, FarhanGans, FarhanGans2)
break
// fitur simple
case 'listsurah':
await costum(listsurah(), text, FarhanGans, FarhanGans2)
break
case 'menumedia':
user.push(sender)
await costum(mediaa(prefix, pushname2, groupName, name), text, FarhanGans, FarhanGans2)
break
case 'menucreator':
user.push(sender)
await costum(creator(prefix, pushname2, groupName, user, name), text, FarhanGans, FarhanGans2)
break
case 'menufun':
user.push(sender)
await costum(fun(prefix, pushname2, groupName, user, name), text, FarhanGans, FarhanGans2)
break
case 'menuspam':
user.push(sender)
await costum(spam(prefix, pushname2, groupName, user, name), text, FarhanGans, FarhanGans2)
break
case 'menuinformasi':
user.push(sender)
await costum(informasi(prefix, pushname2, groupName, user, name), text, FarhanGans, FarhanGans2)
break
case 'menuprimbon':
user.push(sender)
await costum(primbon(prefix, pushname2, groupName, user, name), text, FarhanGans, FarhanGans2)
break
case 'menuencrypt':
user.push(sender)
await costum(encrypt(prefix, pushname2, groupName, user, name), text, FarhanGans, FarhanGans2)
break
case 'menugroup':
user.push(sender)
uptime = process.uptime()
await costum(groupp(prefix, pushname2, groupName, user, name, uptime, jam, tanggal(), premi, Simihh, Welcomee, ModeAnime, Nsfww, BadWordd, AntiLinkk, AntiVirtexx), text, FarhanGans, FarhanGans2)
break
case 'menupremium':
user.push(sender)
premium.push(sender)
await costum(menupremium(prefix, pushname2, groupName, user, name, premi), text, FarhanGans, FarhanGans2)
break
case 'menuothers':
user.push(sender)
await costum(others(prefix, pushname2, groupName, user, name), text, FarhanGans, FarhanGans2)
break
case 'menuowner':
user.push(sender)
await costum(ownerrr(prefix, pushname2, groupName, user, name), text, FarhanGans, FarhanGans2)
break
case 'menuscrapper':
user.push(sender)
await costum(scrapper(prefix, pushname2, groupName, user, name), text, FarhanGans, FarhanGans2)
break
// end fitur simple
case 'infobot':
await costum(bottt(prefix), text, FarhanGans, botinfo)
break
case 'bahasa':
if (isBanned) return reply(mess.only.benned)
if (!isUser) return reply(mess.only.userB)
frhan.sendMessage(from, bahasa(prefix), text, {quoted: mek})
break
case 'donasi':
frhan.sendMessage(from, donasi(name), text, {quoted: mek})
break
case 'info':
me = frhan.user
user.push(sender)
uptime = process.uptime()
teks = `➽ *Nama Bot* : ${me.name}\n➽ *Owner Bot* : https://api.whatsapp.com/${ownerInfo}\n➽ *prefix* : | ${prefix} |\n➽ *Total Block* : ${blocked.length}\n➽ *Aktif Sejak* : ${kyun(uptime)}\n➽ *Total Pengguna* : ${user.length} User\n➽ *Instagram* : https://www.instagram.com/_farhan_xcode7\n\n➽ *Special Thanks To* :\n\n➽ Allah SWT \n➽ MhankBarBar\n➽ Nurutomo\n➽ Manurios`
buffer = await getBuffer(me.imgUrl)
frhan.sendMessage(from, buffer, image, {quoted: mek, caption: teks, contextInfo:{mentionedJid: [me.jid]}})
break
case 'totaluser':
frhan.updatePresence(from, Presence.composing)
if (!isUser) return reply(mess.only.userB)
if (!isOwner) return reply(mess.only.ownerB)
teks = `╭────「 *TOTAL USER ${name}* 」\n`
no = 0
for (let hehehe of user) {
no += 1
teks += `[${no.toString()}] @${hehehe.split('@')[0]}\n`
}
teks += `│+ Total Pengguna : ${user.length}\n╰──────⎿ *${name}* ⏋────`
frhan.sendMessage(from, teks.trim(), extendedText, {quoted: mek, contextInfo: {"mentionedJid": user}})
break
case 'blocklist':
teks = 'List Block :\n'
for (let block of blocked) {
teks += `~> @${block.split('@')[0]}\n`
}
teks += `Total : ${blocked.length}`
frhan.sendMessage(from, teks.trim(), extendedText, {quoted: mek, contextInfo: {"mentionedJid": blocked}})
break
case 'banlist':
ben = '```List Banned``` :\n'
for (let banned of ban) {
ben += `~> @${banned.split('@')[0]}\n`
}
ben += `Total : ${ban.length}`
frhan.sendMessage(from, ben.trim(), extendedText, {quoted: mek, contextInfo: {"mentionedJid": ban}})
break
case 'ban':
frhan.updatePresence(from, Presence.composing)
if (args.length < 1) return
if (!isOwner) return reply(mess.only.ownerB)
mentioned = mek.message.extendedTextMessage.contextInfo.mentionedJid
ban = mentioned
reply(`berhasil banned : ${ban}`)
break
case 'unban':
if (!isOwner)return reply(mess.only.ownerB)
bnnd = body.slice(8)
ban.splice(`${bnnd}@s.whatsapp.net`, 1)
reply(`Nomor wa.me/${bnnd} telah di unban!`)
break
case 'block':
frhan.updatePresence(from, Presence.composing)
if (!isGroup) return reply(mess.only.group)
if (!isOwner) return reply(mess.only.ownerB)
frhan.blockUser (`${body.slice(7)}@c.us`, "add")
frhan.sendMessage(from, `perintah Diterima, memblokir ${body.slice(7)}@c.us`, text)
break
case 'unblock':
if (isBanned) return reply(mess.only.benned)
if (!isUser) return reply(mess.only.userB)
if (!isGroup) return reply(mess.only.group)
if (!isOwner) return reply(mess.only.ownerB)
frhan.blockUser (`${body.slice(9)}@c.us`, "remove")
frhan.sendMessage(from, `perintah Diterima, membuka blokir ${body.slice(9)}@c.us`, text)
break
case 'readmore':
if (isBanned) return reply(mess.only.benned)
if (!isUser) return reply(mess.only.userB)
if (args.length < 1) return reply('teks nya mana om?')
var kls = body.slice(9)
var has = kls.split("/")[0];
var kas = kls.split("/")[1];
if (args.length < 1) return reply(mess.blank)
frhan.sendMessage(from, `${has}${kas}` , text, { quoted: mek })
break
case 'resetlimit':
if (!isOwner) return reply(mess.only.ownerB)
var obj = []
fs.writeFileSync('./database/json/limit.json', JSON.stringify(obj, null, '\t'))
reply(`LIMIT BERHASIL DI RESET`)
break
case 'limit':
if (!isUser) return reply(mess.only.userB)
checkLimit(sender)
break
case 'ocr':
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 frhan.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('Foto aja gan Jangan Video')
}
await limitAdd(sender)
break
case 'stiker':
case 'sticker':
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 frhan.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')
exec(`webpmux -set exif ${addMetadata('FarhanXCode7', 'Jangan Lupa Donasi')} ${ran} -o ${ran}`, async (error) => {
if (error) return reply(mess.error.stick)
await costum(fs.readFileSync(ran), sticker, FarhanGans, ` ~ Nihh Udah Jadi Stikernya`)
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:[email protected], split [a][b]; [a] palettegen=reserve_transparent=on:transparency_color=ffffff [p]; [b][p] paletteuse`])
.toFormat('webp')
.save(ran)
} else if ((isMedia && mek.message.videoMessage.seconds < 11 || isQuotedVideo && mek.message.extendedTextMessage.contextInfo.quotedMessage.videoMessage.seconds < 11) && args.length == 0) {
const encmedia = isQuotedVideo ? JSON.parse(JSON.stringify(mek).replace('quotedM','m')).message.extendedTextMessage.contextInfo : mek
const media = await frhan.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(`❌ Gagal, pada saat mengkonversi ${tipe} ke stiker`)
})
.on('end', function () {
console.log('Finish')
exec(`webpmux -set exif ${addMetadata('FarhanXCode7', 'Jangan Lupa Donasi')} ${ran} -o ${ran}`, async (error) => {
if (error) return reply(mess.error.stick)
await costum(fs.readFileSync(ran), sticker, FarhanGans, `~ Nih Dah Jadi Gif Stikernya`)
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:[email protected], 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(mek).replace('quotedM','m')).message.extendedTextMessage.contextInfo : mek
const media = await frhan.downloadAndSaveMediaMessage(encmedia)
ranw = getRandom('.webp')
ranp = getRandom('.png')
reply(mess.wait)
keyrmbg = 'Your-ApiKey'
await removeBackgroundFromImageFile({path: media, apiKey: keyrmbg, 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('Gagal, Terjadi kesalahan, silahkan coba beberapa saat lagi.')
})
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)
exec(`webpmux -set exif ${addMetadata('FarhanXCode7', authorname)} ${ranw} -o ${ranw}`, async (error) => {
if (error) return reply(mess.error.stick)
frhan.sendMessage(from, fs.readFileSync(ranw), sticker, {quoted: mek})
fs.unlinkSync(ranw)
})
})
})
} else {
reply(`Kirim gambar dengan caption ${prefix}sticker atau tag gambar yang sudah dikirim`)
}
break
case 'trigger':
if (!isUser) return reply(mess.only.userB)
if (isBanned) return reply (mess.only.benned)
if (isLimit(sender)) return reply(limits.limitend(pushname2))
var imgbb = require('imgbb-uploader')
if ((isMedia && !mek.message.videoMessage || isQuotedImage) && args.length == 0) {
ger = isQuotedImage ? JSON.parse(JSON.stringify(mek).replace('quotedM','m')).message.extendedTextMessage.contextInfo : mek
reply(mess.wait)
owgi = await frhan.downloadAndSaveMediaMessage(ger)
anu = await imgbb("3b8594f4cb11895f4084291bc655e510", owgi)
teks = `${anu.display_url}`
ranp = getRandom('.gif')
rano = getRandom('.webp')
anu1 = `https://some-random-api.ml/canvas/triggered?avatar=${teks}`
exec(`wget ${anu1} -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)
exec(`webpmux -set exif ${addMetadata('FarhanXCode7', 'Jangan Lupa Donasi')} ${rano} -o ${rano}`, async (error) => {
if (error) return reply(mess.error.stick)
frhan.sendMessage(from, fs.readFileSync(rano), sticker, {quoted: mek})
fs.unlinkSync(rano)
})
})
} else {
reply('Gunakan foto!')
}
await limitAdd(sender)
break
case 'wasted':
if (!isUser) return reply(mess.only.userB)