manual task compiler error
The heading might not be the best here but I tried searching and the docs but can't figure out what I am doing wrong. I used the scheduled tasks plugin. I've been using it for a while and my bot runs certain pattern tasks with no issue.
I want to create a manual task that deletes a message if it's deletable after a set period of time. I followed the directions here
https://github.com/sapphiredev/plugins/blob/1f0ca075501324013b7a79410ee4bc04ebad9720/packages/scheduled-tasks/README.md#manual-task-example
My compiler is giving this error: Expected 1-2 arguments, but got 3.ts(2554)
GitHub
plugins/packages/scheduled-tasks/README.md at 1f0ca075501324013b7a7...
Plugins for the Sapphire Framework. Contribute to sapphiredev/plugins development by creating an account on GitHub.
7 Replies
It's entirely possible that the readme isn't up-to-date. Other than the error TS also lets you go the symbol that you're calling (ctrl+click or right click and go to reference) and it'll open the .d.ts file and you can view the ptoper usage and adjust accordingly.
ok thank you I'll try that
this looks like it only takes the options or a number (delay I assume).
I see the change now though it's in the comments below and is done through module declaration
I updated to this but it still doesn’t allow you to provide the payload. I just skipped the task and use TimerManager.setTimeout to do it without
Yeah, it seems the readme isn't updated.
You have to provide the payload with the task name in the first argument
https://github.com/sapphiredev/plugins/blob/d6024cd53f8f1d085788dcc7037c72add8a9291c/packages/scheduled-tasks/src/lib/ScheduledTaskHandler.ts#L88
Solution
something like this:
I’ve been swamped at work but will try this thanks
That was it thanks again