Task
open class Task(var duration: Duration, val callback: suspend () -> Unit, var pollingSeconds: Long = 1, val coroutineScope: CoroutineScope = dev.kordex.core.utils.getKoin().get<Kord>(), val parent: Scheduler? = null, val name: String = "Unnamed", val repeat: Boolean = false) : KordExKoinComponent
Simple class representing a polling-based delayed task. Coroutine-based.
Parameters
duration
How long to wait until the callback should be executed.
callback
Callback to execute on task completion.
pollingSeconds
How often to check whether enough time has passed - 1 by default.
coroutineScope
Coroutine scope to launch in - Kord's by default.
parent
Parent Scheduler object, if any.
name
Optional task name, "Unnamed" by default.
repeat
Whether the task should repeat after completion. false by default.