Built motion from commit (unavailable).|2.5.31
[motion2.git] / server / config / schedule / whatsapp.js
index a870ffa..0af99b6 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x3f9f=['util','../../mysqldb','../logger','schedule','redis','defaults','localhost','socket.io-emitter','WhatsappInteraction','findAll','subtract','hours','then','length','map','info','[WHATSAPP]\x20Interactions\x20to\x20close:','join','update','system','YYYY-MM-DD\x20HH:mm:ss','[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:','emit','whatsappInteraction:update','catch','error','inspect','start','lodash','moment','ioredis'];(function(_0x24259d,_0x64a194){var _0x5a701=function(_0x204516){while(--_0x204516){_0x24259d['push'](_0x24259d['shift']());}};_0x5a701(++_0x64a194);}(_0x3f9f,0x190));var _0xf3f9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3f9f[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xf3f9('0x0'));var moment=require(_0xf3f9('0x1'));var Redis=require(_0xf3f9('0x2'));var util=require(_0xf3f9('0x3'));var config=require('../../config/environment');var db=require(_0xf3f9('0x4'))['db'];var logger=require(_0xf3f9('0x5'))(_0xf3f9('0x6'));config[_0xf3f9('0x7')]=_[_0xf3f9('0x8')](config[_0xf3f9('0x7')],{'host':_0xf3f9('0x9'),'port':0x18eb});var io=require(_0xf3f9('0xa'))(new Redis(config['redis']));function closeInteractions(){var _0x3ca16f=[];return db[_0xf3f9('0xb')][_0xf3f9('0xc')]({'raw':!![],'attributes':['id','lastMsgAt'],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()[_0xf3f9('0xd')](0x18,_0xf3f9('0xe'))}}})[_0xf3f9('0xf')](function(_0x279799){if(_0x279799&&_0x279799[_0xf3f9('0x10')]){_0x3ca16f=_[_0xf3f9('0x11')](_0x279799||[],'id');logger[_0xf3f9('0x12')](_0xf3f9('0x13'),_0x3ca16f[_0xf3f9('0x14')]());return db[_0xf3f9('0xb')][_0xf3f9('0x15')]({'closeReason':_0xf3f9('0x16'),'disposition':'timeout','closed':!![],'closedAt':moment()['format'](_0xf3f9('0x17'))},{'where':{'id':_0x3ca16f}});}})[_0xf3f9('0xf')](function(){if(_0x3ca16f&&_0x3ca16f['length']){logger[_0xf3f9('0x12')](_0xf3f9('0x18'),_0x3ca16f['join']());for(var _0x28e4e5=0x0;_0x28e4e5<_0x3ca16f['length'];_0x28e4e5++){io[_0xf3f9('0x19')](_0xf3f9('0x1a'),{'id':_0x3ca16f[_0x28e4e5],'closed':!![]});}}})[_0xf3f9('0x1b')](function(_0x550875){logger[_0xf3f9('0x1c')]('[WHATSAPP]\x20Error\x20closing\x20interactions',_0x550875?util[_0xf3f9('0x1d')](_0x550875,{'showHidden':![],'depth':null}):'');});}exports[_0xf3f9('0x1e')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();};
\ No newline at end of file
+var _0x0be8=['update','timeout','format','YYYY-MM-DD\x20HH:mm:ss','[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:','join','emit','whatsappInteraction:update','catch','error','start','lodash','moment','ioredis','../../config/environment','../../mysqldb','schedule','redis','localhost','socket.io-emitter','WhatsappInteraction','findAll','subtract','then','length','map','[WHATSAPP]\x20Interactions\x20to\x20close:'];(function(_0x167837,_0x237243){var _0x30807c=function(_0x55cedf){while(--_0x55cedf){_0x167837['push'](_0x167837['shift']());}};_0x30807c(++_0x237243);}(_0x0be8,0x92));var _0x80be=function(_0x1bf3f3,_0x3d168d){_0x1bf3f3=_0x1bf3f3-0x0;var _0x194208=_0x0be8[_0x1bf3f3];return _0x194208;};'use strict';var _=require(_0x80be('0x0'));var moment=require(_0x80be('0x1'));var Redis=require(_0x80be('0x2'));var util=require('util');var config=require(_0x80be('0x3'));var db=require(_0x80be('0x4'))['db'];var logger=require('../logger')(_0x80be('0x5'));config['redis']=_['defaults'](config[_0x80be('0x6')],{'host':_0x80be('0x7'),'port':0x18eb});var io=require(_0x80be('0x8'))(new Redis(config['redis']));function closeInteractions(){var _0x561527=[];return db[_0x80be('0x9')][_0x80be('0xa')]({'raw':!![],'attributes':['id','lastMsgAt'],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()[_0x80be('0xb')](0x18,'hours')}}})[_0x80be('0xc')](function(_0x4c96db){if(_0x4c96db&&_0x4c96db[_0x80be('0xd')]){_0x561527=_[_0x80be('0xe')](_0x4c96db||[],'id');logger['info'](_0x80be('0xf'),_0x561527['join']());return db['WhatsappInteraction'][_0x80be('0x10')]({'closeReason':'system','disposition':_0x80be('0x11'),'closed':!![],'closedAt':moment()[_0x80be('0x12')](_0x80be('0x13'))},{'where':{'id':_0x561527}});}})[_0x80be('0xc')](function(){if(_0x561527&&_0x561527[_0x80be('0xd')]){logger['info'](_0x80be('0x14'),_0x561527[_0x80be('0x15')]());for(var _0x5ea64a=0x0;_0x5ea64a<_0x561527[_0x80be('0xd')];_0x5ea64a++){io[_0x80be('0x16')](_0x80be('0x17'),{'id':_0x561527[_0x5ea64a],'closed':!![]});}}})[_0x80be('0x18')](function(_0x2f217e){logger[_0x80be('0x19')]('[WHATSAPP]\x20Error\x20closing\x20interactions',_0x2f217e?util['inspect'](_0x2f217e,{'showHidden':![],'depth':null}):'');});}exports[_0x80be('0x1a')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();};
\ No newline at end of file