From c15430b5ea03cdfe6f43637f2c10b544171c12fc Mon Sep 17 00:00:00 2001 From: DGoel1602 Date: Sun, 8 Feb 2026 11:24:15 -0500 Subject: [PATCH 1/8] fix: remove early return from genCronLogic for reminders --- apps/cron/src/crons/reminder.ts | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/apps/cron/src/crons/reminder.ts b/apps/cron/src/crons/reminder.ts index e35d7a9ec..f19ae4a16 100644 --- a/apps/cron/src/crons/reminder.ts +++ b/apps/cron/src/crons/reminder.ts @@ -156,19 +156,18 @@ function genCronLogic(webhook: WebhookClient): () => Promise { await webhook.send({ content: `# Events this Week (${formattedDate})\nWe hope you've had an amazing weekend so far, @everyone :D\nHere are some of the events planned for this week!`, }); - return; - } - - const today = new Date(); - const formattedDate = today.toLocaleDateString("en-US", { - weekday: "long", - month: "long", - day: "numeric", - }); + } else { + const today = new Date(); + const formattedDate = today.toLocaleDateString("en-US", { + weekday: "long", + month: "long", + day: "numeric", + }); - await webhook.send({ - content: `# Event Reminders\nGood morning, <@&${DISCORD_REMINDER_ROLE_ID}>!\nToday is ${formattedDate}, and here are some reminders about upcoming events!`, - }); + await webhook.send({ + content: `# Event Reminders\nGood morning, <@&${DISCORD_REMINDER_ROLE_ID}>!\nToday is ${formattedDate}, and here are some reminders about upcoming events!`, + }); + } // For each prefix group, send a line announcing the prefix, then send each event as an embed for (const group of groupedPrefixes) { From 8ecb8ddfcb9bdfa2849285050f646af29248aa6b Mon Sep 17 00:00:00 2001 From: DGoel1602 Date: Sun, 8 Feb 2026 11:25:43 -0500 Subject: [PATCH 2/8] chore: remove hack reminders for now --- apps/cron/src/index.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/apps/cron/src/index.ts b/apps/cron/src/index.ts index 3d97e6244..90a8c9275 100644 --- a/apps/cron/src/index.ts +++ b/apps/cron/src/index.ts @@ -2,7 +2,7 @@ import { alumniAssign } from "./crons/alumni-assign"; import { capybara, cat, duck, goat } from "./crons/animals"; import { backupFilteredDb } from "./crons/backup-filtered-db"; import { leetcode } from "./crons/leetcode"; -import { hackReminders, preReminders, reminders } from "./crons/reminder"; +import { preReminders, reminders } from "./crons/reminder"; import { roleSync } from "./crons/role-sync"; alumniAssign.schedule(); @@ -18,6 +18,8 @@ leetcode.schedule(); preReminders.schedule(); reminders.schedule(); -hackReminders.schedule(); + +// Silencing for now, needs to be manually re-enabled for hacks @WHOEVER_IS_DEV_LEAD_RN +// hackReminders.schedule(); roleSync.schedule(); From 06116a07da3999cfd4cd833ec114af864f0bf587 Mon Sep 17 00:00:00 2001 From: DGoel1602 Date: Sun, 8 Feb 2026 11:31:39 -0500 Subject: [PATCH 3/8] chore: add logging to reminders --- apps/cron/src/crons/reminder.ts | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/apps/cron/src/crons/reminder.ts b/apps/cron/src/crons/reminder.ts index f19ae4a16..8135451e8 100644 --- a/apps/cron/src/crons/reminder.ts +++ b/apps/cron/src/crons/reminder.ts @@ -137,6 +137,16 @@ function genCronLogic(webhook: WebhookClient): () => Promise { 0, ); + let total_events = 0; + for(const group of groupedPrefixes) { + total_events += group.events.length; + console.log(`Events for ${group.prefix}`); + for(const event of group.events) { + console.log(`Title: ${event.name}`); + } + } + console.log(`Found a total of ${total_events} events`); + if (totalEvents === 0) return; // Sunday gets all events From c8c7a299ed47b92bc9f2e4e9348d60bc47b88b9a Mon Sep 17 00:00:00 2001 From: DGoel1602 Date: Sun, 8 Feb 2026 11:41:03 -0500 Subject: [PATCH 4/8] fix: logging in role sync --- apps/cron/src/crons/role-sync.ts | 27 +++++++++++++-------------- 1 file changed, 13 insertions(+), 14 deletions(-) diff --git a/apps/cron/src/crons/role-sync.ts b/apps/cron/src/crons/role-sync.ts index 9ab47d866..52cd83ac9 100644 --- a/apps/cron/src/crons/role-sync.ts +++ b/apps/cron/src/crons/role-sync.ts @@ -32,6 +32,9 @@ export const roleSync = new CronBuilder({ let addedCount = 0; let removedCount = 0; let skippedCount = 0; + let errorCount = 0; + + let erroredUsers = []; for (const user of users) { try { @@ -57,9 +60,6 @@ export const roleSync = new CronBuilder({ // Check 1: Remove permissions from Blade if user doesn't have role on Discord for (const perm of userPermissions) { if (!discordRoleIds.includes(perm.discordRoleId)) { - console.log( - `Removing "${perm.roleName}" from user ${user.name} (${user.discordUserId}) - not on Discord`, - ); await db .delete(Permissions) .where(eq(Permissions.id, perm.permissionId)); @@ -78,9 +78,6 @@ export const roleSync = new CronBuilder({ continue; } - console.log( - `Adding "${role.name}" to user ${user.name} (${user.discordUserId}) - found on Discord`, - ); await db.insert(Permissions).values({ roleId: role.id, userId: user.id, @@ -90,21 +87,23 @@ export const roleSync = new CronBuilder({ } catch (error) { // User might not be in the guild anymore if ((error as { status?: number } | undefined)?.status === 404) { - console.log( - `User ${user.name} (${user.discordUserId}) not found in guild - skipping`, - ); skippedCount++; } else { - console.error( - `Error syncing user ${user.name} (${user.discordUserId}):`, - error, - ); + errorCount++; + if(erroredUsers.length < 5) erroredUsers.push(user.name); } } } console.log( - `Sync completed. Added: ${addedCount}, Removed: ${removedCount}, Skipped: ${skippedCount}`, + `Sync completed. Added: ${addedCount}, Removed: ${removedCount}, Skipped: ${skippedCount}, Errors: ${errorCount}`, ); + + if(errorCount > 0) { + console.log(`First ${erroredUsers.length} users it errored for:`); + for(const name of erroredUsers) { + console.log(name); + } + } }, ); From 2802625a6451c534ae36e5a7316665e5c1a4995f Mon Sep 17 00:00:00 2001 From: DGoel1602 Date: Sun, 8 Feb 2026 11:41:21 -0500 Subject: [PATCH 5/8] chore: format --- apps/cron/src/crons/reminder.ts | 18 +++++++++--------- apps/cron/src/crons/role-sync.ts | 20 ++++++++++---------- 2 files changed, 19 insertions(+), 19 deletions(-) diff --git a/apps/cron/src/crons/reminder.ts b/apps/cron/src/crons/reminder.ts index 8135451e8..6a7224c93 100644 --- a/apps/cron/src/crons/reminder.ts +++ b/apps/cron/src/crons/reminder.ts @@ -137,15 +137,15 @@ function genCronLogic(webhook: WebhookClient): () => Promise { 0, ); - let total_events = 0; - for(const group of groupedPrefixes) { - total_events += group.events.length; - console.log(`Events for ${group.prefix}`); - for(const event of group.events) { - console.log(`Title: ${event.name}`); - } - } - console.log(`Found a total of ${total_events} events`); + let total_events = 0; + for (const group of groupedPrefixes) { + total_events += group.events.length; + console.log(`Events for ${group.prefix}`); + for (const event of group.events) { + console.log(`Title: ${event.name}`); + } + } + console.log(`Found a total of ${total_events} events`); if (totalEvents === 0) return; diff --git a/apps/cron/src/crons/role-sync.ts b/apps/cron/src/crons/role-sync.ts index 52cd83ac9..c70610309 100644 --- a/apps/cron/src/crons/role-sync.ts +++ b/apps/cron/src/crons/role-sync.ts @@ -32,9 +32,9 @@ export const roleSync = new CronBuilder({ let addedCount = 0; let removedCount = 0; let skippedCount = 0; - let errorCount = 0; + let errorCount = 0; - let erroredUsers = []; + let erroredUsers = []; for (const user of users) { try { @@ -89,8 +89,8 @@ export const roleSync = new CronBuilder({ if ((error as { status?: number } | undefined)?.status === 404) { skippedCount++; } else { - errorCount++; - if(erroredUsers.length < 5) erroredUsers.push(user.name); + errorCount++; + if (erroredUsers.length < 5) erroredUsers.push(user.name); } } } @@ -99,11 +99,11 @@ export const roleSync = new CronBuilder({ `Sync completed. Added: ${addedCount}, Removed: ${removedCount}, Skipped: ${skippedCount}, Errors: ${errorCount}`, ); - if(errorCount > 0) { - console.log(`First ${erroredUsers.length} users it errored for:`); - for(const name of erroredUsers) { - console.log(name); - } - } + if (errorCount > 0) { + console.log(`First ${erroredUsers.length} users it errored for:`); + for (const name of erroredUsers) { + console.log(name); + } + } }, ); From b3217d268360934b482ebcf7a7ba0d34a7e85813 Mon Sep 17 00:00:00 2001 From: DGoel1602 Date: Sun, 8 Feb 2026 11:47:50 -0500 Subject: [PATCH 6/8] chore: naming convention --- apps/cron/src/crons/reminder.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/apps/cron/src/crons/reminder.ts b/apps/cron/src/crons/reminder.ts index 6a7224c93..fe9dd0442 100644 --- a/apps/cron/src/crons/reminder.ts +++ b/apps/cron/src/crons/reminder.ts @@ -137,15 +137,15 @@ function genCronLogic(webhook: WebhookClient): () => Promise { 0, ); - let total_events = 0; + let eventsCount = 0; for (const group of groupedPrefixes) { - total_events += group.events.length; + eventsCount += group.events.length; console.log(`Events for ${group.prefix}`); for (const event of group.events) { console.log(`Title: ${event.name}`); } } - console.log(`Found a total of ${total_events} events`); + console.log(`Found a total of ${eventsCount} events`); if (totalEvents === 0) return; From 7e8a17f550336665cbb6353c704de89d2e926d71 Mon Sep 17 00:00:00 2001 From: DGoel1602 Date: Sun, 8 Feb 2026 11:48:42 -0500 Subject: [PATCH 7/8] fix: reuse correct var --- apps/cron/src/crons/reminder.ts | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/apps/cron/src/crons/reminder.ts b/apps/cron/src/crons/reminder.ts index fe9dd0442..4413ce96c 100644 --- a/apps/cron/src/crons/reminder.ts +++ b/apps/cron/src/crons/reminder.ts @@ -137,15 +137,13 @@ function genCronLogic(webhook: WebhookClient): () => Promise { 0, ); - let eventsCount = 0; + console.log(`Found a total of ${totalEvents} events`); for (const group of groupedPrefixes) { - eventsCount += group.events.length; console.log(`Events for ${group.prefix}`); for (const event of group.events) { console.log(`Title: ${event.name}`); } } - console.log(`Found a total of ${eventsCount} events`); if (totalEvents === 0) return; From 44ba973cfc5d8c9c8a1a7475156ffdd25ea43f80 Mon Sep 17 00:00:00 2001 From: DGoel1602 Date: Sun, 8 Feb 2026 11:56:08 -0500 Subject: [PATCH 8/8] fix: console convention for error logging --- apps/cron/src/crons/role-sync.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/apps/cron/src/crons/role-sync.ts b/apps/cron/src/crons/role-sync.ts index c70610309..2a33443a6 100644 --- a/apps/cron/src/crons/role-sync.ts +++ b/apps/cron/src/crons/role-sync.ts @@ -34,7 +34,7 @@ export const roleSync = new CronBuilder({ let skippedCount = 0; let errorCount = 0; - let erroredUsers = []; + const erroredUsers = []; for (const user of users) { try { @@ -100,9 +100,9 @@ export const roleSync = new CronBuilder({ ); if (errorCount > 0) { - console.log(`First ${erroredUsers.length} users it errored for:`); + console.warn(`First ${erroredUsers.length} users it errored for:`); for (const name of erroredUsers) { - console.log(name); + console.warn(name); } } },