D7net
Home
Console
Upload
information
Create File
Create Folder
About
Tools
:
/
home
/
etb1lp46s9ed
/
washeet.softurecs.com
/
server
/
Filename :
whatsapp.js
back
Copy
const _0x53c03f = _0x1a9c; (function (_0x1a301c, _0x22fea7) { const _0x3bca52 = _0x1a9c, _0x1677ed = _0x1a301c(); while (!![]) { try { const _0x21b8a5 = -parseInt(_0x3bca52(0x163)) / 0x1 + parseInt(_0x3bca52(0x181)) / 0x2 + (-parseInt(_0x3bca52(0x19b)) / 0x3) * (-parseInt(_0x3bca52(0x15a)) / 0x4) + -parseInt(_0x3bca52(0x182)) / 0x5 + -parseInt(_0x3bca52(0x17c)) / 0x6 + parseInt(_0x3bca52(0x165)) / 0x7 + (parseInt(_0x3bca52(0x15b)) / 0x8) * (parseInt(_0x3bca52(0x193)) / 0x9); if (_0x21b8a5 === _0x22fea7) break; else _0x1677ed["push"](_0x1677ed["shift"]()); } catch (_0x403c14) { _0x1677ed["push"](_0x1677ed["shift"]()); } } })(_0x2388, 0x7db27); import { Boom } from "@hapi/boom"; import _0x242aa2, { fetchLatestBaileysVersion, useMultiFileAuthState, makeCacheableSignalKeyStore, DisconnectReason, } from "baileys"; import { getDevice } from "./database/model.js"; function _0x1a9c(_0x5a27fb, _0x4707f7) { _0x5a27fb = _0x5a27fb - 0x14d; const _0x23884c = _0x2388(); let _0x1a9c18 = _0x23884c[_0x5a27fb]; return _0x1a9c18; } import _0x179f71 from "qrcode"; import _0x33eb4e from "fs"; import { sock, qrcode, pairingCode, intervalStore } from "./wa/store.js"; import { setStatus } from "./database/index.js"; import { IncomingMessage } from "./controllers/incomingMessage.js"; import { getSavedPhoneNumber } from "./lib/helper.js"; import _0x98086 from "./lib/pino.js"; import _0x1759e9 from "node-cache"; import { release } from "os"; const logger = _0x98086[_0x53c03f(0x156)]({}), msgRetryCounterCache = new _0x1759e9(), connectToWhatsApp = async (_0xaaa198, _0x20276c = null, _0x4e0917 = ![]) => { const _0x456959 = _0x53c03f; if (typeof qrcode[_0xaaa198] !== _0x456959(0x173) && !_0x4e0917) return ( _0x20276c?.[_0x456959(0x14e)](_0x456959(0x19e), { token: _0xaaa198, data: qrcode[_0xaaa198], message: _0x456959(0x189), }), { status: ![], sock: sock[_0xaaa198], qrcode: qrcode[_0xaaa198], message: _0x456959(0x174), } ); if (typeof pairingCode[_0xaaa198] !== "undefined" && _0x4e0917) return ( _0x20276c?.["emit"](_0x456959(0x18a), { token: _0xaaa198, data: pairingCode[_0xaaa198], message: "Go\x20to\x20whatsapp\x20->\x20link\x20device\x20->\x20link\x20with\x20phone\x20number,\x20and\x20pairing\x20with\x20this\x20code.", }), { status: ![], code: pairingCode[_0xaaa198], message: _0x456959(0x188) } ); try { let _0x3275ab = sock[_0xaaa198][_0x456959(0x154)]["id"]["split"](":"); _0x3275ab = _0x3275ab[0x0] + _0x456959(0x153); const _0x2b0f72 = await getPpUrl(_0xaaa198, _0x3275ab); return ( _0x20276c?.[_0x456959(0x14e)](_0x456959(0x18f), { token: _0xaaa198, user: sock[_0xaaa198][_0x456959(0x154)], ppUrl: _0x2b0f72, }), delete qrcode[_0xaaa198], delete pairingCode[_0xaaa198], { status: !![], message: _0x456959(0x198) } ); } catch (_0x4d67c2) { _0x20276c?.[_0x456959(0x14e)](_0x456959(0x17a), { token: _0xaaa198, message: "Connecting..\x20(1)..", }); } const { version: _0x77017b, isLatest: _0x39d922 } = await fetchLatestBaileysVersion(); console[_0x456959(0x160)](_0x456959(0x164)), console[_0x456959(0x160)]( "using\x20WA\x20v" + _0x77017b[_0x456959(0x151)](".") + _0x456959(0x18c) + _0x39d922 ); const { state: _0x44b742, saveCreds: _0x3b55f2 } = await useMultiFileAuthState(_0x456959(0x16a) + _0xaaa198); sock[_0xaaa198] = _0x242aa2({ version: _0x77017b, browser: ["Windows", _0x456959(0x15f), release()], version: _0x77017b, logger: logger, auth: { creds: _0x44b742["creds"], keys: makeCacheableSignalKeyStore(_0x44b742["keys"], logger), }, msgRetryCounterCache: msgRetryCounterCache, generateHighQualityLinkPreview: !![], retryRequestDelayMs: 0x5 * 0x3e8, maxMsgRetryCount: 0x3e8, syncFullHistory: ![], transactionOpts: { maxCommitRetries: 0x1, delayBetweenTriesMs: 0xa }, }); if ( _0x4e0917 && "me" in _0x44b742[_0x456959(0x170)] === ![] && !_0x44b742[_0x456959(0x170)][_0x456959(0x18d)] ) { const _0x41a3a2 = await getSavedPhoneNumber(_0xaaa198); try { const _0x4eb9c3 = await sock[_0xaaa198][_0x456959(0x152)](_0x41a3a2); (pairingCode[_0xaaa198] = _0x4eb9c3?.[_0x456959(0x19a)](/.{1,4}/g)?.[_0x456959(0x151)]("-") || _0x4eb9c3), console[_0x456959(0x160)](_0x456959(0x197), _0x4eb9c3); } catch (_0x569959) { _0x20276c?.[_0x456959(0x14e)](_0x456959(0x17a), { token: _0xaaa198, message: "Time\x20out,\x20please\x20refresh\x20page", }); } _0x20276c?.[_0x456959(0x14e)](_0x456959(0x18a), { token: _0xaaa198, data: pairingCode[_0xaaa198], message: _0x456959(0x187), }); } return ( sock[_0xaaa198]["ev"][_0x456959(0x16f)](async (_0x14c506) => { const _0x51d54f = _0x456959; if (_0x14c506[_0x51d54f(0x191)]) { const _0x3e3953 = _0x14c506[_0x51d54f(0x191)], { connection: _0x1f20a4, lastDisconnect: _0x3b15c7, qr: _0x3f0fac, } = _0x3e3953; console["log"]("connection", _0x3e3953); if (_0x1f20a4 === _0x51d54f(0x184)) { const _0x4a44b4 = _0x3b15c7[_0x51d54f(0x16c)]?.[_0x51d54f(0x17d)]?.["payload"]?.[ "message" ], _0x4d3aae = _0x3b15c7[_0x51d54f(0x16c)]?.[_0x51d54f(0x17d)]?.["payload"]?.[ _0x51d54f(0x16c) ]; if ( (_0x3b15c7?.[_0x51d54f(0x16c)] instanceof Boom)?.[ _0x51d54f(0x17d) ]?.[_0x51d54f(0x17f)] !== DisconnectReason["loggedOut"] ) { delete qrcode[_0xaaa198], _0x20276c?.[_0x51d54f(0x14e)](_0x51d54f(0x17a), { token: _0xaaa198, message: _0x51d54f(0x175), }); if (_0x4a44b4 == "QR\x20refs\x20attempts\x20ended") { sock[_0xaaa198]["ws"][_0x51d54f(0x184)](), delete qrcode[_0xaaa198], delete pairingCode[_0xaaa198], delete sock[_0xaaa198], _0x20276c?.["emit"]("message", { token: _0xaaa198, message: "Request\x20QR\x20ended.\x20reload\x20web\x20to\x20scan\x20again", }); return; } (_0x4d3aae === _0x51d54f(0x178) || _0x4d3aae === _0x51d54f(0x158)) && (setStatus(_0xaaa198, _0x51d54f(0x172)), clearConnection(_0xaaa198), connectToWhatsApp(_0xaaa198, _0x20276c)), _0x4a44b4 === _0x51d54f(0x15d) && connectToWhatsApp(_0xaaa198, _0x20276c), _0x4a44b4 === _0x51d54f(0x194) && delete sock[_0xaaa198]; } else setStatus(_0xaaa198, _0x51d54f(0x172)), console[_0x51d54f(0x160)](_0x51d54f(0x185)), _0x20276c?.[_0x51d54f(0x14e)](_0x51d54f(0x17a), { token: _0xaaa198, message: _0x51d54f(0x185), }), clearConnection(_0xaaa198), connectToWhatsApp(_0xaaa198, _0x20276c); } _0x3f0fac && _0x179f71[_0x51d54f(0x157)]( _0x3f0fac, function (_0x283b3a, _0x383422) { const _0x12db76 = _0x51d54f; if (_0x283b3a) console[_0x12db76(0x160)](_0x283b3a); (qrcode[_0xaaa198] = _0x383422), connectToWhatsApp(_0xaaa198, _0x20276c, _0x4e0917); } ); if (_0x1f20a4 === _0x51d54f(0x176)) { setStatus(_0xaaa198, _0x51d54f(0x183)), delete qrcode[_0xaaa198], delete pairingCode[_0xaaa198]; let _0x157d6d = sock[_0xaaa198]["user"]["id"][_0x51d54f(0x169)](":"); _0x157d6d = _0x157d6d[0x0] + _0x51d54f(0x153); const _0x5c816d = await getPpUrl(_0xaaa198, _0x157d6d); _0x20276c?.[_0x51d54f(0x14e)](_0x51d54f(0x18f), { token: _0xaaa198, user: sock[_0xaaa198][_0x51d54f(0x154)], ppUrl: _0x5c816d, }), delete qrcode[_0xaaa198], delete pairingCode[_0xaaa198]; } } if (_0x14c506[_0x51d54f(0x166)]) { const _0x382efa = _0x14c506[_0x51d54f(0x166)]; _0x3b55f2(_0x382efa); } if (_0x14c506[_0x51d54f(0x195)]) { const { messages: _0x5ca9bb, type: _0x44dc54 } = _0x14c506[_0x51d54f(0x195)], _0x4ce119 = await IncomingMessage( _0x5ca9bb, _0x44dc54, sock[_0xaaa198] ); } }), sock[_0xaaa198]["ev"]?.["on"](_0x456959(0x171), async (_0x1a1749) => { const _0x34a209 = _0x456959, _0x428fc6 = await getDevice( sock[_0xaaa198][_0x34a209(0x154)]["id"][_0x34a209(0x169)](":")[0x0] ), _0x25f7b4 = _0x428fc6[0x0]["reject_call"]; if (_0x25f7b4 === 0x1) { const { from: _0x5bc376, id: _0x24158f, status: _0x159c1f, } = _0x1a1749[0x0]; if (_0x159c1f == _0x34a209(0x192)) { const _0x37d9f4 = { tag: _0x34a209(0x171), attrs: { from: sock[_0xaaa198][_0x34a209(0x154)]["id"], to: _0x5bc376, id: sock[_0xaaa198]["generateMessageTag"](), }, content: [ { tag: "reject", attrs: { "call-id": _0x24158f, "call-creator": _0x5bc376, count: "0", }, content: undefined, }, ], }; await sock[_0xaaa198][_0x34a209(0x18e)](_0x37d9f4); } } }), { sock: sock[_0xaaa198], qrcode: qrcode[_0xaaa198] } ); }; async function connectWaBeforeSend(_0x1c26d9) { const _0x5cf245 = _0x53c03f; let _0x15115d = undefined, _0x5c9d88; (_0x5c9d88 = await connectToWhatsApp(_0x1c26d9)), console["log"](_0x5c9d88), await _0x5c9d88[_0x5cf245(0x15c)]["ev"]?.["on"]( "connection.update", (_0x599196) => { const _0x592d94 = _0x5cf245, { connection: _0x296ef3, qr: _0x4b1e1e } = _0x599196; _0x296ef3 === _0x592d94(0x176) && (_0x15115d = !![]), _0x4b1e1e && (_0x15115d = ![]); } ); let _0x584528 = 0x0; while (typeof _0x15115d === _0x5cf245(0x173)) { _0x584528++; if (_0x584528 > 0x4) break; await new Promise((_0x2c6d0c) => setTimeout(_0x2c6d0c, 0x3e8)); } return _0x15115d; } const sendAvailable = async (_0x4663bc) => { const _0x4a1a90 = _0x53c03f, _0xc48c1c = await getDevice(_0x4663bc); let _0x908c91; try { return ( _0xc48c1c[0x0][_0x4a1a90(0x18b)] == 0x1 ? (_0x908c91 = await sock[_0x4663bc][_0x4a1a90(0x17b)]("available")) : (_0x908c91 = await sock[_0x4663bc][_0x4a1a90(0x17b)]( _0x4a1a90(0x150) )), _0x908c91 ); } catch (_0x2ff4b6) { return ![]; } }; async function fetchGroups(_0x1f62b5) { const _0x56930b = _0x53c03f; try { let _0x1d07ff = await sock[_0x1f62b5][_0x56930b(0x16d)](), _0x1c718d = Object[_0x56930b(0x14d)](_0x1d07ff) [_0x56930b(0x168)](0x0) ["map"]((_0x58222b) => { return _0x58222b[0x1]; }); return _0x1c718d; } catch (_0x12416f) { return ![]; } } function _0x2388() { const _0x307182 = [ "1577666gVsYpx", "2860850bPGszP", "Connected", "close", "Connection\x20closed.\x20You\x20are\x20logged\x20out.", "\x20Connection\x20failed,please\x20scan\x20first", "Go\x20to\x20whatsapp\x20->\x20link\x20device\x20->\x20link\x20with\x20phone\x20number,\x20and\x20pairing\x20with\x20this\x20code.", "pairing\x20with\x20that\x20code", "please\x20scan\x20with\x20your\x20Whatsapp\x20Accountt", "code", "set_available", ",\x20isLatest:\x20", "registered", "query", "connection-open", "Wrong\x20Parameterss", "connection.update", "offer", "3795111cDNjgx", "Connection\x20was\x20lost", "messages.upsert", "json", "pairing\x20code", "Already\x20connected", "includes", "match", "1953rHQNUI", "send", "logout", "qrcode", "entries", "emit", "credentials/", "unavailable", "join", "requestPairingCode", "@s.whatsapp.net", "user", "status", "child", "toDataURL", "Method\x20Not\x20Allowed", "Nothing\x20deleted", "1744oNbdfB", "8hvoalG", "sock", "Stream\x20Errored\x20(restart\x20required)", "\x20connection\x20failed", "Chrome", "log", "profilePictureUrl", "length", "102029sWKKLq", "You\x20re\x20using\x20whatsapp\x20gateway\x20M\x20Pedia\x20v8.x.x\x20-\x20Contact\x20admin\x20if\x20any\x20trouble\x20:\x206292298859671", "4644493SdIKMK", "creds.update", "onWhatsApp", "slice", "split", "./credentials/", "@g.us", "error", "groupFetchAllParticipating", "body", "process", "creds", "call", "Disconnect", "undefined", "please\x20scan", "Connecting..", "open", "\x20connection\x20restored", "Unauthorized", "https://upload.wikimedia.org/wikipedia/commons/thumb/6/6b/WhatsApp.svg/1200px-WhatsApp.svg.png", "message", "sendPresenceUpdate", "5812758mLPZxy", "output", "rmSync", "statusCode", "existsSync", ]; _0x2388 = function () { return _0x307182; }; return _0x2388(); } async function isExist(_0x4bb215, _0x38270e) { const _0x46816b = _0x53c03f; try { if (typeof sock[_0x4bb215] === "undefined") { const _0x2a108e = await connectWaBeforeSend(_0x4bb215); console[_0x46816b(0x160)](_0x46816b(0x155), _0x2a108e); if (!_0x2a108e) return ![]; } if (_0x38270e[_0x46816b(0x199)](_0x46816b(0x16b))) return !![]; else { const [_0x5a5fe9] = await sock[_0x4bb215][_0x46816b(0x167)]( "+" + _0x38270e ); return _0x38270e[_0x46816b(0x162)] > 0xb ? _0x5a5fe9 : !![]; } } catch (_0x5c6aab) { return console[_0x46816b(0x160)](_0x5c6aab), ![]; } } async function getPpUrl(_0x4a5ffc, _0x27d083, _0x4e0f6f) { const _0x4dd7bb = _0x53c03f; let _0x2d46d9; try { return ( (_0x2d46d9 = await sock[_0x4a5ffc][_0x4dd7bb(0x161)](_0x27d083)), _0x2d46d9 ); } catch (_0x39f8d5) { return _0x4dd7bb(0x179); } } async function deleteCredentials(_0x961e5c, _0x450126 = null) { const _0x10008c = _0x53c03f; _0x450126 !== null && _0x450126["emit"]("message", { token: _0x961e5c, message: "Logout\x20Progres..", }); try { if (typeof sock[_0x961e5c] === _0x10008c(0x173)) { const _0x1ee771 = await connectWaBeforeSend(_0x961e5c); _0x1ee771 && (sock[_0x961e5c][_0x10008c(0x19d)](), delete sock[_0x961e5c]); } else sock[_0x961e5c][_0x10008c(0x19d)](), delete sock[_0x961e5c]; return ( delete qrcode[_0x961e5c], clearInterval(intervalStore[_0x961e5c]), setStatus(_0x961e5c, _0x10008c(0x172)), _0x450126 != null && (_0x450126[_0x10008c(0x14e)](_0x10008c(0x178), _0x961e5c), _0x450126[_0x10008c(0x14e)](_0x10008c(0x17a), { token: _0x961e5c, message: "Connection\x20closed.\x20You\x20are\x20logged\x20out.", })), _0x33eb4e[_0x10008c(0x180)](_0x10008c(0x16a) + _0x961e5c) && _0x33eb4e[_0x10008c(0x17e)]( _0x10008c(0x16a) + _0x961e5c, { recursive: !![], force: !![] }, (_0x178137) => { const _0x24af1a = _0x10008c; if (_0x178137) console[_0x24af1a(0x160)](_0x178137); } ), { status: !![], message: "Deleting\x20session\x20and\x20credential" } ); } catch (_0x541bf1) { return ( console[_0x10008c(0x160)](_0x541bf1), { status: !![], message: _0x10008c(0x159) } ); } } function clearConnection(_0x3edadc) { const _0x2ef80e = _0x53c03f; clearInterval(intervalStore[_0x3edadc]), delete sock[_0x3edadc], delete qrcode[_0x3edadc], setStatus(_0x3edadc, _0x2ef80e(0x172)), _0x33eb4e[_0x2ef80e(0x180)](_0x2ef80e(0x16a) + _0x3edadc) && (_0x33eb4e["rmSync"]( _0x2ef80e(0x16a) + _0x3edadc, { recursive: !![], force: !![] }, (_0x49837f) => { const _0x27d077 = _0x2ef80e; if (_0x49837f) console[_0x27d077(0x160)](_0x49837f); } ), console[_0x2ef80e(0x160)]( _0x2ef80e(0x14f) + _0x3edadc + "\x20is\x20deleted" )); } async function initialize(_0x287e2e, _0x570a16) { const _0x47206a = _0x53c03f, { token: _0x430346 } = _0x287e2e[_0x47206a(0x16e)]; if (_0x430346) { const _0x6dc688 = _0x47206a(0x16a) + _0x430346; if (_0x33eb4e[_0x47206a(0x180)](_0x6dc688)) { sock[_0x430346] = undefined; const _0x597bad = await connectWaBeforeSend(_0x430346); return _0x597bad ? _0x570a16["status"](0xc8)[_0x47206a(0x196)]({ status: !![], message: _0x430346 + _0x47206a(0x177), }) : _0x570a16[_0x47206a(0x155)](0xc8)[_0x47206a(0x196)]({ status: ![], message: _0x430346 + _0x47206a(0x15e), }); } return _0x570a16[_0x47206a(0x19c)]({ status: ![], message: _0x430346 + _0x47206a(0x186), }); } return _0x570a16[_0x47206a(0x19c)]({ status: ![], message: _0x47206a(0x190), }); } export * from "./wa/sender.js"; export { connectToWhatsApp, isExist, getPpUrl, fetchGroups, deleteCredentials, initialize, connectWaBeforeSend, sendAvailable, };