Built motion from commit a5685af.|0.0.128
[motion.git] / server / config / automations / chat.js
index 9039aa5..83a1304 100644 (file)
@@ -1 +1 @@
-var _0x8ee1=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x6C\x6F\x64\x61\x73\x68","\x6D\x6F\x6D\x65\x6E\x74","\x41\x75\x74\x6F\x6D\x61\x74\x69\x6F\x6E","\x2E\x2E\x2F\x2E\x2E\x2F\x6D\x6F\x64\x65\x6C\x73","\x43\x68\x61\x74\x52\x6F\x6F\x6D","\x45\x78\x65\x63\x75\x74\x69\x6E\x67\x20\x43\x68\x61\x74\x20\x41\x75\x74\x6F\x6D\x61\x74\x69\x6F\x6E\x20","\x6C\x6F\x67","\x43\x68\x61\x74\x20\x41\x75\x74\x6F\x6D\x61\x74\x69\x6F\x6E\x20\x65\x78\x65\x63\x20\x65\x72\x72\x6F\x72","\x63\x61\x74\x63\x68","\x69\x64","\x64\x61\x74\x61\x31","\x73\x74\x61\x74\x75\x73","\x61\x63\x74\x69\x6F\x6E","\x66\x6F\x72\x45\x61\x63\x68","\x41\x63\x74\x69\x6F\x6E\x73","\x74\x68\x65\x6E","\x64\x61\x74\x61\x56\x61\x6C\x75\x65\x73","\x70\x75\x73\x68","\x41\x6C\x6C","\x41\x6E\x79","\x6C\x65\x6E\x67\x74\x68","\x24\x61\x6E\x64","\x77\x68\x65\x72\x65","\x24\x6F\x72","\x66\x69\x6E\x64\x41\x6C\x6C","\x66\x69\x6E\x64\x42\x79\x49\x64","\x61\x6C\x6C","\x73\x63\x6F\x70\x65","\x41\x75\x74\x6F\x6D\x61\x74\x69\x63\x20\x63\x68\x61\x74\x20\x73\x74\x61\x74\x75\x73\x20\x65\x72\x72\x6F\x72","\x75\x70\x64\x61\x74\x65","\x66\x69\x65\x6C\x64","\x76\x61\x6C\x75\x65","\x65\x71\x75\x61\x6C\x73","\x6E\x6F\x74\x5F\x65\x71\x75\x61\x6C\x73","\x6F\x70\x65\x72\x61\x74\x6F\x72","\x59\x59\x59\x59\x2D\x4D\x4D\x2D\x44\x44\x20\x48\x48\x3A\x6D\x6D\x3A\x73\x73","\x66\x6F\x72\x6D\x61\x74","\x68\x6F\x75\x72\x73","\x73\x75\x62\x74\x72\x61\x63\x74","\x67\x72\x65\x61\x74\x65\x72","\x67\x72\x65\x61\x74\x65\x72\x5F\x6F\x72\x5F\x65\x71\x75\x61\x6C","\x6C\x65\x73\x73","\x6C\x65\x73\x73\x5F\x6F\x72\x5F\x65\x71\x75\x61\x6C","\x63\x72\x65\x61\x74\x65\x64\x41\x74","\x43\x68\x61\x74\x20\x41\x75\x74\x6F\x6D\x61\x74\x69\x6F\x6E\x20","\x20\x73\x65\x74\x20\x77\x69\x74\x68\x20\x74\x69\x6D\x65\x6F\x75\x74\x20","\x74\x69\x6D\x65\x6F\x75\x74","\x69\x6E\x74\x65\x72\x76\x61\x6C","\x65\x78\x70\x6F\x72\x74\x73","\x20\x63\x72\x65\x61\x74\x65\x64\x2C\x20\x74\x68\x65\x20\x73\x74\x61\x74\x75\x73\x20\x69\x73\x20","\x63\x68\x61\x6E\x6E\x65\x6C","\x63\x68\x61\x74","\x61\x66\x74\x65\x72\x43\x72\x65\x61\x74\x65","\x20\x75\x70\x64\x61\x74\x65\x64\x2C\x20\x74\x68\x65\x20\x73\x74\x61\x74\x75\x73\x20\x69\x73\x20","\x43\x68\x61\x74\x20\x61\x75\x74\x6F\x6D\x61\x74\x69\x6F\x6E\x20\x75\x6E\x73\x65\x74\x20","\x61\x66\x74\x65\x72\x55\x70\x64\x61\x74\x65","\x20\x64\x65\x6C\x65\x74\x65\x64","\x61\x66\x74\x65\x72\x44\x65\x6C\x65\x74\x65","\x43\x68\x61\x74\x20\x41\x75\x74\x6F\x6D\x61\x74\x69\x6F\x6E\x20\x69\x6E\x69\x74\x20\x65\x72\x72\x6F\x72"];_0x8ee1[0];var _=require(_0x8ee1[1]);var moment=require(_0x8ee1[2]);var Automation=require(_0x8ee1[4])[_0x8ee1[3]];var ChatRoom=require(_0x8ee1[4])[_0x8ee1[5]];var automationTimeout;var activeChatAutomations={};function executeAutomation(_0xcac4x8){console[_0x8ee1[7]](_0x8ee1[6],_0xcac4x8);var _0xcac4x9;return Automation[_0x8ee1[28]](_0x8ee1[27])[_0x8ee1[26]](_0xcac4x8)[_0x8ee1[16]](function(_0xcac4xe){_0xcac4x9= _0xcac4xe;var _0xcac4xf=[];var _0xcac4x10=[];var _0xcac4x11={where:{}};_0xcac4xe[_0x8ee1[19]][_0x8ee1[14]](function(_0xcac4x12){_0xcac4x10[_0x8ee1[18]](getCondition(_0xcac4x12[_0x8ee1[17]]))});_0xcac4xe[_0x8ee1[20]][_0x8ee1[14]](function(_0xcac4x12){_0xcac4xf[_0x8ee1[18]](getCondition(_0xcac4x12[_0x8ee1[17]]))});if(_0xcac4x10[_0x8ee1[21]]){_0xcac4x11[_0x8ee1[23]][_0x8ee1[22]]= _0xcac4x10};if(_0xcac4xf[_0x8ee1[21]]){_0xcac4x11[_0x8ee1[23]][_0x8ee1[24]]= _0xcac4xf};return ChatRoom[_0x8ee1[25]](_0xcac4x11)})[_0x8ee1[16]](function(_0xcac4xb){_0xcac4xb[_0x8ee1[14]](function(_0xcac4xc){_0xcac4x9[_0x8ee1[15]][_0x8ee1[14]](function(_0xcac4xd){switch(_0xcac4xd[_0x8ee1[13]]){case _0x8ee1[12]:setStatus(_0xcac4xc[_0x8ee1[10]],_0xcac4xd[_0x8ee1[11]]);break;default:}})})})[_0x8ee1[9]](function(_0xcac4xa){console[_0x8ee1[7]](_0x8ee1[8],_0xcac4xa)})}function setStatus(_0xcac4x14,_0xcac4x15){return ChatRoom[_0x8ee1[30]]({status:_0xcac4x15},{where:{id:_0xcac4x14}})[_0x8ee1[9]](function(_0xcac4xa){console[_0x8ee1[7]](_0x8ee1[29],_0xcac4xa)})}function getCondition(_0xcac4x12){var _0xcac4x17={};switch(_0xcac4x12[_0x8ee1[31]]){case _0x8ee1[12]:switch(_0xcac4x12[_0x8ee1[35]]){case _0x8ee1[33]:_0xcac4x17[_0xcac4x12[_0x8ee1[31]]]= _0xcac4x12[_0x8ee1[32]];break;case _0x8ee1[34]:_0xcac4x17[_0xcac4x12[_0x8ee1[31]]]= {$ne:_0xcac4x12[_0x8ee1[32]]};break;default:};break;case _0x8ee1[44]:var _0xcac4x18=moment()[_0x8ee1[39]](parseInt(_0xcac4x12[_0x8ee1[32]],10),_0x8ee1[38])[_0x8ee1[37]](_0x8ee1[36]);switch(_0xcac4x12[_0x8ee1[35]]){case _0x8ee1[40]:_0xcac4x17[_0xcac4x12[_0x8ee1[31]]]= {lt:_0xcac4x18};break;case _0x8ee1[41]:_0xcac4x17[_0xcac4x12[_0x8ee1[31]]]= {$lte:_0xcac4x18};break;case _0x8ee1[42]:_0xcac4x17[_0xcac4x12[_0x8ee1[31]]]= {$gt:_0xcac4x18};break;case _0x8ee1[43]:_0xcac4x17[_0xcac4x12[_0x8ee1[31]]]= {$gte:_0xcac4x18};break;default:};break;default:};return _0xcac4x17}function createInterval(_0xcac4xe){console[_0x8ee1[7]](_0x8ee1[45],_0xcac4xe[_0x8ee1[10]],_0x8ee1[46],_0xcac4xe[_0x8ee1[47]]* 60* 1000);activeChatAutomations[_0x8ee1[48]+ _0xcac4xe[_0x8ee1[10]]]= setInterval(function(){executeAutomation(_0xcac4xe[_0x8ee1[10]])},_0xcac4xe[_0x8ee1[47]]* 60* 1000)}module[_0x8ee1[49]]= function(){Automation[_0x8ee1[53]](function(_0xcac4x1a,_0xcac4x1b){console[_0x8ee1[7]](_0x8ee1[45],_0xcac4x1a[_0x8ee1[10]],_0x8ee1[50],_0xcac4x1a[_0x8ee1[12]]);if(_0xcac4x1a[_0x8ee1[12]]&& _0xcac4x1a[_0x8ee1[51]]=== _0x8ee1[52]){createInterval(_0xcac4x1a)}});Automation[_0x8ee1[56]](function(_0xcac4x1a,_0xcac4x1b){console[_0x8ee1[7]](_0x8ee1[45],_0xcac4x1a[_0x8ee1[10]],_0x8ee1[54],_0xcac4x1a[_0x8ee1[12]]);if(activeChatAutomations[_0x8ee1[48]+ _0xcac4x1a[_0x8ee1[10]]]){console[_0x8ee1[7]](_0x8ee1[55],_0xcac4x1a[_0x8ee1[10]]);clearInterval(activeChatAutomations[_0x8ee1[48]+ _0xcac4x1a[_0x8ee1[10]]]);delete activeChatAutomations[_0x8ee1[48]+ _0xcac4x1a[_0x8ee1[10]]]};if(_0xcac4x1a[_0x8ee1[12]]&& _0xcac4x1a[_0x8ee1[51]]=== _0x8ee1[52]){createInterval(_0xcac4x1a)}});Automation[_0x8ee1[58]](function(_0xcac4x1a,_0xcac4x1b){console[_0x8ee1[7]](_0x8ee1[45],_0xcac4x1a[_0x8ee1[10]],_0x8ee1[57]);if(activeChatAutomations[_0x8ee1[48]+ _0xcac4x1a[_0x8ee1[10]]]){console[_0x8ee1[7]](_0x8ee1[55],_0xcac4x1a[_0x8ee1[10]]);clearInterval(activeChatAutomations[_0x8ee1[48]+ _0xcac4x1a[_0x8ee1[10]]]);delete activeChatAutomations[_0x8ee1[48]+ _0xcac4x1a[_0x8ee1[10]]]}});return Automation[_0x8ee1[28]](_0x8ee1[27])[_0x8ee1[25]]({where:{status:true,channel:_0x8ee1[52]},attributes:[_0x8ee1[10],_0x8ee1[47]]})[_0x8ee1[16]](function(_0xcac4x1c){_0xcac4x1c[_0x8ee1[14]](function(_0xcac4xe){createInterval(_0xcac4xe)})})[_0x8ee1[9]](function(_0xcac4xa){console[_0x8ee1[7]](_0x8ee1[59],_0xcac4xa)})}
\ No newline at end of file
+var _0x821f=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x6C\x6F\x64\x61\x73\x68","\x6D\x6F\x6D\x65\x6E\x74","\x41\x75\x74\x6F\x6D\x61\x74\x69\x6F\x6E","\x2E\x2E\x2F\x2E\x2E\x2F\x6D\x6F\x64\x65\x6C\x73","\x43\x68\x61\x74\x52\x6F\x6F\x6D","\x45\x78\x65\x63\x75\x74\x69\x6E\x67\x20\x43\x68\x61\x74\x20\x41\x75\x74\x6F\x6D\x61\x74\x69\x6F\x6E\x20","\x6C\x6F\x67","\x43\x68\x61\x74\x20\x41\x75\x74\x6F\x6D\x61\x74\x69\x6F\x6E\x20\x65\x78\x65\x63\x20\x65\x72\x72\x6F\x72","\x63\x61\x74\x63\x68","\x69\x64","\x64\x61\x74\x61\x31","\x73\x74\x61\x74\x75\x73","\x61\x63\x74\x69\x6F\x6E","\x66\x6F\x72\x45\x61\x63\x68","\x41\x63\x74\x69\x6F\x6E\x73","\x74\x68\x65\x6E","\x64\x61\x74\x61\x56\x61\x6C\x75\x65\x73","\x70\x75\x73\x68","\x41\x6C\x6C","\x41\x6E\x79","\x6C\x65\x6E\x67\x74\x68","\x24\x61\x6E\x64","\x77\x68\x65\x72\x65","\x24\x6F\x72","\x66\x69\x6E\x64\x41\x6C\x6C","\x66\x69\x6E\x64\x42\x79\x49\x64","\x61\x6C\x6C","\x73\x63\x6F\x70\x65","\x41\x75\x74\x6F\x6D\x61\x74\x69\x63\x20\x63\x68\x61\x74\x20\x73\x74\x61\x74\x75\x73\x20\x65\x72\x72\x6F\x72","\x75\x70\x64\x61\x74\x65","\x66\x69\x65\x6C\x64","\x76\x61\x6C\x75\x65","\x65\x71\x75\x61\x6C\x73","\x6E\x6F\x74\x5F\x65\x71\x75\x61\x6C\x73","\x6F\x70\x65\x72\x61\x74\x6F\x72","\x59\x59\x59\x59\x2D\x4D\x4D\x2D\x44\x44\x20\x48\x48\x3A\x6D\x6D\x3A\x73\x73","\x66\x6F\x72\x6D\x61\x74","\x68\x6F\x75\x72\x73","\x73\x75\x62\x74\x72\x61\x63\x74","\x67\x72\x65\x61\x74\x65\x72","\x67\x72\x65\x61\x74\x65\x72\x5F\x6F\x72\x5F\x65\x71\x75\x61\x6C","\x6C\x65\x73\x73","\x6C\x65\x73\x73\x5F\x6F\x72\x5F\x65\x71\x75\x61\x6C","\x63\x72\x65\x61\x74\x65\x64\x41\x74","\x43\x68\x61\x74\x20\x41\x75\x74\x6F\x6D\x61\x74\x69\x6F\x6E\x20","\x20\x73\x65\x74\x20\x77\x69\x74\x68\x20\x74\x69\x6D\x65\x6F\x75\x74\x20","\x74\x69\x6D\x65\x6F\x75\x74","\x69\x6E\x74\x65\x72\x76\x61\x6C","\x65\x78\x70\x6F\x72\x74\x73","\x20\x63\x72\x65\x61\x74\x65\x64\x2C\x20\x74\x68\x65\x20\x73\x74\x61\x74\x75\x73\x20\x69\x73\x20","\x63\x68\x61\x6E\x6E\x65\x6C","\x63\x68\x61\x74","\x61\x66\x74\x65\x72\x43\x72\x65\x61\x74\x65","\x20\x75\x70\x64\x61\x74\x65\x64\x2C\x20\x74\x68\x65\x20\x73\x74\x61\x74\x75\x73\x20\x69\x73\x20","\x43\x68\x61\x74\x20\x61\x75\x74\x6F\x6D\x61\x74\x69\x6F\x6E\x20\x75\x6E\x73\x65\x74\x20","\x61\x66\x74\x65\x72\x55\x70\x64\x61\x74\x65","\x20\x64\x65\x6C\x65\x74\x65\x64","\x61\x66\x74\x65\x72\x44\x65\x6C\x65\x74\x65","\x43\x68\x61\x74\x20\x41\x75\x74\x6F\x6D\x61\x74\x69\x6F\x6E\x20\x69\x6E\x69\x74\x20\x65\x72\x72\x6F\x72"];_0x821f[0];var _=require(_0x821f[1]);var moment=require(_0x821f[2]);var Automation=require(_0x821f[4])[_0x821f[3]];var ChatRoom=require(_0x821f[4])[_0x821f[5]];var automationTimeout;var activeChatAutomations={};function executeAutomation(_0xae8dx8){console[_0x821f[7]](_0x821f[6],_0xae8dx8);var _0xae8dx9;return Automation[_0x821f[28]](_0x821f[27])[_0x821f[26]](_0xae8dx8)[_0x821f[16]](function(_0xae8dxe){_0xae8dx9= _0xae8dxe;var _0xae8dxf=[];var _0xae8dx10=[];var _0xae8dx11={where:{}};_0xae8dxe[_0x821f[19]][_0x821f[14]](function(_0xae8dx12){_0xae8dx10[_0x821f[18]](getCondition(_0xae8dx12[_0x821f[17]]))});_0xae8dxe[_0x821f[20]][_0x821f[14]](function(_0xae8dx12){_0xae8dxf[_0x821f[18]](getCondition(_0xae8dx12[_0x821f[17]]))});if(_0xae8dx10[_0x821f[21]]){_0xae8dx11[_0x821f[23]][_0x821f[22]]= _0xae8dx10};if(_0xae8dxf[_0x821f[21]]){_0xae8dx11[_0x821f[23]][_0x821f[24]]= _0xae8dxf};return ChatRoom[_0x821f[25]](_0xae8dx11)})[_0x821f[16]](function(_0xae8dxb){_0xae8dxb[_0x821f[14]](function(_0xae8dxc){_0xae8dx9[_0x821f[15]][_0x821f[14]](function(_0xae8dxd){switch(_0xae8dxd[_0x821f[13]]){case _0x821f[12]:setStatus(_0xae8dxc[_0x821f[10]],_0xae8dxd[_0x821f[11]]);break;default:}})})})[_0x821f[9]](function(_0xae8dxa){console[_0x821f[7]](_0x821f[8],_0xae8dxa)})}function setStatus(_0xae8dx14,_0xae8dx15){return ChatRoom[_0x821f[30]]({status:_0xae8dx15},{where:{id:_0xae8dx14}})[_0x821f[9]](function(_0xae8dxa){console[_0x821f[7]](_0x821f[29],_0xae8dxa)})}function getCondition(_0xae8dx12){var _0xae8dx17={};switch(_0xae8dx12[_0x821f[31]]){case _0x821f[12]:switch(_0xae8dx12[_0x821f[35]]){case _0x821f[33]:_0xae8dx17[_0xae8dx12[_0x821f[31]]]= _0xae8dx12[_0x821f[32]];break;case _0x821f[34]:_0xae8dx17[_0xae8dx12[_0x821f[31]]]= {$ne:_0xae8dx12[_0x821f[32]]};break;default:};break;case _0x821f[44]:var _0xae8dx18=moment()[_0x821f[39]](parseInt(_0xae8dx12[_0x821f[32]],10),_0x821f[38])[_0x821f[37]](_0x821f[36]);switch(_0xae8dx12[_0x821f[35]]){case _0x821f[40]:_0xae8dx17[_0xae8dx12[_0x821f[31]]]= {lt:_0xae8dx18};break;case _0x821f[41]:_0xae8dx17[_0xae8dx12[_0x821f[31]]]= {$lte:_0xae8dx18};break;case _0x821f[42]:_0xae8dx17[_0xae8dx12[_0x821f[31]]]= {$gt:_0xae8dx18};break;case _0x821f[43]:_0xae8dx17[_0xae8dx12[_0x821f[31]]]= {$gte:_0xae8dx18};break;default:};break;default:};return _0xae8dx17}function createInterval(_0xae8dxe){console[_0x821f[7]](_0x821f[45],_0xae8dxe[_0x821f[10]],_0x821f[46],_0xae8dxe[_0x821f[47]]* 60* 1000);activeChatAutomations[_0x821f[48]+ _0xae8dxe[_0x821f[10]]]= setInterval(function(){executeAutomation(_0xae8dxe[_0x821f[10]])},_0xae8dxe[_0x821f[47]]* 60* 1000)}module[_0x821f[49]]= function(){Automation[_0x821f[53]](function(_0xae8dx1a,_0xae8dx1b){console[_0x821f[7]](_0x821f[45],_0xae8dx1a[_0x821f[10]],_0x821f[50],_0xae8dx1a[_0x821f[12]]);if(_0xae8dx1a[_0x821f[12]]&& _0xae8dx1a[_0x821f[51]]=== _0x821f[52]){createInterval(_0xae8dx1a)}});Automation[_0x821f[56]](function(_0xae8dx1a,_0xae8dx1b){console[_0x821f[7]](_0x821f[45],_0xae8dx1a[_0x821f[10]],_0x821f[54],_0xae8dx1a[_0x821f[12]]);if(activeChatAutomations[_0x821f[48]+ _0xae8dx1a[_0x821f[10]]]){console[_0x821f[7]](_0x821f[55],_0xae8dx1a[_0x821f[10]]);clearInterval(activeChatAutomations[_0x821f[48]+ _0xae8dx1a[_0x821f[10]]]);delete activeChatAutomations[_0x821f[48]+ _0xae8dx1a[_0x821f[10]]]};if(_0xae8dx1a[_0x821f[12]]&& _0xae8dx1a[_0x821f[51]]=== _0x821f[52]){createInterval(_0xae8dx1a)}});Automation[_0x821f[58]](function(_0xae8dx1a,_0xae8dx1b){console[_0x821f[7]](_0x821f[45],_0xae8dx1a[_0x821f[10]],_0x821f[57]);if(activeChatAutomations[_0x821f[48]+ _0xae8dx1a[_0x821f[10]]]){console[_0x821f[7]](_0x821f[55],_0xae8dx1a[_0x821f[10]]);clearInterval(activeChatAutomations[_0x821f[48]+ _0xae8dx1a[_0x821f[10]]]);delete activeChatAutomations[_0x821f[48]+ _0xae8dx1a[_0x821f[10]]]}});return Automation[_0x821f[28]](_0x821f[27])[_0x821f[25]]({where:{status:true,channel:_0x821f[52]},attributes:[_0x821f[10],_0x821f[47]]})[_0x821f[16]](function(_0xae8dx1c){_0xae8dx1c[_0x821f[14]](function(_0xae8dxe){createInterval(_0xae8dxe)})})[_0x821f[9]](function(_0xae8dxa){console[_0x821f[7]](_0x821f[59],_0xae8dxa)})}
\ No newline at end of file