From cd9b9144559a6d8340c0d0711ee715f4186264d1 Mon Sep 17 00:00:00 2001 From: Rory& Date: Sat, 20 Sep 2025 21:51:54 +0200 Subject: [PATCH] h --- index.js | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/index.js b/index.js index 6b1c75c..bde5070 100644 --- a/index.js +++ b/index.js @@ -163,12 +163,17 @@ ${stats.isNewRecord ? `🎉 NEW RECORD! 🎉 A new record has been set, at ${sta `.split('\n').map(s => s.trim()).join(''), "tel.litenet.call_stats_summary": { - ...stats, date: yesterday + ...stats, + date: yesterday, + allTimeRecordData: records.callRecord } } - console.log("Sending Matrix message:", JSON.stringify(message, null, 2)); - console.log("Plaintext:\n", message.body); - console.log("HTML:\n", message.formatted_body); + + if (process.env.LOG_MESSAGES) { + console.log("Sending Matrix message:", JSON.stringify(message, null, 2)); + console.log("Plaintext:\n", message.body); + console.log("HTML:\n", message.formatted_body); + } if (!process.env.NOOP) { if (!process.env.MATRIX_BASE_URL || !process.env.MATRIX_ROOM_ID || !process.env.MATRIX_ACCESS_TOKEN) { @@ -218,7 +223,10 @@ async function sendSummaryDiscord(yesterday, stats) { } const payload = { embeds: [ embed ] }; - console.log("Sending Discord message:", JSON.stringify(payload, null, 2)); + + if (process.env.LOG_MESSAGES) + console.log("Sending Discord message:", JSON.stringify(payload, null, 2)); + if (hook && !process.env.NOOP) await hook.send(payload); } @@ -227,5 +235,6 @@ if (process.env.NOOP || process.env.RUN_ONCE) { sendSummary(); return; } + console.log("Scheduling..."); const schedule = cron.schedule("0 1 * * *", sendSummary);