mirror of
https://github.com/System-End/slack-end.git
synced 2026-04-19 22:05:10 +00:00
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:
parent
7e625f74d0
commit
6cf0a6b716
1 changed files with 16 additions and 14 deletions
|
|
@ -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) {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue