-
Notifications
You must be signed in to change notification settings - Fork 14
/
curiosity.js
1286 lines (1120 loc) · 43.2 KB
/
curiosity.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
//Código elaborado por (https://github.com/AzamiJs)
const fs = require('fs')
const axios = require('axios')
const { exec, spawn, execSync } = require('child_process')
const speed = require('performance-now')
const chalk = require('chalk')
const yargs = require('yargs/yargs')
const _ = require('lodash')
const moment = require('moment')
const gradient = require('gradient-string')
const Jimp = require('jimp')
const path = require('path')
const fetch = require('node-fetch')
const { performance } = require('perf_hooks')
const osu = require('node-os-utils')
const PhoneNumber = require('awesome-phonenumber')
const yts = require('yt-search')
const ytdl = require('ytdl-core')
const FormData = require('form-data')
const { youtubedl, youtubedlv2 } = require('@bochilteam/scraper');
const { WA_DEFAULT_EPHEMERAL, getAggregateVotesInPollMessage, generateWAMessageFromContent, proto, generateWAMessageContent, generateWAMessage, prepareWAMessageMedia, downloadContentFromMessage, areJidsSameUser, getContentType } = require('@whiskeysockets/baileys')
const { smsg, getGroupAdmins, clockString, sleep, getBuffer, fetchJson, isUrl } = require('./lib/func')
require('./store.js')
const msgs = (message) => {
return message.length >= 10 ? message.substring(0, 500) : message
}
module.exports = client = async (client, m, mesaages, store) => {
try {
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.message.listResponseMessage && m.message.listResponseMessage.singleSelectReply.selectedRowId.startsWith('.') && m.message.listResponseMessage.singleSelectReply.selectedRowId) ? m.message.listResponseMessage.singleSelectReply.selectedRowId : (m.mtype == 'templateButtonReplyMessage') ? m.message.templateButtonReplyMessage.selectedId : (m.mtype === 'messageContextInfo') ? (m.message.buttonsResponseMessage?.selectedButtonId || m.message.listResponseMessage?.singleSelectReply.selectedRowId || m.text) : ''
var budy = (typeof m.text == 'string' ? m.text : '')
var prefix = prefa ? /^[°•π÷׶∆£¢€¥®™+✓_=|~!?@#$%^&.©^]/gi.test(body) ? body.match(/^[°•π÷׶∆£¢€¥®™+✓_=|~!?@#$%^&.©^]/gi)[0] : '' : prefa ?? global.prefix
const command = body.slice(prefix.length).trim().split(/\s+/)[0].toLowerCase()
const args = body.trim().split(/\s+/).slice(1)
const chatContent = (() => {
const messageTypes = { 'conversation': m.message.conversation, 'imageMessage': m.message.imageMessage?.caption, 'documentMessage': m.message.documentMessage?.caption, 'videoMessage': m.message.videoMessage?.caption, 'extendedTextMessage': m.message.extendedTextMessage?.text, 'buttonsResponseMessage': m.message.buttonsResponseMessage?.selectedButtonId, 'templateButtonReplyMessage': m.message.templateButtonReplyMessage?.selectedId, 'listResponseMessage': m.message.listResponseMessage?.singleSelectReply?.selectedRowId, 'messageContextInfo': m.message.listResponseMessage?.singleSelectReply?.selectedRowId }; return messageTypes[m.mtype] || '' })()
const pushname = m.pushName || 'Sin nombre'
const text = args.join(' ')
const q = args.join(" ")
const quoted = m.quoted || m
const mime = (quoted.msg || quoted).mimetype || ''
const isMedia = /image|video|sticker|audio/.test(mime)
const from = m.key.remoteJid
const isCreator = global.owner.some(([number]) => number.replace(/[^\d\s().+:]/g, '').replace(/\s/g, '') + '@s.whatsapp.net' === m.sender)
const isbot = await client.decodeJid(client.user.id)
const sender = m.isGroup ? (m.key.participant || m.participant) : m.key.remoteJid
const groupMetadata = m.isGroup ? await client.groupMetadata(from).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(isbot) : false
const isAdmins = m.isGroup ? groupAdmins.includes(m.sender) : false
const isAnti = true
const fkontak = { key: {participant: `[email protected]`, ...(m.chat ? { remoteJid: `[email protected]` } : {}) }, message: { 'contactMessage': { 'displayName': `${pushname}`, 'vcard': `BEGIN:VCARD\nVERSION:3.0\nN:XL;${pushname},;;;\nFN:${pushname},\nitem1.TEL;waid=${m.sender.split('@')[0]}:${m.sender.split('@')[0]}\nitem1.X-ABLabel:Ponsel\nEND:VCARD`, 'jpegThumbnail': null, thumbnail: null,sendEphemeral: true}}}
//Base de datos
let user = global.db.data.users[m.sender]
let chats = global.db.data.chats[m.chat]
let isNumber = x => typeof x === 'number' && !isNaN(x)
if (typeof user !== 'object') global.db.data.users[m.sender] = {}
if (user) {
if (!('lenguaje' in user)) user.lenguaje = 'es'
if (!('registered' in user)) user.registered = false
if (!user.registered) {
if (!('name' in user)) user.name = m.name
if (!isNumber(user.age)) user.age = -1
if (!isNumber(user.regTime)) user.regTime = -1
}
if (!isNumber(user.limit)) user.limit = 20
if(!isNumber(user.premium)) user.premium = false
} else global.db.data.users[m.sender] = { limit: 20 }
if (typeof chats !== 'object') global.db.data.chats[m.chat] = {}
if (chats) {
if (!('welcome' in chats)) chats.welcome = true
if (!('antilink' in chats)) chats.antilink = true
if (!('antifake' in chats)) chats.antifake = false
if (!('detect' in chats)) chats.detect = true
if (!('mute' in chats)) chats.mute = false
} else global.db.data.chats[m.chat] = {
welcome: true,
antilink: true,
antifake: false,
detect: true,
mute: false
}
global.mess = {
admin: 'Debes ser administrador para ejecutar esta función',
botAdmin: 'El bot debe ser administrador para ejecutar la función',
owner: 'Solo mi propietario puede hacer uso de este comando',
group: 'Esta función sólo funciona en chats grupales',
private: 'Esta función sólo funciona en chats privados',
wait: '`Cargando...`'
}
const link = 'https://whatsapp.com/channel/0029VaB4w2ZFHWpwgyEe3w2k'
const fotos = 'https://qu.ax/lFTW.jpeg'
const Title = wm
const Body = 'Zam'
if (m.message) {
const fecha = chalk.bold.magentaBright(`\nFecha: ${chalk.whiteBright(moment().format('DD/MM/YY HH:mm:ss'))}`)
const mensaje = chalk.bold.greenBright(`\nMensaje: ${chalk.whiteBright(msgs(m.text))}`)
const usuario = chalk.bold.blueBright(`\nUsuario: ${chalk.yellowBright(pushname)}`)
const remitente = chalk.bold.redBright(`\nRemitente: ${gradient('deepskyblue', 'darkorchid')(sender)}`)
const grupo = m.isGroup ? chalk.bold.cyanBright(`\nGrupo: ${chalk.greenBright(groupName)}\nID: ${gradient('violet', 'midnightblue')(from)}`) : chalk.bold.redBright('\nChat privado\n')
console.log(`${fecha}${mensaje}${usuario}${remitente}${grupo}`)
}
if (m.mtype === 'interactiveResponseMessage') {
let msg = m.message[m.mtype] || m.msg
if (msg.nativeFlowResponseMessage && !m.isBot ) {
let { id } = JSON.parse(msg.nativeFlowResponseMessage.paramsJson) || {}
if (id) {
let emit = {
key : { ...m.key } ,
message:{ extendedTextMessage : { text : id } } ,
pushName : m.pushName,
messageTimestamp : m.messageTimestamp || 754785898978
}
return client.ev.emit('messages.upsert', { messages : [ emit ] , type : 'notify'})
}}}
if (global.db.data.chats[m.chat].antilink && groupMetadata) {
let linksProhibidos = {
'telegram': /telegram\.me|t\.me/gi,
'facebook': /facebook\.com/gi,
'whatsapp': /chat\.whatsapp\.com/gi,
'youtube': /youtu\.be|youtube\.com/gi
}
function vl(mensaje, tiposEnlaces) {
for (let tipo of tiposEnlaces) {
if (mensaje.match(linksProhibidos[tipo])) {
return true
}
}
return false
}
let EnlacesProhibidos = ['whatsapp', 'telegram']
if (vl(m.text, EnlacesProhibidos)) {
if (!isBotAdmins) return m.reply('El bot no es admin, no puede eliminar intrusos')
let gclink = (`https://chat.whatsapp.com/` + await client.groupInviteCode(m.chat))
let isLinkThisGc = new RegExp(gclink, 'i')
let isgclink = isLinkThisGc.test(m.text)
if (isgclink) return client.sendMessage(m.chat, { text: `El enlace pertenece a *${groupName}*` }, { quoted: m })
if (isAdmins) return client.sendMessage(m.chat, { text: 'No puedo eliminar un administrador' }, { quoted: m })
await client.sendMessage(m.chat, { delete: { remoteJid: m.chat, fromMe: false, id: m.key.id, participant: m.key.participant } })
client.sendMessage(from, { text: `Anti Enlaces\n\n@${m.sender.split('@')[0]} mandaste un enlace prohibido`, contextInfo: { mentionedJid: [sender] } }, { quoted: m })
client.groupParticipantsUpdate(m.chat, [m.sender], 'remove')
}
}
if (global.db.data.chats[m.chat].antifake && !isAdmins) {
let forbidPrefixes = ['965', '966', '971', '974', '212', '213', '216', '44', '1', '62', '61', '64', '353', '33', '32', '41', '352', '377', '351', '244', '258', '91', '977', '880', '92', '94', '960', '7', '380', '375', '998', '996', '373', '374', '994', '992', '62', '49', '43', '39', '378', '379', '86', '886', '852', '853', '65', '850', '82', '93', '98', '48', '84', '856', '855', '254', '255', '256', '250', '257', '258', '252', '269', '243', '90', '998', '60', '222', '27', '265']
for (let prefix of forbidPrefixes) {
if (m.sender.startsWith(prefix)) {
await m.reply('*Anti Fakes* activo')
client.groupParticipantsUpdate(m.chat, [m.sender], 'remove')}}}
switch(prefix && command) {
case 'bypass': {
m.reply('`Comandos Fallando`\n\n- Imagen\n- Pinterest\n- Wallpaper\n- Wikipedia')
}
break
case 'traducir':
case 'translate':
case 'tr': {
const translate = require('@vitalets/google-translate-api')
let codesidioma = '🇲🇽 *Español:* es\n🏴 *Welsh:* cy\n🇻🇳 *Vietnamese:* vi\n🇹🇷 *Turkish:* tr\n🇹🇭 *Thai:* th\n🇰🇬 *Tamil:* ta\n🇸🇪 *Swedish:* sv\n🇰🇪 *Swahili:* sw\n🇸🇰 *Slovak:* sk\n🇷🇸 *Serbian:* sr\n🇷🇺 *Russian:* ru\n🇷🇴 *Romanian:* ro\n🇵🇹 *Portuguese:* pt\n🇵🇱 *Polish:* pl\n🇳🇴 *Norwegian:* no\n🇲🇰 *Macedonian:* mk\n🇱🇻 *Latvian:* lv\n🇻🇦 *Latin:* la\n🇰🇷 *Korean:* ko\n🇯🇵 *Japanese:* ja\n🇮🇹 *Italian:* it\n🇮🇩 *Indonesian:* id\n🇮🇸 *Icelandic:* is\n🇭🇺 *Hungarian:* hu\n🇮🇳 *Hindi:* hi\n🇭🇹 *Haitian Creole:* ht\n🇬🇷 *Greek:* el\n🇩🇪 *German:* de\n🇫🇷 *French:* fr\n🇫🇮 *Finnish:* fi\n🇨🇨 *Esperanto:* eo\n🇬🇧 *English:* en\n🇳🇱 *Dutch:* nl\n🇩🇰 *Danish:* da\n🇨🇿 *Czech:* cs\n🇭🇷 *Croatian:* hr\n🇨🇳 *Chinese:* zh\n🇲🇰 *Catalan:* ca\n🇦🇲 *Armenian:* hy\n🇦🇪 *Arabic:* ar\n🇦🇱 *Albanian:* sq\n🇿🇦 *Afrikaans:* af'
if (!args || !args[0]) {
return m.reply('Ingrese el *código* del idioma más el *texto* que desea traducir\n\n`Ejemplo`: .translate ru Hola, ¿cómo estás?')
}
let lang = args[0]
let text = args.slice(1).join(' ')
const defaultLang = 'es'
if ((args[0] || '').length !== 2) {
lang = defaultLang
text = args.join(' ')
m.reply('Se ha detectado que no has ingresado un *código* de *idioma* válido. Se usará el idioma predeterminado (Español).')
}
if (!text && m.quoted && m.quoted.text) text = m.quoted.text
try {
const result = await translate(`${text}`, {to: lang, autoCorrect: true})
await m.reply(`${result.text}`)
} catch {
try {
const lol = await fetch(`https://api.lolhuman.xyz/api/translate/auto/${lang}?apikey=${lolkey}&text=${text}`)
const loll = await lol.json()
const result2 = loll.result.translated
await m.reply(`${result2}`)
} catch (e) {
await m.reply('No se pudo realizar la traducción: ' + e)
}
}
}
break
case 'google':
case 'googleit': {
const google = require('google-it')
if (!text) {
return m.reply(`Ingrese algo *relevante* de lo que desea obtener *información*\n\n\`Ejemplo\`: ${prefix + command} Noticias n+`)
}
google({ 'query': text }).then(res => {
let teks = `\t\t\t\t\t\t\t *‹* Google Search‘s *›*\n\n`
res.forEach((g, index) => {
teks += `\`${index + 1}\`\n\n`
teks += `*· Título:* ${g.title}\n`
teks += `*· Descripción:* ${g.snippet}\n`
teks += `*· Enlace:* ${g.link}\n\n`
})
client.sendMessage(m.chat, { video: { url: 'https://qu.ax/cPnS.mp4' }, gifPlayback: true, caption: teks }, { quoted: m })
}).catch(err => {
m.reply('Ha ocurrido un error al realizar la búsqueda: ' + err)
})
break
}
case 'hd':
case 'remini':
case 'calidad': {
const FormData = require('form-data')
const Jimp = require('jimp')
let q = m.quoted ? m.quoted : m
let mime = (q.msg || q).mimetype || q.mediaType || ''
if (!mime) {
return m.reply(`Responde a una *imagen* usando este mismo *comando* (${prefix + command})`)
}
if (!/image\/(jpe?g|png)/.test(mime)) {
return m.reply(`Tipo de *media* no válida`)
}
m.reply('`Cargando Imágen`')
try {
let img = await q.download?.()
let pr = await remini(img, 'enhance')
client.sendMessage(m.chat, { image: pr, caption: `Calidad mejorada` }, { quoted: m, ephemeralExpiration: 24*60*100, disappearingMessagesInChat: 24*60*100 })
} catch (e) {
return m.reply('Ha ocurrido un error al intentar mejorar la calidad de la imagen: ' + e)
}
}
break
case 'ia':
case 'chatgpt': {
if (!text) {
return m.reply(`Ingrese lo que *desea* preguntar a *ChatGPT*\n\n\`Ejemplo\`: ${prefix + command} ¿Qué es la teología?`)
}
try {
client.sendPresenceUpdate('composing', from)
const res = await axios.get(`https://deliriusapi-official.vercel.app/ia/gptweb?text=${text}`)
await m.reply(res.data.gpt)
} catch (e) {
return m.reply('Ha ocurrido un error al solicitar su petición: ' + e)
}
}
break
case 'menu':
case 'help':
case 'allmenu': {
const texto = `Menu - Curiosity
┌ ◦ Información
│ ◦ ${prefix}sc
│ ◦ ${prefix}ping
│ ◦ ${prefix}speedtest
└ ◦ Información
┌ ◦ On Off
│ ◦ ${prefix}on
│ ◦ ${prefix}off
└ ◦ On Off
┌ ◦ Buscadores
│ ◦ ${prefix}google
│ ◦ ${prefix}ia
└ ◦ Buscadores
┌ ◦ Herramientas
│ ◦ ${prefix}hd
│ ◦ ${prefix}traducir
└ ◦ Herramientas
┌ ◦ Descargas
│ ◦ ${prefix}play
│ ◦ ${prefix}play audio
│ ◦ ${prefix}play video
│ ◦ ${prefix}play mp3doc
│ ◦ ${prefix}play mp4doc
│ ◦ ${prefix}gitclone
│ ◦ ${prefix}tiktok
│ ◦ ${prefix}facebook
│ ◦ ${prefix}instagram
│ ◦ ${prefix}slider
│ ◦ ${prefix}x
│ ◦ ${prefix}gdrive
└ ◦ Descargas
┌ ◦ Grupo
│ ◦ ${prefix}admins
│ ◦ ${prefix}grupo
│ ◦ ${prefix}demote
│ ◦ ${prefix}fantasmas
│ ◦ ${prefix}hidetag
│ ◦ ${prefix}kick
│ ◦ ${prefix}link
│ ◦ ${prefix}promote
│ ◦ ${prefix}tagall
└ ◦ Grupo
┌ ◦ Stickers
│ ◦ ${prefix}s
└ ◦ Stickers
┌ ◦ Propietario
│ ◦ ${prefix}update
│ ◦ ${prefix}restart
│ ◦ ${prefix}join
│ ◦ ${prefix}getcase
│ ◦ ${prefix}addcase
└ ◦ Propietario`
await client.sendMessage(m.chat, {text: texto, contextInfo: { forwardingScore: 999, isForwarded: true, forwardedNewsletterMessageInfo: { newsletterName: 'CuriosityBot', newsletterJid: "120363167110224268@newsletter", }, externalAdReply: { title: `© CuriosityBot-MD`, body: '', thumbnailUrl: 'https://qu.ax/lFTW.jpeg', sourceUrl: 'https://github.com/AzamiJs', mediaType: 1, renderLargerThumbnail: true }}}, {quoted: fkontak})
}
break
case 'ping': {
const girastamp = speed()
const latensi = speed() - girastamp
const _muptime = process.uptime() * 1000
const muptime = clockString(_muptime)
m.reply(`Tiempo de respuesta *${latensi.toFixed(4)}*\n\nTiempo de actividad *${muptime}*`)
}
break
case 'sc': case 'script': case 'git': {
try {
let res = await fetch('https://api.github.com/repos/AzamiJs/CuriosityBot-MD')
let json = await res.json()
let git = `*乂 Bot - Script*\n\n· *Nombre*: ${json.name}\n· *Visitantes*: ${json.watchers_count}\n· *Peso*: ${(json.size / 1024).toFixed(2)} MB\n· *Actualizado*: ${moment(json.updated_at).format('DD/MM/YY - HH:mm:ss')}\n· *Url* : ${json.html_url}\n\n ${json.forks_count} Forks · ${json.stargazers_count} Stars · ${json.open_issues_count} Issues`
await client.sendMessage(m.chat, {text: git, contextInfo: { forwardingScore: 999, isForwarded: true, forwardedNewsletterMessageInfo: { newsletterName: 'CuriosityBot', newsletterJid: "120363167110224268@newsletter", }, externalAdReply: { title: `© CuriosityBot-MD`, body: '', thumbnailUrl: 'https://qu.ax/lFTW.jpeg', sourceUrl: 'https://github.com/AzamiJs', mediaType: 1, renderLargerThumbnail: true }}}, {quoted: fkontak})
} catch (e) {
m.reply(e)
}
}
break
case 'speedtest': case 'speed': {
const cp = require('child_process')
const {promisify} = require('util')
const exec = promisify(cp.exec).bind(cp)
let o
m.reply('> Cargando... 🚀🚀🚀')
try {
o = await exec('python3 speed.py --secure --share')
const {stdout, stderr} = o;
if (stdout.trim()) {
const match = stdout.match(/http[^"]+\.png/)
const urlImagen = match ? match[0] : null
await client.sendMessage(m.chat, {image: {url: urlImagen}, caption: stdout.trim()}, {quoted: m})}
if (stderr.trim()) {
const match2 = stderr.match(/http[^"]+\.png/)
const urlImagen2 = match2 ? match2[0] : null
await client.sendMessage(m.chat, {image: {url: urlImagen2}, caption: stderr.trim()}, {quoted: m})
}} catch (e) {
o = e.message
return m.reply(o)
console.log(e)}}
break
case 'on':
case 'off': {
if (!m.isGroup) {
return m.reply(mess.group)
}
if (!isBotAdmins) {
return m.reply(mess.botAdmin)
}
if (!isAdmins) {
return m.reply(mess.admin)
}
if (!text) {
let txt = 'Seleccione una de las siguientes *configuraciones*'
let listSections = []
listSections.push({
title: '',
rows: [
{ header: '', title: '🟢| Activar Antilink', id: `.on antilink`, description: `` },
{ header: '', title: '🔴| Desactivar Antilink', id: `.off antilink`, description: `` },
{ header: '', title: '🟢| Activar Antifake', id: `.on antifake`, description: `` },
{ header: '', title: '🔴| Desactivar Antifake', id: `.off antifake`, description: `` },
{ header: '', title: '🟢| Activar Welcome', id: `.on welcome`, description: `` },
{ header: '', title: '🔴| Desactivar Welcome', id: `.off welcome`, description: `` }
]})
await client.sendList(m.chat, txt, null, `Configuraciones`, listSections, { mentions: [sender]}, { quoted: fkontak })
return
}
let setting = text.trim().toLowerCase()
switch (setting) {
case 'antilink':
if (command === 'on') {
if (db.data.chats[m.chat].antilink) {
return m.reply('La función *Antilink* ya está *activada*')
}
db.data.chats[m.chat].antilink = true
m.reply('La función *Antilink* fue *activada*')
} else if (command === 'off') {
if (!db.data.chats[m.chat].antilink) {
return m.reply('La función *Antilink* ya está *desactivada*')
}
db.data.chats[m.chat].antilink = false
m.reply('La función *Antilink* fue *desactivada*')
break
}
case 'antifake':
if (command === 'on') {
if (db.data.chats[m.chat].antifake) {
return m.reply('La función *Antifake* ya está *activada*')
}
db.data.chats[m.chat].antifake = true
m.reply('La función *Antifake* fue *activada*')
} else if (command === 'off') {
if (!db.data.chats[m.chat].antifake) {
return m.reply('La función *Antifake* ya está *desactivada*')
}
db.data.chats[m.chat].antifake = false
m.reply('La función *Antifake* ya está *desactivada*')
break
}
case 'welcome':
if (command === 'on') {
if (db.data.chats[m.chat].welcome) {
return m.reply('El *mensaje* de bienvenida ya está *activado*')
}
db.data.chats[m.chat].welcome = true
m.reply('*Mensaje* de bienvenida *activado*')
} else if (command === 'off') {
if (!db.data.chats[m.chat].welcome) {
return m.reply('El *mensaje* de bienvenida ya está *desactivado*')
}
db.data.chats[m.chat].welcome = false
m.reply('*Mensaje* de bienvenida *desactivado*')
break
}
default:
m.reply('Elije una opción correcta: `antilink`, `antifake`, `welcome`\n\n- .on welcome\n- .off welcome')
break
}
}
break
case 'play': {
const { youtubedl, youtubedlv2 } = require('@bochilteam/scraper')
const yts = require('yt-search')
const ytdl = require('ytdl-core')
if (!text) {
return m.reply('*Ingrese el título de un vídeo junto al tipo de media que desea recibir*\n\nEjemplo: `!play audio Those Eyes`\n\n> Tipos de media: `audio`, `video`, `mp3doc`, `mp4doc`')
}
const parts = text.split(' ')
const selection = parts.shift().toLowerCase()
const query = parts.join(' ')
try {
if (query.length === 0) {
return m.reply('Parece faltar el título del vídeo')
}
m.reply(mess.wait)
var search = await yts(query)
var videos = search.videos
if (videos.length === 0) {
return m.reply('No se encontraron videos para el término de búsqueda proporcionado')
}
const video = videos[0]
const url = video.url
let dl_url, mimeType, videoUrl
switch (selection) {
case 'audio': {
let c = '360' + 'p'
const audiodl = await youtubedl(url).catch(async _ => await youtubedlv2(url))
audioUrl = await audiodl.video[c].download()
const ytMsg = `\`YouTube - ${query}\`\n\nTítulo: *${video.title}*\nVistas: *${video.views}*\nDuración: *${video.timestamp}*\nEnlace: ${url}\nDescripción: ${video.description}\n\n> Enviando ${selection}`
await client.sendMessage(m.chat, { image: { url: `${video.thumbnail}` }, caption: ytMsg }, { quoted: m })
await client.sendMessage(m.chat, { audio: { url: audioUrl }, mimetype: 'audio/mpeg' }, { quoted: m })
break
}
case 'video': {
const videodl = await youtubedl(url).catch(async _ => await youtubedlv2(url))
videoUrl = await videodl.video['360p'].download()
const ytMsg = `\`YouTube - ${query}\`\n\nTítulo: *${video.title}*\nVistas: *${video.views}*\nDuración: *${video.timestamp}*\nEnlace: ${url}\nDescripción: ${video.description}\n\n> Enviando ${selection}`
await client.sendMessage(m.chat, { image: { url: `${video.thumbnail}` }, caption: ytMsg }, { quoted: m })
await client.sendMessage(m.chat, { video: { url: videoUrl }, caption: '`Video de YouTube`' }, { quoted: m })
break
}
case 'mp3doc': {
const mp3dl = await youtubedl(url).catch(async _ => await youtubedlv2(url))
mp3Url = await mp3dl.video['360p'].download()
const ytMsg = `\`YouTube - ${query}\`\n\nTítulo: *${video.title}*\nVistas: *${video.views}*\nDuración: *${video.timestamp}*\nEnlace: ${url}\nDescripción: ${video.description}\n\n> Enviando ${selection}`
await client.sendMessage(m.chat, { image: { url: `${video.thumbnail}` }, caption: ytMsg }, { quoted: m })
await client.sendMessage(m.chat, { document: {url: mp3Url}, mimetype: 'audio/mpeg', fileName: `${query}.mp3`}, {quoted: m})
break
}
case 'mp4doc': {
const mp4dl = await youtubedl(url).catch(async _ => await youtubedlv2(url))
mp4Url = await mp4dl.video['360p'].download()
const ytMsg = `\`YouTube - ${query}\`\n\nTítulo: *${video.title}*\nVistas: *${video.views}*\nDuración: *${video.timestamp}*\nEnlace: ${url}\nDescripción: ${video.description}\n\n> Enviando ${selection}`
await client.sendMessage(m.chat, { image: { url: `${video.thumbnail}` }, caption: ytMsg }, { quoted: m })
await client.sendMessage(m.chat, { document: {url: mp4Url}, mimetype: 'video/mp4', fileName: `${query}.mp4`}, {quoted: m})
break
}
default:
return m.reply('Tipo de media no válido. Usa `audio`, `video`, `mp3doc` o `mp4doc`.\n\n- .play audio Cardigan')
}
} catch (e) {
m.reply('Ocurrió un error al procesar su solicitud: ' + e)
console.error(e)
}
}
break
case 'gitclone': {
const fetch = require('node-fetch')
if (!args[0]) {
return m.reply('Ingrese el enlace de un *repositorio* de *GitHub*\n\n`Ejemplo`: .gitclone https://github.com/AzamiJs/CuriosityBot-MD')
}
if (!args[0].includes('github.com')) {
return m.reply('Enlace no válido. Compruebe el enlace')
}
m.reply(mess.wait)
try {
let regex1 = /(?:https|git)(?::\/\/|@)github\.com[\/:]([^\/:]+)\/(.+)/i
let [, user, repo] = args[0].match(regex1) || []
repo = repo.replace(/.git$/, '')
let urlGit = `https://api.github.com/repos/${user}/${repo}/zipball`
let filename = (await fetch(urlGit, { method: 'HEAD' })).headers.get('content-disposition').match(/attachment; filename=(.*)/)[1]
client.sendMessage(m.chat, { document: { url: urlGit }, fileName: filename+'.zip', mimetype: 'application/zip' }, { quoted: m }).catch((err) => m.reply('Ha ocurrido un error al intentar descargar sus archivos: ' + err))
} catch (e) {
return m.reply('Ha ocurrido un error al intentar descargar sus archivos: ' + e)
}
}
break
case 'tiktok': {
if (!text) {
return m.reply('Ingrese un *enlace* de vídeo de *TikTok*\n\n`Ejemplo`: .tiktok https://vm.tiktok.com/ZMrWSMM8r')
}
if (!text.includes('tiktok')) {
return m.reply('Enlace no válido. Compruebe la autenticidad del enlace')
}
try {
const tiktokData = await tiktokdl(text)
const txt = `*· Título:* ${tiktokData.data.title || 'Sin título'}
*· Subido:* ${tiktokData.data.create_time}
E S T A D O
*· Me gusta* – ${tiktokData.data.digg_count}
*· Comentarios* – ${tiktokData.data.comment_count}
*· Compartidas* – ${tiktokData.data.share_count}
*· Vistas* – ${tiktokData.data.play_count}
*· Descargas* – ${tiktokData.data.download_count}
*· Nombre:* ${tiktokData.data.author.nickname || 'Sin información del autor'}
\`${tiktokData.data.author.unique_id}\` - https://www.tiktok.com/@${tiktokData.data.author.unique_id}
*· Sonido:* ${tiktokData.data.music}\n`
const videoURL = tiktokData.data.play
client.sendMessage(m.chat, { caption: txt, video: { url: videoURL } }, { quoted: m })
} catch (e) {
m.reply('Error ' + e)
}
}
break
case 'facebook':
case 'fb': {
const fetch = require('node-fetch')
if (!text) {
return m.reply('Ingrese un enlace de un *reel* de *Facebook*\n\n`Ejemplo`: .fb https://www.facebook.com/share/r/GB9op9yMyNUmFVH2/?mibextid=V2iOCx')
}
if (!text.includes('facebook')) {
return m.reply('Enlace no válido. Compruebe el enlace')
}
m.reply(mess.wait)
try {
const data = await fetch(`https://lolhuman.xyz/api/facebook?apikey=${lolkey}&url=${text}`)
let video = await data.json()
let buff = await video.result[0]
const caption = `Video de Facebook`
await client.sendMessage(m.chat, { video: { url: buff }, mimetype: 'video/mp4', fileName: `video.mp4`, caption: caption, mentions: [m.sender], }, { quoted: m })
} catch (e) {
m.reply('Ha ocurrido un error al descargar su video: ' + e)
}
}
break
case 'instagram':
case 'ig': {
const fetch = require('node-fetch')
if (!text) {
return m.reply('Ingrese un enlace de un *reel* de *Instagram*\n\n`Ejemplo`: .ig https://www.instagram.com/reel/C8Z0mgHuD4d/?igsh=bzE0bGo0eHRxd2dx')
}
if (!text.includes('instagram')) {
return m.reply('Enlace no válido. Compruebe el enlace')
}
m.reply(mess.wait)
try {
const data = await fetch(`https://lolhuman.xyz/api/instagram?apikey=${lolkey}&url=${text}`)
let video = await data.json()
let buff = await video.result[0]
const caption = `Instagram 🍃`
await client.sendMessage(m.chat, { video: { url: buff }, mimetype: 'video/mp4', fileName: `video.mp4`, caption: caption, mentions: [m.sender], }, { quoted: m })
} catch (e) {
m.reply('Ha ocurrido un error al descargar su solicitud: ' + e)
}
}
break
case 'twiter':
case 'tw':
case 'x': {
const fg = require('api-dylux')
if (!text) {
return m.reply('Ingrese un *enlace* de *X*\n\n`Ejemplo`: .x https://twitter.com/fernandavasro/status/1569741835555291139?t=ADxk8P3Z3prq8USIZUqXCg&s=19')
}
try {
let { SD, HD, desc, thumb, audio } = await fg.twitter(text)
await client.sendMessage(m.chat, { video: { url: HD }, caption: `${desc}`}, { quoted: m })
} catch (e) {
m.reply('Ha ocurrido un error al descargar su video de x: ' + e)
console.log(e)
}
}
break
case 'tiktokimg':
case 'slider':
case 'ttimg': {
const fetch = require('node-fetch')
if (!text) {
return m.reply('Ingrese un enlace de *tiktok* que contenga *imágenes*\n\n`Ejemplo`: .slider https://vm.tiktok.com/ZMr7dg1co/')
}
if (!(text.includes('http://') || text.includes('https://'))) {
return m.reply(`Este enlace no contiene *http://* ni *https://*`)
}
if (!text.includes('tiktok.com')) {
return m.reply(`El enlace no es válido. Compruebe la autenticidad del enlace`)
}
m.reply(mess.wait)
try {
let res = await fetch(`https://api.lolhuman.xyz/api/tiktokslide?apikey=${lolkey}&url=${text}`)
let anu = await res.json()
if (anu.status != '200') throw Error(anu.message)
anu = anu.result
if (anu.length == 0) throw Error('Error: no data')
let c = 0
for (let x of anu) {
if (m.isGroup) {
if (c == 0) {
await client.sendMessage(m.chat, { image: { url: x }, caption: `*Se ha enviado 1 de ${anu.length} imágenes*\n_El resto se enviará al privado_` }, { quoted: m })
} else {
await client.sendMessage(m.sender, { image: { url: x } })
}
} else {
await client.sendMessage(m.chat, { image: { url: x } })
}
c += 1
}
} catch (e) {
console.log(e)
return m.reply(`Ha ocurrido un error al descargar sus imágenes: ` + e)
}
}
break
case 'gdrive':
case 'drive': {
const fg = require('api-dylux')
if (!text) {
return m.reply('Ingrese un *enlace* de *Drive*\n\n`Ejemplo`: .drive https://drive.google.com/file/d/1dmHlx1WTbH5yZoNa_ln325q5dxLn1QHU/view')
}
if (!text.includes('drive')) {
return m.reply('El enlace no es válido. Compruebe el enlace')
}
try {
let res = await fg.GDriveDl(text)
client.sendMessage(m.chat, { document: { url: res.downloadUrl }, fileName: res.fileName, mimetype: res.mimetype }, { quoted: m })
} catch (e) {
m.reply('Ha ocurrido un error al descargar su documento: ' + e)
}
}
break
case 'admins':
case 'admin': {
if (!m.isGroup) {
return m.reply(mess.group)
}
if (!text) {
return m.reply('Ingrese su *motivo* por el cual desea la presencia de *admins*')
}
if (text.length < 10) {
return m.reply('Parece un motivo corto')
}
const pp = await client.profilePictureUrl(m.chat, 'image').catch(_ => null) || 'https://qu.ax/OEgX.jpg'
const groupAdmins = participants.filter(p => p.admin)
const listaAdmins = groupAdmins.map((v, i) => `\`${i + 1}\` @${v.id.split('@')[0]}`).join('\n')
const owner = groupMetadata.owner || groupAdmins.find(p => p.admin === 'superadmin')?.id || m.chat.split`-`[0] + '@s.whatsapp.net'
let mensaje = args.join` `
let yo = `Mensaje: ${text}`
let texto = `${yo}
⚠️ Staff del grupo ⚠️
${listaAdmins}`.trim()
client.sendMessage(m.chat, { image: { url: pp }, caption: texto, mentions: [...groupAdmins.map(v => v.id), owner]}, { quoted: m })
}
break
case 'grupo':
case 'group':
case 'settings': {
if (!m.isGroup) {
return m.reply(mess.group)
}
if (!isBotAdmins) {
return m.reply(mess.botAdmin)
}
if (!isAdmins) {
return m.reply(mess.admin)
}
const isClose = { 'open': 'not_announcement', 'close': 'announcement', 'abierto': 'not_announcement', 'cerrado': 'announcement', 'abrir': 'not_announcement', 'cerrar': 'announcement', 'desbloquear': 'unlocked', 'bloquear': 'locked' }[(args[0] || '')]
if (isClose === undefined) {
return m.reply('*Seleccione una opción para configurar el grupo*\n\n`Ejemplo`:\n○ !grupo abrir\n○ !grupo cerrar\n○ !grupo bloquear\n○ !grupo desbloquear')
}
await client.groupSettingUpdate(m.chat, isClose)
{ m.reply('> Grupo configurado correctamente') }
}
break
case 'demote':
case 'degradar':
case 'quitaradmin': {
if (!m.isGroup) {
return m.reply(mess.group)
}
if (!isBotAdmins) {
return m.reply(mess.botAdmin)
}
if (!isAdmins) {
return m.reply(mess.admin)
}
if (isNaN(text) && !text.match(/@/g)){
} else if (isNaN(text)) {
var number = text.split`@`[1]
} else if (!isNaN(text)) {
var number = text
}
if (!text && !m.quoted) {
return m.reply('Etiquete al *administrador* que desea *degradar*')
}
if (number.length > 13 || (number.length < 11 && number.length > 0)) {
return m.reply('Número proporcionado incorrecto')
}
try {
if (text) {
var User = number + '@s.whatsapp.net'
} else if (m.quoted.sender) {
var User = m.quoted.sender
} else if (m.mentionedJid) {
var User = number + '@s.whatsapp.net'
}
} catch (e) {
} finally {
client.groupParticipantsUpdate(m.chat, [User], 'demote')
m.reply('> Degradado con éxito')
}
}
break
case 'fantasmas': {
const { areJidsSameUser } = require('@whiskeysockets/baileys')
if (!m.isGroup) {
return m.reply(mess.group)
}
if (!isAdmins) {
return m.reply(mess.admin)
}
let member = participants.map(u => u.id)
if (!text) {
var sum = member.length
} else {
var sum = text}
var total = 0
var sider = []
for (let i = 0; i < sum; i++) {
let users = m.isGroup ? participants.find(u => u.id == member[i]) : {}
if ((typeof global.db.data.users[member[i]] == 'undefined' || global.db.data.users[member[i]].chat == 0) && !users.isAdmin && !users.isSuperAdmin) {
if (typeof global.db.data.users[member[i]] !== 'undefined'){
if (global.db.data.users[member[i]].whitelist == false){
total++
sider.push(member[i])}
} else {
total++
sider.push(member[i])}}}
if (total == 0) {
return m.reply('Este grupo es activo')
}
client.sendMessage(m.chat, { text: `Lista de inactivos\n${sider.map(v => '· @' + v.replace(/@.+/, '')).join('\n')}`, mentions: sider })
}
break
case 'hidetag':
case 'notificar':
case 'tag': {
if (!m.isGroup) {
return m.reply(mess.group)
}
if (!isBotAdmins) {
return m.reply(mess.botAdmin)
}
if (!isAdmins) {
return m.reply(mess.admin)
}
if (!m.quoted && !text) {
return m.reply('Ingrese o responda a un *texto* para continuar')
}
try {
client.sendMessage(m.chat, { forward: m.quoted.fakeObj, mentions: participants.map(a => a.id) })
} catch {
client.sendMessage(m.chat, { text : text ? text : '' , mentions: participants.map(a => a.id)}, { quoted: null, ephemeralExpiration: 24*60*100, disappearingMessagesInChat: 24*60*100})}
}
break
case 'kick':
case 'kill':
case 'matar':
case 'sacar': {
if (!m.isGroup) {
return m.reply(mess.group)
}
if (!isBotAdmins) {
return m.reply(mess.botAdmin)
}
if (!isAdmins) {
return m.reply(mess.admin)
}
if (!m.mentionedJid[0] && !m.quoted) {
return m.reply('Etiqueta o responde al mensaje de la *persona* que quieres *eliminar*')
}
let user = m.mentionedJid[0] ? m.mentionedJid[0] : m.quoted.sender
const groupInfo = await client.groupMetadata(m.chat)
const ownerGroup = groupInfo.owner || m.chat.split`-`[0] + '@s.whatsapp.net'
const ownerBot = global.owner[0][0] + '@s.whatsapp.net'
if (user === client.user.jid) {
return m.reply('No puedo eliminar el *bot* del grupo')
}
if (user === ownerGroup) {
return m.reply('No puedo eliminar al *propietario* del grupo')
}
if (user === ownerBot) {
return m.reply('No puedo eliminar al *propietario* del bot')
}
await client.groupParticipantsUpdate(m.chat, [user], 'remove')
}
break
case 'link':
case 'enlace': {
if (!m.isGroup) {
return m.reply(mess.group)
}
if (!isBotAdmins) {
return m.reply(mess.botAdmin)
}
let group = m.chat
let linkk = 'https://chat.whatsapp.com/' + await client.groupInviteCode(group)
client.sendMessage(m.chat, {text: '🚩\v' + linkk }, {quoted: m }, { detectLink: true })
}
break
case 'promote':
case 'promover':
case 'daradmin': {
if (!m.isGroup) {
return m.reply(mess.group)
}
if (!isBotAdmins) {
return m.reply(mess.botAdmin)
}
if (!isAdmins) {
return m.reply(mess.admin)
}
if (isNaN(text) && !text.match(/@/g)){
} else if (isNaN(text)) {
var number = text.split`@`[1]
} else if (!isNaN(text)) {
var number = text
}
if (!text && !m.quoted) {
return m.reply('Etiquete al *usuario* que desea *promover*')
}
if (number.length > 13 || (number.length < 11 && number.length > 0)) {
return m.reply('Número proporcionado incorrecto')
}
try {
if (text) {
var User = number + '@s.whatsapp.net'
} else if (m.quoted.sender) {
var User = m.quoted.sender
} else if (m.mentionedJid) {