onCooldown

inline fun onCooldown(key: String, length: Duration, run: () -> Unit): Boolean

Runs something if no cooldown is active and starts the cooldown after running it.

Return

whether run was executed.

Parameters

key

The key for this cooldown.

length

The length of this cooldown in milliseconds.

run

What to run if this cooldown is complete.