Team Roles Updates

This commit is contained in:
2025-11-23 13:35:43 -05:00
parent c3e52d6a03
commit 758bef92c7
8 changed files with 131 additions and 6 deletions

View File

@@ -11,6 +11,14 @@ export default async(Discord: any, client: BotClient) => {
client.emit("birthdayCheck");
}, ms('30m'));
// Clean up old typst files daily
setInterval(() => {
client.emit("typstCleanup");
}, ms('24h'));
// Run cleanup once on startup
client.emit("typstCleanup");
} catch (err) {
console.log(err);
} finally {

View File

@@ -0,0 +1,20 @@
import BotClient from "../../../libs/BotClient";
export default async(Discord: any, client: BotClient) => {
console.log("[TypstCleanup] Running cleanup for old typst files...");
// Delete files older than 1 day (after the question day passes)
const result = await client.typst.cleanupOldFiles(1);
if (result.deleted > 0) {
console.log(`[TypstCleanup] ✅ Successfully cleaned up ${result.deleted} old typst file(s)`);
}
if (result.errors > 0) {
console.error(`[TypstCleanup] ⚠️ Encountered ${result.errors} error(s) during cleanup`);
}
if (result.deleted === 0 && result.errors === 0) {
console.log("[TypstCleanup] No old files to clean up");
}
}