From 710e4258f3fc228c1d9b51ddaa867754451d681d Mon Sep 17 00:00:00 2001 From: ChrisChrome Date: Sun, 12 May 2024 08:56:42 -0600 Subject: [PATCH] Fix event code assignment in index.js --- index.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/index.js b/index.js index 81cda62..5194a1a 100644 --- a/index.js +++ b/index.js @@ -284,12 +284,13 @@ xmpp.on("stanza", (stanza) => { const bodyData = getFirstURL(body); // get product id from "x" tag var evt = events[product_id.pil.substring(0, 3)]; - evt.code = product_id.pil.substring(0, 3); if (!evt) { evt = { name: "Unknown", priority: 3 } console.log(`${colors.red("[ERROR]")} Unknown event type: ${product_id.pil.substring(0, 3)}. Fix me`); } + + evt.code = product_id.pil.substring(0, 3); // Check timestamp, if not within 3 minutes, ignore it const now = new Date(); const diff = (now - product_id.timestamp) / 1000 / 60;