Updated handlers

This commit is contained in:
2024-09-13 18:20:38 +02:00
parent da16275df4
commit 7caf6eda5f
7 changed files with 26 additions and 66 deletions

View File

@@ -2,11 +2,12 @@ import { CronJob } from "cron"
import fs from "fs"
import { ICron } from "interfaces"
import path from "path"
type FileType = "js" | "ts"
const __dirname = import.meta.dirname
export default async function loadCronEvents() {
export default async function loadCronEvents(ft: FileType) {
const cronPath = path.join(__dirname, "..", "..", "events", "cron")
const cronFiles = fs.readdirSync(cronPath).filter(file => file.endsWith(".js"))
const cronFiles = fs.readdirSync(cronPath).filter(file => file.endsWith(ft))
for (const file of cronFiles) {
const filePath = path.join(cronPath, file)