forked from ArifzynXD/Arifzyn-MD
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Arifzyn.js
3873 lines (3834 loc) · 127 KB
/
Arifzyn.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
/*
Created By ArxzyDev
My Contact wa.me/6289513081052
*/
const {
BufferJSON,
WA_DEFAULT_EPHEMERAL,
generateWAMessageFromContent,
proto,
generateWAMessageContent,
generateWAMessage,
prepareWAMessageMedia,
areJidsSameUser,
getContentType,
} = require("@whiskeysockets/baileys");
const os = require("os");
const fs = require("fs");
const fsx = require("fs-extra");
const path = require("path");
const util = require("util");
const chalk = require("chalk");
const moment = require("moment-timezone");
const speed = require("performance-now");
const ms = (toMs = require("ms"));
const axios = require("axios");
const fetch = require("node-fetch");
const { exec, spawn, execSync } = require("child_process");
const { performance } = require("perf_hooks");
const more = String.fromCharCode(8206);
const readmore = more.repeat(4001);
const {
TelegraPh,
UploadFileUgu,
webp2mp4File,
floNime,
} = require("./lib/uploader");
const {
toAudio,
toPTT,
toVideo,
ffmpeg,
addExifAvatar,
} = require("./lib/converter");
const {
smsg,
getGroupAdmins,
formatp,
tanggal,
jam,
formatDate,
getTime,
isUrl,
await,
sleep,
clockString,
msToDate,
sort,
toNumber,
enumGetKey,
runtime,
fetchJson,
getBuffer,
json,
delay,
format,
logic,
generateProfilePicture,
parseMention,
getRandom,
pickRandom,
reSize,
} = require("./lib/myfunc");
/* ~~~~~~~~~ FUNTION SYSTEM ~~~~~~~~~ */
let afk = require("./lib/afk");
const {
addPremiumUser,
getPremiumExpired,
getPremiumPosition,
expiredCheck,
checkPremiumUser,
getAllPremiumUser,
} = require("./lib/premiun");
/* ~~~~~~~~~ DATA GAME ~~~~~~~~~ */
let tebaklagu = [];
let kuismath = [];
let tebakgambar = [];
let tebakkata = [];
let tebakkalimat = [];
let tebaklirik = [];
let tebaktebakan = [];
let tebakbendera = [];
let tebakbendera2 = [];
let tebakkabupaten = [];
let tebakkimia = [];
let tebakasahotak = [];
let tebaksiapakahaku = [];
let tebaksusunkata = [];
let tebaktekateki = [];
let akinator = [];
/* ~~~~~~~~~ DATA ~~~~~~~~~ */
let premium = JSON.parse(fs.readFileSync("./src/data/premium.json"));
let _owner = JSON.parse(fs.readFileSync("./src/data/owner.json"));
let _user = JSON.parse(fs.readFileSync("./src/data/user.json"));
let _afk = JSON.parse(fs.readFileSync("./src/data/user/afk-user.json"));
let hit = JSON.parse(fs.readFileSync("./src/total-hit-user.json"));
let autosimi = JSON.parse(fs.readFileSync("./src/data/simi.json"));
/* ~~~~~~~~~ DATA MEDIA ~~~~~~~~~ */
const VnArxzy = JSON.parse(fs.readFileSync("./src/media/vn.json"));
const StickerArxzy = JSON.parse(fs.readFileSync("./src/media/sticker.json"));
const ImageArxzy = JSON.parse(fs.readFileSync("./src/media/image.json"));
const VideoArxzy = JSON.parse(fs.readFileSync("./src/media/video.json"));
/* ~~~~~~~~~ WAKTU SETEMPAT ~~~~~~~~~ */
moment.tz.setDefault("Asia/Jakarta").locale("id");
const hariini = moment.tz("Asia/Jakarta").format("dddd, DD MMMM YYYY");
const wib = moment.tz("Asia/Jakarta").format("HH:mm:ss");
const waktu = moment().tz("Asia/Jakarta").format("HH:mm:ss");
if (waktu < "23:59:00") {
var ucapanWaktu = "Selamat Malam 🏙️";
}
if (waktu < "19:00:00") {
var ucapanWaktu = "Selamat Petang 🌆";
}
if (waktu < "18:00:00") {
var ucapanWaktu = "Selamat Sore 🌇";
}
if (waktu < "15:00:00") {
var ucapanWaktu = "Selamat Siang 🌤️";
}
if (waktu < "10:00:00") {
var ucapanWaktu = "Selamat Pagi 🌄";
}
if (waktu < "05:00:00") {
var ucapanWaktu = "Selamat Subuh 🌆";
}
if (waktu < "03:00:00") {
var ucapanWaktu = "Selamat Tengah Malam 🌃";
}
/* ~~~~~~~~~ STARTING & MODULE ALL ~~~~~~~~~ */
module.exports = conn = async (conn, m, msg, chatUpdate, store) => {
try {
/* ~~~~~~~~~ BASE ARXZYDEV ~~~~~~~~~ */
const { type, quotedMsg, mentioned, now, fromMe } = m;
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.singleSelectm.reply.selectedRowId
: m.mtype == "templateButtonm.replyMessage"
? m.message.templateButtonm.replyMessage.selectedId
: m.mtype === "messageContextInfo"
? m.message.buttonsResponseMessage?.selectedButtonId ||
m.message.listResponseMessage?.singleSelectm.reply.selectedRowId ||
m.text
: "";
var budy = typeof m.text == "string" ? m.text : "";
var prefix = [".", "/"]
? /^[°•π÷׶∆£¢€¥®™+✓_=|~!?@#$%^&.©^]/gi.test(body)
? body.match(/^[°•π÷׶∆£¢€¥®™+✓_=|~!?@#$%^&.©^]/gi)[0]
: ""
: prefa;
const isCmd = body.startsWith(prefix, "");
const command = body
.replace(prefix, "")
.trim()
.split(/ +/)
.shift()
.toLowerCase();
const args = body.trim().split(/ +/).slice(1);
const full_args = body.replace(command, "").slice(1).trim();
const pushname = m.pushName || "No Name";
const botNumber = await conn.decodeJid(conn.user.id);
const itsMe = m.sender == botNumber ? true : false;
const sender = m.sender;
const text = (q = args.join(" "));
const from = m.key.remoteJid;
const fatkuns = m.quoted || m;
const quoted =
fatkuns.mtype == "buttonsMessage"
? fatkuns[Object.keys(fatkuns)[1]]
: fatkuns.mtype == "templateMessage"
? fatkuns.hydratedTemplate[Object.keys(fatkuns.hydratedTemplate)[1]]
: fatkuns.mtype == "product"
? fatkuns[Object.keys(fatkuns)[0]]
: m.quoted
? m.quoted
: m;
const mime = (quoted.msg || quoted).mimetype || "";
const qmsg = quoted.msg || quoted;
const isSimi = autosimi.includes(from);
/* ~~~~~~~~~ MEDIA ALL ~~~~~~~~~ */
const isMedia = /image|video|sticker|audio/.test(mime);
const isImage = type == "imageMessage";
const isVideo = type == "videoMessage";
const isAudio = type == "audioMessage";
const isText = type == "textMessage";
const isSticker = type == "stickerMessage";
const isQuotedText =
type === "extendexTextMessage" && content.includes("textMessage");
const isQuotedImage =
type === "extendedTextMessage" && content.includes("imageMessage");
const isQuotedLocation =
type === "extendedTextMessage" && content.includes("locationMessage");
const isQuotedVideo =
type === "extendedTextMessage" && content.includes("videoMessage");
const isQuotedSticker =
type === "extendedTextMessage" && content.includes("stickerMessage");
const isQuotedAudio =
type === "extendedTextMessage" && content.includes("audioMessage");
const isQuotedContact =
type === "extendedTextMessage" && content.includes("contactMessage");
const isQuotedDocument =
type === "extendedTextMessage" && content.includes("documentMessage");
/* ~~~~~~~~~ PREFIX V2 ~~~~~~~~~ */
const pric = /^#.¦|\\^/.test(body) ? body.match(/^#.¦|\\^/gi) : ".";
const isAsu = body.startsWith(pric);
const isCommand = isAsu
? body.replace(pric, "").trim().split(/ +/).shift().toLowerCase()
: "";
const sticker = [];
const isAfkOn = afk.checkAfkUser(m.sender, _afk);
const isAdrian = "[email protected]".includes(m.sender);
/* ~~~~~~~~~ GROUP SYSTEM ~~~~~~~~~ */
const isGroup = m.key.remoteJid.endsWith("@g.us");
const groupMetadata = m.isGroup
? await conn.groupMetadata(m.chat).catch((e) => {})
: "";
const groupName = m.isGroup ? groupMetadata.subject : "";
const participants = m.isGroup ? await groupMetadata.participants : "";
const groupAdmins = m.isGroup ? await getGroupAdmins(participants) : "";
const isBotAdmins = m.isGroup ? groupAdmins.includes(botNumber) : false;
const isAdmins = m.isGroup ? groupAdmins.includes(m.sender) : false;
const groupOwner = m.isGroup ? groupMetadata.owner : "";
const isGroupOwner = m.isGroup
? (groupOwner ? groupOwner : groupAdmins).includes(m.sender)
: false;
/* ~~~~~~~~~ STATUS USERS ~~~~~~~~~ */
const isCreator = [numberowner, ..._owner]
.map((v) => v.replace(/[^0-9]/g, "") + "@s.whatsapp.net")
.includes(m.sender);
const isPremium =
isCreator || isCreator || checkPremiumUser(m.sender, premium);
const isUser = _user.includes(m.sender);
expiredCheck(conn, m, premium);
/* ~~~~~~~~~ ALL SYSTEM BOT ~~~~~~~~~ */
if (!conn.public) {
if (isCreator && !m.key.fromMe) return;
}
if (autoread) {
conn.readMessages([m.key]);
}
if (autobio) {
conn.updateProfileStatus(`-`).catch((_) => _);
}
if (chatUpdate["messages.upsert"]) {
const upsert = chatUpdate["messages.upsert"];
for (let msg of upsert.messages) {
if (
msg.key.remoteJid == "status@broadcast" &&
!msg.key.fromMe &&
!msg.message?.protocolMessage
) {
console.log(
`Lihat status ${msg.pushName} ${
msg.key.participant.split("@")[0]
}\n`,
);
conn.readMessages([msg.key]);
}
}
}
if (isCommand) {
let titida = ["composing", "recording"];
yte = titida[Math.floor(titida.length * Math.random())];
conn.sendPresenceUpdate(yte, from);
}
if (m.sender.startsWith("212") && global.autoblok212 === true) {
return conn.updateBlockStatus(m.sender, "block");
}
if (!m.sender.startsWith("62") && global.onlyindo === true) {
return conn.updateBlockStatus(m.sender, "block");
}
let list = [];
for (let i of owner) {
list.push({
displayName: conn.getName(i + "@s.whatsapp.net"),
vcard: `BEGIN:VCARD\n
VERSION:3.0\n
N:${conn.getName(i + "@s.whatsapp.net")}\n
FN:${conn.getName(i + "@s.whatsapp.net")}\n
item1.TEL;waid=${i}:${i}\n
item1.X-ABLabel:Ponsel\n
item2.EMAIL;type=INTERNET:[email protected]\n
item2.X-ABLabel:Email\n
item3.URL:https://profile.conndev.xyz\n
item3.X-ABLabel:Profile Website\n
item4.ADR:;;Indonesia;;;;\n
item4.X-ABLabel:Region\n
END:VCARD`,
});
}
if (isCmd && !isUser) {
_user.push(sender);
fs.writeFileSync("./src/data/user.json", JSON.stringify(_user, null, 2));
}
/* ~~~~~~~~~ CONSOLE ~~~~~~~~~ */
if (isCommand) {
console.log(`<================>`);
console.log(
chalk.black(
chalk.bgWhite(!isCommand ? "<> MESSAGE </>" : "<> COMMAND </>"),
),
chalk.black(chalk.bgGreen(hariini)),
chalk.black(chalk.bgBlue(budy || m.mtype)) +
"\n" +
chalk.magenta("=> From"),
chalk.green(pushname),
chalk.yellow(m.sender) + "\n" + chalk.blueBright("=> In"),
chalk.green(m.isGroup ? pushname : "Private Chat", m.chat),
);
console.log(`<================>`);
const cmdadd = () => {
hit[0].hit_cmd += 1;
fs.writeFileSync("./src/total-hit-user.json", JSON.stringify(hit));
};
cmdadd();
const totalhit = JSON.parse(
fs.readFileSync("./src/total-hit-user.json"),
)[0].hit_cmd;
}
/* ~~~~~~~~~ RESPON DATA MEDIA ~~~~~~~~~ */
for (let Mwuhehe of VnArxzy) {
if (budy === Mwuhehe) {
let audiobuffy = fs.readFileSync(`./media/audio/${Mwuhehe}.mp3`);
conn.sendMessage(
m.chat,
{
audio: audiobuffy,
mimetype: "audio/mp4",
ptt: true,
},
{
quoted: m,
},
);
}
}
for (let Mwuhehe of StickerArxzy) {
if (budy === Mwuhehe) {
let stickerbuffy = fs.readFileSync(`./media/sticker/${Mwuhehe}.webp`);
conn.sendMessage(
m.chat,
{
sticker: stickerbuffy,
},
{
quoted: m,
},
);
}
}
for (let Mwuhehe of ImageArxzy) {
if (budy === Mwuhehe) {
let imagebuffy = fs.readFileSync(`./media/image/${Mwuhehe}.jpg`);
conn.sendMessage(
m.chat,
{
image: imagebuffy,
},
{
quoted: m,
},
);
}
}
for (let Mwuhehe of VideoArxzy) {
if (budy === Mwuhehe) {
let videobuffy = fs.readFileSync(`./media/video/${Mwuhehe}.mp4`);
conn.sendMessage(
m.chat,
{
video: videobuffy,
},
{
quoted: m,
},
);
}
}
/* ~~~~~~~~~ RESPON CMD GAME~~~~~~~~~ */
if (
akinator.hasOwnProperty(m.sender.split("@")[0]) &&
isCmd &&
["0", "1", "2", "3", "4", "5"].includes(body)
) {
kuis = true;
var { server, frontaddr, session, signature, question, step } =
akinator[m.sender.split("@")[0]];
if (step == "0" && budy == "5")
m.reply("Maaf Anda telah mencapai pertanyaan pertama");
var ini_url = `https://api.lolhuman.xyz/api/akinator/answer?apikey=${lol}&server=${server}&frontaddr=${frontaddr}&session=${session}&signature=${signature}&answer=${budy}&step=${step}`;
var get_result = await fetchJson(ini_url);
var get_result = get_result.result;
if (get_result.hasOwnProperty("name")) {
var ini_name = get_result.name;
var description = get_result.description;
ini_txt = `${ini_name} - ${description}\n\n`;
ini_txt += "*Terima Kasih*\n*Powered By ArxzyDev & LoL Human*";
await conn
.sendMessage(m.chat, {
image: {
url: get_result.image,
},
caption: ini_txt,
})
.then(() => {
delete akinator[m.sender.split("@")[0]];
fs.writeFileSync(
"./src/data/akinator.json",
JSON.stringify(akinator),
);
});
return;
}
var { question, _, step } = get_result;
ini_txt = `${question}\n\n`;
ini_txt += "0 - Ya\n";
ini_txt += "1 - Tidak\n";
ini_txt += "2 - Saya Tidak Tau\n";
ini_txt += "3 - Mungkin\n";
ini_txt += "4 - Mungkin Tidak\n";
ini_txt += "5 - Kembali ke Pertanyaan Sebelumnya";
if (args[0] === "5") {
var ini_url = `https://api.lolhuman.xyz/api/akinator/back?apikey=${lol}&server=${server}&frontaddr=${frontaddr}&session=${session}&signature=${signature}&answer=${budy}&step=${step}`;
var get_result = await fetchJson(ini_url);
var get_result = get_result.result;
var { question, _, step } = get_result;
ini_txt = `${question}\n\n`;
ini_txt += "0 - Ya\n";
ini_txt += "1 - Tidak\n";
ini_txt += "2 - Saya Tidak Tau\n";
ini_txt += "3 - Mungkin\n";
ini_txt += "4 - Mungkin Tidak";
ini_txt += "5 - Kembali ke Pertanyaan Sebelumnya";
}
conn.sendText(m.chat, ini_txt, m).then(() => {
const data_ = akinator[m.sender.split("@")[0]];
data_["question"] = question;
data_["step"] = step;
akinator[m.sender.split("@")[0]] = data_;
fs.writeFileSync("./src/data/akinator.json", JSON.stringify(akinator));
});
}
if (tebakgambar.hasOwnProperty(m.sender.split("@")[0]) && isCmd) {
kuis = true;
jawaban = tebakgambar[m.sender.split("@")[0]];
if (budy.toLowerCase() == "nyerah") {
await m.reply("*Anda Telah menyerah*");
delete tebakgambar[m.sender.split("@")[0]];
} else if (budy.toLowerCase() == jawaban) {
await conn.sendText(
m.chat,
`🎮 Tebak Gambar 🎮\n\nJawaban Benar 🎉`,
m,
);
delete tebakgambar[m.sender.split("@")[0]];
} else m.reply("*Jawaban Salah!*");
}
if (kuismath.hasOwnProperty(m.sender.split("@")[0]) && isCmd) {
kuis = true;
jawaban = kuismath[m.sender.split("@")[0]];
if (budy.toLowerCase() == "nyerah") {
await m.reply("*Anda Telah menyerah*");
delete kuismath[m.sender.split("@")[0]];
} else if (budy.toLowerCase() == jawaban) {
await m.reply(
`🎮 Kuis Matematika 🎮\n\nJawaban Benar 🎉\n\nIngin bermain lagi? kirim ${prefix}math mode`,
);
delete kuismath[m.sender.split("@")[0]];
} else m.reply("*Jawaban Salah!*");
}
if (tebakasahotak.hasOwnProperty(m.sender.split("@")[0]) && isCmd) {
kuis = true;
jawaban = tebakasahotak[m.sender.split("@")[0]];
if (budy.toLowerCase() == "nyerah") {
await m.reply("*Anda Telah menyerah*");
delete tebakasahotak[m.sender.split("@")[0]];
} else if (budy.toLowerCase() == jawaban) {
await conn.sendText(m.chat, `🎮 Asah Otak 🎮\n\nJawaban Benar 🎉`, m);
delete tebakasahotak[m.sender.split("@")[0]];
} else m.reply("*Jawaban Salah!*");
}
if (tebaksiapakahaku.hasOwnProperty(m.sender.split("@")[0]) && isCmd) {
kuis = true;
jawaban = tebaksiapakahaku[m.sender.split("@")[0]];
if (budy.toLowerCase() == "nyerah") {
await m.reply("*Anda Telah menyerah*");
delete tebaksiapakahaku[m.sender.split("@")[0]];
} else if (budy.toLowerCase() == jawaban) {
await conn.sendText(
m.chat,
`🎮 Siapakah Aku 🎮\n\nJawaban Benar 🎉`,
m,
);
delete tebaksiapakahaku[m.sender.split("@")[0]];
} else m.reply("*Jawaban Salah!*");
}
if (tebaksusunkata.hasOwnProperty(m.sender.split("@")[0]) && isCmd) {
kuis = true;
jawaban = tebaksusunkata[m.sender.split("@")[0]];
if (budy.toLowerCase() == "nyerah") {
await m.reply("*Anda Telah menyerah*");
delete tebaksusunkata[m.sender.split("@")[0]];
} else if (budy.toLowerCase() == jawaban) {
await conn.sendText(m.chat, `🎮 Susun Kata 🎮\n\nJawaban Benar 🎉`, m);
delete tebaksusunkata[m.sender.split("@")[0]];
} else m.reply("*Jawaban Salah!*");
}
if (tebakbendera.hasOwnProperty(m.sender.split("@")[0]) && isCmd) {
kuis = true;
jawaban = tebakbendera[m.sender.split("@")[0]];
if (budy.toLowerCase() == "nyerah") {
await m.reply("*Anda Telah menyerah*");
delete tebakbendera[m.sender.split("@")[0]];
} else if (budy.toLowerCase() == jawaban) {
await conn.sendText(
m.chat,
`🎮 Tebak Gambar 🎮\n\nJawaban Benar 🎉`,
m,
);
delete tebakbendera[m.sender.split("@")[0]];
} else m.reply("*Jawaban Salah!*");
}
if (tebakbendera2.hasOwnProperty(m.sender.split("@")[0]) && isCmd) {
kuis = true;
jawaban = tebakbendera2[m.sender.split("@")[0]];
if (budy.toLowerCase() == "nyerah") {
await m.reply("*Anda Telah menyerah*");
delete tebakbendera2[m.sender.split("@")[0]];
} else if (budy.toLowerCase() == jawaban) {
await conn.sendText(
m.chat,
`🎮 Tebak Bendera 🎮\n\nJawaban Benar 🎉`,
m,
);
delete tebakbendera2[m.sender.split("@")[0]];
} else m.reply("*Jawaban Salah!*");
}
if (tebakkabupaten.hasOwnProperty(m.sender.split("@")[0]) && isCmd) {
kuis = true;
jawaban = tebakkabupaten[m.sender.split("@")[0]];
if (budy.toLowerCase() == "nyerah") {
await m.reply("*Anda Telah menyerah*");
delete tebakkabupaten[m.sender.split("@")[0]];
} else if (budy.toLowerCase() == jawaban) {
await conn.sendText(
m.chat,
`🎮 Tebak Kabupaten 🎮\n\nJawaban Benar 🎉`,
m,
);
delete tebakkabupaten[m.sender.split("@")[0]];
} else m.reply("*Jawaban Salah!*");
}
if (tebakkimia.hasOwnProperty(m.sender.split("@")[0]) && isCmd) {
kuis = true;
jawaban = tebakkimia[m.sender.split("@")[0]];
if (budy.toLowerCase() == "nyerah") {
await m.reply("*Anda Telah menyerah*");
delete tebakkimia[m.sender.split("@")[0]];
} else if (budy.toLowerCase() == jawaban) {
await conn.sendText(m.chat, `🎮 Tebak Kimia 🎮\n\nJawaban Benar 🎉`, m);
delete tebakkimia[m.sender.split("@")[0]];
} else m.reply("*Jawaban Salah!*");
}
if (tebaktekateki.hasOwnProperty(m.sender.split("@")[0]) && isCmd) {
kuis = true;
jawaban = tebaktekateki[m.sender.split("@")[0]];
if (budy.toLowerCase() == "nyerah") {
await m.reply("*Anda Telah menyerah*");
delete tebaktekateki[m.sender.split("@")[0]];
} else if (budy.toLowerCase() == jawaban) {
await conn.sendText(m.chat, `🎮 Teka Teki 🎮\n\nJawaban Benar 🎉`, m);
delete tebaktekateki[m.sender.split("@")[0]];
} else m.reply("*Jawaban Salah!*");
}
if (tebaklagu.hasOwnProperty(m.sender.split("@")[0]) && isCmd) {
kuis = true;
jawaban = tebaklagu[m.sender.split("@")[0]];
if (budy.toLowerCase() == "nyerah") {
await m.reply("*Anda Telah menyerah*");
delete tebaklagu[m.sender.split("@")[0]];
} else if (budy.toLowerCase() == jawaban) {
await conn.sendText(m.chat, `🎮 Tebak Lagu 🎮\n\nJawaban Benar 🎉`, m);
delete tebaklagu[m.sender.split("@")[0]];
} else m.reply("*Jawaban Salah!*");
}
if (tebakkata.hasOwnProperty(m.sender.split("@")[0]) && isCmd) {
kuis = true;
jawaban = tebakkata[m.sender.split("@")[0]];
if (budy.toLowerCase() == "nyerah") {
await m.reply("*Anda Telah menyerah*");
delete tebakkata[m.sender.split("@")[0]];
} else if (budy.toLowerCase() == jawaban) {
await conn.sendText(m.chat, `🎮 Tebak Kata 🎮\n\nJawaban Benar 🎉`, m);
delete tebakkata[m.sender.split("@")[0]];
} else m.reply("*Jawaban Salah!*");
}
if (tebakkalimat.hasOwnProperty(m.sender.split("@")[0]) && isCmd) {
kuis = true;
jawaban = tebakkalimat[m.sender.split("@")[0]];
if (budy.toLowerCase() == "nyerah") {
await m.reply("*Anda Telah menyerah*");
delete tebakkalimat[m.sender.split("@")[0]];
} else if (budy.toLowerCase() == jawaban) {
await conn.sendText(
m.chat,
`🎮 Tebak Kalimat 🎮\n\nJawaban Benar 🎉`,
m,
);
delete tebakkalimat[m.sender.split("@")[0]];
} else m.reply("*Jawaban Salah!*");
}
if (tebaklirik.hasOwnProperty(m.sender.split("@")[0]) && isCmd) {
kuis = true;
jawaban = tebaklirik[m.sender.split("@")[0]];
if (budy.toLowerCase() == "nyerah") {
await m.reply("*Anda Telah menyerah*");
delete tebaklirik[m.sender.split("@")[0]];
} else if (budy.toLowerCase() == jawaban) {
await conn.sendText(m.chat, `🎮 Tebak Lirik 🎮\n\nJawaban Benar 🎉`, m);
delete tebaklirik[m.sender.split("@")[0]];
} else m.reply("*Jawaban Salah!*");
}
if (tebaktebakan.hasOwnProperty(m.sender.split("@")[0]) && isCmd) {
kuis = true;
jawaban = tebaktebakan[m.sender.split("@")[0]];
if (budy.toLowerCase() == "nyerah") {
await m.reply("*Anda Telah menyerah*");
delete tebaktebakan[m.sender.split("@")[0]];
} else if (budy.toLowerCase() == jawaban) {
await conn.sendText(
m.chat,
`🎮 Tebak Tebakan 🎮\n\nJawaban Benar 🎉`,
m,
);
delete tebaktebakan[m.sender.split("@")[0]];
} else m.reply("*Jawaban Salah!*");
}
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 telah berakhir",
"-2": "Invalid",
"-1": "Posisi Invalid",
0: "Posisi Invalid",
}[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]} Menang!`
: isTie
? `Game berakhir`
: `Giliran ${["", ""][1 * room.game._currentTurn]} (@${
room.game.currentTurn.split("@")[0]
})`
}
: @${room.game.playerX.split("@")[0]}
: @${room.game.playerO.split("@")[0]}
Ketik *nyerah* untuk menyerah dan mengakui kekalahan`;
if ((room.game._currentTurn ^ isSurrender ? room.x : room.o) !== m.chat)
room[room.game._currentTurn ^ isSurrender ? "x" : "o"] = m.chat;
if (room.x !== room.o)
conn.sendText(room.x, str, m, {
mentions: parseMention(str),
});
conn.sendText(room.o, str, m, {
mentions: parseMention(str),
});
if (isTie || isWin) {
delete this.game[room.id];
}
}
/* ~~~~~~~~~ RESPON USER AFK ~~~~~~~~~ */
if (m.isGroup && !m.key.fromMe) {
let mentionUser = [
...new Set([
...(m.mentionedJid || []),
...(m.quoted ? [m.quoted.sender] : []),
]),
];
for (let ment of mentionUser) {
if (afk.checkAfkUser(ment, _afk)) {
let getId2 = afk.getAfkId(ment, _afk);
let getReason2 = afk.getAfkReason(getId2, _afk);
let getTimee = Date.now() - afk.getAfkTime(getId2, _afk);
let heheh2 = ms(getTimee);
m.reply(`Jangan tag, dia sedang afk\n\n*Reason :* ${getReason2}`);
}
}
if (afk.checkAfkUser(m.sender, _afk)) {
let getId = afk.getAfkId(m.sender, _afk);
let getReason = afk.getAfkReason(getId, _afk);
let getTime = Date.now() - afk.getAfkTime(getId, _afk);
let heheh = ms(getTime);
_afk.splice(afk.getAfkPosition(m.sender, _afk), 1);
fs.writeFileSync("./src/data/user/afk-user.json", JSON.stringify(_afk));
conn.sendTextWithMentions(
m.chat,
`@${m.sender.split("@")[0]} telah kembali dari afk`,
m,
);
}
}
switch (isCommand) {
case "status":
{
if (!isCreator) return m.reply(mess.owner);
if (args.length < 1) return m.reply("perilah apa?");
if (q === "image") {
let imgSw = await conn.downloadAndSaveMediaMessage(quoted);
await conn.sendMessage(
"status@broadcast",
{ image: { url: imgSw }, caption: q },
{ statusJidList: _user },
);
m.reply(mess.done);
} else if (/video/.test(mime)) {
let VidSw = await conn.downloadAndSaveMediaMessage(quoted);
await conn.sendMessage(
"status@broadcast",
{ video: { url: VidSw }, caption: q },
{ statusJidList: _user },
);
m.reply(mess.done);
} else if (/audio/.test(mime)) {
let VnSw = await conn.downloadAndSaveMediaMessage(quoted);
await conn.sendMessage(
"status@broadcast",
{ audio: { url: VnSw }, mimetype: "audio/mp4", ptt: true },
{ backgroundColor: "#FF000000", statusJidList: _user },
);
m.reply(mess.done);
} else if (q) {
conn.sendMessage(
"status@broadcast",
{ text: q },
{ backgroundColor: "#FF000000", font: 3, statusJidList: _user },
);
} else {
m.reply(
"Replay Media Jika Mau Dengan Caption Ketik .status caption",
);
}
}
break;
case "autosimi":
if (!isCreator) return m.reply(mess.owne);
if (args.length < 1) return m.reply("perilah apa?");
if (q == "on") {
autosimi.push(from);
fs.writeFileSync("./src/data/simi.json", JSON.stringify(autosimi));
m.reply("Sukses mengaktifkan mode simi");
} else if (q == "off") {
autosimi.splice(from, 1);
fs.writeFileSync("./src/data/simi.json", JSON.stringify(autosimi));
m.reply("Sukes menonaktifkan mode simi");
} else {
m.reply("Agak Laen");
}
break;
case "setimgqouted":
case "siq":
{
if (!isCreator) return m.reply(mess.owner);
let delb = await conn.downloadAndSaveMediaMessage(quoted);
await fsx.copy(delb, "./media/quoted.jpg");
fs.unlinkSync(delb);
m.reply(mess.done);
}
break;
case "setimgmenu":
case "sim":
{
if (!isCreator) return m.reply(mess.owner);
let delb = await conn.downloadAndSaveMediaMessage(quoted);
await fsx.copy(delb, "./media/menu.jpg");
fs.unlinkSync(delb);
m.reply(mess.done);
}
break;
case "setvidmenu":
case "svm":
{
if (!isCreator) return m.reply(mess.owner);
let delb = await conn.downloadAndSaveMediaMessage(quoted);
await fsx.copy(delb, "./media/menu.mp4");
fs.unlinkSync(delb);
m.reply(mess.done);
}
break;
case "addprem":
if (!isCreator) return m.reply(mess.owner);
if (args.length < 2)
return m.reply(
`Penggunaan :\n*#addprem* @tag waktu\n*#addprem* nomor waktu\n\nContoh : #addprem @tag 30d`,
);
if (m.mentionedJid.length !== 0) {
for (let i = 0; i < m.mentionedJid.length; i++) {
addPremiumUser(m.mentionedJid[0], args[1], premium);
}
m.reply("Sukses Premium");
} else {
addPremiumUser(args[0] + "@s.whatsapp.net", args[1], premium);
m.reply("Sukses Via Nomer");
}
break;
case "delprem":
if (!isCreator) return m.reply(mess.owner);
if (args.length < 1)
return m.reply(`Penggunaan :\n*#delprem* @tag\n*#delprem* nomor`);
if (m.mentionedJid.length !== 0) {
for (let i = 0; i < m.mentionedJid.length; i++) {
premium.splice(getPremiumPosition(m.mentionedJid[i], premium), 1);
fs.writeFileSync(
"./src/data/premium.json",
JSON.stringify(premium),
);
}
m.reply("Sukses Delete");
} else {
premium.splice(
getPremiumPosition(args[0] + "@s.whatsapp.net", premium),
1,
);
fs.writeFileSync("./src/data/premium.json", JSON.stringify(premium));
m.reply("Sukses Via Nomer");
}
break;
case "listprem":
{
if (!isCreator) return m.reply(mess.owner);
let data = require("./src/data/premium.json");
let txt = `*------「 LIST PREMIUM 」------*\n\n`;
for (let i of data) {
txt += `Nomer : ${i.id}\n`;
txt += `Expired : ${i.expired} Second\n`;
}
conn.sendMessage(
m.chat,
{
text: txt,
mentions: i,
},
{
quoted: m,
},
);
}
break;
case "delsesi":
case "clearsession":
{
if (!isCreator) return m.reply(mess.owner);
fs.readdir("./session", async function (err, files) {
if (err) {
console.log("Unable to scan directory: " + err);
return m.reply("Unable to scan directory: " + err);
}
let filteredArray = await files.filter(
(item) =>
item.startsWith("pre-key") ||
item.startsWith("sender-key") ||
item.startsWith("session-") ||
item.startsWith("app-state"),
);
console.log(filteredArray.length);
let teks = `Terdeteksi ${filteredArray.length} file sampah\n\n`;
if (filteredArray.length == 0) return m.reply(teks);
filteredArray.map(function (e, i) {
teks += i + 1 + `. ${e}\n`;
});
m.reply(teks);
await sleep(2000);
m.reply("Menghapus file sampah...");
await filteredArray.forEach(function (file) {
fs.unlinkSync(`./session/${file}`);
});
await sleep(2000);
m.reply("Berhasil menghapus semua sampah di folder session");
});
}
break;
case "join":
try {
if (!isCreator) return m.reply(mess.owner);
if (!text) return m.reply("Masukkan Link Group!");
if (!isUrl(args[0]) && !args[0].includes("whatsapp.com"))
return m.reply("Link Invalid!");
m.reply(mess.wait);
let result = args[0].split("https://chat.whatsapp.com/")[1];
await conn
.groupAcceptInvite(result)
.then((res) => m.reply(json(res)))
.catch((err) => m.reply(json(err)));
} catch {
m.reply("Gagal Masuk Ke Group");
}
break;
case "cekapikey":
if (!isCreator) return m.reply(mess.owner);
let g = await fetchJson(
`https://api.lolhuman.xyz/api/checkapikey?apikey=${lol}`,
);
m.reply(q.result);
break;
case "ambilsesi":
case "getsesi":
if (!isCreator) return m.reply(mess.owner);
m.reply("Tunggu Sebentar, Sedang mengambil file sesi mu");
let sesi = fs.readFileSync("./src/total-hit-user.json");
conn.sendMessage(
m.chat,
{
document: sesi,
mimetype: "application/json",
fileName: "total-hit-user.json",
},
{
quoted: m,
},
);