diff --git a/src/handlers/schedule/index.ts b/src/handlers/schedule/index.ts index bd81435..de32418 100644 --- a/src/handlers/schedule/index.ts +++ b/src/handlers/schedule/index.ts @@ -11,12 +11,14 @@ export const start = async (client: Client) => { const jobNames = await checkDirectory("schedules"); if (!jobNames) return logger.warn("⏰ No available jobs found"); - jobNames.map(async (jobName) => { - const job: IJob = await import(`../../schedules/${jobName}`); + return await Promise.all( + jobNames.map(async (jobName) => { + const job: IJob = await import(`../../schedules/${jobName}`); - return schedule.scheduleJob(job.options.schedule, async () => { - logger.verbose(`⏰ Performed the job "${jobName}"`); - await job.execute(client); - }); - }); + return schedule.scheduleJob(job.options.schedule, async () => { + logger.verbose(`⏰ Performed the job "${jobName}"`); + await job.execute(client); + }); + }) + ); };