Task_2
Base class for a task. A field doesn't keep its value between runs since each run gets a fresh instance.
Import it from @seedcord/plugin-tasks/gateway or /http to type this.core as your bot's Core.
\@RegisterTask()
export class Unban extends Task<{ guildId: string; userId: string }> {
public async execute(): Promise<void> {
const { guildId, userId } = this.data;
await this.core.rest.delete(Routes.guildBan(guildId, userId));
}
}Member visibility
Filter class members by access level.
constructor
Constructs a new instance of the Task class
Task_2(context: TaskContext<TData>)core
protected readonly core: TCoredata
The scheduled payload after its trip through the store.
protected readonly data: TaskData<TData>key
The task's key, from @RegisterTask or the class name.
public readonly key: stringlogger
Logs under the task's key, on the channel of the plugin's attach key.
protected readonly logger: Loggersignal
Aborts when the bot shuts down. Pass it to anything slow.
protected readonly signal: AbortSignalstartedAt
protected readonly startedAt: Datetrigger
protected readonly trigger: TaskTriggerexecute()
The task's work. The plugin logs a throw, publishes it as a failed taskRan, and passes it to onError().
onError()
Runs after execute() throws and the plugin has logged the error. If execute() throws after shutdown aborted signal, the plugin skips this.
onOverrun()
Runs in place of execute() when a protected task gets a cron or manual run before its previous run has finished.