enhancement(lint): Fix lint errors for src/modules/flightly.ts

Co-authored-by: NeonGamerBot-QK <neon@saahild.com>
Signed-off-by: zeon-neon[bot] <136533918+zeon-neon[bot]@users.noreply.github.com>
This commit is contained in:
zeon-neon[bot] 2025-03-27 15:37:39 +00:00 committed by GitHub
parent 7e625f74d0
commit 6cf0a6b716
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -196,26 +196,28 @@ function detectChanges(newData, previousData) {
export function setupFlightlyCron(app: ModifiedApp) {
new Cron("*/20 * * * *", async () => {
await cronForTrackingData(app);
})
});
}
export async function cronForTrackingData(app: ModifiedApp) {
const IdsToTrack = app.dbs.flightly.get("flightly-ids");
for (const { flightIds, userId } of IdsToTrack) {
for(const flightId of flightIds){
const flightD = await getFlightData(flightId);
const changes = await detectChanges(flightD, app.dbs.flightly.get(userId+flightD.id));
if (changes.length > 0) {
await app.client.chat.postMessage({
channel: userId,
text: `Flight updates for \`${flightId}\`\n`+changes.join("\n"),
});
for (const flightId of flightIds) {
const flightD = await getFlightData(flightId);
const changes = await detectChanges(
flightD,
app.dbs.flightly.get(userId + flightD.id),
);
if (changes.length > 0) {
await app.client.chat.postMessage({
channel: userId,
text: `Flight updates for \`${flightId}\`\n` + changes.join("\n"),
});
}
app.dbs.flightly.set(userId + flightD.id, flightD);
await new Promise((r) => setTimeout(r, 1000));
}
app.dbs.flightly.set(userId+flightD.id, flightD);
await new Promise((r) => setTimeout(r, 1000));
}
await new Promise((r) => setTimeout(r, 250));
await new Promise((r) => setTimeout(r, 250));
}
}
export async function getTextVersionOfData(flightId: string) {