Updated handlers
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user