Team Roles Updates
This commit is contained in:
@@ -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 {
|
||||
|
||||
20
src/events/bot/custom/typstCleanup.ts
Normal file
20
src/events/bot/custom/typstCleanup.ts
Normal 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");
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user