-
Notifications
You must be signed in to change notification settings - Fork 159
/
index.js
2486 lines (2444 loc) · 128 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
/*
]=====> RAMLAN ID <=====[ ]=====> YT Ramlan ID <=====[ ]=====> 085559240360 <=====[
*/
// ANAK ANJING PASTI YANG ATAS DI UBAH
// NGOTAK KONSOL
// NUMPANG NAMA TIDAK MEMBUAT MU PRO
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 crypto = require('crypto')
const base64Img = require('base64-img')
const fetch = require('node-fetch')
const { color, bgcolor } = require('./lib/color')
const { donasi } = require('./lib/donasi')
const { fetchJson } = require('./lib/fetcher')
const { cara } = require('./src/cara')
const { iklan1 } = require('./src/iklan')
const { exec } = require("child_process")
const { wait, simih, getBuffer, h2k, generateMessageID, getGroupAdmins, getRandom, banner, start, info, success, close } = require('./lib/functions')
const speed = require('performance-now')
const brainly = require('brainly-scraper')
const ffmpeg = require('fluent-ffmpeg')
const imgbb = require('imgbb-uploader')
const cd = 4.32e+7
const { nad } = require('./language')
const vcard = 'BEGIN:VCARD\n'
+ 'VERSION:3.0\n'
+ 'FN:RAMLAN ID\n' // GANTI NAMA LU
+ 'ORG:OWNER BOTZ;\n'
+ 'TEL;type=CELL;type=VOICE;waid=6285559240360:+62 855-5924-0360\n' // GANTI NOMOR LU
+ 'END:VCARD'
// UDAH SEGITU KONSOL KEBAWAH BIARIN AJA
const ngonsol = JSON.parse(fs.readFileSync('./settings/Ramlan.json'))
const {
botName,
ownerName,
XteamKey,
ownerNumber,
botPrefix,
GrupLimitz,
UserLimitz,
CeerTod
} = ngonsol
// POWERED BY RAMLAN ID
prefix = botPrefix
blocked = []
limitawal = UserLimitz
memberlimit = GrupLimitz
cr = CeerTod
// LOAD JSON
const _leveling = JSON.parse(fs.readFileSync('./database/group/leveling.json'))
const _level = JSON.parse(fs.readFileSync('./database/user/level.json'))
const _registered = JSON.parse(fs.readFileSync('./database/user/registered.json'))
const welkom = JSON.parse(fs.readFileSync('./database/group/welkom.json'))
const nsfw = JSON.parse(fs.readFileSync('./database/group/nsfw.json'))
const samih = JSON.parse(fs.readFileSync('./database/group/simi.json'))
const event = JSON.parse(fs.readFileSync('./database/group/event.json'))
const _limit = JSON.parse(fs.readFileSync('./database/user/limit.json'))
const uang = JSON.parse(fs.readFileSync('./database/user/uang.json'))
const ban = JSON.parse(fs.readFileSync('./database/user/banned.json'))
const premium = JSON.parse(fs.readFileSync('./database/user/premium.json'))
const antilink = JSON.parse(fs.readFileSync('./database/group/antilink.json'))
/*
]=====> LOAD MENU <=====[
*/
const { help } = require('./lib/help')
const { simple } = require('./database/menu/simple')
const { gabut } = require('./database/menu/gabut')
const { groupm } = require('./database/menu/group')
const { download } = require('./database/menu/download')
const { dompet } = require('./database/menu/dompet')
const { random } = require('./database/menu/random')
const { other } = require('./database/menu/other')
const { owb } = require('./database/menu/owb')
const { maker } = require('./database/menu/maker')
const { sound } = require('./database/menu/sound')
/*
]=====> FUNCTION <=====[
*/
const getLevelingXp = (sender) => {
let position = false
Object.keys(_level).forEach((i) => {
if (_level[i].id === sender) {
position = i
}
})
if (position !== false) {
return _level[position].xp
}
}
const getLevelingLevel = (sender) => {
let position = false
Object.keys(_level).forEach((i) => {
if (_level[i].id === sender) {
position = i
}
})
if (position !== false) {
return _level[position].level
}
}
const getLevelingId = (sender) => {
let position = false
Object.keys(_level).forEach((i) => {
if (_level[i].id === sender) {
position = i
}
})
if (position !== false) {
return _level[position].id
}
}
const addLevelingXp = (sender, amount) => {
let position = false
Object.keys(_level).forEach((i) => {
if (_level[i].id === sender) {
position = i
}
})
if (position !== false) {
_level[position].xp += amount
fs.writeFileSync('./database/user/level.json', JSON.stringify(_level))
}
}
const addLevelingLevel = (sender, amount) => {
let position = false
Object.keys(_level).forEach((i) => {
if (_level[i].id === sender) {
position = i
}
})
if (position !== false) {
_level[position].level += amount
fs.writeFileSync('./database/user/level.json', JSON.stringify(_level))
}
}
const addLevelingId = (sender) => {
const obj = {id: sender, xp: 1, level: 1}
_level.push(obj)
fs.writeFileSync('./database/user/level.json', JSON.stringify(_level))
}
const getRegisteredRandomId = () => {
return _registered[Math.floor(Math.random() * _registered.length)].id
}
const addRegisteredUser = (userid, sender, age, time, serials) => {
const obj = { id: userid, name: sender, age: age, time: time, serial: serials }
_registered.push(obj)
fs.writeFileSync('./database/user/registered.json', JSON.stringify(_registered))
}
const createSerial = (size) => {
return crypto.randomBytes(size).toString('hex').slice(0, size)
}
const checkRegisteredUser = (sender) => {
let status = false
Object.keys(_registered).forEach((i) => {
if (_registered[i].id === sender) {
status = true
}
})
return status
}
const addATM = (sender) => {
const obj = {id: sender, uang : 0}
uang.push(obj)
fs.writeFileSync('./database/user/uang.json', JSON.stringify(uang))
}
const addKoinUser = (sender, amount) => {
let position = false
Object.keys(uang).forEach((i) => {
if (uang[i].id === sender) {
position = i
}
})
if (position !== false) {
uang[position].uang += amount
fs.writeFileSync('./database/user/uang.json', JSON.stringify(uang))
}
}
const checkATMuser = (sender) => {
let position = false
Object.keys(uang).forEach((i) => {
if (uang[i].id === sender) {
position = i
}
})
if (position !== false) {
return uang[position].uang
}
}
const bayarLimit = (sender, amount) => {
let position = false
Object.keys(_limit).forEach((i) => {
if (_limit[i].id === sender) {
position = i
}
})
if (position !== false) {
_limit[position].limit -= amount
fs.writeFileSync('./database/user/limit.json', JSON.stringify(_limit))
}
}
const confirmATM = (sender, amount) => {
let position = false
Object.keys(uang).forEach((i) => {
if (uang[i].id === sender) {
position = i
}
})
if (position !== false) {
uang[position].uang -= amount
fs.writeFileSync('./database/user/uang.json', JSON.stringify(uang))
}
}
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)} M ${pad(seconds)} S`
}
/*
]=====> SCAN QR <=====[
*/
const baby = new WAConnection()
baby.logger.level = 'warn'
console.log(banner.string)
baby.on('qr', qr => {
qrcode.generate(qr, { small: true })
console.log(color('[','white'), color('!','red'), color(']','white'), color(' SUBSCRIBE YT RAMLAN CHANNEL'))
})
baby.on('credentials-updated', () => {
fs.writeFileSync('./Ramlan.json', JSON.stringify(baby.base64EncodedAuthInfo(), null, '\t'))
info('2', 'ingfokan cuyy...')
})
fs.existsSync('./Ramlan.json') && baby.loadAuthInfo('./Ramlan.json')
baby.on('connecting', () => {
start('2', 'Ramlan Connecting...')
})
baby.on('open', () => {
success('2', 'Ramlan Connected')
})
baby.connect({timeoutMs: 30*1000})
baby.on('group-participants-update', async (anu) => {
if (!welkom.includes(anu.jid)) return
try {
const mdata = await baby.groupMetadata(anu.jid)
console.log(anu)
if (anu.action == 'add') {
num = anu.participants[0]
try {
ppimg = await baby.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 = `[ *WELCOME IN GC ${mdata.subject}* ] \n___________________________\n@${num.split('@')[0]} Intro/Dikick!!! \n➸ Nama : \n➸ Umur : \n➸ Askot : \n➸ Gender : \n➸ Udah Punya Doi/Blm: \n➸ Pap Muka dumlu!!! \n➸ Instagram? \n𝐒𝐚𝐯𝐞 𝐍𝐨𝐦𝐨𝐫 𝐀𝐃𝐌𝐈𝐍! \n *___________________________*\nJangan jadi kutu lomcat sayang!!`
let buff = await getBuffer(ppimg)
baby.sendMessage(mdata.id, buff, MessageType.image, {caption: teks, contextInfo: {"mentionedJid": [num]}})
} else if (anu.action == 'remove') {
num = anu.participants[0]
try {
ppimg = await baby.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 = `SELAMAT TINGGAL... @${num.split('@')[0]}👋* \n_Jasamu akan saya kubur dalam dalam_`
let buff = await getBuffer(ppimg)
baby.sendMessage(mdata.id, buff, MessageType.image, {caption: teks, contextInfo: {"mentionedJid": [num]}})
}
} catch (e) {
console.log('Error : %s', color(e, 'red'))
}
})
baby.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'))
}
})
baby.on('message-new', async (mek) => {
try {
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 timi = moment.tz('Asia/Jakarta').add(30, 'days').calendar();
const timu = moment.tz('Asia/Jakarta').add(20, 'days').calendar();
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 : ''
var tas = (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 mesejAnti = tas.slice(0).trim().split(/ +/).shift().toLowerCase()
const command = body.slice(1).trim().split(/ +/).shift().toLowerCase()
const args = body.trim().split(/ +/).slice(1)
const isCmd = body.startsWith(prefix)
const tescuk = ["[email protected]"]
const isGroup = from.endsWith('@g.us')
const q = args.join(' ')
const botNumber = baby.user.jid
const sender = isGroup ? mek.participant : mek.key.remoteJid
pushname = baby.contacts[sender] != undefined ? baby.contacts[sender].vname || baby.contacts[sender].notify : undefined
const groupMetadata = isGroup ? await baby.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) : ''
/*
]=====> RAMLAN ID <=====[
*/
const isEventon = isGroup ? event.includes(from) : false
const isRegistered = checkRegisteredUser(sender)
const isBanned = ban.includes(sender)
const isBotGroupAdmins = groupAdmins.includes(botNumber) || false
const isLevelingOn = isGroup ? _leveling.includes(from) : 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 isAntiLink = isGroup ? antilink.includes(from) : false
const isOwner = ownerNumber.includes(sender)
const isPrem = premium.includes(sender) || isOwner
const isImage = type === 'imageMessage'
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) => {
baby.sendMessage(from, teks, text, {quoted:mek})
}
const sendMess = (hehe, teks) => {
baby.sendMessage(hehe, teks, text)
}
const mentions = (teks, memberr, id) => {
(id == null || id == undefined || id == false) ? baby.sendMessage(from, teks.trim(), extendedText, {contextInfo: {"mentionedJid": memberr}}) : baby.sendMessage(from, teks.trim(), extendedText, {quoted: mek, contextInfo: {"mentionedJid": memberr}})
}
const sendImage = (teks) => {
baby.sendMessage(from, teks, image, {quoted:mek})
}
const costum = (pesan, tipe, target, target2) => {
baby.sendMessage(from, pesan, tipe, {quoted: { key: { fromMe: false, participant: `${target}`, ...(from ? { remoteJid: from } : {}) }, message: { conversation: `${target2}` }}})
}
const sendPtt = (teks) => {
baby.sendMessage(from, audio, mp3, {quoted:mek})
}
/*
]=====> LEVELING && ROLE <=====[
*/
const Rank = getLevelingLevel(sender)
var role = 'NEWBIE'
if (Rank <= 3) {
role = 'Bronze I'
} else if (Rank <= 5) {
role = 'Bronze II'
} else if (Rank <= 7) {
role = 'Bronze III'
} else if (Rank <= 9) {
role = 'Silver I'
} else if (Rank <= 11) {
role = 'Silver II'
} else if (Rank <= 13) {
role = 'Silver III'
} else if (Rank <= 16) {
role = 'Gold I'
} else if (Rank <= 18) {
role = 'Gold II'
} else if (Rank <= 20) {
role = 'Gold III'
} else if (Rank <= 22) {
role = 'Gold IV'
} else if (Rank <= 25) {
role = 'Platinum I'
} else if (Rank <= 27) {
role = 'Platinum II'
} else if (Rank <= 29) {
role = 'Platinum III'
} else if (Rank <= 31) {
role = 'Platinum IV'
} else if (Rank <= 33) {
role = 'Diamond I'
} else if (Rank <= 35) {
role = 'Diamomd II'
} else if (Rank <= 37) {
role = 'Diamond III'
} else if (Rank <= 39) {
role = 'Diamond IV'
} else if (Rank <= 45) {
role = 'Master'
} else if (Rank <= 100) {
role = 'Grand Master'
}
if (isGroup && isRegistered && isLevelingOn) {
const currentLevel = getLevelingLevel(sender)
const checkId = getLevelingId(sender)
try {
if (currentLevel === undefined && checkId === undefined) addLevelingId(sender)
const amountXp = Math.floor(Math.random() * 10) + 500
const requiredXp = 5000 * (Math.pow(2, currentLevel) - 1)
const getLevel = getLevelingLevel(sender)
addLevelingXp(sender, amountXp)
if (requiredXp <= getLevelingXp(sender)) {
addLevelingLevel(sender, 1)
bayarLimit(sender, 3)
await reply(nad.levelup(pushname, sender, getLevelingXp, getLevel, getLevelingLevel))
}
} catch (err) {
console.error(err)
}
}
/*
]=====> CHECK LIMIT BY LANN ID <=====[
*/
const checkLimit = (sender) => {
let found = false
for (let lmt of _limit) {
if (lmt.id === sender) {
let limitCounts = limitawal - lmt.limit
if (limitCounts <= 0) return baby.sendMessage(from,`Limit anda sudah habis\n\n_Note : limit bisa di dapatkan dengan cara ${prefix}buylimit dan naik level_`, text,{ quoted: mek})
baby.sendMessage(from, nad.limitcount(isPrem, limitCounts), text, { quoted : mek})
found = true
}
}
if (found === false) {
let obj = { id: sender, limit: 1 }
_limit.push(obj)
fs.writeFileSync('./database/user/limit.json', JSON.stringify(_limit))
baby.sendMessage(from, nad.limitcount(isPrem, limitCounts), text, { quoted : mek})
}
}
/*
]=====> LIMITED BY LANN ID <=====[
*/
const isLimit = (sender) =>{
let position = false
for (let i of _limit) {
if (i.id === sender) {
let limits = i.limit
if (limits >= limitawal ) {
position = true
baby.sendMessage(from, nad.limitend(pushname), text, {quoted: mek})
return true
} else {
_limit
position = true
return false
}
}
}
if (position === false) {
const obj = { id: sender, limit: 0 }
_limit.push(obj)
fs.writeFileSync('./database/user/limit.json',JSON.stringify(_limit))
return false
}
}
const limitAdd = (sender) => {
if (isOwner && isPrem) {return false;}
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/user/limit.json', JSON.stringify(_limit))
}
}
if (isGroup) {
try {
const getmemex = groupMembers.length
if (getmemex <= memberlimit) {
reply(`maaf kak membernya sedikit, aku gak bisa disini! Minimal member : ${memberlimit}`)
setTimeout( () => {
baby.groupLeave(from)
}, 5000)
setTimeout( () => {
baby.updatePresence(from, Presence.composing)
reply("See you kak")
}, 4000)
setTimeout( () => {
baby.updatePresence(from, Presence.composing)
reply("Oh iya, jangan lupain aku ya:(")
}, 3000)
setTimeout( () => {
baby.updatePresence(from, Presence.composing)
reply("Baru undang aku lagi:)")
}, 2000)
setTimeout( () => {
baby.updatePresence(from, Presence.composing)
reply("Membernya tambahin dulu")
}, 1000)
setTimeout( () => {
baby.updatePresence(from, Presence.composing)
reply("Aku pamit ya kak:)")
}, 0)
}
} catch (err) { console.error(err) }
}
/*
]=====> ATM <=====[
*/
if (isRegistered ) {
const checkATM = checkATMuser(sender)
try {
if (checkATM === undefined) addATM(sender)
const uangsaku = Math.floor(Math.random() * 10) + 90
addKoinUser(sender, uangsaku)
} catch (err) {
console.error(err)
}
}
// ANTI LINK GRUP
if (mesejAnti.includes("://chat.whatsapp.com/")){
if (!isGroup) return
if (!isAntiLink) return
if (isGroupAdmins) return reply('Atasan grup mah bebas yakan:v')
baby.updatePresence(from, Presence.composing)
if (mesejAnti.includes("#izinbos")) return reply("Iya kak jangan spam ya")
var kic = `${sender.split("@")[0]}@s.whatsapp.net`
reply(`Woyy ${sender.split("@")[0]} Gak Boleh Share Link Group😡`)
setTimeout( () => {
baby.groupRemove(from, [kic]).catch((e)=>{reply(`BOT HARUS JADI ADMIN`)})
}, 3000)
setTimeout( () => {
baby.updatePresence(from, Presence.composing)
reply("Hedsot :v")
}, 2000)
setTimeout( () => {
baby.updatePresence(from, Presence.composing)
reply("Bismillah")
}, 1000)
setTimeout( () => {
baby.updatePresence(from, Presence.composing)
reply("Ready?")
}, 0)
}
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;32mBABY\x1b[1;37m]', time, color(command), 'dari', color(sender.split('@')[0]), 'args :', color(args.length))
if (!isGroup && !isCmd) console.log('\x1b[1;31m=\x1b[1;37m>', '[\x1b[1;31mR4M\x1b[1;37m]', time, color('Pesan'), 'dari', color(pushname), 'args :', color(args.length))
if (isCmd && isGroup) console.log('\x1b[1;31m=\x1b[1;37m>', '[\x1b[1;32mBABY\x1b[1;37m]', time, color(command), 'dari', color(sender.split('@')[0]), 'in', color(groupName), 'args :', color(args.length))
if (!isCmd && isGroup) console.log('\x1b[1;31m=\x1b[1;37m>', '[\x1b[1;31mR4M\x1b[1;37m]', time, color('Pesan'), 'dari', color(pushname), 'in', color(groupName), 'args :', color(args.length))
let authorname = baby.contacts[from] != undefined ? baby.contacts[from].vname || baby.contacts[from].notify : undefined
if (authorname != undefined) { } else { authorname = groupName } function addMetadata(packname, author) {
if (!packname) packname = 'BABYBOT'; if (!author) author = 'Ramlan ID';
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`
})
}
var prema = 'Free'
if (isPrem) {
prema = 'Premium'
}
if (isOwner) {
prema = 'Owner'
}
switch(command) {
case 'help':
case 'menu':
if (isBanned) return reply(nad.baned())
if (!isRegistered) return reply(nad.noregis())
const reqXp = 5000 * (Math.pow(2, getLevelingLevel(sender)) - 1)
const uangku = checkATMuser(sender)
await costum(help(pushname, prefix, botName, ownerName, reqXp, getLevelingLevel, sender, _registered, uangku, role, prema), text, tescuk, cr)
break
case 'donasi':
case 'donate':
baby.sendMessage(from, donasi(pushname, prefix, botName, ownerName), text)
break
case 'iklan':
baby.sendMessage(from, iklan1(pushname, prefix, botName, ownerName), text)
break
case 'bingungcok':
if (isBanned) return reply(nad.baned())
if (!isRegistered) return reply(nad.noregis())
baby.sendMessage(from, cara(pushname, prefix, botName, ownerName), text)
break
case 'simplemenu':
case 'simpelmenu':
if (isBanned) return reply(nad.baned())
if (!isRegistered) return reply(nad.noregis())
await costum(simple(pushname, prefix, botName, ownerName, getLevelingLevel, sender, _registered), text, tescuk, cr)
break
case 'gabutmenu':
if (isBanned) return reply(nad.baned())
if (!isRegistered) return reply(nad.noregis())
await costum(gabut(pushname, prefix, botName, ownerName, getLevelingLevel, sender, _registered), text, tescuk, cr)
break
case 'groupmenu':
if (isBanned) return reply(nad.baned())
if (!isRegistered) return reply(nad.noregis())
if (!isGroup) return reply(nad.groupo())
await costum(groupm(pushname, prefix, botName, ownerName, getLevelingLevel, sender, _registered), text, tescuk, cr)
break
case 'downloadmenu':
if (isBanned) return reply(nad.baned())
if (!isRegistered) return reply(nad.noregis())
await costum(download(pushname, prefix, botName, ownerName, getLevelingLevel, sender, _registered), text, tescuk, cr)
break
case 'dompetmenu':
if (isBanned) return reply(nad.baned())
if (!isRegistered) return reply(nad.noregis())
await costum(dompet(pushname, prefix, botName, ownerName, getLevelingLevel, sender, _registered), text, tescuk, cr)
break
case 'randommenu':
if (isBanned) return reply(nad.baned())
if (!isRegistered) return reply(nad.noregis())
await costum(random(pushname, prefix, botName, ownerName, getLevelingLevel, sender, _registered), text, tescuk, cr)
break
case 'makermenu':
if (isBanned) return reply(nad.baned())
if (!isRegistered) return reply(nad.noregis())
await costum(maker(pushname, prefix, botName, ownerName, getLevelingLevel, sender, _registered), text, tescuk, cr)
break
case 'othermenu':
if (isBanned) return reply(nad.baned())
if (!isRegistered) return reply(nad.noregis())
await costum(other(pushname, prefix, botName, ownerName, getLevelingLevel, sender, _registered), text, tescuk, cr)
break
case 'soundmenu':
if (isBanned) return reply(nad.baned())
if (!isRegistered) return reply(nad.noregis())
await costum(sound(pushname, prefix, botName, ownerName, getLevelingLevel, sender, _registered), text, tescuk, cr)
break
case 'ownermenu':
if (isBanned) return reply(nad.baned())
if (!isRegistered) return reply(nad.noregis())
await costum(owb(pushname, prefix, botName, ownerName, getLevelingLevel, sender, _registered), text, tescuk, cr)
break
/*
]=====> SIMPLE MENU <=====[
*/
case 'stiker':
case 'sticker':
case 's':
case 'stickergif':
case 'stikergif':
if (isBanned) return reply(nad.baned())
if (!isRegistered) return reply(nad.noregis())
if (isLimit(sender)) return reply(nad.limitend(pusname))
await limitAdd(sender)
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 baby.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(nad.stikga())
})
.on('end', function () {
console.log('Finish')
exec(`webpmux -set exif ${addMetadata('BABYBOT', authorname)} ${ran} -o ${ran}`, async (error) => {
if (error) return reply(nad.stikga())
baby.sendMessage(from, fs.readFileSync(ran), sticker, {quoted: mek})
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 baby.downloadAndSaveMediaMessage(encmedia)
ran = getRandom('.webp')
reply(nad.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('BABYBOT', authorname)} ${ran} -o ${ran}`, async (error) => {
if (error) return reply(nad.stikga())
baby.sendMessage(from, fs.readFileSync(ran), sticker, {quoted: mek})
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 {
reply(`Kirim gambar/video/gif dengan caption \n${prefix}sticker (durasi sticker video 1-9 detik)`)
}
break
case 'runtime':
uptime = process.uptime()
run = `「 *RUNTIME* 」\n${kyun(uptime)}`
baby.sendMessage(from, run, text, {quoted: { key: { fromMe: false, participant: `[email protected]`, ...(from ? { remoteJid: from } : {}) }, message: { conversation: `𝐁𝐀𝐁𝐘 𝐁𝐎𝐓 𝐕𝐄𝐑𝐈𝐅𝐈𝐄𝐃` }}})
break
case 'nulis':
if (isBanned) return reply(nad.baned())
if (!isRegistered) return reply(nad.noregis())
if (isLimit(sender)) return reply(nad.limitend(pusname))
if (args.length < 1) return reply(`Teksnya mana kak? Contoh : ${prefix}nulis Ramlan baik hati`)
nul = body.slice(7)
reply('「❗」WAIT BRO GUE NULIS DUMLU YAKAN')
tak = await getBuffer(`https://api.zeks.xyz/api/nulis?text=${nul}&apikey=apivinz`)
baby.sendMessage(from, tak, image, {quoted: mek, caption: 'Lebih baik nulis sendiri ya kak :*'})
await limitAdd(sender)
break
case 'nuliskiri':
case 'tuliskiri':
if (isBanned) return reply(nad.baned())
if (!isRegistered) return reply(nad.noregis())
if (!isPrem) return reply(nad.premium())
if (args.length < 1) return reply(`Teksnya mana kak? Contoh : ${prefix}nulis1 Ramlan baik hati`)
ramlan = body.slice(11)
reply('「❗」WAIT BRO GUE NULIS DUMLU YAKAN')
buff = await getBuffer(`https://api.xteam.xyz/magernulis2?text=${ramlan}&APIKEY=${XteamKey}`)
baby.sendMessage(from, buff, image, {quoted: mek, caption: 'Lebih baik nulis sendiri ya kak :*'})
break
case 'nuliskanan':
case 'tuliskanan':
if (isBanned) return reply(nad.baned())
if (!isRegistered) return reply(nad.noregis())
if (!isPrem) return reply(nad.premium())
if (args.length < 1) return reply(`Teksnya mana kak? Contoh : ${prefix}nulis2 Ramlan baik hati`)
laysha = body.slice(12)
reply('「❗」WAIT BRO GUE NULIS DUMLU YAKAN')
buff = await getBuffer(`https://api.xteam.xyz/magernulis3?text=${laysha}&APIKEY=${XteamKey}`)
baby.sendMessage(from, buff, image, {quoted: mek, caption: 'Lebih baik nulis sendiri ya kak :*'})
break
case 'quotes':
baby.updatePresence(from, Presence.composing)
if (isBanned) return reply(nad.baned())
if (!isRegistered) return reply(nad.noregis())
if (isLimit(sender)) return reply(nad.limitend(pusname))
data = fs.readFileSync('./src/quote.json');
jsonData = JSON.parse(data);
randIndex = Math.floor(Math.random() * jsonData.length);
randKey = jsonData[randIndex];
randQuote =''+randKey.quote+ '\n\n_By: '+randKey.by+'_'
baby.sendMessage(from, randQuote, text, {quoted: mek})
await limitAdd(sender)
break
case 'ninjalogo':
if (isBanned) return reply(nad.baned())
if (!isRegistered) return reply(nad.noregis())
if (!isPrem) return reply(nad.premium())
var gh = body.slice(11)
var nin = gh.split("&")[0];
var ja = gh.split("&")[1];
if (args.length < 1) return reply(`「❗」Contoh : ${prefix}ninjalogo Ramlan & Gans`)
reply(nad.wait())
buffer = await getBuffer(`https://api.xteam.xyz/textpro/ninjalogo?text=${nin}&text2=${ja}&APIKEY=${XteamKey}`)
baby.sendMessage(from, buffer, image, {quoted: mek})
break
case 'halloweentext':
if (isBanned) return reply(nad.baned())
if (!isRegistered) return reply(nad.noregis())
if (!isPrem) return reply(nad.premium())
if (args.length < 1) return reply(nad.wrongf())
ween = body.slice(15)
if (ween.length > 10) return reply('Teksnya kepanjangan, maksimal 9 karakter')
reply(nad.wait())
buffer = await getBuffer(`https://api.xteam.xyz/textpro/helloweenfire?text=${ween}&APIKEY=${XteamKey}`)
baby.sendMessage(from, buffer, image, {quoted: mek})
break
case 'pornhub':
if (isBanned) return reply(nad.baned())
if (!isRegistered) return reply(nad.noregis())
if (isLimit(sender)) return reply(nad.limitend(pusname))
var gh = body.slice(9)
var porn = gh.split("&")[0];
var hub = gh.split("&")[1];
if (args.length < 1) return reply(`「❗」Contoh : ${prefix}pornhub Ramlan & Hub`)
reply(nad.wait())
alan = await getBuffer(`https://api.zeks.xyz/api/phlogo?text1=${porn}&text2=${hub}&apikey=apivinz`)
baby.sendMessage(from, alan, image, {quoted: mek})
await limitAdd(sender)
break
case 'textlight':
if (isBanned) return reply(nad.baned())
if (!isRegistered) return reply(nad.noregis())
if (isLimit(sender)) return reply(nad.limitend(pusname))
if (args.length < 1) return reply(nad.wrongf())
ligh = body.slice(11)
if (ligh.length > 10) return reply('Teksnya kepanjangan, maksimal 9 karakter')
reply(nad.wait())
lawak = await getBuffer(`https://api.zeks.xyz/api/tlight?text=${ligh}&apikey=apivinz`)
baby.sendMessage(from, lawak, image, {quoted: mek})
await limitAdd(sender)
break
case 'glitchtext':
if (isBanned) return reply(nad.baned())
if (!isRegistered) return reply(nad.noregis())
if (isLimit(sender)) return reply(nad.limitend(pusname))
var gh = body.slice(12)
var gli = gh.split("&")[0];
var tch = gh.split("&")[1];
if (args.length < 1) return reply(`「❗」Contoh : ${prefix}glitchtext Ramlan & Gans`)
reply(nad.wait())
buffer = await getBuffer(`https://api.zeks.xyz/api/gtext?text1=${gli}&text2=${tch}&apikey=apivinz`)
baby.sendMessage(from, buffer, image, {quoted: mek})
await limitAdd(sender)
break
case 'simi':
if (isBanned) return reply(nad.baned())
if (!isRegistered) return reply(nad.noregis())
if (isLimit(sender)) return reply(nad.limitend(pusname))
if (args.length < 1) return reply(`Mau nanya apa? Contoh : ${prefix}simi halo`)
tefs = body.slice(5)
anu = await fetchJson(`https://api.xteam.xyz/simsimi?kata=${tefs}&APIKEY=${XteamKey}`)
reply(anu.jawaban)
await limitAdd(sender)
break
case 'tts':
if (isBanned) return reply(nad.baned())
if (!isRegistered) return reply(nad.noregis())
if (isLimit(sender)) return reply(nad.limitend(pusname))
if (args.length < 1) return baby.sendMessage(from, `Kode bahasanya mana kak? contoh : ${prefix}tts id Halo Ramlan`, text, {quoted: mek})
const gtts = require('./lib/gtts')(args[0])
if (args.length < 2) return baby.sendMessage(from, `Teksnya mana kak | contoh : ${prefix}tts id ah yamate kudasai`, text, {quoted: mek})
dtt = body.slice(8)
ranm = getRandom('.mp3')
rano = getRandom('.ogg')
dtt.length > 300
? reply('Teks nya terlalu panjang kak')
: 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(nad.stikga())
baby.sendMessage(from, buff, audio, {quoted: mek, ptt:true})
fs.unlinkSync(rano)
})
})
await limitAdd(sender)
break
case 'ttp': //By NOIR X RAMLAN ID
pngttp = './temp/ttp.png'
webpng = './temp/ttp.webp'
const ttptext = body.slice(5)
fetch(`https://api.areltiyan.site/sticker_maker?text=${ttptext}`, { method: 'GET'})
.then(async res => {
const ttptxt = await res.json()
console.log("SUKSES")
base64Img.img(ttptxt.base64, 'temp', 'ttp', function(err, filepath) {
if (err) return console.log(err);
exec(`ffmpeg -i ${pngttp} -vcodec libwebp -filter:v fps=fps=20 -lossless 1 -loop 0 -preset default -an -vsync 0 -s 512:512 ${webpng}`, (err) => {
buffer = fs.readFileSync(webpng)
baby.sendMessage(from, buffer, sticker)
fs.unlinkSync(webpng)
fs.unlinkSync(pngttp)
})
})
});
break
case 'toimg':
if (isBanned) return reply(nad.baned())
if (!isRegistered) return reply(nad.noregis())
if (isLimit(sender)) return reply(nad.limitend(pusname))
if (!isQuotedSticker) return reply('Reply atau Tag sticker yang mau dijadiin gambar kak >_<')
reply(nad.wait())
encmedia = JSON.parse(JSON.stringify(mek).replace('quotedM','m')).message.extendedTextMessage.contextInfo
media = await baby.downloadAndSaveMediaMessage(encmedia)
ran = getRandom('.png')
exec(`ffmpeg -i ${media} ${ran}`, (err) => {
fs.unlinkSync(media)
if (err) return reply(nad.stikga())
buffer = fs.readFileSync(ran)
baby.sendMessage(from, buffer, image, {quoted: mek, caption: 'nih kak [(^.^)]'})
fs.unlinkSync(ran)
})
await limitAdd(sender)
break
case 'speed':
case 'ping':
const timestamp = speed();
const latensi = speed() - timestamp
baby.sendMessage(from, `Speed: ${latensi.toFixed(4)} _ms_`, text, { quoted: mek})
break
case 'bikinquote':
if (isBanned) return reply(nad.baned())
if (!isRegistered) return reply(nad.noregis())
if (isLimit(sender)) return reply(nad.limitend(pusname))
var gh = body.slice(12)
var quote = gh.split("&")[0];
var wm = gh.split("&")[1];
const pref = `yang mau dijadiin quote apaan, titit?\n\ncontoh : ${prefix}bikinquote aku bukan boneka & Kata Ramlan`
if (args.length < 1) return reply(pref)
reply(nad.wait())
anu = await fetchJson(`https://terhambar.com/aw/qts/?kata=${quote}&author=${wm}&tipe=random`, {method: 'get'})
buffer = await getBuffer(anu.result)
baby.sendMessage(from, buffer, image, {caption: 'Nih kak >_<', quoted: mek})
await limitAdd(sender)
break
case 'meme':
if (isBanned) return reply(nad.baned())
if (!isRegistered) return reply(nad.noregis())
if (isLimit(sender)) return reply(nad.limitend(pusname))
nganu = await fetchJson(`https://api.zeks.xyz/api/memeindo?apikey=apivinz`)
buper = await getBuffer(nganu.result)
baby.sendMessage(from, buper, image, {quoted: mek})
await limitAdd(sender)