D7net
Home
Console
Upload
information
Create File
Create Folder
About
Tools
:
/
home
/
etb1lp46s9ed
/
wcloud.whatzi.online
/
server
/
Filename :
whatsapp.js
back
Copy
const _0x18bc89=_0x467d;(function(_0xb0b2fc,_0x5855b2){const _0x3a5ea6=_0x467d,_0x31154f=_0xb0b2fc();while(!![]){try{const _0x384aae=parseInt(_0x3a5ea6(0x110))/0x1+-parseInt(_0x3a5ea6(0x106))/0x2+-parseInt(_0x3a5ea6(0x136))/0x3+-parseInt(_0x3a5ea6(0x116))/0x4*(-parseInt(_0x3a5ea6(0x144))/0x5)+parseInt(_0x3a5ea6(0x126))/0x6*(-parseInt(_0x3a5ea6(0x112))/0x7)+-parseInt(_0x3a5ea6(0x124))/0x8*(parseInt(_0x3a5ea6(0x132))/0x9)+parseInt(_0x3a5ea6(0x120))/0xa;if(_0x384aae===_0x5855b2)break;else _0x31154f['push'](_0x31154f['shift']());}catch(_0xfd028a){_0x31154f['push'](_0x31154f['shift']());}}}(_0x85b2,0x67ce8));function _0x85b2(){const _0x18be04=['6579EJZYdD','messages.upsert','Disconnect','entries','946563jTitlT','statusCode','creds','json','generateMessageTag','includes','reject','Time\x20out,\x20please\x20refresh\x20page','@s.whatsapp.net','Go\x20to\x20whatsapp\x20->\x20link\x20device\x20->\x20link\x20with\x20phone\x20number,\x20and\x20pairing\x20with\x20this\x20code.','output','Wrong\x20Parameterss','please\x20scan','@g.us','35QAkwRE','Request\x20QR\x20ended.\x20reload\x20web\x20to\x20scan\x20again','Connecting..','payload','toDataURL','error','slice','split','connection.update','status','emit','Connection\x20closed.\x20You\x20are\x20logged\x20out.','call','Unauthorized','922620ODKjED','match','https://upload.wikimedia.org/wikipedia/commons/thumb/6/6b/WhatsApp.svg/1200px-WhatsApp.svg.png','Connection\x20was\x20lost','available','undefined','Deleting\x20session\x20and\x20credential','sock','existsSync','Already\x20connected','212422zLHhEx','logout','21zhwpND','./credentials/','qrcode','rmSync','85336aubOaa','code','credentials/','profilePictureUrl','Windows','close','child','Stream\x20Errored\x20(restart\x20required)','You\x20re\x20using\x20whatsapp\x20gateway\x20M\x20Pedia\x20v8.x.x\x20-\x20Contact\x20admin\x20if\x20any\x20trouble\x20:\x206292298859671','join','21829170sCcIBT','log','open','set_available','5416AIEgqD','unavailable','1695534UiprEl','connection-open','sendPresenceUpdate','registered','message','Nothing\x20deleted','send','onWhatsApp',',\x20isLatest:\x20','\x20Connection\x20failed,please\x20scan\x20first','user','requestPairingCode'];_0x85b2=function(){return _0x18be04;};return _0x85b2();}import{Boom}from'@hapi/boom';import _0x11befa,{fetchLatestBaileysVersion,useMultiFileAuthState,makeCacheableSignalKeyStore,DisconnectReason}from'baileys';import{getDevice}from'./database/model.js';import _0x41e510 from'qrcode';import _0x1d47a1 from'fs';import{sock,qrcode,pairingCode,intervalStore}from'./wa/store.js';import{setStatus}from'./database/index.js';import{IncomingMessage}from'./controllers/incomingMessage.js';function _0x467d(_0x44ca14,_0x1928e0){_0x44ca14=_0x44ca14-0xfa;const _0x85b289=_0x85b2();let _0x467ded=_0x85b289[_0x44ca14];return _0x467ded;}import{getSavedPhoneNumber}from'./lib/helper.js';import _0x1f9c29 from'./lib/pino.js';import _0x3d5feb from'node-cache';import{release}from'os';const logger=_0x1f9c29[_0x18bc89(0x11c)]({}),msgRetryCounterCache=new _0x3d5feb(),connectToWhatsApp=async(_0x1e4f4f,_0x5ed273=null,_0x1c7187=![])=>{const _0x4ed09e=_0x18bc89;if(typeof qrcode[_0x1e4f4f]!==_0x4ed09e(0x10b)&&!_0x1c7187)return _0x5ed273?.[_0x4ed09e(0x102)](_0x4ed09e(0x114),{'token':_0x1e4f4f,'data':qrcode[_0x1e4f4f],'message':'please\x20scan\x20with\x20your\x20Whatsapp\x20Accountt'}),{'status':![],'sock':sock[_0x1e4f4f],'qrcode':qrcode[_0x1e4f4f],'message':_0x4ed09e(0x142)};if(typeof pairingCode[_0x1e4f4f]!=='undefined'&&_0x1c7187)return _0x5ed273?.[_0x4ed09e(0x102)]('code',{'token':_0x1e4f4f,'data':pairingCode[_0x1e4f4f],'message':_0x4ed09e(0x13f)}),{'status':![],'code':pairingCode[_0x1e4f4f],'message':'pairing\x20with\x20that\x20code'};try{let _0x3014b1=sock[_0x1e4f4f][_0x4ed09e(0x130)]['id'][_0x4ed09e(0xff)](':');_0x3014b1=_0x3014b1[0x0]+_0x4ed09e(0x13e);const _0x3641c7=await getPpUrl(_0x1e4f4f,_0x3014b1);return _0x5ed273?.[_0x4ed09e(0x102)](_0x4ed09e(0x127),{'token':_0x1e4f4f,'user':sock[_0x1e4f4f][_0x4ed09e(0x130)],'ppUrl':_0x3641c7}),delete qrcode[_0x1e4f4f],delete pairingCode[_0x1e4f4f],{'status':!![],'message':_0x4ed09e(0x10f)};}catch(_0x1851de){_0x5ed273?.['emit'](_0x4ed09e(0x12a),{'token':_0x1e4f4f,'message':'Connecting..\x20(1)..'});}const {version:_0x45ab4c,isLatest:_0x50c6e9}=await fetchLatestBaileysVersion();console[_0x4ed09e(0x121)](_0x4ed09e(0x11e)),console[_0x4ed09e(0x121)]('using\x20WA\x20v'+_0x45ab4c[_0x4ed09e(0x11f)]('.')+_0x4ed09e(0x12e)+_0x50c6e9);const {state:_0x53e66c,saveCreds:_0x4043c5}=await useMultiFileAuthState(_0x4ed09e(0x113)+_0x1e4f4f);sock[_0x1e4f4f]=_0x11befa({'version':_0x45ab4c,'browser':[_0x4ed09e(0x11a),'Chrome',release()],'version':_0x45ab4c,'logger':logger,'auth':{'creds':_0x53e66c[_0x4ed09e(0x138)],'keys':makeCacheableSignalKeyStore(_0x53e66c['keys'],logger)},'msgRetryCounterCache':msgRetryCounterCache,'generateHighQualityLinkPreview':!![],'retryRequestDelayMs':0x5*0x3e8,'maxMsgRetryCount':0x3e8,'syncFullHistory':![],'transactionOpts':{'maxCommitRetries':0x1,'delayBetweenTriesMs':0xa}});if(_0x1c7187&&'me'in _0x53e66c[_0x4ed09e(0x138)]===![]&&!_0x53e66c['creds'][_0x4ed09e(0x129)]){const _0x12ce07=await getSavedPhoneNumber(_0x1e4f4f);try{const _0x24040c=await sock[_0x1e4f4f][_0x4ed09e(0x131)](_0x12ce07);pairingCode[_0x1e4f4f]=_0x24040c?.[_0x4ed09e(0x107)](/.{1,4}/g)?.['join']('-')||_0x24040c;}catch(_0x484c24){_0x5ed273?.[_0x4ed09e(0x102)]('message',{'token':_0x1e4f4f,'message':_0x4ed09e(0x13d)});}_0x5ed273?.[_0x4ed09e(0x102)](_0x4ed09e(0x117),{'token':_0x1e4f4f,'data':pairingCode[_0x1e4f4f],'message':'Go\x20to\x20whatsapp\x20->\x20link\x20device\x20->\x20link\x20with\x20phone\x20number,\x20and\x20pairing\x20with\x20this\x20code.'});}return sock[_0x1e4f4f]['ev']['process'](async _0x2267c8=>{const _0x537d4a=_0x4ed09e;if(_0x2267c8['connection.update']){const _0x201887=_0x2267c8[_0x537d4a(0x100)],{connection:_0x3ff7cf,lastDisconnect:_0xe0e0d8,qr:_0x5eca19}=_0x201887;if(_0x3ff7cf===_0x537d4a(0x11b)){const _0x419530=_0xe0e0d8[_0x537d4a(0xfd)]?.[_0x537d4a(0x140)]?.[_0x537d4a(0xfb)]?.['message'],_0x17ecc6=_0xe0e0d8[_0x537d4a(0xfd)]?.['output']?.[_0x537d4a(0xfb)]?.[_0x537d4a(0xfd)];if((_0xe0e0d8?.[_0x537d4a(0xfd)]instanceof Boom)?.[_0x537d4a(0x140)]?.[_0x537d4a(0x137)]!==DisconnectReason['loggedOut']){delete qrcode[_0x1e4f4f],_0x5ed273?.['emit'](_0x537d4a(0x12a),{'token':_0x1e4f4f,'message':_0x537d4a(0xfa)});if(_0x419530=='QR\x20refs\x20attempts\x20ended'){sock[_0x1e4f4f]['ws'][_0x537d4a(0x11b)](),delete qrcode[_0x1e4f4f],delete pairingCode[_0x1e4f4f],delete sock[_0x1e4f4f],_0x5ed273?.[_0x537d4a(0x102)](_0x537d4a(0x12a),{'token':_0x1e4f4f,'message':_0x537d4a(0x145)});return;}(_0x17ecc6===_0x537d4a(0x105)||_0x17ecc6==='Method\x20Not\x20Allowed')&&(setStatus(_0x1e4f4f,_0x537d4a(0x134)),clearConnection(_0x1e4f4f),connectToWhatsApp(_0x1e4f4f,_0x5ed273)),_0x419530===_0x537d4a(0x11d)&&connectToWhatsApp(_0x1e4f4f,_0x5ed273),_0x419530===_0x537d4a(0x109)&&delete sock[_0x1e4f4f];}else setStatus(_0x1e4f4f,_0x537d4a(0x134)),console['log']('Connection\x20closed.\x20You\x20are\x20logged\x20out.'),_0x5ed273?.[_0x537d4a(0x102)](_0x537d4a(0x12a),{'token':_0x1e4f4f,'message':_0x537d4a(0x103)}),clearConnection(_0x1e4f4f),connectToWhatsApp(_0x1e4f4f,_0x5ed273);}_0x5eca19&&_0x41e510[_0x537d4a(0xfc)](_0x5eca19,function(_0x3b4455,_0x113d27){if(_0x3b4455)console['log'](_0x3b4455);qrcode[_0x1e4f4f]=_0x113d27,connectToWhatsApp(_0x1e4f4f,_0x5ed273,_0x1c7187);});if(_0x3ff7cf==='open'){setStatus(_0x1e4f4f,'Connected'),delete qrcode[_0x1e4f4f],delete pairingCode[_0x1e4f4f];let _0xee491b=sock[_0x1e4f4f][_0x537d4a(0x130)]['id'][_0x537d4a(0xff)](':');_0xee491b=_0xee491b[0x0]+'@s.whatsapp.net';const _0x4378bd=await getPpUrl(_0x1e4f4f,_0xee491b);_0x5ed273?.[_0x537d4a(0x102)](_0x537d4a(0x127),{'token':_0x1e4f4f,'user':sock[_0x1e4f4f]['user'],'ppUrl':_0x4378bd}),delete qrcode[_0x1e4f4f],delete pairingCode[_0x1e4f4f];}}if(_0x2267c8['creds.update']){const _0x55dbf9=_0x2267c8['creds.update'];_0x4043c5(_0x55dbf9);}if(_0x2267c8[_0x537d4a(0x133)]){const {messages:_0xfb8113,type:_0x14b163}=_0x2267c8[_0x537d4a(0x133)],_0x18aa1d=await IncomingMessage(_0xfb8113,_0x14b163,sock[_0x1e4f4f]);}}),sock[_0x1e4f4f]['ev']?.['on'](_0x4ed09e(0x104),async _0x43b19e=>{const _0x354d0c=_0x4ed09e,_0x208b5b=await getDevice(sock[_0x1e4f4f][_0x354d0c(0x130)]['id'][_0x354d0c(0xff)](':')[0x0]),_0x1b7234=_0x208b5b[0x0]['reject_call'];if(_0x1b7234===0x1){const {from:_0xeecec2,id:_0x444f54,status:_0x151272}=_0x43b19e[0x0];if(_0x151272=='offer'){const _0x44ca20={'tag':_0x354d0c(0x104),'attrs':{'from':sock[_0x1e4f4f]['user']['id'],'to':_0xeecec2,'id':sock[_0x1e4f4f][_0x354d0c(0x13a)]()},'content':[{'tag':_0x354d0c(0x13c),'attrs':{'call-id':_0x444f54,'call-creator':_0xeecec2,'count':'0'},'content':undefined}]};await sock[_0x1e4f4f]['query'](_0x44ca20);}}}),{'sock':sock[_0x1e4f4f],'qrcode':qrcode[_0x1e4f4f]};};async function connectWaBeforeSend(_0x4a9429){const _0x5634f9=_0x18bc89;let _0x576f97=undefined,_0x2e2312;_0x2e2312=await connectToWhatsApp(_0x4a9429),console[_0x5634f9(0x121)](_0x2e2312),await _0x2e2312[_0x5634f9(0x10d)]['ev']?.['on'](_0x5634f9(0x100),_0x1250b1=>{const _0x14dd1e=_0x5634f9,{connection:_0x6db56b,qr:_0x1af0a6}=_0x1250b1;_0x6db56b===_0x14dd1e(0x122)&&(_0x576f97=!![]),_0x1af0a6&&(_0x576f97=![]);});let _0x35f9e1=0x0;while(typeof _0x576f97==='undefined'){_0x35f9e1++;if(_0x35f9e1>0x4)break;await new Promise(_0x3eec53=>setTimeout(_0x3eec53,0x3e8));}return _0x576f97;}const sendAvailable=async _0x165f3a=>{const _0x4f03cc=_0x18bc89,_0x670dd0=await getDevice(_0x165f3a);let _0x5626ff;try{return _0x670dd0[0x0][_0x4f03cc(0x123)]==0x1?_0x5626ff=await sock[_0x165f3a][_0x4f03cc(0x128)](_0x4f03cc(0x10a)):_0x5626ff=await sock[_0x165f3a][_0x4f03cc(0x128)](_0x4f03cc(0x125)),_0x5626ff;}catch(_0x29e386){return![];}};async function fetchGroups(_0x2de262){const _0x1406b9=_0x18bc89;try{let _0x4d7d48=await sock[_0x2de262]['groupFetchAllParticipating'](),_0x1c34c2=Object[_0x1406b9(0x135)](_0x4d7d48)[_0x1406b9(0xfe)](0x0)['map'](_0x55dd37=>{return _0x55dd37[0x1];});return _0x1c34c2;}catch(_0x2c79f3){return![];}}async function isExist(_0x4bde31,_0x12ef3f){const _0x255f90=_0x18bc89;try{if(typeof sock[_0x4bde31]===_0x255f90(0x10b)){const _0x30c6dc=await connectWaBeforeSend(_0x4bde31);if(!_0x30c6dc)return![];}if(_0x12ef3f[_0x255f90(0x13b)](_0x255f90(0x143)))return!![];else{const [_0x5843bf]=await sock[_0x4bde31][_0x255f90(0x12d)]('+'+_0x12ef3f);return _0x12ef3f['length']>0xb?_0x5843bf:!![];}}catch(_0x2266bf){return console[_0x255f90(0x121)](_0x2266bf),![];}}async function getPpUrl(_0x1f714d,_0x5f57e8,_0x2e7f07){const _0x21747d=_0x18bc89;let _0x2f3012;try{return _0x2f3012=await sock[_0x1f714d][_0x21747d(0x119)](_0x5f57e8),_0x2f3012;}catch(_0x377e74){return _0x21747d(0x108);}}async function deleteCredentials(_0x1d6604,_0x399b82=null){const _0x150bfc=_0x18bc89;_0x399b82!==null&&_0x399b82['emit'](_0x150bfc(0x12a),{'token':_0x1d6604,'message':'Logout\x20Progres..'});try{if(typeof sock[_0x1d6604]===_0x150bfc(0x10b)){const _0x5651fa=await connectWaBeforeSend(_0x1d6604);_0x5651fa&&(sock[_0x1d6604][_0x150bfc(0x111)](),delete sock[_0x1d6604]);}else sock[_0x1d6604]['logout'](),delete sock[_0x1d6604];return delete qrcode[_0x1d6604],clearInterval(intervalStore[_0x1d6604]),setStatus(_0x1d6604,'Disconnect'),_0x399b82!=null&&(_0x399b82[_0x150bfc(0x102)](_0x150bfc(0x105),_0x1d6604),_0x399b82[_0x150bfc(0x102)](_0x150bfc(0x12a),{'token':_0x1d6604,'message':'Connection\x20closed.\x20You\x20are\x20logged\x20out.'})),_0x1d47a1['existsSync'](_0x150bfc(0x113)+_0x1d6604)&&_0x1d47a1[_0x150bfc(0x115)](_0x150bfc(0x113)+_0x1d6604,{'recursive':!![],'force':!![]},_0x4840b8=>{if(_0x4840b8)console['log'](_0x4840b8);}),{'status':!![],'message':_0x150bfc(0x10c)};}catch(_0x533aa2){return console['log'](_0x533aa2),{'status':!![],'message':_0x150bfc(0x12b)};}}function clearConnection(_0x58f591){const _0x56a072=_0x18bc89;clearInterval(intervalStore[_0x58f591]),delete sock[_0x58f591],delete qrcode[_0x58f591],setStatus(_0x58f591,_0x56a072(0x134)),_0x1d47a1[_0x56a072(0x10e)](_0x56a072(0x113)+_0x58f591)&&(_0x1d47a1[_0x56a072(0x115)](_0x56a072(0x113)+_0x58f591,{'recursive':!![],'force':!![]},_0x1f1915=>{const _0x2f5dbe=_0x56a072;if(_0x1f1915)console[_0x2f5dbe(0x121)](_0x1f1915);}),console['log'](_0x56a072(0x118)+_0x58f591+'\x20is\x20deleted'));}async function initialize(_0x48b371,_0x5f182c){const _0x2dd7b7=_0x18bc89,{token:_0x4eb2cf}=_0x48b371['body'];if(_0x4eb2cf){const _0x3f1408=_0x2dd7b7(0x113)+_0x4eb2cf;if(_0x1d47a1[_0x2dd7b7(0x10e)](_0x3f1408)){sock[_0x4eb2cf]=undefined;const _0x2ceeb4=await connectWaBeforeSend(_0x4eb2cf);return _0x2ceeb4?_0x5f182c[_0x2dd7b7(0x101)](0xc8)[_0x2dd7b7(0x139)]({'status':!![],'message':_0x4eb2cf+'\x20connection\x20restored'}):_0x5f182c[_0x2dd7b7(0x101)](0xc8)[_0x2dd7b7(0x139)]({'status':![],'message':_0x4eb2cf+'\x20connection\x20failed'});}return _0x5f182c[_0x2dd7b7(0x12c)]({'status':![],'message':_0x4eb2cf+_0x2dd7b7(0x12f)});}return _0x5f182c[_0x2dd7b7(0x12c)]({'status':![],'message':_0x2dd7b7(0x141)});}export*from'./wa/sender.js';export{connectToWhatsApp,isExist,getPpUrl,fetchGroups,deleteCredentials,initialize,connectWaBeforeSend,sendAvailable};