✨ Check for updates every minute
This commit is contained in:
4
index.js
4
index.js
@ -86,7 +86,7 @@ function formatUpdateMessage(update) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Check for timetable updates
|
// Check for timetable updates
|
||||||
setTimeout(async () => {
|
setInterval(async () => {
|
||||||
const history = await timetable.getUpdates();
|
const history = await timetable.getUpdates();
|
||||||
const lastCheck = await db.getObjectDefault("/lastTimetableUpdate", 0);
|
const lastCheck = await db.getObjectDefault("/lastTimetableUpdate", 0);
|
||||||
const updates = history.filter((entry) => entry.updatedAt > lastCheck);
|
const updates = history.filter((entry) => entry.updatedAt > lastCheck);
|
||||||
@ -104,7 +104,7 @@ setTimeout(async () => {
|
|||||||
client.sendHtmlMessage(roomId, plainText(message), message);
|
client.sendHtmlMessage(roomId, plainText(message), message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}, 1000);
|
}, 1000 * 60);
|
||||||
|
|
||||||
// Handle events
|
// Handle events
|
||||||
client.on("Room.timeline", async function (event, room) {
|
client.on("Room.timeline", async function (event, room) {
|
||||||
|
Reference in New Issue
Block a user