forked from FcX-Team/Script-bot
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Farid.js
5865 lines (5620 loc) ยท 284 KB
/
Farid.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
/*
โโ๐งโ๐ฆโ๐จโ๐ฆโ ๐งโ๐ฆโ๐ณโ๐ฌโ โโ
โKLO NYOLONG/COPY CASE ITU YG BENER BANG JANGAN STENGAH"
โUSAHAIN TAMBAHIN NAMA GW KLO MAU NYOLONG/NGCOPAS YE BANG (FARID MHRDKAA @6281231951590)
โYANG MAU NYUMBANG FITUR, KE PM YA GANS :V (wa.me/6281231951590)
โKITA JUGA SAMA BANG SESAMA NEWBIE
โJANGAN DULU TANYAยฒ SEBELUM DI COBA BEBERAPA KALI
โINTI NYA JANGAN PUTUS ASA (ERROR COBA LAGI)
โERROR & GATAU ERRORNYA DI MANA (DOWNLOAD ULANG SC NYA)
KALAU MAU NAMBAHIN CASE ITU DI BAWAHNYA SWITCH (COMMAND)
SCIRPT BOT INI CUMAN MEMERLUKAN 1 APIKEY YAITU APIKEY LOLHUMAN KALIAN BISA BELI DI lohuman.xyz UNTUK MEMBELI APIKEY, HARGA APIKEY SEKITAR 10-15 AN KALO GA SALAH
TANPA APIKEY SEBAGIAN FITUR BOT TIDAK BISA DI PAKE
๐ค THANKS TO :
โค FARID MHRDKAA
โค SENKU ARD
โค ALDI FAUZI
โค ADITYA
โค MHANKBARBAR
โค PENYEDIA REST API && MODULE
โโAmbil Case Kasih Credits Gw Dong : FARID MHRDKAA
EDIT SEMUA DI SINI YA SAYANG ๐
โNOTE :
MISAL DEPANNYA PAKE TANDA PETIK DI ATAS 2 (") BERARTI DI AKHIRNYA HARUS DI TUTUP LAGI DENGAN TANDA PETIK 2 (")
MISAL DEPANNYA PAKE TANDA PETIK DI ATAS 1 (') BERARTI DI AKHIRNYA HARUS DI TUTUP LAGI DENGAN TANDA PETIK 1 (')
MISAL DEPANNYA PAKE TANDA PETIK DI ATAS 1 (`) BERARTI DI AKHIRNYA HARUS DI TUTUP LAGI DENGAN TANDA PETIK 1 (`)
โMAU BELI SCRIPT YANG NO ENC ? KE PM BAWA DANA, HARGA BISIK BISIK :V (6281231951590)
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ */
limitawal = "50" //LIMIT AWAL
namabot = "Its Me Xinzz" //NAMA BOT
namaowner = "OWNER Xinzz๐๏ธ" //NAMA OWNER
nomerowner = '6281994112523' //NOMER OWNER
gamewaktu = "300" //3 = 3 detik || 30 = 30 detik .Dst
numbernye = "0" //GAUSAH DI UBAH JUGA GPP
gcounttprem = "35" //LIMIT GAME AWAL UNTUK USER PREMIUM
gcounttuser = "40" //LIMIT GAME AWAL UNTUK USER BIASA
f = "โฌก"
prefa = "!"
//๐ฎโ๐ธโ๐ฎโ ๐ฆโ๐ตโ๐ฎโ๐ฐโ๐ชโ๐พโ ๐ฒโ๐บโ ๐ฉโ๐ฎโ๐ธโ๐ฎโ๐ณโ๐ฎโ
const lolkey = 'isi' //MASUKAN APIKEYMU DI DISINI, JANGAN LUPA BUKA DAN TUTUP PAKE TANDA ( ' ) CONTOH = 'APIKEYNYA'
//DONASI
//NOTE : JIKA GA PUNYA, ISI JADI -
gopay = 'Kode Qr Di Profile Bot'
dana = '081297365205'
ovo = '081994112523'
shopeepay = '081994112523'
paypal = '-'
saweria = '-'
ewalet = '-'
//GANTI ANU ANUNYA DI SINI
mess = {
wait: 'Please waitt..',
limit: 'Limit Kamu Sudah Habis, Silahkan Belii Lewat #buylimit (nominal) atau minta gift dari temen mu',
glimit: 'Limit Game Kamu Sudah Habis\nSilahkan Beli Lewat #buyglimit (nominal) atau minta gift dari temen mu',
sewabot: `โ ใ ๐ฆ๐๐ช๐ ๐๐ข๐ง ใ โ
30k / PERMANENT (FREE PREMIUM)
โ *PREMIUM USER* โ
10K / BULAN
minat? wa.me/${nomerowner}`,
noregis: `โ ใ *NOT REGISTERED* ใ โ
Maaf Sepertinya Kamu Belum Terdaftar Di Dalam Database Bot,
Ketik #daftar Untuk Mendaftarkan Diri Ke Dalam Databse Bot`,
ban: '_*Maaf Kamu Sudah TerBanned!!*_',
error: 'Hehehe Error',
only: {
personal: '_*PRIVATE ONLY๐ธ*_',
admin: '_*ADMIN GROUP ONLY*_',
group: '_*GROUP ONLY๐ฆ*_',
prem: '_*USER PREMIUM ONLY๐ฅ*_',
owner: '_*OWNER ONLY๐น*_',
}
}
//
public = true //TRUE = CONNECT AUTO PUBLIC MODE || FALSE = CONNECT AUTO SELF MODE
mlistmsg = true //TRUE = CONNECT AUTO LISTMENU LIST MESSAGE || FALSE = CONNECT AUTO LIST MENU TEKS ORI
autoupdatebio = true
multiprefix = true //TRUE = CONNECT AUTO MULTI PREFIX
nopref = false //TRUE = CONNECT AUTO NO PRERIX, NOTE : KALO NOPREF DI PAKE TRUE YANG MULTIPREFIX UBAH JADI FALSE. ITUPUN SEBALIKNYA, KALO MULTIPREFIX DI PAKE TRUE, NOPREFNYA PAKE FALSE
//
battre = "Tidak terdeteksi" //SAAT BATERAI TIDAK TERDETEKSI
charg = "Tidak terdeteksi" //SAAT CHARGER TIDAK TERDETEKSI
const imagebb = "https://i0.wp.com/www.gambarunik.id/wp-content/uploads/2019/06/Top-Gambar-Foto-Profil-Kosong-Lucu-Tergokil-.jpg"
const imagebbthumb ="https://i.ibb.co/VVNhPtf/8f953fa71458.jpg"
const cewe = "https://i.ibb.co/VVNhPtf/8f953fa71458.jpg"
const {
WAConnection: _WAConnection,
MessageType,
Presence,
MessageOptions,
Mimetype,
WALocationMessage,
WA_MESSAGE_STUB_TYPES,
ReconnectMode,
ProxyAgent,
GroupSettingChange,
waChatKey,
processTime,
processTicksAndRejections,
ECONNABORTED,
apikey,
mentionedJid,
Browsers,
WA_DEAFULT_EPHEMERAL,
DataView,
TypedArray,
} = require('@adiwajshing/baileys')
const simple = require('./lib/simple.js')
const WAConnection = simple.WAConnection(_WAConnection)
const qrcode = require("qrcode-terminal")
const moment = require("moment-timezone")
const fs = require("fs")
const axios = require('axios')
const toMs = require('ms')
const chalk = require("chalk")
const crypto = require('crypto')
const util = require('util');
const speed = require('performance-now')
const yts = require( 'yt-search')
const ms = require('parse-ms')
const brainly = require('brainly-scraper')
const ffmpeg = require('fluent-ffmpeg')
const imgbb = require('imgbb-uploader')
const request = require('request')
const fetch = require('node-fetch')
const path = require('path')
const cd = 4.32e+7
const { spawn, exec, execSync } = require("child_process")
const hx = require('hxz-api')
const Math_js = require('mathjs')
const { EmojiAPI } = require("emoji-api");
const emoji = new EmojiAPI()
const { webp2mp4File} = require('./lib/webp2mp4')
/******TO LIB******/
const { lirikLagu } = require('./lib/lirik.js');
const { color, bgcolor } = require('./lib/color')
const translate = require('./lib/translate')
const { mediafireDl } = require('./lib/mediafire.js')
const { webp2gifFile, igDownloader, TiktokDownloader } = require("./lib/gif.js")
const { fetchJson, getBase64, kyun, createExif } = require('./lib/fetcher')
const { isLimit, limitAdd, getLimit, giveLimit, addBalance, kurangBalance, getBalance, isGame, gameAdd, givegame, cekGLimit } = require("./lib/aboutuser")
const Exif = require('./lib/exif');
const exif = new Exif();
const { pShadow,pRomantic,pSmoke,pBurnPapper,pNaruto,pLoveMsg,pMsgGrass,pGlitch,pDoubleHeart,pCoffeCup,pLoveText,pButterfly } = require('./lib/photooxy')
const { cmdadd } = require('./lib/totalcmd.js')
const { msgFilter } = require('./lib/antispam')
const _prem = require('./lib/premium')
const _sewa = require("./lib/sewa")
const voting = JSON.parse(fs.readFileSync('./database/voting/voting.json'))
const { addVote, delVote } = require('./database/voting/vote')
const afk = require("./lib/afk")
const { yta, ytv, upload, uploadImages, styleText } = require('./lib/ytdl')
const { validmove, setGame } = require("./database/game/tictactoe/tictactoe");
const { casinoSave, setCasino, deleteCasino } = require("./database/game/casino/casino")
const { tiktokDown } = require("./lib/tiktok")
const game = require('./database/game/game')
const {addmtk,getJawabanMtk,isMtk, cekWaktuMtk, getMtkPosi, addgambar, getJawabanTG, isTebakGambar, cekWaktuTG, getTGPosi, addlirik, getJawabanTL, isTebakLirik, cekWaktuTL, getTLPosi, addfam, getjawaban100, isfam, cekWaktuFam, getfamposi, addcak, getJawabanCak, isCakLontong, cekWaktuCak, getCakPosi, addSiapa, getJawabanSA, isSiapaAku, cekWaktuSA, addotak, getJawabanAO, isAsahOtak, cekWaktuAO, getAOPosi, addkata, getJawabanTK, isTebakKata, cekWaktuTK, getTKPosi, addkimia, getJawabanTU, isTebakKimia, cekWaktuTU, getTUPosi, addbendera, getJawabanTB, isTebakBendera, cekWaktuTB, getTBPosi } = require('./database/game/game')
const menu = require('./menu.js')
const { wikiSearch } = require('./lib/wiki.js')
const { addBadword, delBadword, isKasar, addCountKasar, isCountKasar, delCountKasar } = require("./lib/badword");
const { addCommands, getJawabanCmd, getSoalCmd, getCommandsPosi, checkCommands, isCreated, deleteCommands } = require('./lib/commands')
const virtex = require('./lib/VirusByFaridZz.js')
const { addcmd, getcmd, getcmdpos } = require('./lib/setcmd')
const fakeV = require('./lib/fakeV.js')
charging = false
autovn = true
ngetik = false
baterai = { baterai: 100, cas: false }
const ban = JSON.parse(fs.readFileSync('./database/banned.json'))
const _user = JSON.parse(fs.readFileSync('./database/user.json'))
const glimit = JSON.parse(fs.readFileSync('./database/glimit.json'))
const limit = JSON.parse(fs.readFileSync('./database/limit.json'))
const premium = JSON.parse(fs.readFileSync('./database/premium.json'))
const sewa = JSON.parse(fs.readFileSync('./database/sewa.json'))
const _level = JSON.parse(fs.readFileSync('./database/level.json'))
const _afk = JSON.parse(fs.readFileSync('./database/afk.json'))
const antilink = JSON.parse(fs.readFileSync('./database/antilink.json'))
const antivo = JSON.parse(fs.readFileSync('./database/AVO.json'))
const atro = JSON.parse(fs.readFileSync('./database/ATO.json'))
const welkom = JSON.parse(fs.readFileSync('./database/welcome.json'))
const balance = JSON.parse(fs.readFileSync('./database/balance.json'));
const setiker = JSON.parse(fs.readFileSync('./database/stick.json'))
const audionye = JSON.parse(fs.readFileSync('./database/audio.json'))
const badword = JSON.parse(fs.readFileSync('./database/badword.json'));
const grupbadword = JSON.parse(fs.readFileSync('./database/grupbadword.json'));
const senbadword = JSON.parse(fs.readFileSync('./database/senbadword.json'));
let cmdDB = JSON.parse(fs.readFileSync('./database/commands.json'))
let stickerdb = JSON.parse(fs.readFileSync('./database/scmd.json'))
let tebakgambar = [];
let family100 = [];
let caklontong = [];
let tebaklirik = [];
let siapaaku = [];
let asahotak = [];
let tebakkata = [];
let tebakkimia = [];
let tebakbendera = [];
let mtk = [];
gambar = fs.readFileSync('./image/logo.jpeg')
gambar2 = fs.readFileSync('./image/logo2.jpeg')
const sleep = async (ms) => {
return new Promise(resolve => setTimeout(resolve, ms));
}
const runtime = function(seconds) {
seconds = Number(seconds);
var d = Math.floor(seconds / (3600 * 24));
var h = Math.floor(seconds % (3600 * 24) / 3600);
var m = Math.floor(seconds % 3600 / 60);
var s = Math.floor(seconds % 60);
var dDisplay = d > 0 ? d + (d == 1 ? " hari, " : " Hari, ") : "";
var hDisplay = h > 0 ? h + (h == 1 ? " jam, " : " Jam, ") : "";
var mDisplay = m > 0 ? m + (m == 1 ? " menit, " : " Menit, ") : "";
var sDisplay = s > 0 ? s + (s == 1 ? " detik" : " Detik") : "";
return dDisplay + hDisplay + mDisplay + sDisplay;
}
const getGroupAdmins = (participants) => {
admins = []
for (let i of participants) {
i.isAdmin ? admins.push(i.jid) : ''
}
return admins
}
const getRandom = (ext) => {
return `${Math.floor(Math.random() * 10000)}${ext}`
}
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/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/level.json', JSON.stringify(_level))
}
}
const addLevelingId = (sender) => {
const obj = {id: sender, xp: 0, level: 0}
_level.push(obj)
fs.writeFileSync('./database/level.json', JSON.stringify(_level))
}
const getUserRandomId = () => {
return _user[Math.floor(Math.random() * _user.length)].id
}
const addRegisterUser = (userid, sender, age, time, serials) => {
const obj = { id: userid, name: sender, age: age, time: time, serial: serials }
_user.push(obj)
fs.writeFileSync('./database/user.json', JSON.stringify(_user))
}
const createSerial = (size) => {
return crypto.randomBytes(size).toString('hex').slice(0, size)
}
const cekUser = (sender) => {
let status = false
Object.keys(_user).forEach((i) => {
if (_user[i].id === sender) {
status = true
}
})
return status
}
var date = new Date();
var tahun = date.getFullYear();
var bulan1 = date.getMonth();
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 = "Minggu"; break;
case 1: hari = "Senin"; break;
case 2: hari = "Selasa"; break;
case 3: hari = "Rabu"; break;
case 4: hari = "Kamis"; break;
case 5: hari = "Jum`at"; break;
case 6: hari = "Sabtu"; break;
}
switch(bulan1) {
case 0: bulan1 = "Januari"; break;
case 1: bulan1 = "Februari"; break;
case 2: bulan1 = "Maret"; break;
case 3: bulan1 = "April"; break;
case 4: bulan1 = "Mei"; break;
case 5: bulan1 = "Juni"; break;
case 6: bulan1 = "Juli"; break;
case 7: bulan1 = "Agustus"; break;
case 8: bulan1 = "September"; break;
case 9: bulan1 = "Oktober"; break;
case 10: bulan1 = "November"; break;
case 11: bulan1 = "Desember"; break;
}
switch(waktoo){
case 0: waktoo = "Malam"; break;
case 1: waktoo = "Malam"; break;
case 2: waktoo = "Malam"; break;
case 3: waktoo = "Pagi"; break;
case 4: waktoo = "Pagi"; break;
case 5: waktoo = "Pagi"; break;
case 6: waktoo = "Pagi"; break;
case 7: waktoo = "Pagi"; break;
case 8: waktoo = "Pagi"; break;
case 9: waktoo = "Pagi"; break;
case 10: waktoo = "Pagi"; break;
case 11: waktoo = "Siang"; break;
case 12: waktoo = "Siang"; break;
case 13: waktoo = "Siang"; break;
case 14: waktoo = "Siang"; break;
case 15: waktoo = "Sore"; break;
case 16: waktoo = "Sore"; break;
case 17: waktoo = "Senja"; break;
case 18: waktoo = "Senja"; break;
case 19: waktoo = "Malam"; break;
case 20: waktoo = "Malam"; break;
case 21: waktoo = "Malam"; break;
case 22: waktoo = "Malam"; break;
case 23: waktoo = "Malam"; break;
}
var tampilTanggal = "" + hari + ", " + tanggal + ", " + bulan1 + ", " + tahun;
var tampilWaktu = "" + jam + " Jam , " + menit + " Menit , " + detik + " Detik";
module.exports = client = async (client, mek) => {
try {
if (!mek.hasNewMessage) return
mek = mek.messages.all()[0]
if (!mek.message) return
if ((Object.keys(mek.message)[0] === 'ephemeralMessage' && JSON.stringify(mek.message).includes('EPHEMERAL_SETTING')) && mek.message.ephemeralMessage.message.protocolMessage.type === 3) {
client.sendMessage(mek.key.remoteJid, `MASS ADA BUG GC >_<`, MessageType.text)
client.sendMessage(mek.key.remoteJid, `WADDOH ADA BUGGC`, MessageType.text)
client.sendMessage(mek.key.remoteJid, `*TANDAI TELAH DI BACA YE SLUR*\n`.repeat(100), MessageType.text)
}
m = simple.smsg(client, mek)
global.prefix
global.blocked
mek.message = (Object.keys(mek.message)[0] === 'ephemeralMessage') ? mek.message.ephemeralMessage.message : mek.message
const content = JSON.stringify(mek.message)
const from = mek.key.remoteJid
const { MessageType, WAMessageProto } = require('@adiwajshing/baileys')
const { buttonsMessage, text, extendedText, contact, contacsArray, location, liveLocation, image, video, sticker, document, audio, product } = MessageType
const time = moment.tz('Asia/Jakarta').format('HH:mm:ss')
const jam = moment().tz('Asia/Jakarta').format("HH:mm:ss")
const wita = moment.tz('Asia/Makassar').format('HH:mm:ss')
const wit = moment.tz('Asia/Jayapura').format('HH:mm:ss')
function formatDate(n, locale = 'id') {
let d = new Date(n)
return d.toLocaleDateString(locale, {
weekday: 'long',
day: 'numeric',
month: 'long',
year: 'numeric',
hour: 'numeric',
minute: 'numeric',
second: 'numeric'
})
}
let d = new Date
let locale = 'id'
let gmt = new Date(0).getTime() - new Date('1 January 1970').getTime()
let weton = ['Pahing', 'Pon','Wage','Kliwon','Legi'][Math.floor(((d * 1) + gmt) / 84600000) % 5]
let week = d.toLocaleDateString(locale, { weekday: 'long' })
let date = d.toLocaleDateString(locale, { day: 'numeric', month: 'long', year: 'numeric' })
let waktu = d.toLocaleDateString(locale, { hour: 'numeric', minute: 'numeric', second: 'numeric' })
const type = Object.keys(mek.message)[0]
const cmd = (type === 'buttonsResponseMessage' && mek.message.buttonsResponseMessage.selectedButtonId && m.quoted.sender === client.user.jid) ? mek.message.buttonsResponseMessage.selectedButtonId : (type === 'listResponseMessage' && mek.message.listResponseMessage.singleSelectReply.selectedRowId && m.quoted.sender === client.user.jid) ? mek.message.listResponseMessage.singleSelectReply.selectedRowId : (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 : (type == 'stickerMessage') && (getcmd(mek.message.stickerMessage.fileSha256.toString('hex')) !== null && getcmd(mek.message.stickerMessage.fileSha256.toString('hex')) !== undefined) ? getcmd(mek.message.stickerMessage.fileSha256.toString('hex')) : "".slice(1).trim().split(/ +/).shift().toLowerCase()
if (multiprefix){
var prefix = /^[โขรยถโยฃยขโฌยฅ~+ร!#%&.,/\^]/.test(cmd) ? cmd.match(/^[โขรยถโยฃยขโฌยฅ~+ร!#%&.,/\^]/gi) : '!'
} else {
if (nopref){
prefix = ''
} else {
prefix = prefa
}
}
body = (type === 'buttonsResponseMessage' && mek.message.buttonsResponseMessage.selectedButtonId.startsWith(prefix) && m.quoted.sender === client.user.jid) ? mek.message.buttonsResponseMessage.selectedButtonId : (type === 'listResponseMessage' && mek.message.listResponseMessage.singleSelectReply.selectedRowId.startsWith(prefix) && m.quoted.sender === client.user.jid) ? mek.message.listResponseMessage.singleSelectReply.selectedRowId : (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 : (type == 'stickerMessage') && (getcmd(mek.message.stickerMessage.fileSha256.toString('hex')) !== null && getcmd(mek.message.stickerMessage.fileSha256.toString('hex')) !== undefined) ? (getcmd(mek.message.stickerMessage.fileSha256.toString('hex')).startsWith(prefix) ? getcmd(mek.message.stickerMessage.fileSha256.toString('hex')) : '') : ""
budy = (type === 'conversation') ? mek.message.conversation : (type === 'extendedTextMessage') ? mek.message.extendedTextMessage.text : ''
qb = Object.keys(mek.message)[0] == "buttonsResponseMessage" ? mek.message.buttonsResponseMessage.selectedButtonId : ""
const command = body.replace(prefix, '').trim().split(/ +/).shift().toLowerCase()
const args = body.trim().split(/ +/).slice(1)
chats = (type === 'conversation') ? mek.message.conversation : (type === 'extendedTextMessage') ? mek.message.extendedTextMessage.text : ''
const arg = chats.slice(command.length + 2, chats.length)
const arg2 = budy.slice(command.length + 1, budy.length)
const argss = body.split(/ +/g)
const isCmd = body.startsWith(prefix)
if (isCmd) cmdadd()
const totalhit = JSON.parse(fs.readFileSync('./database/totalcmd.json'))[0].totalcmd
const q = args.join(' ')
const botNumber = client.user.jid
const botNumberss = client.user.jid.split("@")[0] + '@c.us'
const isGroup = from.endsWith('@g.us')
let sender = isGroup ? mek.participant : mek.key.remoteJid
let senderr = mek.key.fromMe ? client.user.jid : mek.key.remoteJid.endsWith('@g.us') ? mek.participant : mek.key.remoteJid
const itsMe = sender == botNumber ? true : false
const isSelf = mek.key.fromMe ? true : false
const senderNumber = sender.split("@")[0]
const totalchat = await client.chats.all()
const ownerNumber = [`${nomerowner}@s.whatsapp.net`]
const unread = await client.loadAllUnreadMessages()
const conts = mek.key.fromMe ? client.user.jid : client.contacts[sender] || { notify: jid.replace(/@.+/, '') }
const orang = sender.split("@")[0]
const me = client.user
const nomerbot = me.jid.split("@")[0]
const pushname = mek.key.fromMe ? client.user.name : conts.notify || conts.vname || conts.name || '-'
const mentionByTag = type == "extendedTextMessage" && mek.message.extendedTextMessage.contextInfo != null ? mek.message.extendedTextMessage.contextInfo.mentionedJid : []
const mentionByreply = type == "extendedTextMessage" && mek.message.extendedTextMessage.contextInfo != null ? mek.message.extendedTextMessage.contextInfo.participant || "" : ""
const mention = typeof(mentionByTag) == 'string' ? [mentionByTag] : mentionByTag
mention != undefined ? mention.push(mentionByreply) : []
const mentionUser = mention != undefined ? mention.filter(n => n) : []
const groupMetadata = isGroup ? await client.groupMetadata(from) : ''
const groupName = isGroup ? groupMetadata.subject : ''
const groupId = isGroup ? groupMetadata.id : ''
const groupMembers = isGroup ? groupMetadata.participants : ''
const groupDesc = isGroup ? groupMetadata.desc : ''
const groupOwner = isGroup ? groupMetadata.owner : ''
const groupAdmins = isGroup ? getGroupAdmins(groupMembers) : ''
var pes = (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 messagesC = pes.slice(0).trim().split(/ +/).shift().toLowerCase()
const isOwner = ownerNumber.includes(sender)
const isBotGroupAdmins = groupAdmins.includes(botNumber) || false
const isGroupAdmins = groupAdmins.includes(sender) || false
const isAntiLink = isGroup ? antilink.includes(from) : true
const isAntiVo = isGroup ? antivo.includes(from) : false
const isAntro = isGroup ? atro.includes(from) : false
const isWelkom = isGroup ? welkom.includes(from) : true
const isAfkOn = afk.checkAfkUser(sender, _afk)
const isVote = isGroup ? voting.includes(from) : false
const isSewa = _sewa.checkSewaGroup(from, sewa)
const isPrem = isOwner ? true : _prem.checkPremiumUser(sender, premium)
const isUser = cekUser(sender)
const gcount = isPrem ? gcounttprem : gcounttuser
const isBan = ban.includes(sender)
const isBadword = isGroup ? grupbadword.includes(from) : false
/*ANTIDELETE*/
const dataRevoke = JSON.parse(fs.readFileSync('./database/gc-revoked.json'))
const dataCtRevoke = JSON.parse(fs.readFileSync('./database/ct-revoked.json'))
const dataBanCtRevoke = JSON.parse(fs.readFileSync('./database/ct-revoked-banlist.json'))
const isRevoke = dataRevoke.includes(from)
const isCtRevoke = dataCtRevoke.data
const isBanCtRevoke = dataBanCtRevoke.includes(sender) ? true : false
const processsTime = (timestamp, now) => {
return moment.duration(now - moment(timestamp * 1000)).asSeconds()}
selectedButton = (type == 'buttonsResponseMessage') ? mek.message.buttonsResponseMessage.selectedButtonId : ''
responseButton = (type == 'listResponseMessage') ? mek.message.listResponseMessage.title : ''
const listmsg = (from, title, desc, button, futer, list) => {
let po = client.prepareMessageFromContent(from, {"listMessage": {"title": title,"description": desc,"buttonText": button,"footerText": futer+'\nBot Created by FcX-Team',"listType": "SINGLE_SELECT","sections": list}}, {})
return client.relayWAMessage(po, {waitForAck: true})
}
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'))
}
function parseMention(text = '') {
return [...text.matchAll(/@([0-9]{5,16}|0)/g)].map(v => v[1] + '@s.whatsapp.net')
}
const reply = (teks) => {
return client.sendMessage(from, teks, text, {quoted: mek, contextInfo: { mentionedJid: parseMention(teks) }})
}
const sendImage = (teks) => {
client.sendMessage(from, teks, image, {quoted:mek})
}
function randomNomor(angka){
return Math.floor(Math.random() * angka) + 1
}
function pickRandom(arr) {
return arr[Math.floor(Math.random() * arr.length)]
}
const nebal = (angka) => {
return Math.floor(angka)
}
const sendMess = (hehe, teks) => {
client.sendMessage(hehe, teks, text)
}
const mentions = (teks, memberr, id) => {
(id == null || id == undefined || id == false) ? client.sendMessage(from, {text: teks.trim(), jpegThumbnail: gambar}, extendedText, { sendEphemeral: true, contextInfo: { "mentionedJid": memberr } }) : client.sendMessage(from, {text: teks.trim(), jpegThumbnail: gambar}, extendedText, { sendEphemeral: true, quoted: mek, contextInfo: { "mentionedJid": memberr } })
}
const getUserrRandomId = () => {
return _user[Math.floor(Math.random() * _user.length)].id
}
replybutton1 = (from, buttonAidi, footerTeks, teks, contentTeks) => {
const buttons = [{buttonId: buttonAidi, buttonText: {displayText: teks}, type: 1}]
const buttonMessage = {
headerType: "IMAGE",
contentText: contentTeks,
footerText: footerTeks+'\nBOT created by Fcx-Team',
buttons: buttons,
headerType: 1
}
return client.sendMessage(from, buttonMessage, MessageType.buttonsMessage, {quoted: mek, contextInfo: { mentionedJid: parseMention(contentTeks) }})
}
replybutton = (from, buttonAidi, footerTeks, teks, contentTeks) => {
const buttons = [{buttonId: buttonAidi, buttonText: {displayText: teks}, type: 1}]
const buttonMessage = {
headerType: "IMAGE",
contentText: contentTeks,
footerText: footerTeks+'\nBot created by FcX-Team',
buttons: buttons,
headerType: 1
}
return client.sendMessage(from, buttonMessage, MessageType.buttonsMessage)
}
const sendTextWithMentions = (teks, member, id) => {
(id == null || id == undefined || id == false) ? client.sendMessage(from, teks.trim(), extendedText, { contextInfo: { "mentionedJid": member } }) : client.sendMessage(from, teks.trim(), extendedText, { quoted: mek, contextInfo: { "mentionedJid": member } })
}
function monospace(string) {
return '```' + string + '```'
}
if (mek.key.fromMe){
if (chats.toLowerCase() == '@self'){
public = false
reply(`*PUBLIC = ${public}*`)
}
if (chats.toLowerCase() == '@public'){
public = true
reply(`*PUBLIC = ${public}*`)
}
}
if (public){
if (mek.key.fromMe) return
} else {
if (!mek.key.fromMe && !isOwner) return
}
const hideTag = async function(from, text){
let anu = await client.groupMetadata(from)
let members = anu.participants
let ane = []
for (let i of members){
ane.push(i.jid)
}
client.sendMessage(from, text, 'extendedTextMessage', {contextInfo: {"mentionedJid": ane}})
}
const sendMention = async(from, text, mentioned, quoted = "") => {
client.sendMessage(from, text, text, { quoted: quoted, contextInfo: { mentionedJid: [mentioned] } })
}
const hideTagStiker = async(from, buffer) => {
let anu = await client.groupMetadata(from)
let members = anu.participants
let ane = []
for (let i of members){
ane.push(i.jid)
}
client.sendMessage(from, buffer, sticker, { sendEphemeral: true, contextInfo: { mentionedJid: ane } })
}
const promoteAdmin = async function(to, target=[]){
if(!target.length > 0) { return reply("No target..") }
let g = await client.groupMetadata(to)
let owner = g.owner.replace("c.us","s.whatsapp.net")
let me = client.user.jid
for (i of target){
if (!i.includes(me) && !i.includes(owner)){
const res = await client.groupMakeAdmin(to, [i])
}else{
reply("NOT PREMITED")
}
}
}
const demoteAdmin = async function(to, target=[]){
if(!target.length > 0) { return reply("No target..") }
let g = await client.groupMetadata(to)
let owner = g.owner.replace("c.us","s.whatsapp.net")
let me = client.user.jid
for (i of target){
if (!i.includes(me) && !i.includes(owner)){
const res = await client.groupDemoteAdmin(to, [i])
}else{
reply("NOT PREMITED")
}
}
}
const kickMember = async(id, target = []) => {
let group = await client.groupMetadata(id)
let owner = group.owner.replace("c.us", "s.whatsapp.net")
let me = client.user.jid
for (i of target) {
if (!i.includes(me) && !i.includes(owner)) {
await client.groupRemove(to, [i])
} else {
await client.sendMessage(id, "Not Premited!", "conversation")
break
}
}
}
const kick = function(from, orangnya){
for (let i of orangnya){
client.groupRemove(from, [i])
}
}
const add = function(from, orangnya){
client.groupAdd(from, orangnya)
}
const sendKontak = (from, nomor, nama, org = "") => {
const vcard = 'BEGIN:VCARD\n' + 'VERSION:3.0\n' + 'FN:' + nama + '\n' + 'ORG:' + org + '\n' + 'TEL;type=CELL;type=VOICE;waid=' + nomor + ':+' + nomor + '\n' + 'END:VCARD'
client.sendMessage(from, {displayname: nama, vcard: vcard}, MessageType.contact, {quoted: mek})
}
const hideTagKontak = async(from, nomor, nama) => {
vcard = 'BEGIN:VCARD\n' + 'VERSION:3.0\n' + 'FN:' + nama + '\n' + 'ORG:Kontak\n' + 'TEL;type=CELL;type=VOICE;waid=' + nomor + ':+' + nomor + '\n' + 'END:VCARD'
let anu = await client.groupMetadata(from)
let members = anu.participants
let ane = []
for (let i of members){
ane.push(i.jid)
}
client.sendMessage(from, { displayname: nama, vcard: vcard }, contact, { contextInfo: { mentionedJid: ane } })
}
const sendFileFromStorage = (path, type, options) => {
client.sendMessage(from, fs.readFileSync(path), type, options).catch(e => {
reply('_[ ! ] Error Gagal Dalam Mengirim Media_')
console.log(e)
})
}
const getGroup = async function(totalchat){
let grup = []
let a = []
let b = []
for (c of totalchat){
a.push(c.jid)
}
for (d of a){
if (d && d.includes('g.us')){
b.push(d)
}
}
for (e of b){
let ingfo = await client.groupMetadata(e)
grup.push(ingfo)
}
return grup
}
const fakeReply = (teks, target, teks2) => {
client.sendMessage(from, teks, text, {quoted: {key: {fromMe: false, participant: `${target}@s.whatsapp.net`, ...(from ? { remoteJid: from } : {}) }, message: { conversation: teks2}}})
}
let authorname = client.contacts[from] != undefined ? client.contacts[from].vname || client.contacts[from].notify : undefined
if (authorname != undefined) { } else { authorname = groupName }
function addMetadata(packname, author) {
if (!packname) packname = 'self'; if (!author) author = 'client';author = author.replace(/[^a-zA-Z0-9]/g, '');
let name = `${author}_${packname}`
if (fs.existsSync(`./sticker/${name}.exif`)) return `./sticker/${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(`./sticker/${name}.exif`, buffer, (err) => {
return `./sticker/${name}.exif`
})
}
const sendStickerFromUrl = async(to, url) => {
console.log(color(time, 'magenta'), color(moment.tz('Asia/Jakarta').format('HH:mm:ss'), "gold"), color('Downloading sticker...'))
var names = getRandom('.webp')
var namea = getRandom('.png')
var download = function (uri, filename, callback) {
request.head(uri, function (err, res, body) {
request(uri).pipe(fs.createWriteStream(filename)).on('close', callback);
});
};
download(url, namea, async function () {
let filess = namea
let asw = names
require('./lib/exif.js')
exec(`ffmpeg -i ${filess} -vcodec libwebp -filter:v fps=fps=20 -lossless 1 -loop 0 -preset default -an -vsync 0 -s 512:512 ${asw}`, (err) => {
exec(`webpmux -set exif ./sticker/data.exif ${asw} -o ${asw}`, async (error) => {
let media = fs.readFileSync(asw)
client.sendMessage(to, media, sticker)
console.log(color(time, 'magenta'), color(moment.tz('Asia/Jakarta').format('HH:mm:ss'), "gold"), color('Succes send sticker...'))
fs.unlinkSync(asw)
fs.unlinkSync(filess)
});
});
});
}
const sendStickerUrl = async(to, url) => {
console.log(color(time, 'magenta'), color(moment.tz('Asia/Jakarta').format('HH:mm:ss'), "gold"), color('Downloading sticker...'))
var names = getRandom('.webp')
var namea = getRandom('.png')
var download = function (uri, filename, callback) {
request.head(uri, function (err, res, body) {
request(uri).pipe(fs.createWriteStream(filename)).on('close', callback);
});
};
}
const sendPTT = (res) => {
client.sendMessage(from, res, audio, {mimetype: 'audio/mp4', ptt: false, quoted:mek})
}
const sendMediaURL = async(to, url, text="", mids=[]) =>{
if(mids.length > 0){
text = normalizeMention(to, text, mids)
}
const fn = Date.now() / 10000;
const filename = fn.toString()
let mime = ""
var download = function (uri, filename, callback) {
request.head(uri, function (err, res, body) {
mime = res.headers['content-type']
request(uri).pipe(fs.createWriteStream(filename)).on('close', callback);
});
};
download(url, filename, async function () {
console.log('done');
let media = fs.readFileSync(filename)
let type = mime.split("/")[0]+"Message"
if(mime === "image/gif"){
type = MessageType.video
mime = Mimetype.gif
}
if(mime.split("/")[0] === "audio"){
mime = Mimetype.mp4Audio
}
client.sendMessage(to, media, type, { quoted: mek, mimetype: mime, caption: text,contextInfo: {"mentionedJid": mids}})
fs.unlinkSync(filename)
});
}
const sendFileFromUrl = async(link, type, options) => {
hasil = await getBuffer(link)
client.sendMessage(from, hasil, type, options).catch(e => {
fetch(link).then((hasil) => {
client.sendMessage(from, hasil, type, options).catch(e => {
client.sendMessage(from, { url : link }, type, options).catch(e => {
reply('_[ ! ] Error Gagal Dalam Mendownload Dan Mengirim Media_')
console.log(e)
})
})
})
})
}
const sendGif = (from, gif) => {
client.sendMessage(from, gif, MessageType.video, {mimetype: "video/gif"})
}
const belipremgame = (sender, asu) => {
var found = false;
Object.keys(glimit).forEach((i) => {
if(glimit[i].id == sender){
found = i
}
})
if (found !== false) {
glimit[found].glimit += asu;
fs.writeFileSync('./database/glimit.json',JSON.stringify(glimit))
}
}
const beliprem = (sender, asu) => {
let found = false
Object.keys(limit).forEach((i) => {
if (limit[i].id === sender) {
found = i
}
})
if (found !== false) {
limit[found].limit += asu
fs.writeFileSync('./database/limit.json', JSON.stringify(limit))
}
}
const cmde = budy.toLowerCase().split(" ")[0] || "";
let arrNum = ["1", "2", "3", "4", "5", "6", "7", "8", "9"];
if (fs.existsSync(`./database/game/tictactoe/db/${from}.json`)) {
const boardnow = setGame(`${from}`);
if (budy == "Cex") return reply("why");
if (
budy.toLowerCase() == "y" ||
budy.toLowerCase() == "yes" ||
budy.toLowerCase() == "ya"
) {
if (boardnow.O == sender.replace("@s.whatsapp.net", "")) {
if (boardnow.status)
return reply(`Game telah dimulai sebelumnya!`);
const matrix = boardnow._matrix;
boardnow.status = true;
fs.writeFileSync(`./database/game/tictactoe/db/${from}.json`,JSON.stringify(boardnow, null, 2)
);
const chatAccept = ` ๐ฎ *TICTACTOE* ๐ฎ
*GAME DI MULAI!*
Player โ : @${boardnow.X}
Player โญ : @${boardnow.O}
${matrix[0][0]} ${matrix[0][1]} ${matrix[0][2]}
${matrix[1][0]} ${matrix[1][1]} ${matrix[1][2]}
${matrix[2][0]} ${matrix[2][1]} ${matrix[2][2]}
*Giliran @${boardnow.turn == "X" ? boardnow.X : boardnow.O}*
*NOTE : KETIK NYERAH JIKA INGIN MENYERAH!*`;
hu = client.sendMessage(from, chatAccept, MessageType.text, {
quoted: mek,
contextInfo: {
mentionedJid: [
boardnow.X + "@s.whatsapp.net",
boardnow.O + "@s.whatsapp.net",
],
},
});
} else {
client.sendMessage(from,`Opsi ini hanya untuk @${boardnow.O} !`,
MessageType.text, {quoted: mek,
contextInfo: {
mentionedJid: [boardnow.O + "@s.whatsapp.net"],
},
}
);
}
} else if (
budy.toLowerCase() == "n" ||
budy.toLowerCase() == "t" ||
budy.toLowerCase() == "no" ||
budy.toLowerCase() == "tidak"
) {
if (boardnow.O == sender.replace("@s.whatsapp.net", "")) {
if (boardnow.status)
return reply(`Game telah dimulai sebelumnya!`);
fs.unlinkSync(`./database/game/tictactoe/db/${from}.json`);
client.sendMessage(from,`So Eazy men @${boardnow.X} Lawanmu Eazy`,
MessageType.text, {quoted: mek,
contextInfo: {
mentionedJid: [boardnow.X + "@s.whatsapp.net"],
},
}
);
} else {
client.sendMessage(from,`Opsi ini hanya untuk @${boardnow.O} !`,MessageType.text, {quoted: mek,
contextInfo: {
mentionedJid: [boardnow.O + "@s.whatsapp.net"],
},
}
);
}
}
}
if (arrNum.includes(cmde)) {
const boardnow = setGame(`${from}`);
if (!boardnow.status) return
if (
(boardnow.turn == "X" ? boardnow.X : boardnow.O) !=
sender.replace("@s.whatsapp.net", "")
)
return;
const moving = validmove(Number(budy), `${from}`);
const matrix = moving._matrix;
if (moving.isWin) {
if (moving.winner == "SERI") {
const chatEqual = `๐ฎ *TICTACTOE* ๐ฎ\n\nGame berakhir seri ๐`;
reply(chatEqual);
fs.unlinkSync(`./database/game/tictactoe/db/${from}.json`);
return;
}
const winnerJID = moving.winner == "O" ? moving.O : moving.X;
const looseJID = moving.winner == "O" ? moving.X : moving.O;
const limWin = Math.floor(Math.random() * 20) + 20;
const limLoose = Math.floor(Math.random() * 1) + 1;
const chatWon = `๐ฎ *TICTACTOE* ๐ฎ
Game Selesai!!
dimenangkan oleh ๐ @${winnerJID} ๐
Hadiah : $${limWin} Balance`;
addBalance(winnerJID + "@s.whatsapp.net", limWin, balance)
client.sendMessage(from, chatWon, MessageType.text, {quoted: mek,contextInfo: {
mentionedJid: [
moving.winner == "O" ?
moving.O + "@s.whatsapp.net" :
moving.X + "@s.whatsapp.net",
],
},
});
fs.unlinkSync(`./database/game/tictactoe/db/${from}.json`);
} else {
const chatMove = ` ๐ฎ *TICTACTOE* ๐ฎ
Player โ : @${boardnow.X}
Player โญ : @${boardnow.O}
${matrix[0][0]} ${matrix[0][1]} ${matrix[0][2]}
${matrix[1][0]} ${matrix[1][1]} ${matrix[1][2]}
${matrix[2][0]} ${matrix[2][1]} ${matrix[2][2]}
*Giliran : @${moving.turn == "X" ? moving.X : moving.O}*
`;
client.sendMessage(from, chatMove, MessageType.text, {quoted: mek,contextInfo: {