diff options
author | Vitaly Takmazov | 2023-02-11 04:02:56 +0300 |
---|---|---|
committer | Vitaly Takmazov | 2023-02-11 04:03:08 +0300 |
commit | 32fb3f61e8ce90b30d7ba58c820c9be523e7ff3f (patch) | |
tree | cf58e645d22add476091ab489a965cda1ada563c /vnext/server/middleware/event.js | |
parent | 387a31dc3c40fe12edb97e061293a2e4ae27fb6a (diff) |
HMS notifications
Diffstat (limited to 'vnext/server/middleware/event.js')
-rw-r--r-- | vnext/server/middleware/event.js | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/vnext/server/middleware/event.js b/vnext/server/middleware/event.js index 5ea855dd..136ae268 100644 --- a/vnext/server/middleware/event.js +++ b/vnext/server/middleware/event.js @@ -4,6 +4,7 @@ import { sendTelegramNotification } from '../durov'; import { subscribers } from '../http'; import { sendNotification, buildNotification } from '../sender'; import debug from 'debug'; +import { send } from '../hms'; var log = debug('event'); /** @type {number[]} */ @@ -40,6 +41,11 @@ function processMessageEvent(msg) { .filter(t => ['durov'].includes(t.type)) .map(t => t.token); sendTelegramNotification(msg, durovIds); + let hmsIds = (user.tokens || []) + .filter(t => t.type === 'hcm') + .map(t => t.token); + log(`${user.uname}: ${hmsIds}`); + send(msg, hmsIds).then(() => {}).catch(log); }); }).catch(log); } |