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

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}`);
}
}
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}`);
}
}
Solution:
GitHub
dragonite/src/listeners/scheduled-tasks/scheduledTaskError.ts at ma...
A Pokémon information Discord bot built around Discord Interactions - favware/dragonite
Jump to solution
4 Replies
Favna
Favna3d ago
Skyra doesn't use the scheduled tasks plugin at all
Solution
Favna
Favna3d ago
GitHub
dragonite/src/listeners/scheduled-tasks/scheduledTaskError.ts at ma...
A Pokémon information Discord bot built around Discord Interactions - favware/dragonite
Favna
Favna3d ago
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.
chillihero
chilliheroOP3d ago
awesome, thats what I was looking for

Did you find this page helpful?