-
-
Notifications
You must be signed in to change notification settings - Fork 267
/
main.js
1 lines (1 loc) · 14.1 KB
/
main.js
1
const _0x180a5e=_0x2840;(function(_0x177b3e,_0x15c5f8){const _0x21ad87=_0x2840,_0x46c7c1=_0x177b3e();while(!![]){try{const _0x347644=-parseInt(_0x21ad87(0x240))/0x1*(parseInt(_0x21ad87(0x20e))/0x2)+parseInt(_0x21ad87(0x204))/0x3*(-parseInt(_0x21ad87(0x219))/0x4)+-parseInt(_0x21ad87(0x249))/0x5+-parseInt(_0x21ad87(0x21f))/0x6*(-parseInt(_0x21ad87(0x22a))/0x7)+parseInt(_0x21ad87(0x255))/0x8*(parseInt(_0x21ad87(0x20b))/0x9)+parseInt(_0x21ad87(0x207))/0xa*(-parseInt(_0x21ad87(0x251))/0xb)+parseInt(_0x21ad87(0x22d))/0xc;if(_0x347644===_0x15c5f8)break;else _0x46c7c1['push'](_0x46c7c1['shift']());}catch(_0x27d09c){_0x46c7c1['push'](_0x46c7c1['shift']());}}}(_0x212b,0x5bf20),process['env']['NODE_TLS_REJECT_UNAUTHORIZED']='0');import'./config.js';import{createRequire}from'module';import _0x4b6de0,{join}from'path';import{fileURLToPath,pathToFileURL}from'url';import{platform}from'process';import*as _0x3818d5 from'ws';import{readdirSync,statSync,unlinkSync,existsSync,readFileSync,watch,rmSync}from'fs';function _0x212b(){const _0x44ce97=['Safari','race','default','cyan','@user\x20demoted','conn','keys','sort','parse','Stickers\x20may\x20not\x20work\x20without\x20imagemagick\x20if\x20libwebp\x20on\x20ffmpeg\x20doesnt\x20isntalled\x20(pkg\x20install\x20imagemagick)','freeze','deleted\x20plugin\x20-\x20\x27','forEach','161783hRRhbp','participantsUpdate','API','exitProcess','autocleartmp','Group\x20subject\x20cchanged\x20\x0a@group','?update=','./server.js','ffprobe','1339470jcMBer','write','sSubject','./plugins/index','messages.upsert','./handler.js','.data.json','-frames:v','11cicBup','length','win32','connection.update','263800FKfRHT','Group\x20link\x20changed\x20\x0a@revoke','__require','close','syntax\x20error\x20while\x20loading\x20\x27','creds.update','error\x20require\x20plugin\x20\x27','prefix','now','fromEntries','opts','plugins','slice','module','message.delete','webp','entries','statusCode','reloadHandler','info','loggedOut','bind','replace','off','./tmp','mtimeMs','@adiwajshing/baileys','toString','test','argv','__dirname','READ','magick','error','ffmpeg','server','PORT','then','connectionUpdate','data','connect','mongodbv2','handler','sDesc','loadDatabase','APIs','3wgwTUU','log','output','562290YQzcyu','catch','bye','-filter_complex','9KVWwlY','Quick\x20Test\x20Done','Please\x20install\x20ffmpeg\x20for\x20sending\x20videos\x20(pkg\x20install\x20ffmpeg)','2RdsXoe','isInit','ffmpegWebp','credsUpdate','filter','authFile','config','SERVER_PORT','sdemote','-hide_banner','logger','2656148YPIiIw','welcome','chain','Hello,\x20@user\x0aWelcome\x20to\x20@group','timestamp','env','17730TcXmUx','group-participants.update','convert','support','z/i!#$%+£¢€¥^°=¶∆×÷π√✓©®:;?&.,\x5c-','✅\x20\x20Auto\x20clear\x20\x20|\x20\x20tmp\x20folder\x20cleared','onDelete','read','reload','removeAllListeners','warn','1533patdey','groupsUpdate','url','10157172uIZRmJ','__filename','\x5c$&','@user\x20now\x20admin','groups.update','color'];_0x212b=function(){return _0x44ce97;};return _0x212b();}import _0x225d64 from'yargs';import{spawn}from'child_process';import _0x555a67 from'lodash';import _0x296c40 from'chalk';import _0x2ec945 from'syntax-error';import{tmpdir}from'os';import{format}from'util';import{makeWASocket,protoType,serialize}from'./lib/simple.js';import{Low,JSONFile}from'lowdb';import _0x4a674b from'pino';import{mongoDB,mongoDBV2}from'./lib/mongoDB.js';import _0x2a7e58 from'./lib/store.js';import _0x4ad840 from'dotenv';const {DisconnectReason,useMultiFileAuthState}=await import(_0x180a5e(0x1f0)),{CONNECTING}=_0x3818d5,{chain}=_0x555a67,PORT=process['env'][_0x180a5e(0x1fa)]||process[_0x180a5e(0x21e)][_0x180a5e(0x215)]||0xbb8;protoType(),serialize(),_0x4ad840[_0x180a5e(0x214)](),global[_0x180a5e(0x22e)]=function filename(_0x23a93c=import.meta[_0x180a5e(0x22c)],_0x2badf2=platform!==_0x180a5e(0x253)){const _0x5931c8=_0x180a5e;return _0x2badf2?/file:\/\/\//[_0x5931c8(0x1f2)](_0x23a93c)?fileURLToPath(_0x23a93c):_0x23a93c:pathToFileURL(_0x23a93c)[_0x5931c8(0x1f1)]();},global['__dirname']=function dirname(_0x2c7472){const _0x35d8aa=_0x180a5e;return _0x4b6de0['dirname'](global[_0x35d8aa(0x22e)](_0x2c7472,!![]));},global[_0x180a5e(0x257)]=function require(_0x256790=import.meta[_0x180a5e(0x22c)]){return createRequire(_0x256790);},global[_0x180a5e(0x242)]=(_0x786cf5,_0x4229f9='/',_0x56f421={},_0x295576)=>(_0x786cf5 in global[_0x180a5e(0x203)]?global[_0x180a5e(0x203)][_0x786cf5]:_0x786cf5)+_0x4229f9+(_0x56f421||_0x295576?'?'+new URLSearchParams(Object['entries']({..._0x56f421,..._0x295576?{[_0x295576]:global['APIKeys'][_0x786cf5 in global[_0x180a5e(0x203)]?global['APIs'][_0x786cf5]:_0x786cf5]}:{}})):''),global['timestamp']={'start':new Date()};const __dirname=global['__dirname'](import.meta[_0x180a5e(0x22c)]);function _0x2840(_0x4d8e79,_0x5ebad6){const _0x212bca=_0x212b();return _0x2840=function(_0x2840cd,_0x38fe5d){_0x2840cd=_0x2840cd-0x1da;let _0x79ce67=_0x212bca[_0x2840cd];return _0x79ce67;},_0x2840(_0x4d8e79,_0x5ebad6);}global[_0x180a5e(0x1e0)]=new Object(_0x225d64(process[_0x180a5e(0x1f3)][_0x180a5e(0x1e2)](0x2))[_0x180a5e(0x243)](![])[_0x180a5e(0x23b)]()),global[_0x180a5e(0x1dd)]=new RegExp('^['+(opts[_0x180a5e(0x1dd)]||_0x180a5e(0x223))[_0x180a5e(0x1ec)](/[|\\{}()[\]^$+*?.\-\^]/g,_0x180a5e(0x22f))+']'),global[_0x180a5e(0x1e0)]['db']=process['env']['MONGO_DB'],global['db']=new Low(/https?:\/\//['test'](opts['db']||'')?new cloudDBAdapter(opts['db']):/mongodb(\+srv)?:\/\//i['test'](opts['db'])?opts[_0x180a5e(0x1ff)]?new mongoDBV2(opts['db']):new mongoDB(opts['db']):new JSONFile((opts['_'][0x0]?opts['_'][0x0]+'_':'')+'database.json')),global['DATABASE']=global['db'],global[_0x180a5e(0x202)]=async function loadDatabase(){const _0x4499ca=_0x180a5e;if(global['db']['READ'])return new Promise(_0x2f621f=>setInterval(async function(){const _0xc86aa3=_0x2840;!global['db']['READ']&&(clearInterval(this),_0x2f621f(global['db'][_0xc86aa3(0x1fd)]==null?global[_0xc86aa3(0x202)]():global['db'][_0xc86aa3(0x1fd)]));},0x1*0x3e8));if(global['db'][_0x4499ca(0x1fd)]!==null)return;global['db']['READ']=!![],await global['db'][_0x4499ca(0x226)]()['catch'](console[_0x4499ca(0x1f7)]),global['db'][_0x4499ca(0x1f5)]=null,global['db'][_0x4499ca(0x1fd)]={'users':{},'chats':{},'stats':{},'msgs':{},'sticker':{},'settings':{},...global['db']['data']||{}},global['db'][_0x4499ca(0x21b)]=chain(global['db'][_0x4499ca(0x1fd)]);},loadDatabase(),global[_0x180a5e(0x213)]=(opts['_'][0x0]||'guru')+_0x180a5e(0x24f);const {state,saveState}=_0x2a7e58['useSingleFileAuthState'](global[_0x180a5e(0x213)]),connectionOptions={'printQRInTerminal':!![],'auth':state,'logger':_0x4a674b({'level':'silent'}),'browser':['GURU-BOT',_0x180a5e(0x233),'1.0.0']};global[_0x180a5e(0x238)]=makeWASocket(connectionOptions),conn[_0x180a5e(0x20f)]=![];!opts[_0x180a5e(0x1f2)]&&setInterval(async()=>{const _0x1bde77=_0x180a5e;if(global['db'][_0x1bde77(0x1fd)])await global['db'][_0x1bde77(0x24a)]()[_0x1bde77(0x208)](console[_0x1bde77(0x1f7)]);if(opts[_0x1bde77(0x244)])try{clearTmp();}catch(_0xe86bc1){console[_0x1bde77(0x1f7)](_0xe86bc1);}},0x3c*0x3e8);if(opts[_0x180a5e(0x1f9)])(await import(_0x180a5e(0x247)))['default'](global['conn'],PORT);async function clearTmp(){const _0x55d8a9=_0x180a5e,_0x22d30c=[tmpdir(),join(__dirname,_0x55d8a9(0x1ee))],_0x1aa906=[];return _0x22d30c['forEach'](_0x187f57=>readdirSync(_0x187f57)[_0x55d8a9(0x23f)](_0x3683ab=>_0x1aa906['push'](join(_0x187f57,_0x3683ab)))),_0x1aa906['map'](_0x50294e=>{const _0x12b322=_0x55d8a9,_0x20f76d=statSync(_0x50294e);if(_0x20f76d['isFile']()&&Date['now']()-_0x20f76d[_0x12b322(0x1ef)]>=0x3e8*0x3c*0x1)return unlinkSync(_0x50294e);return![];});}setInterval(async()=>{const _0x10c793=_0x180a5e;var _0x589121=await clearTmp();console[_0x10c793(0x205)](_0x296c40[_0x10c793(0x236)](_0x10c793(0x224)));},0xea60);async function connectionUpdate(_0x5dd780){const _0x7c4bc=_0x180a5e,{connection:_0x13d055,lastDisconnect:_0x23ffdd,isNewLogin:_0x45c82e}=_0x5dd780;if(_0x45c82e)conn['isInit']=!![];const _0x18fe6a=_0x23ffdd?.['error']?.['output']?.['statusCode']||_0x23ffdd?.[_0x7c4bc(0x1f7)]?.[_0x7c4bc(0x206)]?.['payload']?.[_0x7c4bc(0x1e7)];_0x18fe6a&&_0x18fe6a!==DisconnectReason[_0x7c4bc(0x1ea)]&&conn?.['ws']['readyState']!==CONNECTING&&(console[_0x7c4bc(0x205)](await global['reloadHandler'](!![])['catch'](console[_0x7c4bc(0x1f7)])),global[_0x7c4bc(0x21d)][_0x7c4bc(0x1fe)]=new Date());if(global['db'][_0x7c4bc(0x1fd)]==null)loadDatabase();}process['on']('uncaughtException',console[_0x180a5e(0x1f7)]);let isInit=!![],handler=await import(_0x180a5e(0x24e));global[_0x180a5e(0x1e8)]=async function(_0x2bf1d5){const _0x4c5926=_0x180a5e;try{const _0x525e74=await import('./handler.js?update='+Date['now']())[_0x4c5926(0x208)](console['error']);if(Object[_0x4c5926(0x239)](_0x525e74||{})[_0x4c5926(0x252)])handler=_0x525e74;}catch(_0x77e8bc){console['error'](_0x77e8bc);}if(_0x2bf1d5){const _0x1b31ee=global[_0x4c5926(0x238)]['chats'];try{global[_0x4c5926(0x238)]['ws'][_0x4c5926(0x258)]();}catch{}conn['ev'][_0x4c5926(0x228)](),global[_0x4c5926(0x238)]=makeWASocket(connectionOptions,{'chats':_0x1b31ee}),isInit=!![];}return!isInit&&(conn['ev'][_0x4c5926(0x1ed)]('messages.upsert',conn[_0x4c5926(0x200)]),conn['ev'][_0x4c5926(0x1ed)]('group-participants.update',conn[_0x4c5926(0x241)]),conn['ev']['off']('groups.update',conn['groupsUpdate']),conn['ev'][_0x4c5926(0x1ed)](_0x4c5926(0x1e4),conn[_0x4c5926(0x225)]),conn['ev'][_0x4c5926(0x1ed)](_0x4c5926(0x254),conn[_0x4c5926(0x1fc)]),conn['ev'][_0x4c5926(0x1ed)](_0x4c5926(0x1db),conn[_0x4c5926(0x211)])),conn[_0x4c5926(0x21a)]=_0x4c5926(0x21c),conn[_0x4c5926(0x209)]='Goodbye\x20@user',conn['spromote']=_0x4c5926(0x230),conn[_0x4c5926(0x216)]=_0x4c5926(0x237),conn[_0x4c5926(0x201)]='Group\x20description\x20changed\x20\x0a@desc',conn[_0x4c5926(0x24b)]=_0x4c5926(0x245),conn['sIcon']='Group\x20icon\x20changed',conn['sRevoke']=_0x4c5926(0x256),conn[_0x4c5926(0x200)]=handler['handler'][_0x4c5926(0x1eb)](global[_0x4c5926(0x238)]),conn[_0x4c5926(0x241)]=handler[_0x4c5926(0x241)]['bind'](global[_0x4c5926(0x238)]),conn[_0x4c5926(0x22b)]=handler['groupsUpdate'][_0x4c5926(0x1eb)](global['conn']),conn[_0x4c5926(0x225)]=handler['deleteUpdate'][_0x4c5926(0x1eb)](global['conn']),conn[_0x4c5926(0x1fc)]=connectionUpdate[_0x4c5926(0x1eb)](global[_0x4c5926(0x238)]),conn[_0x4c5926(0x211)]=saveState[_0x4c5926(0x1eb)](global[_0x4c5926(0x238)],!![]),conn['ev']['on'](_0x4c5926(0x24d),conn[_0x4c5926(0x200)]),conn['ev']['on'](_0x4c5926(0x220),conn[_0x4c5926(0x241)]),conn['ev']['on'](_0x4c5926(0x231),conn[_0x4c5926(0x22b)]),conn['ev']['on'](_0x4c5926(0x1e4),conn[_0x4c5926(0x225)]),conn['ev']['on'](_0x4c5926(0x254),conn['connectionUpdate']),conn['ev']['on'](_0x4c5926(0x1db),conn[_0x4c5926(0x211)]),isInit=![],!![];};const pluginFolder=global[_0x180a5e(0x1f4)](join(__dirname,_0x180a5e(0x24c))),pluginFilter=_0x3efc51=>/\.js$/[_0x180a5e(0x1f2)](_0x3efc51);global[_0x180a5e(0x1e1)]={};async function filesInit(){const _0x16fd1f=_0x180a5e;for(let _0x5f418b of readdirSync(pluginFolder)[_0x16fd1f(0x212)](pluginFilter)){try{let _0x15a802=global[_0x16fd1f(0x22e)](join(pluginFolder,_0x5f418b));const _0x2cfbd3=await import(_0x15a802);global[_0x16fd1f(0x1e1)][_0x5f418b]=_0x2cfbd3['default']||_0x2cfbd3;}catch(_0x5efdeb){conn['logger'][_0x16fd1f(0x1f7)](_0x5efdeb),delete global[_0x16fd1f(0x1e1)][_0x5f418b];}}}filesInit()['then'](_0x24cde4=>console[_0x180a5e(0x205)](Object[_0x180a5e(0x239)](global[_0x180a5e(0x1e1)])))[_0x180a5e(0x208)](console[_0x180a5e(0x1f7)]),global['reload']=async(_0x55f866,_0x1e40c8)=>{const _0x10f9b7=_0x180a5e;if(pluginFilter(_0x1e40c8)){let _0x44a513=global[_0x10f9b7(0x22e)](join(pluginFolder,_0x1e40c8),!![]);if(_0x1e40c8 in global['plugins']){if(existsSync(_0x44a513))conn[_0x10f9b7(0x218)][_0x10f9b7(0x1e9)]('\x20updated\x20plugin\x20-\x20\x27'+_0x1e40c8+'\x27');else return conn[_0x10f9b7(0x218)]['warn'](_0x10f9b7(0x23e)+_0x1e40c8+'\x27'),delete global[_0x10f9b7(0x1e1)][_0x1e40c8];}else conn[_0x10f9b7(0x218)][_0x10f9b7(0x1e9)]('new\x20plugin\x20-\x20\x27'+_0x1e40c8+'\x27');let _0x1f29a2=_0x2ec945(readFileSync(_0x44a513),_0x1e40c8,{'sourceType':_0x10f9b7(0x1e3),'allowAwaitOutsideFunction':!![]});if(_0x1f29a2)conn['logger'][_0x10f9b7(0x1f7)](_0x10f9b7(0x1da)+_0x1e40c8+'\x27\x0a'+format(_0x1f29a2));else try{const _0x3e61b4=await import(global[_0x10f9b7(0x22e)](_0x44a513)+_0x10f9b7(0x246)+Date[_0x10f9b7(0x1de)]());global[_0x10f9b7(0x1e1)][_0x1e40c8]=_0x3e61b4[_0x10f9b7(0x235)]||_0x3e61b4;}catch(_0x193079){conn['logger']['error'](_0x10f9b7(0x1dc)+_0x1e40c8+'\x0a'+format(_0x193079)+'\x27');}finally{global[_0x10f9b7(0x1e1)]=Object[_0x10f9b7(0x1df)](Object[_0x10f9b7(0x1e6)](global['plugins'])[_0x10f9b7(0x23a)](([_0x1e94fa],[_0xde47d4])=>_0x1e94fa['localeCompare'](_0xde47d4)));}}},Object[_0x180a5e(0x23d)](global[_0x180a5e(0x227)]),watch(pluginFolder,global[_0x180a5e(0x227)]),await global['reloadHandler']();async function _quickTest(){const _0x9e639=_0x180a5e;let _0xc24423=await Promise['all']([spawn(_0x9e639(0x1f8)),spawn(_0x9e639(0x248)),spawn(_0x9e639(0x1f8),[_0x9e639(0x217),'-loglevel',_0x9e639(0x1f7),_0x9e639(0x20a),_0x9e639(0x232),_0x9e639(0x250),'1','-f',_0x9e639(0x1e5),'-']),spawn('convert'),spawn(_0x9e639(0x1f6)),spawn('gm'),spawn('find',['--version'])]['map'](_0x483444=>{const _0x357b51=_0x9e639;return Promise[_0x357b51(0x234)]([new Promise(_0x333d6f=>{const _0x106e84=_0x357b51;_0x483444['on'](_0x106e84(0x258),_0x5c4e89=>{_0x333d6f(_0x5c4e89!==0x7f);});}),new Promise(_0x3a2771=>{const _0x57448e=_0x357b51;_0x483444['on'](_0x57448e(0x1f7),_0x18acd1=>_0x3a2771(![]));})]);})),[_0x377f39,_0x4f405e,_0x220b75,_0x19627c,_0x592470,_0x321a20,_0x4d49b3]=_0xc24423;console['log'](_0xc24423);let _0x2db355=global[_0x9e639(0x222)]={'ffmpeg':_0x377f39,'ffprobe':_0x4f405e,'ffmpegWebp':_0x220b75,'convert':_0x19627c,'magick':_0x592470,'gm':_0x321a20,'find':_0x4d49b3};Object[_0x9e639(0x23d)](global['support']);if(!_0x2db355['ffmpeg'])conn['logger'][_0x9e639(0x229)](_0x9e639(0x20d));if(_0x2db355['ffmpeg']&&!_0x2db355[_0x9e639(0x210)])conn[_0x9e639(0x218)]['warn']('Stickers\x20may\x20not\x20animated\x20without\x20libwebp\x20on\x20ffmpeg\x20(--enable-ibwebp\x20while\x20compiling\x20ffmpeg)');if(!_0x2db355[_0x9e639(0x221)]&&!_0x2db355['magick']&&!_0x2db355['gm'])conn[_0x9e639(0x218)][_0x9e639(0x229)](_0x9e639(0x23c));}_quickTest()[_0x180a5e(0x1fb)](()=>conn[_0x180a5e(0x218)]['info'](_0x180a5e(0x20c)))['catch'](console[_0x180a5e(0x1f7)]);