forked from CYBER-x-SACHIYA-SL-MD-BOT/CYBER-PANDA-MD.V.0.4
-
Notifications
You must be signed in to change notification settings - Fork 206
/
Core.js
7228 lines (6039 loc) · 289 KB
/
Core.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
process.on("uncaughtException", console.error);
require("./config");
const fs = require('fs');
const pm2 = require('pm2');
const util = require("util");
const { promisify } = require('util');
const setTimeoutPromise = promisify(setTimeout);
const chalk = require("chalk");
const axios = require('axios');
const { spawn, exec, execSync } = require("child_process");
const moment = require("moment-timezone");
const { EmojiAPI } = require("emoji-api");
const { addBalance } = require("./lib/limit.js");
const { smsg, formatp, tanggal, GIFBufferToVideoBuffer, formatDate, getTime, isUrl, sleep, clockString, runtime, fetchJson, getBuffer, jsonformat, format, parseMention, getRandom, fetchBuffer } = require('./lib/myfunc')
const _ = require("lodash");
const yargs = require("yargs/yargs");
const kaitime = moment.tz('Asia/Kolkata').format('HH:mm:ss');
const kaidate = moment.tz('Asia/Kolkata').format('DD/MM/YYYY');
const time2 = moment().tz('Asia/Kolkata').format('HH:mm:ss');
const currentDate = new Date();
const options = { weekday: 'long' }; // Specify 'long' to get the full day name
const currentDay = new Intl.DateTimeFormat('en-US', options).format(currentDate);
const speed = require('performance-now');
const eco = require('discord-mongoose-economy');
// const thiccysapi = require('textmaker-thiccy');
// const ffmpeg = require('fluent-ffmpeg');
// const ffmpegPath = require('ffmpeg-static').path;
// ffmpeg.setFfmpegPath(ffmpegPath);
const Jimp = require('jimp'); // for full dp etc.
const modapk = require("tod-api");
const { hentai } = require('./lib/scraper2.js');
const { instadl } = require('./lib/instadl');
const ty = eco.connect('mongodb+srv://Arch:[email protected]/?retryWrites=true&w=majority');
const { isLimit, limitAdd, getLimit, giveLimit, kurangBalance, getBalance, isGame, gameAdd, givegame, cekGLimit } = require('./lib/limit.js');
const githubstalk = require('./lib/githubstalk');
let { covid } = require('./lib/covid.js');
const { Gempa } = require("./lib/gempa.js");
const spaceemojis = ["🌌", "🌠", "🚀", "🪐", "🌟"]; // list of emojis for Space CMDs.
const manyemojis = ["😄", "👍", "👏", "👌", "🥇", "🌟", "🎉", "🙌", "🤩", "💯", "🔥", "✨", "🚀", "💖", "🌈", "🌞", "🌠", "🌼", "💪", "😎", "💫", "💓", "🎈", "🎁", "🍾", "🎊", "🥳", "👑", "🌺", "🌻", "🌸"];
const os = require('os'); // for os info
const gis = require("g-i-s");
const { MessageType } = require('@whiskeysockets/baileys');
//"parse-ms": "^1.1.0",
//
let nowtime = '';
if (time2 < "05:00:00") {
nowtime = '𝘎𝘖𝘖𝘋 𝘕𝘐𝘎𝘏𝘛 🦋💞';
} else if (time2 < "11:00:00") {
nowtime = '𝘎𝘖𝘖𝘋 𝘔𝘖𝘙𝘕𝘐𝘕𝘎 💞🦋';
} else if (time2 < "15:00:00") {
nowtime = '𝘎𝘖𝘖𝘋 𝘈𝘍𝘛𝘌𝘙𝘕𝘖𝘖𝘕 💞🦋';
} else if (time2 < "18:00:00") {
nowtime = '𝘎𝘖𝘖𝘋 𝘌𝘝𝘌𝘕𝘐𝘕𝘎 💞🦋';
} else if (time2 < "19:00:00") {
nowtime = '𝘎𝘖𝘖𝘋 𝘌𝘝𝘌𝘕𝘐𝘕𝘎 💞🦋';
} else {
nowtime = '𝘎𝘖𝘖𝘋 𝘕𝘐𝘎𝘏𝘛 💞🦋';
}
//
const timestampe = speed();
const latensie = speed() - timestampe
var low;
try {
low = require("lowdb");
} catch (e) {
low = require("./lib/lowdb");
}
const { Low, JSONFile } = low;
const mongoDB = require("./lib/mongoDB");
global.opts = new Object(
yargs(process.argv.slice(2)).exitProcess(false).parse()
);
global.db = new Low(
/https?:\/\//.test(opts["db"] || "")
? new cloudDBAdapter(opts["db"])
: /mongodb/.test(opts["db"])
? new mongoDB(opts["db"])
: new JSONFile(`src/database.json`)
);
global.DATABASE = global.db; // Backwards Compatibility
global.loadDatabase = async function loadDatabase() {
if (global.db.READ)
return new Promise((resolve) =>
setInterval(function () {
!global.db.READ
? (clearInterval(this),
resolve(
global.db.data == null ? global.loadDatabase() : global.db.data
))
: null;
}, 1 * 1000)
);
if (global.db.data !== null) return;
global.db.READ = true;
await global.db.read();
global.db.READ = false;
global.db.data = {
users: {},
chats: {},
database: {},
game: {},
settings: {},
others: {},
sticker: {},
...(global.db.data || {}),
};
global.db.chain = _.chain(global.db.data);
};
loadDatabase();
global.db = JSON.parse(fs.readFileSync("./src/database.json"));
if (global.db)
global.db = {
sticker: {},
database: {},
game: {},
others: {},
users: {},
...(global.db || {}),
};
//
let isSleeping = false; // Move the declaration here.
let banUser = JSON.parse(fs.readFileSync('./database/banUser.json'));
let banchat = JSON.parse(fs.readFileSync('./database/banChat.json'));
let kaiaudio = JSON.parse(fs.readFileSync('./Media-Database/audio.json'));
let _limit = JSON.parse(fs.readFileSync('./storage/user/limit.json'));
let _buruan = JSON.parse(fs.readFileSync('./storage/user/bounty.json'));
let _darahOrg = JSON.parse(fs.readFileSync('./storage/user/blood.json'))
let ntnsfw = JSON.parse(fs.readFileSync('./database/nsfw.json')); //
let pendaftar = JSON.parse(fs.readFileSync('./storage/user/user.json'))
let balance = JSON.parse(fs.readFileSync('./database/balance.json'))
let ssewa = JSON.parse(fs.readFileSync('./database/sewa.json'))
let ban = JSON.parse(fs.readFileSync('./database/ban.json'))
let autosticker = JSON.parse(fs.readFileSync('./database/autosticker.json'))
const _autostick = JSON.parse(fs.readFileSync('./database/autostickpc.json'))
let limit = JSON.parse(fs.readFileSync('./database/limit.json'))
let setik = JSON.parse(fs.readFileSync('./src/sticker.json'))
let vien = JSON.parse(fs.readFileSync('./src/audio.json'))
let imagi = JSON.parse(fs.readFileSync('./src/image.json'))
let videox = JSON.parse(fs.readFileSync('./src/video.json'))
global.db = JSON.parse(fs.readFileSync('./src/database.json'))
let _sewa = require("./lib/sewa");
const sewa = JSON.parse(fs.readFileSync('./database/sewa.json'))
const time = moment.tz('Asia/Kolkata').format('DD/MM HH:mm:ss')
const ucap = moment(Date.now()).tz('Asia/Kolkata').locale('id').format('a')
var buln = ['/01/', '/02/', '/03/', '/04/', '/05/', '/06/', '/07/', '/08/', '/09/', '/10/', '/11/', '/12/'];
var myHari = ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'];
var tgel = new Date();
var hri = tgel.getDate();
var bulnh = tgel.getMonth();
var thisHari = tgel.getDay(),
thisDaye = myHari[thisHari];
var yye = tgel.getYear();
var syear = (yye < 1000) ? yye + 1900 : yye;
const jangwak = (hri + '' + buln[bulnh] + '' + syear)
const janghar = (thisDaye)
var myHari = [
"Sunday",
"Monday",
"Tuesday",
"Wednesday",
"Thursday",
"Friday",
"Saturday",
];
var tgel = new Date();
var thisHari = tgel.getDay(),
thisDaye = myHari[thisHari];
var yye = tgel.getYear();
//
module.exports = A17 = async (A17, 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 : '')
const prefix = global.prefa
const isCmd = body.startsWith(prefix)
const notCmd = body.startsWith('')
const command = isCmd ? body.slice(1).trim().split(' ')[0].toLowerCase() : ''
const args = body.trim().split(/ +/).slice(1)
const pushname = m.pushName || "No Name"
const botNumber = await A17.decodeJid(A17.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 = args.join(" ")
const from = m.chat
const quoted = m.quoted ? m.quoted : m
const mime = (quoted.msg || quoted).mimetype || ''
const isMedia = /image|video|sticker|audio/.test(mime)
const messagesD = body.slice(0).trim().split(/ +/).shift().toLowerCase()
const groupMetadata = m.isGroup ? await A17.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 isUser = pendaftar.includes(m.sender)
const isBan = banUser.includes(m.sender)
const welcm = m.isGroup ? wlcm.includes(from) : false
const isBanChat = m.isGroup ? banchat.includes(from) : false
const isRakyat = isCreator || global.rkyt.map(v => v.replace(/[^0-9]/g, '') + '@s.whatsapp.net').includes(m.sender) || false
const AntiLink = m.isGroup ? ntilink.includes(from) : false
const AntiLinkYoutubeVid = m.isGroup ? ntilinkytvid.includes(from) : false
const AntiLinkYoutubeChannel = m.isGroup ? ntilinkytch.includes(from) : false
const AntiLinkInstagram = m.isGroup ? ntilinkig.includes(from) : false
const AntiLinkFacebook = m.isGroup ? ntilinkfb.includes(from) : false
const AntiLinkTiktok = m.isGroup ? ntilinktt.includes(from) : false
const AntiLinkTelegram = m.isGroup ? ntilinktg.includes(from) : false
const AntiLinkTwitter = m.isGroup ? ntilinktwt.includes(from) : false
const AntiLinkAll = m.isGroup ? ntilinkall.includes(from) : false
const antiWame = m.isGroup ? ntwame.includes(from) : false
const antiVirtex = m.isGroup ? ntvirtex.includes(from) : false
const AntiNsfw = m.isGroup ? ntnsfw.includes(from) : false
autoreadsw = true
const content = JSON.stringify(m.message)
const q = args.join(' ')
const isQuotedVideo = m.mtype === 'extendedTextMessage' && content.includes('videoMessage')
const isQuotedAudio = m.mtype === 'extendedTextMessage' && content.includes('audioMessage')
autoreadsw = true;
_sewa.expiredCheck(A17, sewa);
const reply = (teks) => {
A17.sendMessage(m.chat, { text: teks }, { quoted: m })
}
/* const reply = (teks) => {
A17.sendMessage(m.chat, { text: teks }, { quoted: m });
}; */
const sender = m.isGroup ? (m.key.participant ? m.key.participant : m.participant) : m.key.remoteJid
const senderNumber = sender.split('@')[0]
function randomNomor(angka) {
return Math.floor(Math.random() * angka) + 1;
}
if (m.message) {
addBalance(m.sender, randomNomor(574), balance);
console.log(
chalk.black(chalk.bgWhite("[ MESSAGE ]")),
chalk.black(chalk.bgGreen(new Date())),
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)
);
}
if (isCmd && !isUser) {
pendaftar.push(m.sender);
fs.writeFileSync("./storage/user/user.json", JSON.stringify(pendaftar));
}
//----------------------------------------------------------------------------------------------------------//
// if (global.autoreadpmngc) {
// if (command) {
// await A17.sendPresenceUpdate("composing", m.chat);
// A17.sendReadReceipt(from, m.sender, [m.key.id]);
// }
// }
//
// if (global.autoReadGc) {
// if (m.isGroup) {
// A17.sendReadReceipt(m.chat, m.sender, [m.key.id]);
// }
// }
// if (global.autoReadAll) {
// if (m.chat) {
// A17.sendReadReceipt(m.chat, m.sender, [m.key.id]);
// }
// }
if (global.autoreadgc) {
if (command) {
await A17.sendPresenceUpdate('composing', m.chat);
// Create an array of message keys to mark as read
const keysToMarkAsRead = [
{
remoteJid: m.chat,
id: m.key.id,
participant: m.sender,
},
// You can add more message keys to mark multiple messages as read
];
// Use the sock object to read the specified messages
await A17.readMessages(keysToMarkAsRead);
}
}
if (global.autoRecord) {
if (m.chat) {
A17.sendPresenceUpdate("recording", m.chat);
}
}
if (global.autoTyping) {
if (m.chat) {
A17.sendPresenceUpdate("composing", m.chat);
}
}
if (global.available) {
if (m.chat) {
A17.sendPresenceUpdate("available", m.chat);
}
}
//Dm and Groups Autoreply/Bot chat
/*
if (!isCmd && !m.isGroup){
const botreply = await axios.get(`http://api.brainshop.ai/get?bid=166512&key=5nz1Ha6nS9Zx1MfT&uid=[uid]&msg=[msg]=[${budy}]`)
txt = `${botreply.data.cnt}`
m.reply(txt)
}
*/
//----------------------------------------------------------------------------------------------------//
//
for (let anju of kaiaudio) {
if (budy === anju) {
result = fs.readFileSync(`./Assets/audio/${anju}.mp3`)
A17.sendMessage(m.chat, { audio: result, mimetype: 'audio/mp4', ptt: true }, { quoted: m })
}
}
//
// const hariRaya = new Date("6 1, 2022 00:00: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}Day ${jjam}Hour ${mmmenit}Minute ${ddetik}Second`;
// async function hitungmundur(bulan, tanggal) {
// let from = new Date(`${bulan} ${tanggal}, 2022 00:00:00`).getTime();
// let now = Date.now();
// let distance = from - now;
// let days = Math.floor(distance / (1000 * 60 * 60 * 24));
// let hours = Math.floor(
// (distance % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60)
// );
// let minutes = Math.floor((distance % (1000 * 60 * 60)) / (1000 * 60));
// let seconds = Math.floor((distance % (1000 * 60)) / 1000);
// return (
// days +
// "Day " +
// hours +
// "Hour " +
// minutes +
// "Minute " +
// seconds +
// "Second"
// );
// }
//-----------------------------------------------------------------------------------------------------------------------------------//
//don't edit this part.
const formatTime = (seconds) => {
const hours = Math.floor(seconds / 3600);
const minutes = Math.floor((seconds % 3600) / 60);
const secs = seconds % 60;
return `${hours.toString().padStart(2, '0')}:${minutes.toString().padStart(2, '0')}:${secs.toString().padStart(2, '0')}`;
};
function updateStatus() {
const uptimeInSeconds = Math.floor(process.uptime());
const uptimeFormatted = formatTime(uptimeInSeconds);
// const status = `
// ㅤㅤ〄ㅤㅤ〘 BELUGA-BOT BETA EDITION 〙ㅤㅤ〄ㅤㅤㅤㅤ
// ㅤㅤㅤ〘ㅤ Auto Uptime: ${uptimeFormatted}ㅤ〙`;
function _0x582b(_0xabb6f8,_0x12cdd8){const _0x58e890=_0x58e8();return _0x582b=function(_0x582b90,_0x4387b3){_0x582b90=_0x582b90-0x189;let _0x932613=_0x58e890[_0x582b90];return _0x932613;},_0x582b(_0xabb6f8,_0x12cdd8);}function _0x58e8(){const _0x109554=['12896370RDSmnX','3BgvPel','189HbmdoW','18854HvEPNh','11TZHUID','9125326EcyeIg','464328lPaAMf','3400722cbWEOK','2263175KIczdo','12TaHNqM','2521564eqJRHK'];_0x58e8=function(){return _0x109554;};return _0x58e8();}(function(_0x429d7b,_0x532ab5){const _0x527567=_0x582b,_0x130eb4=_0x429d7b();while(!![]){try{const _0x75c57a=-parseInt(_0x527567(0x18b))/0x1+-parseInt(_0x527567(0x192))/0x2*(-parseInt(_0x527567(0x189))/0x3)+parseInt(_0x527567(0x191))/0x4*(-parseInt(_0x527567(0x190))/0x5)+-parseInt(_0x527567(0x18f))/0x6+parseInt(_0x527567(0x18d))/0x7+parseInt(_0x527567(0x18e))/0x8*(-parseInt(_0x527567(0x18a))/0x9)+parseInt(_0x527567(0x193))/0xa*(parseInt(_0x527567(0x18c))/0xb);if(_0x75c57a===_0x532ab5)break;else _0x130eb4['push'](_0x130eb4['shift']());}catch(_0x19ea04){_0x130eb4['push'](_0x130eb4['shift']());}}}(_0x58e8,0xa8dae));const status='\x0a\x20 \x20『•• \x20Panda-\x20Bᴏᴛ\x20-Mᴅ\x20 ••』 \x0a\x20\x20ㅤㅤㅤ〘ㅤ\x20🛡️ Auto\x20Uptime:\x20'+uptimeFormatted+'ㅤ〙';
A17.setStatus(status); // Set the status using A17.setStatus or your equivalent method
// Update the status randomly within 5 minutes (300000 milliseconds)
const randomTime = Math.floor(Math.random() * 300000) + 1000; // don't edit.
setTimeout(updateStatus, randomTime);
}
// Initial call to start the random status updates
updateStatus();
//-----------------------------------------------------------------------------------------------------------------------------------//
//
// if (AntiLinkAll)
// var rondonxk = '[-a-zA-Z0-9@:%._+~#=].[-a-zA-Z0-9@:%._+~#=].[-a-zA-Z0-9()@:%_+.~#?&/=]'
// if (budy.includes("https://")) {
// if (!isBotAdmins) return
// bvl = `\`\`\`「 Antilink System 」\`\`\`\n\nLink sent by Admin so no action will be taken!`
// if (isAdmins) return reply(bvl)
// if (m.key.fromMe) return reply(bvl)
// if (isCreator) return reply(bvl)
// kice = m.sender
// await A17.sendMessage(
// from,
// {
// delete: {
// remoteJid: from,
// fromMe: false,
// id: m.id,
// participant: m.sender,
// },
// },
// {
// quoted: m,
// }
// );
// // await A17.groupParticipantsUpdate(m.chat, [kice], 'remove')
// A17.sendMessage(from, { text: `\`\`\`「 Antilink System 」\`\`\`\n\n*⚠️ Group link detected !*\n\n*🚫@${kice.split("@")[0]} You are not allowed to send any links in this group !*\n`, contextInfo: { mentionedJid: [kice] } }, { quoted: m })
// } else {
// }
// if (budy.includes("http://")) {
// if (!isBotAdmins) return
// bvl = `\`\`\`「 Antilink System 」\`\`\`\n\nLink sent by Admin so no action will be taken!`
// if (isAdmins) return reply(bvl)
// if (m.key.fromMe) return reply(bvl)
// if (isCreator) return reply(bvl)
// kice = m.sender
// await A17.sendMessage(
// from,
// {
// delete: {
// remoteJid: from,
// fromMe: false,
// id: m.id,
// participant: m.sender,
// },
// },
// {
// quoted: m,
// }
// );
// // await A17.groupParticipantsUpdate(m.chat, [kice], 'remove')
// A17.sendMessage(from, { text: `\`\`\`「 Antilink System 」\`\`\`\n\n*⚠️ Group link detected !*\n\n*🚫@${kice.split("@")[0]} You are not allowed to send any links in this group !*\n`, contextInfo: { mentionedJid: [kice] } }, { quoted: m })
// } else {
// }
// const menulist = `
// Konichiwa ${pushname} dear 👋. I am ${global.BotName}, a bot developed by: Kai to take your WhatsApp usage into next level.
// 「 System Info 」
// Speed : ${latensie.toFixed(4)} miliseconds
// Up Time : ${runtime(process.uptime())}
// Bot Name : ${global.BotName}
// Owner Name : ${global.OwnerName}
// 𝗣𝗹𝗮𝘁𝗳𝗼𝗿𝗺 : Amazon AWS
// 𝗧𝗼𝘁𝗮𝗹 𝗨𝘀𝗲𝗿 : ${Object.keys(global.db.users).length}
// 「 User Info 」
// User Level: ${levelMenu}
// User XP : ${xpMenu} \ ${reqXp}
// User Role : ${role}
// 「 User Bank 」
// User Balance : ${uangku}
// //Iron : ${getBesi(m.sender)}
// Gold : ${getEmas(m.sender)}
// Emarald : ${getEmerald(m.sender)}
// Potion : ${getPotion(m.sender)}
// Type *-menu* or press any button below to start using *${global.BotName}*
// ©️ *${global.BotName}* All Rights Reserved by: *Kai*
// `
// const qtod = m.quoted? "true":"false"
// function pickRandom(list) {
// return list[Math.floor(list.length * Math.random())]
// }
//-------------------------------------------------------------- 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
//reply(`[DEBUG]\n${parseInt(m.text)}`)
if (!/^([1-9]|(me)?give up|surr?ender|off|skip)$/i.test(m.text)) return
isSurrender = !/^[1-9]$/.test(m.text)
if (m.sender !== room.game.currentTurn) {
if (!isSurrender) return !0
}
if (!isSurrender && 1 > (ok = room.game.turn(m.sender === room.game.playerO, parseInt(m.text) - 1))) {
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]} Won!` : isTie ? `Game Over` : `Turn ${['❌', '⭕'][1 * room.game._currentTurn]} (@${room.game.currentTurn.split('@')[0]})`}
❌: @${room.game.playerX.split('@')[0]}
⭕: @${room.game.playerO.split('@')[0]}
Typed *surrender* to surrender and admited defeat`
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) await A17.sendText(room.x, str, m, { mentions: parseMention(str) })
await A17.sendText(room.o, str, m, { mentions: parseMention(str) })
if (isTie || isWin) {
delete this.game[room.id]
}
}
//-----------------------------------------------------------------------------------------------------------------------------------//
//
const pickRandom = (arr) => {
return arr[Math.floor(Math.random() * arr.length)]
}
/*
let smallinput = budy.toLowerCase()
if (smallinput.includes('hello')) {
reply (`*හලො ඉතින් කොහොමද...*,
*මහෙන් මොකක් හරි උදවුවක් ඔනිද..ඔයා මොකද කරන්නෙ..*`);
}
//if (smallinput.includes('he')) {
// reply (`Hello ${pushname}, I am ${BotName}. How can i help you?`);
// }
if (smallinput=='hi') {
reply (`*හායි හායි* *ඉතින් කියන්න පැටියො ඔයා* *මොකද කරන්නෙ*`)
}
if (smallinput=='runtime') {
reply (`Hi💞 ${pushname}🦋 │𝐂𝐘𝐁𝜩𝐑│𝐏𝜟𝐍𝐃𝐀│𝐌𝐃│𝐕➂ 🦋${runtime(process.uptime())}\n\nCurrent Time: ${kaitime}\n\nCurrent Date: ${kaidate}`)
}
if( smallinput.includes('konichiwa') || smallinput.includes('konochiwa') || smallinput.includes('konichiba') || smallinput.includes('salute')){
reply (`Konichiwa ${pushname}, I am ${BotName}. How can i help you?`);
}
if (smallinput=='panda') {
reply ('Yes I am Alive 🫂')
}
if (smallinput=='Hm') {
reply ('*හූම් හූම්.ගාන්න උබ බක මුනෙක්ද...එ කියපන් පකකො😂*.')
}
}
if (smallinput=='mk') {
reply ('*මොමවත් නැ.අනෙ ඔයා මොකද කරන්නෙ..*')
}
if (smallinput=='ping') {
reply (`𝘏𝘐🦋 ${pushname} 𝘗𝘖𝘕𝘎 ${latensie.toFixed(4)} 𝘔;𝘚
🦋 │𝐂𝐘𝐁𝜩𝐑│𝐏𝜟𝐍𝐃𝐀│𝐌𝐃│𝐕➂ 🦋`)
}
if (smallinput.includes('good morning') || smallinput.includes('Gm')) {
reply (`* ${pushname} ගුට් මොනින්ග් පැටියො
ආදරෙයි හැම දාම සතුටින් පරිස්සමින් ඉන්න..💞 `);
}
if (smallinput.includes('good afternoon') || smallinput.includes('konnichiwa')) {
reply (`Good afthernoon to you too ${pushname} 🦋 │𝐂𝐘𝐁𝜩𝐑│𝐏𝜟𝐍𝐃𝐀│𝐌𝐃│𝐕➂ 🦋.`);
}
//if (smallinput.includes('good afthernoon')) {
// reply (`Huh ${pushname} 😇.🦋 │𝐂𝐘𝐁𝜩𝐑│𝐏𝜟𝐍𝐃𝐀│𝐌𝐃│𝐕➂ 🦋`);
// }
if (smallinput.includes('good night')) {
reply (`😴 ගුට් නයිට් පැටියො 💞 ${pushname} බත් කලද ඉන්නෙ.🤷`);
}
if (smallinput.includes('arigato')|| smallinput.includes('arigatou') || smallinput.includes('thank')) {
reply (`Mention not ${pushname} 😇. I am a bot afterall.`);
}
*/
const responses = {
hello: `Hello ${pushname}, I am ${BotName}. My current prefix is "${prefix}". How can I help you?`,
kai: `My Boss is lost in another Multiverse, and I lost connection with him...`,
runtime: `🦋𝘏𝘐 ${pushname}\n${nowtime}\n\n🦋𝘙𝘜𝘕𝘛𝘐𝘔𝘌:${runtime(process.uptime())}\n\n🦋𝘗𝘙𝘌𝘍𝘐𝘟: *${prefix}*\n\n🦋𝘛𝘐𝘔𝘌: ${kaitime}\n\n🦋𝘋𝘈𝘛𝘌: ${kaidate}\n\n🦋𝘛𝘰𝘥𝘢𝘺 𝘪𝘴 ${currentDay}`,
konichiwa: `Konichiwa ${pushname}, I am ${BotName}. How can I help you?`,
alive: '🦋 │𝐂𝐘𝐁𝜩𝐑│𝐏𝜟𝐍𝐃𝐀│𝐌𝐃│𝐕➂ 🦋',
ping: `Hi🛡️ ${pushname}, Pong ${latensie.toFixed(4)} ms`,
'good morning': `Good morning💞🦋.`,
ohayo: `Good morning to you too ${pushname} ☺️. Have a great day 😇.`,
'good afternoon': `Good afternoon💞🦋.`,
konnichiwa: `Good afternoon to you too ${pushname} ✨. Wishing you an enjoyable afternoon too 😇🤞🏻.`,
'good night': `Good night💞🦋`,
};
const smallinput = budy.toLowerCase();
if (responses.hasOwnProperty(smallinput)) {
reply(responses[smallinput]);
}
//-----------------------------------------------------------------------------------------------------------------------------------//
//
switch (command) {
//
case 'sc': case 'script': case 'git': {
if (isBan) return reply(mess.banned);
if (isBanChat) return reply(mess.bangc);
A17.sendMessage(from, { react: { text: "✅", key: m.key } })
let { data } = await axios.get('https://github.com/CYBER-x-SACHIYA-SL-MD-BOT/CYBER-PANDA-MD.V.0.4');
teks = `
┌───────────────
│ *®-ᴄʏʙᴇʀ-ᴘᴀɴᴅᴀ-ᴍᴅ*
├───────────────
│ *Total Stars* ${data.stargazers_count}
├───────────────
│ *Total Forks* ${data.forks_count} forks
├───────────────
│ *GitHub* https://github.com/CYBER-x-SACHIYA-SL-MD-BOT/CYBER-PANDA-MD.V.0.4
├───────────────
│ *ꜱᴀᴄʜɪᴛʜ ᴄʜᴀɴᴅʀᴀ*
└────────────────`
/* let buttons = [
{buttonId: `${prefix}owner`, buttonText: {displayText: '🍁 DEVELOPER 🍁'}, type: 1}
] */
let buttonMessage = {
image: Thumb,
jpegThumbnail: BotLogo,
caption: teks,
/* footer: `${BotName}`,
buttons: buttons,
headerType: 4, */
contextInfo: {
externalAdreply: {
title: "Powered by Kai",
body: " ",
thumbnail: fs.readFileSync("Assets/pic2.jpg"),
mediaType: 1,
//mediaUrl: 'https://wallpapercave.com/wp/wp10524580.jpg',
//sourceUrl: "https://wallpapercave.com/wp/wp10524580.jpg"
mediaUrl: 'github.com/CYBER-x-SACHIYA-SL-MD-BOT/CYBER-PANDA-MD.V.0.4',
sourceUrl: "github.com/CYBER-x-SACHIYA-SL-MD-BOT/CYBER-PANDA-MD.V.0.4"
}
}
}
A17.sendMessage(m.chat, buttonMessage, { quoted: m })
}
break;
case 'qt': {
if (!args[0] && !m.quoted) {
return m.reply(`Please provide a text (Type or mention a message) !`);
}
try {
let userPfp;
if (m.quoted) {
userPfp = await A17.profilePictureUrl(m.quoted.sender, "image");
} else {
userPfp = await A17.profilePictureUrl(m.sender, "image");
}
const waUserName = pushname;
const quoteText = m.quoted ? m.quoted.body : args.join(" ");
const quoteJson = {
type: "quote",
format: "png",
backgroundColor: "#FFFFFF",
width: 700,
height: 580,
scale: 2,
messages: [
{
entities: [],
avatar: true,
from: {
id: 1,
name: waUserName,
photo: {
url: userPfp,
},
},
text: quoteText,
replyMessage: {},
},
],
};
const quoteResponse = await axios.post("https://bot.lyo.su/quote/generate", quoteJson, {
headers: { "Content-Type": "application/json" },
});
const buffer = Buffer.from(quoteResponse.data.result.image, "base64");
A17.sendImageAsSticker(m.chat, buffer, m, {
packname: `${global.BotName}`,
author: waUserName,
});
} catch (error) {
console.error(error);
m.reply("Error generating quote!");
}
break;
}
case 'support': case 'supportgc': {
if (isBan) return reply(mess.banned);
if (isBanChat) return reply(mess.bangc);
A17.sendMessage(from, { react: { text: "💫", key: m.key } })
reply(`⚙ *My developer's group:* http://gg.gg/gc-support`)
}
break;
case 'repo': case 'botrepo': {
if (isBan) return reply(mess.banned);
if (isBanChat) return reply(mess.bangc);
A17.sendMessage(from, { react: { text: "💫", key: m.key } })
reply(`⚙ My Source Code is </> - https://github.com/CYBER-x-SACHIYA-SL-MD-BOT/CYBER-PANDA-MD.V.0.4`)
}
break;
case 'owner': case 'creator': case 'mod': case 'mods': {
if (isBan) return reply(mess.banned);
if (isBanChat) return reply(mess.bangc);
A17.sendMessage(from, { react: { text: "💫", key: m.key } })
A17.sendContact(m.chat, global.Owner, m)
}
break;
case 'addmod':
case 'addowner':
if (isBan) return reply(mess.banned);
if (isBanChat) return reply(mess.bangc);
if (!isCreator) return reply(mess.botowner)
A17.sendMessage(from, { react: { text: "🛡️", key: m.key } })
if (!args[0]) return reply(`Use ${prefix + command} number\nExample ${prefix + command} ${OwnerNumber}`)
bnnd = q.split("|")[0].replace(/[^0-9]/g, '')
let ceknye = await A17.onWhatsApp(bnnd)
if (ceknye.length == 0) return reply(`Enter A Valid And Registered Number On WhatsApp!!!`)
Owner.push(bnnd)
fs.writeFileSync('./database/mod.json', JSON.stringify(Owner))
reply(`Number ${bnnd} Has Become An Owner!!!`)
break;
case 'delowner':
case 'delmod':
if (isBan) return reply(mess.banned);
if (isBanChat) return reply(mess.bangc);
if (!isCreator) return reply(mess.botowner)
A17.sendMessage(from, { react: { text: "🛡️", key: m.key } })
if (!args[0]) return reply(`Use ${prefix + command} nomor\nExample ${prefix + command} 916297175943`)
ya = q.split("|")[0].replace(/[^0-9]/g, '')
unp = Owner.indexOf(ya)
Owner.splice(unp, 1)
fs.writeFileSync('./database/mod.json', JSON.stringify(Owner))
reply(`The Numbrr ${ya} Has been deleted from owner list by the owner!!!`)
break;
case 'modlist':
if (isBan) return reply(mess.banned);
if (isBanChat) return reply(mess.bangc);
if (!isCreator) return reply(mess.botowner);
A17.sendMessage(from, { react: { text: "🛡️", key: m.key } })
try {
const modData = fs.readFileSync('./database/mod.json', 'utf8');
const mods = JSON.parse(modData);
if (mods.length === 0) {
reply('There are no mods in the list.');
} else {
let modList = '';
mods.forEach((mod, index) => {
modList += `(${index + 1}) ${A17.getName(mod)}\n`;
});
reply(`List of List of Moderators:\n\n${modList}`);
}
} catch (error) {
console.error(error);
reply('Failed to fetch mod list.');
}
break;
case 'setbotpp': {
if (!isCreator) return reply(mess.owner)
if (isBanChat) return reply(mess.bangc);
if (!isCreator) return reply(mess.owner)
A17.sendMessage(from, { react: { text: "🫡", key: m.key } })
if (!quoted) return `*Send/reply Image With Caption* ${prefix + command}`
if (!/image/.test(mime)) return `*Send/reply Image With Caption* ${prefix + command}`
if (/webp/.test(mime)) return `*Send/reply Image With Caption* ${prefix + command}`
let media = await A17.downloadAndSaveMediaMessage(quoted)
await A17.updateProfilePicture(botNumber, { url: media }).catch((err) => fs.unlinkSync(media))
m.reply(mess.jobdone)
}
break;
//
case 'changeprefix':
case 'setprefix':
if (isBan) return reply(mess.banned);
if (isBanChat) return reply(mess.bangc);
if (!isCreator) return reply(mess.botowner)
A17.sendMessage(from, { react: { text: "🛡️", key: m.key } })
if (args.length !== 1) {
return m.reply(`Please provide a single character as the new prefix.`);
} else {
const newPrefix = args[0];
try {
global.prefa = [newPrefix];
return m.reply(`${pushname} Successfully changed Prefix to "${newPrefix}"`);
} catch (error) {
console.error('Error changing prefix:', error);
return m.reply(`An error occurred while changing the prefix. Please try again later.`);
}
}
//
case 'restart':
await A17.sendMessage(from, { react: { text: "⚙", key: m.key } });
if (!isCreator) return reply(mess.botowner)
await A17.sendMessage(from, { text: mess.waiting });
await A17.sendMessage(from, { react: { text: "✅", key: m.key } });
await A17.sendMessage(from, { text: 'Restarting Success!' });
// Delay the shutdown by 5 seconds using sleep function
//await sleep(5000);
// Use PM2 to restart the script
pm2.restart('index', (err) => {
if (err) {
A17.sendMessage(from, { react: { text: "❌", key: m.key } });
A17.sendMessage(from, { text: 'Restarting Failed!' });
} else {
return;
}
});
break;
//
case 'shutdown': case 'sleep':
if (!isCreator) return reply(mess.owner)
if (isBanChat) return reply(mess.bangc);
if (!isCreator) return reply(mess.owner)
await A17.sendMessage(from, { react: { text: "⚠️", key: m.key } })
reply(`Okey bye time to sleep!`)
await sleep(5000)