From cc944871a4b2c2a97f556345dc2c26085f6671c0 Mon Sep 17 00:00:00 2001 From: minie4 Date: Sat, 24 Jun 2023 15:15:33 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=94=A7=20Make=20update=20interval=20confi?= =?UTF-8?q?gurable?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .env.sample | 3 +++ index.js | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/.env.sample b/.env.sample index 63ffb04..ea29f59 100644 --- a/.env.sample +++ b/.env.sample @@ -5,6 +5,9 @@ # (Make sure the /api and https:// is included in the endpoint) TIMETABLE_ENDPOINT= TIMETABLE_TOKEN= +# How often should the script query for timetable updates +# Default: 60000 (every minute) +TIMETABLE_INTERVAL= # Set the Matrix url, bot user name and auth token here MATRIX_URL= diff --git a/index.js b/index.js index f71d6c0..eef4e70 100644 --- a/index.js +++ b/index.js @@ -126,7 +126,7 @@ setInterval(async () => { client.sendHtmlMessage(roomId, plainText(message), message); } } -}, 1000); +}, process.env.TIMETABLE_INTERVAL || 1000 * 60); // Handle events client.on("Room.timeline", async function (event, room) {