fix: istg if doesnt work

This commit is contained in:
Saahil 2025-01-06 19:19:47 -05:00
parent d906f1c9cd
commit 9fce24a521
No known key found for this signature in database
GPG key ID: 8A8B64515254CFC6
2 changed files with 24 additions and 1 deletions

View file

@ -10,7 +10,7 @@ import { View } from "@slack/bolt";
import Loader from "./modules/CommandLoader";
import path from "path";
import JSONdb from "simple-json-db";
import cron from "node-cron"
import * as utils from "./modules/index";
import howWasYourDay, {
cached_spotify_songs,
@ -84,5 +84,21 @@ function handleError(e: any) {
} catch (e) {}
}
setupOverallCron(app);
// im going parinoiddd
cron.schedule(
"30 21 * * *",
async () => {
try {
await howWasYourDay(app);
} catch (e: any) {
// uh guess what this doesnt run because this cron doesnt run ...
app.client.chat.postMessage({
channel: `C07R8DYAZMM`,
text: `So i was supposed to say How was your day neon right?? well guess what neon broke my damn code!! so he gets to deal with this shitty error: \`\`\`\n${e.stack}\`\`\``,
});
}
},
{ name: "howwasmyday" },
);
process.on("unhandledRejection", handleError);
process.on("unhandledException", handleError);

View file

@ -99,6 +99,7 @@ export function setupOverallCron(app: ModifiedApp) {
// at home? at school?
// set away if in any focus mode
});
try {
cronWithCheckIn.schedule(
"30 21 * * *",
async () => {
@ -114,6 +115,12 @@ export function setupOverallCron(app: ModifiedApp) {
},
{ name: "howwasmyday" },
);
} catch (e) {
app.client.chat.postMessage({
channel: `C07R8DYAZMM`,
text: `So i was supposed to say How was your day neon right?? well guess what neon broke my damn code!! so he gets to deal with this shitty error: \`\`\`\n${e.stack}\`\`\``,
});
}
cronWithCheckIn.schedule(
"1 7 * * 1-5",
async () => {