UNPKG

smssakutoko

Version:

MPWA Multi device beta

1 lines 10.3 kB
const _0x597ef5 = _0x1b53; (function (_0x2a6819, _0x2e1bb3) { const _0x57972f = _0x1b53, _0xd60d92 = _0x2a6819(); while (!![]) { try { const _0x365041 = -parseInt(_0x57972f(0x1db)) / 0x1 * (parseInt(_0x57972f(0x1cf)) / 0x2) + parseInt(_0x57972f(0x1e7)) / 0x3 * (parseInt(_0x57972f(0x1f0)) / 0x4) + parseInt(_0x57972f(0x1bb)) / 0x5 * (-parseInt(_0x57972f(0x1b9)) / 0x6) + -parseInt(_0x57972f(0x1cc)) / 0x7 + -parseInt(_0x57972f(0x1c8)) / 0x8 * (parseInt(_0x57972f(0x1e8)) / 0x9) + -parseInt(_0x57972f(0x1e6)) / 0xa + parseInt(_0x57972f(0x1c6)) / 0xb * (parseInt(_0x57972f(0x1dd)) / 0xc); if (_0x365041 === _0x2e1bb3) break; else _0xd60d92['push'](_0xd60d92['shift']()); } catch (_0x48e2d1) { _0xd60d92['push'](_0xd60d92['shift']()); } } }(_0x4002, 0xb8214)); const { validationResult } = require('express-validator'), { startCon } = require(_0x597ef5(0x1eb)), fs = require('fs'), { formatSendBlast, getFileTypeFromUrl, formatReceipt } = require(_0x597ef5(0x1c9)), { dbQuery } = require('./Querydb'), { Socket } = require(_0x597ef5(0x1f4)), validationSend = async _0x904f65 => { const _0x5b5c85 = _0x597ef5, _0x5285f9 = validationResult(_0x904f65); if (!_0x5285f9[_0x5b5c85(0x1d4)]()) return { 'status': ![], 'msg': _0x5285f9[_0x5b5c85(0x1b6)]()[0x0][_0x5b5c85(0x1de)] }; const _0x3fb83c = await fs[_0x5b5c85(0x1d1)](_0x5b5c85(0x1e1) + _0x904f65[_0x5b5c85(0x1d0)][_0x5b5c85(0x1d7)] + _0x5b5c85(0x1d8)); if (!_0x3fb83c) return { 'status': ![], 'msg': _0x5b5c85(0x1b8) }; const { conn: _0x114fe4, state: _0x34bca4 } = await startCon(_0x904f65[_0x5b5c85(0x1d0)][_0x5b5c85(0x1d7)]); return { 'status': !![], 'data': { 'conn': _0x114fe4, 'state': _0x34bca4 } }; }, sendMessage = async (_0x258050, _0x57bdd1) => { const _0x2f5ed1 = _0x597ef5, _0x13100c = await validationSend(_0x258050), _0x233d73 = formatReceipt(_0x258050['body'][_0x2f5ed1(0x1f3)]); if (_0x13100c['status'] === ![]) return _0x57bdd1[_0x2f5ed1(0x1bf)](0x19a)[_0x2f5ed1(0x1ee)]({ 'status': ![], 'msg': _0x13100c[_0x2f5ed1(0x1de)] }); const { conn: _0x5241ab, state: _0x4e8160 } = _0x13100c['data'], _0x27447b = _0x258050[_0x2f5ed1(0x1d0)][_0x2f5ed1(0x1e3)], _0x2ece97 = await getMessage(_0x27447b, _0x258050['body']); console[_0x2f5ed1(0x1f2)](_0x2ece97), _0x5241ab['ev']['on']('connection.update', async _0x5c1271 => { const _0x1b2e9b = _0x2f5ed1; if (_0x5c1271[_0x1b2e9b(0x1c1)] === _0x1b2e9b(0x1e2)) { const _0xb5778c = await _0x5241ab[_0x1b2e9b(0x1ba)](_0x233d73); if (_0xb5778c[_0x1b2e9b(0x1da)] === 0x0) return _0x57bdd1[_0x1b2e9b(0x1bf)](0x19a)[_0x1b2e9b(0x1ee)]({ 'status': ![], 'msg': _0x1b2e9b(0x1ec) }); await _0x5241ab[_0x1b2e9b(0x1e5)](_0x233d73, _0x2ece97)['then'](() => { const _0x3b4330 = _0x1b2e9b; _0x57bdd1[_0x3b4330(0x1bf)](0xc8)['json']({ 'status': !![], 'msg': 'Message\x20Sent!' }); })[_0x1b2e9b(0x1b7)](_0x248e93 => { const _0x104207 = _0x1b2e9b; _0x57bdd1[_0x104207(0x1bf)](0x19a)['json']({ 'status': ![], 'msg': _0x248e93[_0x104207(0x1c7)] }); }); } }); }; async function asyncForEach(_0x604cc5, _0x114f73) { const _0x159220 = _0x597ef5; for (let _0x35886b = 0x0; _0x35886b < _0x604cc5[_0x159220(0x1da)]; _0x35886b++) { await _0x114f73(_0x604cc5[_0x35886b], _0x35886b, _0x604cc5); } } const blastMessage = async (_0xd4d602, _0x270d0f) => { const _0x2ed39d = _0x597ef5, _0x193ae8 = await dbQuery('SELECT\x20user_id\x20FROM\x20numbers\x20WHERE\x20body\x20=\x20\x27' + _0xd4d602[_0x2ed39d(0x1d0)][_0x2ed39d(0x1d7)] + '\x27'), _0x48dcfa = _0x193ae8[0x0]['user_id'], _0x283ecf = await formatSendBlast(_0xd4d602['body'][_0x2ed39d(0x1e3)], _0xd4d602[_0x2ed39d(0x1d0)][_0x2ed39d(0x1ea)]); function _0x16a827(_0x13dcaf) { const _0x452da6 = _0x2ed39d; return console[_0x452da6(0x1f2)](_0x13dcaf), new Promise(_0x2b1d09 => { setTimeout(() => { _0x2b1d09(''); }, _0x13dcaf); }); } return asyncForEach(_0x283ecf, async ({ number: _0x1f0804, msg: _0x2edc01 }) => { const _0x2c2a67 = _0x2ed39d, _0x508b23 = await validationSend(_0xd4d602); if (_0x508b23['status'] === ![]) return _0x270d0f[_0x2c2a67(0x1bf)](0x19a)['json']({ 'status': ![], 'msg': _0x508b23[_0x2c2a67(0x1de)] }); const { conn: _0x144810, state: _0x2ad088 } = _0x508b23['data']; if (_0x2ad088[_0x2c2a67(0x1be)]['me'] === undefined) return _0x270d0f[_0x2c2a67(0x1bf)](0x19a)[_0x2c2a67(0x1ee)]({ 'status': ![], 'msg': _0x2c2a67(0x1d6) }); _0x144810['ev']['on'](_0x2c2a67(0x1cb), async _0x1a675a => { const _0x77e560 = _0x2c2a67; if (_0x1a675a['connection'] === _0x77e560(0x1e2)) { let _0x58abbf = 'failed'; const _0xd635d9 = formatReceipt(_0x1f0804), _0x436c25 = await _0x144810['onWhatsApp'](_0xd635d9); _0x436c25[_0x77e560(0x1da)] === 0x0 ? _0x58abbf = _0x77e560(0x1ce) : (console[_0x77e560(0x1f2)](_0x2edc01), await _0x144810['sendMessage'](_0xd635d9, _0x2edc01)[_0x77e560(0x1f1)](() => { const _0x5735ba = _0x77e560; _0x58abbf = _0x5735ba(0x1d5); })[_0x77e560(0x1b7)](_0x5c7d7b => { const _0x3e72b9 = _0x77e560; console[_0x3e72b9(0x1f2)](_0x5c7d7b), _0x58abbf = _0x3e72b9(0x1ce); })); const _0x3fe829 = _0xd4d602[_0x77e560(0x1d0)]['type'] === 'image' ? _0x2edc01['caption'] : _0x2edc01['text'], _0x2a2a50 = _0x77e560(0x1b5) + _0x48dcfa + _0x77e560(0x1bd) + _0x1f0804 + _0x77e560(0x1bd) + _0x3fe829 + _0x77e560(0x1bd) + _0xd4d602['body'][_0x77e560(0x1e3)] + _0x77e560(0x1bd) + _0x58abbf + '\x22)'; await dbQuery(_0x2a2a50); } }), await _0x16a827(_0xd4d602[_0x2c2a67(0x1d0)][_0x2c2a67(0x1c3)] * 0x3e8); }), _0x270d0f[_0x2ed39d(0x1bf)](0xc8)['json']({ 'status': !![], 'msg': _0x2ed39d(0x1c2) }); }; function _0x4002() { const _0x551ead = ['socket.io', 'INSERT\x20INTO\x20blasts\x20(user_id,receiver,message,type,status)\x20\x20VALUES\x20(\x22', 'array', 'catch', 'The\x20sender\x20is\x20not\x20registered\x20or\x20not\x20scan\x20yet!', '6ptsUHV', 'onWhatsApp', '5577740VcwOSl', 'template1', '\x22,\x22', 'creds', 'status', 'call', 'connection', 'Blasts\x20message\x20on\x20progress!,you\x20can\x20see\x20the\x20results\x20in\x20history\x20Blast\x20page.', 'delay', 'Button', 'split', '10806323FlavKr', 'message', '8ZoxNOq', './Helper', 'url', 'connection.update', '1258460Oywijh', 'template2', 'failed', '281234ZkrAYc', 'body', 'readFileSync', 'groupFetchAllParticipating', 'text', 'isEmpty', 'success', 'Please\x20Connect\x20your\x20whatsapp\x20before\x20use\x20the\x20Api!', 'sender', '.json', 'slice', 'length', '8KrtzIO', 'phoneNumber', '36lacaYj', 'msg', 'button1', 'map', './sessions/session-', 'open', 'type', 'document', 'sendMessage', '8006840fBKyas', '24cxVmMZ', '999963CvVpMY', 'footer', 'data', './WaConnection', 'The\x20Destination\x20Number\x20Is\x20Not\x20Registered\x20On\x20Whatsapp', 'entries', 'json', 'button2', '569536fWPcLa', 'then', 'log', 'number']; _0x4002 = function () { return _0x551ead; }; return _0x4002(); } function _0x1b53(_0x188534, _0xa4d969) { const _0x4002bb = _0x4002(); return _0x1b53 = function (_0x1b5358, _0x2530ab) { _0x1b5358 = _0x1b5358 - 0x1b5; let _0x76c1aa = _0x4002bb[_0x1b5358]; return _0x76c1aa; }, _0x1b53(_0x188534, _0xa4d969); } async function getMessage(_0x5646a1, _0xe04998) { const _0xef856d = _0x597ef5; try { let _0x54a586; switch (_0x5646a1) { case _0xef856d(0x1d3): _0x54a586 = { 'text': _0xe04998['message'] }; break; case 'image': _0x54a586 = { 'image': { 'url': _0xe04998[_0xef856d(0x1ca)] }, 'caption': _0xe04998['message'] }; break; case _0xef856d(0x1e4): const { explode: _0x1e1134, fileType: _0x28b154 } = getFileTypeFromUrl(_0xe04998['url']); _0x54a586 = { 'document': { 'url': _0xe04998[_0xef856d(0x1ca)] }, 'fileName': _0x1e1134, 'mimetype': 'application/' + _0x28b154 }; break; case 'button': const _0x4b3cd2 = [{ 'buttonId': 'Id1', 'buttonText': { 'displayText': _0xe04998[_0xef856d(0x1df)] }, 'type': 0x1 }, { 'buttonId': 'Id2', 'buttonText': { 'displayText': _0xe04998[_0xef856d(0x1ef)] }, 'type': 0x1 }]; _0x54a586 = { 'text': _0xe04998[_0xef856d(0x1c7)], 'footer': _0xe04998['footer'], 'buttons': _0x4b3cd2, 'headerType': 0x1 }; break; case 'template': const _0x19f6dd = _0xe04998[_0xef856d(0x1bc)][_0xef856d(0x1c5)]('|'), _0x1417f6 = _0xe04998[_0xef856d(0x1cd)][_0xef856d(0x1c5)]('|'), _0x2beea7 = _0x19f6dd[0x0] === _0xef856d(0x1c0) ? _0xef856d(0x1dc) : _0xef856d(0x1ca), _0x45226b = _0x1417f6[0x0] === 'call' ? _0xef856d(0x1dc) : _0xef856d(0x1ca), _0x1566b3 = _0x19f6dd[0x0] + 'Button', _0x26ea7d = _0x1417f6[0x0] + _0xef856d(0x1c4), _0x49b405 = [{ 'index': 0x1, [_0x1566b3]: { [_0x2beea7]: _0x19f6dd[0x2], 'displayText': _0x19f6dd[0x1] } }, { 'index': 0x2, [_0x26ea7d]: { [_0x45226b]: _0x1417f6[0x2], 'displayText': _0x1417f6[0x1] } }], _0x3ffc4f = { 'text': _0xe04998['message'], 'footer': _0xe04998[_0xef856d(0x1e9)], 'templateButtons': _0x49b405 }; _0x54a586 = _0x3ffc4f; break; default: break; }return _0x54a586; } catch (_0x298104) { console['log'](_0x298104); } } const getGroup = async (_0x5cabb0, _0xd88151) => { const _0x46fd05 = _0x597ef5, _0x90a097 = await validationSend(_0x5cabb0); if (_0x90a097[_0x46fd05(0x1bf)] === ![]) return _0xd88151['status'](0x19a)['json']({ 'status': ![], 'msg': _0x90a097[_0x46fd05(0x1de)] }); const { conn: _0x4a2e67, state: _0x11064 } = _0x90a097[_0x46fd05(0x1ea)], _0x159589 = _0x5cabb0[_0x46fd05(0x1d0)][_0x46fd05(0x1e3)], _0xdb78ae = await getMessage(_0x159589, _0x5cabb0[_0x46fd05(0x1d0)]); console['log'](_0xdb78ae), _0x4a2e67['ev']['on']('connection.update', async _0xece8cb => { const _0x2cfa69 = _0x46fd05; if (_0xece8cb['connection'] === _0x2cfa69(0x1e2)) { let _0x4bfa09 = await _0x4a2e67[_0x2cfa69(0x1d2)](), _0x219588 = Object[_0x2cfa69(0x1ed)](_0x4bfa09)[_0x2cfa69(0x1d9)](0x0)[_0x2cfa69(0x1e0)](_0x4611c7 => _0x4611c7[0x1]); return _0xd88151[_0x2cfa69(0x1bf)](0xc8)[_0x2cfa69(0x1ee)]({ 'status': !![], 'groups': _0x219588 }); } }); }, InitialDevice = async (_0x2a4005, _0x4e9431) => { const _0x56a46d = _0x597ef5, _0x50b9ab = await validationSend(_0x2a4005); if (_0x50b9ab[_0x56a46d(0x1bf)] === ![]) return _0x4e9431[_0x56a46d(0x1bf)](0x19a)['json']({ 'status': ![], 'msg': _0x50b9ab[_0x56a46d(0x1de)] }); const { conn: _0x4888d9, state: _0x3e178e } = _0x50b9ab['data'], _0x432f06 = _0x2a4005[_0x56a46d(0x1d0)]['type']; _0x4888d9['ev']['on']('connection.update', async _0x2900b7 => { const _0x2e8314 = _0x56a46d; if (_0x2900b7[_0x2e8314(0x1c1)] === _0x2e8314(0x1e2)) return !![]; return ![]; }); }; module['exports'] = { 'sendMessage': sendMessage, 'blastMessage': blastMessage, 'getGroup': getGroup, 'InitialDevice': InitialDevice };