Built motion from commit 0555bc41.|2.5.41
[motion2.git] / server / config / schedule / whatsapp.js
index f20f9b2..b49d4eb 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xe0b4=['../../mysqldb','../logger','schedule','redis','localhost','socket.io-emitter','WhatsappInteraction','findAll','lastMsgAt','subtract','length','info','[WHATSAPP]\x20Interactions\x20to\x20close:','join','update','system','timeout','format','YYYY-MM-DD\x20HH:mm:ss','then','[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:','emit','whatsappInteraction:update','catch','error','[WHATSAPP]\x20Error\x20closing\x20interactions','inspect','start','lodash','moment','../../config/environment'];(function(_0x245ad3,_0xb97410){var _0x3311f9=function(_0x57c70e){while(--_0x57c70e){_0x245ad3['push'](_0x245ad3['shift']());}};_0x3311f9(++_0xb97410);}(_0xe0b4,0x190));var _0x4e0b=function(_0x43807f,_0x168d34){_0x43807f=_0x43807f-0x0;var _0x220570=_0xe0b4[_0x43807f];return _0x220570;};'use strict';var _=require(_0x4e0b('0x0'));var moment=require(_0x4e0b('0x1'));var Redis=require('ioredis');var util=require('util');var config=require(_0x4e0b('0x2'));var db=require(_0x4e0b('0x3'))['db'];var logger=require(_0x4e0b('0x4'))(_0x4e0b('0x5'));config['redis']=_['defaults'](config[_0x4e0b('0x6')],{'host':_0x4e0b('0x7'),'port':0x18eb});var io=require(_0x4e0b('0x8'))(new Redis(config[_0x4e0b('0x6')]));function closeInteractions(){var _0x15fe5b=[];return db[_0x4e0b('0x9')][_0x4e0b('0xa')]({'raw':!![],'attributes':['id',_0x4e0b('0xb')],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()[_0x4e0b('0xc')](0x18,'hours')}}})['then'](function(_0x5b80bb){if(_0x5b80bb&&_0x5b80bb[_0x4e0b('0xd')]){_0x15fe5b=_['map'](_0x5b80bb||[],'id');logger[_0x4e0b('0xe')](_0x4e0b('0xf'),_0x15fe5b[_0x4e0b('0x10')]());return db[_0x4e0b('0x9')][_0x4e0b('0x11')]({'closeReason':_0x4e0b('0x12'),'disposition':_0x4e0b('0x13'),'closed':!![],'closedAt':moment()[_0x4e0b('0x14')](_0x4e0b('0x15'))},{'where':{'id':_0x15fe5b}});}})[_0x4e0b('0x16')](function(){if(_0x15fe5b&&_0x15fe5b[_0x4e0b('0xd')]){logger[_0x4e0b('0xe')](_0x4e0b('0x17'),_0x15fe5b[_0x4e0b('0x10')]());for(var _0x2ee95c=0x0;_0x2ee95c<_0x15fe5b[_0x4e0b('0xd')];_0x2ee95c++){io[_0x4e0b('0x18')](_0x4e0b('0x19'),{'id':_0x15fe5b[_0x2ee95c],'closed':!![]});}}})[_0x4e0b('0x1a')](function(_0x8e2f9c){logger[_0x4e0b('0x1b')](_0x4e0b('0x1c'),_0x8e2f9c?util[_0x4e0b('0x1d')](_0x8e2f9c,{'showHidden':![],'depth':null}):'');});}exports[_0x4e0b('0x1e')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();};
\ No newline at end of file
+var _0x7b84=['emit','whatsappInteraction:update','error','[WHATSAPP]\x20Error\x20closing\x20interactions','inspect','start','lodash','moment','ioredis','util','../../config/environment','../../mysqldb','../logger','redis','defaults','localhost','socket.io-emitter','WhatsappInteraction','findAll','lastMsgAt','subtract','hours','then','length','map','info','[WHATSAPP]\x20Interactions\x20to\x20close:','join','update','system','timeout','format','YYYY-MM-DD\x20HH:mm:ss','[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:'];(function(_0x52d2d2,_0x199a1b){var _0x47569d=function(_0x4a8309){while(--_0x4a8309){_0x52d2d2['push'](_0x52d2d2['shift']());}};_0x47569d(++_0x199a1b);}(_0x7b84,0x17c));var _0x47b8=function(_0x57e9b8,_0x57e9a9){_0x57e9b8=_0x57e9b8-0x0;var _0x119fcd=_0x7b84[_0x57e9b8];return _0x119fcd;};'use strict';var _=require(_0x47b8('0x0'));var moment=require(_0x47b8('0x1'));var Redis=require(_0x47b8('0x2'));var util=require(_0x47b8('0x3'));var config=require(_0x47b8('0x4'));var db=require(_0x47b8('0x5'))['db'];var logger=require(_0x47b8('0x6'))('schedule');config[_0x47b8('0x7')]=_[_0x47b8('0x8')](config[_0x47b8('0x7')],{'host':_0x47b8('0x9'),'port':0x18eb});var io=require(_0x47b8('0xa'))(new Redis(config[_0x47b8('0x7')]));function closeInteractions(){var _0x53e656=[];return db[_0x47b8('0xb')][_0x47b8('0xc')]({'raw':!![],'attributes':['id',_0x47b8('0xd')],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()[_0x47b8('0xe')](0x18,_0x47b8('0xf'))}}})[_0x47b8('0x10')](function(_0x24d240){if(_0x24d240&&_0x24d240[_0x47b8('0x11')]){_0x53e656=_[_0x47b8('0x12')](_0x24d240||[],'id');logger[_0x47b8('0x13')](_0x47b8('0x14'),_0x53e656[_0x47b8('0x15')]());return db[_0x47b8('0xb')][_0x47b8('0x16')]({'closeReason':_0x47b8('0x17'),'disposition':_0x47b8('0x18'),'closed':!![],'closedAt':moment()[_0x47b8('0x19')](_0x47b8('0x1a'))},{'where':{'id':_0x53e656}});}})[_0x47b8('0x10')](function(){if(_0x53e656&&_0x53e656[_0x47b8('0x11')]){logger[_0x47b8('0x13')](_0x47b8('0x1b'),_0x53e656[_0x47b8('0x15')]());for(var _0x268440=0x0;_0x268440<_0x53e656[_0x47b8('0x11')];_0x268440++){io[_0x47b8('0x1c')](_0x47b8('0x1d'),{'id':_0x53e656[_0x268440],'closed':!![]});}}})['catch'](function(_0x1fe3b7){logger[_0x47b8('0x1e')](_0x47b8('0x1f'),_0x1fe3b7?util[_0x47b8('0x20')](_0x1fe3b7,{'showHidden':![],'depth':null}):'');});}exports[_0x47b8('0x21')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();};
\ No newline at end of file