fix: date moment + add cron job

This commit is contained in:
Saahil 2025-02-22 23:37:00 -05:00
parent 1fed8532fe
commit daeb78b8f0
No known key found for this signature in database
GPG key ID: 8A8B64515254CFC6
2 changed files with 9 additions and 1 deletions

View file

@ -1,3 +1,4 @@
import { Cron } from "croner";
import { ModifiedApp } from "./slackapp";
// time to get fudge pt 2
@ -36,7 +37,7 @@ const strings = []
}
const daysDiffLength = user.days.length - oldUser.days.length
if(daysDiffLength > 0) {
strings.push(`:yay: ${user.username} has moved up to ${user.days.length + 1} days!`)
strings.push(`:yay: ${user.username} has is now at ${user.days.length} days!`)
}
}
return strings
@ -54,4 +55,9 @@ app.client.chat.postMessage({
text: `Diff for \`${new Date().toISOString()}\` (EST)\n\n${strings.join('\n')}`
})
}
}
export function cronJobFor15daysofcode(app: ModifiedApp) {
new Cron("*/15 * * * *", async () => {
await cronMoment(app)
})
}

View file

@ -14,6 +14,7 @@ import { highSeasCron } from "./highseas";
import { Cron } from "croner";
import { setupCron } from "./juice";
import { tempcronjob } from "./school";
import { cronJobFor15daysofcode } from "./15daysofcode";
const cronWithCheckIn = Sentry.cron.instrumentNodeCron(cron);
@ -269,6 +270,7 @@ export function setupOverallCron(app: ModifiedApp) {
// highSeasCron(app);
// temp? nah perm now
tempcronjob(app);
cronJobFor15daysofcode(app);
return {
// checkAirtableBoba,
cronWithCheckIn,