Built motion from commit f861bcb808219e66da88ba48b61bddb35224a65e. Version 3.0.0...
[motion-next.git] / server / api / whatsappInteraction / whatsappInteraction.events.js
1 'use strict';const a956_0x1448=['save','Users','findAll','events','255667nhVmgg','then','WhatsappMessage','1301sLJNsr','catch','1103475bjytnd','327621zcCyFp','map','@mysqldb','unreadMessages','263729ohpNYb','addHook','WhatsappInteraction','528BKhlYi','remove','exports','1ckNhre','emit','29IANNoN','67017QynGtr','11437pDPxAg','undefined'];const a956_0xe0ec=function(_0x225a30,_0x39001a){_0x225a30=_0x225a30-0x1c9;let _0x1448a1=a956_0x1448[_0x225a30];return _0x1448a1;};const a956_0x322e28=a956_0xe0ec;(function(_0x2c2665,_0x3b8917){const _0x2990e9=a956_0xe0ec;while(!![]){try{const _0x1f0dc7=parseInt(_0x2990e9(0x1dc))+-parseInt(_0x2990e9(0x1d2))+-parseInt(_0x2990e9(0x1cc))*-parseInt(_0x2990e9(0x1ca))+parseInt(_0x2990e9(0x1d8))*-parseInt(_0x2990e9(0x1e2))+-parseInt(_0x2990e9(0x1d5))*parseInt(_0x2990e9(0x1df))+-parseInt(_0x2990e9(0x1cb))+parseInt(_0x2990e9(0x1d7));if(_0x1f0dc7===_0x3b8917)break;else _0x2c2665['push'](_0x2c2665['shift']());}catch(_0x4936ec){_0x2c2665['push'](_0x2c2665['shift']());}}}(a956_0x1448,0x584ac));const EventEmitter=require(a956_0x322e28(0x1d1)),WhatsappInteraction=require(a956_0x322e28(0x1da))['db'][a956_0x322e28(0x1de)],WhatsappMessage=require('@mysqldb')['db'][a956_0x322e28(0x1d4)],WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents['setMaxListeners'](0x0);const events={'afterCreate':a956_0x322e28(0x1ce),'afterUpdate':'update','afterDestroy':a956_0x322e28(0x1e0)};function emitEvent(_0x3d7df3){return function(_0x11ed01){const _0x3d01f0=a956_0xe0ec;_0x11ed01['getUsers']({'attributes':['id'],'raw':!![]})[_0x3d01f0(0x1d3)](function(_0x1f63b9){const _0xe99923=_0x3d01f0;return _0x11ed01['setDataValue'](_0xe99923(0x1cf),_0x1f63b9[_0xe99923(0x1d9)](function(_0x358a57){return{'id':_0x358a57['id']};})),WhatsappMessage[_0xe99923(0x1d0)]({'where':{'WhatsappInteractionId':_0x11ed01['id'],'direction':'in','read':![]},'raw':!![]});})[_0x3d01f0(0x1d3)](function(_0x2201f7){const _0x5c2613=_0x3d01f0;_0x11ed01['setDataValue'](_0x5c2613(0x1db),_0x2201f7['length']),WhatsappInteractionEvents[_0x5c2613(0x1c9)](_0x3d7df3+':'+_0x11ed01['id'],_0x11ed01),WhatsappInteractionEvents['emit'](_0x3d7df3,_0x11ed01);})[_0x3d01f0(0x1d6)](()=>{});};}for(const e in events){if(typeof events[e]!==a956_0x322e28(0x1cd)){const event=events[e];WhatsappInteraction[a956_0x322e28(0x1dd)](e,emitEvent(event));}}module[a956_0x322e28(0x1e1)]=WhatsappInteractionEvents;