SylveonDev
SylveonDev
SIASapphire - Imagine a framework
Created by SylveonDev on 7/28/2024 in #sapphire-support
@sapphire/plugin-scheduled-tasks fails completely
Hello, I am looking to use the @sapphire/plugin-scheduled-tasks so I made a test script based off the documentation on the Github page. I rewritten the script in commonjs as I use that instead of ts. It does does not work well. It immediately fires instead of the duration as specified, it also doesn't pass any payload variables specified. Would I happen to be doing something wrong?
# The console output, which is empty
Iran {}
# The console output, which is empty
Iran {}
// This starts a task.
this.container.tasks.create('tempBan', { guild: member.guild, member }, duration);
// This starts a task.
this.container.tasks.create('tempBan', { guild: member.guild, member }, duration);
// The main thing itself
const { ScheduledTask } = require('@sapphire/plugin-scheduled-tasks');

class ManualTask extends ScheduledTask {
constructor(context, options) {
super(context, {
...options
});
}
async run(payload) {
console.log(`Iran`, payload);
}
}

module.exports = {
ManualTask,
}
// The main thing itself
const { ScheduledTask } = require('@sapphire/plugin-scheduled-tasks');

class ManualTask extends ScheduledTask {
constructor(context, options) {
super(context, {
...options
});
}
async run(payload) {
console.log(`Iran`, payload);
}
}

module.exports = {
ManualTask,
}
13 replies