From ac5c560c54f7a70dcf0faae6468c918b75328266 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bar=C4=B1=C5=9F=20Soner=20U=C5=9Fakl=C4=B1?= Date: Thu, 31 Oct 2019 12:54:03 -0400 Subject: [PATCH] feat: add action:messaging.save --- src/messaging/create.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/messaging/create.js b/src/messaging/create.js index 7a126e1e60..4acd05a1b6 100644 --- a/src/messaging/create.js +++ b/src/messaging/create.js @@ -34,7 +34,7 @@ module.exports = function (Messaging) { Messaging.addMessage = async (data) => { const mid = await db.incrObjectField('global', 'nextMid'); - const timestamp = data.timestamp || new Date().getTime(); + const timestamp = data.timestamp || Date.now(); let message = { content: String(data.content), timestamp: timestamp, @@ -72,6 +72,7 @@ module.exports = function (Messaging) { messages[0].newSet = isNewSet; messages[0].mid = mid; messages[0].roomId = data.roomId; + plugins.fireHook('action:messaging.save', { message: messages[0], data: data }); return messages[0]; };