@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?
Solution:Jump to solution
First of all, create takes 2 parameters and you provided 3. The proper syntax is
this.container.tasks.create({ name: 'name', payload: { huilde: member.guild, member }}, { delay: 9999999999 })
7 Replies
Solution
First of all, create takes 2 parameters and you provided 3. The proper syntax is
this.container.tasks.create({ name: 'name', payload: { huilde: member.guild, member }}, { delay: 9999999999 })
Readme is outdated I know
But it's always better to check the type definitions first, even if you don't use typescript (if you use vscode it still has some basic checking with them)
Ohhhh that explains a lot
I shall see if this fixes my issue
FYI If you want some basic QoL but still write JavaScript (as much as I would recommend typescript but you do you) you can create a tsconfig file and put this in, then you can continue to write JS but get notified of these kind of mistakes
(Assuming your files are in a directory called src at the bottom there)
That'll nudge the vscode TSServer to do some checking while you write
Eventually I will rewrite to typescript. I have been learning the basics to ts. The code is hosted on the root project directory, so would I change include to a
.
?Yes and add an exclude of node_modules
Yep that worked, thanks.