From 50e20f38b723b9c5daf32231e84238b67571df56 Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Mon, 21 Oct 2019 09:24:01 +0200 Subject: [PATCH] Evaluation formula for announcement --- Commons.js | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/Commons.js b/Commons.js index 7e4f4b388..f11a46836 100644 --- a/Commons.js +++ b/Commons.js @@ -2691,6 +2691,17 @@ } if (periods > lastPeriodAnnounced) { + + let formulaValue + if (announcement.formula !== undefined) { + try { + formulaValue = eval(announcement.formula.code); + } catch (err) { + announcement.formula.error = err.message + } + } + announcement.formulaValue = formulaValue + bot.SESSION.socialBots.announce(announcement) /* Next, we will remmeber this announcement was already done, so that it is not announced again in further processing of the same day. */