diff --git a/src/core/structures/default-services.ts b/src/core/structures/default-services.ts index 2700f1cf..a9581969 100644 --- a/src/core/structures/default-services.ts +++ b/src/core/structures/default-services.ts @@ -53,12 +53,9 @@ export class TaskScheduler implements Disposable { } try { const onTick = async function(this: CronJob) { - task.execute({ - deps, - id: uuid, - lastTimeExecution: this.lastExecution, - nextTimeExecution: this.nextDate().toJSDate() - }) + task.execute({ id: uuid, + lastTimeExecution: this.lastExecution, + nextTimeExecution: this.nextDate().toJSDate() }, { deps }) } const job = CronJob.from({ cronTime: task.trigger, onTick, timeZone: task.timezone }); job.start(); diff --git a/src/types/core-modules.ts b/src/types/core-modules.ts index f03b7956..a4dc9267 100644 --- a/src/types/core-modules.ts +++ b/src/types/core-modules.ts @@ -225,10 +225,7 @@ export interface SernSubCommandGroupData extends BaseApplicationCommandOptionsDa export interface ScheduledTaskContext { - /** - * An object of dependencies configured in `makeDependencies` - */ - deps: UnpackedDependencies, + /** * the uuid of the current task being run */ @@ -243,12 +240,19 @@ export interface ScheduledTaskContext { nextTimeExecution: Date | null; } +//name subject to change +interface TaskAttrs { + /** + * An object of dependencies configured in `makeDependencies` + */ + deps: UnpackedDependencies +} export interface ScheduledTask { name?: string; trigger: string | Date; timezone?: string; - execute(tasks: ScheduledTaskContext): Awaitable + execute(tasks: ScheduledTaskContext, sdt: TaskAttrs): Awaitable }