forked from MRHRTZ/Js-Project
-
Notifications
You must be signed in to change notification settings - Fork 0
/
HurtzHandler~.js
3260 lines (3092 loc) · 189 KB
/
HurtzHandler~.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
const { decryptMedia } = require('@open-wa/wa-decrypt')
const getYouTubeID = require('get-youtube-id')
const fs = require('fs-extra')
const urlShortener = require('./lib/shortener')
const axios = require('axios')
const moment = require('moment-timezone')
const get = require('got')
const download = require('download-file')
// const fetch = require('node-fetch')
const speed = require('performance-now')
const google = require('google-it')
const color = require('./lib/color')
const { promisify } = require('util')
const { spawn, exec } = require('child_process')
const { getLocationData } = require('./lib')
const util = require('util')
const nhentai = require('nhentai-js')
const AsyncFunction = Object.getPrototypeOf(async function () {}).constructor
const os = require('os')
const cron = require('node-cron')
const { API } = require('nhentai-api')
const { liriklagu, quotemaker, randomNimek, fb, ig, twt, sleep, tulis, jadwalTv, ss, between } = require('./lib/functions')
const { help, snk, info, donate, readme, listChannel, bahasa_list } = require('./lib/help')
const { stdout } = require('process')
const nsfw_ = JSON.parse(fs.readFileSync('./lib/NSFW.json'))
const welkomD = JSON.parse(fs.readFileSync('./lib/dmff.json'))
const welkom = JSON.parse(fs.readFileSync('./lib/welcome.json'))
const welkomF = JSON.parse(fs.readFileSync('./lib/freedom.json'))
const { RemoveBgResult, removeBackgroundFromImageBase64, removeBackgroundFromImageFile } = require('remove.bg')
const translate = require('@vitalets/google-translate-api');
const { BikinTikel } = require('./lib/tikel_makel')
const setting = JSON.parse(fs.readFileSync('./lib/config.json'))
const muted = JSON.parse(fs.readFileSync('./lib/muted.json'))
const vip = JSON.parse(fs.readFileSync('./lib/vip.json'))
let banned = JSON.parse(fs.readFileSync('./lib/banned.json'));
const limit = JSON.parse(fs.readFileSync('./lib/limit.json'));
const msgLimit = JSON.parse(fs.readFileSync('./lib/msgLimit.json'));
const {prefix, banChats, restartState: isRestart,mtc: mtcState, whitelist ,sAdmin, limitCount, memberLimit, groupLimit} = setting
//const { default: translate } = require('google-translate-open-api')
// const igGetInfo = promisify(instagram.getInfo)
// const twtGetInfo = promisify(twitter.getInfo)
moment.tz.setDefault('Asia/Jakarta').locale('id')
module.exports = msgHandler = async (hurtz, message) => {
try {
const { type, id, from, t, sender, isGroupMsg, chat, caption, isMedia, mimetype, quotedMsg, quotedMsgObj, mentionedJidList } = message
let { body } = message
const { name, formattedTitle } = chat
let { pushname, verifiedName } = sender
pushname = pushname || verifiedName
const commands = caption || body || ''
const command = commands.toLowerCase().split(' ')[0] || ''
const args = commands.split(' ')
const msgs = (message) => {
if (command.startsWith('!')) {
if (message.length >= 10){
return `${message.substr(0, 15)}`
}else{
return `${message}`
}
}
}
const mess = {
wait: '_Permintaan anda sedang diproses mohon tunggu sebentar_ ⏲️',
mt: '_Fitur ini masih dalam proses perbaikan._',
error: {
St: '_Terjadi kesalahan_ ⚠️ _Kirim gambar dengan caption *!sticker* atau tag gambar yang sudah dikirim_',
Qm: '_Terjadi kesalahan_ ⚠️ _mungkin themenya tidak tersedia!_',
Yt3: '_Terjadi kesalahan_ ⚠️ _tidak dapat meng konversi ke mp3!_',
Yt4: '_Terjadi kesalahan_ ⚠️ _mungkin error di sebabkan oleh sistem._',
Ig: '_Terjadi kesalahan_ ⚠️ _mungkin karena akunnya private_',
Ki: '⚠️ _Bot tidak bisa mengeluarkan admin group!_',
Ad: '⚠️ _Tidak dapat menambahkan target, mungkin karena di private dan pastikan format nomer hanya angka contoh 62856xxxxx, tidak memakai awalan 08 dan simbol_',
Iv: '⚠️ _Link yang anda kirim tidak valid!_'
}
}
const time = moment(t * 1000).format('DD/MM HH:mm:ss')
const botNumber = await hurtz.getHostNumber()
const blockNumber = await hurtz.getBlockedIds()
const serial = sender.id
const isSadmin = serial === sAdmin
const groupId = isGroupMsg ? chat.groupMetadata.id : ''
const groupAdmins = isGroupMsg ? await hurtz.getGroupAdmins(groupId) : ''
const isGroupAdmins = isGroupMsg ? groupAdmins.includes(sender.id) : false
const isBotGroupAdmins = isGroupMsg ? groupAdmins.includes(botNumber + '@c.us') : false
const isBanned = banned.includes(sender.id)
const ownerNumber = '[email protected]'
const DGCfounder = 'Biancho Junaidi'
const DGCbotowner = 'MRHRTZ@kali:~#'
const dgc_id = '[email protected]_3EB05AFD72F7F8618F4B'
const isFounder = sender.pushname === DGCfounder
const isBOwner = sender.pushname === DGCbotowner
const pengirim = JSON.parse(fs.readFileSync('./lib/pengguna.json'))
const jelema = pengirim[Math.floor(Math.random()*pengirim.length)];
const isOwner = sender.id === ownerNumber
const isBlocked = blockNumber.includes(sender.id)
const isPrivate = sender.id === chat.contact.id
const menuPriv = `Perintah private sekarang hanya anonymous chat!\n\nHal ini dikarenakan terlalu banyak request di pc (private chat) sehingga bot rentan terblokir WhatsApp\n\nBot ini disewakan khusus grup, ketik *!SendOwner* untuk mengirim nomer pemilik bot\n\nFitur Private yg tersedia :\n 🎤〘 Anonymous Chat 〙💺\n\n➣ *!kirim _Teksnya_*\n➣ *!daftar _62855xxxx_*\n➣ *!hapus _62855xxxx_*`
// `*Fitur bot private yang tersedia* :\n\n➣ *!sendowner*\n➣ *!bug _teksnya_*\n➣ *!tostiker _Teksnya_*\n➣ *!stikergif*\n➣ *!stiker*\n\n 🎤〘 Anonymous Chat 〙💺\n\n➣ *!kirim _Teksnya_*\n➣ *!daftar _62855xxxx_*\n➣ *!hapus _62855xxxx_*\n\n_Apabila ingin full fitur menu donasi untuk sewa bot digrup, minat? ketik *!sendOwner*_`
const isNsfw = isGroupMsg ? nsfw_.includes(chat.id) : false
const uaOverride = 'WhatsApp/2.2029.4 Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.116 Safari/537.36'
const isUrl = new RegExp(/https?:\/\/(www\.)?[-a-zA-Z0-9@:%._+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()@:%_+.~#?&/=]*)/gi)
if (!isGroupMsg && command.startsWith('!')) console.log('\x1b[1;31m~\x1b[1;37m>>', '[\x1b[1;32mOUT\x1b[1;37m]', time, color(msgs(command)), 'from', color(pushname))
if (isGroupMsg && command.startsWith('!')) console.log('\x1b[1;31m~\x1b[1;37m>>', '[\x1b[1;32mOUT\x1b[1;37m]', time, color(msgs(command)), 'from', color(pushname), 'in', color(formattedTitle))
if (!isGroupMsg && !command.startsWith('!')) console.log('\x1b[1;33m~\x1b[1;37m>>', '[\x1b[1;31mMSG\x1b[1;37m]', time, color('pesan'), 'from', color(pushname))
if (isGroupMsg && !command.startsWith('!')) console.log('\x1b[1;33m~\x1b[1;37m>>', '[\x1b[1;31mMSG\x1b[1;37m]', time, color('pesan'), 'from', color(pushname), 'in', color(formattedTitle))
if (isBlocked ) return
//hurtz.reply(from, `_Sepertinya anda telah terblokir dikarenakan vc/call bot._`)
//if (!isOwner) return
//try {
//EXPIRED BEGIN
// cron.schedule('00 15 * * * *', () => {
// const hzbot = '[email protected]'
// hurtz.sendText(hzbot, `Terima kasih telah menggunakan jasa DGC ChatBot grup ini telah expired pada tanggal 52 bot akan otomatis leave terima kasih.`)
// // .then(() => hurtz.leaveGroup(hzbot))
// // .then(() => hurtz.deleteChat(hzbot))
// console.log('Coming')
// })
let rawText = type === 'chat' ?
message.body :
(type === 'image' || type === 'video') && caption ?
message.caption : ''
if (rawText.startsWith('> ') /* && sender.id == ownerNumber*/ ) {
console.log(sender.id, 'is trying to use the execute command')
let type = Function
if (/await/.test(rawText)) type = AsyncFunction
let func = new type('print', 'hurtz', 'message', 'get', 'fs', rawText.slice(2))
let output
try {
output = func((...args) => {
console.log(...args)
hurtz.reply(from, util.format(...args), id)
}, hurtz, message, get, fs)
console.log(output)
await hurtz.reply(from, '*Console Output*\n\n' + util.format(output), id)
} catch (e) {
await hurtz.reply(from, '*Console Error*\n\n' + util.format(e), id)
}
}
//EXPIRED ENDLINE
const isMuted = (chatId) => {
if(muted.includes(chatId)){
return false
}else{
return true
}
}
const isVIP = (chet) => {
if(vip.includes(chet)){
return false
}else{
return true
}
}
function restartAwal(hurtz){
setting.restartState = false
isRestart = false
hurtz.sendText(setting.restartId, 'Restart Succesfull!')
setting.restartId = 'undefined'
fs.writeFileSync('./lib/setting.json', JSON.stringify(setting, null,2));
}
//BEGIN HELPER
if (typeof Array.prototype.splice === 'undefined') {
Array.prototype.splice = function (index, howmany, elemes) {
howmany = typeof howmany === 'undefined' || this.length;
var elems = Array.prototype.slice.call(arguments, 2), newArr = this.slice(0, index), last = this.slice(index + howmany);
newArr = newArr.concat.apply(newArr, elems);
newArr = newArr.concat.apply(newArr, last);
return newArr;
}
}
function isMsgLimit(id){
if (isSadmin) {return false;}
let found = false;
const addmsg = JSON.parse(fs.readFileSync('./lib/msgLimit.json'))
for (let i of addmsg){
if(i.id === id){
if (i.msg >= 12) {
found === true
// console.log(i)
hurtz.reply(from, '*[ANTI-SPAM]*\nMaaf, akun anda kami blok karena SPAM, dan tidak bisa di UNBLOK!', id)
hurtz.contactBlock(id)
banned.push(id)
fs.writeFileSync('./lib/banned.json', JSON.stringify(banned))
return true;
}else if(i.msg >= 7){
found === true
hurtz.reply(from, '*[ANTI-SPAM]*\nNomor anda terdeteksi spam!\nMohon tidak spam 5 pesan lagi atau nomor anda AUTO BLOK!', id)
return true
}else{
found === true
return false;
}
}
}
if (found === false){
let obj = {id: `${id}`, msg:1};
addmsg.push(obj);
fs.writeFileSync('./lib/msgLimit.json',JSON.stringify(addmsg));
return false;
}
}
function addMsgLimit(id){
if (isSadmin) {return;}
var found = false
const addmsg = JSON.parse(fs.readFileSync('./lib/msgLimit.json'))
Object.keys(addmsg).forEach((i) => {
if(addmsg[i].id == id){
found = i
// console.log(addmsg[0])
}
})
if (found !== false) {
addmsg[found].msg += 1;
fs.writeFileSync('./lib/msgLimit.json',JSON.stringify(addmsg));
// console.log(addmsg[0])
}
}
function isLimit(id){
//if (isSadmin) {return false;}
let found = false;
for (let i of limit){
if(i.id === id){
let limits = i.limit;
if (limits >= limitCount) {
found = true;
return true;
}else{
limit
found = true;
return false;
}
}
}
if (found === false){
let obj = {id: `${id}`, limit:0};
limit.push(obj);
fs.writeFileSync('./lib/limit.json',JSON.stringify(limit));
return false;
}
}
function limitAdd (id) {
//if (isSadmin) {return;}
var found = false;
const limidat = JSON.parse(fs.readFileSync('./lib/limit.json'))
Object.keys(limidat).forEach((i) => {
if(limidat[i].id == id){
found = i
//console.log(limidat[0])
}
})
if (found !== false) {
limidat[found].limit += 1;
// console.log(limidat[found])
fs.writeFileSync('./lib/limit.json',JSON.stringify(limidat));
}
}
//END HELPER
if (body === '!unmute') {
if(isGroupMsg) {
if (!isGroupAdmins) return hurtz.reply(from, 'Maaf, perintah ini hanya dapat dilakukan oleh admin grup!', id)
let index = muted.indexOf(chat.id);
muted.splice(index,1)
fs.writeFileSync('./lib/muted.json', JSON.stringify(muted, null, 2))
hurtz.reply(from, `Bot telah di unmute!`, id)
}
}
if (!isMuted(chat.id) == true) return console.log(`Muted ${chat.id} ${name}`)
//hurtz.reply(from, `_Hai ${pushname} Limit request anda sudah mencapai batas, Coba lagi besok..._`, id)
if (args[0] == 'Tes') {
hurtz.reply(from, `Oke nyala..`, id)
}
if (args[0] == "Assalamualaikum" || args[0] == "Assalamu'alaikum" || args[0] == "Samlikum" || args[0] == "Samlekom"){
return hurtz.reply(from, "Wa'alaikumsalam warahmatullahi wabarokatuh", id)
} else if (args[0] == "Anjing" || args[0] == "Goblok" || args[0] == "Ngentod" || args[0] == "Bangsat"){
if (!isGroupAdmins) {
return hurtz.reply(from, "WOYY JANGAN TOXIC MEMBER BANGSAT SETAN!", id)
.then(() => hurtz.removeParticipant(groupId, sender.id))
.then(() => {
hurtz.sendText(from, `Awokawoka mampuss terwisuda🐦`)
}).catch(() => hurtz.sendText(from, `Untung bot bukan admin kalo ngga udah terkick tuh >:(`))
} else {
return hurtz.reply(from, "Mohon jaga ucapannya ya mimin:)", id)
}
}
if (command == '!cke') {
hurtz.getIsPlugged().then((a) => console.log(a))
} else if (command == '!botstat') {
function isCas() {
if (hurtz.getIsPlugged().then((plog) => { return plog }) == true) {
return 'Charging ⚡'
} else {
return 'Not Charging'
}
}
const loadedMsg = await hurtz.getAmountOfLoadedMessages()
const chatIds = await hurtz.getAllChatIds()
const groups = await hurtz.getAllGroups()
const timestamp = speed();
const latensi = speed() - timestamp
const MyPhone = await hurtz.getMe()
const { battery, plugged, phone } = MyPhone
const { wa_version, mcc, mnc, os_version, device_manufacturer, device_model, os_build_number } = phone
// console.log(os.hostname())
hurtz.reply(from, ` 〘 Server Info 〙
*HOST* : _${os.hostname()}_
*PLATFORM* : _${os.platform()}_
*CPU* : _${os.cpus()[0].model}_
*SPEED* : _${os.cpus()[0].speed} MHz_
*CORE* : _${os.cpus().length}_
*Penggunaan RAM* : _${(process.memoryUsage().heapUsed / 1024 / 1024).toFixed(2)}MB / ${Math.round(require('os').totalmem / 1024 / 1024)}MB_
*Pesan masuk* : _${loadedMsg}_
*Group* : _${groups.length}_
*Private Chat* : _${chatIds.length - groups.length}_
*Total* : _${chatIds.length}_
*Latensi* : _${latensi.toFixed(4)} detik/req_
〘 Phone Info 〙
*Baterai* : _${battery} ${isCas()}_
*Versi WhatsApp* : _${wa_version}_
*MCC* : _${mcc}_
*MNC* : _${mnc}_
*Versi OS* : _${os_version}_
*Tipe Perangkat* : _${device_manufacturer}_
*Model Perangkat* : _${device_model}_
*OS Build Number* : _${os_build_number}_`, id)
} else if (command == '!mute') {
if (!isGroupAdmins) return hurtz.reply(from, 'Maaf, perintah ini hanya dapat dilakukan oleh admin grup!', id)
muted.push(chat.id)
fs.writeFileSync('./lib/muted.json', JSON.stringify(muted, null, 2))
hurtz.reply(from, `Bot telah di mute pada chat ini! *!unmute* untuk membuka mute!`, id)
await hurtz.sendSeen(from)
} else if (command == '!unmute') {
await hurtz.sendSeen(from)
} else if (command == '!grup?') {
if (!isOwner) return hurtz.reply(from, 'Sorry gw gakenal u xixi, cuman ngerti perintah owner bot!', id)
await hurtz.getAllGroups().then((res) => {
let gc = `*Grup yang dimasuki bot* :\n`
for (let i = 0; i < res.length; i++) {
gc += `\n*Nama grup* : ${res[i].name}\n*Pesan yang belum terbaca* : ${res[i].unreadCount} chat\n*Tidak spam?* : ${res[i].notSpam}\n`
}
hurtz.reply(from, gc, id)
console.log(res[0])
})
} else if (command == '!kirim') {
if (isGroupMsg) return hurtz.reply(from, `Fitur ini khusus private chat!`)
if (args.length === 1) return hurtz.reply(from, 'Masukan pesan atau gambar dengan caption *!kirim _teksnya_*, bisa juga tag pesan dan gambar dengan pesan *!kirim _teksnya_*')
var cek = pengirim.includes(sender.id);
const isQuotedImage = quotedMsg && quotedMsg.type === 'image'
if(!cek){
return hurtz.reply(from, 'kamu belum terdaftar, untuk mendaftar kirim !daftar no wa kamu\ncontoh : !daftar 628523615486 ', id) //if user is not registered
} else {
if (isMedia && args.length >= 1) {
const mediaData = await decryptMedia(message, uaOverride)
const imageBase64 = `data:${mimetype};base64,${mediaData.toString('base64')}`
const opo = body.slice(6)
//pengirim.push(from) //otomatis menambahkan nomor ke database
//fs.writeFileSync('./lib/user.json', JSON.stringify(pengirim))
hurtz.sendImage(jelema, imageBase64, 'gambar.jpeg',`${opo}\n\nHai, kamu mendapat pesan dari : wa.me/${from.replace(/[@c.us]/g, '')}`)
.then(() => hurtz.reply(from, 'Berhasil mengirim pesan\nTunggu pesan dari seseorang, kalo ga di bales coba lagi aja', id))
} else if (isQuotedImage && args.length >= 1) {
const mediaData = await decryptMedia(quotedMsg, uaOverride)
const imageBase64 = `data:${quotedMsg.mimetype};base64,${mediaData.toString('base64')}`
const opo = body.slice(6)
//pengirim.push(from) //otomatis menambahkan nomor ke database
//fs.writeFileSync('./lib/user.json', JSON.stringify(pengirim))
hurtz.sendImage(jelema, imageBase64, 'gambar.jpeg',`${opo}\n\nHai, kamu mendapat pesan dari : wa.me/${from.replace(/[@c.us]/g, '')}`)
.then(() => hurtz.reply(from, 'Berhasil mengirim pesan\nTunggu pesan dari seseorang, kalo ga di bales coba lagi aja', id))
} else if (args.length >= 1) {
const opo = body.slice(6)
//pengirim.push(from) //otomatis menambahkan nomor ke database
//fs.writeFileSync('./lib/user.json', JSON.stringify(pengirim))
hurtz.sendText(jelema, `${opo}\n\nHai, kamu mendapat pesan dari : wa.me/${from.replace(/[@c.us]/g, '').replace(/[-]/g, '')}`)
.then(() => hurtz.reply(from, 'Berhasil mengirim pesan\nTunggu pesan dari seseorang, kalo ga di bales coba lagi aja', id))
} else {
await hurtz.reply(from, 'Format salah! Untuk membuka daftar perintah kirim #menu', id)
}
}
} else if (command == '!daftar') {
if (isGroupMsg) return hurtz.reply(from, `Fitur ini khusus private chat!`)
if (args.length === 1) return hurtz.reply(from, 'Nomornya mana kak?\ncontoh: !daftar 6285226236155')
const text = body.slice(8).replace(/[-\s+]/g,'') + '@c.us'
var cek = pengirim.includes(text);
if(cek){
return hurtz.reply(from, 'Nomor sudah ada di database', id) //if number already exists on database
} else {
const mentah = await hurtz.checkNumberStatus(text) //VALIDATE WHATSAPP NUMBER
const hasiluu = mentah.canReceiveMessage ? `Sukses menambahkan nomer ke database\nTotal data nomer sekarang : *${pengirim.length}*` : false
if (!hasiluu) return hurtz.reply(from, `Nomor WhatsApp tidak valid [ Tidak terdaftar di WhatsApp ]\nDan pastikan format nomer diawali dengan *62* contoh *6285559038022*`, id)
{
pengirim.push(mentah.id._serialized)
fs.writeFileSync('./lib/pengguna.json', JSON.stringify(pengirim))
hurtz.sendText(from, hasiluu)
}
}
} else if (command == '!hapus') {
if (isGroupMsg) return hurtz.reply(from, `Fitur ini khusus private chat!`)
if (!isOwner) return hurtz.reply(from, 'Fitur ini hanya dapat digunakan oleh owner bot')
if (!args.length >= 1) return hurtz.reply(from, 'Masukkan nomornya, *GUNAKAN AWALAN 62* contoh: 6285226236155')
{
let inx = pengirim.indexOf(args[0]+'@c.us')
pengirim.splice(inx,1)
fs.writeFileSync('./lib/pengguna.json', JSON.stringify(pengirim))
hurtz.reply(from, 'Sukses menghapus nomor dari database', id)
}
} else if (command == '!list') {
if (isGroupMsg) return hurtz.reply(from, `Fitur ini khusus private chat!`)
if (!isOwner) return hurtz.reply(from, 'Fitur ini hanya dapat digunakan oleh owner bot')
const num = fs.readFileSync('./lib/pengguna.json')
const daftarnum = JSON.parse(num)
console.log(daftarnum)
let hasiluu = `*Menampilkan daftar list chat anonymous* :\n`
for (var i = 0; i < daftarnum.length; i++) {
hasiluu += `\n➣ @${daftarnum[i].replace(/['"@c.us]/g,'')}\n`
}
// const hasiluu = daftarnum.toString().replace(/['"@c.us]/g,'').replace(/[,]/g, '\n');
await hurtz.sendTextWithMentions(from, hasiluu).catch(() => {
hurtz.reply(from, `_Database kosong!_`, id)
})
} else if (command == '!ceklokasi') {
if (!isGroupMsg) return hurtz.reply(from, menuPriv, id)
try {
hurtz.reply(from, mess.wait, id)
if (quotedMsg.type !== 'location') return hurtz.reply(from, `Maaf, format pesan salah.\nKirimkan lokasi dan reply dengan caption !ceklokasi`, id)
console.log(`Request Status Zona Penyebaran Covid-19 (${quotedMsg.lat}, ${quotedMsg.lng}).`)
const zoneStatus = await getLocationData(quotedMsg.lat, quotedMsg.lng)
if (zoneStatus.kode !== 200) hurtz.reply(from, 'Maaf, Terjadi error ketika memeriksa lokasi yang anda kirim.', id)
console.log(zoneStatus)
let datax = ''
for (let i = 0; i < zoneStatus.data.length; i++) {
const { zone, region } = zoneStatus.data[i]
const _zone = zone == 'green' ? 'Hijau* (Aman) ✅\n' : zone == 'yellow' ? 'Kuning* (Waspada) ⚠️\n' : 'Merah* (Bahaya) 📛\n'
datax += `${i + 1}. Kel. *${region}* Berstatus *Zona ${_zone}`
}
const text = `*CEK LOKASI PENYEBARAN COVID-19*\nHasil pemeriksaan dari lokasi yang anda kirim adalah *${zoneStatus.status}* ${zoneStatus.optional}\n\nInformasi lokasi terdampak disekitar anda:\n${datax}`
hurtz.reply(from, text, id)
} catch(e){
console.log(e)
hurtz.reply(from, `Mohon tag data lokasi anda! (sharelok) lalu kirim perintah *!ceklokasi*`)
}
} else if (command == '$') {
if (!isGroupMsg) return hurtz.reply(from, menuPriv, id)
if (args.length === 1) return hurtz.reply(from, `Chat dengan simi caranya ketik perintah :\n*$* _Pesan kamu_\nContoh :\n*$* _Halo simi_`, id)
const que = body.slice(2)
const sigot = await get.get(`http://simsumi.herokuapp.com/api?text=${que}&lang=id`).json()
hurtz.reply(from, sigot.success, id)
// console.log(sigot)
await hurtz.sendSeen(from)
} else if (command == '!fact' || command == '!facts') {
if (!isGroupMsg) return hurtz.reply(from, menuPriv, id)
const faks = `https://api.i-tech.id/tools/fakta?key=ijmalalfafanajib`
const getting = await get.get(faks).json()
await hurtz.reply(from, `*FACTS* : ${getting.result}`, id).catch((e) => console.log(e))
await hurtz.sendSeen(from)
} else if (command == '!indohot') {
if (!isGroupMsg) return hurtz.reply(from, menuPriv, id)
const faksx = `https://test.mumetndase.my.id/indohot`
const gettingx = await get.get(faksx).json()
//console.log(gettingx)
await hurtz.reply(from, `*Judul* : ${gettingx.data.judul}\n*Genre* : ${gettingx.data.genre}\n*Negara* : ${gettingx.data.country}\n*Durasi* : ${gettingx.data.durasi}\n*Link gan* : ${gettingx.data.url}`, id).catch((e) => console.log(e))
await hurtz.sendSeen(from)
} else if (command == '!pantun') {
if (!isGroupMsg) return hurtz.reply(from, menuPriv, id)
const pans = `https://api.i-tech.id/tools/pantun?key=ijmalalfafanajib`
const gettingpa = await get.get(pans).json()
await hurtz.reply(from, `${gettingpa.result}`, id).catch((e) => console.log(e))
await hurtz.sendSeen(from)
} else if (command == '!quran') {
if (!isGroupMsg) return hurtz.reply(from, menuPriv, id)
if (args.length === 1) return hurtz.reply(from, `Kirim perintah Surah Quran kamu dengan cara ketik perintah :\n*!quran* _Urutan surat_\nContoh :\n*!quran* _1_`, id)
const qura = `https://api.i-tech.id/tools/quran?key=ijmalalfafanajib&surat=${args[1]}`
const gettingqu = await get.get(qura).json()
let hasqu = `*Quran Surat ${args[1]}*\n\n________________________________________`
if (gettingqu.code === '404') return hurtz.reply(from, `_Terdapat kesalahan saat mencari surat ${args[1]}_`)
for (let i = 0; i < gettingqu.result.length; i++) {
hasqu += `\nAyat : ${gettingqu.result[i].nomor}\n${gettingqu.result[i].ar}\n${gettingqu.result[i].id}\n________________________________________`
}
await hurtz.reply(from, `${hasqu}`, id).catch((e) => hurtz.reply(from, `_Terdapat kesalahan saat ,encari surat ${args[1]}_`, id))
console.log(gettingqu)
await hurtz.sendSeen(from)
} else if (command == '!pictquotes') {
if (!isGroupMsg) return hurtz.reply(from, menuPriv, id)
try {
hurtz.reply(from, mess.wait)
const pictq = await get.get('https://inspirobot.me/api?generate=true')
console.log(pictq.body)
hurtz.sendFileFromUrl(from, pictq.body, 'QUOTES.jpg', `Quotes untuk ${pushname}`, id)
} catch (e){
console.log(e)
hurtz.reply(from, `Kesalahan saat mengambil data quotes!`, id)
}
} else if (command == '!cekjodoh') {
if (!isGroupMsg) return hurtz.reply(from, menuPriv, id)
if (args.length === 1) return hurtz.reply(from, `Kirim perintah Cek Jodoh kamu dengan cara ketik perintah :\n*!cekjodoh* _Kamu_|_nama pasanganmu_\nContoh :\n*!cekjodoh* _asep_|_udin_`, id)
hurtz.reply(from, mess.wait, id)
const quejod = body.slice(10)
const jod = `https://api.i-tech.id/tools/cekjodoh?key=ijmalalfafanajib&query=${encodeURIComponent(quejod.split('|')[0])}-${encodeURIComponent(quejod.split('|')[1])}`
const gettingjo = await get.get(jod).json()
// console.log(gettingjo)
await hurtz.reply(from, `${gettingjo.result}`, id).catch(() => hurtz.reply(from, '_Kesalahan! pastikan anda menggunakan perinath yang benar. Ketik *!cekjodoh*_', id))
await hurtz.sendSeen(from)
} else if (command == '!ramalanjodoh') {
if (!isGroupMsg) return hurtz.reply(from, menuPriv, id)
if (args.length === 1) return hurtz.reply(from, `Kirim perintah Cek Jodoh kamu dengan cara ketik perintah :\n*!ramalanjodoh* _Kamu|nama pasanganmu_\nContoh :\n*!ramalanjodoh* _asep|udin_`, id)
hurtz.reply(from, mess.wait, id)
const quejodr = body.slice(14)
const jodr = `https://api.i-tech.id/tools/jodoh?key=ijmalalfafanajib&p1=${encodeURIComponent(quejodr.split('|')[0])}&p2=${encodeURIComponent(quejodr.split('|')[1])}`
const gettingjor = await get.get(jodr).json()
// console.log(gettingjor)
await hurtz.sendFileFromUrl(from, gettingjor.gambar, 'pirstlope.png', `*Hasil ramalan jodoh dari ${quejodr.split('|')[0]} dan ${quejodr.split('|')[1]}*\n\n*Sisi Positif* : ${gettingjor.sisi.positif}\n*Sisi Negatif* : ${gettingjor.sisi.negatif}`, id).catch((e) => console.log(e))
await hurtz.sendSeen(from)
} else if (command == '!search') {
if (!isGroupMsg) return hurtz.reply(from, menuPriv, id)
if (args.length === 1) return hurtz.reply(from, `Kirim perintah Google search dengan cara ketik perintah :\n*!search* _Query search_\nContoh :\n*!search* _Detik News hari ini_`, id)
hurtz.reply(from, mess.wait, id)
const googleQuery = body.slice(8)
if(googleQuery == undefined || googleQuery == ' ') return hurtz.reply(from, `_Kesalahan tidak bisa menemukan hasil dari ${googleQuery}_`, id)
google({ 'query': googleQuery }).then(results => {
//console.log(results)
let captserch = `_*Hasil Pencarian Google Dari ${googleQuery}*_\n`
for (let i = 0; i < results.length; i++) {
captserch += `\n*Judul* : ${results[i].title}\n*Deskripsi* : ${results[i].snippet}\n*Link* : ${results[i].link}\n`
}
//let vars = results[0]
hurtz.reply(from, captserch, id);
}).catch(e => {
console.log(e)
hurtz.sendText(ownerNumber, e);
})
await hurtz.sendSeen(from)
} else if (command == '!dmlist') {
hurtz.reply(from, `Free Fire
50 💎 Rp : 6.840
70 💎 Rp : 9.405
100 💎 Rp : 13.680
140 💎 Rp : 18.810
210 💎 Rp : 28.215
355 💎 Rp : 47.025
720 💎 Rp : 94.050
1075 💎 Rp : 141.075
1440 💎 Rp : 188.100
2000 💎 Rp : 256.500
Member mingguan : 28.500
Member bulanan : 114.000`, id)
} else if (command == '!qrcode') {
if (!isGroupMsg) return hurtz.reply(from, menuPriv, id)
if (args.length === 1) return hurtz.reply(from, `Kirim perintah create QR Code dengan cara ketik perintah :\n*!qrcode* _Ketik pesan_\nContoh :\n*!qrcode* _MRHRTZ@kali:~#_`, id)
const qrdata = body.slice(8)
try {
hurtz.reply(from, mess.wait, id)
await hurtz.sendFileFromUrl(from, `https://api.qrserver.com/v1/create-qr-code/?size=500x500&data=${qrdata}`, 'pictqr.png', `_Berhasil membuat kode QR ${pushname}_`).catch(err => console.log('[ERROR] send image'))
} catch (err) {
console.log(err)
await hurtz.reply(from, `_Mohon maaf tidak bisa memproses QR Code!_`, id)
}
await hurtz.sendSeen(from)
} else if (command == '!profil' || command == '!profile') {
if (!isGroupMsg) return hurtz.reply(from, menuPriv, id)
if (isLimit(serial)) return hurtz.reply(from, `_Hai ${pushname} Limit request anda sudah mencapai batas, Akan direset kembali setiap jam 9 dan gunakan seperlunya!_`, id)
console.log(isGroupAdmins)
if (isOwner) {
//const vipny = vip.includes(chat.id)
const biony = await hurtz.getStatus(sender.id)
const captets = `🖋️ *Nama* : ${pushname}\n\n🔖 *Bio* : ${biony.status}\n\n📜 *Jabatan* : Bot Owner 👑\n\n🔮 *Member VIP* : ${!isVIP(sender.id)}`
const pepe = await hurtz.getProfilePicFromServer(sender.id)
//console.log(!isVIP(sender.id)+chat.id+sender.id)
//console.log(message)
if (pepe == '' || pepe == undefined) {
await hurtz.sendFileFromUrl(from, 'https://encrypted-tbn0.gstatic.com/images?q=tbn%3AANd9GcTQcODjk7AcA4wb_9OLzoeAdpGwmkJqOYxEBA&usqp=CAU', 'profile.jpg', captets, id)
} else {
await hurtz.sendFileFromUrl(from, pepe, 'profile.jpg', captets, id)
}
} else if (isGroupAdmins) {
//const vipny = vip.includes(chat.id)
const biony = await hurtz.getStatus(sender.id)
const captets = `🖋️ *Nama* : ${pushname}\n\n🔖 *Bio* : ${biony.status}\n\n📜 *Jabatan* : Admin\n\n🔮 *Member VIP* : ${!isVIP(sender.id)}`
const pepe = await hurtz.getProfilePicFromServer(sender.id)
//console.log(!isVIP(sender.id)+chat.id+sender.id)
//console.log(message)
if (pepe == '' || pepe == undefined) {
await hurtz.sendFileFromUrl(from, 'https://encrypted-tbn0.gstatic.com/images?q=tbn%3AANd9GcTQcODjk7AcA4wb_9OLzoeAdpGwmkJqOYxEBA&usqp=CAU', 'profile.jpg', captets, id)
} else {
await hurtz.sendFileFromUrl(from, pepe, 'profile.jpg', captets, id)
}
} else if (!isGroupAdmins) {
//const vipny = vip.includes(chat.id)
const biony = await hurtz.getStatus(sender.id)
const captets = `🖋️ *Nama* : ${pushname}\n\n🔖 *Bio* : ${biony.status}\n\n📜 *Jabatan* : Member\n\n🔮 *Member VIP* : ${!isVIP(sender.id)}`
const pepe = await hurtz.getProfilePicFromServer(sender.id)
//console.log(!isVIP(sender.id)+chat.id+sender.id)
//console.log(message)
if (pepe == '' || pepe == undefined) {
await hurtz.sendFileFromUrl(from, 'https://encrypted-tbn0.gstatic.com/images?q=tbn%3AANd9GcTQcODjk7AcA4wb_9OLzoeAdpGwmkJqOYxEBA&usqp=CAU', 'profile.jpg', captets, id)
} else {
await hurtz.sendFileFromUrl(from, pepe, 'profile.jpg', captets, id)
}
}
await hurtz.sendSeen(from)
} else if (command == '!pembayaran') {
hurtz.reply(from, `ID:
Harga:
Pesanan:`, id)
} else if (command == '!bug') {
if (args.length === 1) return hurtz.reply(from, `Kirim laporan bug dengan cara ketik perintah :\n*!bug* _Ketik pesan_\nContoh :\n*!bug* _Bug di perintah !musik tolong fix_`, id)
const ygingin = body.slice(5)
await hurtz.sendText(ownerNumber, `*BUG!!!* :\n\n*From* ${pushname}\n*Grup* : ${name}\n*WA* : wa.me/${sender.id.replace('@c.us','')}\n*Content* : ${ygingin}\n*TimeStamp* : ${time}\n\n\n\n|${from}|${id}|`).then(() => hurtz.reply(from, `_[DONE] Laporan telah terkirim, mohon kirim laporan dengan jelas atau kami tidak akan menerima laporan tersebut sebagai bug!_`, id))
await hurtz.sendSeen(from)
} else if (command == '!sendbug') {
if (args.length === 1) return hurtz.reply(from, `Usage : [from, "MSG", id]`, id)
if (!isOwner) return hurtz.reply(from, 'Perintah ini hanya untuk Owner bot!', id)
if (!quotedMsg) return hurtz.reply(from, `Tag woeee`, id)
const perom = quotedMsg.body.split('|')
await hurtz.reply(perom[1], `*Pesan dari owner* : ${body.slice(9)}`, perom[2]).then(() => hurtz.reply(from, `Sukses balas chat bug!`, id))
.catch((err) => {
console.log(err)
hurtz.reply(from, `Gunakan format yang benar! [from, "message", id]`, id)
})
} else if (command == '!stikernobg') {
if (!isGroupMsg) return hurtz.reply(from, menuPriv, id)
// if (args.length === 1 && !isMedia || args.length === 1 && !quotedMsg) return hurtz.reply(from, `Kirim foto dengan caption *!stickernobg*`, id)
if (!isVIP) return hurtz.reply(from, `_Sepertinya anda bukan member vip._`, id)
if (isMedia && type === 'image') {
try {
var mediaData = await decryptMedia(message, uaOverride)
var imageBase64 = `data:${mimetype};base64,${mediaData.toString('base64')}`
var base64img = imageBase64
var outFile = './media/img/noBg.png' //5tHjBbPSh3gYoHD9rTqiVCa7 [ { title: 'Insufficient credits', code: 'insufficient_credits' } ]
var result = await removeBackgroundFromImageBase64({ base64img, apiKey: 'C5epTF1WmcV9CeGfAk6EUzbm', size: 'auto', type: 'auto', outFile })
await fs.writeFile(outFile, result.base64img)
await hurtz.sendImageAsSticker(from, `data:${mimetype};base64,${result.base64img}`)
} catch(err) {
console.log(err)
//hurtz.reply(from, `Maaf, Tidak dapat mengidentifikasi background! mungkin terlalu banyak warna.\n\n_Apabila anda terus melihat pesan ini meskipun gambar jelas mohon chat owner untuk di fix!_`, id)
}
} else if (quotedMsg && quotedMsg.type == 'image') {
hurtz.reply(from, `Maaf, media tidak terdeteksi! Kirim foto dengan caption *!stickernobg* bukan tag`, id)
} else {
hurtz.reply(from, `Kirim foto dengan caption *!stickernobg*`, id)
}
await hurtz.sendSeen(from)
} else if (command == '!stiker' || command == '!sticker') {
if (!isGroupMsg) return hurtz.reply(from, menuPriv, id)
if (isMedia && type === 'image') {
hurtz.reply(from, mess.wait, id)
const mediaDataa = await decryptMedia(message, uaOverride)
const filenamea = `./media/imgscale.${mimetype.split('/')[1]}`
await fs.writeFileSync(filenamea, mediaDataa)
const imageBase64a = `data:${mimetype};base64,${mediaDataa.toString('base64')}`
await hurtz.sendImageAsSticker(from, imageBase64a)
}
else if (quotedMsg && quotedMsg.type == 'image') {
hurtz.reply(from, mess.wait, id)
const mediaDataa = await decryptMedia(quotedMsg, uaOverride)
const imageBase64a = `data:${quotedMsg.mimetype};base64,${mediaDataa.toString('base64')}`
const filenamea = `./media/imgscale.${quotedMsg.mimetype.split('/')[1]}`
await fs.writeFileSync(filenamea, mediaDataa)
await hurtz.sendImageAsSticker(from, imageBase64a)
} else if (args.length === 2) {
const url = args[1]
if (url.match(isUrl)) {
await hurtz.sendStickerfromUrl(from, url, { method: 'get' })
.catch(err => console.log('Caught exception: ', err))
} else {
hurtz.reply(from, mess.error.Iv, id)
}
} else {
hurtz.reply(from, mess.error.St, id)
}
await hurtz.sendSeen(from)
} else if (command == '!toimage') {
if (!isGroupMsg) return hurtz.reply(from, menuPriv, id)
if (args.length === 2) return hurtz.reply(from, `Hai ${pushname} untuk menggunakan fitur sticker to image, mohon tag stiker! dan kirim pesan *!toimage*`, id)
if (quotedMsg) {
hurtz.reply(from, '_Mohon tunggu sedang mengkonversi stiker..._', id)
if( quotedMsg.type === 'sticker') {
mediaData = await decryptMedia(quotedMsg, uaOverride)
await hurtz.sendImage(from, `data:${quotedMsg.mimetype};base64,${mediaData.toString('base64')}`, `${pushname}.jpg`, `Sticker berhasil dikonversi! ${pushname}`)
} else {
hurtz.reply(from, `Hai ${pushname} sepertinya yang ada tag bukan stiker, untuk menggunakan fitur sticker to image, mohon tag stiker! dan kirim pesan *!toimage*`, id)
}
} else {
hurtz.reply(from, `Hai ${pushname} untuk menggunakan fitur sticker to image, mohon tag stiker! dan kirim pesan *!toimage*`, id)
}
await hurtz.sendSeen(from)
} else if (command == '!ssweb') {
if (!isGroupMsg) return hurtz.reply(from, menuPriv, id)
if (args.length === 1) return hurtz.reply(from, 'Kirim perintah *!ssweb* _Website yang akan discreenshot_')
try {
hurtz.reply(from, `_Sedang screenshot web..._`, id)
const urlssny = await get.get('https://api.haipbis.xyz/ssweb?url='+args[1]).json()
await hurtz.sendFileFromUrl(from, urlssny.result, `SS_dari_${args[1]}.jpg`, `Berhasil di screenshot ${pushname}`, id).catch(() => hurtz.reply(from, `Kesalahan saat mengakses dan ss web tersebut.`, id))
} catch (err){
console.log(err)
hurtz.reply(from, `Gagal screenshot web!`, id)
}
await hurtz.sendSeen(from)
} else if (command == '!read') {
if (!isGroupMsg) return hurtz.reply(from, menuPriv, id)
if (args.length === 1 || args.length > 2) return hurtz.reply(from, 'Kirim perintah *!read* _Id postingan DGC_', id)
try {
hurtz.reply(from, mess.wait, id)
const readDGC = await get.get(`http://deepgore-article-api.herokuapp.com/api/article/${args[1]}`).json()
const readArr = ` ☠️🇮🇩 *${readDGC.categories[0]}* 🇮🇩☠️\n\n*Judul* : ${readDGC.title}\n*Author* : ${readDGC.author}\n*Waktu Upload* : ${readDGC.published.replace('T',' ').split('.')[0]}\n\n\n${readDGC.content}`
await hurtz.sendFileFromUrl(from, readDGC.thumb, `thumb-dgc.png`, readArr, id)
} catch (e) {
console.log(e)
hurtz.reply(from, `Kesalahan, Periksa kembali ID read DGC Artikel!`)
}
} else if (command == '!dgcartikel' || command == '!artikeldgc') {
if (!isGroupMsg) return hurtz.reply(from, menuPriv, id)
if (args.length === 1 || args.length > 2) return hurtz.reply(from, 'Kirim perintah *!artikelDgc* _Halaman_', id)
try {
hurtz.reply(from, mess.wait, id)
const jsonDGC = await get.get(`http://deepgore-article-api.herokuapp.com/api/latest-update/${args[1]}`).json()
const { result } = jsonDGC
console.log(jsonDGC.all_pages)
let capTDC = ` ☠️🇮🇩 *ARTIKEL DGC* 🇮🇩☠️\n\n*Jumlah Postingan* : ${jsonDGC.all_post}\n*Jumlah Halaman* : ${jsonDGC.all_pages}\n`
for (var i = 0; i < result.length; i++) {
const iddgc = result[i].id
const titel = result[i].title
const publis = result[i].published
const updat = result[i].update
const kategor = result[i].category
const desc = result[i].tiny_text
const authh = result[i].author_post
capTDC += `\n===============================\n\n\n*Urutan* : ${i+1}\n*Judul* : ${titel}\n*Author* : ${authh}\n*Kategori* : ${kategor}\n*Perintah baca* : !read ${iddgc}\n*Published* : ${publis.replace('T',' ').split('.')[0]}\n*Sinopsis* : ${desc}\n`
}
capTDC += `\n===============================\n\n\n _Menampilkan ${args[1]} dari ${jsonDGC.all_pages} halaman_`
await hurtz.reply(from, capTDC, id)
// console.log(jsonDGC)
} catch (e) {
hurtz.reply(from, `Kesalahan! Cek kembali halaman yg tersedia.`, id)
console.log(e)
}
} else if (command == '!musik' || command == '!music') {
if (!isGroupMsg) return hurtz.reply(from, menuPriv, id)
if (args.length === 1) return hurtz.reply(from, 'Kirim perintah *!musik* _Judul lagu yang akan dicari_')
const quer = body.slice(7)
hurtz.reply(from, mess.wait, id)
try {
const jsonsercmu = await get.get(`https://api.vhtear.com/youtube?query=${encodeURIComponent(quer)}&apikey=botnolepbydandyproject`).json()
const { result } = await jsonsercmu
let berhitung = 1
let xixixi = `*Hasil pencarian dari ${quer}*\n\n_Note : Apabila kesusahan mengambil data id, untuk download musik tag pesan ini dan berikan perintah : *!getmusik urutan* contoh : *!getmusik 2*_\n`
for (let i = 0; i < result.length; i++) {
xixixi += `\n*Urutan* : ${berhitung+i}\n*Title* : ${result[i].title}\n*Channel* : ${result[i].channel}\n*Durasi* : ${result[i].duration}\n*Perintah download* : _!getmusik ${result[i].id}_\n`
}
xixixi += `\n\n`
for (let ii = 0; ii < result.length; ii++) {
xixixi += `(#)${result[ii].id}`
}
await hurtz.sendFileFromUrl(from, result[0].image, 'thumbserc.jpg', xixixi, id)
} catch (err){
console.log(err)
hurtz.reply(from, `_Kesalahan saat mencari judul lagu ${quer}_`, id)
}
await hurtz.sendSeen(from)
} else if (command == '!video' || command == '!vidio') {
if (!isGroupMsg) return hurtz.reply(from, menuPriv, id)
if (args.length === 1) return hurtz.reply(from, 'Kirim perintah *!video* _Judul video yang akan dicari_')
const querv = body.slice(7)
hurtz.reply(from, mess.wait, id)
try {
const jsonsercmuv = await get.get(`https://api.vhtear.com/youtube?query=${encodeURIComponent(querv)}&apikey=botnolepbydandyproject`).json()
const { result } = await jsonsercmuv
let xixixai = `*Hasil pencarian dari ${querv}*\n\n_Note : Apabila kesusahan mengambil data id, untuk download video tag pesan ini dan berikan perintah : *!getvideo urutan* contoh : *!getvideo 2*_\n`
for (let i = 0; i < result.length; i++) {
xixixai += `\n*Urutan* : ${i+1}\n*Title* : ${result[i].title}\n*Channel* : ${result[i].channel}\n*Durasi* : ${result[i].duration}\n*Perintah download* : _!getvideo ${result[i].id}_\n`
}
xixixai += `\n\n`
for (let ii = 0; ii < result.length; ii++) {
xixixai += `(#)${result[ii].id}`
}
await hurtz.sendFileFromUrl(from, result[0].image, 'thumbserc.jpg', xixixai, id)
} catch (err){
console.log(err)
}
await hurtz.sendSeen(from)
} else if (command == '') {
} else if (command == '') {
} else if (command == '') {
} else if (command == '') {
} else if (command == '') {
} else if (command == '') {
} else if (command == '') {
} else if (command == '') {
} else if (command == '') {
} else if (command == '') {
}
switch(command) {
case '!vidio':
case '!video':
case '!film':
if (!isGroupMsg) return hurtz.reply(from, menuPriv, id)
if (args.length === 1) return hurtz.reply(from, 'Kirim perintah *!video* _Judul video yang akan dicari_')
const querv = body.slice(7)
hurtz.reply(from, mess.wait, id)
try {
const jsonsercmuv = await get.get(`https://api.vhtear.com/youtube?query=${encodeURIComponent(querv)}&apikey=botnolepbydandyproject`).json()
const { result } = await jsonsercmuv
let xixixai = `*Hasil pencarian dari ${querv}*\n\n_Note : Apabila kesusahan mengambil data id, untuk download video tag pesan ini dan berikan perintah : *!getvideo urutan* contoh : *!getvideo 2*_\n`
for (let i = 0; i < result.length; i++) {
xixixai += `\n*Urutan* : ${i+1}\n*Title* : ${result[i].title}\n*Channel* : ${result[i].channel}\n*Durasi* : ${result[i].duration}\n*Perintah download* : _!getvideo ${result[i].id}_\n`
}
xixixai += `\n\n`
for (let ii = 0; ii < result.length; ii++) {
xixixai += `(#)${result[ii].id}`
}
await hurtz.sendFileFromUrl(from, result[0].image, 'thumbserc.jpg', xixixai, id)
} catch (err){
console.log(err)
}
await hurtz.sendSeen(from)
break
case '!playstore':
//https://api.vhtear.com/playstore?query=ff&apikey=botnolepbydandyproject
if (!isGroupMsg) return hurtz.reply(from, menuPriv, id)
if (args.length === 1) return hurtz.reply(from, 'Kirim perintah *!PlayStore* _Aplikasi/Games yang akan dicari_')
const keywotp = body.slice(11)
hurtz.reply(from, mess.wait, id)
try {
//hurtz.reply(from, '_Sedang mencari data..._', id)
const dataplay = await get.get(`https://api.vhtear.com/playstore?query=${keywotp}&apikey=botnolepbydandyproject`).json()
//console.log(dataplay)
let keluarplay = `*Menampilkan list app ${keywotp}*\n`
for (let i = 0; i < dataplay.result.length; i++) {
keluarplay += `\n*Nama* : ${dataplay.result[i].title}\n*Developer* : ${dataplay.result[i].developer}\n*Deskripsi* : ${dataplay.result[i].description}\n*Paket ID* : ${dataplay.result[i].app_id}\n*Harga* : ${dataplay.result[i].price}\n*Link App* : https://play.google.com${dataplay.result[i].url}\n`
}
await hurtz.sendFileFromUrl(from, dataplay.result[0].icon, `icon_app.webp`, keluarplay, id)
} catch (err){
console.log(err)
}
await hurtz.sendSeen(from)
break
case '!ytsearch':
case '!searchyt':
if (!isGroupMsg) return hurtz.reply(from, menuPriv, id)
if (args.length === 1) return hurtz.reply(from, 'Kirim perintah *!searchyt* _Channel/Title YT yang akan dicari_')
const keywot = body.slice(10)
hurtz.reply(from, mess.wait, id)
try {
//hurtz.reply(from, '_Sedang mencari data..._', id)
const jsonserc = await get.get(`https://api.vhtear.com/youtube?query=${encodeURIComponent(keywot)}&apikey=botnolepbydandyproject`).json()
// if (!response2.ok) throw new Error(`unexpected response ${response2.statusText}`)
// const jsonserc = await response2.json()
const { result } = await jsonserc
let xixixi = `*Hasil pencarian dari ${keywot}*\n`
for (let i = 0; i < result.length; i++) {
xixixi += `\n*Title* : ${result[i].title}\n*Channel* : ${result[i].channel}\n*URL* : ${result[i].urlyt}\n*Durasi* : ${result[i].duration}\n*Views* : ${result[i].views}\n`
}
await hurtz.sendFileFromUrl(from, result[0].image, 'thumbserc.jpg', xixixi, id)
} catch (err) {
console.log(err)
}
await hurtz.sendSeen(from)
break
case '!translate':
if (!isGroupMsg) return hurtz.reply(from, menuPriv, id)
if (args.length === 1) return hurtz.reply(from, `Penggunaan untuk translate teks\n\nPenggunaan 1 : *!translate [data bahasa] [teks yang akan ditranslate]* _(tanpa tag)_\nPenggunaan 2 : *!translate [data bahasa]* _(dengan tag)_\n\nContoh 1 : *!translate id hello how are you* _(tanpa tag)_\nContoh 2 : *!translate id* _(tag pesan yang akan ditranslate)_`, id)
//if (!quotedMsg) return hurtz.reply(from, 'Tag pesan yang akan ditranslate!', id)
if (quotedMsg) {
const dataTextReal = quotedMsg.type == 'chat' ? quotedMsg.body : quotedMsg.type == 'image' ? quotedMsg.caption : ''
const lang = args[1].toString()
const trans = async (dataText, lang) => {
console.log(`Translate text to ${lang}...`)
const result = await translate(dataTextReal, {
to: lang
})
.then((res) => hurtz.reply(from, res.text, id))
.catch((err) => hurtz.reply(from, `Sepertinya tidak ada data bahasa ${lang}\n\n${bahasa_list}`, id))
// console.log(result.data[0])
}
trans(dataTextReal, lang)
} else if (args.length >= 2) {
// !translate id
const dataTextManu = body.slice(13)
const lang = args[1].toString()
const trans = async (dataText, lang) => {
console.log(`Translate text to ${lang}...`)
const result = await translate(dataTextManu, {
to: lang
})
.then((res) => hurtz.reply(from, res.text, id))
.catch((err) => hurtz.reply(from, `Sepertinya tidak ada data bahasa ${lang}\n\n${bahasa_list}`, id))
// console.log(result.data[0])
}
trans(dataTextManu, lang)
} else {
hurtz.reply(from, `Kesalahan mentranslate`, id)
}
await hurtz.sendSeen(from)
break
case '!tostiker':
case '!tosticker':
//if (args.length === 1) return hurtz.reply(from, `Penggunaan teks to sticker : *!tosticker [Teks]*\n\nContoh : !tosticker bot ganteng`)
if (!isGroupMsg) return hurtz.reply(from, menuPriv, id)
if (isMedia && type === 'image' || quotedMsg && quotedMsg.type === 'image') return hurtz.reply(from, 'Fitur ini hanya untuk teks! bukan gambar.', id)
const texk = body.slice(10)
hurtz.reply(from, '_Sedang mengkonversi teks ke stiker..._', id)
//hurtz.reply(from, '_Fitur ini sedang down dikarenakan terlalu banyak request._', id)
try {
if (quotedMsgObj == null) {
if (args.length === 1) return hurtz.reply(from, `Mohon masukan teks setelah *!tostiker*\nContoh : *!tostiker Bot Ganz*`, id)
const GetData = await BikinTikel(texk)
//if (GetData.status == false) return hurtz.reply(from, 'Kesalahan dalam mengkonversi teks! tag tulisan atau gunakan teks setelah perintah *!tosticker [teks]*', id)
try {
await hurtz.sendImageAsSticker(from, GetData.result)
} catch (err) {
console.log(err)
}
} else {
const GetData = await BikinTikel(quotedMsgObj.body)
if (GetData.status == false) return hurtz.reply(from, 'Kesalahan dalam mengkonversi teks! tag tulisan atau gunakan teks setelah perintah *!tosticker [teks]*', id)
try {
await hurtz.sendImageAsSticker(from, GetData.result)
} catch (err) {
console.log(err)
}
}
} catch (err){
console.log(err)
hurtz.reply(from, `_Kesalahan! saat membuat stiker._`)
}
// try
// {
// const string = body.toLowerCase().includes('!ttp') ? body.slice(5) : body.slice(5)
// if(args)
// {
// if(quotedMsgObj == null)
// {
// const gasMake = await getStickerMaker(string)
// if(gasMake.status == true)
// {
// try{
// await hurtz.sendImageAsSticker(from, gasMake.base64)
// }catch(err) {
// await hurtz.reply(from, 'Gagal membuat.', id)
// }
// }else{
// await hurtz.reply(from, gasMake.reason, id)