From 32fb3f61e8ce90b30d7ba58c820c9be523e7ff3f Mon Sep 17 00:00:00 2001 From: Vitaly Takmazov Date: Sat, 11 Feb 2023 04:02:56 +0300 Subject: HMS notifications --- vnext/server/middleware/event.js | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'vnext/server/middleware') 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); } -- cgit v1.2.3