createRepeatedTask(), how?

Any examples on how to create a repeated task? There is nothing in the documentation about it.
7 Replies
Fidelix
FidelixOP2mo ago
@beetle that's exactly what I'm asking. No examples on how to use createRepeatedTask() I wanted to create a task that repeats every x minutes for a given amount of times, with a delay for the first.
beetle
beetle2mo ago
where are you importing this function from?
Fidelix
FidelixOP2mo ago
this.container.tasks.createRepeated
Seren_Modz 21
Seren_Modz 212mo ago
pattern task example: https://github.com/sapphiredev/plugins/blob/main/packages/scheduled-tasks/README.md#pattern-task-example interval task example: https://github.com/sapphiredev/plugins/blob/main/packages/scheduled-tasks/README.md#interval-task-example as for the createRepeated function, the only thing i know of is that it takes an array of tasks (type of ScheduledTaskCreateRepeatedTask) -# unfortuantely, i don't use the scheduled tasks plugin so unable to help further than what i can see on github and the docs
Fidelix
FidelixOP2mo ago
Yeah, none of these work for what I want. I want to call a task with an initial delay of 5min, then run it 6 times with a 10 min interval.
『 PoroUsedSnax 』
I haven't used the plugin myself, but from what I do know of it, it seems like for your use case you could create a single task for your delay, with a payload of your repeated interval, then create a repeated task when that task runs You might have to track how many times the repeated task has run yourself and then cancel it after it's ran the number of times you want

Did you find this page helpful?