-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.js
2000 lines (1838 loc) · 87.4 KB
/
main.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
// Importaciones
const baileys = require('@whiskeysockets/baileys'); // trabajar a través de descargas por Whatsapp
const { WaMessageStubType, WA_DEFAULT_EPHEMERAL, BufferJSON, areJidsSameUser, downloadContentFromMessage, generateWAMessageContent, generateWAMessageFromContent, generateWAMessage, prepareWAMessageMedia, getContentType, relayMessage} = require('@whiskeysockets/baileys'); // Importa los objetos 'makeWASocket' y 'proto' desde el módulo '@whiskeysockets/baileys'
const { default: makeWASocket, proto } = require("@whiskeysockets/baileys")
const moment = require('moment-timezone') // Trabajar con fechas y horas en diferentes zonas horarias
const gradient = require('gradient-string') // Aplicar gradientes de color al texto
const { exec, spawn, execSync } = require("child_process")// Función 'execSync' del módulo 'child_process' para ejecutar comandos en el sistema operativo
const chalk = require('chalk') // Estilizar el texto en la consola
const os = require('os') // Proporciona información del sistema operativo
const fs = require('fs') // Trabajar con el sistema de archivos
const scp1 = require('./libs/scraper')
const fetch = require('node-fetch')
const axios = require('axios')
const {fileURLToPath} = require('url')
const cheerio = require('cheerio')
const yts = require('yt-search')
const gpt = require('api-dylux')
const util = require('util')
const createHash = require('crypto')
const mimetype = require("mime-types")
const ws = require('ws')
const JavaScriptObfuscator = require('javascript-obfuscator')
const webp = require("node-webpmux")
const Jimp = require('jimp')
const { File } = require("megajs")
const speed = require("performance-now")
const ffmpeg = require("fluent-ffmpeg")
const similarity = require('similarity')
const ytdl = require('ytdl-core')
const fg = require('api-dylux')
const {savefrom, lyrics, lyricsv2, youtubedl, youtubedlv2} = require('@bochilteam/scraper')
const translate = require('@vitalets/google-translate-api')
const { smsg, fetchBuffer, getBuffer, buffergif, getGroupAdmins, formatp, tanggal, formatDate, getTime, isUrl, sleep, clockString, runtime, fetchJson, jsonformat, delay, format, logic, generateProfilePicture, parseMention, getRandom, msToTime, downloadMediaMessage, convertirMsADiasHorasMinutosSegundos, pickRandom, getUserBio, asyncgetUserProfilePic} = require('./libs/fuctions')
const { ytmp4, ytmp3, ytplay, ytplayvid } = require('./libs/youtube')
const {sizeFormatter} = require('human-readable')
const formatSize = sizeFormatter({
std: 'JEDEC', decimalPlaces: 2, keepTrailingZeroes: false, render: (literal, symbol) => `${literal} ${symbol}B`});
const color = (text, color) => { // Función 'color' que toma un texto y un color como parámetros
return !color ? chalk.cyanBright(text) : color.startsWith('#') ? chalk.hex(color)(text) : chalk.keyword(color)(text)} // Si no hay color, utilizar el color celeste brillante (por defecto)
const msgs = (message) => {
if (message.length >= 10) {
return `${message.substr(0, 500)}`
} else {
return `${message}`}}
const getFileBuffer = async (mediakey, MediaType) => {
const stream = await downloadContentFromMessage(mediakey, MediaType)
let buffer = Buffer.from([])
for await(const chunk of stream) {
buffer = Buffer.concat([buffer, chunk]) }
return buffer
}
module.exports = conn = async (conn, m, chatUpdate, mek, store) => {
var budy = (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) : ''
//----------------------[ ATRIBUTOS ]-------------------------
if (m.key.id.startsWith("BAE5")) return
var body = (typeof m.text == 'string' ? m.text : '')
var prefix = /^[°•π÷׶∆£¢*€¥®™+✓_=|~!?@#$%^&.©^]/gi.test(body) ? body.match(/^[°•π÷׶∆£*¢€¥®™+✓_=|~!?@#$%^&.©^]/gi)[0] : ""
//var prefix = body.match(/^[/.*#]/)
const isCmd = body.startsWith(prefix)
const command = isCmd ? body.slice(1).trim().split(/ +/).shift().toLocaleLowerCase() : null
const args = body.trim().split(/ +/).slice(1)
const from = m.chat
const msg = JSON.parse(JSON.stringify(m, undefined, 2))
const content = JSON.stringify(m.message)
const type = m.mtype
let t = m.messageTimestamp
const pushname = m.pushName || "Sin nombre"
const botnm = conn.user.id.split(":")[0] + "@s.whatsapp.net"
const _isBot = conn.user.jid
const userSender = m.key.fromMe ? botnm : m.isGroup && m.key.participant.includes(":") ? m.key.participant.split(":")[0] + "@s.whatsapp.net" : m.key.remoteJid.includes(":") ? m.key.remoteJid.split(":")[0] + "@s.whatsapp.net" : m.key.fromMe ? botnm : m.isGroup ? m.key.participant : m.key.remoteJid
const isCreator = [conn.decodeJid(conn.user.id), ...global.owner.map(([numero]) => numero)].map((v) => v.replace(/[^0-9]/g, '') + '@s.whatsapp.net').includes(m.sender);
const isOwner = isCreator || m.fromMe;
const isMods = isOwner || global.mods.map((v) => v.replace(/[^0-9]/g, '') + '@s.whatsapp.net').includes(m.sender);
//const isCreator = global.owner.map(([numero]) => numero.replace(/[^\d\s().+:]/g, '').replace(/\s/g, '') + '@s.whatsapp.net').includes(userSender)
const itsMe = m.sender == conn.user.id ? true : false
const text = args.join(" ")
const q = args.join(" ")
const quoted = m.quoted ? m.quoted : m
const sender = m.key.fromMe ? botnm : m.isGroup ? m.key.participant : m.key.remoteJid
const delay = (ms) => new Promise((resolve) => setTimeout(resolve, ms))
const mime = (quoted.msg || quoted).mimetype || ''
const isMedia = /image|video|sticker|audio/.test(mime)
const mentions = []
if (m.message[type].contextInfo) {
if (m.message[type].contextInfo.mentionedJid) {
const msd = m.message[type].contextInfo.mentionedJid
for (let i = 0; i < msd.length; i++) {
mentions.push(msd[i])}}}
//----------------------[ FUNCION/GRUPO ]-------------------------
const groupMetadata = m.isGroup ? await conn.groupMetadata(from) : ''
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(botnm) : false
const isGroupAdmins = m.isGroup ? groupAdmins.includes(userSender) : false
const isBaneed = m.isGroup ? blockList.includes(userSender) : false
const isPremium = m.isGroup ? premium.includes(userSender) : false
const who = m.quoted ? m.quoted.sender : m.mentionedJid && m.mentionedJid[0] ? m.mentionedJid[0] : m.fromMe ? conn.user.jid : m.sender;
const thumb = 'https://telegra.ph/file/16a28106fa7c2109f3ff9.jpg'
let fkontak = { "key": { "participants":"[email protected]", "remoteJid": "status@broadcast", "fromMe": false, "id": "Halo" }, "message": { "contactMessage": { "vcard": `BEGIN:VCARD\nVERSION:3.0\nN:Sy;Bot;;;\nFN:y\nitem1.TEL;waid=${userSender.split('@')[0]}:${userSender.split('@')[0]}\nitem1.X-ABLabel:Ponsel\nEND:VCARD` }}, "participant": "[email protected]" }
const ftroli ={key: {fromMe: false,"participant":"[email protected]", "remoteJid": "status@broadcast"}, "message": {orderMessage: {itemCount: 2022,status: 200, thumbnail: thumb, surface: 200, message: "puta gata", orderTitle: "puto aiden me lo folle", sellerJid: '[email protected]'}}, contextInfo: {"forwardingScore":999,"isForwarded":true},sendEphemeral: true}
const fdoc = {key : {participant : '[email protected]', ...(from ? { remoteJid: `status@broadcast` } : {}) },message: {documentMessage: {title: "A", jpegThumbnail: null}}}//const fgif = {key: {participant: `[email protected]`, ...(m.chat ? { remoteJid: "status@broadcast" } : {})},message: {"videoMessage": { "title":botname, "h": wm,'seconds': '359996400', 'gifPlayback': 'true', 'caption': ownername, 'jpegThumbnail': thumb}}}
const kick = function (from, orangnya) {
for (let i of orangnya) {
conn.groupParticipantsUpdate(from, [i], "remove");
}}
const time = moment(Number(msg.messageTimestamp + "000")).locale("es-mx").tz("America/Asuncion").format('MMMM Do YYYY, h:mm:ss a')
const reply = (text) => {
m.reply(text)}
const sendAdMessage = (text, title, body, image, url) => { conn.sendMessage(m.chat, {text: text, contextInfo: { externalAdReply: { title: title, body: body, mediaUrl: url, sourceUrl: url, previewType: 'PHOTO', showAdAttribution: true, thumbnail: image, sourceUrl: url }}}, {})}
const sendImage = ( image, caption ) => { conn.sendMessage(m.chat, { image: image, caption: caption }, {quoted: m, ephemeralExpiration: 24*60*100, disappearingMessagesInChat: 24*60*100})}
const sendImageAsUrl = ( url, caption ) => { conn.sendMessage(m.chat, { image: {url: url }, caption: caption }, {quoted: m, ephemeralExpiration: 24*60*100, disappearingMessagesInChat: 24*60*100})}
//-------------[ TIPOS DE MENSAJES Y CITADOS ]----------------
const isAudio = type == 'audioMessage' // Mensaje de Audio
const isSticker = type == 'stickerMessage' // Mensaje de Sticker
const isContact = type == 'contactMessage' // Mensaje de Contacto
const isLocation = type == 'locationMessage' // Mensaje de Localización
const isQuotedImage = type === 'extendedTextMessage' && content.includes('imageMessage')
const isQuotedVideo = type === 'extendedTextMessage' && content.includes('videoMessage')
const isQuotedAudio = type === 'extendedTextMessage' && content.includes('audioMessage')
const isQuotedSticker = type === 'extendedTextMessage' && content.includes('stickerMessage')
const isQuotedDocument = type === 'extendedTextMessage' && content.includes('documentMessage')
const isQuotedMsg = type === 'extendedTextMessage' && content.includes('Message') // Mensaje citado de cualquier tipo
const isViewOnce = (type === 'viewOnceMessage') // Verifica si el tipo de mensaje es (mensaje de vista única)
//base de datos
let user = global.db.data.users[m.sender]
let chats = global.db.data.users[m.chat]
let setting = global.db.data.settings[conn.user.jid]
//--------------------[ AUTOBIO ]-----------------------
if (global.db.data.settings[numBot].autobio) {
let setting = global.db.data.settings[numBot]
if (new Date() * 1 - setting.status > 1000) {
let uptime = await runtime(process.uptime())
var timestamp = speed();
var latensi = speed() - timestamp
let bio = `🔰 ${botname} uso: ${conn.public ? 'Publico' : 'Privado'} | Uptime : ${runtime(process.uptime())} | User: ${Object.keys(global.db.data.users).length}`
try {
await conn.updateProfileStatus(bio)
//await delay(3 * 3000)
//await conn.updateProfilePicture(numBot, { url: "https://telegra.ph/file/84b0bad9adbbd5ed2b95e.jpg" })
setting.status = new Date() * 1
} catch {
console.log(`[𝚄𝙿𝙳𝙰𝚃𝙴]\n𝙿𝚒𝚗𝚐: ${latensi.toFixed(4)}`)
}}}
//autoread
if (m.message) {
conn.readMessages([m.key])}
//Marcar como (Escribiendo...)
/*if (command) {
await conn.sendPresenceUpdate('composing', m.chat)
}*///Para que le guste :v
//--------------------[ ANTIFAKES ]-----------------------
if (global.db.data.chats[m.chat].antifake && !isGroupAdmins) {
let forbidPrefixes = ["1", "994", "48", "43", "40", "41", "49"];
for (let prefix of forbidPrefixes) {
if (m.sender.startsWith(prefix)) {
m.reply(`${lenguaje['smsAntiFake']()}`, m.sender)
conn.groupParticipantsUpdate(m.chat, [m.sender], 'remove')}}}
if (global.db.data.chats[m.chat].antiarabe && !isGroupAdmins) {
let forbidPrefixes = ["212", "265", "234", "258", "263", "967", "20", "92", "91"];
for (let prefix of forbidPrefixes) {
if (m.sender.startsWith(prefix)) {
m.reply(`${lenguaje['smsAntiArabe']()}`, m.sender)
conn.groupParticipantsUpdate(m.chat, [m.sender], 'remove')}}}
//---------------------[ ANTIPRIVADO ]-----------------------
if (global.db.data.chats[m.chat].antiprivado && !isCreator) {
if (m.isBaileys && m.fromMe) return !0;
if (m.isGroup) return !1;
if (!m.message) return !0;
if (msg.text.toLowerCase().includes('staff') || msg.text.toLowerCase().includes('ayudar') || msg.text.toLowerCase().includes('estado') || msg.text.toLowerCase().includes('owner') || msg.text.toLowerCase().includes('infohost') || msg.text.toLowerCase().includes('grupos')) return !0 //comando a los que si responde el privado
const chat = global.db.data.chats[m.chat];
const bot = global.db.data.setting[numBot]
await conn.sendMessage(m.chat, {text: `${lenguaje['smsWel']()} @${sender.split`@`[0]} ${lenguaje['smsAntiPv']()}`, mentions: [sender], },{quoted: m})
await conn.updateBlockStatus(m.chat, 'block')
return !1;
}
//--------------------[ viewOnceMessage ]-----------------------
if (m.mtype == 'viewOnceMessageV2') {
if (global.db.data.chats[m.chat].viewonce) return
teks = `${lenguaje['viewOnce']()}`
let msg = m.message.viewOnceMessageV2.message
let type = Object.keys(msg)[0]
let media = await downloadContentFromMessage(msg[type], type == 'imageMessage' ? 'image' : 'video')
let buffer = Buffer.from([])
for await (const chunk of media) {
buffer = Buffer.concat([buffer, chunk])}
if (/video/.test(type)) {
return conn.sendFile(m.chat, buffer, 'error.mp4', `${msg[type].caption} ${teks}`, m)
} else if (/image/.test(type)) {
return conn.sendFile(m.chat, buffer, 'error.jpg', `${msg[type].caption} ${teks}`, m)
}}
//--------------------[ ANTILINK DE YOUTUBE ]-----------------------
if (global.db.data.chats[m.chat].AntiYoutube && !isCreator) {
if (budy.includes("https://youtu.be/") || budy.includes("https://youtube.com/")) {
if (isGroupAdmins) return reply(lenguaje['AntiLink3']())
if (!isBotAdmins) return m.reply(lenguaje['AntiLink4']())
if (m.key.fromMe) return
if (!isCreator) return
conn.sendMessage(m.chat, {text:`${lenguaje['AntiLink']()}\n@${sender.split("@")[0]} ${lenguaje['AntiLink2']()}`, mentions: [sender], },{quoted: m, ephemeralExpiration: 24*60*100, disappearingMessagesInChat: 24*60*100})
await conn.sendMessage(m.chat, { delete: { remoteJid: m.chat, fromMe: false, id: m.key.id, participant: m.key.participant }})
conn.groupParticipantsUpdate(m.chat, [m.sender], 'remove')
}}
//--------------------[ ANTILINK DE IG ]-----------------------
if (global.db.data.chats[m.chat].AntInstagram && !isCreator) {
if (budy.includes("https://www.instagram.com/")) {
if (isGroupAdmins) return reply(lenguaje['AntiLink3']())
if (!isBotAdmins) return m.reply(lenguaje['AntiLink4']())
if (m.key.fromMe) return
if (!isCreator) return
conn.sendMessage(m.chat, {text:`${lenguaje['AntiLink']()}\n@${sender.split("@")[0]} ${lenguaje['AntiLink2']()}`, mentions: [sender], },{quoted: m, ephemeralExpiration: 24*60*100, disappearingMessagesInChat: 24*60*100})
await conn.sendMessage(m.chat, { delete: { remoteJid: m.chat, fromMe: false, id: m.key.id, participant: m.key.participant }})
conn.groupParticipantsUpdate(m.chat, [m.sender], 'remove')
}}
//--------------------[ ANTILINK DE FACEBOOK ]-----------------------
if (global.db.data.chats[m.chat].AntiFacebook && !isCreator) {
if (budy.includes("https://facebook.com/")) {
if (isGroupAdmins) return reply(lenguaje['AntiLink3']())
if (!isBotAdmins) return m.reply(lenguaje['AntiLink4']())
if (m.key.fromMe) return
if (!isCreator) return
conn.sendMessage(m.chat, {text: `${lenguaje['AntiLink']()}\n@${sender.split("@")[0]} ${lenguaje['AntiLink2']()}`, mentions: [sender], },{quoted: m, ephemeralExpiration: 24*60*100, disappearingMessagesInChat: 24*60*100})
await conn.sendMessage(m.chat, { delete: { remoteJid: m.chat, fromMe: false, id: m.key.id, participant: m.key.participant }})
conn.groupParticipantsUpdate(m.chat, [m.sender], 'remove')
}}
//--------------------[ ANTILINK DE TELEGRAM ]-----------------------
if (global.db.data.chats[m.chat].AntiTelegram && !isCreator) {
if (budy.includes("https://t.me/")) {
if (isGroupAdmins) return reply(lenguaje['AntiLink3']())
if (!isBotAdmins) return m.reply(lenguaje['AntiLink4']())
if (m.key.fromMe) return
if (!isCreator) return
conn.sendMessage(m.chat, {text: `${lenguaje['AntiLink']()}\n@${sender.split("@")[0]} ${lenguaje['AntiLink2']()}`, mentions: [sender], },{quoted: m, ephemeralExpiration: 24*60*100, disappearingMessagesInChat: 24*60*100})
await conn.sendMessage(m.chat, { delete: { remoteJid: m.chat, fromMe: false, id: m.key.id, participant: m.key.participant }})
conn.groupParticipantsUpdate(m.chat, [m.sender], 'remove')
}}
//--------------------[ ANTILINK DE TIKTOK ]-----------------------
if (global.db.data.chats[m.chat].AntiTiktok && !isCreator) {
if (budy.match("https://www.tiktok.com/") || budy.match("https://vm.tiktok.com/")) {
//f (!isCreator) return m.reply(`Es mi creador Salvador`)
if (isGroupAdmins) return reply(lenguaje['AntiLink3']())
if (!isBotAdmins) return m.reply(lenguaje['AntiLink4']())
conn.sendMessage(m.chat, {text: `${lenguaje['AntiLink']()}\n@${sender.split("@")[0]} ${lenguaje['AntiLink2']()}`, mentions: [sender], },{quoted: m, ephemeralExpiration: 24*60*100, disappearingMessagesInChat: 24*60*100})
await conn.sendMessage(m.chat, { delete: { remoteJid: m.chat, fromMe: false, id: m.key.id, participant: m.key.participant }})
conn.groupParticipantsUpdate(m.chat, [m.sender], 'remove')
}}
//--------------------[ ANTILINK DE X (TWITER) ]-----------------------
if (global.db.data.chats[m.chat].AntiTwitter) {
if (budy.includes("https://twitter.com/")){
if (isGroupAdmins) return reply(lenguaje['AntiLink3']())
if (!isBotAdmins) return m.reply(lenguaje['AntiLink4']())
if (m.key.fromMe) return
if (!isCreator) return
conn.sendMessage(m.chat, {text: `${lenguaje['AntiLink']()}\n@${sender.split("@")[0]} ${lenguaje['AntiLink2']()}`, mentions: [sender], },{quoted: m, ephemeralExpiration: 24*60*100, disappearingMessagesInChat: 24*60*100})
await conn.sendMessage(m.chat, { delete: { remoteJid: m.chat, fromMe: false, id: m.key.id, participant: m.key.participant }})
conn.groupParticipantsUpdate(m.chat, [m.sender], 'remove')
}}
//-------[ ANTILINK2 (TODOS LOS ENLACES) ]------------
if (global.db.data.chats[m.chat].antiLink2 && !isCreator) {
if (budy.includes("https://")) {
if (isGroupAdmins) return reply(lenguaje['AntiLink3']())
if (!isBotAdmins) return m.reply(lenguaje['AntiLink4']())
if (m.key.fromMe) return
if (!isCreator) return
conn.sendMessage(m.chat, {text: `${lenguaje['AntiLink']()}\n@${sender.split("@")[0]} ${lenguaje['AntiLink2']()}`, mentions: [sender], },{quoted: m, ephemeralExpiration: 24*60*100, disappearingMessagesInChat: 24*60*100})
await conn.sendMessage(m.chat, { delete: { remoteJid: m.chat, fromMe: false, id: m.key.id, participant: m.key.participant }})
conn.groupParticipantsUpdate(m.chat, [m.sender], 'remove')
}}
//-----------------[ ANTILINK DE WHATSAPP ]---------------------
if (global.db.data.chats[m.chat].antilink) {
if (budy.match(`chat.whatsapp.com`)) {
const groupAdmins = participants.filter((p) => p.admin);
const listAdmin = groupAdmins.map((v, i) => `${i + 1}. @${v.id.split('@')[0]}`).join('\n➥ ');
let delet = m.key.participant
let bang = m.key.id
conn.sendMessage(m.chat, {text: `${lenguaje['AntiLink']()}\n@${sender.split("@")[0]} ${lenguaje['AntiLink2']()}`, mentions: [sender], },{quoted: m, ephemeralExpiration: 24*60*100, disappearingMessagesInChat: 24*60*100})
if (!isBotAdmins) return m.reply(lenguaje['AntiLink4']())
let gclink = (`https://chat.whatsapp.com/`+await conn.groupInviteCode(m.chat))
let isLinkThisGc = new RegExp(gclink, 'i')
let isgclink = isLinkThisGc.test(m.text)
if (isgclink) return
if (isGroupAdmins) return reply(lenguaje['AntiLink3']())
conn.sendMessage(m.chat, { delete: { remoteJid: m.chat, fromMe: false, id: bang, participant: delet }})
conn.groupParticipantsUpdate(m.chat, [m.sender], 'remove')}}
//--------------------[ ANTITOXIC ]-----------------------
if (global.db.data.chats[m.chat].antitoxic && !isCreator) {
if (budy.match(`g0re|g0r3|g.o.r.e|sap0|sap4|malparido|malparida|malparidos|malparidas|m4lp4rid0|m4lp4rido|m4lparido|malp4rido|m4lparid0|malp4rid0|chocha|chup4la|chup4l4|chupalo|chup4lo|chup4l0|chupal0|chupon|chupameesta|sabandija|hijodelagranputa|hijodeputa|hijadeputa|hijadelagranputa|kbron|kbrona|cajetuda|laconchadedios|putita|putito|put1t4|putit4|putit0|put1to|put1ta|pr0stitut4s|pr0stitutas|pr05titutas|pr0stitut45|prostitut45|prostituta5|pr0stitut45|fanax|f4nax|drogas|droga|dr0g4|nepe|p3ne|p3n3|pen3|p.e.n.e|pvt0|puto|pvto|put0|hijodelagransetentamilparesdeputa|Chingadamadre|coño|c0ño|coñ0|c0ñ0|afeminado|drog4|cocaína|marihuana|chocho|chocha|cagon|pedorro|agrandado|agrandada|pedorra|sape|nmms|mamar|chigadamadre|hijueputa|chupa|kaka|caca|bobo|boba|loco|loca|chupapolla|estupido|estupida|estupidos|polla|pollas|idiota|maricon|chucha|verga|vrga|naco|zorra|zorro|zorras|zorros|pito|huevon|huevona|huevones|rctmre|mrd|ctm|csm|cp|cepe|sepe|sepesito|cepecito|cepesito|hldv|ptm|baboso|babosa|babosos|babosas|feo|fea|feos|feas|webo|webos|mamawebos|chupame|bolas|qliao|imbecil|embeciles|kbrones|cabron|capullo|carajo|gore|gorre|gorreo|sapo|sapa|mierda|cerdo|cerda|puerco|puerca|perra|perro|joden|jodemos|dumb|fuck|shit|bullshit|cunt|cum|semen|bitch|motherfucker|foker|fucking`)) {
if (m.isBaileys && m.fromMe) {
return !0 }
if (!m.isGroup) {
return !1 }
if (isGroupAdmins) return
const user = global.db.data.users[m.sender];
const chat = global.db.data.chats[m.chat];
const bot = global.db.data.settings[conn.user.jid] || {};
const isToxic = budy.match;
user.warn += 1;
if (!(user.warn >= 4)) await conn.sendMessage(m.chat, {text: `${lenguaje['AntiToxic'](m, isToxic)}\n⚠️ *${user.warn}/4*\n\n${botname}`, mentions: [m.sender]}, {quoted: m})
if (user.warn >= 4) {
user.warn = 0;
await conn.sendMessage(m.chat, {text: `*@${m.sender.split('@')[0]} ${lenguaje['AntiToxic2']()}*`, mentions: [m.sender]}, {quoted: m})
user.banned = true
await conn.groupParticipantsUpdate(m.chat, [m.sender], 'remove')}
return !1;
}}
//--------------------[ MODO SELF ]-----------------------
if (!conn.public && !isCreator) {
if (!m.key.fromMe) return
}
//--------------------[ BANEAR EL CHAT ]-----------------------
if (global.db.data.chats[m.chat].ban && !isCreator) {
return
}
//--------------------[ MODO ADMINS ]-----------------------
if (global.db.data.chats[m.chat].modeadmin && !isGroupAdmins) {
return
}
//--------------------[ UPTIME ]-----------------------
//Tiempo de Actividad del bot
const used = process.memoryUsage()
const cpus = os.cpus().map(cpu => {
cpu.total = Object.keys(cpu.times).reduce((last, type) => last + cpu.times[type], 0)
return cpu
})
//conn.sendReadReceipt(from,sender,[m.key.id])
const cpu = cpus.reduce((last, cpu, _, { length }) => {
last.total += cpu.total
last.speed += cpu.speed / length
last.times.user += cpu.times.user
last.times.nice += cpu.times.nice
last.times.sys += cpu.times.sys
last.times.idle += cpu.times.idle
last.times.irq += cpu.times.irq
return last
}, {
speed: 0,
total: 0,
times: {
user: 0,
nice: 0,
sys: 0,
idle: 0,
irq: 0
}})
//---------------------[ MULTILENGUAJE ]------------------------
const { en, es, ar, id, pt, rs} = require('./libs/idiomas/total-idiomas.js')
if (user.Language == 'es') {
global.lenguaje = es
} else if (user.Language == 'en') {
global.lenguaje = en
} else if (user.Language == 'ar') {
global.lenguaje = ar
} else if (user.Language == 'id') {
global.lenguaje = id
} else if (user.Language == 'pt') {
global.lenguaje = pt
} else if (user.Language == 'rs') {
global.lenguaje = rs
} else {
global.lenguaje = es
}
// ‿︵‿︵ʚɞ『 INFO CONSOLE 』ʚɞ‿︵‿︵
if (m.message) {
console.log(chalk.bold.cyanBright(`╔═════════════════════∌\n║+${conn.user.jid.split`@`[0]} ➢ ${botname}`),
chalk.bold.magenta(`\n╠═════════════════════\n║⏰${lenguaje.consola.text} `) + chalk.magentaBright(moment(t * 1000).tz(place).format('DD/MM/YY HH:mm:ss'),
chalk.bold.red(`\n️║🏷️ ${lenguaje.consola.text1} `) + chalk.bold.white(`[${conn.public ? 'Publico' : 'Privado'}]`),
chalk.bold.yellow(`\n║📑${lenguaje.consola.text2} `) + chalk.yellowBright(`${type}`),
m.isGroup ? chalk.bold.greenBright(`\n║📤${lenguaje.consola.text4} `) + chalk.greenBright(groupName) + ' ➜ ' + gradient.rainbow(from) : chalk.bold.greenBright(`\n║📥${lenguaje.consola.text5}`, userSender),
chalk.bold.cyan(`\n║📊${lenguaje.consola.text3} `) + chalk.cyanBright(pushname) + ' ➜', gradient.rainbow(userSender),
chalk.bold.white(`\n║💬${lenguaje.consola.text6}`) + chalk.whiteBright(`\n╚═════════════════════⋊\n${msgs(m.text)}\n`))
)}
//----------------[ COMIENZA LA DIVISIÓN ]---------------------
switch (prefix && command) {
case 'yts': //Buscadores
if (global.db.data.users[m.sender].limit < 1) return m.reply(info.endLimit) //Sin se quedar sin límites, no puede usar este comando
if (!text) return reply(`*${lenguaje.sms.text}*\n${prefix + command} historia wa anime`)
const yts = require("youtube-yts");
const search = await yts(text);
//reply(info.wait)
const {key} = await conn.sendMessage(from, {text: info.wait}, { quoted: fkontak })
await conn.sendMessage(from, {text: info.waitt, edit: key}, { quoted: fkontak })
await conn.sendMessage(from, {text: info.waittt, edit: key}, { quoted: fkontak })
await conn.sendMessage(from, {text: info.waitttt, edit: key}, { quoted: fkontak })
let teks = `${lenguaje['result']()} ` + text + '\n\n';
let no = 1;
let themeemoji = "✨"
for (let i of search.all) {
teks += `[ ${no++} ]\n\n${themeemoji} ${lenguaje.sms.text1}: ${i.title}\n${themeemoji} ${lenguaje.sms.text2}: ${i.views}\n${themeemoji} ${lenguaje.sms.text3}: ${i.timestamp}\n${themeemoji} ${lenguaje.sms.text4}: ${i.ago}\n${themeemoji} URL: ${i.url}\n\n━━━━━━━━━━━━\n\n`;
}
await conn.sendMessage(from, { image: { url: search.all[0].thumbnail }, caption: teks }, { quoted: fkontak });
await conn.sendMessage(from, {text: info.result, edit: key}, { quoted: fkontak })
db.data.users[m.sender].limit -= 1 //aqui agregar la cantidad de cuanto diamante/limite quiere te gaste por comando ejemplo: 1 = 1 límite (diamante)
m.reply('1 ' + info.limit) //"opcional" si quiere te mande un texto de cuanto límite (diamante) has gastado el usuario
break
case 'google': {
if (!text) return reply(`*${lenguaje.sms.text}*\n${prefix + command} gata`)
let google = require('google-it')
google({'query': text}).then(res => {
let teks = `Google : ${text}\n\n`
for (let g of res) {
teks += `• *${lenguaje.sms.text1}* : ${g.title}\n`
teks += `• *${lenguaje.sms.text5}* : ${g.snippet}\n`
teks += `• *Link* : ${g.link}\n\n━━━━━━━━━━━━━━━━━━━━\n\n`
}
reply(teks)})
}
break
case 'imagen': {
if (global.db.data.users[m.sender].limit < 1) return m.reply(info.endLimit)
const {googleImage} = require('@bochilteam/scraper')
if (budy.includes('gore') || budy.includes('cp')|| budy.includes('porno')|| budy.includes('Gore')|| budy.includes('rule')|| budy.includes('CP') || budy.includes('Rule34') /*|| budy.includes('escribe la palabras aquí')*/) return m.reply(`😐 ${lenguaje.sms.text6}`); //puede agregar mas palabras cuales no quiere que Bot busqué como ese ejemplo
if (!text) return m.reply(`*${lenguaje.sms.text}*\n${prefix + command} gatito`)
try {
image = await fetchJson(`https://api.akuari.my.id/search/googleimage?query=${text}`)
n = image.result
images = n[Math.floor(Math.random() * n.length)]
conn.sendMessage(m.chat, { image: { url: images}, caption: `💫 ${lenguaje['result']()} ${text}`}, { quoted: m, ephemeralExpiration: 24*60*100, disappearingMessagesInChat: 24*60*100})
db.data.users[m.sender].limit -= 5
m.reply('5 ' + info.limit)
} catch {
try {
const res = await googleImage(text);
const image = res[Math.floor(Math.random() * res.length)]
const link = image;
conn.sendMessage(m.chat, { image: { url: link}, caption: `💫 ${lenguaje['result']()} ${text}`}, { quoted: m, ephemeralExpiration: 24*60*100, disappearingMessagesInChat: 24*60*100})
db.data.users[m.sender].limit -= 5
m.reply('5 ' + info.limit)
} catch (e) {
console.log(e)
}}}
break
//Herramientas
case 'traducir': case 'translate': case 'tr': {
const translate = require('@vitalets/google-translate-api')
if (!args || !args[0]) return m.reply(`*${lenguaje.sms.text}*\n${prefix + command} es hello`)
let lang = args[0];
let text = args.slice(1).join(' ');
const defaultLang = 'es';
if ((args[0] || '').length !== 2) {
lang = defaultLang;
text = args.join(' ');
}
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=${lolkeysapi}&text=${text}`);
const loll = await lol.json();
const result2 = loll.result.translated;
await m.reply(result2);
} catch {
await m.reply(info.error)
}}}
break
case 'ia': case 'chatgpt': {
if (!text) return conn.sendMessage(from, { text: `⚠️ ${lenguaje.sms.text7}\n• ${prefix + command} Recomienda un top 10 de películas de acción` }, { quoted: msg })
try {
await conn.sendPresenceUpdate('composing', m.chat)
let syst = `Eres InfinityBot-MD, un gran modelo de lenguaje entrenado por OpenAI. Siga cuidadosamente las instrucciones del usuario. Responde usando Markdown.`
let gpt = await fetch(global.API('fgmods', '/api/info/openai', { prompt: syst, text }, 'apikey'));
let res = await gpt.json()
await m.reply(res.result)
} catch {
try {
let gpt = await fetch(`https://delirius-api-oficial.vercel.app/api/chatgpt?q=${text}`);
let res = await gpt.json()
await m.reply(res.data)
} catch (e) {
console.log(e)}}}
break
case 'chatgpt2': case 'ia2': {
if (global.db.data.users[m.sender].limit < 1) return m.reply(info.endLimit)
if (!text) return conn.sendMessage(from, { text: `⚠️ ${lenguaje.sms.text7}\n• ${prefix + command} Recomienda un top 10 de películas de acción` }, { quoted: msg })
await conn.sendPresenceUpdate('composing', m.chat)
let gpt = await fetch(`https://delirius-api-oficial.vercel.app/api/ia2?text=${text}`);
let res = await gpt.json()
await m.reply(res.gpt)}
break
case 'gemini': {
if (global.db.data.users[m.sender].limit < 1) return m.reply(info.endLimit)
if (!text) return conn.sendMessage(from, { text: `⚠️ ${lenguaje.sms.text7}\n• ${prefix + command} Recomienda un top 10 de películas de acción` }, { quoted: msg })
try {
await conn.sendPresenceUpdate('composing', m.chat)
let gpt = await fetch(global.API('fgmods', '/api/info/gemini', { text }, 'apikey'));
let res = await gpt.json()
await m.reply(res.result)
} catch {
try {
let gpt = await fetch(`https://delirius-api-oficial.vercel.app/api/gemini?query=${text}`);
let res = await gpt.json()
await m.reply(res.message)
} catch (e) {
console.log(e)}}}
break
case 'copilot': case 'bing': {
if (global.db.data.users[m.sender].limit < 1) return m.reply(info.endLimit)
if (!text) return conn.sendMessage(from, { text: `⚠️ ${lenguaje.sms.text7}\n• ${prefix + command} Recomienda un top 10 de películas de acción` }, { quoted: msg })
await conn.sendPresenceUpdate('composing', m.chat)
let gpt = await fetch(`https://delirius-api-oficial.vercel.app/api/bingia?query=${text}`);
let res = await gpt.json()
await m.reply(res.message)}
break
case 'ss': case 'ssweb': {
if (global.db.data.users[m.sender].registered < true) return reply(info.registra)
if (!q) return reply(`*${lenguaje.sms.text}* ${prefix+command} link`)
let krt = await scp1.ssweb(q)
conn.sendMessage(from, {image:krt.result, caption: info.result}, {quoted:m})
db.data.users[m.sender].limit -= 5
m.reply('5 ' + info.limit)
}
break
//Información
case 'ping':
var timestamp = speed();
var latensi = speed() - timestamp
conn.sendMessage(from, { text: `*Pong 🏓 ${latensi.toFixed(4)}*` }, { quoted: msg, ephemeralExpiration: 24*60*100, disappearingMessagesInChat: 24*60*100})
break
case 'status': case 'estado': case 'velocidad': {
const { performance } = require('perf_hooks')
const osu = require('node-os-utils')
const used = process.memoryUsage()
const cpus = os.cpus().map(cpu => {
cpu.total = Object.keys(cpu.times).reduce((last, type) => last + cpu.times[type], 0)
return cpu
})
const cpu = cpus.reduce((last, cpu, _, { length }) => {
last.total += cpu.total
last.speed += cpu.speed / length
last.times.user += cpu.times.user
last.times.nice += cpu.times.nice
last.times.sys += cpu.times.sys
last.times.idle += cpu.times.idle
last.times.irq += cpu.times.irq
return last
}, {
speed: 0,
total: 0,
times: {
user: 0,
nice: 0,
sys: 0,
idle: 0,
irq: 0
}})
let timestamp = speed()
let latensi = speed() - timestamp
neww = performance.now()
oldd = performance.now()
const totalMemory = Math.round(os.totalmem() / (1024 * 1024 * 1024))
const freeMemory = Math.round(os.freemem() / (1024 * 1024 * 1024))
const usedMemory = totalMemory - freeMemory
const cpuUsage = os.loadavg()[0]
let respon = ` \`⧼⧼⧼ ${lenguaje.sms.text8} ⧽⧽⧽\`
> ${latensi.toFixed(4)} Seg
> ${oldd - neww} _milisegundos_
${lenguaje.sms.text9}
➢ ${lenguaje.sms.text10}: ${runtime(process.uptime())}
➢ ${lenguaje.sms.text11}: ${Object.entries(global.db.data.chats).filter(chat => chat[1].isBanned).length}
➢ ${lenguaje.sms.text12}: ${Object.entries(global.db.data.users).filter(user => user[1].banned).length}
➢ ${lenguaje.sms.text13}: ${Object.keys(global.db.data.users).length}
${lenguaje.sms.text14}
➢ ${lenguaje.sms.text15}: ${formatp(os.totalmem() - os.freemem())} / ${formatp(os.totalmem())}
➢ ${lenguaje.sms.text16} : ${os.platform()}
➢ ${lenguaje.sms.text17}: ${os.hostname()}
➢ ${lenguaje.sms.text18}: ${cpuUsage.toFixed(2)}%
➢ ${lenguaje.sms.text19}: ${totalMemory} GB
${lenguaje.sms.text20}
${Object.keys(used).map((key, _, arr) => `${key.padEnd(Math.max(...arr.map(v=>v.length)),' ')}: ${formatp(used[key])}`).join('\n')}
${cpus[0] ? `${lenguaje.sms.text21}
${cpus[0].model.trim()} (${cpu.speed} MHZ)\n${Object.keys(cpu.times).map(type => `- *${(type + '*').padEnd(6)}: ${(100 * cpu.times[type] / cpu.total).toFixed(2)}%`).join('\n')}
_Uso de núcleo(s) de CPU (${cpus.length} CPU central)_
${cpus.map((cpu, i) => `${i + 1}. ${cpu.model.trim()} (${cpu.speed} MHZ)\n${Object.keys(cpu.times).map(type => `- *${(type + '*').padEnd(6)}: ${(100 * cpu.times[type] / cpu.total).toFixed(2)}%`).join('\n')}`).join('\n\n')}` : ''}`.trim()//`
conn.sendFile(m.chat, imagen1, 'lp.jpg', respon, m, false, { contextInfo: { externalAdReply: {title: "𝘐𝘔𝘍𝘖𝘙𝘔𝘈𝘊𝘐𝘖𝘕 𝘈𝘊𝘌𝘙𝘊𝘈 𝘋𝘌𝘓 𝘉𝘖𝘛", body: "Click para entrar", sourceUrl: md, thumbnailUrl: imagen1 }}})}
break
case 'speedtest': case 'speed': {
const cp = require('child_process')
const {promisify} = require('util')
const exec = promisify(cp.exec).bind(cp);
let o;
conn.fakeReply(m.chat, `🚀 𝐏𝐫𝐮𝐞𝐛𝐚 𝐝𝐞 𝐯𝐞𝐥𝐨𝐜𝐢𝐝𝐚𝐝`, '[email protected]', 'test')
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 conn.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 conn.sendMessage(m.chat, {image: {url: urlImagen2}, caption: stderr.trim()}, {quoted: m});
}} catch (e) {
o = e.message;
return m.reply(o)
console.log(e)}}
break
//Gestión del Grupo
case 'setrules': case 'addrules': case 'addrule': {
let chat = global.db.data.chats[m.chat]
if (!text) return m.reply(`${lenguaje.sms.text22}`)
chat.rules = text
m.reply(`${lenguaje['exito']()}`)}
break
case 'reglas': case 'rule': case 'rules': {
let chat = global.db.data.chats[m.chat]
if (!chat.rules === '') m.reply(`*Sin reglas*`)
m.reply(`${chat.rules}`)}
break
case 'grupo':
if (!m.isGroup) return reply(info.group);
if (!isBotAdmins) return reply(info.botAdmin)
if (!isGroupAdmins) return reply(info.admin)
if (!text) return reply(`${lenguaje.sms.text23}\n*${prefix + command} abrir*\n*${prefix + command} cerrar*`)
if (args[0] === 'abrir') {
m.reply(`${lenguaje.sms.text24}`)
await conn.groupSettingUpdate(from, 'not_announcement')
} else if (args[0] === 'cerrar') {
m.reply(`${lenguaje.sms.text25}`)
await conn.groupSettingUpdate(from, 'announcement')
}
break
case 'delete': case 'del': {
if (!m.quoted) throw false
if (!isBotAdmins) return reply(info.botAdmin)
//if (!isGroupAdmins) return reply(info.admin)
let { chat, fromMe, id} = m.quoted
let delet = m.message.extendedTextMessage.contextInfo.participant
let bang = m.message.extendedTextMessage.contextInfo.stanzaId
return conn.sendMessage(m.chat, { delete: { remoteJid: m.chat, fromMe: false, id: bang, participant: delet }})}
break
case 'hidetag': case 'notificar': case 'tag': {
if (!m.isGroup) return m.reply(info.group)
if (!isGroupAdmins) return m.reply(info.admin)
if (!m.quoted && !text) return m.reply(`*${lenguaje.sms.text26}*`)
try {
conn.sendMessage(m.chat, { forward: m.quoted.fakeObj, mentions: participants.map(a => a.id) })
} catch {
conn.sendMessage(m.chat, { text : text ? text : '' , mentions: participants.map(a => a.id)}, { quoted: m, ephemeralExpiration: 24*60*100, disappearingMessagesInChat: 24*60*100})}}
break
case 'tagall': {
if (!m.isGroup) return reply(info.group)
if (!isBotAdmins) return reply(info.botAdmin)
if (!isGroupAdmins) return reply(info.admin)
let teks = `❑ ━〔 *📢 𝙸𝙽𝚅𝙾𝙲𝙰𝙲𝙸𝙾𝙽 📢* 〕━ ❑\n\n`
teks += `❑ 𝙼𝙴𝙽𝚂𝙰𝙹𝙴: ${q ? q : 'Sin mensaje'}\n\n`
for (let mem of participants) {
teks += `➥ @${mem.id.split('@')[0]}\n`
}
conn.sendMessage(m.chat, { text: teks, mentions: participants.map(a => a.id) }, { quoted: m })}
break
case 'setppname': case 'nuevonombre': case 'newnombre': {
if (!m.isGroup) return reply(info.group)
if (!isBotAdmins) return reply(info.botAdmin)
if (!isGroupAdmins) return reply(info.admin)
if (!text) return reply(`*${lenguaje.sms.text26}*`)
await conn.groupUpdateSubject(m.chat, text)
}
break
case 'setdesc': case 'descripción': {
if (!m.isGroup) return reply(info.group)
if (!isBotAdmins) return reply(info.botAdmin)
if (!isGroupAdmins) return reply(info.admin)
if (!text) return reply(`${lenguaje.sms.text26}`)
await conn.groupUpdateDescription(m.chat, text)
}
break
case 'setppgroup': case 'setpp': {
if (!m.isGroup) return reply(info.group)
if (!isBotAdmins) return reply(info.botAdmin)
if (!isGroupAdmins) return reply(info.admin)
if (!quoted) return reply(`*${lenguaje.sms.text27}*`)
if (!/image/.test(mime)) return reply(`*${lenguaje.sms.text27}*`)
if (/webp/.test(mime)) return reply(`*${lenguaje.sms.text27}*`)
var mediz = await conn. downloadAndSaveMediaMessage(quoted, 'ppgc.jpeg')
if (args[0] == `full`) {
var { img } = await generateProfilePicture(mediz)
await conn.query({tag: 'iq', attrs: {to: m.chat, type:'set', xmlns: 'w:profile:picture' }, content: [ {tag: 'picture', attrs: { type: 'image' }, content: img } ]})
fs.unlinkSync(mediz)
} else {
var memeg = await conn.updateProfilePicture(m.chat, { url: mediz })
fs.unlinkSync(mediz)
}}
break
case 'kick': {
if (!m.isGroup) return m.reply(info.group)
if (!isBotAdmins) return m.reply(info.botAdmin)
if (!isGroupAdmins) return m.reply(info.admin)
const kicktext = `Etiqueta a alguien boludo`;
if (!m.mentionedJid[0] && !m.quoted) return m.reply(kicktext, m.chat, {mentions: conn.parseMention(kicktext)});
if (m.mentionedJid.includes(conn.user.jid)) return;
const user = m.mentionedJid[0] ? m.mentionedJid[0] : m.quoted.sender;
const owr = m.chat.split`-`[0];
await conn.groupParticipantsUpdate(m.chat, [user], 'remove')}
break
case 'link': case 'linkgc': {
if (!m.isGroup) return reply(info.group)
if (!isBotAdmins) return reply(info.botAdmin)
let response = await conn. groupInviteCode(m.chat)
conn.sendText(m.chat, `https://chat.whatsapp.com/${response}`, m, { detectLink: true })}
break
case 'promote': {
if (!m.isGroup) return reply(info.group)
if (!isBotAdmins) return reply(info.botAdmin)
if (!isGroupAdmins) return reply(info.admin)
let users = m.mentionedJid[0] ? m.mentionedJid[0] : m.quoted ? m.quoted.sender : text.replace(/[^0-9]/g, '')+'@s.whatsapp.net'
await conn.groupParticipantsUpdate(m.chat, [users], 'promote').then((res) => reply(jsonformat(res))).catch((err) => reply(jsonformat(err)))
}
break
case 'demote': {
if (!m.isGroup) return reply(info.group)
if (!isBotAdmins) return reply(info.botAdmin)
if (!isGroupAdmins) return reply(info.admin)
let users = m.mentionedJid[0] ? m.mentionedJid[0] : m.quoted ? m.quoted.sender : text.replace(/[^0-9]/g, '')+'@s.whatsapp.net'
await conn.groupParticipantsUpdate(m.chat, [users], 'demote').then((res) => reply(jsonformat(res))).catch((err) => reply(jsonformat(err)))
}
break
//Descarga
case 'play': {
if (global.db.data.users[m.sender].registered < true) return reply(info.registra)
if (!text) return conn.sendMessage(from, { text: `*🚩 ${lenguaje.sms.text}*\n${prefix + command} ozuna` }, { quoted: msg })
let yts = require("youtube-yts")
let search = await yts(text)
let anup3k = search.videos[0]
let anu = search.videos[Math.floor(Math.random() * search.videos.length)]
eek = await getBuffer(anu.thumbnail)
conn.sendMessage(from, { image : eek, caption: `↻ ◁ II ▷ ↺
${anu.title}
ᴠᴏʟᴜᴍᴇ : ▮▮▮▮▮▮▯▯▯` }, { quoted: m})
const playmp3 = require('./libs/ytdl2')
const pl= await playmp3.mp3(anup3k.url)
await conn.sendMessage(from, { audio: fs.readFileSync(pl.path), fileName: `error.mp3`, mimetype: 'audio/mp4' }, { quoted: m });
await fs.unlinkSync(pl.path)
db.data.users[m.sender].limit -= 5
m.reply('5 ' + info.limit)
}
break
case 'play2': {
if (global.db.data.users[m.sender].limit < 1) return m.reply(info.endLimit)
let yts = require("youtube-yts")
if (!text) return m.reply(`*🚩 ${lenguaje.sms.text}*\n${prefix + command} ozuna`)
m.react(rwait)
let vid = (await yts(text)).all[0]
const yt_play = await search(args.join(" "))
let { title, description, url, thumbnail, videoId, timestamp, views, published } = vid
//let message = await
conn.sendMessage(from, { image : thumbnail, caption: `↻ ◁ II ▷ ↺
${yt_play[0].title}
ᴠᴏʟᴜᴍᴇ : ▮▮▮▮▮▮▯▯▯` }, { quoted: m})
try {
const qu = '360';
const q = qu + 'p';
const v = yt_play[0].url;
const yt = await youtubedl(v).catch(async (_) => await youtubedlv2(v));
const dl_url = await yt.video[q].download();
const ttl = await yt.title;
const size = await yt.video[q].fileSizeH;
await await conn.sendMessage(m.chat, {video: {url: dl_url}, fileName: `${ttl}.mp4`, mimetype: 'video/mp4', caption: `${ttl}`, thumbnail: await fetch(yt.thumbnail)}, {quoted: m, ephemeralExpiration: 24*60*100, disappearingMessagesInChat: 24*60*100});
m.react(done)
db.data.users[m.sender].limit -= 5
m.reply('5 ' + info.limit)
} catch {
try {
let chat = global.db.data.chats[m.chat]
let res = await yts(text)
//let vid = res.all.find(video => video.seconds < 3600)
let vid = res.videos[0]
if (!vid) return `⚠️ Vídeo no encontrado`
let isVideo = /vid$/.test(command)
let q = isVideo ? '360p' : '128kbps'
let yt = await (isVideo ? fg.ytv : fg.yta)(vid.url, q)
let { title, dl_url, quality, size, sizeB } = yt
let isLimit = limit * 1024 < sizeB
if (!isLimit) conn.sendMessage(m.chat, { video: { url: dl_url }, mimetype: 'video/mp4', asDocument: chat.useDocument }, { quoted: m})
db.data.users[m.sender].limit -= 3
m.reply('3 ' + info.limit)
m.react(done)
} catch {
try {
const mediaa = await ytMp4(yt_play[0].url);
await await conn.sendMessage(m.chat, {video: {url: dl_url}, caption: wm, mimetype: 'video/mp4', fileName: ttl + `.mp4`}, {quoted: m, ephemeralExpiration: 24*60*100, disappearingMessagesInChat: 24*60*100});
} catch {
try {
const lolhuman = await fetch(`https://api.lolhuman.xyz/api/ytvideo2?apikey=${lolkeysapi}&url=${yt_play[0].url}`);
const lolh = await lolhuman.json();
const n = lolh.result.title || 'error';
const n2 = lolh.result.link;
const n3 = lolh.result.size;
const n4 = lolh.result.thumbnail;
await conn.sendMessage(m.chat, {video: {url: n2}, fileName: `${n}.mp4`, mimetype: 'video/mp4', caption: `${n}`, thumbnail: await fetch(n4)}, {quoted: m, ephemeralExpiration: 24*60*100, disappearingMessagesInChat: 24*60*100});
m.react(done)
db.data.users[m.sender].limit -= 5
m.reply('5 ' + info.limit)
} catch (e) {
m.react(error)
return m.reply(info.error)
console.log(e)}}}}}
break
case 'play3': case 'playdoc': case 'ytmp3doc': {
if (global.db.data.users[m.sender].limit < 1) return m.reply(info.endLimit)
if (!text) return m.reply(`*${lenguaje.sms.text}*\n*${prefix + command}* ozuna\n*${prefix + command}* https://youtu.be/7ouFkoU8Ap8?si=Bvm3LypvU_uGv0bw`)
try {
m.react(rwait)
let vid = (await yts(text)).all[0]
const yt_play = await search(args.join(" "))
let { title, description, url, thumbnail, videoId, timestamp, views, published } = vid
m.reply(`*Descarga sus audio ${yt_play[0].title} en documentos espere un momento....*`)
const q = '128kbps';
const v = yt_play[0].url;
const yt = await youtubedl(v).catch(async (_) => await youtubedlv2(v));
const dl_url = await yt.audio[q].download();
const ttl = await yt.title;
const size = await yt.audio[q].fileSizeH;
await conn.sendMessage(m.chat, {document: {url: dl_url}, mimetype: 'audio/mpeg', fileName: `${ttl}.mp3`}, {quoted: m, ephemeralExpiration: 24*60*100, disappearingMessagesInChat: 24*60*100});
m.react(done)
db.data.users[m.sender].limit -= 3
m.reply('3 ' + info.limit)
} catch {
try {
const lolhuman = await fetch(`https://api.lolhuman.xyz/api/ytaudio2?apikey=${lolkeysapi}&url=${yt_play[0].url}`);
const lolh = await lolhuman.json();
const n = lolh.result.title || 'error';
await conn.sendMessage(m.chat, {document: {url: lolh.result.link}, fileName: `${n}.mp3`, mimetype: 'audio/mpeg'}, {quoted: m, ephemeralExpiration: 24*60*100, disappearingMessagesInChat: 24*60*100});
m.react(done)
db.data.users[m.sender].limit -= 3
m.reply('3 ' + info.limit)
} catch {
try {
const searchh = await yts(yt_play[0].url);
const __res = searchh.all.map((v) => v).filter((v) => v.type == 'video');
const infoo = await ytdl.getInfo('https://youtu.be/' + __res[0].videoId);
const ress = await ytdl.chooseFormat(infoo.formats, {filter: 'audioonly'});
conn.sendMessage(m.chat, {audio: {url: ress.url}, fileName: __res[0].title + '.mp3', mimetype: 'audio/mp4'}, {quoted: m, ephemeralExpiration: 24*60*100, disappearingMessagesInChat: 24*60*100});
m.react(done)
db.data.users[m.sender].limit -= 3
m.reply('3 ' + info.limit)
} catch (e) {
m.react(error)
return m.reply(info.error)
console.log(e)}}}}
break
case 'play4': case 'playdoc2': case 'ytmp4doc': {
if (global.db.data.users[m.sender].limit < 1) return m.reply(info.endLimit)
if (!text) return m.reply(`${lenguaje.sms.text}\n*${prefix + command}* ozuna\n*${prefix + command}* https://youtu.be/7ouFkoU8Ap8?si=Bvm3LypvU_uGv0bw`)
m.react(rwait)
let vid = (await yts(text)).all[0]
const yt_play = await search(args.join(" "))
let { title, description, url, thumbnail, videoId, timestamp, views, published } = vid
m.reply(`*Descarga sus video ${yt_play[0].title} en documentos espere un momento....*`)
let q = args[1] || '360p'
try {
const yt = await fg.ytv(args[0], q)
let { title, dl_url, quality, size, sizeB } = yt
conn.sendMessage(m.chat, {document: {url: dl_url}, fileName: `${ttl}.mp4`, mimetype: 'video/mp4', caption: `${title}`, thumbnail: await fetch(yt.thumbnail)}, {quoted: m, ephemeralExpiration: 24*60*100, disappearingMessagesInChat: 24*60*100});
m.react(done)
db.data.users[m.sender].limit -= 3
m.reply('3 ' + info.limit)
} catch {
try {
let yt = await fg.ytmp4(args[0], q)
let { title, size, sizeB, dl_url, quality } = yt
conn.sendMessage(m.chat, {document: {url: dl_url}, fileName: `${ttl}.mp4`, mimetype: 'video/mp4', caption: `${title}`, thumbnail: await fetch(yt.thumbnail)}, {quoted: m, ephemeralExpiration: 24*60*100, disappearingMessagesInChat: 24*60*100});
m.react(done)
db.data.users[m.sender].limit -= 3
m.reply('3 ' + info.limit)
} catch {
try {
const qu = '360';
const q = qu + 'p';
const v = yt_play[0].url;
const yt = await youtubedl(v).catch(async (_) => await youtubedlv2(v));
const dl_url = await yt.video[q].download();
const ttl = await yt.title;
const size = await yt.video[q].fileSizeH;
await await conn.sendMessage(m.chat, {document: {url: dl_url}, fileName: `${ttl}.mp4`, mimetype: 'video/mp4', caption: `${ttl}`, thumbnail: await fetch(yt.thumbnail)}, {quoted: m, ephemeralExpiration: 24*60*100, disappearingMessagesInChat: 24*60*100});
m.react(done)
db.data.users[m.sender].limit -= 3
m.reply('3 ' + info.limit)
} catch {
try {
const mediaa = await ytMp4(yt_play[0].url);
await await conn.sendMessage(m.chat, {document: {url: dl_url}, caption: cap, mimetype: 'video/mp4', fileName: ttl + `.mp4`}, {quoted: m, ephemeralExpiration: 24*60*100, disappearingMessagesInChat: 24*60*100});
} catch {
try {
const lolhuman = await fetch(`https://api.lolhuman.xyz/api/ytvideo2?apikey=${lolkeysapi}&url=${yt_play[0].url}`);
const lolh = await lolhuman.json();
const n = lolh.result.title || 'error';
const n2 = lolh.result.link;
const n3 = lolh.result.size;
const n4 = lolh.result.thumbnail;
await conn.sendMessage(m.chat, {document: {url: n2}, fileName: `${n}.mp4`, mimetype: 'video/mp4', caption: `${n}`, thumbnail: await fetch(n4)}, {quoted: m, ephemeralExpiration: 24*60*100, disappearingMessagesInChat: 24*60*100});
m.react(done)
db.data.users[m.sender].limit -= 3
m.reply('3 ' + info.limit)
} catch (e) {
m.react(error)
return m.reply(info.error)
console.log(e)}}}}}}
break
case "ytmp3": case "ytaudio":
if (global.db.data.users[m.sender].limit < 1) return m.reply(info.endLimit)
const mp = require('./libs/ytdl2')
if (args.length < 1 || !isUrl(text) || !mp.isYTUrl(text)) return reply(`*${lenguaje.sms.text}*\n${prefix + command} https://youtu.be/7ouFkoU8Ap8?si=Bvm3LypvU_uGv0bw`)
m.react("🕕")
let mediaa = await ytplayvid(text)
const audio = await mp.mp3(text)
await conn.sendMessage(from, {audio: fs.readFileSync(audio.path), mimetype: 'audio/mp4',
contextInfo: {
externalAdReply: { title:audio.meta.title,
body: botname,
//await getBuffer(pl.meta.image),
thumbnail: getBuffer(audio.meta.image),
mediaType:2,
mediaUrl:text,
}}}, {quoted:m})
await fs.unlinkSync(audio.path)
m.react("✅")
db.data.users[m.sender].limit -= 5
m.reply('5 ' + info.limit)
break
case 'ytmp4': case 'ytvideo': {
if (global.db.data.users[m.sender].limit < 1) return m.reply(info.endLimit)
const mp = require('./libs/ytdl2')
if (args.length < 1 || !isUrl(text) || !mp.isYTUrl(text)) return reply(`*${lenguaje.sms.text}*\n${prefix + command} https://youtu.be/7ouFkoU8Ap8?si=Bvm3LypvU_uGv0bw`)
m.react("🕕")
const vid = await mp.mp4(text)
const ytc = `*${vid.title}*`
await conn.sendMessage(from, {video: {url : vid.videoUrl}, caption: ytc }, {quoted:m})