#Which type to use for context in scheduled task plugin error listener?

1 messages · Page 1 of 1 (latest)

brisk citrus
#

Currently updating my bot code to the new version of djs and sapphire.
i struggle to find the correct type that has this piece.nameproperty, any idea? I checked skyra but their implementation looks more complicated than what I want to achieve.

import type { Events, TaskErrorPayload } from '#lib/types';
import { Listener } from '@sapphire/framework';

export class ScheduledTaskErrorListener extends Listener<**Events.TaskError**> {
    public run(error: Error, context: **TaskErrorPayload**) {
        this.container.logger.fatal(`[TASK] ${context.piece.name}\n${error.stack || error.message}`);
    }
}
halcyon oakBOT
#

To help others find answers, you can mark your question as solved via Right click solution message -> Apps -> ✅ Mark Solution

nocturne steeple
#

Skyra doesn't use the scheduled tasks plugin at all

#

Or if you have your own impl of scheduled tasks then it's on you to set the context properly wherever you throw the error.

brisk citrus
#

awesome, thats what I was looking for