forked from zim-bot/zimbot-v3
-
Notifications
You must be signed in to change notification settings - Fork 0
/
zimbot.js
9259 lines (8672 loc) · 505 KB
/
zimbot.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
// ⧈⧈⧈⧈⧈⧈⧈⧈⧈⧈⧈⧈⧈⧈⧈⧈⧈⧈⧈⧈⧈⧈⧈
//▮ZIM BOT INC 2022 ®️ALL RIGHTS RESERVED
//▮
//▮FORK AND DON'T FORGET TO GIVE A STAR
//▮
//▮THIS SOFTWARE IS UNDER UZ COPYRIGHT
//▮
//▮REPORT ABUSE OF THIS SOFTWARE EMAIL US
//▮WHATSAPP US : +44 7441 437150
//▮YOUTUBE CHANNELL: https://youtube.com/c/DRIPSOFC
//▮
//╰▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
//
//┏━━━━━━━━━━━━━━━━━━━━━━━━━
//┃THIS SOFTWARE INCLUDES
//┃SOME ENCRYPTED FILES
//┃
//┃THANKS FOR CHOOSING ZIMBOT
//┃THANKS TO DikaArdnt
//┃BEHOLD THE NEW
//┃
//┃LET LOVE LEAD
//┃
//┃YOU WANNA RE UPLOAD GIVE A PROPER CREDIT
//┗━━━━━━━━━━━━━━━━━━━━━━━━━
//
process.on('uncaughtException', console.error) //Safe Log Error
require('./config')
const { WAConnection, MessageType , BufferJSON, WA_DEFAULT_EPHEMERAL, PresenceUpdate, Presence, generateWAMessageFromContent, proto, generateWAMessageContent, generateWAMessage, prepareWAMessageMedia, areJidsSameUser, getContentType } = require('@adiwajshing/baileys')
const fs = require('fs')
const util = require('util')
const chalk = require('chalk')
const cheerio = require('cheerio')
const { exec, spawn, execSync } = require("child_process")
const axios = require('axios')
const path = require('path')
const fetch = require('node-fetch')
const google = require('google-it')
let { msgFilter } = require('./lib/antispam')
const os = require('os')
const hx = require('hxz-api')
const mel = require('kitsune-api')
const xa = require('xfarr-api')
const moment = require('moment-timezone')
const { JSDOM } = require('jsdom')
const speed = require('performance-now')
const { performance } = require('perf_hooks')
const { Primbon } = require('scrape-primbon')
const primbon = new Primbon()
const { smsg, formatp, tanggal, formatDate, getTime, isUrl, sleep, clockString, runtime, fetchJson, getBuffer, jsonformat, format, parseMention, getRandom } = require('./lib/myfunc')
const { limitAdd, addBalance, kurangBalance, getBalance, isGame, gameAdd, givegame, cekGLimit } = require("./lib/limit")
const _limitOrg = JSON.parse(fs.readFileSync('./database/limit.json'))
const level = require('./lib/level')
const { mediafireDl } = require('./lib/mediafire.js')
const _antivirtex = JSON.parse(fs.readFileSync('./database/antivirtex.json'))
const zimbot = JSON.parse(fs.readFileSync('./database/zimbot.json'))
//apikeys zvibhorani izvi
const setting = JSON.parse(fs.readFileSync('./apikey.json'))
//buat info zvibhorani zivi
limitawal = '100'
botname = 'ZIM BOT INC'
wm = 'ZIM BOT INC'
global.reactmoji = '🇿🇼'
limitCount = setting.limit
//read database
const limit = JSON.parse(fs.readFileSync('./database/limit.json'))
const antiwame = JSON.parse(fs.readFileSync('./database/antiwame.json'))
const antilinkyt = JSON.parse(fs.readFileSync('./database/antilinkyt.json'))
const antibule = JSON.parse(fs.readFileSync('./database/antibule.json'))
const balance = JSON.parse(fs.readFileSync('./database/balance.json'))
const premium = JSON.parse(fs.readFileSync('./database/premium.json'))
const _level = JSON.parse(fs.readFileSync('./database/level.json'))
const banned = JSON.parse(fs.readFileSync('./database/banned.json'))
const dripsanti = JSON.parse(fs.readFileSync('./lib/rude.json'))
let bad = JSON.parse(fs.readFileSync('./lib/rude.json'))
const autoblock = JSON.parse(fs.readFileSync('./database/autoblock.json'))
const dripsno = JSON.parse(fs.readFileSync('./database/autoblock.json'))
const dripswelcome = JSON.parse(fs.readFileSync('./database/welcome.json'))
//////created by zim-bot-inc
module.exports = ZimBotInc = async (ZimBotInc, m, chatUpdate, store) => {
try {
var body = (m.mtype === 'conversation') ? m.message.conversation : (m.mtype == 'imageMessage') ? m.message.imageMessage.caption : (m.mtype == 'videoMessage') ? m.message.videoMessage.caption : (m.mtype == 'extendedTextMessage') ? m.message.extendedTextMessage.text : (m.mtype == 'buttonsResponseMessage') ? m.message.buttonsResponseMessage.selectedButtonId : (m.mtype == 'listResponseMessage') ? m.message.listResponseMessage.singleSelectReply.selectedRowId : (m.mtype == 'templateButtonReplyMessage') ? m.message.templateButtonReplyMessage.selectedId : (m.mtype === 'messageContextInfo') ? (m.message.buttonsResponseMessage?.selectedButtonId || m.message.listResponseMessage?.singleSelectReply.selectedRowId || m.text) : ''
var budy = (typeof m.text == 'string' ? m.text : '')
var prefix = prefa ? /^[°•π÷׶∆£¢€¥®™+✓_=|~!?@#$%^&.©^]/gi.test(body) ? body.match(/^[°•π÷׶∆£¢€¥®™+✓_=|~!?@#$%^&.©^]/gi)[0] : "" : prefa ?? global.prefix
const isCmd = body.startsWith(prefix)
const command = body.replace(prefix, '').trim().split(/ +/).shift().toLowerCase()
const args = body.trim().split(/ +/).slice(1)
const pushname = m.pushName || "No Name"
const botNumber = await ZimBotInc.decodeJid(ZimBotInc.user.id)
const isCreator = [botNumber, ...global.owner].map(v => v.replace(/[^0-9]/g, '') + '@s.whatsapp.net').includes(m.sender)
const itsMe = m.sender == botNumber ? true : false
const text = q = args.join(" ")
const quoted = m.quoted ? m.quoted : m
const sender = m.sender
const from = m.chat
const isBan = banned.includes(m.sender)
const mime = (quoted.msg || quoted).mimetype || ''
const isMedia = /image|video|sticker|audio/.test(mime)
const isAutoblock = autoblock.includes('@s.whatsapp.net')
//GROUP METADATA
const groupMetadata = m.isGroup ? await ZimBotInc.groupMetadata(m.chat).catch(e => {}) : ''
const groupName = m.isGroup ? groupMetadata.subject : ''
const participants = m.isGroup ? await groupMetadata.participants : ''
const groupAdmins = m.isGroup ? await participants.filter(v => v.admin !== null).map(v => v.id) : ''
const groupOwner = m.isGroup ? groupMetadata.owner : ''
const isBotAdmins = m.isGroup ? groupAdmins.includes(botNumber) : false
const isAdmins = m.isGroup ? groupAdmins.includes(m.sender) : false
const isAntiwame = m.isGroup ? antiwame.includes(m.chat) : false
const isAntiVirtex = m.isGroup ? _antivirtex.includes(m.chat) : false
const isAntilinkyt = m.isGroup ? antilinkyt.includes(m.chat) : false
const isAntibule = m.isGroup ? antibule.includes(m.chat) : false
const antiToxic = m.isGroup ? dripsanti.includes(from) : false
const zimbotincv3 = body.slice(0).trim().split(/ +/).shift().toLowerCase()
const isPremium = isCreator || global.premium.map(v => v.replace(/[^0-9]/g, '') + '@s.whatsapp.net').includes(m.sender) || false
const isAntinsfw = m.isGroup ? dripsno.includes(m.chat) : false
const isWelcome = m.isGroup ? dripswelcome.includes(m.chat) : false
//zim bot inc
const timuu = moment.tz('Africa/Harare').format('HH:mm:ss')
const hariRaya = new Date('Apr 02, 2022 01:45:00')
const sekarang = new Date().getTime();
const Selisih = hariRaya - sekarang;
const jhari = Math.floor( Selisih / (1000 * 60 * 60 * 24));
const jjam = Math.floor( Selisih % (1000 * 60 * 60 * 24) / (1000 * 60 * 60))
const mmmenit = Math.floor( Selisih % (1000 * 60 * 60) / (1000 * 60));
const ddetik = Math.floor( Selisih % (1000 * 60) / 1000);
const ultah = `${jhari}Hari ${jjam}Jam ${mmmenit}Menit ${ddetik}Detik`
var date = new Date();
var tahun = date.getFullYear();
var bulan1 = date.getMonth();
var ikiya = date.getMonth()
var gakroh = date.getDate();
var tanggal = date.getDate();
var hari = date.getDay();
var jam = date.getHours();
var menit = date.getMinutes();
var detik = date.getSeconds();
var waktoo = date.getHours();
switch(hari) {
case 0: hari = "MONDAY"; //limitAdd(sender, limit)
break;
case 1: hari = "TUESDAY"; //limitAdd(sender, limit)
break;
case 2: hari = "WEDNESDAY"; //limitAdd(sender, limit)
break;
case 3: hari = "THURSDAY"; //limitAdd(sender, limit)
break;
case 4: hari = "THURSDAY"; //limitAdd(sender, limit)
break;
case 5: hari = "SATURDAY"; //limitAdd(sender, limit)
break;
case 6: hari = "SUNDAY"; //limitAdd(sender, limit)
break;
}
switch(bulan1) {
case 0: bulan1 = "January"; //limitAdd(sender, limit)
break;
case 1: bulan1 = "February"; //limitAdd(sender, limit)
break;
case 2: bulan1 = "March"; //limitAdd(sender, limit)
break;
case 3: bulan1 = "Aprill"; //limitAdd(sender, limit)
break;
case 4: bulan1 = "May"; //limitAdd(sender, limit)
break;
case 5: bulan1 = "June"; //limitAdd(sender, limit)
break;
case 6: bulan1 = "July"; //limitAdd(sender, limit)
break;
case 7: bulan1 = "August"; //limitAdd(sender, limit)
break;
case 8: bulan1 = "September"; //limitAdd(sender, limit)
break;
case 9: bulan1 = "October"; //limitAdd(sender, limit)
break;
case 10: bulan1 = "November"; //limitAdd(sender, limit)
break;
case 11: bulan1 = "December"; //limitAdd(sender, limit)
break;
}
switch(gakroh) {
case 0: gakroh = "sacred"; //limitAdd(sender, limit)
break;
case 1: gakroh = "safari"; //limitAdd(sender, limit)
break;
case 2: gakroh = "rabi'ul-awal"; //limitAdd(sender, limit)
break;
case 3: gakroh = "rabi'ul-akhir"; //limitAdd(sender, limit)
break;
case 4: gakroh = "syawal"; //limitAdd(sender, limit)
break;
case 5: gakroh = "jumadil-akhir"; //limitAdd(sender, limit)
break;
case 6: gakroh = "rejab"; //limitAdd(sender, limit)
break;
case 7: gakroh = "syaaban"; //limitAdd(sender, limit)
break;
case 8: gakroh = "ramadan"; //limitAdd(sender, limit)
break;
case 9: gakroh = "early friday"; //limitAdd(sender, limit)
break;
}
var tampilTanggal = "" + hari + ", " + tanggal + " " + bulan1 + " " + tahun;
var tampilWaktu = "" + jam + ":" + menit + ":" + detik ;
myMonths = ["January","February","March","Aprill","May","June","July","August","September","October","November","December"];
myDays = ['Monday','Tuesday','Wednesday','Thursday','Friday','Saturday','Sunday'];
myDoms = ["sacred","safari","first ribal","last ribal","syawal","late Friday","rejab","syaaban","ramadan","early friday"];
var tgl = new Date();
detik = tgl.getSeconds();
menit = tgl.getMinutes();
jam = tgl.getHours();
var ampm = jam >= 12 ? 'PM' : 'AM';
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;
const ini_tanggal = `${day} - ${myMonths[bulan]} - ${year}`
//message filter
if (isCmd) msgFilter.addFilter(from)
// TIME
const time2 = moment().tz('Africa/Harare').format('HH:mm:ss')
if(time2 < "23:59:00"){
var ucapannya2 = `Good Night 🌒`
}
if(time2 < "19:00:00"){
var ucapannya2 = `Good night🌙`
}
if(time2 < "18:00:00"){
var ucapannya2 = `Good afternoon 🌅`
}
if(time2 < "15:00:00"){
var ucapannya2 = `Good afternoon 🌞`
}
if(time2 < "10:00:00"){
var ucapannya2 = `Good morning 🌄`
}
if(time2 < "05:00:00"){
var ucapannya2 = `Good morning 🌅`
}
global.botdev = ['27634090203','447441437150']
global.bothelp = ['918188019676']
//function rpg
const {
addInventoriDarah,
cekDuluJoinAdaApaKagaDiJson,
addDarah,
kurangDarah,
getDarah
} = require('./storage/user/darah.js')
const {
cekInventoryAdaAtauGak,
addInventori,
addBesi,
addEmas,
addEmerald,
addUmpan,
addPotion,
kurangBesi,
kurangEmas,
kurangEmerald,
kurangUmpan,
kurangPotion,
getBesi,
getEmas,
getEmerald,
getUmpan,
getPotion
} = require('./storage/user/alat_tukar.js')
const {
addInventoriMonay,
cekDuluJoinAdaApaKagaMonaynyaDiJson,
addMonay,
kurangMonay,
getMonay
} = require('./storage/user/monay.js')
const {
addInventoriLimit,
cekDuluJoinAdaApaKagaLimitnyaDiJson,
addLimit,
kurangLimit,
getLimit
} = require('./storage/user/limit.js')
const {
cekDuluHasilBuruanNya,
addInventoriBuruan,
addIkan,
addAyam,
addKelinci,
addDomba,
addSapi,
addGajah,
kurangIkan,
kurangAyam,
kurangKelinci,
kurangDomba,
kurangSapi,
kurangGajah,
getIkan,
getAyam,
getKelinci,
getDomba,
getSapi,
getGajah
} = require('./storage/user/buruan.js')
let DarahAwal = global.rpg.darahawal
const isDarah = cekDuluJoinAdaApaKagaDiJson(m.sender)
const isCekDarah = getDarah(m.sender)
const isUmpan = getUmpan(m.sender)
const isPotion = getPotion(m.sender)
const isIkan = getIkan(m.sender)
const isAyam = getAyam(m.sender)
const isKelinci = getKelinci(m.sender)
const isDomba = getDomba(m.sender)
const isSapi = getSapi(m.sender)
const isGajah = getGajah(m.sender)
const isMonay = getMonay(m.sender)
const isLimit = getLimit(m.sender)
const isBesi = getBesi(m.sender)
const isEmas = getEmas(m.sender)
const isEmerald = getEmerald(m.sender)
const isInventory = cekInventoryAdaAtauGak(m.sender)
const isInventoriBuruan = cekDuluHasilBuruanNya(m.sender)
const isInventoryLimit = cekDuluJoinAdaApaKagaLimitnyaDiJson(m.sender)
const isInventoryMonay = cekDuluJoinAdaApaKagaMonaynyaDiJson(m.sender)
const ikan = ['🐟','🐠','🐡']
// Database Rpg
let _limit = JSON.parse(fs.readFileSync('./storage/user/limit.json'));
let _buruan = JSON.parse(fs.readFileSync('./storage/user/hasil_buruan.json'));
let _darahOrg = JSON.parse(fs.readFileSync('./storage/user/darah.json'))
let monay = JSON.parse(fs.readFileSync('./storage/user/monay.json'))
// random
let medrips = fs.readFileSync('./lib/namaku.js')
jsonDrips = JSON.parse(medrips)
randIndex = Math.floor(Math.random() * jsonDrips.length)
randek = jsonDrips[randIndex];
// Random Image Simple Menu
let picaks = [flaming,fluming,flarun,flasmurf,mehk,awog,mohai,mhehe]
let picak = picaks[Math.floor(Math.random() * picaks.length)]
// ajajajakakk
try {
let isNumber = x => typeof x === 'number' && !isNaN(x)
let limitUser = isPremium ? global.limitawal.premium : global.limitawal.free
let user = global.db.data.users[m.sender]
if (typeof user !== 'object') global.db.data.users[m.sender] = {}
if (user) {
if (!isNumber(user.afkTime)) user.afkTime = -1
if (!('afkReason' in user)) user.afkReason = ''
if (!isNumber(user.limit)) user.limit = limitUser
} else global.db.data.users[m.sender] = {
afkTime: -1,
afkReason: '',
limit: limitUser,
}
let chats = global.db.data.chats[m.chat]
if (typeof chats !== 'object') global.db.data.chats[m.chat] = {}
if (chats) {
if (!('mute' in chats)) chats.mute = false
if (!('antilink' in chats)) chats.antilink = false
if (!('antilinkyt' in chats)) chats.antilinkyt = false
if (!('autoblock' in chats)) chats.autoblock = false
if (!('isWecome' in chats)) chats.isWelcome = true
if (!('antilinkall' in chats)) chats.antilinkall = false
if (!('antiytchannel' in chats)) chats.antiytchannel = false
if (!('antitiktok' in chats)) chats.antitiktok = false
if (!('antitelegram' in chats)) chats.antitelegram = false
if (!('antiinstagram' in chats)) chats.antiinstagram = false
if (!('antifb' in chats)) chats.antifb = false
if (!('antibule' in chats)) chats.antibule = false
if (!('antiwame' in chats)) chats.antiwame = false
if (!('wame' in chats)) chats.wame = false
if (!('antitwitter' in chats)) chats.antitwitter = false
} else global.db.data.chats[m.chat] = {
mute: false,
wame: false,
antilink: false,
antilinkyt: false,
isWelcome: true,
antilinkall: false,
antiytchannel: false,
antitiktok: false,
antitelegram: false,
antiinstagram: false,
antifb: false,
antibule: false,
antiwame: false,
antitwitter: false,
autoblock: false
}
const reactionMessage = {
react: {
text: args[0],
key: { remoteJid: m.chat, fromMe: true, id: quoted.id }
}
}
let setting = global.db.data.settings[botNumber]
if (typeof setting !== 'object') global.db.data.settings[botNumber] = {}
if (setting) {
if (!isNumber(setting.status)) setting.status = 0
if (!('autobio' in setting)) setting.autobio = false
if (!('templateImage' in setting)) setting.templateImage = false
if (!('templateLocation' in setting)) setting.templateLocation = false
if (!('templateGif' in setting)) setting.templateGif = true
if (!('templateMsg' in setting)) setting.templateMsg = false
if (!('templateList' in setting)) setting.templateList = false
if (!('templateDoc' in setting)) setting.templateDoc = false
} else global.db.data.settings[botNumber] = {
status: 0,
autobio: false,
templateImage: false,
templateLocation: false,
templateGif: true,
templateMsg: false,
templateList: false,
templateDoc: false,
}
} catch (err) {
console.error(err)
}
//public or self
if (!ZimBotInc.public) {
if (!m.key.fromMe) return
}
// Push Message To Console && Auto Read
if (m.message) {
console.log(chalk.blue(chalk.bgWhite('ZIMBOT')), chalk.whiteBright(chalk.bgRed(new Date)), chalk.black(chalk.bgRed(budy || m.mtype)) + '\n' + chalk.magenta('⦿ FROM'), chalk.bgYellowBright(pushname), chalk.bgGray(m.sender) + '\n' + chalk.bgCyanBright('RECIEVED'), chalk.yellowBright(m.isGroup ? pushname : 'DM', m.chat))
}
if (global.dripsreadgroup) {
if (m.isGroup) { ZimBotInc.sendReadReceipt(m.chat, m.sender, [m.key.id]) }
}
if (global.dripsreadall) { if (m.message) { ZimBotInc.sendReadReceipt(m.chat, m.sender, [m.key.id]) }
}
if (global.dripsrecord) { if (m.chat) { ZimBotInc.sendPresenceUpdate('recording', m.chat) }
}
if (global.dripstyping) { if (m.chat) { ZimBotInc.sendPresenceUpdate('composing', m.chat) }
}
if (global.available) { if (m.chat) { ZimBotInc.sendPresenceUpdate('available', m.chat) }
}
if (global.unavailable) { if (m.chat) { ZimBotInc.sendPresenceUpdate('unavailable', m.chat) }
}
//Auto reset
//Jika bot on di jam 24.00 maka limit dan darah bakal reset
//Kalo off yaa kaga, Harus tunggu besok :v
let cron = require('node-cron')
cron.schedule('0 0 * * *', () => {
const reset = []
_limit = reset
console.log('Limit reset')
fs.writeFileSync('./storage/user/limit.json', JSON.stringify(_limit))
console.log('Success!')
},
{
scheduled: true,
timezone: 'Africa/Harare'
}
)
//thum
let tebaklagu = db.data.game.tebaklagu = []
let _family100 = db.data.game.family100 = []
let kuismath = db.data.game.math = []
let tebakgambar = db.data.game.tebakgambar = []
let tebakkata = db.data.game.tebakkata = []
let caklontong = db.data.game.lontong = []
let caklontong_desk = db.data.game.lontong_desk = []
let tebakkalimat = db.data.game.kalimat = []
let tebaklirik = db.data.game.lirik = []
let tebaktebakan = db.data.game.tebakan = []
let vote = db.data.others.vote = []
vide = await getBuffer(global.vid)
//downloader
const sendFile = async(link, type, options) => {
hasil = await getBuffer(link)
ZimBotInc.sendMessage(from, hasil, type, options).catch(e => {
fetch(link).then((hasil) => {
ZimBotInc.sendMessage(from, hasil, type, options).catch(e => {
ZimBotInc.sendMessage(from, { url : link }, type, options).catch(e => {
m.reply('ERROR [ ! ]')
console.log(e)
})
})
})
})
}
const reply = (teks) => {
ZimBotInc.sendMessage(m.chat, { text: teks, contextInfo:{"externalAdReply": {"title": ` ${global.botname}`,"body": ` BOT GROUP`, "previewType": "PHOTO","thumbnailUrl": ``,"thumbnail": fs.readFileSync(`./Zimbot/drips.jpg`),"sourceUrl": `${global.ytchannel}`}}}, { quoted: m})
}
const replay = (teks) => {
ZimBotInc.sendMessage(m.chat, { text: teks, contextInfo:{"externalAdReply": {"title": ` ${global.botname}`,"body": `BOT YOUTUBE CHANNEL `, "previewType": "PHOTO","thumbnailUrl": ``,"thumbnail": fs.readFileSync(`./Zimbot/drips.jpg`),"sourceUrl": `${global.group2}`}}}, { quoted: m})
}
//dokumen random
let doku = [f1,f2,f3,f4,f5,f6]
let feler = doku[Math.floor(Math.random() * doku.length)]
// limiter
const nebal = (angka) => {
return Math.floor(angka)
}
function randomNomor(angka){
return Math.floor(Math.random() * angka) + 1
}
// Monospace
function monospace(string) {
return '```' + abantyulidab+ '```'
}
if (m.chat.startsWith("212")) {
ZimBotInc.updateBlockStatus(m.sender,'block')
}
//LEVEL
const levelRole = level.getLevelingLevel(m.sender, _level)
var role = 'Warrior III'
if (levelRole <= 5) {
role = 'Warrior II'
} else if (levelRole <= 10) {
role = 'Warrior I'
} else if (levelRole <= 15) {
role = 'Elite III'
} else if (levelRole <= 20) {
role = 'Elite II'
} else if (levelRole <= 25) {
role = 'Elite I'
} else if (levelRole <= 30) {
role = 'Master III'
} else if (levelRole <= 35) {
role = 'Master II'
} else if (levelRole <= 40) {
role = 'Master I'
} else if (levelRole <= 45) {
role = 'GrandMaster III'
} else if (levelRole <= 50) {
role = 'GrandMaster II'
} else if (levelRole <= 55) {
role = 'GrandMaster I'
} else if (levelRole <= 60) {
role = 'Epic III'
} else if (levelRole <= 65) {
role = 'Epic II'
} else if (levelRole <= 70) {
role = 'Epic I'
} else if (levelRole <= 75) {
role = 'Legend III'
} else if (levelRole <= 80) {
role = 'Legend II'
} else if (levelRole <= 85) {
role = 'Legend I'
} else if (levelRole <= 90) {
role = 'Mythic'
} else if (levelRole <= 95) {
role = 'Mythical Glory'
} else if (levelRole >= 100) {
role = 'Immortal'
} else if (levelRole >= 120) {
role = 'MVP'
}
// FUNCTION LEVELING
if (m.isGroup && !level.isGained(m.sender) && !isCmd) {
try {
level.addCooldown(m.sender)
const currentLevel = level.getLevelingLevel(m.sender, _level)
const amountXp = Math.floor(Math.random() * (15 - 25 + 1) + 20)
const requiredXp = 10 * Math.pow(currentLevel, 2) + 50 * currentLevel + 100
level.addLevelingXp(m.sender, amountXp, _level)
if (requiredXp <= level.getLevelingXp(m.sender, _level)) {
level.addLevelingLevel(sender, 1, _level)
const userLevel = level.getLevelingLevel(m.sender, _level)
const fetchXp = 10 * Math.pow(userLevel, 2) + 50 * userLevel + 100
rep = `*「 LEVEL UP 」*\n\n⬤ *Nama :* ${pushname}\n⬤ *Xp :* ${level.getLevelingXp(m.sender, _level)} / ${fetchXp}\n⬤ *Level :* ${currentLevel} -> ${level.getLevelingLevel(m.sender, _level)} 🆙 \n⬤ *Role*: *${role}*\n\nCongrats!! 🎉🎉`
m.reply(`${rep}`)
// client.sendMessage(from, gambare, image, {caption: `${rep}`, quoted: rip}).catch((err) => reply(`* terjadi kesalaahan,silahkan coba lagi nanti*`))
}
} catch (err) {
console.error(err)
}
}
// BGM CODE
for (let drips of zimbot){
if (budy === drips){
result = fs.readFileSync(`./bgm/${drips}.mp3`)
ZimBotInc.sendMessage(m.chat, { audio: result, mimetype: 'audio/mp4' , ptt: true }, { quoted: m})
}
}
//BY DRIPS ZIM BOT INC
// auto set bio
if (db.data.settings[botNumber].autobio) {
let setting = global.db.data.settings[botNumber]
if (new Date() * 1 - setting.status > 1000) {
let uptime = await runtime(process.uptime())
await ZimBotInc.setStatus(`ZIM-BOT-INC| BOT ONLINE: ${runtime(uptime)}`)
setting.status = new Date() * 1
}
}
const listmsg = (from, title, desc, list) => { // ngeread nya pake rowsId, jadi command nya ga keliatan
let po = ZimBotInc.prepareMessageFromContent(from, {"listMessage": {"title": title,"description": desc,"buttonText": "Pilih Disini","footerText": "𝐻𝑒𝑟𝑚𝑎𝑛 𝐶ℎ𝑎𝑛𝑒𝑙᭄𓅂","listType": "SINGLE_SELECT","sections": list, quoted:mek}}, {})
return ZimBotInc.relayWAMessage(po, {waitForAck: true, quoted:mek})
}
//----------ANTILINK ALL--------BY-DRIPS------\\
if (db.data.chats[m.chat].antiinstagram) {
if (budy.includes("https://www.instagram.com/")){
if (!isBotAdmins) return
zimbotv3 = `*▊▊▊DETECTED▊▊▊*\n\n*you are admn okay*`
if (isAdmins) return m.reply(zimbotv3)
if (m.key.fromMe) return m.reply(zimbotv3)
if (isCreator) return m.reply(zimbotv3)
kice = m.sender
await ZimBotInc.groupParticipantsUpdate(m.chat, [kice], 'remove')
ZimBotInc.sendMessage(from, {text:`*▊▊▊DETECTED▊▊▊*\n\n@${kice.split("@")[0]} *I said no ig links here okay, now get out* `, contextInfo:{mentionedJid:[kice]}}, {quoted:m})
}
}
//lets go
if (db.data.chats[m.chat].antifb) {
if(budy.includes("https://facebook.com/")){
if (!isBotAdmins) return
zimbotv3 = `*▊▊▊DETECTED▊▊▊*\n\n*you are admin okay*`
if (isAdmins) return m.reply(zimbotv3)
if (m.key.fromMe) return m.reply(zimbotv3)
if (isCreator) return m.reply(zimbotv3)
kice = m.sender
await ZimBotInc.groupParticipantsUpdate(m.chat, [kice], 'remove')
ZimBotInc.sendMessage(from, {text:`*▊▊▊DETECTED▊▊▊*\n\n@${kice.split("@")[0]} *I said no fb links here okay, now get out*`, contextInfo:{mentionedJid:[kice]}}, {quoted:m})
}
}
//lets go
if (db.data.chats[m.chat].antitelegram) {
if (budy.includes("https://t.me/")){
if (!isBotAdmins) return
zimbotv3 = `*▊▊▊DETECTED▊▊▊*\n*you are admin okay*`
if (isAdmins) return m.reply(zimbotv3)
if (m.key.fromMe) return m.reply(zimbotv3)
if (isCreator) return m.reply(zimbotv3)
kice = m.sender
await ZimBotInc.groupParticipantsUpdate(m.chat, [kice], 'remove')
ZimBotInc.sendMessage(from, {text:`*▊▊▊DETECTED▊▊▊*\n\n@${kice.split("@")[0]} *I said no telegram links here okay, now get out*`, contextInfo:{mentionedJid:[kice]}}, {quoted:m})
}
}
//lets go
if (db.data.chats[m.chat].antitiktok) {
if (budy.includes("https://www.tiktok.com/")){
if (!isBotAdmins) return
zimbotv3 = `*▊▊▊DETECTED▊▊▊*\n\n*you are bot admin okay*`
if (isAdmins) return m.reply(zimbotv3)
if (m.key.fromMe) return m.reply(zimbotv3)
if (isCreator) return m.reply(zimbotv3)
kice = m.sender
await ZimBotInc.groupParticipantsUpdate(m.chat, [kice], 'remove')
ZimBotInc.sendMessage(from, {text:`*▊▊▊DETECTED▊▊▊*\n\n@${kice.split("@")[0]} *I said no tiktok links here okay, now get out*`, contextInfo:{mentionedJid:[kice]}}, {quoted:m})
}
}
//
if (db.data.chats[m.chat].antitwitter) {
if (budy.includes("https://twitter.com/")){
if (!isBotAdmins) return
zimbotv3 = `*▊▊▊DETECTED▊▊▊*\n *you are bot admin okay*`
if (isAdmins) return m.reply(zimbotv3)
if (m.key.fromMe) return m.reply(zimbotv3)
if (isCreator) return m.reply(zimbotv3)
kice = m.sender
await ZimBotInc.groupParticipantsUpdate(m.chat, [kice], 'remove')
ZimBotInc.sendMessage(from, {text:`*▊▊▊DETECTED▊▊▊*\n\n@${kice.split("@")[0]} *I said no twittwer link here okay, now get out*`, contextInfo:{mentionedJid:[kice]}}, {quoted:m})
}
}
//
if (db.data.chats[m.chat].antilinkall) {
if (budy.includes("https")){
if (!isBotAdmins) return
zimbotv3 = `*▊▊▊DETECTED▊▊▊*\n *you are bot admin okay*`
if (isAdmins) return m.reply(zimbotv3)
if (m.key.fromMe) return m.reply(zimbotv3)
if (isCreator) return m.reply(zimbotv3)
kice = m.sender
await ZimBotInc.groupParticipantsUpdate(m.chat, [kice], 'remove')
ZimBotInc.sendMessage(m.chat, {text:`*▊▊▊DETECTED▊▊▊*\n@${kice.split("@")[0]} *I said dont send any links okay*`, contextInfo:{mentionedJid:[kice]}}, {quoted:m})
}
}
//
if (m.mtype == 'viewOnceMessage') {
if (!db.data.chats[m.chat].antionce) return
teks = `*▊▊▊DETECTED ONCE▊▊▊*
`
ZimBotInc.sendTextWithMentions(m.chat, teks, m)
await sleep(500)
m.copyNForward(m.chat, true, { readViewOnce: true }).catch(_ => reply(`*I opened it by force*`))
}
//
if (db.data.chats[m.chat].antilinkyt) {
if (budy.includes("https://youtube.com/")){
if (!isBotAdmins) return
zimbotv3 = `*▊▊▊DETECTED▊▊▊*\n*you are admin okay*`
if (isAdmins) return m.reply(zimbotv3)
if (m.key.fromMe) return m.reply(zimbotv3)
if (isCreator) return m.reply(zimbotv3)
kice = m.sender
await ZimBotInc.groupParticipantsUpdate(m.chat, [kice], 'remove')
ZimBotInc.sendMessage(from, {text:`*▊▊▊DETECTED▊▊▊*\n\n@${kice.split("@")[0]} *I said no yt links here okay, now get out*`, contextInfo:{mentionedJid:[kice]}}, {quoted:m})
}
}
//
if (db.data.chats[m.chat].antilink) {
if (budy.match(`chat.whatsapp.com`)) {
m.reply(`*▊▊▊ ANTILINK ▊▊▊*\n\n*You have been detected sending a group link, sorry you will be kicked!*`)
if (!isBotAdmins) return m.reply(`*Bbot must be admin okay*`)
let gclink = (`https://chat.whatsapp.com/`+await ZimBotInc.groupInviteCode(m.chat))
let isLinkThisGc = new RegExp(gclink, 'i')
let isgclink = isLinkThisGc.test(m.text)
if (isgclink) return m.reply(`*sorry I didn't kick you, because you sent the link of this group lucky you*`)
if (isAdmins) return m.reply(`*Ehh sorry you admin*`)
if (isCreator) return m.reply(`*whoa you are bot creator i wont kick you okay*`)
ZimBotInc.groupParticipantsUpdate(m.chat, [m.sender], 'remove')
}
}
if (budy.length > 3500) {
if (!m.isGroup) return
if (!isAntiVirtex) return
if (groupAdmins) return
m.reply('Mark as read\n'.repeat(300))
m.reply(`*▊▊▊DETECTED▊▊▊*\n\n*You sent a virtex, sorry you will be kicked from the group*`)
console.log(('[KICK]', 'red'), color('Received a text virus!', 'yellow'))
ZimBotInc.groupParticipantsUpdate(m.chat, [m.sender], 'remove')
}
//
// AntiWame
if (db.data.chats[m.chat].antiwame) {
if (budy.includes(`http://wa.me`)) {
if (!isBotAdmins) return
zimbotv3 = `*▊▊▊DETECTED▊▊▊*\n\n*you are admin okay*`
if (isAdmins) return reply(zimbotv3)
if (m.key.fromMe) return reply(zimbotv3)
if (isCreator) return reply(zimbotv3)
kice = m.sender
await ZimBotInc.groupParticipantsUpdate(m.chat, [kice], 'remove')
ZimBotInc.sendMessage(from, {text:`*▊▊▊DETECTED▊▊▊*\n\n@${kice.split("@")[0]} *I said no links okay, now get out*`, contextInfo:{mentionedJid:[kice]}}, {quoted:m})
}
}
//
if (db.data.chats[m.chat].autoblock) {
if (m.chat.includes("@s.whatsapp.net")) {
if (isCreator)
block = m.sender
await ZimBotInc.sendMessage(from, {text:`*▊▊▊AUTO BLOCK▊▊▊*\n\n@${block.split("@")[0]} *today I'm blocking dumps bye you are _blocked_* *if you want to use bot join this group* ${global.group1}\n\n${global.group2}`, m})
ZimBotInc.updateBlockStatus(m.sender,'block')
}
}
// AntilinkYt
if (!isAntilinkyt) {
if (budy.includes(`https://nando.com`)) {
if (!isBotAdmins) return m.reply('*BOT MUST BE ADMIN OKAY*')
m.reply(`*▊▊▊ ANTIYT ▊▊▊*\n\n*SOrry ${botname} will kick you out because what you sent is a youtube link in this group*`)
if (isAdmins) return m.reply(`*Ehh sorry you admin*`)
if (isCreator) return m.reply(`*whoa you are bot creator i wont kick you okay*`)
kice = m.sender
await ZimBotInc.groupParticipantsUpdate(m.chat, [kice], 'remove').then((res) => ads(jsonformat(res))).catch((err) => m.reply(jsonformat(err)))
ZimBotInc.sendMessage(m.chat, {text:`*▊▊▊ ANTILINK ▊▊▊*\n\n@${kice.split("@")[0]} *Has been kicked for sending the youtube link in this group*`, contextInfo:{mentionedJid:[kice]}}, {quoted:m})
}
}
/// Anti Bule
if (db.data.chats[m.chat].antibule) {
if (m.sender.includes(`+212`)) {
if (!isBotAdmins) return m.reply('*BOT MUST BE ADMIN OKAY*')
m.reply(`*▊▊▊ ANTIBULE ▊▊▊*\n\n*Sorry ${botname} will kick you out because you are a stranger in this group*`)
if (isAdmins) return m.reply(`*Ehh sorry you admin*`)
if (isCreator) return m.reply(`*whoa you are bot creator i wont kick you okay*`)
kice = m.sender
await ZimBotInc.groupParticipantsUpdate(m.chat, [kice], 'remove').then((res) => m.reply(jsonformat(res))).catch((err) => m.reply(jsonformat(err)))
ZimBotInc.sendMessage(m.chat, {text:`*▊▊▊ ANTILINK ▊▊▊*\n\n@${kice.split("@")[0]} *You shouldn't be in this group*`, contextInfo:{mentionedJid:[kice]}}, {quoted:m})
}
}
// Mute Chat
if (db.data.chats[m.chat].mute && !isAdmins && !isCreator) {
return
}
// Respon Cmd with media
if (isMedia && m.msg.fileSha256 && (m.msg.fileSha256.toString('base64') in global.db.data.sticker)) {
let hash = global.db.data.sticker[m.msg.fileSha256.toString('base64')]
let { text, mentionedJid } = hash
let messages = await generateWAMessage(m.chat, { text: text, mentions: mentionedJid }, {
userJid: ZimBotInc.user.id,
quoted: m.quoted && m.quoted.fakeObj
})
messages.key.fromMe = areJidsSameUser(m.sender, ZimBotInc.user.id)
messages.key.id = m.key.id
messages.pushName = m.pushName
if (m.isGroup) messages.participant = m.sender
let msg = {
...chatUpdate,
messages: [proto.WebMessageInfo.fromObject(messages)],
type: 'append'
}
ZimBotInc.ev.emit('messages.upsert', msg)
}
if (('family100'+m.chat in _family100) && isCmd) {
kuis = true
let room = _family100['family100'+m.chat]
let teks = budy.toLowerCase().replace(/[^\w\s\-]+/, '')
let isSurender = /^((me)?nyerah|surr?ender)$/i.test(m.text)
if (!isSurender) {
let index = room.jawaban.findIndex(v => v.toLowerCase().replace(/[^\w\s\-]+/, '') === teks)
if (room.terjawab[index]) return !0
room.terjawab[index] = m.sender
}
let isWin = room.terjawab.length === room.terjawab.filter(v => v).length
let caption = `
Answer the following questions :\n${room.soal}\n\n\nThere is ${room.jawaban.length} Answer ${room.jawaban.find(v => v.includes(' ')) ? `(some answers have spaces)` : ''}
${isWin ? `All Answers Answered` : isSurender ? 'Give up!' : ''}
${Array.from(room.jawaban, (jawaban, index) => {
return isSurender || room.terjawab[index] ? `(${index + 1}) ${jawaban} ${room.terjawab[index] ? '@' + room.terjawab[index].split('@')[0] : ''}`.trim() : false
}).filter(v => v).join('\n')}
${isSurender ? '' : `Perfect Player`}`.trim()
ZimBotInc.sendText(m.chat, caption, m, { contextInfo: { mentionedJid: parseMention(caption) }}).then(mes => { return _family100['family100'+m.chat].pesan = mesg }).catch(_ => _)
if (isWin || isSurender) delete _family100['family100'+m.chat]
}
if (tebaklagu.hasOwnProperty(m.sender.split('@')[0]) && isCmd) {
kuis = true
jawaban = tebaklagu[m.sender.split('@')[0]]
if (budy.toLowerCase() == jawaban) {
await ZimBotInc.sendButtonText(m.chat, [{ buttonId: 'tebak lagu', buttonText: { displayText: 'guess the song' }, type: 1 }], `🎮 Guess the Song 🎮\n\n*Correct answer Bonus +500 money🎉*\n\n*Want to play again? press the button below*`, ZimBotInc.user.name, m)
delete tebaklagu[m.sender.split('@')[0]]
} else m.reply('*Wrong answer!*')
}
if (kuismath.hasOwnProperty(m.sender.split('@')[0]) && isCmd) {
kuis = true
jawaban = kuismath[m.sender.split('@')[0]]
if (budy.toLowerCase() == jawaban) {
await m.reply(`🎮 Math Quiz 🎮\n\n*Correct answer* 🎉\n\n*Want to play again? send* ${prefix}math mode`)
delete kuismath[m.sender.split('@')[0]]
} else m.reply('*Wrong answer!*')
}
if (tebakgambar.hasOwnProperty(m.sender.split('@')[0]) && isCmd) {
kuis = true
jawaban = tebakgambar[m.sender.split('@')[0]]
if (budy.toLowerCase() == jawaban) {
await ZimBotInc.sendButtonText(m.chat, [{ buttonId: 'tebak gambar', buttonText: { displayText: 'Guess the picture' }, type: 1 }], `🎮 Tebak Gambar 🎮\n\n*Correct answer +500 money🎉*\n\n*Want to play again? press the button below*`, ZimBotInc.user.name, m)
delete tebakgambar[m.sender.split('@')[0]]
} else m.reply('*Wrong answer!*')
}
9
if (tebakkata.hasOwnProperty(m.sender.split('@')[0]) && isCmd) {
kuis = true
jawaban = tebakkata[m.sender.split('@')[0]]
if (budy.toLowerCase() == jawaban) {
await ZimBotInc.sendButtonText(m.chat, [{ buttonId: 'tebak kata', buttonText: { displayText: 'Tebak Kata' }, type: 1 }], `🎮 Tebak Kata 🎮\n\nCorrect Answer +500 money🎉\n\n*Want to play again? press the button below*`, ZimBotInc.user.name, m)
delete tebakkata[m.sender.split('@')[0]]
} else m.reply('*Wrong answer!*')
}
if (caklontong.hasOwnProperty(m.sender.split('@')[0]) && isCmd) {
kuis = true
jawaban = caklontong[m.sender.split('@')[0]]
deskripsi = caklontong_desk[m.sender.split('@')[0]]
if (budy.toLowerCase() == jawaban) {
await ZimBotInc.sendButtonText(m.chat, [{ buttonId: 'tebak lontong', buttonText: { displayText: 'Tebak Lontong' }, type: 1 }], `🎮 Cak Lontong 🎮\n\nCorrect Answer +500 money🎉\n*${deskripsi}*\n\n*Want to play again? press the button below*`, ZimBotInc.user.name, m)
delete caklontong[m.sender.split('@')[0]]
delete caklontong_desk[m.sender.split('@')[0]]
} else m.reply('*Wrong answer!*')
}
if (tebakkalimat.hasOwnProperty(m.sender.split('@')[0]) && isCmd) {
kuis = true
jawaban = tebakkalimat[m.sender.split('@')[0]]
if (budy.toLowerCase() == jawaban) {
await ZimBotInc.sendButtonText(m.chat, [{ buttonId: 'tebak kalimat', buttonText: { displayText: 'Tebak Kalimat' }, type: 1 }], `🎮 Tebak Kalimat 🎮\n\nCorrect Answer +500 money🎉\n\n*Want to play again? press the button below*`, ZimBotInc.user.name, m)
delete tebakkalimat[m.sender.split('@')[0]]
} else m.reply('*Wrong answer!*')
}
if (tebaklirik.hasOwnProperty(m.sender.split('@')[0]) && isCmd) {
kuis = true
jawaban = tebaklirik[m.sender.split('@')[0]]
if (budy.toLowerCase() == jawaban) {
await ZimBotInc.sendButtonText(m.chat, [{ buttonId: 'tebak lirik', buttonText: { displayText: 'Tebak Lirik' }, type: 1 }], `🎮 Tebak Lirik 🎮\n\nCorrect Answer +500 money🎉\n\n*Want to play again? press the button below*`, ZimBotInc.user.name, m)
delete tebaklirik[m.sender.split('@')[0]]
} else m.reply('*Wrong answer!*')
}
if (tebaktebakan.hasOwnProperty(m.sender.split('@')[0]) && isCmd) {
kuis = true
jawaban = tebaktebakan[m.sender.split('@')[0]]
if (budy.toLowerCase() == jawaban) {
await ZimBotInc.sendButtonText(m.chat, [{ buttonId: 'tebak tebakan', buttonText: { displayText: 'Tebak Tebakan' }, type: 1 }], `🎮 Tebak Tebakan 🎮\n\nCorrect Answer +500 money🎉\n\n*Want to play again? press the button below*`, ZimBotInc.user.name, m)
delete tebaktebakan[m.sender.split('@')[0]]
} else m.reply('*Wrong answer!*')
}
//TicTacToe
this.game = this.game ? this.game : {}
let room = Object.values(this.game).find(room => room.id && room.game && room.state && room.id.startsWith('tictactoe') && [room.game.playerX, room.game.playerO].includes(m.sender) && room.state == 'PLAYING')
if (room) {
let ok
let isWin = !1
let isTie = !1
let isSurrender = !1
// m.reply(`[DEBUG]\n${parseInt(m.text)}`)
if (!/^([1-9]|(me)?nyerah|surr?ender|off|skip)$/i.test(m.text)) return
isSurrender = !/^[1-9]$/.test(m.text)
if (m.sender !== room.game.currentTurn) { // nek wayahku
if (!isSurrender) return !0
}
if (!isSurrender && 1 > (ok = room.game.turn(m.sender === room.game.playerO, parseInt(m.text) - 1))) {
m.reply({
'-3': 'Game has ended',
'-2': 'Invalid',
'-1': 'Invalid Position',
0: 'Invalid Position',
}[ok])
return !0
}
if (m.sender === room.game.winner) isWin = true
else if (room.game.board === 511) isTie = true
let arr = room.game.render().map(v => {
return {
X: '❌',
O: '⭕',
1: '1️⃣',
2: '2️⃣',
3: '3️⃣',
4: '4️⃣',
5: '5️⃣',
6: '6️⃣',
7: '7️⃣',
8: '8️⃣',
9: '9️⃣',
}[v]
})
if (isSurrender) {
room.game._currentTurn = m.sender === room.game.playerX
isWin = true
}
let winner = isSurrender ? room.game.currentTurn : room.game.winner
let str = `Room ID: ${room.id}
${arr.slice(0, 3).join('')}
${arr.slice(3, 6).join('')}
${arr.slice(6).join('')}
${isWin ? `@${winner.split('@')[0]} Win!` : isTie ? `Game berakhir` : `Giliran ${['❌', '⭕'][1 * room.game._currentTurn]} (@${room.game.currentTurn.split('@')[0]})`}
❌: @${room.game.playerX.split('@')[0]}